All articles

SHA-1 was only theoretically broken for twelve years

An AI model found a quantum attack on the encryption the web just moved to, and its reviewers called it galactic. What RSA-129, DES, MD5 and SHA-1 say about how long a theoretical attack stays theoretical, and three guesses about this one.

On Thursday I asked my own web server a question I’d never asked it before: which key exchange are you using? Finding out took a sixty-line script, because the OpenSSL on my PC dates from 2021 and didn’t recognize the name I was looking for. The script opened a connection to hrih.si and printed what the two sides had agreed on. The answer was X25519MLKEM768.

That mouthful is the post-quantum one. (Cryptographers don’t have a marketing department.) Half of it is X25519, the elliptic-curve exchange browsers were already using. The other half is ML-KEM, a standard NIST finished in August 2024 and built so that a future quantum computer can’t undo it.

If you looked through this site’s deploy folder, you’d find nothing that mentions it, because I never turned it on. The site runs on Caddy, Caddy is written in Go, and Go has offered this exchange by default since February 2025. So as far as I can tell, it was already there the day I put the site online in October, and nobody asked me.

The timing was a little awkward. Three days earlier, Anthropic had published a 283-page paper, found by an unreleased Claude model, describing a new quantum attack on the mathematics underneath ML-KEM. My server had a lock I didn’t know about, and it was already in the news.

The week leading up to that paper had been a strange one. On Saturday a post on X said rumors had a frontier AI lab cracking 2048-bit RSA, one of the two older systems all this is meant to replace. Elon Musk replied on Sunday that he’d heard the same from a few people, and on Monday Cloudflare’s shares closed up 11.8%. When the paper came out that night, RSA wasn’t in it at all. Its title calls the algorithms “galactic,” which is computer-science slang for fast on paper and far too slow to ever run.

Theoretical, in other words. I’ve heard that word about attacks before, so I went to check how it held up the other times.

What was actually published

Anthropic put four papers up on GitHub on the evening of 30 November, and only the first matters here. In plain words, it claims a quantum computer can solve a family of lattice problems much faster than anyone knew, and those are the kind of problems ML-KEM rests on. So does ML-DSA, the signature standard that goes with it.

That word faster needs a large asterisk. The smallest sizes of these standards are built to take about 2^128 operations to break, a number nobody can reach. The new attack needs a quantum computer with at least billions of logical qubits (the error-corrected kind), by Cloudflare’s count, when today’s machines have something on the order of thousands. Even on that imaginary machine, the paper’s reviewers say 2^1000 operations wouldn’t come close to breaking the smallest size of either standard. So the new attack is far slower than the ones we already had, and Anthropic’s README says as much: the speed-up only shows up at sizes nobody deploys.

Those reviewers are 21 outside cryptographers, the Cryptography Incident Review Group, and their assessment came out the same night. It agreed the attack falls far short of the standards, and it added that it’s reasonable to expect the attack to be improved in the near future. Trail of Bits, asked whether the result breaks the standards, answered “Not yet.” and told people deploying them to do nothing for now.

That advice was a day old when the tone changed. On 2 December the NSA told the owners of national security systems to “immediately accelerate” their move to post-quantum cryptography. A joint statement from the NSA, CISA and the National Cyber Director said AI companies had disclosed discoveries affecting some cryptography in use, and that there was no immediate and widespread threat. Eight big tech companies backed the call, and on 3 December Cloudflare pulled its deadline for being fully post-quantum from 2029 to 2027.

So the attack would need more resources than our galaxy has (that’s Cloudflare’s reckoning), it targets the new standards, and the official answer is to move to the new standards faster.

Some of that is easy to explain. What ML-KEM replaces is RSA and elliptic curves, and a quantum computer breaks those with far less effort, so staying put is worse. Some of it may be that the government knows something the papers don’t say, which I’ll come back to. The rest, I think, is history.

Forty quadrillion years

