AndresFreundTec,
@AndresFreundTec@mastodon.social avatar

I accidentally found a security issue while benchmarking postgres changes.

If you run debian testing, unstable or some other more "bleeding edge" distribution, I strongly recommend upgrading ASAP.

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

AndresFreundTec,
@AndresFreundTec@mastodon.social avatar

I was doing some micro-benchmarking at the time, needed to quiesce the system to reduce noise. Saw sshd processes were using a surprising amount of CPU, despite immediately failing because of wrong usernames etc. Profiled sshd, showing lots of cpu time in liblzma, with perf unable to attribute it to a symbol. Got suspicious. Recalled that I had seen an odd valgrind complaint in automated testing of postgres, a few weeks earlier, after package updates.

Really required a lot of coincidences.

Doomed_Daniel,
@Doomed_Daniel@mastodon.gamedev.place avatar

@AndresFreundTec
Awesome work!

Shows that stubbornly debugging weird issues (that many would probably just ignore as "oh, it's slower now, whatever, it still works well enough..") can pay out big time! :)

(Well, metaphorically at least, though I guess this also increases your worth on the job market)

ian,
@ian@hachyderm.io avatar

@AndresFreundTec Thank you.

arikb,
@arikb@mastodon.sdf.org avatar

@AndresFreundTec It's not coincidence - it's attention and perseverance. The Internet thanks you.

nea89,
@nea89@kitty.social avatar

@AndresFreundTec Moral of the story: if you write malware, write performant malware!

hyc,
@hyc@mastodon.social avatar

@nea89 @AndresFreundTec all non-performant code is malware

supergarv,
@supergarv@phpc.social avatar

@AndresFreundTec Gotta add to the noise, many thanks for digging into this. If it wasn't for you, who knows what could've been done here. You're a hero, and I mean it.

abartlet,
@abartlet@mastodon.nzoss.nz avatar

@AndresFreundTec I truly admire your skill, willingness to trust your gut and appreciate your doggedness and tenacity chasing this down.

The internet is a little safer because of you.

Thanks,

TTimo,
@TTimo@mastodon.social avatar

@AndresFreundTec jesus, I hope you like beer cuz we owe you a free lifetime supply.

phryk,
@phryk@mastodon.social avatar

@AndresFreundTec Thanks a whole bunch, excellent work and just in the nick of time to avert the worst consequences. <3

ButterflyOfFire,
@ButterflyOfFire@mstdn.fr avatar

Merci @AndresFreundTec 🙏

glyph,
@glyph@mastodon.social avatar

@AndresFreundTec I feel both confident and also kind of queasy when saying this: it seems extremely likely that this is not the first time something like this has happened, it's just the first time we have been lucky enough to notice.

lispi314,
@lispi314@udongein.xyz avatar

@glyph @AndresFreundTec That is true.

