reviews/current/objective-20260909T223027Z/mistralai__devstral-2512.md
On this page

Independent Pi/OpenRouter review: mistralai/devstral-2512

Source: a10323dede4413fbf295916b8ad12e3dbad7514e. Status: completed.

Independent Security Review: Attested Relay v2 (Commit a10323d)

Reviewer: Independent (no affiliation with project owner) Scope: Confidentiality of request/response contents from intermediaries until ~1-week delayed disclosure via RandomX puzzles. Assumptions: AWS/Nitro trusted; all others (EC2 owner, parent host, Cloudflare, network, DNS, archive providers, other clients, external solvers) may collude. RandomX primitive assumed strong (no cryptanalytic shortcut).



Executive Summary

Property A: Confidentiality of Request/Response Contents Before Delay

Assessment: SUPPORTED CONDITIONALLY

Property B: No Early Key/Plaintext Recovery or Puzzle Bypass

Assessment: SUPPORTED CONDITIONALLY



Detailed Findings

1. Confidentiality of Request/Response Contents (Property A)

Strengths

End-to-End Encryption:

TLS Isolation:

No Plaintext Logging:

Record Integrity:

Weaknesses & Risks

⚠️ Metadata Leakage:

⚠️ Side-Channel Risks:

⚠️ Record Provenance:

⚠️ Parent Host Can Delay/Withhold Records:

⚠️ No Forward Secrecy for Records:


2. No Early Key/Plaintext Recovery or Puzzle Bypass (Property B)

Strengths

RandomX Puzzle Binding:

Sequential Work Enforcement:

Checkpoint Validation:

Epoch Key Isolation:

No Key Reuse:

Weaknesses & Risks

⚠️ Checkpoint Replay Attacks:

⚠️ Puzzle Publication Race Conditions:

⚠️ Epoch Key Leakage via Side Channels:

⚠️ RandomX Mode Mismatch:

⚠️ Puzzle Generation Parallelism:



Critical Questions & Answers

A. Can an in-scope adversary recover or infer request/response contents before the intended delay?

Answer: SUPPORTED CONDITIONALLY

B. Can an adversary obtain epoch keys, private seeds/intermediates, or equivalent decryption capability early?

Answer: SUPPORTED CONDITIONALLY



Unresolved Questions & Missing Evidence

  1. Side-Channel Resistance:

    • Question: Has the enclave been audited for side-channel resistance (e.g., Spectre, Meltdown, cache attacks)?
    • Status: No evidence provided. The threat model explicitly does not assume resistance to side channels (line 20 in threatmodel.md).
    • Risk: An attacker with physical access or hypervisor control could potentially recover keys or plaintext.
  2. RandomX FFI Safety:

    • Question: Is the RandomX FFI binding (in timelock/src/randomx.rs) memory-safe and free of buffer overflows?
    • Status: The FFI uses raw pointers (lines 15–37 in randomx.rs) and no bounds checking.
    • Risk: A bug in the FFI could corrupt memory or leak secrets.
  3. TLS Stack Security:

    • Question: Is the TLS stack (aws-lc-rs, rustls) free of vulnerabilities?
    • Status: The enclave uses aws-lc-rs (AWS’s fork of ring) and rustls with AWS-LC-RS provider.
    • Risk: A vulnerability in aws-lc-rs or rustls could leak plaintext or keys.
  4. Record Encryption Key Derivation:

    • Question: Is the record encryption key derivation (HKDF-SHA256) secure?
    • Status: The derivation uses HKDF with a fixed domain separator (lines 81–91 in timelock/src/lib.rs).
    • Risk: If the epoch key is recovered, all records for that epoch are compromised.
  5. Parent Host Persistence Guarantees:

    • Question: Does the parent host durably store records before acknowledging?
    • Status: The host writes records to disk (lines 67–123 in crates/host/src/artifacts.rs) and syncs the directory (lines 61–65).
    • Risk: The parent could lie about persistence, but the enclave blocks new requests if persistence fails (line 83–84 in v2_proxy.rs).
  6. Epoch Key Zeroization:

    • Question: Are epoch keys fully zeroized after use?
    • Status: The enclave uses Zeroizing<[u8; 32]> (lines 12–13 in v2_epoch.rs), but this does not guarantee hardware-level erasure.
    • Risk: Memory remnants could leak the epoch key.
  7. RandomX Calibration:

    • Question: Is the RandomX calibration (43,768,124 iterations) sufficient to ensure ~1 week delay?
    • Status: The calibration assumes ~506.5755 hashes/s per CPU (line 3 in config/relay-v2.toml).
    • Risk: If faster hardware (e.g., GPUs, ASICs) is available, the delay could be shorter.


Recommendations

High Priority

  1. Audit RandomX FFI for Memory Safety:

    • The FFI uses raw pointers and no bounds checking. A fuzzing campaign should be conducted to ensure no memory corruption is possible.
    • Action: Add bounds checks in the FFI or use a safer binding (e.g., librandomx via cdylib).
  2. Hardware Side-Channel Mitigations:

    • Enable Nitro Enclave’s side-channel protections (e.g., CPU isolation, memory encryption).
    • Action: Configure the enclave with --cpu-unbound and --memory-mb to limit exposure.
  3. Record Provenance Signatures:

    • Sign each record (not just the manifest) to prevent forgery by epoch key holders.
    • Action: Modify encrypt_record to include a per-record signature (e.g., using the enclave’s signing key).
  4. Checkpoint Encryption:

    • Encrypt checkpoints to prevent replay attacks by attackers who gain access to the solver’s filesystem.
    • Action: Store checkpoints encrypted with a solver-specific key.