In August 1977, Martin Gardner used his Scientific American column to introduce a new kind of cipher invented by Ron Rivest, Adi Shamir and Leonard Adleman (the R, the S and the A of RSA). He printed a 129-digit number and offered $100 to anyone who could factor it and read the message it protected. He also printed Rivest’s estimate. Factoring a number of 125 or 126 digits, a little shorter than the one on the page, with the best algorithm and fastest computers of the day, would take about 40 quadrillion years.

It took sixteen years and eight months.

In April 1994, four researchers announced that they and about 600 volunteers in more than twenty countries had factored it, after eight months of computing. The message read THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE.

Even for 1977, that estimate was high. MIT’s news office reported in 2011 that Rivest called it a bit of an overestimate, and if you run the formula from the RSA paper’s table for a number that size, you get somewhere between 11,000 and 23,000 years. But 11,000 years isn’t sixteen either. The method that did the job, the quadratic sieve, came to Carl Pomerance early in 1981. The algorithm that beat the estimate didn’t exist until more than three years after the estimate was printed.

An estimate like that can only price the best attack anyone knows on the day it’s written. It can’t include the attack somebody thinks of next. (In 2015 a programmer named Nat McHugh factored it again on rented cloud machines, in about a day, for about $30.)

“Galactic” is that kind of number too. Richard Lipton and Ken Regan gave the word its meaning in 2010, for algorithms that look wonderful on paper and never get used to compute anything. Back then Lipton wrote that Shor’s algorithm, the one that would factor RSA’s numbers on a quantum computer, was galactic for now. He also noted that galactic algorithms have several times been improved into practical ones.

Twelve years of theoretical

SHA-1 is the case with the best records, and it shows two clocks running at once: how fast an attack improves, and how fast everyone moves off the thing it attacks.

It’s a hash function, meaning it turns any file into a short fingerprint, and it became a US standard in 1995. In February 2005, Xiaoyun Wang, Yiqun Lisa Yin and Hongbo Yu circulated a paper showing how to find a collision, two different inputs with one fingerprint, in 2^69 operations instead of the 2^80 that brute force needs.

Nobody had 2^69 operations to spare. Bruce Schneier wrote that week that the attack sat at the far edge of feasibility and ordinary users had no cause for panic. He also wrote that it was time to move off SHA-1, and passed on an old saying from inside the NSA: “Attacks always get better; they never get worse.”

They got better. By that August the claimed number was 2^63, and the following year NIST told US agencies to stop using SHA-1 for signatures after 2010. Then the price tags started. An Intel researcher named Jesse Walker worked out in 2012 what a collision would cost in rented computing: about $2.77 million that year, falling to $700,000 by 2015 and $173,000 by 2018. He was too cautious. In October 2015 a team that had just broken SHA-1’s core put the full job at $75,000 to $120,000.

The second clock, meanwhile, was barely ticking. In January 2014, nine years after the attack and three after NIST’s date, 98.8% of the sites in the SSL Pulse survey had a certificate signed with SHA-1. Ninety-eight point eight. It was 82.1% that October, when the certificate authorities and browser makers voted to stop issuing them from 2016, and after the vote it fell quickly: 51% in April 2015, 13.2% in January 2016, 1.5% in January 2017.

On 23 February 2017, a team from CWI Amsterdam and Google published the first real SHA-1 collision. It took 9.2 quintillion SHA-1 computations, which they put at 6,500 years of processor time and 110 years of graphics-card time. Chrome had stopped accepting SHA-1 certificates a few weeks earlier. Firefox switched them off for all its users the day after.

That was twelve years from theoretical to done, and for the web’s certificates the two clocks finished within weeks of each other. You can’t cut it much closer than that.

Everywhere else SHA-1 isn’t finished, and by 2020 the stronger kind of collision, the kind you can forge things with, cost about $45,000. NIST’s final date for it is 31 December 2030, nearly 26 years after the first attack. And I have some in the room with me. I ran git rev-parse --show-object-format in this site’s repository and it printed sha1, so every commit behind this page is named by a SHA-1 hash. Git has used a hardened version since 2.13 and plans to make SHA-256 the default for new repositories in Git 3.0. (My SHA-1 migration is going about as well as everyone else’s.)

