GHSA-88JR-9QJ4-CCM4
Repeated integer reads copy entire transaction buffers and can cause denial of service
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 7.0.3 | bitcoinjs-lib · -13 d desde divulgación | |
| Divulgación | Publicada | GHSA-88JR-9QJ4-CCM4 divulgada | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
In affected versions of `bitcoinjs-lib`, repeated integer reads during transaction parsing can copy the entire input buffer for each read. A transaction with many inputs or outputs can therefore take quadratic time to parse and allocate far more memory than its encoded size.
Applications that parse untrusted transactions synchronously can have their event loop blocked by one request. No valid signatures or proof of work are needed to reach the parser.
Details
`Transaction.fromBuffer` uses `BufferReader` to read transaction fields. The reader passes its full buffer and an offset to integer helpers in `uint8array-tools`. Affected helpers convert the buffer using `Buffer.from(buffer)` before reading a small value:
const buf = Buffer.from(buffer);
return buf.readUInt8(offset);For a `Uint8Array`, this conversion copies the whole array. The number of reads grows with the number of transaction inputs and outputs. For a buffer of length L and R integer reads, the copying work is proportional to L times R rather than just L.
The same transaction parser is used while decoding blocks and PSBT unsigned transactions. This issue concerns the integer-read helpers, including reads made by the transaction's length-decoding dependencies.
Example
The reporter measured `Transaction.fromBuffer` on `bitcoinjs-lib` 7.0.1 using transactions with many inputs:
| Inputs | Encoded size | Reported parse time |
| --- | --- | --- |
| 1,500 | 60 kB | 177 ms |
| 3,000 | 120 kB | 567 ms |
| 6,000 | 240 kB | 2,006 ms |
These are measurements from the reporter's environment, not timing guarantees for other machines. Parsing does not check whether these transactions would be accepted by the Bitcoin network.
Impact
A service that accepts attacker-controlled transaction bytes or hex can spend excessive CPU time and memory on one input. Since parsing is synchronous, other work on the same event loop is delayed. The exposure depends on how the application accepts and limits untrusted input.
Affected versions
The affected bitcoinjs-lib releases are 7.0.0-rc.0 through 7.0.2 when their dependency tree contains the copying integer helpers. The earliest affected release candidate is included, not just stable 7.0.0.
The helpers are implemented in `uint8array-tools`. Its fixed release is 0.0.10. This advisory describes their use in bitcoinjs-lib transaction parsing, not every possible use of that package.
Fix and workarounds
Upgrade bitcoinjs-lib to 7.0.3 or a later patched release. Version 7.0.3 requires `uint8array-tools` ^0.0.10, `varuint-bitcoin` ^2.0.1 and `bip174` ^3.0.1 so the affected production read paths resolve to the fixed helpers. The helpers read through views or direct byte access instead of copying the whole buffer.
Applications that remain on an older bitcoinjs-lib release must verify the actual resolved dependency tree rather than assuming that a top-level dependency update replaces every nested copy. Input limits and parsing in a separate worker can reduce exposure but do not remove the copying defect.
References
- bitcoinjs-lib 7.0.3 on npm
https://www.npmjs.com/package/bitcoinjs-lib/v/7.0.3 - uint8array-tools 0.0.10 on npm
https://www.npmjs.com/package/uint8array-tools/v/0.0.10 - varuint-bitcoin 2.0.1 on npm
https://www.npmjs.com/package/varuint-bitcoin/v/2.0.1 - bip174 3.0.1 on npm
https://www.npmjs.com/package/bip174/v/3.0.1 - Fix: Avoid repeated buffer copies when parsing transactions and blocks
https://github.com/bitcoinjs/bitcoinjs-lib/commit/cfbe5b4001128d173d9e5a3c5d51e14b1e0ed890
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmbitcoinjs-lib |
Corregida | 7.0.3 | -13 d | 7.0.5 no afectada |
7.0.3Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/bitcoinjs/bitcoinjs-lib/security/advisories/GHSA-88jr-9qj4-ccm4Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
