llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · bitcoinjs-lib

GHSA-8247-5GP7-95QH

Block parsing copies the remaining buffer for every transaction and can cause denial of service

Texto original en inglés · Ver en español

Parche disponible
Descargar PNG JSON
CVSS
—
high
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a -13 d de la divulgación
Exposición25 dDesde la divulgación, 26 oct 2026, 1:40 p. m.
Detección23 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 7.0.3
Monitoreo
Detectada +1
13 oct 26
26 oct 26
18 nov 26
21 nov 26
13 oct 26
23 oct 26
1 nov 26
11 nov 26
21 nov 26
FechaFaseEventoDetalle
Remediación Parche 7.0.3 bitcoinjs-lib · -13 d desde divulgación
Divulgación Publicada GHSA-8247-5GP7-95QH divulgada
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

In affected versions of `bitcoinjs-lib`, `Block.fromBuffer` copies the remaining block bytes before parsing each transaction. A block containing many transactions can cause quadratic copying even when its encoded size is modest.

Applications that decode untrusted blocks synchronously can have their event loop blocked and experience heavy memory allocation. The block does not need valid proof of work or a valid Merkle root to reach this code.

Details

Inside the transaction loop, `Block.fromBuffer` passes the remaining bytes to `Transaction.fromBuffer`:

const tx = Transaction.fromBuffer(
  bufferReader.buffer.slice(bufferReader.offset),
  true,
);

`Uint8Array.prototype.slice` allocates and copies the selected bytes. With many small transactions, this copies almost the whole block on the first iteration, then a slightly shorter suffix on each following iteration. The sum of those copies grows quadratically with the number of transactions of a fixed small size.

This behavior differs from `Buffer.prototype.slice`, which returns a view. The regression affects the v7 Uint8Array parsing path. Calling `Block.fromHex` also reaches `Block.fromBuffer` with a Uint8Array.

Example

A block-shaped buffer can contain a header, a transaction count and many encoded transactions. Parsing happens before proof-of-work or Merkle-root validation, so an attacker does not need to mine a block to exercise the copying loop.

The faulty operation is the suffix copy itself. It remains expensive even if the integer helpers used inside `Transaction.fromBuffer` have been updated to avoid their own copies. The two operations do not depend on each other.

Impact

An application that accepts attacker-controlled block bytes or hex can spend excessive CPU time copying data and create substantial allocation and garbage-collection pressure. Since decoding is synchronous, it can delay unrelated requests on the same event loop. This is relevant to services such as block decoders and indexers that parse bytes before validating the block.

Affected versions

bitcoinjs-lib 7.0.0-rc.0 through 7.0.2 are affected when parsing Uint8Array input. The published release candidate is included. The Buffer-based v5 and v6 implementations do not have this Uint8Array suffix-copy regression.

Fix and workarounds

Upgrade bitcoinjs-lib to 7.0.3 or a later patched release. The parser uses `subarray` instead of `slice` when passing the remaining block to the transaction parser. `subarray` creates a view and avoids the repeated suffix copies.

Updating only the integer-reading dependencies does not fix this operation in bitcoinjs-lib. Applications can reduce exposure with input limits and isolated parsing workers but should still upgrade.

References
  • bitcoinjs-lib 7.0.3 on npm https://www.npmjs.com/package/bitcoinjs-lib/v/7.0.3
  • Fix: Avoid repeated buffer copies when parsing transactions and blocks https://github.com/bitcoinjs/bitcoinjs-lib/commit/cfbe5b4001128d173d9e5a3c5d51e14b1e0ed890
Versiones

Rangos afectados

Afectada Corregida Última
bitcoinjs-lib≥ 7.0.0-rc.0 < 7.0.3
7.0.0-rc.0
7.0.3
7.0.5
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npmbitcoinjs-lib
Corregida 7.0.3 -13 d 7.0.5 no afectada
Versiones corregidas7.0.3
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/bitcoinjs/bitcoinjs-lib/security/advisories/GHSA-8247-5gp7-95qh

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.