Skip to content
Heist/ feed
Back to feed
High

ProtoNode may be modified such that common method calls may panic in ipfs/go-merkledag

Type: advisorySources: OSV

go-merkledag implements the 'DAGService' interface and adds two ipld node types, Protobuf and Raw for the ipfs project. A `ProtoNode` may be modified in such a way as to cause various encode errors which will trigger a panic on common method calls that don't allow for error returns. A `ProtoNode` should only be able to encode to valid DAG-PB, attempting to encode invalid DAG-PB forms will result in an error from the codec. Manipulation of an existing (newly created or decoded) `ProtoNode` using the modifier methods did not account for certain states that would place the `ProtoNode` into an unencodeable form. Due to conformance with the [`github.com/ipfs/go-block-format#Block`](https://pkg.go.dev/github.com/ipfs/go-block-format#Block) and [`github.com/ipfs/go-ipld-format#Node`](https://pkg.go.dev/github.com/ipfs/go-ipld-format#Node) interfaces, certain methods, which internally require a re-encode if state has changed, will panic due to the inability to return an error. This issue has been addressed across a number of pull requests. Users are advised to upgrade to version 0.8.1 for a complete set of fixes. Users unable to upgrade may attempt to mitigate this issue by sanitising inputs when allowing user-input to set a new `CidBuilder` on a `ProtoNode` and by sanitising `Tsize` (`Link#Size`) values such that they are a reasonable byte-size for sub-DAGs where derived from user-input.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2022-23495
Confirmed fixed CVEs
Not specified
Updated in this feed
6 Nov 2026, 02:00 UTC · Revision 1

Source evidence

ProtoNode may be modified such that common method calls may panic in ipfs/go-merkledag

core-osv · Original source

Published 8 Dec 2022, 21:25 UTC

go-merkledag implements the 'DAGService' interface and adds two ipld node types, Protobuf and Raw for the ipfs project. A `ProtoNode` may be modified in such a way as to cause various encode errors which will trigger a panic on common method calls that don't allow for error returns. A `ProtoNode` should only be able to encode to valid DAG-PB, attempting to encode invalid DAG-PB forms will result in an error from the codec. Manipulation of an existing (newly created or decoded) `ProtoNode` using the modifier methods did not account for certain states that would place the `ProtoNode` into an unencodeable form. Due to conformance with the [`github.com/ipfs/go-block-format#Block`](https://pkg.go.dev/github.com/ipfs/go-block-format#Block) and [`github.com/ipfs/go-ipld-format#Node`](https://pkg.go.dev/github.com/ipfs/go-ipld-format#Node) interfaces, certain methods, which internally require a re-encode if state has changed, will panic due to the inability to return an error. This issue has been addressed across a number of pull requests. Users are advised to upgrade to version 0.8.1 for a complete set of fixes. Users unable to upgrade may attempt to mitigate this issue by sanitising inputs when allowing user-input to set a new `CidBuilder` on a `ProtoNode` and by sanitising `Tsize` (`Link#Size`) values such that they are a reasonable byte-size for sub-DAGs where derived from user-input.

osv:CVE-2022-23495
Complete source record
{
  "id": "bbbfa8ffb81087aecc424d65eda21825a72ad0d0d58ff31496eb474f1f5671be",
  "url": "https://osv.dev/vulnerability/CVE-2022-23495",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "ProtoNode may be modified such that common method calls may panic in ipfs/go-merkledag",
    "summary": "go-merkledag implements the 'DAGService' interface and adds two ipld node types, Protobuf and Raw for the ipfs project. A `ProtoNode` may be modified in such a way as to cause various encode errors which will trigger a panic on common method calls that don't allow for error returns. A `ProtoNode` should only be able to encode to valid DAG-PB, attempting to encode invalid DAG-PB forms will result in an error from the codec. Manipulation of an existing (newly created or decoded) `ProtoNode` using the modifier methods did not account for certain states that would place the `ProtoNode` into an unencodeable form. Due to conformance with the [`github.com/ipfs/go-block-format#Block`](https://pkg.go.dev/github.com/ipfs/go-block-format#Block) and [`github.com/ipfs/go-ipld-format#Node`](https://pkg.go.dev/github.com/ipfs/go-ipld-format#Node) interfaces, certain methods, which internally require a re-encode if state has changed, will panic due to the inability to return an error. This issue has been addressed across a number of pull requests. Users are advised to upgrade to version 0.8.1 for a complete set of fixes. Users unable to upgrade may attempt to mitigate this issue by sanitising inputs when allowing user-input to set a new `CidBuilder` on a `ProtoNode` and by sanitising `Tsize` (`Link#Size`) values such that they are a reasonable byte-size for sub-DAGs where derived from user-input.",
    "evidence": "osv:CVE-2022-23495",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2022-23495",
      "aliases": [
        "CVE-2022-23495",
        "GHSA-x39j-h85h-3f46",
        "GO-2022-1155"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/ipfs/go-merkledag",
              "type": "GIT",
              "events": [
                {
                  "introduced": "8794146d52c211b8af0456e734a248649e636be0"
                },
                {
                  "fixed": "503ecaa8b898d65ddaee92ba8c6ae60b824004c1"
                },
                {
                  "fixed": "0e4726d152e088749e0ef7404f44a4217f6f9d92"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:protocol:go-merkledag:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0.4.0"
                      },
                      {
                        "fixed": "0.8.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "0e4726d152e088749e0ef7404f44a4217f6f9d92"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "v0.8.0"
                  },
                  {
                    "range": [
                      {
                        "fixed": "503ecaa8b898d65ddaee92ba8c6ae60b824004c1"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "v0.8.1"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v0.7.0",
            "v0.6.0",
            "v0.5.1",
            "v0.5.0",
            "v0.4.1",
            "v0.4.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-23495.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:46.162959830Z",
      "provider": "osv",
      "references": [
        "https://en.wikipedia.org/wiki/Directed_acyclic_graph",
        "https://github.com/ipfs/go-merkledag/releases/tag/v0.8.0",
        "https://github.com/ipfs/go-merkledag/releases/tag/v0.8.1",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/23xxx/CVE-2022-23495.json",
        "https://github.com/ipfs/go-merkledag/security/advisories/GHSA-x39j-h85h-3f46",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-23495",
        "https://github.com/ipfs/go-merkledag/issues/90",
        "https://github.com/ipfs/kubo/issues/9297",
        "https://github.com/ipfs/go-merkledag/pull/91",
        "https://github.com/ipfs/go-merkledag/pull/92",
        "https://github.com/ipfs/go-merkledag/pull/93"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-755"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/23xxx/CVE-2022-23495.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-23495",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 514081,
  "published_at": "2022-12-08T21:25:40.257+00:00"
}