CVE-2019-11840: Golang.org/x/crypto Golang.org/x/crypto/salsa20/salsa Uses Insufficiently Random Values Vulnerability

MODERATE
Advisory Identifier: GHSA-r5c5-pr8j-pfp7
CVSS 5.9
CWE-330
Published
Advisory Summary

CVE-2019-11840 is a MODERATE (CVSS 5.9) golang.org/x/crypto/salsa20/salsa uses insufficiently random values vulnerability (CWE-330: Use of Insufficiently Random Values) affecting Golang.org/x/crypto libraries in the Go ecosystem. The issue involves golang.org/x/crypto/salsa20/salsa uses insufficiently random values. Remediation is available by upgrading affected packages to version 0.0.0-20190320223903-b7391e95e576.

CVE-2019-11840 at a Glance

CVE Identifier CVE-2019-11840
GHSA Identifier GHSA-r5c5-pr8j-pfp7
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-330: Use of Insufficiently Random Values
Affected Product Golang.org/x/crypto
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2019-11840

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

golang.org/x/crypto fixed: 0.0.0-20190320223903-b7391e95e576
Upgrade golang.org/x/crypto to 0.0.0-20190320223903-b7391e95e576
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 golang.org/x/crypto

How to Check if You Are Affected

To determine whether your application is affected by CVE-2019-11840, inspect your project dependencies for Golang.org/x/crypto:

inspect dependencies for golang.org/x/crypto

Analyze the terminal output to locate any version of Golang.org/x/crypto in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20190320223903-b7391e95e576), 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 CWE-330: Use of Insufficiently Random Values, where the product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers. In Golang.org/x/crypto, 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

An issue was discovered in supplementary Go cryptography libraries, aka golang-googlecode-go-crypto, before 2019-03-20. A flaw was found in the amd64 implementation of golang.org/x/crypto/salsa20 and golang.org/x/crypto/salsa20/salsa. If more than 256 GiB of keystream is generated, or if the counter otherwise grows greater than 32 bits, the amd64 implementation will first generate incorrect output, and then cycle back to previously generated keystream. Repeated keystream bytes can lead to loss of confidentiality in encryption applications, or to predictability in CSPRNG applications. ### Specific Go Packages Affected golang.org/x/crypto/salsa20/salsa

CVE-2019-11840 Affected Golang.org/x/crypto Versions

1 component(s)
Fixed Versions:
0.0.0-20190320223903-b7391e95e576
Product / Package Ecosystem Affected Versions Fixed Version
golang.org/x/crypto
Go
< 0.0.0-20190320223903-b7391e95e576
0.0.0-20190320223903-b7391e95e576

References

groups.google.com/g/golang-announce/c... WEB
https://groups.google.com/g/golang-announce/c/tjyNcJxb2vQ/m/n0NRBziSCAAJ
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2019/06/msg00029.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2020/10/msg00014.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2020/11/msg00016.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2020/11/msg00030.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2021/01/msg00015.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2023/06/msg00017.html
pkg.go.dev/vuln/go-2022-0209 WEB
https://pkg.go.dev/vuln/GO-2022-0209
NVD — CVE-2019-11840 NVD
https://nvd.nist.gov/vuln/detail/CVE-2019-11840
Golang.org/x/crypto Source Repository REPOSITORY
https://github.com/golang/go/issues/30965
bugzilla.redhat.com/show_bug.cgi WEB
https://bugzilla.redhat.com/show_bug.cgi?id=1691529
Golang.org/x/crypto Source Repository REPOSITORY
https://github.com/golang/go
go.dev/cl/168406 WEB
https://go.dev/cl/168406
go.dev/issue/30965 WEB
https://go.dev/issue/30965
go.googlesource.com/crypto/+/b7391e95e5... WEB
https://go.googlesource.com/crypto/+/b7391e95e576cacdcdd422573063bc057239113d
groups.google.com/forum/ WEB
https://groups.google.com/forum/#!msg/golang-announce/tjyNcJxb2vQ/n0NRBziSCAAJ

Frequently Asked Questions

What is CVE-2019-11840?
CVE-2019-11840 is a security vulnerability in Golang.org/x/crypto involving golang.org/x/crypto/salsa20/salsa uses insufficiently random values under CWE-330: Use of Insufficiently Random Values.
Which Golang.org/x/crypto versions are affected?
Affected versions include releases prior to 0.0.0-20190320223903-b7391e95e576 across affected packages: golang.org/x/crypto.
What version fixes CVE-2019-11840?
Upgrading to 0.0.0-20190320223903-b7391e95e576 (or the latest patched release for your respective branch) resolves the vulnerability.
Is golang.org/x/crypto affected?
Yes, golang.org/x/crypto is affected in releases prior to 0.0.0-20190320223903-b7391e95e576. Upgrade your dependency to 0.0.0-20190320223903-b7391e95e576 or later.
What is the CVSS score of CVE-2019-11840?
CVE-2019-11840 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2019-11840?
CVE-2019-11840 is classified under CWE-330: Use of Insufficiently Random Values (The product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.).
How can I check Go dependencies for CVE-2019-11840?
Run the dependency tree command: 'inspect dependencies for golang.org/x/crypto'. 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-r5c5-pr8j-pfp7",
  "modified" : "2023-09-29T15:47:38Z",
  "published" : "2022-05-24T16:45:25Z",
  "aliases" : [ "CVE-2019-11840" ],
  "summary" : "golang.org/x/crypto/salsa20/salsa uses insufficiently random values",
  "details" : "An issue was discovered in supplementary Go cryptography libraries, aka golang-googlecode-go-crypto, before 2019-03-20. A flaw was found in the amd64 implementation of golang.org/x/crypto/salsa20 and golang.org/x/crypto/salsa20/salsa. If more than 256 GiB of keystream is generated, or if the counter otherwise grows greater than 32 bits, the amd64 implementation will first generate incorrect output, and then cycle back to previously generated keystream. Repeated keystream bytes can lead to loss of confidentiality in encryption applications, or to predictability in CSPRNG applications.\n\n### Specific Go Packages Affected\ngolang.org/x/crypto/salsa20/salsa",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "golang.org/x/crypto"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20190320223903-b7391e95e576"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-11840"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/golang/go/issues/30965"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=1691529"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/golang/go"
  }, {
    "type" : "WEB",
    "url" : "https://go.dev/cl/168406"
  }, {
    "type" : "WEB",
    "url" : "https://go.dev/issue/30965"
  }, {
    "type" : "WEB",
    "url" : "https://go.googlesource.com/crypto/+/b7391e95e576cacdcdd422573063bc057239113d"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/forum/#!msg/golang-announce/tjyNcJxb2vQ/n0NRBziSCAAJ"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/g/golang-announce/c/tjyNcJxb2vQ/m/n0NRBziSCAAJ"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2019/06/msg00029.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2020/10/msg00014.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2020/11/msg00016.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2020/11/msg00030.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2021/01/msg00015.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/06/msg00017.html"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2022-0209"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-330" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-02-08T00:33:46Z",
    "nvd_published_at" : "2019-05-09T16:29:00Z"
  }
}