Skip to content

Security: Gateway TLS verification disabled when gateway_app_id == "any" #607

Closed as not planned

Description

@kvinwang

Note: This issue documents a vulnerability that was originally reported privately as the repository security advisory GHSA-qwh8-369j-c47j by @pbeza.

Root Cause

When the gateway_app_id configuration is set to "any", TLS certificate verification is disabled via tls_no_check(true). Additionally, verify_server_attestation(false) is called unconditionally — the CVM never verifies the gateway's RA-TLS attestation during registration.

// system_setup.rs:405-407
.tls_no_check(self.keys.gateway_app_id == "any")
.verify_server_attestation(false)  // Always false!

Attack Path

  1. CVM is configured with gateway_app_id = "any" (or server attestation is never verified regardless)
  2. CVM connects to the gateway to register and sends its WireGuard private key
  3. A MitM attacker intercepts the connection (possible because TLS verification is disabled or server attestation is not checked)
  4. Attacker captures the WireGuard private key
  5. Attacker can now decrypt all WireGuard-tunneled traffic to/from the CVM

Impact

WireGuard private key theft enables complete traffic interception for the CVM. The attacker can read all P2P communication, including MPC protocol messages containing partial signatures and key material.

Suggested Fix

  1. Always verify server attestation: verify_server_attestation(true)
  2. Never disable TLS verification: remove the tls_no_check call or ensure it's always false
  3. If gateway_app_id = "any" is needed for testing, gate it behind a compile-time feature flag

Note: This finding was reported automatically as part of an AI/Claude-driven internal audit by the NEAR One MPC team. It has not been manually verified by a human to confirm whether it constitutes an actual security issue.

Activity

  1. kvinwang commented on Mar 27, 2026

    @kvinwang
    CollaboratorAuthor

    Maintainer response (copied from private security advisory GHSA-qwh8-369j-c47j):

    Thanks for the report, but this is not a security vulnerability.

    1. gateway_app_id = "any" is configured in the KMS contract, not in the CVM

    The gateway_app_id value is set in the KMS contract (on-chain configuration), which is publicly auditable. A contract configured with gateway_app_id = "any" is clearly a development/testing deployment, not a production environment. Any user or verifier can inspect the contract configuration before trusting the deployment.

    That said, we acknowledge this is easy to overlook. We plan to provide an automated auditing tool that checks KMS contract configurations and flags insecure settings like gateway_app_id = "any", helping users verify they are interacting with a properly configured production deployment.

    2. Runtime configuration vs. compile-time feature flag

    Gating this behind a compile-time cargo feature is not strictly better. Cargo features are additive — if any crate in the dependency tree enables a dev-mode feature, it gets enabled for the entire build. This can lead to accidental inclusion that is easy to miss in code review. A runtime configuration that is publicly auditable on-chain provides a clear, verifiable boundary.

  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. gateway_app_id is KMS contract configuration and is publicly auditable. Production deployments must not use "any". 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