scy,
@scy@chaos.social avatar

Eek. Apparently liblzma (part of the xz package) has a backdoor in versions 5.6.0 and 5.6.1, causing SSH to be compromised.

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

This might even have been done on purpose by the upstream devs.

Developing story, please take with a grain of salt.

The 5.6 versions are somewhat recent, depending on how bleeding edge your distro is you might not be affected.

HackyScientress,
@HackyScientress@chaos.social avatar

@scy archlinux has shipped the compromised version as before 5.6.1-2 they used the tarball to build the package. Version 5.6.1-2 uses the git repo.

The compromised versions were shipped on 24.02 and 09.03.

scy,
@scy@chaos.social avatar

Red Hat released an urgent security alert for Fedora 41 and Rawhide users:

> PLEASE IMMEDIATELY STOP USAGE OF ANY FEDORA 41 OR FEDORA RAWHIDE INSTANCES for work or personal activity.

https://www.redhat.com/en/blog/urgent-security-alert-fedora-41-and-rawhide-users

> Although Fedora 40 beta contained the 5.6 version of xz in an update, the build environment prevents the injection from correctly occurring, and has not been shown to be compromised. Fedora 40 has now reverted to the 5.4.x versions of xz.

scy,
@scy@chaos.social avatar

Red Hatter rwmj on https://news.ycombinator.com/item?id=39866275:

> the apparent author of the backdoor was in communication with me over several weeks trying to get xz 5.6.x added to Fedora 40 & 41 because of it's "great new features". We even worked with him to fix the valgrind issue (which it turns out now was caused by the backdoor […]

> He has been part of the xz project for 2 years, adding all sorts of binary test files

> with this level of sophistication I would be suspicious of even older versions of xz

Easy2063,
@Easy2063@chaos.social avatar

@scy The user (or whoever was behind that account) was seemingly also pretty active in other projects. The next couple of days are gonna be "interesting"... 😬

scy, (edited )
@scy@chaos.social avatar

Also, PSA for people who are immediately triggered by the word "systemd", partially blaming it for the issue:

No.

Some distros patch OpenSSH to link to libsystemd to call https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html to notify systemd about startup completion.

libsystemd then links to the backdoored lzma for other things.

But OpenSSH could've implemented the notification on its own. It's literally "send a line into a socket", only a few lines of code, even in C.

https://chaos.social/@smrqdt/112180465514002100
https://news.ycombinator.com/item?id=39866076

scy,
@scy@chaos.social avatar

Thanks to @erAck for pointing me to the Hacker News thread!

https://social.tchncs.de/@erAck/112180240179746418

scy,
@scy@chaos.social avatar

There is now a GitHub issue in the xz repository inquiring about whether this has been intentional or not.

https://github.com/tukaani-project/xz/issues/92

guenther,

@scy wow that github issue is a shitshow. racism begins at what is currently the middle of that thread.

f4grx,
@f4grx@chaos.social avatar

@scy Do people expect real info on such a public page? I expect only denial.

scy,
@scy@chaos.social avatar

@f4grx You seem to assume that this project only has a single maintainer, the attacker, which is not true.

f4grx,
@f4grx@chaos.social avatar

@scy Not really assuming anything. But as said "the cat is out of the bag" and it's important to notify people getting info via this channel, much more important than any denial or confirmation from the potential offender.

scy,
@scy@chaos.social avatar

Ugh, there is xz code in the kernel.

An open patchset from a few days ago has been put on hold.

https://lore.kernel.org/lkml/202403291221.124220E0F4@keescook/

via https://mastodon.social/@brauner/112180923169321849

scy,
@scy@chaos.social avatar

I'm not saying that it looks like someone has specifically targeted xz and played the long game by helping out a maintainer that was overworked and suffered from mental health issues

but it does look like someone has specifically targeted xz and played the long game by helping out a maintainer that was overworked and suffered from mental health issues

https://mastodon.social/@glyph/112180922900094371

m,
@m@ms.vg avatar

@scy Gibt es Informationen in leichter Sprache? Ist Debian betroffen? Was muss getan werden?

scy,
@scy@chaos.social avatar

@m Ich liege schon im Bett, aber:

Ich habe keine Links mit Infos in leichter Sprache.

Debian Sid und Trixie sind wohl betroffen. Also Testing und Unstable.

Debian Stable, also Bookworm, ist nicht betroffen.

Wenn du betroffen bist, solltest du die Pakete auf deinem System aktualisieren. Das müsste reichen.

positivedinosaur,
@positivedinosaur@twit.social avatar

@m @scy Soweit ich das sehen kann ist die Checkliste: hast du 'nen Rechner der mit SSH aus'm Internet erreicht werden kann? Und hat dieser Rechner die xz Bibliothek installiert mit einer Version 5.6.0 oder 5.6.1 (xz --version auf dem Rechner sagt es dir!)? Dann bist du womöglich betroffen. Sieh nach ob es 'n Update gibt!

