prototype(azure_execution_binding): bind HCLAkPub exponent e and key size, reject duplicate JSON keys, and harden _secure_boot_state and authenticode_sha256
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 20/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 37
- Fork
- 33
- Merge medio
- 1g 4h
- PR unite (30g)
- 111
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di agentrust-io/trace-spec
-
content_marking: validate record.alg against record.hash prefix, reject unknown assertion fields, and check anchor agreementForse già presa @drk-ram l’ha presa 2 giorni fa. Apertaneeds-review:MEDIUM
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
agentrust-io/trace-spec#614 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
adapters: validate data_class, policy/appraisal enums, and URI fields in TraceAGTAdapter and TraceSandboxAdapterForse già presa @drk-ram l’ha presa 2 giorni fa. Apertaneeds-review:MEDIUM
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
agentrust-io/trace-spec#615 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
trust-record-verify: reject non-object inputs in parentRecordHash, verifyDelegationLink, and bundleDigestForse già presa @drk-ram l’ha presa 2 giorni fa. Apertaneeds-review:MEDIUM
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
agentrust-io/trace-spec#616 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
intent_bridge,successor_observation: validate caller options and trusted JWKs at entry and deep-copy observation before predicateForse già presa @drk-ram l’ha presa 2 giorni fa. Apertaneeds-review:MEDIUM
Difficoltà 4/5 1-2 giorni Idoneità per principianti 35/100
agentrust-io/trace-spec#617 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
prototype(tdx_collateral,snp_collateral): fold non-UpToDate TCB statuses in _converge, reject negative/non-minimal DER integers, and harden policy inputsForse già presa @drk-ram l’ha presa 3 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
agentrust-io/trace-spec#603 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di agentrust-io/trace-spec
Issue simili
-
Project submission:Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
slavakurilyak/awesome-ai-agents#845 ·
I maintainer di solito rispondono entro 1 giorno
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertadifficulty:2 enhancement good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
MakazhanAlpamys/Soup#2178 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
scverse/rapids-singlecell#854 ·
I maintainer di solito rispondono entro 1 giorno
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLForse già presa @ninglinLiu l’ha presa oggi. Apertaarea:frontend backend:slang bug direction:input
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=FalseForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 13 giorni