CVE-2020-5303: Github.com/tendermint/tendermint Denial of Service Vulnerability

LOW
Advisory Identifier: GHSA-v24h-pjjv-mcp6
CVSS 3.1
CWE-789 CWE-787
Published
Advisory Summary

CVE-2020-5303 is a LOW (CVSS 3.1) denial of service vulnerability (CWE-789: Memory Allocation with Excessive Size Value) affecting Github.com/tendermint/tendermint libraries in the Go ecosystem. The issue involves denial of service in tendermint. Remediation is available by upgrading affected packages to version 0.33.3, 0.31.12, 0.32.10.

CVE-2020-5303 at a Glance

CVE Identifier CVE-2020-5303
GHSA Identifier GHSA-v24h-pjjv-mcp6
Severity LOW
CVSS v3.1 Base Score 3.1
CWE Classification CWE-789: Memory Allocation with Excessive Size Value
Affected Product Github.com/tendermint/tendermint
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 3.1

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:R/S:U/C:N/I:N/A:L).

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

How to Fix CVE-2020-5303

To remediate this vulnerability, upgrade all affected Github.com/tendermint/tendermint 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/tendermint/tendermint fixed: 0.33.3
Upgrade github.com/tendermint/tendermint to 0.33.3
github.com/tendermint/tendermint fixed: 0.31.12
Upgrade github.com/tendermint/tendermint to 0.31.12
github.com/tendermint/tendermint fixed: 0.32.10
Upgrade github.com/tendermint/tendermint to 0.32.10
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/tendermint/tendermint

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-5303, inspect your project dependencies for Github.com/tendermint/tendermint:

inspect dependencies for github.com/tendermint/tendermint

Analyze the terminal output to locate any version of Github.com/tendermint/tendermint in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.33.3), 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-789: Memory Allocation with Excessive Size Value, where the product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated. In Github.com/tendermint/tendermint, 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

### Description **Denial of Service 1** Tendermint 0.33.2 and earlier does not limit the number of P2P connection requests. For each p2p connection, Tendermint allocates XXX bytes. Even though this memory is garbage collected once the connection is terminated (due to duplicate IP or reaching a maximum number of inbound peers), temporary memory spikes can lead to OOM (Out-Of-Memory) exceptions. Tendermint 0.33.3 (and 0.32.10) limits the total number of P2P incoming connection requests to to `p2p.max_num_inbound_peers + len(p2p.unconditional_peer_ids)`. Notes: - Tendermint does not rate limit P2P connection requests per IP (an attacker can saturate all the inbound slots); - Tendermint does not rate limit HTTP(S) requests. If you expose any RPC endpoints to the public, please make sure to put in place some protection (https://www.nginx.com/blog/rate-limiting-nginx/). We may implement this in the future (https://github.com/tendermint/tendermint/issues/1696). **Denial of Service 2** Tendermint 0.33.2 and earlier does not reclaim `activeID` of a peer after it's removed in `Mempool` reactor. This does not happen all the time. It only happens when a connection fails (for any reason) before the `Peer` is created and added to all reactors. `RemovePeer` is therefore called before `AddPeer`, which leads to always growing memory (`activeIDs` map). The `activeIDs` map has a maximum size of 65535 and the node will panic if this map reaches the maximum. An attacker can create a lot of connection attempts (exploiting Denial of Service 1), which ultimately will lead to the node panicking. Tendermint 0.33.3 (and 0.32.10) claims `activeID` for a peer in `InitPeer`, which is executed before `MConnection` is started. Notes: - `InitPeer` function was added to all reactors to combat a similar issue - https://github.com/tendermint/tendermint/issues/3338; - Denial of Service 2 is independent of Denial of Service 1 and can be executed without it. ### Specific Go Packages Affected github.com/tendermint/tendermint/p2p ### Impact - All full nodes (except for validators who are behind closed networks) - Node's memory usage increases, then it panics either in the mempool or due to OOM. ### Patches - v0.33.3 - v0.32.10 - v0.31.12 ### Workarounds No workarounds. ### References - https://hackerone.com/reports/820317 (not disclosed yet) - https://github.com/tendermint/tendermint/issues/3338 - https://github.com/tendermint/tendermint/issues/1696 ### For more information If you have any questions or comments about this advisory: * Open an issue in [tendermint/tendermint](https://github.com/tendermint/tendermint) * Email us at [security@tendermint.com](mailto:security@tendermint.com) More information can be found [here](https://tendermint.com/security/). ### Credits - [fudongbai](https://hackerone.com/fudongbai) for discovering and reporting Denial of Service 2 - Ethan Buchman (@ebuchman) for writing a test case for Denial of Service 2 and Tess Rinearson (@tessr) for fixing it - Anton Kaliaev (@melekes) for fixing Denial of Service 1

CVE-2020-5303 Affected Github.com/tendermint/tendermint Versions

3 component(s)
Fixed Versions:
0.33.30.31.120.32.10
Product / Package Ecosystem Affected Versions Fixed Version
github.com/tendermint/tendermint
Go
≥ 0.33.0
< 0.33.3
0.33.3
github.com/tendermint/tendermint
Go
< 0.31.12
0.31.12
github.com/tendermint/tendermint
Go
≥ 0.32.0
< 0.32.10
0.32.10

References

Frequently Asked Questions

What is CVE-2020-5303?
CVE-2020-5303 is a security vulnerability in Github.com/tendermint/tendermint involving Denial of service in Tendermint under CWE-789: Memory Allocation with Excessive Size Value.
Which Github.com/tendermint/tendermint versions are affected?
Affected versions include releases prior to 0.33.3, 0.31.12, 0.32.10 across affected packages: github.com/tendermint/tendermint.
What version fixes CVE-2020-5303?
Upgrading to 0.33.3, 0.31.12, 0.32.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/tendermint/tendermint affected?
Yes, github.com/tendermint/tendermint is affected in releases prior to 0.33.3, 0.31.12, 0.32.10. Upgrade your dependency to 0.33.3, 0.31.12, 0.32.10 or later.
What is the CVSS score of CVE-2020-5303?
CVE-2020-5303 has a CVSS v3.1 base score of 3.1 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2020-5303?
CVE-2020-5303 is classified under CWE-789: Memory Allocation with Excessive Size Value (The product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated.).
How can I check Go dependencies for CVE-2020-5303?
Run the dependency tree command: 'inspect dependencies for github.com/tendermint/tendermint'. 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-v24h-pjjv-mcp6",
  "modified" : "2023-10-02T12:27:32Z",
  "published" : "2021-05-27T18:44:09Z",
  "aliases" : [ "CVE-2020-5303" ],
  "summary" : "Denial of service in Tendermint",
  "details" : "### Description\n\n**Denial of Service 1**\n\nTendermint 0.33.2 and earlier does not limit the number of P2P connection requests. For each p2p connection, Tendermint allocates XXX bytes. Even though this memory is garbage collected once the connection is terminated (due to duplicate IP or reaching a maximum number of inbound peers), temporary memory spikes can lead to OOM (Out-Of-Memory) exceptions. \n\nTendermint 0.33.3 (and 0.32.10) limits the total number of P2P incoming connection requests to to `p2p.max_num_inbound_peers + len(p2p.unconditional_peer_ids)`.\n\nNotes:\n\n- Tendermint does not rate limit P2P connection requests per IP (an attacker can saturate all the inbound slots);\n- Tendermint does not rate limit HTTP(S) requests. If you expose any RPC endpoints to the public, please make sure to put in place some protection (https://www.nginx.com/blog/rate-limiting-nginx/). We may implement this in the future (https://github.com/tendermint/tendermint/issues/1696).\n\n**Denial of Service 2**\n\nTendermint 0.33.2 and earlier does not reclaim `activeID` of a peer after it's removed in `Mempool` reactor. This does not happen all the time. It only happens when a connection fails (for any reason) before the `Peer` is created and added to all reactors. `RemovePeer` is therefore called before `AddPeer`, which leads to always growing memory (`activeIDs` map). The `activeIDs` map has a maximum size of 65535 and the node will panic if this map reaches the maximum. An attacker can create a lot of connection attempts (exploiting Denial of Service 1), which ultimately will lead to the node panicking.\n\nTendermint 0.33.3 (and 0.32.10) claims `activeID` for a peer in `InitPeer`, which is executed before `MConnection` is started.\n\nNotes: \n\n- `InitPeer` function was added to all reactors to combat a similar issue - https://github.com/tendermint/tendermint/issues/3338;\n- Denial of Service 2 is independent of Denial of Service 1 and can be executed without it.\n\n### Specific Go Packages Affected\ngithub.com/tendermint/tendermint/p2p\n\n### Impact\n\n- All full nodes (except for validators who are behind closed networks)\n- Node's memory usage increases, then it panics either in the mempool or due to OOM.\n\n### Patches\n\n- v0.33.3\n- v0.32.10\n- v0.31.12\n\n### Workarounds\n\nNo workarounds.\n\n### References\n\n- https://hackerone.com/reports/820317 (not disclosed yet)\n- https://github.com/tendermint/tendermint/issues/3338\n- https://github.com/tendermint/tendermint/issues/1696\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in [tendermint/tendermint](https://github.com/tendermint/tendermint)\n* Email us at [security@tendermint.com](mailto:security@tendermint.com)\n\nMore information can be found [here](https://tendermint.com/security/).\n\n### Credits\n\n- [fudongbai](https://hackerone.com/fudongbai) for discovering and reporting Denial of Service 2\n- Ethan Buchman (@ebuchman) for writing a test case for Denial of Service 2 and Tess Rinearson (@tessr) for fixing it\n- Anton Kaliaev (@melekes) for fixing Denial of Service 1",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/tendermint/tendermint"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.33.0"
      }, {
        "fixed" : "0.33.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/tendermint/tendermint"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.31.12"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/tendermint/tendermint"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.32.0"
      }, {
        "fixed" : "0.32.10"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tendermint/tendermint/security/advisories/GHSA-v24h-pjjv-mcp6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-5303"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tendermint/tendermint/issues/1696"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tendermint/tendermint/issues/3338"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tendermint/tendermint/commit/e2d6859afd7dba4cf97c7f7d412e7d8fc908d1cd"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/820317"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tendermint/tendermint"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md#denial-of-service-1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-787", "CWE-789" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-24T21:16:50Z",
    "nvd_published_at" : null
  }
}