Skip to content

Configfs path overridable via environment variable enables fake quotes #562

Closed as not planned

Description

@pbeza

The TDX quote generation code in dstack/dstack-util/src/tdx_attest.rs reads the configfs-tsm path from an environment variable without validation, allowing an attacker who controls the environment to redirect quote generation to an arbitrary path.

Root Cause

The TDX attestation library reads the DCAP_TDX_QUOTE_CONFIGFS_PATH environment variable to determine where to read/write TDX quote data. If set, this overrides the default configfs path (/sys/kernel/config/tsm/report). A process that can set this environment variable can redirect quote generation to an attacker-controlled filesystem path, serving fabricated TDX quotes.

// linux.rs:331-339
let configfs_path = std::env::var("DCAP_TDX_QUOTE_CONFIGFS_PATH")
    .unwrap_or_else(|_| DEFAULT_CONFIGFS_PATH.to_string());

Attack Path

  1. Attacker compromises a process inside the CVM or controls the process environment
  2. Attacker sets DCAP_TDX_QUOTE_CONFIGFS_PATH to a directory they control (e.g., /tmp/fake-tsm/)
  3. Attacker populates the fake directory with crafted quote data
  4. When the application requests a TDX quote, it reads from the attacker's directory instead of the real configfs
  5. The fabricated quote may contain arbitrary report_data, measurements, or signatures

Impact

Applications using the tdx-attest library can be tricked into using fake TDX quotes. The impact depends on whether the quotes are verified downstream — if they are, the fake quotes will fail signature verification (they won't be signed by Intel's QE). However, in configurations where quote verification is disabled (a related finding, a related finding), fake quotes could be accepted.

Suggested Fix

Ignore the environment variable in production builds:

#[cfg(not(feature = "testing"))]
let configfs_path = DEFAULT_CONFIGFS_PATH.to_string();

#[cfg(feature = "testing")]
let configfs_path = std::env::var("DCAP_TDX_QUOTE_CONFIGFS_PATH")
    .unwrap_or_else(|_| DEFAULT_CONFIGFS_PATH.to_string());

Alternatively, validate that the configfs path points to a real sysfs mount.


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 a lot for the detailed report and for calling out this configuration option.

    Our current threat model treats code running inside the CVM as potentially malicious as long as its behavior is fully covered by the TDX measurements and remote attestation. In other words, if an attacker can already run arbitrary code inside the guest and deliberately override the configfs path via an environment variable, we consider that a compromise of the CVM itself rather than a bypass of the attestation boundary. The verifier is expected to reason about the measured image / compose configuration, not to protect against arbitrary logic that the measured application chooses to execute on its own.

    That said, the point that this knob can be used to redirect quotes is still very useful from a hardening and “foot-gun” perspective. We will review how this environment variable is used in practice (for example, restricting it to test/debug scenarios or guarding it behind explicit build-time flags) and update our documentation so it is clear that it is not intended for production use.

    Thanks again for raising this and for the broader set of reports — they are very helpful for tightening the design and documentation of our threat model.

  2. h4x3rotab commented on Jun 30, 2026

    @h4x3rotab
    Contributor

    Maintainer triage update: this 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: not a production vulnerability. A process that can choose its own quote path is already inside the measured CVM behavior. No code fix is planned for this report under the documented production threat model.

    Closing as not planned.

  3. added
    securitySecurity-related issue, report, or hardening work
    security: reportPublic security report or already-public security finding
    security: not-production-vulnDoes not compromise supported production deployments under the documented threat model
    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: not-production-vulnDoes not compromise supported production deployments under the documented threat modelsecurity: 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