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

オープン
#1,472 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@choksi2212 がすでに取り組んでいます。

2026年10月24日 から。

  • #1474 @choksi2212 による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Rust
スター
672
フォーク
213
平均マージ
23時間 39分
マージ済み PR(30日)
19

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

RustCrypto/signatures のほかの issue

RustCrypto/signatures の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。