Binary artifacts have no business existing in Free Software (or near-binary considering how auditable pre-generated config scripts end-up being). The way it was compromised in this case is almost certain to have happened before and reminds me of the SourceForge malware debacle (so arguably that's another famous example of it happening before).

I"m not sure if many other projects do like Guix and record the checksum of the whole repository so as to ensure reproducibility purely from source.

glyph,
@glyph@mastodon.social avatar

@lispi314 @AndresFreundTec In general this is reasonable, but this there are some clear exceptions for test vectors in cryptographic libraries and compression libraries (which this was).

lispi314,
@lispi314@udongein.xyz avatar

@glyph @AndresFreundTec In this case the actual malicious vector was the near-binary injected code in the practical binary of the unaudited autotools vomit (always autoreconf) which was then bundled in the actual binary artifact that was the compromised tarballs.

None should have ever been part of the project.

As for the test files, I still think that having a hex dump with comments explaining what flaws particular parts test would be desirable in a lot of cases.

haploc,
@haploc@fedi.cr-net.be avatar

@AndresFreundTec amazing find, thank you

hikhvar,
@hikhvar@norden.social avatar
mainec,
@mainec@fromm.social avatar

@hikhvar @AndresFreundTec is anyone in touch with the original maintainer?

Given they were put under pressure before already I don't want to imagine their state of mind after the flurry of news in the past few hours.

Lennart01,

@mainec
https://tukaani.org/xz-backdoor/
They have published this website.
They have also listed contact info here:
https://tukaani.org/contact.html
Hope they are doing fine ngl.

AndresFreundTec,
@AndresFreundTec@mastodon.social avatar

One more aspect that I think emphasizes the number of coincidences that had to come together to find this:

I run a number "buildfarm" instances for automatic testing of postgres. Among them with valgrind. For some other test instance I had used -fno-omit-frame-pointer for some reason I do not remember. A year or so ago I moved all the test instances to a common base configuration, instead of duplicate configurations. I chose to make all of them use -fno-omit-frame-pointer.

AndresFreundTec,
@AndresFreundTec@mastodon.social avatar

Afaict valgrind would not have complained about the payload without -fno-omit-frame-pointer. It was because _get_cpuid() expected the stack frame to look a certain way.

Additionally, I chose to use debian unstable to find possible portability problems earlier. Without that valgrind would have had nothing to complain.

Without having seen the odd complaints in valgrind, I don't think I would have looked deeply enough when seeing the high cpu in sshd below _get_cpuid().

AndresFreundTec,
@AndresFreundTec@mastodon.social avatar

There are more coincidences that are even less interesting. But even the above should make it clear how unlikely it was that I found this thing.

AndresFreundTec,
@AndresFreundTec@mastodon.social avatar

Just to be clear: I didn't mean that I didn't do good - I did. I mean that we got unreasonably lucky here, and that we can't just bank on that going forward.

HydrePrever,
@HydrePrever@mathstodon.xyz avatar

@AndresFreundTec but there are thousands of devs running all sorts of tests. The question is not "what were the odds that you missed it", but "what were the odds that everybody missed it"...

gordonmessmer,
@gordonmessmer@fosstodon.org avatar

@HydrePrever @AndresFreundTec The odds that everyone missed it are extremely high. It actually triggered a bunch of test failures, which the attacker explained away as ifunc side effects, and a lot of people simply accepted that explanation.

cautiousguy_eu,
@cautiousguy_eu@bagarrosphere.fr avatar
implementcontrols,
@implementcontrols@mastodon.social avatar

@AndresFreundTec dont for a minute think that you are ever having a holiday again! We need you monitoring those timings! The world needs you! 🏅

jayreding,
@jayreding@mastodon.world avatar

@AndresFreundTec That was more than just good - you probably stopped a devastating attack on the whole industry. The open source community owes you a huge debt of gratitude. Had that exploit gotten into the wild it would have been awful. Catching it early was an immense win.

I hope Microsoft recognizes how much of a contribution you made to the entire industry.

eichin,
@eichin@mastodon.mit.edu avatar

@AndresFreundTec And a lot of persistence! Reminds me of one of the classics of the industry, Cliff Stoll's Cuckoo's Egg - "Stoll traced the error to an unauthorized user who had apparently used nine seconds of computer time and not paid for it" leading to a german hacker selling content to the KGB - 38 years ago. It is impressive (but uncommon) to see someone paying that level of attention to anomalies these days, with how thick tech stacks have gotten...

glyph,
@glyph@mastodon.social avatar

@eichin @AndresFreundTec the cuckoo’s egg is an excellent deep cut

regehr,
@regehr@mastodon.social avatar

@AndresFreundTec every internet user owes you a beer

ascherbaum,
@ascherbaum@mastodon.social avatar
upmultimedia,
@upmultimedia@mastodon.gamedev.place avatar

@AndresFreundTec You literally saved the internet and probably billions of dollars, well done

hyc,
@hyc@mastodon.social avatar

@AndresFreundTec intercepting RSA_public_decrypt implies it only triggers for RSA-based ssh keys. Glad I switched all my keys to ed25519 already.

silverwizard,

@AndresFreundTec Good job! You deserve a lot of kudos!

scottytrees,
@scottytrees@mastodon.social avatar

@AndresFreundTec yeah everyone is talking about it now on Fedora rawhide/41 testing as well.

gordonmessmer,
@gordonmessmer@fosstodon.org avatar

@AndresFreundTec Thank you so much for finding this!

The questions at the top of my mind now are: who will fork and continue maintenance of xz? How will we determine that we can trust them? And how will we apply those lessons throughout the larger ecosystem?

malte,
@malte@anticapitalist.party avatar

@gordonmessmer @AndresFreundTec i read that many projects migrate to zstd anyway ¯_(ツ)_/¯

gordonmessmer,
@gordonmessmer@fosstodon.org avatar

@malte @AndresFreundTec There's still a lot of data out there already in xz format, so merely dropping the software would mean that that data becomes unreadable. Dropping it may be an option, but I'm not sure it's the best option.

vwbusguy,
@vwbusguy@mastodon.online avatar

@gordonmessmer @malte @AndresFreundTec True, but xz isn't the only library capable of decoding lzma. 7-zip, for example.

aphistic,
@aphistic@advent.social avatar

@AndresFreundTec Great job, and great sleuthing!

CyrilBrulebois,
@CyrilBrulebois@mamot.fr avatar

@AndresFreundTec This is incredible work, thank you so much.

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