Panic when processing certain blocks in go-codec-dagpb
Summary
CVE-2022-2584: ipld/go-codec-dagpb panics when processing certain blocks. Affects github.com/ipld/go-codec-dagpb versions < 1.3.1. Fixed in 1.3.1. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The go-codec-dagpb package is a Go implementation of the dag-pb codec for the go-ipld-prime library. It is used for encoding and decoding blocks in the InterPlanetary File System (IPFS) and other distributed systems. The package provides functionality for working with blocks in the dag-pb format, which is a binary encoding of IPLD data structures. The vulnerability in go-codec-dagpb can lead to a panic when processing certain blocks.
Vulnerability Detail
The vulnerability in go-codec-dagpb arises from an assumption that the reported link length is accurate. When decoding certain blocks, if the block ends before the reported length, it can result in a buffer overread and trigger a panic. This vulnerability can be exploited by an attacker to cause a denial of service (DoS) condition or potentially execute arbitrary code. The issue has been assigned a moderate severity rating.
How To Fix
Latest published version: v1.7.0 as of 22 Oct 2026
go get github.com/ipld/go-codec-dagpb@v1.7.0
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
1.3.1
This is the first release that contains the fix.
go get github.com/ipld/go-codec-dagpb@v1.3.1
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If you are unable to immediately upgrade to a fixed version of go-codec-dagpb, you can implement a workaround by recovering panics higher in the call stack of the goroutine that calls the defective code. This can help prevent the panic from propagating and causing a complete system failure.
Conclusion
The vulnerability in go-codec-dagpb can lead to a panic when processing certain blocks, potentially causing a denial of service (DoS) condition or enabling arbitrary code execution. It is recommended to upgrade to version 1.3.1 or above of go-codec-dagpb to fix the vulnerability. If immediate upgrade is not possible, implementing a workaround by recovering panics higher in the call stack can help mitigate the impact. For further support on vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for github.com/ipld/go-codec-dagpb →
FAQ
go-codec-dagpb is a Go package that provides encoding and decoding functionality for blocks in the dag-pb format. It is commonly used in distributed systems like IPFS.
The vulnerability can lead to a panic when processing certain blocks, potentially causing a denial of service (DoS) condition or enabling arbitrary code execution.
You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your Gopkg.lock file and Vulert will analyze it for open-source vulnerabilities.
Yes, you can implement a workaround by recovering panics higher in the call stack of the goroutine that calls the defective code. This can help mitigate the impact of the vulnerability.
For more information, you can ask in the IPFS Discord #ipld-chatter channel or open an issue in the go-codec-dagpb GitHub repository.