# MuPDF's AES-256 key had only 9 bits of real randomness

Original title: The case of the 9 bit AES key

> Hacker News story 50280722 · language: en · submitted 2026-10-28
> Web version: https://zeli.app/story/50280722
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 131 · by [ledoge](<https://news.ycombinator.com/user?id=ledoge>) · 💬 68
[original](<https://v12.sh/blog/the-case-of-the-9bit-aes-key>) · [HN discussion](<https://news.ycombinator.com/item?id=50280722>)

## Summary

Several PDF tools generate their AES-256 file keys from tiny, enumerable state spaces. MuPDF before 1.28.5 seeded a 48-bit LCG with the current time in seconds, and only 9 bits of that timestamp ever reached the key, so all 512 possible streams can be brute-forced in about 11 milliseconds. Foxit hashes the timestamp plus 32 zero-filled bytes, letting a Rust tool test 370 million timestamps per second. OpenPDF and iText seed an ARC4 stream with time and free memory. MuPDF has fixed the flaw.

## Key quote

> Timestamps that differ by 512 seconds produce exactly the same byte stream.

## HN discussion (68 comments)

### [tptacek](<https://news.ycombinator.com/item?id=50281944>)

> "MuPDF versions before 1.28.5 use an implementation of the drand48 family" yeah, ok, so they're basically not doing real encryption. The number of bits in the key space isn't the real story; the keys simply aren't cryptographically random.

### [jburgess777](<https://news.ycombinator.com/item?id=50282482>)

> Does the DMCA still make it illegal to access encrypted content no matter how easy it is to discover the key? https://www.law.cornell.edu/uscode/text/17/1201
>
> Would the new LLM model owners like to strike this down, or use it to demonstrate how dangerous unrestricted models can be?

### [NelsonMinar](<https://news.ycombinator.com/item?id=50282234>)

> What is wrong with software engineers that we keep making really stupid basic mistakes like this? Sometimes I think programming should require licensing and regular testing.

### [ubutler](<https://news.ycombinator.com/item?id=50281821>)

> Rule #1 of rolling your own RNG: don’t.
>
> Rule #2? Please don’t.

### [JonChesterfield](<https://news.ycombinator.com/item?id=50281663>)

> Wonderful.

---

## Cite

- Page: https://zeli.app/story/50280722
- Date: 2026-10-28
- Source: v12.sh (https://v12.sh/blog/the-case-of-the-9bit-aes-key)
- Hacker News: https://news.ycombinator.com/item?id=50280722

## Other languages

- zh: https://zeli.app/zh/story/50280722 · markdown: https://zeli.app/zh/story/50280722.md
- ja: https://zeli.app/ja/story/50280722 · markdown: https://zeli.app/ja/story/50280722.md
- ko: https://zeli.app/ko/story/50280722 · markdown: https://zeli.app/ko/story/50280722.md
- de: https://zeli.app/de/story/50280722 · markdown: https://zeli.app/de/story/50280722.md
- es: https://zeli.app/es/story/50280722 · markdown: https://zeli.app/es/story/50280722.md
- ru: https://zeli.app/ru/story/50280722 · markdown: https://zeli.app/ru/story/50280722.md
