ElementsProject / ElementsProject/elements
Bad arguments (in C++ code) to BlindTransaction() can cause memory corruption
まだ誰も着手していません。
- 主要言語
- C++
- スター
- 1.2k
- フォーク
- 417
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 15
説明
If the issuance blinding key or token blinding key is specified for the input when calling BlindTransaction, but the transaction input itself have null value in issuance.nInflationKeys/issuance.nAmount, then num_blind_attempts will be incremented, while the size of value_blindptrs and asset_blindptrs will not be increased with another 32 bytes of random data.
(the same issue can happen with continue at https://github.com/ElementsProject/elements/blob/4e023af58b697f63d0612abd712e1f8310719217/src/blind.cpp#L434-L435)
If num_blind_attempts is larger than the size *_blindptrs arrays, secp256k1_pedersen_blind_generator_blind_sum that is called later can go over the size of the arrays, because there's no check that the sizes are equal to num_blind_attempts + num_known_input_blinds. This can cause crash. secp256k1_pedersen_blind_generator_blind_sum will also write to the last blinder, and this can cause memory corruption.
Of course this is only possible by the calling C++ code being incorrect, supplying wrong transaction data, etc. But this raises the question - are these continue statements actually needed ? Wouldn't it be better to replace them with returning failure ? It seems that in both cases, either the transaction structure is wrong, or the arguments issuance_blinding_privkey/token_blinding_privkey are wrong.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
src/blind.cpp の 407-416 行および 434-435 行から開始し、BlindTransaction の呼び出し元と value_blindptrs および asset_blindptrs の構築を追跡します。無効な発行またはブラインディングキーの引数がどのように処理されるかを確認し、個数が一致しない場合のカバレッジを追加します。完了の条件は、不正な入力によって blind_sum が配列の範囲外を読み書きできないことです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cpp
- 領域
- cryptography
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100