ampoff,
@ampoff@chaos.social avatar

@positivedinosaur @m @scy Und, zumindest bislang die Erkenntnis, systemd-Systeme und glibc (wegen IFUNC). Homebrew hatte auch die Backdoor-Version, hatte aber, wie es aktuell scheint, keinen Trigger.

scy,
@scy@chaos.social avatar

@ampoff @positivedinosaur Oh, ist der Schadcode inzwischen vollständig durchanalysiert? Weil heute Nacht war der Stand noch "systemd/OpenSSH ist der eine Trigger, den wir kennen, wer weiß welche es noch gibt".

ampoff,
@ampoff@chaos.social avatar

@scy @positivedinosaur "wie es aktuell scheint" :) Diese Version, die ja wohl vom Adversary gepatcht wurde, hatte wohl eben diesen Trigger. Zu älteren weiß ich zumindest noch nichts.

scy,
@scy@chaos.social avatar

@ampoff @positivedinosaur Es geht nicht nur um ältere Versionen, sondern auch um weitere Trigger in der 5.6er-Reihe, von denen wir noch nichts wissen.

Nur weil wir einen Trigger erschlagen haben heißt das nicht, dass es keine weiteren gibt. Das ist es, was ich an deiner Formulierung irreführend finde.

"Hatte keinen Trigger" und "hat den Trigger, den wir kennen, nicht" sind zwei komplett unterschiedliche Dinge.

veronica, (edited )
@veronica@mastodon.online avatar

@scy The original maintainer seems to have burned out and handed it over a couple of years ago. It's a lot of responsibility resting on individuals, and it's certainly a weak point in open source to exploit. https://www.mail-archive.com/xz-devel@tukaani.org/msg00567.html

smrqdt,
@smrqdt@chaos.social avatar

@scy Is there any reason this couldn’t be the kind of pressure lots of open source maintainers receive from their users? I would apply Occam’s razor and prefer much simpler explanations. e.g. ”state actors forced/convinced the dev to help” or “talented rogue dev did it for fun/out of spite/to hack ex-partner”

The attack might be sophisticated, but IT security still is a garbage fire (again proofed by this).

scy, (edited )
@scy@chaos.social avatar

Meanwhile, is considering rolling back not only to the point before the backdoor was added, but to where the person who wrote the backdoor hadn't contributed any code to xz yet.

Which means considering creating patches to fix ABI breakage such a rollback would cause.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1068024

For all the trash talk Debian gets for being "pedantic" and slow to change: They put in the work to do things right. I respect that.

via https://hachyderm.io/@joeyh/112181512951127467

(Edit: English is hard.)

javerous,
@javerous@sourcemac.com avatar

@scy It looks a bit excessive to me. I understand that none of the commits from this guy was actually malicious (i.e. the GitHub repository is itself clean).

scy,
@scy@chaos.social avatar

@javerous You understand wrong.

The malware is in binary data, in the tests, in the repo.

It's only the trigger that's only in the release tarballs.

scy,
@scy@chaos.social avatar

Okay, you know what?

New goal.

I want to become a maintainer, taking care of some of the abandoned packages.

