-
Notifications
You must be signed in to change notification settings - Fork 74
Description
The quote simulation flag in dstack/dstack-util/src/tdx_attest.rs is controlled by a runtime environment variable rather than a compile-time feature gate, so a compromised process that sets this variable can cause the system to accept simulated (non-hardware) quotes.
Root Cause
The guest agent's simulate_quote functionality is controlled by a runtime config flag (simulator.enabled) rather than a compile-time feature gate. When enabled, the function patches report_data at a hardcoded offset within a pre-baked quote template, producing a quote that looks structurally valid but is not generated by TDX hardware.
// Controlled by runtime config, not #[cfg(feature = "simulator")]
if self.config.simulator.enabled {
return self.simulate_quote(report_data);
}Attack Path
- A production deployment is accidentally configured with
simulator.enabled = true - Guest agent serves simulated quotes instead of real TDX hardware quotes
- Simulated quotes have fixed measurements, MRTD, and RTMRs from the template
- If the KMS or verifier accepts these quotes (e.g., because they match expected measurements by coincidence, or if quote signature verification is also disabled), the system operates without real hardware attestation
- The
report_datais the only part that varies — everything else is static from the template
Impact
A misconfigured production deployment could serve simulated quotes that bypass TDX hardware attestation. The runtime flag makes this a configuration error away from total attestation bypass, whereas a compile-time gate would prevent simulation code from existing in production binaries.
Suggested Fix
Gate simulation behind a compile-time feature:
#[cfg(feature = "simulator")]
if self.config.simulator.enabled {
return self.simulate_quote(report_data);
}Ensure the simulator feature is never enabled in production builds. Add a startup warning log if the feature is compiled in.
Note: This issue was created automatically. The vulnerability report was generated by Claude and has not been verified by a human.