HT to @wdormann here - somebody has backdoored the open source project XZ which has downstream impacts.

For example, although OpenSSH doesn’t use XZ, Debian patch OpenSSH and introduced a dependency which translates as the XZ changes introducing a sshd authentication bypass backdoor it appears.

One dude bothered to investigate in his free time about why ssh was running slow, so it was caught fairly early - i.e. hopefully before distros started bundling it.

https://www.openwall.com/lists/oss-security/2024/03/29/4

oss-security - backdoor in upstream xz/liblzma leading to ssh server compromise

Worryingly it looks like the backdoor comes via one of the two main devs and dates back over a month from their GitHub account, with legit commits too - XZ is used in systemd so this one might play out for a while.
I suspect distros probably want to roll XZ back to around January 2024, stop bundling updates until the developer is removed in GitHub or a logical explanation can be given, and somebody needs to fund a code review of it.

Here we go: https://www.bleepingcomputer.com/news/security/red-hat-warns-of-backdoor-in-xz-tools-used-by-most-linux-distros/

As I said, the impact here will be very limited due to how quick it was caught. Everybody owes the finder a beer.

Red Hat warns of backdoor in XZ tools used by most Linux distros

Today, Red Hat warned users to immediately stop using systems running Fedora development and experimental versions because of a backdoor found in the latest XZ Utils data compression tools and libraries.

BleepingComputer
Postgres developer @AndresFreundTec saving Linux security from backdoors as a side of desk activity
CISA advisory: Reported Supply Chain Compromise Affecting XZ Utils Data Compression Library, CVE-2024-3094 https://www.cisa.gov/news-events/alerts/2024/03/29/reported-supply-chain-compromise-affecting-xz-utils-data-compression-library-cve-2024-3094
The person/account on XZ repo also altered the security disclosure policy on that and other repos they author in months prior.
Interesting find by @fuomag9 - the XZ repo person tried getting Ubuntu to update yesterday by filing a bug report https://bugs.launchpad.net/bugs/2059417
Bug #2059417 “Sync xz-utils 5.6.1-1 (main) from Debian unstable ...” : Bugs : xz-utils package : Ubuntu

NOTE: THIS IS AN ATTEMPT AT INCLUDING A BACKDOOR. THIS IS LEFT FOR HISTORICAL PURPOSES ONLY AND MUST NOT BE DONE. Please sync xz-utils 5.6.1-1 (main) from Debian unstable (main) Hello! I am one of the upstream maintainers for XZ Utils. Version 5.6.1 was recently released and uploaded to Debian as a bugfix only release. Notably, this fixes a bug that causes Valgrind to issue a warning on any application dynamically linked with liblzma. This includes a lot of important applications. This cou...

Launchpad
The Twilight zone time - a bug from 2015 comes back around in XZ incident, it appears https://github.com/google/sanitizers/issues/342
Segfault in instrumented programs that use GNU indirect functions. · Issue #342 · google/sanitizers

Originally reported on Google Code with ID 342 What steps will reproduce the problem? 1. Testcase is attached. Compile with GCC with -fsanitize=address option. 2. Run. 3. What is the expected outpu...

GitHub
Multiple different XZ repos and website have been suspended by GitHub.

Back in 2022 a host of characters appeared and basically bullied the creator of the XZ project to hand it over to somebody else - at the time the guy cited mental health issues around not updating the project quickly.

At the time he was already talking about maybe handing over to the account who years later introduced the backdoor.

In mid 2023 said account introduced a change to Google’s OSS Fuzzer to weaken detection for XZ.

Somebody played a years long game of Jenga and lost.

Before everybody high fives each other, this is how the backdoor was found: somebody happened to look at why CPU usage had increased in sshd, and did all the research and notification work themselves. By this point the backdoor had been there for a month unnoticed.

I’ve made the joke before that if GCHQ aren’t introducing backdoors and vulns in open source that I want a tax refund. It wasn’t a joke. And it won’t be just be GCHQ.

https://mastodon.social/@AndresFreundTec/112180406142695845

Another two thoughts on XZ -

- sshd itself has no dependency on the XZ utils library. The streams got crossed in a way I don’t think anybody understood (except the threat actor).

- had that backdoor been performant with sshd, I don’t think anybody would have spotted it.

The way this played out opens a window of opportunity to go back and look at both issues.

Really good timeline of what is known to have happened so far. It looks like the rogue developer deliberately introduced a vulnerability in other package, too - I haven’t seen anybody else mention this.

Reading the dev’s GitHub history, they’ve been making changes to other open source projects too around compression. It also appears they/somebody involved has other accounts, too.

https://boehs.org/node/everything-i-know-about-the-xz-backdoor

Everything I know about the XZ backdoor

Please note: This is being updated in real-time. The intent is to make sense of lots of simultaneous discoveries

