Skip to content

XChaCha20-Poly1305 nonce reuse allows plaintext recovery from ciphertexts over 64 KiB

High
shibme published GHSA-m4vx-9958-6pvh Aug 11, 2026

Package

gomod xipher.org/xipher (Go)

Affected versions

< 1.32.2

Patched versions

1.32.3

Description

Impact

internal/crypto/xcp reused the same random nonce for every 64KB block in a message. Any message over 64KB ends up with more than one block encrypted under the same key and nonce, which breaks confidentiality: C1 XOR C2 = P1 XOR P2. If an attacker knows or can guess the plaintext of one block, they can recover the plaintext of any other block in the same message. No key needed.

Reproduced this against the real encryption path in this repo, not a toy example. Both the symmetric and public-key encryption paths are affected since they both go through xcp.

The same reuse also repeats Poly1305's one-time key, so forging part of an affected message is plausible too, though no working forgery was built to confirm it.

Every released version until v1.32.2 is affected. It's been there since the first streaming-encryption commit.

Patches

Every block now gets its own nonce: a fixed 16 byte prefix for the whole message, plus a per-block counter and a flag for the last block. This also means a truncated or reordered ciphertext fails to decrypt instead of silently returning partial or wrong data.

Old ciphertexts still decrypt fine. New encryption never reuses a nonce across blocks again.

Patched in v1.32.3.

Workarounds

None beyond upgrading. If you can't upgrade right away, avoid encrypting anything over 64KB with an affected version, and treat any ciphertext over 64KB you've already produced as possibly exposed.

References

CWE-323

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

CVE ID

No known CVE

Weaknesses

Reusing a Nonce, Key Pair in Encryption

Nonces should be used for the present occasion and only once. Learn more on MITRE.

Credits