profile

ESPRESSO FRIDAYS

The Greatest Linux Hack Story of All TImes

Published about 1 month ago • 6 min read

Hi friends,

This is the story of how one mysterious hacker, took advantage of an inactive negligible library in Linux, and the maintainers emotional stress.

Slowly, week after week, bit by bit lines of seemingly random testing code were added, in front of everyone’s eyes, to the Linux upstream.

Thanks to one curious developer, who had an itch because of a tiny lag in his login process, sending him deep into the rabbit hole of Linux SSH and the mystic world of ZX, we would have never heard of this critical 10-graded security hole.


2 years earlier // 19 May 2022

A random developer starts shooting emails on the community board asking whether the niche XZ utility in Linux is still maintained.

They wanted to know whether they should update their own version because they now want new features.

What’s XZ?

Xz is a compression utility - similar in concept to making .zip files. Its main use is lossless compression for command line utilities, which is to say that it guarantees when it is uncompressed the result is a byte-for-byte clone of the original data. It’s used by a lot of important security software, and is included as a library for many other utilities. A library is just a term used for tools used by other tools.

The core maintainer “Lasse” then says that he’s not actively working on it but if bugs will be reported he’ll make sure they’re fixed.

He also says that he know this isn’t not optimal but towards the end mentions a developer by the name “Jia Tan”, saying they were a big help with XZ utils and “might have a bigger role in the future…”:

Jia Tan has helped me off-list with XZ Utils and he might have a bigger
role in the future at least with XZ Utils. It's clear that my resources
are too limited (thus the many emails waiting for replies) so something
has to change in the long term.
- https://www.mail-archive.com/xz-devel@tukaani.org/msg00563.html

Others respond as well with questions until one guy, pops out of no where, his name is “Jigar Kumar” and he’s making very pushy comments towards a new maintainer, saying that people should either fork or establish a new leader, finishing by saying it’s “sad to see … a repo like this” in his words.

The same Kumar goes on in another reply to say that he “doubts we’ll see a release this year”, telling the maintainer that “you ignore the many patches..” and “you choke your repo”:

With your current rate, I very doubt to see 5.4.0 release this year. The only
progress since april has been small changes to test code. You ignore the many
patches bit rotting away on this mailing list. Right now you choke your repo.
Why wait until 5.4.0 to change maintainer? Why delay what your repo needs?
- https://www.mail-archive.com/xz-devel@tukaani.org/msg00568.html

Months later, a security researcher will start questioning the identity of this “Kumar” and how he emerged out of no where and disappeared off the face of the earth just as fast.


Related or not, “Jia Tan” keeps working and slowly, unofficially, becomes the de-facto maintainer of XZ utils. A small compression library, used by every major Linux distro.

Over two years “Jia Tan” added changes, slowly, bit by bit, with commits that didn’t come up on any radar:

They even contributed a PR that was merged into Google’s oss-fuzz project to disable information coming up from the library.

Google’s project’s purpose is “uncovering programming errors in software… (that)… can have serious security implications” 🤔 https://github.com/google/oss-fuzz/pull/10667

He then went on and used yet another alias to ask for XZ updates from the community, pushing the fixes even further. Fixes, that will soon be identified as a backdoor in the Linux SSH protocol.

The back door part comes into play with one of the main ways xz is used - SSH. SSH is an encrypted protocol between two machines where text commands can be exchanged, allowing a user to interact with a server. It’s a very common utility in the Linux world and the security of this communication is critical. The back door means that the connection is no longer private and could allow an attacker to insert their own text commands into the secure connection.


Fri, 29 Mar 2024 08:51:26 -0700

Andres Freund, A software developer at Microsoft, randomly notices “odd symptoms” when his SSH login process took a tiny bit longer. How much? 600 milliseconds. 600 milliseconds between the world, and one of the greatest zero-day Linux vulnerabilities ever found.

Andres noticed the CPU levels went noticeably higher than expected and went down the rabbit hole, investigating the library leading to the issue and reporting his findings with a clear message:

