Repository navigation
fix(auth): verify user signatures with verify_strict - #176
Conversation
verify_auth_signature checked the publickey signature with ed25519-dalek's non-strict verify, which accepts signatures under a small-order (weak) public key that anyone can forge: with A the identity point, R' = [S]B - [k]A = [S]B, so R = B and S = 1 verify for every message. A weak key in authorized_keys (parsed by VerifyingKey::from_bytes, which does not reject weak keys) would therefore let any peer authenticate as that user. verify_strict rejects weak keys and a non-canonical or small-order R. OpenSSH never generates small-order keys and emits canonical signatures, so legitimate clients are unaffected. Adds small_order_key_forgery_is_rejected, which shows the non-strict check accepting the forged signature and verify_auth_signature rejecting it; it fails if the call goes back to verify. The other ed25519 verify calls (host_key.rs and tests/accept.rs) check the server's own host-key signatures in tests and are unchanged. Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. What was reviewed:
What was verified:
🤖 Generated with Claude Code |
PR Review: fix(auth): verify user signatures with verify_strict (#176)Decision: 🟢 Approved Executive summaryThe PR is a one-line security fix plus a regression test: Verification performed
New findingsNo findings reach the 🔴 or 🟡 threshold. The change introduces no 💡 Suggestions (nice to have)
|
opencode review #1 on #176 (suggestion, applied): defense in depth on top of verify_strict. AuthorizedKeys::load now rejects a key whose VerifyingKey::is_weak() is true with MalformedLine, the same fail-closed path every other malformed line already takes, so a bad authorized_keys fails loudly instead of keeping a forgeable key loaded. Adds reject_small_order_key. Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
|
Reviewer findings: round 1 summary
The Codex |
PR Review: fix(auth): verify user signatures with verify_strict (#176)Decision: 🟢 Approved Executive summaryTwo commits harden the single first-party verification of peer-controlled Ed25519 signatures: Previous issues
New findingsNo findings reach the 🔴/🟡 threshold. Verified independently: the only production verification of attacker-controlled Ed25519 input is 💡 Suggestions (nice to have)
|
opencode review #2 on #176 (suggestion, applied): the MalformedLine variant doc and AuthorizedKeys::load's # Errors section now name the small-order key case added in 292783d. Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
|
Round 2: opencode review #2 approved with one suggestion: the |
PR Review: fix(auth): verify user signatures with verify_strict (#176)Decision: 🟢 Approved Executive summaryThree commits harden the single first-party verification of peer-controlled Ed25519 input: Previous issues
New findingsNo findings reach the 🔴 (≥90) or 🟡 (≥80) threshold. Verified independently:
The upstream limitation that |
PR Review: fix(auth): verify user signatures with verify_strict (#176)Decision: 🟢 Approved Executive summaryFour commits (three substantive plus a Previous issues
New findingsNo findings reach the 🔴 (≥90) or 🟡 (≥80) threshold. Verified independently:
💡 Suggestions (nice to have)
Limitations: I could not run the ADR-0020 interop gate locally (the runner's OpenSSH 9.6 has no ML-KEM), so the end-to-end claim rests on the green |
Summary
verify_auth_signature(crates/quantumssh-core/src/auth.rs) checked thepublickeysignature with ed25519-dalek's non-strictverify. That check accepts signatures under a small-order ("weak") public key, and those signatures can be forged by anyone.Athe identity point,R' = [S]B − [k]A = [S]B, soR = B, S = 1verifies for every message.authorized_keysentries are parsed withVerifyingKey::from_bytes(auth.rs:264), which does not reject weak keys.authorized_keyswould let any peer authenticate as that user.This PR switches the call to
verify_strict. ed25519-dalek 2.2.0'sVerifyingKeydocs describe it as performing both signature-malleability checks:Sreduced mod ℓ, and the small-torsion check onR. The same page says ofis_weak: "A weak public key can be used to generate a signature that's valid for almost every message."Legitimate clients are unaffected. OpenSSH (
ssh-keygen) never produces small-order keys and emits canonical signatures. The CI interop gate drives a real OpenSSH 10.x publickey login end to end.Threat-model anchor: the user-authentication path that every connection reaches before it is authenticated (
docs/threat-model.md§4.1 is the pre-auth trust surface). The rule applied is the CLAUDE.md "Fail closed" hard rule.Scope
auth.rs:332, the only first-party Ed25519 verification of peer-controlled input. The doc comment now explains why it usesverify_strict.verifycalls (host_key.rs:360andtests/accept.rs:290/1353) verify the server's own host-key signatures inside tests.verifyandverify_strictsemantics are the same in ed25519-dalek 3.0.0.Test
auth::tests::small_order_key_forgery_is_rejectedbuilds the identity key (01 00…00, and assertsis_weak()) and the forged signatureR = basepoint (58 66…66) ‖ S = 1. Then:VerifyingKey::verifyaccepts it, which documents the bug class;verify_auth_signaturerejects it.I checked that the test fails if the call goes back to
verify: it panics at the final assertion.Local validation:
cargo fmt --all,cargo clippy --workspace --all-targets -- -D warnings(clean),cargo test --workspace(34 + 104 + 35 passed),cargo build --workspace --release.No issue tracks this. It came out of the dalek 3.x research for #109, as a finding independent of that bump.
https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW