cloudflare / cloudflare/circl

Integer overflow in appendLen16Prefixed causes unrecoverable ciphertext in ABE scheme

Open
#695 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.