CVE-2023-40583: Github.com/libp2p/go libp2p Libp2p Nodes Vulnerable To OOM Vulnerability

HIGH
Advisory Identifier: GHSA-gcq9-qqwx-rgj3
CVSS 7.5
CWE-400
Published
Advisory Summary

CVE-2023-40583 is a HIGH (CVSS 7.5) libp2p nodes vulnerable to oom vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Github.com/libp2p/go libp2p libraries in the Go ecosystem. The issue involves libp2p nodes vulnerable to oom attack. Remediation is available by upgrading affected packages to version 0.27.4.

CVE-2023-40583 at a Glance

CVE Identifier CVE-2023-40583
GHSA Identifier GHSA-gcq9-qqwx-rgj3
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Github.com/libp2p/go libp2p
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-2023-40583

To remediate this vulnerability, upgrade all affected Github.com/libp2p/go libp2p 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/libp2p/go-libp2p fixed: 0.27.4
Upgrade github.com/libp2p/go-libp2p to 0.27.4
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/libp2p/go-libp2p

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-40583, inspect your project dependencies for Github.com/libp2p/go libp2p:

inspect dependencies for github.com/libp2p/go-libp2p

Analyze the terminal output to locate any version of Github.com/libp2p/go libp2p in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.27.4), 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Github.com/libp2p/go libp2p, 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

### Summary In go-libp2p, by using signed peer records a malicious actor can store an arbitrary amount of data in a remote node’s memory. This memory does not get garbage collected and so the victim can run out of memory and crash. It is feasible to do this at scale. An attacker would have to transfer ~1/2 as much memory it wants to occupy (2x amplification factor). The attacker can perform this attack over time as the target node’s memory will not be garbage collected. This can occur because when a signed peer record is received, only the signature validity check is performed but the sender signature is not checked. Signed peer records from randomly generated peers can be sent by a malicious actor. A target node will accept the peer record as long as the signature is valid, and then stored in the peer store. There is cleanup logic in the peer store that cleans up data when a peer disconnects, but this cleanup is never triggered for the fake peer (from which signed peer records were accepted) because it was never “connected”. ### Impact If users of go-libp2p in production are not monitoring memory consumption over time, it could be a silent attack i.e. the attacker could bring down nodes over a period of time (how long depends on the node resources i.e. a go-libp2p node on a virtual server with 4 gb of memory takes about 90 sec to bring down; on a larger server, it might take a bit longer.) ### Patches Update your go-libp2p dependency to the latest release, v0.30.0 at the time of writing. If you'd like to stay on the 0.27.x release, we strongly recommend users to update to go-libp2p [0.27.7](https://github.com/libp2p/go-libp2p/releases/tag/v0.27.7). Though this OOM issue was fixed in 0.27.4, there were subsequent patch releases afterwards (important fixes for other issues unrelated to the OOM). ### Workarounds None

CVE-2023-40583 Affected Github.com/libp2p/go libp2p Versions

1 component(s)
Fixed Versions:
0.27.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/libp2p/go-libp2p
Go
< 0.27.4
0.27.4

References

Frequently Asked Questions

What is CVE-2023-40583?
CVE-2023-40583 is a security vulnerability in Github.com/libp2p/go libp2p involving libp2p nodes vulnerable to OOM attack under CWE-400: Uncontrolled Resource Consumption.
Which Github.com/libp2p/go libp2p versions are affected?
Affected versions include releases prior to 0.27.4 across affected packages: github.com/libp2p/go-libp2p.
What version fixes CVE-2023-40583?
Upgrading to 0.27.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/libp2p/go-libp2p affected?
Yes, github.com/libp2p/go-libp2p is affected in releases prior to 0.27.4. Upgrade your dependency to 0.27.4 or later.
What is the CVSS score of CVE-2023-40583?
CVE-2023-40583 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-2023-40583?
CVE-2023-40583 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check Go dependencies for CVE-2023-40583?
Run the dependency tree command: 'inspect dependencies for github.com/libp2p/go-libp2p'. 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-gcq9-qqwx-rgj3",
  "modified" : "2023-11-17T22:07:30Z",
  "published" : "2023-08-24T22:22:59Z",
  "aliases" : [ "CVE-2023-40583" ],
  "summary" : "libp2p nodes vulnerable to OOM attack",
  "details" : "### Summary\nIn go-libp2p, by using signed peer records a malicious actor can store an arbitrary amount of data in a remote node’s memory. This memory does not get garbage collected and so the victim can run out of memory and crash.\n\nIt is feasible to do this at scale. An attacker would have to transfer ~1/2 as much memory it wants to occupy (2x amplification factor).\n\nThe attacker can perform this attack over time as the target node’s memory will not be garbage collected.\n\nThis can occur because when a signed peer record is received, only the signature validity check is performed but the sender signature is not checked. Signed peer records from randomly generated peers can be sent by a malicious actor. A target node will accept the peer record as long as the signature is valid, and then stored in the peer store.\n\nThere is cleanup logic in the peer store that cleans up data when a peer disconnects, but this cleanup is never triggered for the fake peer (from which signed peer records were accepted) because it was never “connected”.\n\n### Impact\nIf users of go-libp2p in production are not monitoring memory consumption over time, it could be a silent attack i.e. the attacker could bring down nodes over a period of time (how long depends on the node resources i.e. a go-libp2p node on a virtual server with 4 gb of memory takes about 90 sec to bring down; on a larger server, it might take a bit longer.)\n\n### Patches\nUpdate your go-libp2p dependency to the latest release, v0.30.0 at the time of writing.\n\nIf you'd like to stay on the 0.27.x release, we strongly recommend users to update to go-libp2p [0.27.7](https://github.com/libp2p/go-libp2p/releases/tag/v0.27.7). Though this OOM issue was fixed in 0.27.4, there were subsequent patch releases afterwards (important fixes for other issues unrelated to the OOM).\n\n### Workarounds\nNone",
  "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/libp2p/go-libp2p"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.27.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.27.3"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/libp2p/go-libp2p/security/advisories/GHSA-gcq9-qqwx-rgj3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-40583"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/libp2p/go-libp2p/commit/45d3c6fff662ddd6938982e7e9309ad5fa2ad8dd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/libp2p/go-libp2p"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/libp2p/go-libp2p/releases/tag/v0.27.4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/libp2p/go-libp2p/releases/tag/v0.27.7"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-24T22:22:59Z",
    "nvd_published_at" : "2023-08-25T21:15:09Z"
  }
}