Security

Our Audit of Massa Labs’ Post-Quantum Encryption Library

Published
Reading time
2 min read

Massa Labs asked us to audit pq-rerand, their Rust library for post-quantum encryption. It lets a storage server take an encrypted file and produce a different encryption of the same file. The server needs only the owner’s public key. Someone comparing the copies on two servers can no longer recognize the file by matching the encrypted bytes, and the owner can still read either copy. The authors call this public re-randomization.

Download MASSA-01 (PDF, 99 pages)

In one test, we could alter an encrypted block and tell whether the recipient accepted or rejected each version we sent. We never saw what any of those blocks decrypted to. After 15,663 yes-or-no answers, we had the recipient’s secret key (F11).

A storage client can give away that answer without ever sending an error message. Suppose it asks a second server for a block only when the first copy fails its authenticity check. Anyone watching both requests now knows the client rejected the first copy. Massa Labs revised the library so that only the function that checks authenticity sees the raw decrypted bytes. The library can’t control which server the client contacts next. We left F11 open because each application still has to hide the result from anyone who can change a block.

The other High finding turned up when we locked a test session (F22). Locking the session erased the buffer that held the key. We could still read the entire key from an earlier copy on the thread’s stack, where a crash dump could have captured it. Massa Labs changed the code to build keys directly in heap buffers and wipe the stack space used during key generation. When we repeated the session test on an Apple M4, we found no surviving copy.

To check the Rust implementation against the paper, we wrote a second implementation and gave both the same random inputs. Across four test seeds, they produced identical keys and ciphertexts and agreed byte for byte after re-randomization and decryption.

Nadim Kobeissi and Lorenzo Magliocco carried out the audit. We rated two findings High, two Medium, eleven Low and twelve Informational. Massa Labs fixed 26 of the 27 in six pull requests we reviewed before merge.

Read more Audit reports, security advisories, software releases, and research from Symbolic Software. RSS GitHub

Related posts

Software

hpke-ng: Faster, Smaller, Harder HPKE for Rust

126 head-to-head benchmarks against hpke-rs and rust-hpke. hpke-ng wins 103, ties 19, loses 4. ML-KEM-1024 decap −55%, X25519 decap −41%, export −72% to −76%, end-to-end roundtrip −30%, plus a type system that catches four classes of bug at compile time.

26 min read
Security

Our Audit of the 4Mica Payment Network

We audited 4Mica's collateral-backed payment network. Its BLS signatures and netting were correct; the serious risks were in settlement and key management.

2 min read
Security

2PC-MPC in Rust: Audit Report

The public report from our audit, with 3MI Labs, of dWallet Labs' 2PC-MPC Rust implementation.

1 min read