Email me

Rust advisories / bip322

Vulnerability CriticalRUSTSEC-2026-0334 · bip322

RUSTSEC-2026-0334: BIP-322 address ownership verification bypass for P2WPKH and P2SH-P2WPKH addresses

Short answerA security vulnerability in the bip322 crate: BIP-322 address ownership verification bypass for P2WPKH and P2SH-P2WPKH addresses. Critical severity (CVSS 9.1). Fixed in 0.0.11: update to a fixed version.

Cratebip322
TypeVulnerability (crypto-failure)
Affected versionsFrom 0.0.6 before 0.0.11.
Fixed in0.0.11
SeverityCritical, CVSS 9.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
Published2026-08-14
Last changed2026-10-09
Also known asGHSA-5chw-87w3-j9cv
Affected functionsbip322::verify_full, bip322::verify_full_encoded, bip322::verify_simple, bip322::verify_simple_encoded

What to do

  1. See which version you have: cargo tree -i bip322 (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p bip322. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example bip322 = "0.0.11") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

Affected versions of bip322 accepted a BIP-322 proof created with an attacker-controlled private key as a valid signature for an unrelated victim P2WPKH or P2SH-P2WPKH address, allowing complete authentication bypass in applications using verify_simple, verify_simple_encoded, verify_full, or verify_full_encoded as proof that a user controls a Bitcoin address.

In verify_full, the verifier obtained the public key from the caller-controlled witness and passed it to verify_full_p2wpkh, where the supposed public-key mismatch check read the key from the same witness and compared it with itself:

let witness_pub_key = &witness.to_vec()[1];

if &pub_key.to_bytes() != witness_pub_key {
    return Err(Error::PublicKeyMismatch);
}

Since pub_key was originally parsed from that exact witness element, this comparison was tautological. The code verified that the signature was valid for the public key embedded in the witness, but never verified that this public key hashes to the claimed address, violating BIP-322's requirement that the message_signature satisfy the message_challenge (the claimed address's scriptPubKey).

As a result, an attacker could select any victim P2WPKH or P2SH-P2WPKH address, construct the BIP-322 challenge for that address and message, sign it with their own unrelated private key, and have the proof accepted. No victim key or victim interaction was required. Application-level nonces do not mitigate this, since the attacker can construct and sign the current challenge message with their own key.

P2TR verification is not affected: the public key is derived from the address's witness program rather than from the caller-controlled witness.

The flaw was corrected in commit e8accbe by deriving the expected scriptPubKey from the witness public key (P2WPKH(HASH160(pubkey)), wrapped in P2SH for the nested case) and requiring it to exactly equal the scriptPubKey of the claimed address before signature verification, failing with Error::PublicKeyMismatch otherwise. The fix is included in version 0.0.11. Affected versions 0.0.6 through 0.0.10 have been yanked from crates.io.

There is no known workaround that mitigates the vulnerability. Upgrading to version 0.0.11 is the recommended course of action.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Up next

Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