Summary
sealed-env enterprise mode versions 0.1.0-alpha.1 through 0.1.0-alpha.3 embed the operator's TOTP secret directly in the JWS payload of every unseal token, which is only base64-encoded, not encrypted.
Any party who can observe a minted unseal token in logs, environment variables, or monitoring tools can decode it and recover the TOTP secret, potentially bypassing zero-trust assumptions and taking over secret management workflows.
Affected context
This vulnerability appears in sealed-env when:
- Enterprise mode is enabled and unseal tokens are minted for operators or automation.
- Tokens are handled across CI/CD pipelines, orchestration systems, or observability tooling.
- JWS payloads are treated as opaque "tokens" and may be logged, inspected, or exposed via environment variables or API responses.
Because the JWS payload is only base64-encoded JSON, any location where these tokens are exposed can become a source of TOTP secret disclosure.
Exploit preconditions
- Attack surface: Any channel where unseal tokens may be observed:
- CI build logs
- Container environment variable dumps
kubectl describeoutput- Application logs and error traces (e.g., Sentry/Rollbar)
- Log aggregation and monitoring backends
- Required access: Ability to read or intercept unseal tokens from these channels (e.g., CI logs access, cluster read privileges, log platform access).
- Trigger point: The moment a vulnerable sealed-env instance mints an unseal token and it is exposed through logging, configuration, or monitoring.
- Why exploitation is possible: The operator's TOTP secret is embedded directly and persistently in every token's JWS payload in plaintext JSON (only base64-encoded), so any observer can decode and reuse it, undermining the intended zero-trust design.
Why this happens
The core defect is an insecure design choice where a long-lived, high-value authentication secret (the operator's TOTP secret) is embedded directly into a short-lived token artifact.
The JWS structure provides integrity but not confidentiality: its payload is base64-encoded JSON by default, not encrypted. Treating JWS encoding as if it provided secrecy led to exposure of sensitive authentication material.
This maps to:
- CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, because confidential secrets are made available in token payloads that are likely to be logged or shared.
- CWE-522: Insufficiently Protected Credentials, because credential material is not adequately protected in transit or at rest within application artifacts, and relies on obscurity (base64) rather than cryptographic confidentiality.
Potential impact
- An attacker may recover the operator's TOTP secret and generate valid authentication codes indefinitely.
- An attacker could bypass multi-factor/unseal protections built around sealed-env, effectively impersonating a privileged operator or automation identity.
- An attacker may gain long-term control over secret management flows, including the ability to unseal vaults, rotate or read secrets, and modify security posture.
- Compromise of one observable token could lead to cross-environment impact if the same TOTP secret is reused.
- Incidents in CI/CD or logging infrastructure could escalate into full environment compromise via stolen TOTP secrets.
General mitigation guidance
Mitigation focuses on treating high-value secrets as never-exported, never-embedded credentials, and on minimizing where and how tokens carry sensitive data.
Recommended defensive patterns include:
- Designing tokens to carry only minimally necessary, non-secret metadata (e.g., subject identifiers, scopes, expiration) and deriving trust from server-side state or key material, not embedded secrets.
- Separating authentication factors from transport artifacts: TOTP seeds, private keys, or master secrets should remain confined to secure storage layers and not be serialized into tokens at all.
- Using cryptographic mechanisms aligned with the desired property:
- For confidentiality, combine JWS with proper encryption (e.g., JWE) or equivalent mechanisms, rather than relying on base64 encoding.
- For integrity only, keep payloads non-sensitive so leakage does not expose credentials.
- Implementing strict logging and tracing hygiene:
- Avoid logging complete tokens in application or infrastructure logs.
- Redact or truncate token fields when observability is necessary.
- Applying least-privilege and compartmentalization in secret management:
- Limit who and what can mint unseal tokens.
- Scope tokens narrowly (short TTLs, minimal permissions) so exposure has reduced blast radius.
How teams detect issues like this
Effective detection is primarily about identifying both the insecure design pattern and accidental exposure of sensitive tokens:
- Static analysis and code review:
- Flag any code paths that embed raw secrets (TOTP seeds, keys, passwords) into token payloads, headers, or cookies.
- Review JWS/JWT/JWE usage to distinguish between integrity-only and confidentiality-providing mechanisms; ensure sensitive data is never stored in cleartext payloads.
- Look for serialization of authentication secrets into JSON structures passed to signing routines.
- Configuration and policy enforcement:
- Enforce coding standards or lint rules that prohibit logging full tokens or credentials.
- Apply security review checklists for secret management components to ensure credentials are never embedded into transport artifacts.
- Operational monitoring:
- Scan logs and telemetry for base64-encoded JSON tokens in contexts likely to hold secrets, and verify that decoded payloads do not include credential-like fields (e.g.,
totp_secret,seed,secretKey). - Use automated tooling or DLP policies to detect probable secrets in structured logs and configuration snapshots.
- Automated review tools:
- Integrate secret-scanning and token-inspection tools in CI pipelines to flag accidental inclusion of secrets in token payloads or logged output.

