CVE-2019-13126: Github.com/nats io/nats server/v2 Integer Overflow Or Wraparound Vulnerability

HIGH
Advisory Identifier: GHSA-jp4j-47f9-2vc3
CVSS 7.5
CWE-190
Published
Advisory Summary

CVE-2019-13126 is a HIGH (CVSS 7.5) integer overflow or wraparound vulnerability (CWE-190: Integer Overflow or Wraparound) affecting Github.com/nats io/nats server/v2 libraries in the Go ecosystem. The issue involves integer overflow or wraparound in nats server. Remediation is available by upgrading affected packages to version 2.2.0.

CVE-2019-13126 at a Glance

CVE Identifier CVE-2019-13126
GHSA Identifier GHSA-jp4j-47f9-2vc3
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-190: Integer Overflow or Wraparound
Affected Product Github.com/nats io/nats server/v2
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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

How to Fix CVE-2019-13126

To remediate this vulnerability, upgrade all affected Github.com/nats io/nats server/v2 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/nats-io/nats-server/v2 fixed: 2.2.0
Upgrade github.com/nats-io/nats-server/v2 to 2.2.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/nats-io/nats-server/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2019-13126, inspect your project dependencies for Github.com/nats io/nats server/v2:

inspect dependencies for github.com/nats-io/nats-server/v2

Analyze the terminal output to locate any version of Github.com/nats io/nats server/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.2.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 CWE-190: Integer Overflow or Wraparound, where the product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. this occurs when an integer value is incremented to a value that is too large to store in the associated representation. when this occurs, the value may become a very small or negative number. In Github.com/nats io/nats server/v2, 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 integer overflow in NATS Server before 2.2.0 allows a remote attacker to crash the server by sending a crafted request. ### Specific Go Packages Affected github.com/nats-io/nats-server/v2/server

CVE-2019-13126 Affected Github.com/nats io/nats server/v2 Versions

1 component(s)
Fixed Versions:
2.2.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/nats-io/nats-server/v2
Go
< 2.2.0
2.2.0

References

Frequently Asked Questions

What is CVE-2019-13126?
CVE-2019-13126 is a security vulnerability in Github.com/nats io/nats server/v2 involving Integer Overflow or Wraparound in NATS Server under CWE-190: Integer Overflow or Wraparound.
Which Github.com/nats io/nats server/v2 versions are affected?
Affected versions include releases prior to 2.2.0 across affected packages: github.com/nats-io/nats-server/v2.
What version fixes CVE-2019-13126?
Upgrading to 2.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/nats-io/nats-server/v2 affected?
Yes, github.com/nats-io/nats-server/v2 is affected in releases prior to 2.2.0. Upgrade your dependency to 2.2.0 or later.
What is the CVSS score of CVE-2019-13126?
CVE-2019-13126 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2019-13126?
CVE-2019-13126 is classified under CWE-190: Integer Overflow or Wraparound (The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.).
How can I check Go dependencies for CVE-2019-13126?
Run the dependency tree command: 'inspect dependencies for github.com/nats-io/nats-server/v2'. 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-jp4j-47f9-2vc3",
  "modified" : "2023-09-29T16:33:59Z",
  "published" : "2021-05-18T18:14:55Z",
  "aliases" : [ "CVE-2019-13126" ],
  "summary" : "Integer Overflow or Wraparound in NATS Server",
  "details" : "An integer overflow in NATS Server before 2.2.0 allows a remote attacker to crash the server by sending a crafted request.\n\n### Specific Go Packages Affected\ngithub.com/nats-io/nats-server/v2/server",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/nats-io/nats-server/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-13126"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/pull/1053"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/pull/1441"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/commit/07ef71ff98f45f8c2711be4aeaf484610d891dda"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/commits/master"
  }, {
    "type" : "WEB",
    "url" : "https://www.twistlock.com/labs-blog/finding-dos-vulnerability-nats-go-fuzz-cve-2019-13126"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-190" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-17T16:35:04Z",
    "nvd_published_at" : "2019-07-29T17:15:00Z"
  }
}