CVE-2023-23626
JSON

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 packageVersionsReported by
ipfs go-bitfield< 1.1.0CVE List
github.com/ipfs/go-bitfield (Go)before 1.1.0GitHub Advisory Database, Go Vulnerability Database
protocol go-bitfieldbefore 1.1.0NVD

All scores

GitHub_M5.9medium CVSS:3.1CVSS:3.1/AV:N/AC:H/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-754CWE-1284

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

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 >= 0 yourself before calling NewBitfield or FromBytes
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

Sources

SourceRecordLicence
CVE ListCVE-2023-23626 changed 2025-03-10CVE Terms of Use
GitHub Advisory DatabaseGHSA-2h6c-j3gf-xp9r changed 2026-09-10CC-BY-4.0
Go Vulnerability DatabaseGO-2023-1558 changed 2024-05-20CC-BY-4.0
NVDCVE-2023-23626 changed 2026-06-17Public domain