Medium Priority

  1. TLS Stack Hardening:

    • Audit aws-lc-rs and rustls for vulnerabilities.
    • Action: Use rustls with ring (instead of aws-lc-rs) for broader scrutiny.
  2. Epoch Key Forward Secrecy:

    • Derive record keys from a per-record nonce + epoch key (instead of just epoch key) to limit exposure if the epoch key is recovered.
    • Action: Modify record_key to include a per-record nonce.
  3. Parent Host Persistence Verification:

    • Require multiple acknowledgements (e.g., from independent storage providers) before accepting a record as persisted.
    • Action: Modify publish to write to multiple hosts (lines 57–74 in v2_epoch.rs).
  4. Side-Channel Testing:

    • Test the enclave for side-channel leaks (e.g., Flush+Reload, Prime+Probe).
    • Action: Run side-channel detection tools (e.g., ct-grind, cache-audit).

Low Priority

  1. RandomX Calibration Revalidation:

    • Revalidate the RandomX calibration on newer hardware (e.g., Graviton4, AMD EPYC).
    • Action: Run benchmarking on modern CPUs and adjust iterations if needed.
  2. Document Side-Channel Assumptions:

    • Explicitly document that the enclave does not protect against side channels.
    • Action: Update threatmodel.md to clarify side-channel risks.


Final Verdict

Property Assessment Confidence Notes
A. Confidentiality of request/response contents before delay SUPPORTED CONDITIONALLY High Holds if RandomX is strong, no side channels, and implementation is correct. Metadata leakage and side-channel risks remain.
B. No early key/plaintext recovery or puzzle bypass SUPPORTED CONDITIONALLY High Holds if RandomX is unsolved, checkpoints are not tampered, and no side channels exist. Checkpoint replay and side-channel risks remain.

Would I rely on this for sensitive content?

Yes, but with caveats:

Critical Missing Evidence

  1. Side-channel resistance testing (e.g., Spectre, Meltdown, cache attacks).
  2. RandomX FFI memory safety audit (fuzzing, static analysis).
  3. TLS stack (aws-lc-rs, rustls) vulnerability assessment.
  4. Independent verification of RandomX calibration (is 43M iterations really ~1 week on modern hardware?).

Strongest Code-Grounded Reasons Attacks Are Blocked

  1. Epoch keys are derived from RandomX puzzles (lines 315–350 in timelock/src/lib.rs), which are assumed hard to solve early.
  2. Records are AEAD-encrypted with per-record nonces (lines 102–124 in v2_proxy.rs), preventing replay or forgery without the epoch key.
  3. Manifests are signed with Ed25519 (lines 388–393 in timelock/src/lib.rs), preventing tampering with puzzle parameters.
  4. Checkpoints are validated against the manifest (lines 438–455 in timelock/src/lib.rs), preventing checkpoint replay attacks.
  5. Epoch keys are zeroized after use (lines 131–132 in v2_epoch.rs), limiting memory exposure.

Most Concerning Gaps

  1. No side-channel mitigations (e.g., for Spectre, Meltdown, or memory introspection).
  2. RandomX FFI uses unsafe raw pointers (potential for memory corruption).
  3. Checkpoints are not encrypted (replay attacks possible if solver filesystem is compromised).
  4. Parent host can delay/withhold records (liveness risk, but not a confidentiality violation).
  5. No forward secrecy for records (if epoch key is recovered, all records for that epoch are compromised).


Appendix: File/Line References for Key Findings

Finding File Lines Impact
Record Encryption crates/enclave/src/v2_proxy.rs 102–124 ✅ Prevents plaintext leakage to parent host
Epoch Key Derivation crates/timelock/src/lib.rs 315–350 ✅ Binds epoch key to RandomX puzzle
Manifest Signing crates/timelock/src/lib.rs 388–393 ✅ Prevents puzzle tampering
Checkpoint Validation crates/timelock/src/lib.rs 438–455 ✅ Prevents checkpoint replay attacks
RandomX FFI (Unsafe) crates/timelock/src/randomx.rs 15–37 ⚠️ Potential for memory corruption
Parent Host Persistence crates/enclave/src/v2_epoch.rs 57–74 ⚠️ Parent can lie about persistence
Epoch Key Zeroization crates/enclave/src/v2_epoch.rs 131–132 ⚠️ Does not guarantee hardware-level erasure
TLS Termination crates/enclave/src/v2_main.rs 180–196 ✅ Parent only sees encrypted bytes
ECH Support crates/enclave/src/net.rs 77–92 ✅ Hides SNI from parent (if upstream supports ECH)
Side-Channel Note DOCUMENTATION/threatmodel.md 20 ⚠️ Explicitly no side-channel resistance assumed


Conclusion

The attested relay v2 design and implementation largely achieve their stated goals of confidentiality until ~1-week delay, assuming:

However, the following risks remain:

  1. Side-channel attacks (not mitigated).
  2. RandomX FFI memory safety (unaudited).
  3. Checkpoint replay attacks (if solver filesystem is compromised).
  4. Parent host persistence lies (liveness risk, not confidentiality).
  5. No forward secrecy for records (epoch key compromise = all records compromised).

For sensitive content, I would rely on this system only if:

Final Answer: