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

Aperta
#1,472 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@choksi2212 ci sta già lavorando.

Dal 24/10/2026.

  • #1474 di @choksi2212 — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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).

Lingua principale
Rust
Stelle
672
Fork
213
Merge medio
23h 39m
PR unite (30g)
19

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di RustCrypto/signatures

Tutte le issue di RustCrypto/signatures

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.