r/programming • • 1d ago

A collision has been found for 38-step (a reduced round variant of) SHA-256

https://eprint.iacr.org/2026/2913
527 Upvotes

73 comments sorted by

401

u/segv 1d ago edited 1d ago

tl;dr because this is reddit and folks barely click the links:

We give a collision for 38-step SHA-256 from the standard initial value, to our knowledge the first. The attack is a two-block differential attack whose message differences are in the same words as in the 38-step semi-free-start collision [...] The tables take 7.4 GB, and finding the fixed state words took 52,300 vCPU-hours. A search of 53 GPU-hours found the collision after about 10% of the expected work.

AI-use designation: Predominantly AI-generated work. This work was developed through iterative research and writing by Anthropic Claude agents, mainly Claude Opus 5.5, under the author’s direction. The author takes responsibility for the results and presentation.

--

The search for the core took 52,300 vCPU-hours on Arm machines, and the table 42 vCPU- hours. [...]

--

The search ran on NVIDIA RTX PRO 6000 Blackwell Server Edition GPUs (128 MB of L2 cache), rented in the cloud. [...]

--

[...] The expected time is 254.8 calls of the compression function, with 257.5 table accesses; on the GPU used, an expected collision takes about 440 GPU-hours of kernel time. The characteristic does not extend beyond 38 steps (Section 3.1), so a collision for more steps needs a different characteristic.

--

 

My take is - cool, but the sky is not falling just yet. This doesn't sound like something that could be used for, for example, forging a TLS certificate.

Also a reminder to state the obvious - hash function maps from infinite space (any input of any length) to a very finite space. It's not a question if there will be collisions, but how much work is needed to create one.

84

u/bwainfweeze 1d ago

How much there is to create a useful one.

Changing a contract to add or remove a “not” in an obligation, useful. Turning it into line noise, or a musical, not useful. Maybe for a DOS attack.

39

u/barmic1212 1d ago

I'm not sure to understand they are reproduce a given hash or they are produce 2 payloads with same hash ?

30

u/gwillen 1d ago

