PoW v2 fallback verification does not enforce keyPrefix
Description
In the fallback branch of verifySolution (used whenever a challenge has no keySignature, or the verifier doesn't have the matching hmacKeySignatureSecret), the derived key was checked only for equality against the value re-derived from the submitted counter. The required keyPrefix was never checked. This lets a client submit any counter with a single KDF execution and pass verification, entirely skipping the proof-of-work search the prefix is meant to enforce.
Impact
The fallback path covers:
- Any probabilistic challenge.
- Deterministic-mode challenges created without
hmacKeySignatureSecret. - Deterministic-mode challenges where the verifier omits
hmacKeySignatureSecreteven though it was set at creation.
The recommended fast path (deterministic mode with a matching hmacKeySignatureSecret set on both creation and verification) was unaffected.
Patches
- Dart Lib v0.3.1
- Elixir Lib v2.0.1
- Java Lib v2.0.3
- TS Lib v2.3.2
- Python Lib v2.1.0
- Ruby Lib v2.0.1
- Rust Lib v0.2.0
Go, PHP, C++ libraries are unaffected.
Workarounds
Use deterministic mode with hmacKeySignatureSecret set consistently on creation and verification to route through the unaffected fast path, or upgrade to patched versions.
References
Patch commit: e2a6daf