Skip to content

simulate_quote patches report_data at hardcoded offset with no build-time guard #563

Closed

Description

@pbeza

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

  1. A production deployment is accidentally configured with simulator.enabled = true
  2. Guest agent serves simulated quotes instead of real TDX hardware quotes
  3. Simulated quotes have fixed measurements, MRTD, and RTMRs from the template
  4. 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
  5. The report_data is 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.

Activity

  1. kvinwang commented on Mar 25, 2026

    @kvinwang
    Collaborator

    Thanks again for reporting this.

    The concern you raised has been addressed in PR #582 ("refactor(guest-agent): isolate simulator from production paths"): the quote simulator now lives in a dedicated dstack-guest-agent-simulator binary and is no longer switchable from the production guest-agent via a runtime flag.

    In other words:

    • production builds only use the real TDX hardware attestation path;
    • simulator-only helpers and configuration are confined to the simulator crate/binary;
    • there is no mixed-mode behavior where a misconfigured runtime flag in a production deployment would silently route requests through the simulator.

    Given this refactoring, the issue described here is now limited to the simulator environment and does not affect production deployments.

  2. h4x3rotab commented on Jun 30, 2026

    @h4x3rotab
    Contributor

    Maintainer triage update: this was fixed by #582 and is recorded in the public security report table: https://github.com/Dstack-TEE/dstack/blob/master/docs/security/public-security-reports.md#public-reports-and-findings

    Disposition: valid report, fixed. #582 isolates the simulator into a dedicated binary.

    Closing as fixed.

  3. added
    securitySecurity-related issue, report, or hardening work
    security: reportPublic security report or already-public security finding
    security: fixedSecurity report addressed by a code or configuration change
    on Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    securitySecurity-related issue, report, or hardening worksecurity: fixedSecurity report addressed by a code or configuration changesecurity: reportPublic security report or already-public security finding

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions