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

High 7.5 Published Updated

Attackers can cause a denial of service by triggering a panic in the go-ipld-prime JSON codec when encoding byte data.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2023-22460?

CVE-2023-22460 is a high-severity denial of service vulnerability in go-ipld-prime, published on 4 Jan 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official 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.

Weakness: CWE-20

Which versions are affected by CVE-2023-22460?

3 open source packages ship an affected version, including github.com/ipld/go-ipld-prime. It affects 1 product.

PackageAffectedFixed in
github.com/ipld/go-ipld-prime GoAll versions0.19.0
github.com/ipld/go-ipld-prime GoAll versions0.19.0
github.com/ipld/go-ipld-prime GoAll versions0.19.0

Products include Protocol Go-Ipld-Prime.

How do I fix CVE-2023-22460?

Upgrade github.com/ipld/go-ipld-prime to 0.19.0 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2023-22460 being exploited?

There is no known exploitation of CVE-2023-22460 in the wild and no public exploit code.

Sources

Also known as GHSA-c653-6hhg-9x92, GO-2023-1269.

Is CVE-2023-22460 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free