“The upstream xz repository and the xz tarballs have been backdoored”
- https://lwn.net/ml/oss-security/20240329155126.kjjfduxw2yrlxgzm@awork3.anarazel.de/

The reason this was ever discovered is that the injected code was heavily reliant on in-memory computational processes, which replaced symbols in real time, effectively allowing other parties in on the SSHd process.

Quoting Andres again : > “This is the quite slow step that made me look into the issue.”


The next day 2024-03-29

The news blow up, every major news outlet, security news, Linux distros and even cloud providers started sharing the news, either covering the story, urging users to update their systems.

Keep in mind this is still VERY fresh. New information is discovered by the minute. And while the project is already disabled on Github, if you follow the news closely you’ll keep getting updates revealing information over this absolutely crazy story.

It’s still unclear who’s the mysterious Jia Ten, whether the other names are aliases or maybe, maybe, this is a nation backed actor, or even a group, slowly building their own zero days vulnerability into one of the worlds most sensitive protocols!


What should you do?

The silver lining here, is that staying out of the infection zone is rather easy, downgrade of upgrade from the infected version, or just upgrade your linux to latest will solve the problem. Moreover, Not all distros even use the compromised library, it’s mostly Debian but others as well. If you want to be 100% sure, as said - just upgrade and you’ll be fine.

Moreover, in the majority of cases the vulnerable version didn’t get released into any major stable version so most users should be safe, but it’s still wise to monitor the situation and make sure all systems and utils are up to date.

What can we learn from this?

  1. The hard lesson we get to re-learn every year: Open source is not magic, nor a security guarantee! We’ve all seen the implication of the “everything npm” package earlier in 2023 which as only a joke that got out of hand, but famous other vulnerabilities like log4shell and the often forgotten heartbleed bug (https://heartbleed.com/) should have taught us to not trust every package even if it’s coming from a famous upstream, or your local package manager!
  2. Focused engineers save lives. yes, I took it this far, focus is critical, and curious engineers like Andres saved the day / year for MAJOR system’s most of us aren’t even aware of. I can come up with a bunch of critical civil infrastructure running linux what would have surely got infected with this at some point, and if not for Andres this could have never even come up.
  3. Does this make you think of how many exiting bugs like this we currently have without even knowing? How many zero day bugs are out there ready to be used?
    Systems are not as safe as they seem to be, and this is great reminder! I hope you enjoyed this, and I’ll see you on the next one!

Special thanks to Andres, who was diligant, focused and curious enough to help the world fix one of the worst malicious bugs ever! Be like Andres!

Links:

Thank you for reading, I hope you liked it, and maybe even learned something new.
Enjoy your weekend!

Whenever you’re ready, here’s how I can help you

ESPRESSO FRIDAYS

Every once in a while I send hand picked things I've learned. Kind of like your filter to the tech internet. No spam, I promise!

Read more from ESPRESSO FRIDAYS

Hi friends! This week, I want to delve into a topic that many of us overlook: typing. Often, people just wing it with whatever typing habits they’ve developed over time. But it doesn’t have to be this way. Mastering fast typing and knowing the keyboard by heart can make everything quicker, more productive, and fun. It allows for better focus and significantly improves the quality of work. Touch Typing The first step in adopting the right system is touch typing. Learning touch typing is...

1 day ago • 1 min read

Hi frieds, The question posed in the title is likely the one that keeps many developers and engineering leaders up at night these days. The short answer is no. I recently came across two fascinating blog posts about AI’s impact on software development. The first was from the renowned “The Pragmatic Engineer” blog, and the second from Sequoia Capital, a major venture capital firm with investments in giants like Google, Apple, and Oracle. Here’s a brief rundown of the key insights: Ask any CEO...

9 days ago • 2 min read

Focus is a huge problem in modern days. These days, lots of apps and websites try to grab our attention and keep us hooked. Most of us know we should resist these distractions. But instead of making a plan, many people just wing it. I used to do that too. But I’ve had enough. Another Instagram post, YouTube short, or funny meme won’t make me feel good about my day. In fact, they: Make my workday longer. Slow down my progress, bit by bit. So, I put together some tools and rules to help me stay...

16 days ago • 3 min read
Share this post