Skip to content

Security: Unauthenticated bootstrap endpoint can overwrite root keys #610

Closed

Description

@kvinwang

Note: This issue documents a vulnerability that was originally reported privately as the repository security advisory GHSA-f7w3-x786-xvh7 by @pbeza.

Root Cause

The KMS bootstrap endpoint has no authentication and no idempotency check. It accepts root key material (or generates it) and persists it. If called multiple times, subsequent calls can overwrite previously set root keys. During the initial KMS setup window, a race condition allows an attacker to substitute their own root keys.

Attack Path

  1. Legitimate operator initiates KMS bootstrap
  2. Attacker concurrently calls the bootstrap endpoint with their own root key material
  3. If the attacker's request arrives first (or the endpoint allows overwrites), attacker's keys are persisted
  4. All subsequent key derivations use the attacker's root keys
  5. Attacker controls the entire key hierarchy for all CVMs using this KMS

Impact

If an attacker wins the bootstrap race, they control the root keys for the entire KMS instance. All app keys, disk encryption keys, and signing keys derived from this KMS are compromised. For MPC, all keyshares and signing keys are under attacker control.

Suggested Fix

  1. Add authentication to the bootstrap endpoint (e.g., require a pre-shared bootstrap token)
  2. Add idempotency: reject bootstrap if root keys are already set
  3. Use a file-based lock to ensure atomicity:
if root_keys_exist() {
    return Err(Error::AlreadyBootstrapped);
}
  1. Log all bootstrap attempts for audit purposes

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-f7w3-x786-xvh7):

    Thanks for the report, but the described attack path is not feasible.

    The bootstrap endpoint does not accept external key material. The BootstrapRequest only contains a domain field — root keys are generated server-side by Keys::generate(), not supplied by the caller. An attacker cannot "substitute their own root keys" because there is no mechanism to inject key material through this endpoint.

    Calling bootstrap multiple times simply regenerates keys on the server side. The operator retains the last result and chooses which bootstrap outcome to publish (e.g., registering the corresponding public key on-chain). An attacker calling bootstrap concurrently would only cause a re-generation of server-side keys — the operator can simply re-run bootstrap and publish the correct result.

    As noted in our response to GHSA-fc72-qqqp-cjgr, the onboard service is a short-lived, temporary setup process. Operators concerned about interference during setup can bind the service to 127.0.0.1 or use firewall rules until configuration is complete.

  2. 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