Integer overflow in appendLen16Prefixed causes unrecoverable ciphertext in ABE scheme
- Dominant language
- Go
- Stars
- 1.7k
- Forks
- 219
- Avg merge
- 15h 45m
- Merged PRs (30d)
- 4
Description
(This was previously reported to, and categorized as "Informational" and outside their threat model by, Cloudflare)
appendLen16Prefixed (in internal/tkn/util.go) stores the byte length in a uint16. Any policy whose overall length exceeds 65535 bytes will wrap at uint16(len(pBytes)) and cause encryption to "succeed" with an unrecoverable ciphertext (error at decryption time, nothing at encryption)
That is, any combination of numerocity and specific attribute length summing to over 65535 will overflow and not be recoverable
Contributor guide
Research direction
Start in internal/tkn/util.go at appendLen16Prefixed and trace its callers in the ABE encryption path. Inspect the existing ABE tests, then add coverage for policies whose encoded length exceeds 65535 bytes. Done means encryption does not silently produce ciphertext that decryption cannot recover.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cryptography
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100