CVE-2023-22460
JSON

7.5high

go-ipld-prime json codec may panic if asked to encode bytes

Severity
7.5high CVSS:3.1 by GitHub_M
Exploit likelihood
1.17% (higher than 68% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-c653-6hhg-9x92GO-2023-1269

Description

go-ipld-prime is an implementation of the InterPlanetary Linked Data (IPLD) spec interfaces, a batteries-included codec implementations of IPLD for CBOR and JSON, and tooling for basic operations on IPLD objects. Encoding data which contains a Bytes kind Node will pass a Bytes token to the JSON encoder which will panic as it doesn't expect to receive Bytes tokens. Such an encode should be treated as an error, as plain JSON should not be able to encode Bytes. This only impacts uses of the `json` codec. `dag-json` is not impacted. Use of `json` as a decoder is not impacted. This issue is fixed in v0.19.0. As a workaround, one may prefer the `dag-json` codec, which has the ability to encode bytes.

Affected

Product or packageVersionsReported by
ipld go-ipld-prime< 0.19.0CVE List
github.com/ipld/go-ipld-prime (Go)before 0.19.0GitHub Advisory Database, Go Vulnerability Database
protocol go-ipld-primebefore 0.19.0NVD

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub5.9medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Classification

CWE-20

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

go-ipld-prime is an implementation of the InterPlanetary Linked Data (IPLD) spec interfaces, a batteries-included codec implementations of IPLD for CBOR and JSON, and tooling for basic operations on IPLD objects. Encoding data which contains a Bytes kind Node will pass a Bytes token to the JSON encoder which will panic as it doesn't expect to receive Bytes tokens. Such an encode should be treated as an error, as plain JSON should not be able to encode Bytes. This only impacts uses of the `json` codec. `dag-json` is not impacted. Use of `json` as a decoder is not impacted. This issue is fixed in v0.19.0. As a workaround, one may prefer the `dag-json` codec, which has the ability to encode bytes.

GitHub Advisory Database

go-ipld-prime is a series of Go interfaces for manipulating IPLD data and a Go module that contains the go-ipld-prime/codec/json codec.

Impact

Encoding data which contains a Bytes kind Node will pass a Bytes token to the JSON encoder which will panic as it doesn't expect to receive Bytes tokens. Such an encoding should be treated as an error, as plain JSON should not be able to encode Bytes.

This only impacts uses of the "json" codec, "dag-json" is not impacted. Use of "json" as a decoder is not impacted.

Patches

Fixed in v0.19.0.

Workarounds

Prefer the "dag-json" codec which has the ability to encode bytes.

References

See fix in #472

Go Vulnerability Database

Encoding data using the 'json' codec which contains a 'Bytes' type Node will cause the encoder to panic. The decoder is not impacted. If the codec is used to encode user supplied data, this may be used as a vector for a denial of service attack.

NVD (es)

go-ipld-prime es una implementación de las interfaces de especificaciones de datos vinculados interplanetarios (IPLD), que incluye implementaciones de códec de IPLD para CBOR y JSON y herramientas para operaciones básicas en objetos IPLD. La codificación de datos que contiene un nodo de tipo Bytes pasará un token de Bytes al codificador JSON, lo que entrará en pánico porque no espera recibir tokens de Bytes. Dicha codificación debe tratarse como un error, ya que JSON simple no debería poder codificar bytes. Esto solo afecta los usos del códec "json". `dag-json` no se ve afectado. El uso de `json` como decodificador no se ve afectado. Este problema se solucionó en v0.19.0. Como workaround, se puede preferir el códec `dag-json`, que tiene la capacidad de codificar bytes.

References

Sources

SourceRecordLicence
CVE ListCVE-2023-22460 changed 2026-08-27CVE Terms of Use
GitHub Advisory DatabaseGHSA-c653-6hhg-9x92 changed 2023-11-08CC-BY-4.0
Go Vulnerability DatabaseGO-2023-1269 changed 2024-05-20CC-BY-4.0
NVDCVE-2023-22460 changed 2026-08-27Public domain