CVE-2022-23495 ProtoNode may be modified such that common method calls may panic in ipfs/go-merkledag
Attackers can cause a panic in the go-merkledag library by manipulating ProtoNode states, leading to denial of service in applications using this IPFS component.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2022-23495?
CVE-2022-23495 is a high-severity denial of service vulnerability in ipfs go-merkledag, published on 8 Dec 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
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.
Which versions are affected by CVE-2022-23495?
3 open source packages ship an affected version, including github.com/ipfs/go-merkledag. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
github.com/ipfs/go-merkledag Go | From 0.4.0 | 0.8.1 |
github.com/ipfs/go-merkledag Go | From 0.4.0 | 0.8.1 |
github.com/ipfs/go-merkledag Go | From 0.4.0 | 0.8.1 |
Products include Protocol Go-Merkledag.
How do I fix CVE-2022-23495?
Upgrade github.com/ipfs/go-merkledag to 0.8.1 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-2022-23495 being exploited?
There is no known exploitation of CVE-2022-23495 in the wild and no public exploit code.
Sources
Also known as GHSA-x39j-h85h-3f46, GO-2022-1155.