Skip to content

security: crypto.Verify rejects wrong-length public keys (panic-DoS fix)#39

Merged
TeoSlayer merged 1 commit into
mainfrom
security/verify-length-guard
Jul 25, 2026
Merged

security: crypto.Verify rejects wrong-length public keys (panic-DoS fix)#39
TeoSlayer merged 1 commit into
mainfrom
security/verify-length-guard

Conversation

@TeoSlayer

Copy link
Copy Markdown
Contributor

ed25519.Verify panics on a public key that isn't exactly 32 bytes, and crypto.Verify is reached from unauthenticated paths (the handshake decodes a peer-supplied public_key and verifies it with no length check) — a remote, unauthenticated crash-DoS. Guard the length, return false. Regression test covers 0/1/5/31/33/64-byte + nil keys.

🤖 Generated with Claude Code

ed25519.Verify panics on a public key that is not exactly 32 bytes.
crypto.Verify is reached from unauthenticated message paths (e.g. the
handshake decodes a peer-supplied public_key and calls it), so a
wrong-length key was a remote, unauthenticated crash. Guard the length
and return false instead of panicking.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@TeoSlayer
TeoSlayer merged commit 3e09d17 into main Jul 25, 2026
11 checks passed
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.

2 participants