GHSA-f2gr-7299-487h: Github.com/ipfs/go ipfs Denial of Service Vulnerability

MODERATE
CWE-400
Published
Advisory Summary

GHSA-f2gr-7299-487h is a MODERATE denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Github.com/ipfs/go ipfs libraries in the Go ecosystem. The issue involves dos and excessive memory usage when passing untrusted user input to to dag import. Remediation is available by upgrading affected packages to version 0.13.1.

GHSA-f2gr-7299-487h at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-f2gr-7299-487h
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Github.com/ipfs/go ipfs
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-f2gr-7299-487h

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

How to Check if You Are Affected

To determine whether your application is affected by GHSA-f2gr-7299-487h, inspect your project dependencies for Github.com/ipfs/go ipfs:

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

Analyze the terminal output to locate any version of Github.com/ipfs/go ipfs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.13.1), 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/ipfs/go ipfs, 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

### Impact go-ipfs nodes crash when trying to import certain malformed CAR files due to an issue in the go-car dependency. This impacts nodes running `ipfs dag import` on untrusted user inputs, for example, pinning services with a car ingest endpoint. This include the corresponding [HTTP RPC API `v0/dag/import`](https://docs.ipfs.io/reference/http/api/#api-v0-dag-import) endpoint. An attacker controlling the car file passed in can also make the node allocate arbitrary sized buffers creating memory exhaustion attacks. ### Patches 0.13.1, 0.14 and later. #### Forks For those running on forked versions of go-ipfs, simply updating the version of `github.com/ipld/go-car/v2` you are using to >= v2.4.0 should resolve the issue. #### Libraries consumers Any users of libraries within the go-ipfs ecosystem, even if not the go-ipfs package or binary itself, may be affected and should upgrade their dependency on go-car. You can check if your Go module has a dependency on go-car by running a command such as `go mod graph | grep go-car` in your module root. Note: if you are using other libraries, some parts of go-car (`github.com/ipld/go-car/v2/index/...`) have not fully been fixed yet. Please see [go-car's security advisory](https://github.com/ipld/go-car/security/advisories/GHSA-9x4h-8wgm-8xfg) for more information. go-ipfs do not make use of this code. ### Workarounds The best way to work around this is to control exposure to the [HTTP RPC API endpoint for CAR imports](https://docs.ipfs.io/reference/http/api/#api-v0-dag-import) to only work with trusted data. You can also validate that the car will not crash go-ipfs by running `car verify` on it first (`go install github.com/ipld/go-car/cmd/car@latest`). ### References See also the [go-car security advisory](https://github.com/ipld/go-car/security/advisories/GHSA-9x4h-8wgm-8xfg). ### For more information If you have any questions or comments about this advisory: 1. Ask in the [IPFS Discourse](discuss.ipfs.io/) 1. Ask in the [IPFS Discord #ipld-chatter](https://discord.gg/ipfs) 1. Open an issue in [go-ipfs](https://github.com/ipfs/go-ipfs)

GHSA-f2gr-7299-487h Affected Github.com/ipfs/go ipfs Versions

1 component(s)
Fixed Versions:
0.13.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/ipfs/go-ipfs
Go
≥ 0.5.0
< 0.13.1
0.13.1

References

Frequently Asked Questions

What is GHSA-f2gr-7299-487h?
GHSA-f2gr-7299-487h is a security vulnerability in Github.com/ipfs/go ipfs involving DOS and excessive memory usage when passing untrusted user input to to dag import under CWE-400: Uncontrolled Resource Consumption.
Which Github.com/ipfs/go ipfs versions are affected?
Affected versions include releases prior to 0.13.1 across affected packages: github.com/ipfs/go-ipfs.
What version fixes GHSA-f2gr-7299-487h?
Upgrading to 0.13.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/ipfs/go-ipfs affected?
Yes, github.com/ipfs/go-ipfs is affected in releases prior to 0.13.1. Upgrade your dependency to 0.13.1 or later.
What CWE is associated with GHSA-f2gr-7299-487h?
GHSA-f2gr-7299-487h 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 GHSA-f2gr-7299-487h?
Run the dependency tree command: 'inspect dependencies for github.com/ipfs/go-ipfs'. 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-f2gr-7299-487h",
  "modified" : "2022-07-06T20:06:56Z",
  "published" : "2022-07-06T20:06:56Z",
  "aliases" : [ ],
  "summary" : "DOS and excessive memory usage when passing untrusted user input to to dag import",
  "details" : "### Impact\ngo-ipfs nodes crash when trying to import certain malformed CAR files due to an issue in the go-car dependency. This impacts nodes running `ipfs dag import` on untrusted user inputs, for example, pinning services with a car ingest endpoint.\nThis include the corresponding [HTTP RPC API `v0/dag/import`](https://docs.ipfs.io/reference/http/api/#api-v0-dag-import) endpoint.\n\nAn attacker controlling the car file passed in can also make the node allocate arbitrary sized buffers creating memory exhaustion attacks.\n\n### Patches\n0.13.1, 0.14 and later.\n\n#### Forks\nFor those running on forked versions of go-ipfs, simply updating the version of `github.com/ipld/go-car/v2` you are using to >= v2.4.0 should resolve the issue.\n\n#### Libraries consumers\nAny users of libraries within the go-ipfs ecosystem, even if not the go-ipfs package or binary itself, may be affected and should upgrade their dependency on go-car.\n\nYou can check if your Go module has a dependency on go-car by running a command such as `go mod graph | grep go-car`  in your module root.\n\nNote: if you are using other libraries, some parts of go-car (`github.com/ipld/go-car/v2/index/...`) have not fully been fixed yet.  Please see [go-car's security advisory](https://github.com/ipld/go-car/security/advisories/GHSA-9x4h-8wgm-8xfg) for more information.  go-ipfs do not make use of this code.\n\n### Workarounds\nThe best way to work around this is to control exposure to the [HTTP RPC API endpoint for CAR imports](https://docs.ipfs.io/reference/http/api/#api-v0-dag-import) to only work with trusted data.\n\nYou can also validate that the car will not crash go-ipfs by running `car verify` on it first (`go install github.com/ipld/go-car/cmd/car@latest`).\n\n### References\nSee also the [go-car security advisory](https://github.com/ipld/go-car/security/advisories/GHSA-9x4h-8wgm-8xfg).\n\n### For more information\nIf you have any questions or comments about this advisory:\n1. Ask in the [IPFS Discourse](discuss.ipfs.io/)\n1. Ask in the [IPFS Discord #ipld-chatter](https://discord.gg/ipfs)\n1. Open an issue in [go-ipfs](https://github.com/ipfs/go-ipfs)",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/ipfs/go-ipfs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.5.0"
      }, {
        "fixed" : "0.13.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ipfs/go-ipfs/security/advisories/GHSA-f2gr-7299-487h"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ipfs/go-ipfs"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-07-06T20:06:56Z",
    "nvd_published_at" : null
  }
}