prototype(azure_execution_binding): bind HCLAkPub exponent e and key size, reject duplicate JSON keys, and harden _secure_boot_state and authenticode_sha256
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 20/100
調査の方向性
Start with prototype/azure_execution_binding.py, focusing on authenticate_ak, _runtime_claims, _secure_boot_state, and authenticode_sha256; compare the duplicate-key handling with execution_appraisal.py, tdx_collateral.py, and verifier_token.py. Reproduce the supplied SecureBoot event cases, then inspect existing tests for these entry points. Done means all four malformed-input cases are rejected with the specified exceptions and the RSA key checks enforce the stated requirements.
索引モデルが issue の本文から書いたものです。
説明
What is wrong
At main (a8e3559), prototype/azure_execution_binding.py has four security and input-validation bugs:
-
authenticate_akchecks only the RSA modulusnofHCLAkPuband ignoreskty,e, and key size (GHSA-vwq2exponent-mismatch class):- In
prototype/azure_execution_binding.py:466-492,authenticate_akreadskeys[0]["n"]fromHCLAkPub, comparesif modulus != ak.public_numbers().n: raise ExecutionDenied("ak_not_hcl_bound"), and returnsak(loaded from attacker-suppliedpacket["ak_pem"]). - It never checks
keys[0].get("kty") == "RSA", never decodes or validateskeys[0]["e"]as a canonicalBase64urlUInt, never requiresexponent == 65537andmodulus.bit_length() >= 2048, and never checksak.public_numbers().e == exponent. - Supplying an
ak_pemwith the same modulusnasHCLAkPuband a different public exponente(e.g.,e=3), or anHCLAkPubwith a non-RSAkty, weak exponent, or< 2048-bit modulus, passesauthenticate_ak.
- In
-
authenticate_akand_runtime_claimsaccept duplicate JSON object keys in HCL runtime JSON:authenticate_ak(line 467) and_runtime_claims(line 512) calljson.loads(...)without anobject_pairs_hookto reject duplicate keys, unlikeexecution_appraisal.py,tdx_collateral.py, andverifier_token.py.
-
_secure_boot_stateleaksstruct.error/UnicodeDecodeErrorand accepts truncated variable payloads:- In
prototype/azure_execution_binding.py:207-218,_secure_boot_statecallsname_len, data_len = struct.unpack_from("<QQ", event.data, 16)andevent.data[32 : 32 + 2 * name_len].decode("utf-16-le")without checkinglen(event.data) >= 32or32 + 2 * name_len + data_len <= len(event.data)and without catching(struct.error, UnicodeDecodeError)asExecutionDenied. Whendata_lenexceeds the remaining bytes and 1 byte\x01followsSecureBoot, Python's sliceevent.data[32 + 2 * name_len : 32 + 2 * name_len + data_len]silently truncates tob"\x01"and returnsTrue.
- In
-
authenticode_sha256leaksstruct.error/TypeErroron non-bytesor truncated PE images instead of raisingValueError.
Reproduction on a8e3559:
import hashlib, struct
from prototype import azure_execution_binding as aeb
# 1. Truncated SecureBoot UEFI variable event with data_len=9999 and 1 trailing byte b'\x01' passes:
name_utf16 = "SecureBoot".encode("utf-16-le")
data = b"\x00" * 16 + struct.pack("<QQ", len("SecureBoot"), 9999) + name_utf16 + b"\x01"
ev = aeb.UefiEvent(pcr=7, event_type=aeb.EV_EFI_VARIABLE_DRIVER_CONFIG, sha256=hashlib.sha256(data).digest(), data=data)
assert aeb._secure_boot_state([ev]) is True
# 2. Short event data (< 32 bytes) raises raw struct.error instead of ExecutionDenied:
bad_data = b"\x00" * 20
bad_ev = aeb.UefiEvent(pcr=7, event_type=aeb.EV_EFI_VARIABLE_DRIVER_CONFIG, sha256=hashlib.sha256(bad_data).digest(), data=bad_data)
aeb._secure_boot_state([bad_ev]) # raises struct.error
Spec section or file
prototype/azure_execution_binding.py(authenticate_ak,_runtime_claims,_secure_boot_state,authenticode_sha256)
Expected behavior
authenticate_akrequireskeys[0].get("kty") == "RSA", decodeskeys[0]["e"]as a canonicalBase64urlUInt, requiresexponent == 65537andmodulus.bit_length() >= 2048, and verifies(ak.public_numbers().n, ak.public_numbers().e) == (modulus, exponent).authenticate_akand_runtime_claimsreject duplicate JSON object keys in HCL runtime JSON withExecutionDenied._secure_boot_statevalidateslen(event.data) >= 32and32 + 2 * name_len + data_len <= len(event.data)(requiring exactdata_lenbytes) and catches(struct.error, UnicodeDecodeError)asExecutionDenied("secure_boot_state").authenticode_sha256validatesisinstance(image, bytes)and PE header/section bounds, raisingValueErroron malformed inputs.
Impact
An attacker-supplied ak_pem with a mismatched public exponent e (or a truncated PCR 7 SecureBoot variable event) is accepted by azure_execution_binding.
- 主要言語
- Python
- スター
- 37
- フォーク
- 33
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 118
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
agentrust-io/trace-spec のほかの issue
-
prototype(tdx_collateral): reject non-finite JSON, non-minimal/duplicate PCK OIDs, boolean integer fields, and non-list advisoryIDs対応中かも @drk-ram が 3 日前に担当しました。 オープンneeds-review:MEDIUM
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
agentrust-io/trace-spec#644 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
prototype(gate_store): reject float overflow, out-of-range integers, empty identifiers, and invalid RemoteGateStore timeout対応中かも @drk-ram が 3 日前に担当しました。 オープンneeds-review:MEDIUM
難易度 3/5 半日 初心者へのやさしさ 35/100
agentrust-io/trace-spec#645 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
prototype(snp_collateral): verify VCEK signature against ASK and enforce canonical HCL base64, report version, and component bounds対応中かも @drk-ram が 3 日前に担当しました。 オープンneeds-review:MEDIUM
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
agentrust-io/trace-spec#646 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
fix(delegation): reject private JWKs in trusted_root_keys, duplicate lattice entries, and invalid credential bounds対応中かも @drk-ram が 3 日前に担当しました。 オープンneeds-review:MEDIUM
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
agentrust-io/trace-spec#647 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
conformance(loader,report): reject non-standard JSON constants in loads_strict and validate record_digest/build inputs対応中かも @drk-ram が 3 日前に担当しました。 オープンneeds-review:MEDIUM
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
agentrust-io/trace-spec#648 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
agentrust-io/trace-spec の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
elviskahoro/sdk-python-attio#144 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
RenyiELBO raises TypeError when model has no sample sites対応中かも @alibb007 が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Four evaluation scripts unpack init_memmachine_params's five return values into three namesオープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
MemMachine/MemMachine#1911 ·
メンテナーはふだん 3 日以内に返信