ecdsa, rfc6979: k, k⁻¹ and the RFC 6979 generator state are not zeroized (FIPS 186-5 § 6.4.1)

Abierto
#1,472 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@choksi2212 ya está trabajando en esto.

Desde el 24/10/2026.

  • #1474 de @choksi2212 — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start with src/hazmat.rs at sign_prehashed and sign_prehashed_rfc6979, then inspect rfc6979's src/hmac_drbg.rs and its feature setup. Trace how k, k_inv, k_bytes, the private key encoding, and generator state are held, and check the existing zeroize dependency and feature conventions. Done means the secret material is zeroized as proposed and the relevant tests cover the changes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

FIPS 186-5 § 6.4.1: step 10 of signature generation orders k and k⁻¹ to be destroyed
("Securely destroy"), and the same section requires d, k and k⁻¹ to be "protected from
unauthorized disclosure and modification".

In ecdsa 0.17.0:

  • hazmat::sign_prehashed (src/hazmat.rs l. 52-91): k_inv and the copies of k are not
    zeroized. NonZeroScalar implements Zeroize (elliptic-curve 0.14.1,
    src/scalar/nonzero.rs l. 384-396) but is Copy (l. 124), so it cannot zeroize on drop.
  • hazmat::sign_prehashed_rfc6979 (l. 102-124): k_bytes and d.to_repr(), a copy of the
    private key handed to KGenerator::new, are not zeroized.
    In rfc6979 0.6.0, HmacDrbg keeps k and v (src/hmac_drbg.rs l. 16 and 19), derived from
    the private key, and the crate does not depend on zeroize.
    Since s = k⁻¹·(z + r·d) is published, k from a single signature yields d. The ecdsa lines are
    unchanged on the default branch at cf99f5ebe36954026fdc86d2a2b372e6c97d04fb.

Proposal: zeroize k_bytes, the key encoding, k and k_inv explicitly in hazmat (ecdsa
already depends on zeroize), and implement ZeroizeOnDrop for HmacDrbg/KGenerator behind
a zeroize feature of rfc6979.

We know of no practical exploit: the residue matters once the key itself is gone, in a memory
dump or a swapped page. We searched the tracker first; the closest reports concern keys only
(#1020, #883, #937).

Lenguaje dominante
Rust
Estrellas
672
Forks
213
Merge medio
23 h 39 min
PR fusionados (30 d)
19

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de RustCrypto/signatures

Todos los issues de RustCrypto/signatures

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.