You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Surfaced by a full-repository review (2026-06-09).
Finding
Off-chain voucher verification (recover_signer, crates/incentive/src/voucher.rs:160-165; also channel.rs:275-277, bind_sig.rs:119-122) uses alloy's recover_address_from_prehash, which internally calls normalized_s() — it silently accepts a high-s (non-canonical) ECDSA signature and recovers the correct signer.
The node persists the signature bytes verbatim (channel.rs:292; alloy's as_bytes() does not normalize), so the exact high-s bytes are what later get submitted to withdraw/closeChannel.
Impact
A malicious client deliberately signs vouchers with high-s:
The node accepts the voucher in apply_voucher, serves the bytes, and advances last_nonce.
At settlement, withdraw/closeChannel revert (InvalidSignatureS).
The replay guard requires nonce > last_nonce, so the node can never obtain a replacement low-s voucher for that nonce — the accrued value is unrecoverable on-chain.
Net effect: free delivery for the attacker, or settlement griefing.
The same asymmetry applies to slash evidence: a high-sslash_sig (probe_sig.rs / stream_sig.rs) verifies off-chain but would fail at the on-chain SlashJudge, silently weakening collected evidence.
Fix
Reject non-canonical s at acceptance time (check signature.s() > secp256k1n/2 → InvalidSignature) in voucher verification, and mirror the check in the probe_sig/stream_sig/bind_sig paths, so the off-chain accept-set exactly matches the on-chain verifiable-set. Add a regression test that flips a valid signature to its high-s form and asserts rejection.
A directly exploitable off-chain / on-chain signature acceptance asymmetry in crates/incentive: alloy's recover_address_from_prehash silently normalises high-s ECDSA signatures during verification, but OpenZeppelin's ECDSA.tryRecover (used in PaymentChannel._verifyVoucher) hard-rejects them. Because persisted signature bytes are never normalised, any voucher signed with a high-s value will be accepted by the node, served against, and then permanently fail on-chain settlement — with no recovery path due to the nonce replay guard. The same asymmetry affects slash-evidence paths (probe_sig.rs, stream_sig.rs).
📊 Assessment
Dimension
Value
Reasoning
Type
Bug
Correctness defect with direct financial exploit path
Labels
critical, poc-blocking, rust added
Unrecoverable-value-loss attack is above high; payment settlement is PoC-blocking; fix is purely in Rust
Coding agent
Suitable
Root cause, all affected file locations, fix strategy, and test requirement are fully specified
// After recovering the signature, before accepting it:let s = signature.s();if s > secp256k1::Scalar::from_be_bytes(SECP256K1N_HALF).unwrap(){returnErr(Error::InvalidSignature);// non-canonical s}
Alternatively, use k256::ecdsa::Signature::normalize_s() and check whether normalisation changed the bytes — reject if it did (so the caller must re-sign). Do not silently normalise and store the corrected bytes; the node should never accept a voucher it can only make valid by mutating it.
Regression test outline:
Sign a valid voucher to get a canonical low-s signature.
Compute the high-s form: s' = secp256k1n - s, v' = 1 - v (or flip the recovery bit).
Assert apply_voucher (or the equivalent verify call) returns Err(InvalidSignature).
Assert the original low-s form still passes.
Checklist:
Add is_high_s guard in voucher.rs::recover_signer
Mirror guard in channel.rs, bind_sig.rs
Mirror guard in probe_sig.rs, stream_sig.rs
Add #[test] fn rejects_high_s_voucher regression test
Add #[test] fn rejects_high_s_slash_sig regression test
Verify no storage/serialisation path normalises silently (search as_bytes() call sites)
Note for reviewer: OZ's ECDSA.tryRecover follows EIP-2 (only low-s canonical signatures). The alloy normalized_s() path is intended for producing canonical signatures, not enforcing that incoming ones are canonical. The fix is purely additive (new rejection branch), so no migration of stored state is needed — existing valid vouchers all have low-s values by construction if signers used any EIP-2-compliant library.
Activity
github-actions commentedon Jun 9, 2026
🎯 Triage report
A directly exploitable off-chain / on-chain signature acceptance asymmetry in
crates/incentive: alloy'srecover_address_from_prehashsilently normalises high-sECDSA signatures during verification, but OpenZeppelin'sECDSA.tryRecover(used inPaymentChannel._verifyVoucher) hard-rejects them. Because persisted signature bytes are never normalised, any voucher signed with a high-svalue will be accepted by the node, served against, and then permanently fail on-chain settlement — with no recovery path due to the nonce replay guard. The same asymmetry affects slash-evidence paths (probe_sig.rs,stream_sig.rs).📊 Assessment
critical,poc-blocking,rustaddedhigh; payment settlement is PoC-blocking; fix is purely in Rust🔗 Similar issues
channel.rs; closed, but demonstrates adjacent invariants around nonce handling that were already hardened💡 Notes and suggestions
Affected locations (all must be patched in lockstep):
crates/incentive/src/voucher.rs:160-165(recover_signer)crates/incentive/src/channel.rs:275-277crates/incentive/src/bind_sig.rs:119-122crates/incentive/src/probe_sig.rs(slash-evidence path)crates/incentive/src/stream_sig.rs(slash-evidence path)Fix pattern:
Alternatively, use
k256::ecdsa::Signature::normalize_s()and check whether normalisation changed the bytes — reject if it did (so the caller must re-sign). Do not silently normalise and store the corrected bytes; the node should never accept a voucher it can only make valid by mutating it.Regression test outline:
ssignature.sform:s' = secp256k1n - s,v' = 1 - v(or flip the recovery bit).apply_voucher(or the equivalent verify call) returnsErr(InvalidSignature).sform still passes.Checklist:
is_high_sguard invoucher.rs::recover_signerchannel.rs,bind_sig.rsprobe_sig.rs,stream_sig.rs#[test] fn rejects_high_s_voucherregression test#[test] fn rejects_high_s_slash_sigregression testas_bytes()call sites)Note for reviewer: OZ's
ECDSA.tryRecoverfollows EIP-2 (only low-scanonical signatures). The alloynormalized_s()path is intended for producing canonical signatures, not enforcing that incoming ones are canonical. The fix is purely additive (new rejection branch), so no migration of stored state is needed — existing valid vouchers all have low-svalues by construction if signers used any EIP-2-compliant library.Add this agentic workflows to your repo
To install this agentic workflow, run
fix(incentive): reject high-s ECDSA signatures off-chain (#836) (#871)
perf(node): hoist voucher ecrecover out of the per-lane lock (#1735) (#…