How far the rabbit hole goes - back in 2021 they deliberately introduced a risky change in the compression library libarchive. Nobody noticed. This is shipped in a ton of systems:
https://github.com/libarchive/libarchive/pull/1609

Whoever the threat actor is knows what they are doing as they’ve gone after chained dependencies around compression.

Added error text to warning when untaring with bsdtar by JiaT75 · Pull Request #1609 · libarchive/libarchive

Added the error text when printing out warning and errors in bsdtar when untaring. Previously, there were cryptic error messages when, for example in issue #1561, the user tries to untar an archive...

GitHub

If anybody thinks this kind of thing is unique, it isn’t.

Example - CVE-2021-44529 in Ivanti Endpoint Manager. The cause?

Backdoor in open source code, was there for 7 years.

https://borncity.com/win/2024/02/22/ivanti-endpoint-manager-vulnerability-cve-2021-44529-code-injection-or-backdoor/

XZ Embedded Linux kernel module for IoT devices, 10 days ago had a change submitted to add Jia Tan (backdoor author) as a maintainer.

https://lore.kernel.org/lkml/202403201[email protected]/

Linux kernel documentation: https://docs.kernel.org/staging/xz.html

The GitHub repository for XZ Embedded kernel module has also been disabled: https://github.com/tukaani-project/xz-embedded/

[PATCH 01/11] MAINTAINERS: Add XZ Embedded maintainers - Lasse Collin

Original maintainer of XZ repos has posted a short update:

https://tukaani.org/xz-backdoor/

HT @SamantazFox

XZ Utils backdoor

Dave Anderson (@[email protected])

The poor original maintainer of xz is on it now, and has already found another "fun" thing: https://git.tukaani.org/?p=xz.git;a=commitdiff;h=f9cf4c05edd14dedfe63833f8ccbe41b55823b00 . The configure check for enabling the Landlock sandboxing facility was subtly broken, so that Landlock support would never get enabled. The original malicious commit landed around the same timeframe as the main backdoor, also at an abnormal time of day compared to the new maintainer's historical activity pattern.

Hachyderm.io

Also since there’s a lot going on here, up thread I mentioned a 2015 minor bug in Google’s OSS Fuzzer (security testing tool) - the threat actor deliberately introduced the bugged function into XZ, then used that to get an exception in OSS Fuzzer’s code to stop scanning of XZ.

I’ve just been looking at the actual backdoor for a few hours with greater minds than me, it’s incredibly complex - it basically piggy backs RSA key RCE inside sshd as a Trojan horse. Somebody/bodies spent $$ on this.

Also, to be super clear nobody should panic about #XZ as the Postgres developer who found this basically caught it quick enough that almost no businesses or devices will be running the code.

So everybody should be chill about this specific issue as that guy saved everybody’s bacon.

To give an idea of the scale of OpenSSH usage, it’s absolutely huge, it dwarfs RDP by a huge margin (think ten times), and had this survived for a long period of time it would have been unbelievably bad.

The sshd backdoor in #XZ is just way beyond my technical ability. There’s so much there, I imagine more than a few conference talks are going to be submitted for it.

My amateur hour view is it’s really well put together (eg you can only execute commands if you have a private key that only the attacker has) and appears to allow remote removal of the backdoor, too. There’s a whole bunch of features which I’m too dumb to get.

Also for me, performance isn’t that bad - I wouldn’t have noticed it.

Kinda interesting - a change made by the threat actor has ended up in Windows OS. Redmond bundled libarchive into the OS, which the TA had been tinkering with.

This is the code change which has been imported: https://github.com/libarchive/libarchive/pull/1609

Edit: reworded this as the scope looks bigger than Win 11.

Added error text to warning when untaring with bsdtar by JiaT75 · Pull Request #1609 · libarchive/libarchive

Added the error text when printing out warning and errors in bsdtar when untaring. Previously, there were cryptic error messages when, for example in issue #1561, the user tries to untar an archive...

GitHub
I gotta say, the open source community response to the XZ issue and auditing code changes for the specific threat actor has been incredibly good overall.

4 days since XZ backdoor became public knowledge and most major Linux AV and EDR security vendors still have zero detections.. they haven’t even set the static file hashes as malicious.

Can’t wait for all the vendor blogs in a week saying they fully protect against the threat. 👍

The libarchive change has been rolled back as it introduced a low severity security issue, will go through usual process for updates.
Linux distribution versions impacted by #XZ backdoor (or not), best list I’ve seen: https://www.rapid7.com/blog/post/2024/04/01/etr-backdoored-xz-utils-cve-2024-3094/
Backdoored XZ Utils (CVE-2024-3094) | Rapid7 Blog

On Friday, March 29, developer Andres Freund shared that he had discovered an upstream backdoor in widely used command line tool XZ Utils (liblzma).

Rapid7

.@amlw wrote a great proof of concept for #XZ to allow code execution via ssh.

Very important note: it doesn’t work in the wild as you need the private key, which only the threat actor(s) have. But you can create your own for exploiting your own servers.

https://github.com/amlweems/xzbot

GitHub - amlweems/xzbot: notes, honeypot, and exploit demo for the xz backdoor (CVE-2024-3094)

notes, honeypot, and exploit demo for the xz backdoor (CVE-2024-3094) - amlweems/xzbot

GitHub

If you use Microsoft Vulnerability Management, it is false positiving on CVE-2024-3094 aka #XZ backdoor - it is picking up the Cygwin version of XZ as vuln on Windows systems.

The Cygwin packages predate the backdoor and it doesn’t impact Windows, also the file it flags isn’t the backdoor but lzmadec.exe

https://cygwin.com/packages/summary/xz.html

Cygwin Package Summary for xz

Really good timeline of #XZ backdoor, laying out everything known about what the threat actor was up to: https://research.swtch.com/xz-timeline
research!rsc: Timeline of the xz open source attack

Re #XZ attacker - the known threat actor account made various changes across multiple open source projects and documentation.

Library maintainers should not look at those changes in isolation of just that line change, or assume the threat actor only became malicious later. Assume they are very well resourced and acting with broad objectives.

In at least one case they made an existing unknown vulnerability exploitable, and we know they were socially engineering the XZ maintainer years ago.

‘They’ are very likely a multi million dollar operation - see also just the shell script analysis, before you even get to the backdoor (which is much more nuts) https://research.swtch.com/xz-script

The actual SSH backdoor is cryptographically signed so only the threat actor can use it. If you work in threat intelligence and write “foreign” intelligence agency, you might want to look at your bias training.

#XZ

research!rsc: The xz attack shell script

Really good presentation on the #XZ SSH backdoor from earlier in the year by @fr0gger

https://speakerdeck.com/fr0gger/the-xz-backdoor-story

The XZ Backdoor Story

This talk was presented at Defcon 32. https://defcon.org/html/defcon-32/dc-32-speakers.html On Fri, 29 Mar 2024, at exactly 08:51:26, OSS securit…

Speaker Deck
@GossiTheDog I am amazed how they took all that time to prepare and effort to hide all this, and then impatiently started pushing the distros in such a suspicious way.
@erlenmayr @GossiTheDog The next legit developer wanting a late inclusion into an LTS release will get such a shock...
@GossiTheDog doesn’t this all seem still a bit extreme though? Backdooring most of enterprise Linux systems on one go? Once the attacks started it would be discovered reasonably fast that the problem was in ssh so what’s the point? Do mass-wiper or mass-ransomware attack on one go and move somewhere warm with fat bitcoin wallet?
@GossiTheDog Sometimes I get told off for using the word "malfeasance" in my reports, but I feel like it absolutely applies in this case.
@GossiTheDog is it possible the XZ backdoor was what Zuckerberg had his team produce to get into Snapchat?
@Loucovey @GossiTheDog isn't the snapchat thing much older? Like 2016 or something?
@dancer_storm That's when Zuckerberg directed his team to start. #XZ has been underdevelopment for years.
@GossiTheDog Oh, that's really interesting.
@GossiTheDog Have you seen the Tukanni project installations on windows devices?
@GossiTheDog @amlw I do like that they had the good manners to secure their backdoor so that the riff-raff couldn't use it.

@GossiTheDog Curious that they marked Alpine Linux as not affected: Unit 42 links 5.6 versions prior to 5.6.1-r2 as impacted and the link also shows as much:

Threat Brief: Vulnerability in XZ Utils Data Compression Library Impacting Multiple Linux Distributions (CVE-2024-3094)

An overview of CVE-2024-3094, a vulnerability in XZ Utils impacting multiple Linux distributions, and information about how to mitigate.

Unit 42
@GossiTheDog Debian Sid (Unstable) and Trixie (Testing) was already patched yesterday. https://packages.debian.org/sid/xz-utils
Debian -- Details of package xz-utils in sid

@GossiTheDog Crap, I didn't realize that OpenSUSE MicroOS was rolling release.

And indeed, I had the backdoor installed on my server for a month.

Guess it's time to wipe the server and reinstall from scratch... It gives a good reason to check the backups and Ansible configs :v

@GossiTheDog They missed the point that 5.6.1 was in Debian trixie (testing) since March 5. None of the other versions, though.
*Edit:* It was 5.6.0, not 5.6.1. See https://tracker.debian.org/pkg/xz-utils
@GossiTheDog “Probability of exploitation activity in the next 30 days: 0.05%” so it seems efforts spent somewhere else would most likely wield better results despite this being a CVSS 10.0.
@GossiTheDog That'd blow up systems that haven't downgraded though, no? Detection would be nice, but would risk flooding analysts with alerts they can't do anything about 🤔 (not working on the EDR space, extrapolating)