Not right now (I've got other things to take care of first), but I'll try working towards that goal in the coming months.

Because Debian is the basis of so much, yet ridiculously understaffed.

markus,
@markus@uxp.de avatar

@scy do we know though that the history before that point is unaltered?

I can't check whether there are any signed conmits...

smrqdt,
@smrqdt@chaos.social avatar

@markus @scy the debian project has an archive of every built package and its source: http://snapshot.debian.org/package/xz-utils/

scy,
@scy@chaos.social avatar

@smrqdt @markus Praise be to whoever decided to build such a thing instead of relying on "upstream is gonna be available and uncompromised forever".

Like, seriously.

We all should have way more copies of stuff.

markus,
@markus@uxp.de avatar

@scy @smrqdt (Looks at locked GitHub repo. Looks into the camera.)

ke7yxz,
@ke7yxz@mastodon.social avatar

@scy Is it not sufficient to review the older commits by the questionable actor rather than roll back?

scy,
@scy@chaos.social avatar

@ke7yxz Quoting the Debian bug report:

> any arbitrary commit by a known bad and malicious actor almost certainly has less value than the risk that a subtle change go unnoticed

Sure, they could. But is it worth it.

scy, (edited )
@scy@chaos.social avatar

Hell yeah #GitHub, that's certainly going to help the researchers who are working on the weekend trying to reverse engineer the #xz backdoor.

What a great idea. 🙄

Edit: This also deleted the project's GitHub-hosted website.

Mirrors of the repo can be found here:

https://hachyderm.io/@joeyh/112181981560074232
https://git.tukaani.org/?p=xz.git;a=summary

djh,
@djh@chaos.social avatar

@scy It seems like there's some very recent suspicious activity in Jia's zstd fork

https://github.com/JiaT75/zstd/branches/all

I really really hope GitHub keeps a mirror of that somewhere internally so we can check if Jia was hiding something similar in zstd?

scy, (edited )
@scy@chaos.social avatar

By the way, Debian keeps a copy of every package it has built, and the corresponding source code.

https://snapshot.debian.org/

Which comes in really handy if GitHub, you know, decides to just nuke upstream from orbit.

Keep more copies of stuff, folks. You never know when you might suddenly need them.

(This archive is currently a three-figure number of terabytes in size.)

scy,
@scy@chaos.social avatar

Please do not advise people to run xz --version or similar to check whether they're affected or not.

Right now, as far as I know, the analysis of the obfuscated malware is far from complete. There may be other triggers. There may be malware in older versions, because the attacker had commit access for years.

By running xz and asking it for its version, you're running what could be more malware.

Instead, ask the system's package manager which version of xz is currently installed.

chris,
@chris@strafpla.net avatar

@scy I was wondering about that, too, but I don‘t think that‘s a very likely scenario here.
Malware infected binaries presenting a wrong version number would be very easy to stumble upon by accident - and the code changes would be, too.
One does not put that much effort into injecting malware just to give it away like this.

scy,
@scy@chaos.social avatar

@chris You're missing the point.

It's not that it might tell me the wrong version number.

It's that xz is not particularly dangerous as long as it's just a bunch of files on my disk. It's when you execute the code in these files that it can do harm.

So don't execute it unnecessarily.

chris,
@chris@strafpla.net avatar

@scy Ah, ok, in theory you are right.
But has been executed many times since / if it was installed on our systems.
Not executing it now may feel good, but it does not make a difference, it’s still the same software that was executed a day ago, before we knew.
If I don’t execute it now for fear of some nefarious activity I must expect that this activity already happened.
So avoiding to execute it today only makes sense if I am about to reimage the system from scratch, immediately.

scy,
@scy@chaos.social avatar

@chris I agree that the probability of executing it one more time having negative effects is low, but it's not zero.

There might be dormant stuff in the malware, with a time-based trigger, or even a network-based one.

Is it likely? No.

Does something as trivial as finding out the installed version number warrant another execution? I'd say, also no.

Also, your distro might've patched the current vulnerability without changing the version number xz displays.

positivedinosaur,
@positivedinosaur@twit.social avatar

@scy I would agree and I see your point. However, the same would then apply to ssh. And that's a bit impossible then; how am I going to update my server if I can't ssh into it?

Fair enough though. Minimizing execution of the questionable library is not a bad idea.

scy,
@scy@chaos.social avatar

@positivedinosaur That's all I'm saying.

scy,
@scy@chaos.social avatar

Apparently the main maintainer, Lasse Collin (Larhzu), who was assumed to have simply been offline for the past 24 hours, has now started working on a post-mortem overview page of the incident.

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

> This page is short for now but it will get updated as I learn more about the incident. Most likely it will be during the first week of April 2024.

(via https://infosec.exchange/@jtk/112184732678532539)

joeyh,
@joeyh@hachyderm.io avatar

@scy in some cases the package manager links to the compromised library (liblzma). For example, apt does on debian.

scy,
@scy@chaos.social avatar

@joeyh Valid point, thanks!

In that case, you're probably screwed no matter what though ;)

mdione,
@mdione@en.osm.town avatar

@scy @joeyh you can always check the DBs by hand:

$ zcat /usr/share/doc/xz-utils/changelog.Debian.gz | head -n 1

outputs:

xz-utils (5.4.1-0.2) unstable; urgency=medium

scy,
@scy@chaos.social avatar

@mdione @joeyh But then if you have to actually uninstall/update, things might get hairy if you can't call your package manager ;)

mdione,
@mdione@en.osm.town avatar

@scy @joeyh you can download debs with wget and unpack them with other tools. It's long, but not difficult, and definitely scriptable. some 3-5 commands per package, some 3-5 packages in total?

mdione,
@mdione@en.osm.town avatar
scy,
@scy@chaos.social avatar

@mdione @joeyh And then you've extracted stuff on top of Apt-managed files without updating any of the associated data structures. It's not gonna like that.

My suggestion would be to install a safe version of Apt somewhere in /opt or something and use that. Or even do some chroot stuff from a rescue system.

Which is what I meant with "it gets hairy". It's not impossible, but not exactly trivial either.

mdione,
@mdione@en.osm.town avatar

@scy @joeyh right, but once you have versions you can trust, you can use them to download new version you can also trust. Of course, given that you can actually trust them.

mdione,
@mdione@en.osm.town avatar

@scy @joeyh You could even try to extract them not on top of your system but on a separate directory (/usr/local? /opt/emergency?) and play with $PATH and $LD_LIBRARY_PATH.

markus,
@markus@uxp.de avatar

@scy Yeah if anything the performative dislike of systemd enabled this pattern

smrqdt,
@smrqdt@chaos.social avatar

@scy it’s worse: systemd-notify support is a downstream patch applied by some distributors, because apparently openssh-portable doesn’t support it upstream

fedora: https://src.fedoraproject.org/rpms/openssh/blob/rawhide/f/openssh-7.4p1-systemd.patch
debian: https://sources.debian.org/patches/openssh/1:9.7p1-2/systemd-readiness.patch/

scy,
@scy@chaos.social avatar

@smrqdt Gah! That's painful.

Thanks for the correction, I'll see how I can edit this in.

scy,
@scy@chaos.social avatar
uncanny_static,
@uncanny_static@chaos.social avatar

@scy Sorry, I am not buying this argument. Instead of using the official systemd library, developers should default to implementing their own version of a systemd-specific lowlevel socket protocol?

scy,
@scy@chaos.social avatar

@uncanny_static In this case, I tend to say yes, because it's literally just writing the string "READY=1" to the Unix socket in $NOTIFY_SOCKET.

uncanny_static,
@uncanny_static@chaos.social avatar

@scy But why do you expect people to know that? The page you linked lists a bunch of C functions at the top. And people should know that they should ignore those and rather lookup the protocol and implement it themselves?

scy,
@scy@chaos.social avatar

@uncanny_static Let me give you a non black-or-white answer:

systemd could provide multiple smaller libraries instead of one monolith that links with everything.

Or prominently suggest users to implement sending the string themselves.

Or not provide a C function at all, having everyone call systemd-notify(1) in a subprocess.

The people who wrote that distro patch chose the easy way to add the feature to OpenSSH (a super high value target), instead of the "keep the attack surface small" way.

uncanny_static,
@uncanny_static@chaos.social avatar

@scy I am not saying that this attack has been solely enabled by systemd. Far from that.

However, I think it was a contributing factor. When you are interfacing with another piece of software the standard approach is to look for the official libraries and use them, if they exist. In this case, however, this drastically increased the attack surface. 1/3

uncanny_static,
@uncanny_static@chaos.social avatar

@scy Developers, in general, are not systemd experts and I do not think that they should be expected to know the inner workings of a systemd-specific protocol, even if it is that simple. Using the official library that implements such a basic functionality should not create a large attack surface. 2/3

uncanny_static,
@uncanny_static@chaos.social avatar

@scy IMHO, one of the lessons to be learned here is that such a functionality should be provided by a library that is as simple and small as possible, and not expect people to implement the functionality themselves despite there being officially supported libraries for that. That is just not how people work and "roll your own" is usually considered bad practice. 3/3

scy,
@scy@chaos.social avatar

@uncanny_static I don't think we really disagree. "Provide a simple and small library" was one of my suggestions, too, as was "prominently explain the simplicity of the protocol".

But you're right in that there's no use blaming anyone for linking to libsystemd now. We can just learn from it for the future.

bularator,
@bularator@norden.social avatar

@scy this does not affected OpenSSH.
It does affect and some other linux distros who work hard on maintaining their track record of breakpatching fine software.

scy,
@scy@chaos.social avatar

@bularator Look, there's only so many characters that fit in a toot. I can't explain why distros patch packages in 500 characters, and have some left to talk about the actual vulnerability.

For a normal user's understanding, OpenSSH is affected.

Also, if the software is so fine, why does it have to be patched in order to play nice with what's the default way to start daemons for years now?

bularator,
@bularator@norden.social avatar

@scy or, even more to the point: it's not an OpenSSH problem, it's a debian problem.
People using a better OS are not affected.

scy,
@scy@chaos.social avatar

@bularator Go take your elitism somewhere else. Blocked.

f4grx,
@f4grx@chaos.social avatar

@scy Thank you very much for the warnig.

scy, (edited )
@scy@chaos.social avatar

Saw this first on Lobsters:

https://lobste.rs/s/uihyvs

(Just for completeness, crediting your sources and stuff.)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • magazineikmin
  • thenastyranch
  • Youngstown
  • mdbf
  • rosin
  • slotface
  • InstantRegret
  • khanakhh
  • Durango
  • kavyap
  • osvaldo12
  • tacticalgear
  • GTA5RPClips
  • megavids
  • ngwrru68w68
  • everett
  • tester
  • ethstaker
  • cisconetworking
  • cubers
  • modclub
  • provamag3
  • anitta
  • normalnudes
  • Leos
  • JUstTest
  • lostlight
  • All magazines