Just say the 'magic password': Boffins turn up potential backdoor in SQL Server 2012, 2014

Admin rights needed to fire up the malware and – hey presto!


Security researchers at ESET have published details of a backdoor into Microsoft's SQL Server via hooks and the splendidly named "magic passwords".

The backdoor, which targets SQL Server 2012 and 2014, has the ability to leave a miscreant with stealthy access to a compromised server, and forms part of the arsenal of a malware group dubbed "Winnti."

The Register spoke with ESET malware bod Mathieu Tartare about the research and the risk posed by backdoor.

Before any administrators get too panicked, it is important to note that actually getting the backdoor running on a server requires administrative-level privileges. If that's a risk in your organisation, you arguably have quite a bit more to worry about than someone blowing a hole in SQL Server authentication.

container_ship_hamburg_shutterstock_648

Microsoft wakes up, stretches, remembers: Oh yeah, we do Windows too. And lo, SQL Server 2019 Windows-based container emerges

READ MORE

However, assuming the nefarious code somehow finds its way into the directories of a SQL Server, it has the potential to leave a handy backdoor silently swinging in the breeze for bad guys to sneak in, copy, modify or delete data. This is assuming SQL authentication is being used and they know a username with sufficient privileges.

You did remember to do something about that default admin account, didn't you?

Oh, and the technique does away with phishing for passwords, so long as the attacker knows the "magic password" embedded into the malware. Unsurprisingly, ESET has redacted that particular nugget.

Dubbed "skip-2.0", the malware relies on being injected into a running process, in this case the venerable sqlserver.exe from where it grabs a handle to sqllang.dll and hooks multiple functions, principally those linked to authentication and event logging.

One function hijacked is CPwdPolicyManager::ValidatePwdForLogin, which validates the password for a given SQL user.

You can probably guess where this is going.

If the user enters the "magic password", the original function is not called and the user is connected. Worse, a global flag is set for the other hooked functions to pick up to silence event logging and auditing.

It's all a bit horrid and means that if you know the username of a SQL account, you can connect no matter how strong the admin thinks the password might be.

Of course, the approach does not work for Windows Authentication and, Tartare told us, will not work for disabled accounts.

There is some good news: as well as the level of privilege required to actually get the code required for this technique running on the server, it is also pretty easy to detect (for something that goes to such lengths to cover its tracks in SQL Server).

The success of the attempt to install the hook is written in cleartext to a logfile, hardcoded to C:\Windows\Temp\TS_2CE1.tmp\.

It seems a bit of an oversight on the part of the attackers. Tartare agreed, saying that it was "quite surprising" of the miscreants to leave the log file, but added that it was "usual to see some debug information in the malware – at the end of the day they are developers..."

We could think of an alternative name or two for the ne'er-do-wells.

Tartare told us that the exploit had been tried on other versions of SQL Server without success. He also added that if detected (by spotting that logfile or through an antivirus application) once the injection code was removed, a restart would clear the backdoor.

Unlike recent SSH backdoors (PDF), skip-2.0 is installed in-memory rather than needing an .exe modified prior to execution.

All told, it's a nasty and stealthy password bypass backdoor. However, to make it work administrative privileges are needed to actually install the thing and, of course, the attacker needs to know a valid SQL username. So a victim really would have all kinds of other security hygiene problems on their hands.

We asked Microsoft for its thoughts on the bypass, and a mouthpiece said: "This technique will only work on SQL servers that have already been compromised. We advise customers to ensure their systems have the latest security updates installed, to use strong passwords and to only expose MSSQL servers to the internet if necessary." ®

Similar topics

Broader 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