@GossiTheDog

On the very first day I’ve submitted the static “test” files to ClamAV and VT. ClamAV response was:

Our initial assessment shows that this file is possibly clean. If you provided a description that suggests otherwise, we will further examine the sample & proceed from there.

On VT the detection rate was zero but you can at least add a comment and community ranking there, which I did. Now I see it’s detected by 7/60 and more community ratings were added.

@GossiTheDog it’s easter weekend, right? Give the vendors a break on their well earned vacations… attackers celebrate it too
@GossiTheDog Looking forward to all the vendor phone calls, emails and LinkedIn in mails.
@GossiTheDog isn't windows kind of a giant backdoor anyways with all the telemetry - i mean all os do it but i think windows is pretty active in this area. the story keeps growing to some extent - good qa by open source community in general

@GossiTheDog This is a pretty big wakeup call, to be honest.

I also wonder if they've managed to sneak in other code that has NOT been caught yet.

@GossiTheDog somewhere if this is true it would be somewhat funny and hopefully would put a stop to the whole 'opensource vs closed source security' debate

@GossiTheDog I think this was for the BSD tar executable, so you have to run the code deliberately:

C:\>tar.exe --version
bsdtar 3.6.2 - libarchive 3.6.2 zlib/1.2.5.f-ipp liblzma/5.2.5 bz2lib/1.0.8 libzstd/1.5.4

@GossiTheDog And we only know that because they re-used accounts/names for both code submissions, right?

That's a disturbing thought.

@GossiTheDog Well, Windows (at least 10) has tar. You could try Tavis' exploit. You'll have to do it in Terminal, though; I don't think that conhost (i.e., running CMD.EXE directly) supports ANSI sequences right off the bat. I remember having to do some magic when using those there.
@GossiTheDog It seems like deep supply chain attacks like this are going to be the thing for a while. This whole business is just totally depressing.
@GossiTheDog Damn, if it’s beyond your technical ability, a guy like me wouldn’t have a chance. I’m glad our servers here aren’t using the exploited version, but the thought is terrifying.
@GossiTheDog It's just half a second slower than normal. You won't notice it with a single login. The guy who discovered it noticed it because thousands of computers on the Internet knocking on his SSH door caused noticeable performance degradation.
@GossiTheDog but we shoud maybe panic at the number of other projects that may have been infiltrated by this actor under other names and have never beeen noticed?
@renchap @GossiTheDog that was also my question. If it happened with XZ, where else has it happened before?
@renchap @GossiTheDog GitHub had better be analyzing correlations with other user account activity and flagging any matches for review...
@GossiTheDog yeah, it could have run circles around EternalBlue if it was really deployed.
@GossiTheDog Is my understanding correct that from our current knowledge blocking access to sshd would prevent exploitation?
@sheogorath @GossiTheDog i saw a couple of people saying that the exploit is too obfuscated/complex to say that only sshd would be affected with confidence, yet.

@sheogorath @GossiTheDog ok. debian seems to be "confident enough" now 😁

https://fulda.social/@Ganneff/112190322996404954

Joerg Jaspert :debian: (@[email protected])

@[email protected] @[email protected] Confident enough.

Fulda.social
@GossiTheDog @theruran On top of that, for any given vuln, most vulnerable systems don’t expose it to the outside world. That’s not to say we shouldn’t address those vulns— we absolutely should —but we don’t need to panic about it.
@GossiTheDog Not very chill here 😱. IMHO just pure dumb luck prevented a nuke-equivalent exploding below our arses.
@GossiTheDog the attempt to get it into ubuntu 24.04 lts is the spooky part to me, that would have been a catastrophe if they got it in and then sat on it for a year. Kudos to the fedora and ubuntu maintainers for being suspicious about the urgency.
@GossiTheDog would you be willing to venture that this removes all non-nation state actors given the complexity?

@GossiTheDog @SamantazFox

I don't know which is the biggest crime: naming a product or service with a word of the English language, like "upstream", or mentioning that product or service in an article without capitalizing, changing the font, or qualifiying it -- as "software from upstream" rather than "software from Upstream" or "software from the /upstream/ site".

@JorgeStolfi @GossiTheDog @SamantazFox No one is mentioning a product or service called "Upstream" in any of these articles. They are using the word upstream which has a meaning in the software development context. You are the one who is mistaken :)

@0daystolive @GossiTheDog @SamantazFox

Blush. OK. Then the criminal charges are hereby reduced to a mere misdemeanor: use of confusing jargon. A few weeks of community service will do.