Skip to content

fix: avoid panic on invalid signature input#29

Open
nacardin wants to merge 1 commit into
junkurihara:developfrom
nacardin:fix/panic
Open

fix: avoid panic on invalid signature input#29
nacardin wants to merge 1 commit into
junkurihara:developfrom
nacardin:fix/panic

Conversation

@nacardin

Copy link
Copy Markdown

Fixes two denial-of-service bugs in the signature verification path.

The library parses the Signature and Signature-Input headers of incoming
requests before any cryptographic check runs, so the bytes it sees are fully
attacker-controlled. Two of those parse steps could panic on malformed input:

  1. A negative "created" or "expires" timestamp. These are valid Structured
    Field integers but were converted to u64 with .unwrap(), so a value like
    created=-1 panicked.

  2. An undefined @-prefixed derived component name. The
    name lookup called panic! on anything it didn't recognize.

Either one lets an unauthenticated client crash the verifier just by sending a
crafted header.

The fix makes both paths return a normal parse error instead of panicking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant