Drive-by Download: Javascript, ActiveX, and WScript for Automatic Execution in IE on Windows

Lately there has been a rash of drive-by download attacks which use a really cool attack vector that can be easily reused for penetration testing and phishing. This code is taken from a recent campaign, propagating by way of a FedEx scam phish, but is a much older malware technique which was even used in some of the earlier crypto-locker campaigns. The code uses javascript to build an ActiveX object, which both downloads an executable and then uses a WScript shell to run the executable. By including the following javascript code in an XSS link or phishing email you can easily get code execution from an unwitting user using Internet Explorer on Windows. Enjoy!!