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

> Attackers can bypass Bitcoin address ownership verification for P2WPKH addresses by signing challenges with their own key, leading to authentication bypass.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 14 Aug 2026
- **Also known as:** GHSA-5chw-87w3-j9cv

## What is RUSTSEC-2026-0334?

RUSTSEC-2026-0334 is an authentication bypass vulnerability in bip322, published on 14 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

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:

```rust
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](https://github.com/rust-bitcoin/bip322/commit/e8accbe7d39f48f030e44f333b4796e28f6aad80)
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](https://crates.io/crates/bip322/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.

## Which versions are affected by RUSTSEC-2026-0334?

1 open source package ship an affected version, including bip322.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `bip322` | crates.io | From 0.0.6 | 0.0.11 |

## How do I fix RUSTSEC-2026-0334?

Upgrade bip322 to 0.0.11 or later.

## Is RUSTSEC-2026-0334 being exploited?

There is no known exploitation of RUSTSEC-2026-0334 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for RUSTSEC-2026-0334 and fix it if it is affected.

What it is: RUSTSEC-2026-0334 is an authentication bypass vulnerability in bip322, published on 14 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of RUSTSEC-2026-0334 in the wild and no public exploit code.

Affected packages and fixed versions:
- bip322 (crates.io): affected from 0.0.6; fixed in 0.0.11

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/RUSTSEC-2026-0334/ (Markdown: https://insights.sbomify.com/RUSTSEC-2026-0334/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/RUSTSEC-2026-0334

---
From sbomify Insights: https://insights.sbomify.com/RUSTSEC-2026-0334/
Summaries are generated and may contain mistakes; the official description above is the record.
