SecurityFan score 41 · Tier B
Rebuilding MuPDF's old PDF key generator in Python: nine bits of randomness behind AES-256
DEV · By Jose Pollman ·
The Brief
- MuPDF versions before 1.28.5 wrote AES-256 encrypted PDFs whose 256-bit file key depended on nine bits of randomness.
- The key was cut from one of only 512 possible byte streams, because it came from a 48-bit linear congruential generator seeded with the clock.
- The AES cipher itself was not the problem; the weakness was in key generation.
Why it matters
PDFs encrypted by affected MuPDF versions may have keys drawn from a space of only 512 possibilities, so their protection is much weaker than AES-256 suggests.
Who’s affected
- Teams using MuPDF before 1.28.5 to encrypt PDFs
What to do
- Upgrade MuPDF to version 1.28.5 or later
- MuPDF 1.28.5
- #encryption
- #mupdf
- #aes-256
- #prng
MuPDF versions before 1.28.5 wrote AES-256 encrypted PDFs whose 256-bit file key depended on nine bits of randomness, so it was cut from one of only 512 possible byte streams. The cipher was fine. The key came from a 48-bit linear congruential generator seeded with the clock, and…