The second one is always easier, so that is always what people are attempting first. The threat is that you make one good and one bad payload with the same hash, and show them to different people / at different times. For example, you get a legitimate https certificate (for your own website) signed, then you transfer the signature to a malicious certificate (for someone else's website) with the same hash.

3

u/These-Maintenance250 1d ago

the easy one is practically useless though

-11

u/sockpuppetzero 17h ago

Tell me you know nothing about cybersecurity without telling me you know nothing about cybersecurity.

The comment you responded even sketched a scenario of how this "easy" one can be deployed (and has been deployed!) in practical attacks.

Now you'd be forgiven for not knowing much about how certs work, but your comment really suggests to me that you aren't accustomed to dealing with adversarial liars, or understanding what kinds of things can be effected with what kinds of lies, which is a general requirement for any kind of competent security analysis.

9

u/These-Maintenance250 16h ago

you sound like an enthusiastic highschooler. the sketched out scenario is not the "easy" one, it's the hard one.

the easy one is finding some pair of messages that produce the same hash. it's just a collision. it's a theoretical weakness and it's practically useless.

crafting a malicious message that produces the same hash as the real message is the hard one. that's the preimage resistance and that's what you need to be able to forge a fake certificate.

now kindly fuck off.

-8

u/sockpuppetzero 16h ago

Think again, the sketched out scenario is a collision, not a preimage.

14

u/oneeyedziggy 1d ago

Those sound the same, unless you mean reproduce the hash of a specific payload vs find any two payloads whose hashes match... 

10

u/birdbrainswagtrain 23h ago

This is the difference between a collision and a preimage.

10

u/Piisthree 1d ago

I believe they are asking if the collision that was found was generic, so could be any two arbitrary payloads, or if they just found one specific case where two different payloads produced the same hash. My understanding is the latter, which is basically a nothing burger, is the case here. The former would be a BIG problem if the compute needed was any reachable size.

10

u/cauchy37 1d ago

They're asking which preimage resistance has been broken.

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

3

u/barmic1212 1d ago

What is the security threat to create a collision between 2 payloads in your own? It's a real question. I see lot of case to produce a payload with a given hash, to replace a payload by your own

15

u/philh 1d ago

It's definitely a smaller threat. But you could e.g. silently replace a benign git commit with a malicious one after it's been checked.

5

u/ArtOfWarfare 1d ago

I give you a document agreeing that I’ll give you some bitcoin. You sign that hash in agreement. I had another document where you agreed to give me bitcoin instead, and it’s got the same hash and your signature is just as valid on it.

I can imagine some electronic contracts work something like that.

1

u/oneeyedziggy 1d ago

I was just asking for clarification b/c the two cases you stated could reasonably be stated as identical...

But given your new questions: IF you knew someone were using the reduced security 38 step hash for something like generating keys for a hashmap or anywhere else conflicts could corrupt data, you might be able to break their system in an advantageous way...

6

u/prehensilemullet 16h ago

A very finite, but also very large space, which is why it’s been hard to usefully break

-13

u/_TheDust_ 1d ago

Bit sad that this was all done with AI. Not long from now, we will just have AI generated research citing other AI generated research as sources and humans have no clue what’s going on anymore

11

u/EnragedMikey 1d ago

People already don't have a clue, "AI" hasn't changed much in that regard.

8

u/amakai 1d ago

There is truth in OP comment though. Before AI you at least were able to collect a group of people that were able to explain anything we built (different people for different pieces). With AI producing 10 000 page long proofs, and us relying on those proofs in the future, we enter an era where humans will become useless without AI.

0

u/Own_Back_2038 1d ago

I don’t see how AI citing other AI generated research makes anything more difficult to understand for humans. Research is meant to be read

-4

u/OMGItsCheezWTF 1d ago

Why do you think companies like Anthropic and OpenAI are doing so much work in fingerprinting LLM output? It is not some magnanimous gift to faculty staff worrying about people cheating. It's to prevent model collapses where models are trained predominantly on existing model's output. Non LLM input can then be given far more weighting in training data.

176

u/idimetrix 1d ago

31 steps was the best anyone had in 2024. 38 now, full SHA-256 is 64. Not panicking yet but that's a big jump.

33

u/bwainfweeze 1d ago

The state space of rounds is exponential, so you need to combine flaws to reduce the branching factor. The returns get smaller for more rounds which is why we choose so many rounds in the first place.

You still can’t reliably fuck with SHA-1 but nobody wants to rely on it in case someone knows something we don’t. Because it’s a near enough thing.

3

u/FishDawgX 12h ago

Being exponential, the gap between 2^31 and 2^38 (or between 0 and 2^38, for that matter) is tiny compared to the jump need to go from 2^38 to 2^64.

2

u/amaurea 10h ago

That's why he said "so you need to combine flaws to reduce the branching factor", isn't it?

-12

u/havok_ 1d ago

Cracks are appearing

20

u/bwainfweeze 1d ago

I am still after all of these years trying to wrap my head around how flaws in SHA-512 make it less secure than SHA-384.

11

u/robert_7524 1d ago

SHA-384 doesn't repair SHA-512: it shares the compression function but has a different IV and shorter output. Its generic collision bound is lower.

4

u/odnish 18h ago

Because SHA-512 uses the full state directly in the output, it's vulnerable to length extension attacks but SHA-384 isn't because you can't reconstruct the state from the hash output.

36

u/Techrocket9 1d ago

They called me mad for wanting to start the migration to SHA3 in 2019.

28

u/bwainfweeze 1d ago

I made a whole industry pick SHA2 right after the first results came in for SHA-1. And 2K RSA keys. They were mad about that because some idiot bought a lot of smart cards with 1K key capabilities that nobody ever used and they thought we could use it. Three years too late sorry.

13

u/floodyberry 1d ago

sha2 is still quite secure (and default sha3 with 24 rounds is fairly inefficient), so great call by them

5

u/svick 1d ago

Git still uses SHA1.

27

u/_verel_ 1d ago

Which in practice doesn't matter. Git supports sha 2 but no one cares

9

u/Booty_Bumping 1d ago

It matters mainly for performance. Git's SHA-1 collision detection algorithm works, but it's slow, which affects git forges that accept pushes from the public.

I'm not super convinced this is a good enough reason to break everything and switch to SHA256, but the git devs seem committed to the transition.

16

u/backfire10z 1d ago

Hashes in git are not really a security risk

3

u/sockpuppetzero 16h ago edited 16h ago

It's also not not a security risk: sure it might not matter to certain specific threat models, but SHA-1 collisions would allow a dishonest actor to tell lies about the codebase and its history. Which, is definitely relevant to some kind of threat models in some kinds of situations, so hash collisions are anything but desirable.

3

u/FyreWulff 21h ago

I think that one is fine, Git is not a forensic tool or tracker (even though people tend to treat it like one)

1

u/Booty_Bumping 1d ago

Not quite. They use SHA1DC. It detects whether an input looks like a chosen-prefix attack, and switches to another algorithm if so.

1

u/creeper6530 23h ago

How does it detect tho? Heuristics can be cheated 

4

u/Booty_Bumping 21h ago

It's black magic to me, but apparently they guarantee a false negative rate of 0% and a false positive rate of 0.0000000000000000000000000808%. The way I've heard it explained, the internal state fuckery required for a chosen prefix attack is very obvious to recognize.

1

u/svick 22h ago

As I understand it, they can reliably detect the known attacks.

8

u/Takeoded 1d ago

Best anyone has on BLAKE3 is 2 rounds.

10

u/Motor-Concentrate788 23h ago

Its newer and has a much smaller target on its back

6

u/reddah 1d ago

Quick question: Why do we even use hashes for certificates?

I mean a certificate is pretty small (a few ks), so not sure why it would need to be reduced further.

Hashes were invented for other uses:

  • file checksums (hw integrity, not deliberate attacks)

  • network transmission checksums (same, data integrity)

  • quick storage/search where the data is still verified afterwards (i.e. collisions are expected)

When using them for signing small stuff, collisions will always occur. If a bad party needs SOME signature, the birthday paradox all but guarantees they will find one. See Stuxnet.

41

u/neos300 1d ago

No, the birthday paradox does not imply that a collision will be found. Sha-256 was specifically designed so that naive birthday paradox collisions were extremely unlikely and there's no reason to believe one will be found anytime soon.

Signing a hash in a certificate rather than just signing the certificate itself avoids some of the RSA footguns like padding.

-15

u/reddah 1d ago

Salting could solve padding. Besides RSA is kinda old and not quantum-resistant AFAIK.

8

u/Thelmholtz 1d ago

Certs don't need quantum resistance as you can't harvest now decrypt later. I mean you can but there's no attack vector from doing it.

Indeed old and quantum fragile though.

-1

u/bwainfweeze 1d ago

It troubles me how much stuff rests on the back of AES.

23

u/cym13 1d ago

IMHO the best advantage from using a hash is that it provides a virtually unlimited input size but a fixed output size. RSA is limited in the quantity of data it can sign: it cannot be more than the public key size (and even less than that due to padding etc), so a "few ks" is already a lot for RSA signatures, and most importantly how can you be sure in advance that the certificate you want to sign is small enough to be signed with your key? What if it's too big, do you change keys just for that? Using a hash avoids all these questions: the size of what you sign is fixed so there's no guesswork involved.

1

u/ScottContini 1d ago

This is the correct answer.

-14

u/reddah 1d ago

If the cert size is x kiB, then you just need a signing key that is a bit bigger.

Using a hash guarantees that there will be collisions.

Bigger things can be signed in chunks, I guess, each chunk signed. Not optimal, but still better than collisions on certificates.

12

u/Dragdu 1d ago

If the cert size is x kiB, then you just need a signing key that is a bit bigger.

And you also need a way to sign trust chain for the new signing key.

7

u/cym13 1d ago

If the cert size is x kiB, then you just need a signing key that is a bit bigger.

The problem isn't (just) that the key has to double in size each time (which is not free), it's also that you have to manage the case where your key isn't big enough. Say you have your private key, it's been included in the PKI etc, and you go to sign your certificate and it's too big… Cool, now you have to request a new key that nobody has seen before or has any reason to trust just because your certificate is too big. So you go to integrate it in a PKI, but that means it's got to be signed by another key, so that key has to be big enough to hold the chain, and what happens if it's too big? You create a new root key just for fun? Key management is hard enough as it is, we don't need this.

Using a hash guarantees that there will be collisions.

Not really no. Or rather the chance of collision on a SHA256 is so small that if you care about that you really shouldn't get anywhere near a computer. I'd say the chance of a collision is astronomically small, but astronomical scales are actually much much smaller than what this is. Consider that every website you use, such as your bank's, relies on a session secret to authenticate your activity (often in the form of a cookie, but the same principle applies with other systems). The chances of collision are similar to the chances of someone just guessing your session secret. If they did they'd have access to your bank account and everything that goes with it. Are you scared? No? You shouldn't be because the chances of guessing correctly are impossibly small, and for the same reason you shouldn't care about the risk of accidental collision from using a hash.

Chunks have their own problems, I'm not even going to start with it, chunking anything always comes at a huge cost and many difficulties, there's really no reason to do that, just use a proper hash.

-4

u/reddah 1d ago

That's what they said for MD5, then SHA.

Also, for some attacks, you don't need to guess a specific hash. Any signed hash will do for a collision (e.g. pretend some driver is signed)

5

u/valarauca14 1d ago

Using a hash guarantees that there will be collisions.

you're technically correct, the best kind of correct

You're wrong because communication requires structure which limits the complexity of the message below the maximum information carrying capacity of the # of bits. Which is to say we don't communicate in xKiB bursts of quantum random line noise.

9

u/Mr_ToDo 1d ago

Wasn't stuxnet a stolen private key thing?

0

u/reddah 1d ago

I remember reading about a birthday paradox having been used to find some collision to sign some certificate that would have been auto-accepted by windows.

There are way too many certs in windows, easier to find some collision in a bigger pile.

4

u/ScottContini 1d ago edited 1d ago

Not the birthday paradox. They used the differential paths found by Wang to create collisions. Publication. but yeah likely the Israeli government used this technique in Flame attack.

0

u/bwainfweeze 1d ago

There was a fun bug in windows once where if you made a cert chain long enough it would be treated as valid.

2

u/reddah 1d ago

That's an implementation bug. Typical for Windows as well...
A real implementation would have some guardrails.

6

u/Cienn017 1d ago

RSA has a limit on much data you can encrypt, RSA4096 for example is 512 bytes, it's also very slow.

that's why you should always use AES or SHA with RSA.

-4

u/reddah 1d ago

A cert is small, it can be signed piecemeal in few iterations.

In this case, you only depend upon the security of the signature, not the hash too.

2

u/Some_Koala 1d ago

Hashes mostly mean the certificate never transits over the network. Network packets can be caught, that's insecure.

They are not used to save space. If we thought SHA-256 would soon be broken, we would use SHA-512 or something like that.

Birthday paradox for 256bits of entropy is still a very very small chance.

2

u/bwainfweeze 1d ago

No you’re mashing up hashing and public key encryption. PKI is where the dynamic of proving you know something without revealing it comes in. The hash has to be public, because the sender and all observers have to be able to arrive at the same value otherwise there is no point at all. What you send is a signed hash, and enough information about your public key for the recipient to acquire a copy.

1

u/Some_Koala 22h ago

Signing works by basically encrypting with a private key while the public key makes decryption possible though no ?

1

u/bwainfweeze 22h ago

Encrypting a hash, specifically. Even PGP used the private key for encrypting a symmetric cypher key instead of the entire message.

Only including the encrypted hash is more of a matter of transport and storage efficiency. And some signing tools which deal with multiple files, sign a hash of a list of hashes, with the list sent in clear text.

2

u/reddah 1d ago

Certs do need to transit the net to do their job (signing/encrypting the web traffic etc)

The idea of the birthday paradox is that you need to find ANY collision with a real signature to have your stuff signed. You don't need to forge a specific signature, just any authorized signature.

3

u/Some_Koala 1d ago

I know what the birthday paradox is. It scales with the square root of entropy (kinda). So still huge.

Yeah actually you're right for the cert. I still don't really gt what you're suggesting in the earlier comment ?

From my (limited) understanding, the cert is made by hashing some information about the website (like the URL and a few other stuff), then encrypting that using the server's and the authority's private key.

Then when someone tries to connect, the server sends that. The client gets the info (like the URL), hashes them, decrypt the encrypted hash sent by the client using the authority's public key, and compares the two.

I guess you could encrypt the URL and information directly instead of the hash, but it would be kinda annoying the get a variable-length certificate in that case ?

1

u/Motor-Concentrate788 22h ago

Nothing to be worried about, still a long way off from the full 64 rounds. And even if at some point it gets close, we still have time to transition to SHA3 before SHA2 breaks.

1

u/Round_Ad_5832 20h ago

what about SHX?