CVE-2021-4239
Weak encryption and denial of service in github.com/flynn/noise
The Noise protocol implementation suffers from weakened cryptographic security after encrypting 2^64 messages, and a potential denial of service attack. After 2^64 (~18.4 quintillion) messages are encrypted with the Encrypt function, the nonce counter will wrap around, causing multiple messages to be encrypted with the same key and nonce. In a separate issue, the Decrypt function increments the nonce state even when it fails to decrypt a message. If an attacker can provide an invalid input to the Decrypt function, this will cause the nonce state to desynchronize between the peers, resulting in a failure to encrypt all subsequent messages.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- None
- Integrity
- High
- Availability
- None
Exploit likelihood
What each source reports
NVD Score used
7.5
The Noise protocol implementation suffers from weakened cryptographic security after encrypting 2^64 messages, and a potential denial of service attack. After 2^64 (~18.4 quintillion) messages are encrypted with the Encrypt function, the nonce counter will wrap around, causing multiple messages to be encrypted with the same key and nonce. In a separate issue, the Decrypt function increments the nonce state even when it fails to decrypt a message. If an attacker can provide an invalid input to the Decrypt function, this will cause the nonce state to desynchronize between the peers, resulting in a failure to encrypt all subsequent messages.
- Record
CVE-2021-4239- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Weakness
- CWE-311
- Updated
- 2026-11-02
CVE List
7.5
Weak encryption and denial of service in github.com/flynn/noise
The Noise protocol implementation suffers from weakened cryptographic security after encrypting 2^64 messages, and a potential denial of service attack. After 2^64 (~18.4 quintillion) messages are encrypted with the Encrypt function, the nonce counter will wrap around, causing multiple messages to be encrypted with the same key and nonce. In a separate issue, the Decrypt function increments the nonce state even when it fails to decrypt a message. If an attacker can provide an invalid input to the Decrypt function, this will cause the nonce state to desynchronize between the peers, resulting in a failure to encrypt all subsequent messages.
- Record
CVE-2021-4239- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Updated
- 2026-11-02
EUVDEUVD-2022-7529
7.5
The Noise protocol implementation suffers from weakened cryptographic security after encrypting 2^64 messages, and a potential denial of service attack. After 2^64 (~18.4 quintillion) messages are encrypted with the Encrypt function, the nonce counter will wrap around, causing multiple messages to be encrypted with the same key and nonce. In a separate issue, the Decrypt function increments the nonce state even when it fails to decrypt a message. If an attacker can provide an invalid input to the Decrypt function, this will cause the nonce state to desynchronize between the peers, resulting in a failure to encrypt all subsequent messages.
- Record
EUVD-2022-7529- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-6cr6-fmvc-vw2p
7.7
Noise vulnerable to denial of service
Noise is a Go implementation of the Noise Protocol Framework. The Noise protocol implementation suffers from weakened cryptographic security after encrypting 2^64 messages, and a potential denial of service attack. After 2^64 (~18.4 quintillion) messages are encrypted with the Encrypt function, the nonce counter will wrap around, causing multiple messages to be encrypted with the same key and nonce. In a separate issue, the Decrypt function increments the nonce state even when it fails to decrypt a message. If an attacker can provide an invalid input to the Decrypt function, this will cause the nonce state to desynchronize between the peers, resulting in a failure to encrypt all subsequent messages.
- Record
GHSA-6cr6-fmvc-vw2p- CVSS 3.1
- 7.7 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:H - Weakness
- CWE-311
- Updated
- 2026-11-02
GitHub AdvisoriesGHSA-g9mp-8g3h-3c5c No score
flynn/noise has improper nonce handling yielding potential state DoS
The Go package github.com/flynn/noise, a Noise Protocol implementation, has two bugs in nonce handling in versions prior to v1.0.0.
Issue 1: Potential nonce overflow
If 2<sup>64</sup> (~18.4 quintillion) or more messages are encrypted with Encrypt after handshaking, the nonce counter will wrap around, causing multiple messages to be encrypted with the same key and nonce, resulting in a potentially catastrophic weakening of the security properties of the symmetric cipher.
This has been resolved in the patched version by returning ErrMaxNonce from the CipherState Encrypt and Decrypt methods before the reserved maximum nonce is reached. If this error is encountered, the program should handshake again to start with a fresh CipherState.
Issue 2: Potential denial of service via invalid ciphertext
If an attacker sends an invalid ciphertext into one peer's Decrypt, the nonce is incremented unconditionally. This causes a desync of the CipherState due to a nonce mismatch between the peers, resulting in a failure to decrypt all subsequent messages. A new handshake will be required to establish a new CipherState.
This has been resolved in the patched version by returning authentication errors from Decrypt before incrementing the nonce.
Patches
Fixed in https://github.com/flynn/noise/pull/44, tagged as v1.0.0.
Acknowledgements
These issues were discovered during an audit of a user of this package (dnstt). Thanks to UC Berkley for commissioning the audit, and to David Fifield and Nathan Brown for their collaboration on the fixes. The fixed issues are noted in the audit as:
- UCB-02-003 Potential nonce overflow in Noise protocol
- UCB-02-006 DoS due to unconditional nonce increment
- Record
GHSA-g9mp-8g3h-3c5c- Updated
- 2026-11-02
OSVGHSA-6cr6-fmvc-vw2p
7.7
Noise vulnerable to denial of service
Noise is a Go implementation of the Noise Protocol Framework. The Noise protocol implementation suffers from weakened cryptographic security after encrypting 2^64 messages, and a potential denial of service attack. After 2^64 (~18.4 quintillion) messages are encrypted with the Encrypt function, the nonce counter will wrap around, causing multiple messages to be encrypted with the same key and nonce. In a separate issue, the Decrypt function increments the nonce state even when it fails to decrypt a message. If an attacker can provide an invalid input to the Decrypt function, this will cause the nonce state to desynchronize between the peers, resulting in a failure to encrypt all subsequent messages.
- Record
GHSA-6cr6-fmvc-vw2p- CVSS 3.1
- 7.7 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:H - Weakness
- CWE-311
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2021-4239
7.5
The Noise protocol implementation suffers from weakened cryptographic security after encrypting 2^64 messages, and a potential denial of service attack. After 2^64 (~18.4 quintillion) messages are encrypted with the Encrypt function, the nonce counter will wrap around, causing multiple messages to be encrypted with the same key and nonce. In a separate issue, the Decrypt function increments the nonce state even when it fails to decrypt a message. If an attacker can provide an invalid input to the Decrypt function, this will cause the nonce state to desynchronize between the peers, resulting in a failure to encrypt all subsequent messages.
- Record
UBUNTU-CVE-2021-4239- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N - Updated
- 2026-11-02
OSVGHSA-g9mp-8g3h-3c5c No score
flynn/noise has improper nonce handling yielding potential state DoS
The Go package github.com/flynn/noise, a Noise Protocol implementation, has two bugs in nonce handling in versions prior to v1.0.0.
Issue 1: Potential nonce overflow
If 2<sup>64</sup> (~18.4 quintillion) or more messages are encrypted with Encrypt after handshaking, the nonce counter will wrap around, causing multiple messages to be encrypted with the same key and nonce, resulting in a potentially catastrophic weakening of the security properties of the symmetric cipher.
This has been resolved in the patched version by returning ErrMaxNonce from the CipherState Encrypt and Decrypt methods before the reserved maximum nonce is reached. If this error is encountered, the program should handshake again to start with a fresh CipherState.
Issue 2: Potential denial of service via invalid ciphertext
If an attacker sends an invalid ciphertext into one peer's Decrypt, the nonce is incremented unconditionally. This causes a desync of the CipherState due to a nonce mismatch between the peers, resulting in a failure to decrypt all subsequent messages. A new handshake will be required to establish a new CipherState.
This has been resolved in the patched version by returning authentication errors from Decrypt before incrementing the nonce.
Patches
Fixed in https://github.com/flynn/noise/pull/44, tagged as v1.0.0.
Acknowledgements
These issues were discovered during an audit of a user of this package (dnstt). Thanks to UC Berkley for commissioning the audit, and to David Fifield and Nathan Brown for their collaboration on the fixes. The fixed issues are noted in the audit as:
- UCB-02-003 Potential nonce overflow in Noise protocol
- UCB-02-006 DoS due to unconditional nonce increment
- Record
GHSA-g9mp-8g3h-3c5c- Updated
- 2026-11-02
OSVGO-2022-0425 No score
Weak encryption and denial of service in github.com/flynn/noise
The Noise protocol implementation suffers from weakened cryptographic security after encrypting 2^64 messages, and a potential denial of service attack.
After 2^64 (~18.4 quintillion) messages are encrypted with the Encrypt function, the nonce counter will wrap around, causing multiple messages to be encrypted with the same key and nonce.
In a separate issue, the Decrypt function increments the nonce state even when it fails to decrypt a message. If an attacker can provide an invalid input to the Decrypt function, this will cause the nonce state to desynchronize between the peers, resulting in a failure to encrypt all subsequent messages.
- Record
GO-2022-0425- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
github.com/flynn/noiseGo |
before 1.0.0 | 1.0.0 |
golang-github-flynn-noiseUbuntu:22.04:LTS |
All versions, plus listed versions 1.0.0-2 |
None known |
golang-github-flynn-noiseUbuntu:24.04:LTS |
All versions, plus listed versions 1.0.0-2 |
None known |
golang-github-flynn-noiseUbuntu:25.10 |
All versions, plus listed versions 1.1.0-1 |
None known |
golang-github-flynn-noiseUbuntu:26.10 |
All versions, plus listed versions 1.1.0-1 |
None known |
golang-github-flynn-noiseUbuntu:26.04:LTS |
All versions, plus listed versions 1.1.0-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-4239 is a high vulnerability (CVSS 7.5) in Github.com/flynn/noise, published February 15, 2022. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.38%, the 31st percentile. Fixed in github.com/flynn/noise 1.0.0.