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

GHSA-H52V-8XWG-7J95

Finalized PSBT inputs without UTXO records are counted as zero in fee calculations

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
Parche3 versionesPrimer 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 5.2.2 +2
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 5.2.2 bitcoinjs-lib · -13 d desde divulgación
Remediación Parche 6.1.9 bitcoinjs-lib · -13 d desde divulgación
Remediación Parche 7.0.4 bitcoinjs-lib · -13 d desde divulgación
Divulgación Publicada GHSA-H52V-8XWG-7J95 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`, a finalized PSBT input with neither `witnessUtxo` nor `nonWitnessUtxo` contributes zero to the calculated input total. The library does not reject the missing amount before calculating the fee.

This can understate the fee of a transaction with valid finalized inputs. An application relying on that fee or the built-in `maximumFeeRate` guard can extract a transaction that pays an unexpectedly large miner fee.

Details

Fee accounting in `inputFinalizeGetAmts` adds an input value when one of the UTXO fields is present. There is no final branch that rejects the absence of both fields:

if (input.witnessUtxo) {
  inputAmount += input.witnessUtxo.value;
} else if (input.nonWitnessUtxo) {
  // Add the referenced output value.
}
// Neither field: nothing is added for this input.

The check for finalization uses `finalScriptSig` or `finalScriptWitness`. Those fields can be present without either UTXO field. Finalized spending data does not tell the fee calculator the value of the referenced output.

The affected calculation is used by `getFee()` and `getFeeRate()` as well as the fee-rate check performed by `extractTransaction()`. A PSBT imported after signing can therefore reach the calculation without the missing metadata being needed for a new signing operation.

Example

Consider a transaction with two valid finalized inputs:

  • Input A is worth 10,000 satoshi and includes its UTXO record.
  • Input B is worth 90,000 satoshi but includes neither UTXO field.
  • The transaction pays 9,000 satoshi to its outputs.

The true fee is 91,000 satoshi. The affected calculator counts only input A and reports 1,000 satoshi. The final scripts do not need to be invalid for this accounting error to occur.

Some incomplete combinations instead produce a negative calculated fee and are rejected. That does not prevent the case above, where the remaining known inputs cover the outputs and leave an apparently reasonable fee.

Impact

Applications that accept finalized PSBTs from another party can show an understated fee or fail to reject an excessive fee at extraction. An actual funds loss requires a valid transaction to be broadcast and accepted by the network. This defect does not create signatures or spend coins without the required authorization.

Affected versions
  • v5: 5.1.0 through 5.2.1.
  • v6: 6.0.0 through 6.1.8, including 6.1.0-rc.0.
  • v7: 7.0.0-rc.0 through 7.0.3.
Fix and workarounds

Upgrade to bitcoinjs-lib 5.2.2, 6.1.9 or 7.0.4 for the corresponding version line. Fee calculation now requires a UTXO amount for every input and throws if neither record is available. Incomplete PSBT assembly remains possible, but missing amounts are not treated as zero when consumed by the fee calculator.

Applications that cannot upgrade should require and independently verify a referenced output value for every input before using the calculated fee or extracting a transaction. A finalized input must not be assumed to have a known value merely because its spending script or witness is present.

References
  • bitcoinjs-lib 5.2.2 on npm https://www.npmjs.com/package/bitcoinjs-lib/v/5.2.2
  • bitcoinjs-lib 6.1.9 on npm https://www.npmjs.com/package/bitcoinjs-lib/v/6.1.9
  • bitcoinjs-lib 7.0.4 on npm https://www.npmjs.com/package/bitcoinjs-lib/v/7.0.4
  • Fix: Resolve PSBT input UTXOs consistently https://github.com/bitcoinjs/bitcoinjs-lib/commit/202e4043abdf5de63cda3507baa1030eea4e8868
Versiones

Rangos afectados

Afectada Corregida Última
bitcoinjs-lib≥ 5.1.0 < 5.2.2
bitcoinjs-lib≥ 6.0.0 < 6.1.9
bitcoinjs-lib≥ 7.0.0-rc.0 < 7.0.4
5.1.0
5.2.2
6.0.0
6.1.9
7.0.0-rc.0
7.0.4
7.0.5
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npmbitcoinjs-lib
Corregida 5.2.2, 6.1.9, 7.0.4 -13 d · -13 d · -13 d 7.0.5 no afectada
Versiones corregidas5.2.26.1.97.0.4
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-h52v-8xwg-7j95

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