Vulnerabilities in pkg:golang/github.com/flynn/noise

PACKAGE
Advisory Summary

GHSA-g9mp-8g3h-3c5c is a MODERATE denial of service vulnerability (General Security Weakness) affecting Github.com/flynn/noise libraries in the Go ecosystem. The issue involves flynn/noise has improper nonce handling yielding potential state dos. Remediation is available by upgrading affected packages to version 1.0.0.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/flynn/noise

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/flynn/noise. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-g9mp-8g3h-3c5c - MODERATE flynn/noise has improper nonce handling yielding potential state DoS
GHSA-6cr6-fmvc-vw2p CVE-2021-4239 HIGH Noise vulnerable to denial of service

GHSA-g9mp-8g3h-3c5c at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-g9mp-8g3h-3c5c
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Github.com/flynn/noise
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-g9mp-8g3h-3c5c

To remediate this vulnerability, upgrade all affected Github.com/flynn/noise dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/flynn/noise fixed: 1.0.0
Upgrade github.com/flynn/noise to 1.0.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/flynn/noise

How to Check if You Are Affected

To determine whether your application is affected by GHSA-g9mp-8g3h-3c5c, inspect your project dependencies for Github.com/flynn/noise:

inspect dependencies for github.com/flynn/noise

Analyze the terminal output to locate any version of Github.com/flynn/noise in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Github.com/flynn/noise, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

The Go package `github.com/flynn/noise`, a [Noise Protocol](https://noiseprotocol.org/) 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](https://www.bamsoftware.com/software/dnstt/cure53-turbotunnel-2021.pdf) of a user of this package ([dnstt](https://www.bamsoftware.com/software/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

GHSA-g9mp-8g3h-3c5c Affected Github.com/flynn/noise Versions

1 component(s)
Fixed Versions:
1.0.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/flynn/noise
Go
< 1.0.0
1.0.0

References

Frequently Asked Questions

What is GHSA-g9mp-8g3h-3c5c?
GHSA-g9mp-8g3h-3c5c is a security vulnerability in Github.com/flynn/noise involving flynn/noise has improper nonce handling yielding potential state DoS under General Security Weakness.
Which Github.com/flynn/noise versions are affected?
Affected versions include releases prior to 1.0.0 across affected packages: github.com/flynn/noise.
What version fixes GHSA-g9mp-8g3h-3c5c?
Upgrading to 1.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/flynn/noise affected?
Yes, github.com/flynn/noise is affected in releases prior to 1.0.0. Upgrade your dependency to 1.0.0 or later.
What CWE is associated with GHSA-g9mp-8g3h-3c5c?
GHSA-g9mp-8g3h-3c5c is classified under General Security Weakness.
How can I check Go dependencies for GHSA-g9mp-8g3h-3c5c?
Run the dependency tree command: 'inspect dependencies for github.com/flynn/noise'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-g9mp-8g3h-3c5c",
  "modified" : "2023-08-29T20:07:14Z",
  "published" : "2022-02-15T01:57:18Z",
  "aliases" : [ ],
  "summary" : "flynn/noise has improper nonce handling yielding potential state DoS",
  "details" : "The Go package `github.com/flynn/noise`, a [Noise Protocol](https://noiseprotocol.org/) implementation, has two bugs in nonce handling in versions prior to v1.0.0.\n\n### Issue 1: Potential nonce overflow\n\nIf 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.\n\nThis 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`.\n\n### Issue 2: Potential denial of service via invalid ciphertext\n\nIf 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`.\n\nThis has been resolved in the patched version by returning authentication errors from `Decrypt` before incrementing the nonce. \n\n### Patches\n\nFixed in https://github.com/flynn/noise/pull/44, tagged as v1.0.0.\n\n### Acknowledgements\n\nThese issues were discovered during [an audit](https://www.bamsoftware.com/software/dnstt/cure53-turbotunnel-2021.pdf) of a user of this package ([dnstt](https://www.bamsoftware.com/software/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:\n\n* UCB-02-003 Potential nonce overflow in Noise protocol\n* UCB-02-006 DoS due to unconditional nonce increment",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/flynn/noise"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/flynn/noise/security/advisories/GHSA-g9mp-8g3h-3c5c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/flynn/noise/pull/44"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/flynn/noise"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2022-0425"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-18T21:46:19Z",
    "nvd_published_at" : null
  }
}