MD5, an older hash function, went down that road first. Hans Dobbertin found collisions in its core in 1996 and wrote that this didn’t yet threaten real applications but came rather close. Full collisions arrived in 2004. In December 2008 a team used more than 200 PlayStation 3 consoles to forge a certificate authority that browsers would trust. Then in 2012 the Flame spyware turned up carrying a forged Microsoft code-signing certificate, made with an MD5 collision technique no academic had published. Sixteen years after the warning, somebody was using it in the field.

DES is a different sort of case, because nobody needed a clever attack. It became the US encryption standard in 1977, and that year Whitfield Diffie and Martin Hellman priced a machine to try every key at about $20 million and about a day. Twenty-one years later the Electronic Frontier Foundation built one for under $250,000 and found a key in 56 hours. The attack was the one from 1977. The hardware got cheap.

The ones that stayed theoretical

I’d be cheating if I stopped there, because plenty of theoretical attacks stay that way.

The best example is AES. In 2011 Andrey Bogdanov, Dmitry Khovratovich and Christian Rechberger published an attack that needs 2^126.1 operations for AES-128, against 2^128 for brute force. That’s less than a factor of four. Fifteen years on, nothing has improved on it. NIST’s 2021 review says this kind of attack beats exhaustive search only by a small constant factor. AES is fine.

Sometimes the alarm is plain wrong. In April 2024 Yilei Chen posted a quantum algorithm for lattice problems that looked, for a few days, like serious trouble for the lattice family ML-KEM belongs to. Eight days later he added a note saying that one step “contains a bug, which I don’t know how to fix.” (I have a lot of sympathy for that sentence.)

So some of these attacks turned real, in anything from eight to twenty-one years. Some never moved, and one was a bug. In February 2005 nobody could have told you which of those the SHA-1 attack would be. Schneier’s advice didn’t depend on knowing. No panic, he said, and start moving.

What’s different this time

Getting SHA-1 from 2^69 to an actual collision took a handful of specialists twelve years, and Marc Stevens, a cryptanalyst at CWI, has his name on most of the steps.

This July went differently. Anthropic reported that a Claude model had found a key-recovery attack on HAWK, a signature scheme then in NIST’s queue of candidates. On the smallest size it cut the work from 2^64 to 2^38. Anthropic says that took about 60 hours over a week, with one researcher giving occasional guidance, and the HAWK team withdrew the scheme the next day. (HAWK was a proposal nobody had deployed, and its larger sizes stayed out of reach.) The cryptographers who reviewed the lattice paper say they used AI models too, to tighten the attack and estimate its cost.

On the night of the release Scott Aaronson, a computer scientist at the University of Texas, wrote that we now live in a time when decades of mathematical research happen in weeks. Cloudflare was drier about it. AI, it wrote, only changes how fast you find out whether a system is secure.

If that’s right, and it’s early to say, the first clock now belongs to researchers you can rent by the hour.

The other difference is what we moved to. Lattice schemes come in two flavors, structured and unstructured, and the structured kind has extra algebraic regularity that keeps keys small. An ML-KEM-768 public key is 1,184 bytes. FrodoKEM, the unstructured candidate NIST passed over for its performance, needs 15,632 bytes at the comparable size, about thirteen times as much. NIST said in 2022 that it picked the structured design for its comparatively small keys and its speed.

At 2022’s prices, that was a reasonable trade. But the regularity is also what the new attack uses, and by Anthropic’s account the three other papers it released that night make the unstructured kind look sturdier. Aaronson says back in 2022 he kept asking people why we’d “dance on the ledge” when we could accept bigger keys, and never got an answer that satisfied him. I wrote in October that every architecture is a receipt for the prices of its day. This receipt is dated 2022, and it says bytes were expensive and doubt was cheap.

There are hedges. Browsers don’t use ML-KEM alone. The X25519MLKEM768 my server answered with is a hybrid, built so your connection holds as long as either half does. If somebody found a flaw in ML-KEM that works on ordinary computers, the X25519 half would save you. It wouldn’t save you from a quantum computer, which breaks X25519 anyway, and this attack is a quantum one. For that case NIST picked a backup built on different mathematics, HQC, in March 2025, but its standard hasn’t been published even as a draft. The reviewers asked standards bodies to prioritize more diverse designs, even at some cost in efficiency.

