llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · tiny-secp256k1

GHSA-85G9-F6V5-WQQ7

Point-validation exceptions leave backend stack state damaged

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 el mismo día 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 +1
Explotación
Remediación
Parche 2.2.5
Monitoreo
Detectada +1
26 oct 26
18 nov 26
21 nov 26
26 oct 26
2 nov 26
8 nov 26
14 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-85G9-F6V5-WQQ7 divulgada
Remediación Parche 2.2.5 tiny-secp256k1 · 0 d desde divulgación
Divulgación Modificada Última actualización del registro
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

The WebAssembly build of `tiny-secp256k1` can leave its shadow-stack pointer changed when point validation throws a JavaScript exception from inside an active WASM call. Catching the exception in application code does not restore the pointer. The generated `@bitcoin-js/tiny-secp256k1-asmjs` backend contains the same skipped stack-restoration path.

Repeated invalid inputs can exhaust the shared module's stack and make later valid cryptographic operations fail. A long-running application that passes untrusted public keys to the affected operations can therefore lose cryptographic service until the module is reloaded.

Details

The JavaScript validators check byte-array types and lengths but do not perform all curve-membership checks. An invalid point with the expected length can reach the Rust/WASM implementation.

When a point check fails, the WASM code invokes an imported JavaScript `throwError` function. That function throws a `TypeError`. The exception leaves the active WASM call without running the cleanup that would restore its LLVM shadow-stack pointer.

The loader shares one module instance, so later operations use the damaged state. A `try`/`catch` around the library call does not undo the change to the mutable WASM global. JavaScript cleanup of input buffers also does not restore that pointer.

Affected paths include `pointAdd`, `pointCompress`, `pointMultiply`, `pointAddScalar` and `verify`. The x-only and Schnorr operations present in later releases add `xOnlyPointFromPoint`, `xOnlyPointAddTweak`, `xOnlyPointAddTweakCheck` and `verifySchnorr`.

Static inspection of the integrity-checked asm.js packages shows a translated mutable stack pointer, a call to the imported `throwError` function on point rejection and restoration code after that call. The thrown exception skips restoration there too. The WASM exhaustion thresholds and downstream effects below have not been measured for asm.js.

Example

With the published WASM build of tiny-secp256k1 2.2.4, an invalid public key with the correct length reaches backend point validation:

import * as ecc from "tiny-secp256k1";

const hash = new Uint8Array(32);
const signature = new Uint8Array(64).fill(1);
const invalidPoint = new Uint8Array(32).fill(0xff);

try {
  ecc.verifySchnorr(hash, invalidPoint, signature);
} catch (error) {
  console.log(error.name, error.message); // TypeError: Expected Point
}

This example illustrates one rejection, not stack exhaustion. The reporter observed that repeated rejections eventually make valid operations trap in the published WASM module. The number of calls depends on the operation and compiled binary. Use an isolated process when examining the affected artifact.

Impact

An attacker who can make an application repeatedly process invalid points can disable signing and verification in the shared instance. This is not just a failure of the rejected calls: valid operations can fail afterwards.

The reporter also observed pointer wraparound and corruption of static point-multiplication tables after millions of further calls. That can lead to incorrect public-key results. Such corruption requires substantially more calls than stack exhaustion and is dependent on the compiled memory layout. This report does not establish private-key disclosure.

Affected versions
  • `tiny-secp256k1`: 2.0.0 through 2.2.4.
  • `@bitcoin-js/tiny-secp256k1-asmjs`: 2.2.2 through 2.2.4, based on the generated code's skipped-restoration path.

Not every listed operation exists in every affected release. The v1 native/JavaScript backends do not use this WASM boundary mechanism.

Remediation and workarounds

Upgrade `tiny-secp256k1` and `@bitcoin-js/tiny-secp256k1-asmjs`, as applicable, to 2.2.5 or a later patched release. Backend point validation now returns an error code normally so the frame completes its cleanup. The JavaScript wrapper throws after the backend call returns. This removes the imported JavaScript validation exception from the active WASM or asm.js frame.

Use isolated, restartable workers when processing untrusted inputs. If an affected instance has been used for repeated invalid-point calls, replace the instance or restart its worker rather than continuing to use it for valid cryptographic work.

References
  • tiny-secp256k1 2.2.4 on npm https://www.npmjs.com/package/tiny-secp256k1/v/2.2.4
  • tiny-secp256k1 asm.js 2.2.4 on npm https://www.npmjs.com/package/@bitcoin-js/tiny-secp256k1-asmjs/v/2.2.4
  • Fix: Return backend validation errors before throwing in JavaScript https://github.com/bitcoinjs/tiny-secp256k1/commit/ba1af1fceea95967a172c6438ed9302730bb7c01
Versiones

Rangos afectados

Afectada Corregida Última
tiny-secp256k1≥ 2.0.0 ≤ 2.2.4
@bitcoin-js/tiny-secp256k1-asmjs≥ 2.2.2 ≤ 2.2.4
2.0.0
2.2.2
2.2.4
2.2.5
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npmtiny-secp256k1
Corregida 2.2.5 0 d 2.2.5 no afectada
Versiones corregidas2.2.5
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/tiny-secp256k1/security/advisories/GHSA-85g9-f6v5-wqq7

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