5.9medium
Denial of service when feeding malformed size arguments in go-bitfield
- Severity
- 5.9medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.92% (higher than 61% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-2h6c-j3gf-xp9rGO-2023-1558
Description
go-bitfield is a simple bitfield package for the go language aiming to be more performant that the standard library. When feeding untrusted user input into the size parameter of `NewBitfield` and `FromBytes` functions, an attacker can trigger `panic`s. This happen when the `size` is a not a multiple of `8` or is negative. There were already a note in the `NewBitfield` documentation, however known users of this package are subject to this issue. Users are advised to upgrade. Users unable to upgrade should ensure that `size` is a multiple of 8 before calling `NewBitfield` or `FromBytes`.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| ipfs go-bitfield | < 1.1.0 | CVE List |
| github.com/ipfs/go-bitfield (Go) | before 1.1.0 | GitHub Advisory Database, Go Vulnerability Database |
| protocol go-bitfield | before 1.1.0 | NVD |
All scores
| GitHub_M | 5.9medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H |
| GitHub | 5.9medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
Classification
What each source says
CVE List
go-bitfield is a simple bitfield package for the go language aiming to be more performant that the standard library. When feeding untrusted user input into the size parameter of `NewBitfield` and `FromBytes` functions, an attacker can trigger `panic`s. This happen when the `size` is a not a multiple of `8` or is negative. There were already a note in the `NewBitfield` documentation, however known users of this package are subject to this issue. Users are advised to upgrade. Users unable to upgrade should ensure that `size` is a multiple of 8 before calling `NewBitfield` or `FromBytes`.
GitHub Advisory Database
Impact
When feeding untrusted user input into the size parameter of NewBitfield and FromBytes functions, an attacker can trigger panics.
This happen when the size is a not a multiple of 8 or is negative.
There were already a note in the NewBitfield documentation:
Panics if size is not a multiple of 8.
But it incomplete and missing from FromBytes's documentation.
This has been replaced by returning an (Bitfield, error) and returning a non nil error if the size is wrong.
Patches
Workarounds
- Ensure
size%8 == 0 && size >= 0yourself before callingNewBitfieldorFromBytes
References
Go Vulnerability Database
When feeding untrusted user input into the size parameter of NewBitfield and FromBytes functions, an attacker can trigger panics.
This happens when the size is a not a multiple of 8 or is negative.
A workaround is to ensure size%8 == 0 && size >= 0 yourself before calling NewBitfield or FromBytes.
References
| https://github.com/ipfs/go-bitfield/security/advisories/GHSA-2h6c-j3gf-xp9r | advisory, exploit, patch, vendor-advisory, web | |
| https://github.com/ipfs/go-bitfield/commit/5e1d256fe043fc4163343ccca83862c69c52e579 | fix, patch, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2023-23626 | advisory | |
| https://github.com/ipfs/go-bitfield | package | |
| https://pkg.go.dev/vuln/GO-2023-1558 | web | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-23626 changed 2025-03-10 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-2h6c-j3gf-xp9r changed 2026-09-10 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2023-1558 changed 2024-05-20 | CC-BY-4.0 |
| NVD | CVE-2023-23626 changed 2026-06-17 | Public domain |