All of that is key exchange, the part that keeps a recorded conversation secret. The other half of a connection, proving who you’re talking to, has barely started. My server’s certificate uses an elliptic-curve key on the P-256 curve, with an elliptic-curve signature (ECDSA) from Let’s Encrypt. Any large enough quantum computer breaks that. The post-quantum replacement, ML-DSA, has signatures of 2,420 bytes where ECDSA’s are 64, and Chrome estimates a straight swap adds about 14 kilobytes to every connection. Its answer is a new certificate format, which it plans to trust from the third quarter of 2027.

Which brings me back to the second clock, the one we control. The share of browser traffic reaching Cloudflare with post-quantum key exchange went from about 2% in early 2024 to 73% this week, because browsers update themselves. My server got it by that route too.

Where each operator has to do something, it runs at the old speed. Only 29% of the servers behind Cloudflare support the new exchange when Cloudflare connects to them. As of June 2025, 23.5% of the sites SSL Pulse surveys would accept TLS 1.0, a 1999 version of the web’s encryption protocol that was formally retired in 2021. NIST’s guidance says past transitions took ten to twenty years.

What I don’t know yet

I’m writing this on 3 December, and the story is moving. Neither government statement names an algorithm or a company, and both talk about discoveries in the plural. Cloudflare’s CEO, Matthew Prince, posted that his company had been briefed on something he couldn’t detail yet, and told one user to assume it touches anything using RSA or elliptic curves.

People who follow this closely are reading those hints differently. The cryptography engineer Filippo Valsorda reads the NSA’s advisory as pointing at a classical, AI-found weakness in 256-bit elliptic curves, which would be a different and much bigger story than the lattice papers. Rob Joyce, who used to lead the NSA’s cybersecurity work, says there’s no break of RSA, that elliptic curves are solid, and that this is a strategic call and no emergency.

I can’t tell you who’s right, and by the time you read this it may be settled. (My certificate’s P-256 key has a stake in the answer.) If Valsorda is right, the hurry I puzzled over earlier has a simpler explanation than history. The two clocks don’t change, though. Whichever algorithm the next paper is about, somebody improves the attack and everybody else has to move.

Three guesses

Here’s what I’d bet, with dates attached so you can come back and laugh.

The attack improves and still doesn’t work. By the end of 2028 somebody publishes a much cheaper version of the lattice attack against real ML-KEM or ML-DSA sizes, and it’s nowhere near practical. NIST keeps both standards and steers people toward the larger sizes, as the reviewers already recommend. I’m fairly sure of this one. It’s wrong if nothing cheaper appears, and wrong in a much worse way if a credible estimate drops below 2^128.

A second lock. By the end of 2028 at least one mainstream browser or TLS library ships, even as an experiment, a key exchange whose post-quantum half isn’t a structured lattice. (FrodoKEM, HQC and Classic McEliece are the candidates.) This one’s a hunch. The bytes cost what they did in 2022, but doubt got more expensive this week.

The old door stays open. On 1 January 2031, the day RSA and elliptic curves become deprecated in NIST’s guidance (and the day after its final date for SHA-1), my server on its default settings will accept a connection with no post-quantum cryptography in it. So will most of the web. I’ll rerun Thursday’s script to find out. I’d put money on this one, and I’d like to be wrong.

Back to the server

The script I ran on Thursday had a second half. After asking for the post-quantum exchange, it asked hrih.si for plain X25519, with no ML-KEM at all. The server said yes to that too.

So on one small website in December 2026, the post-quantum handshake is live, the old one works for anyone who asks, and every commit is named by SHA-1. None of that is urgent tonight. It wasn’t urgent in February 2005 either.

What’s the oldest algorithm still running in something you’re responsible for? Post it in the comments. I’d like to read them.

Hatim Rih

原文来源:hrih.si