Summary
A hardcoded fallback authentication secret in Dokploy allows unauthenticated attackers to forge email verification JSON Web Tokens (JWTs) and bypass normal sign-in flows.
With knowledge of this static secret, an attacker can auto-sign-in as an administrator and execute commands on the host through the built-in SSH terminal.
Affected context
This vulnerability affects Dokploy instances that:
- Run versions from 0.27.0 up to (but not including) 0.29.3
- Use the built-in authentication mechanism that relies on BETTER_AUTH_SECRET for JWT handling
- Do not override the authentication secret with a strong, environment-specific value
In these conditions, the application may fall back to a static, hardcoded secret, causing all instances to share a predictable key for signing and verifying email verification tokens.
Exploit preconditions
- Attack surface: Publicly exposed Dokploy web interface and its authentication endpoints.
- Required access: None; an attacker can be completely unauthenticated.
- Trigger point: JWT generation and verification for email verification and auto-sign-in flows that rely on BETTER_AUTH_SECRET.
- Why exploitation is possible: The presence of a hardcoded fallback secret ("better-auth-secret-123456789") means JWTs can be created and signed by anyone who knows the string, allowing them to impersonate privileged users (including admin) without needing credentials.
Why this happens
The core issue is the use of a hardcoded, shared secret value as a fallback for a critical authentication parameter (BETTER_AUTH_SECRET).
This maps directly to CWE-798: Use of Hard-coded Credentials, where sensitive authentication material is embedded in code or configuration and reused across deployments.
Instead of requiring a unique, strong secret per installation, the application logic defaults to a constant string, effectively converting the authentication secret into a publicly knowable key.
Because JWT integrity validation depends entirely on this secret, any party that knows it can forge valid tokens and bypass intended authorization checks.
Potential impact
- Full administrative account takeover without prior authentication
- Remote execution of arbitrary commands on the host via the built-in SSH terminal
- Deployment, modification, or deletion of applications and services managed by Dokploy
- Access to sensitive configuration data, logs, and environment variables
- Lateral movement opportunities into other systems reachable from the Dokploy host
- Complete compromise of the PaaS control plane and hosted workloads
General mitigation guidance
Mitigation focuses on eliminating shared, hardcoded secrets and enforcing strong, unique authentication keys for all deployments.
Common defensive patterns include:
- Requiring a non-empty, cryptographically strong authentication secret to be explicitly configured at install time, with no insecure default.
- Validating on startup that BETTER_AUTH_SECRET (or equivalent) meets minimum length and entropy requirements, and failing closed if it does not.
- Storing secrets only in secure mechanisms (environment variables, secret managers, or configuration vaults) rather than in code or public configuration.
- Designing token-based authentication so that secrets can be rotated easily without disrupting legitimate sessions for extended periods.
- Applying least privilege to built-in consoles (such as SSH terminals), ensuring they are only accessible after robust, multi-step authentication and authorization checks.
These patterns help ensure that a compromised or misconfigured deployment cannot be trivially hijacked through a shared secret.
How teams detect issues like this
Detection can combine code-level analysis with runtime monitoring:
- Static analysis and code review:
- Flag any hardcoded strings used as JWT signing keys, authentication secrets, or password fallbacks.
- Identify conditionals that default to predefined secrets when environment variables are missing.
- Require explicit review of authentication and token issuance logic for uses of shared or low-entropy keys.
- Configuration and policy checks:
- Enforce deployment policies that disallow starting services if critical secrets are unset or match known default values.
- Use Infrastructure as Code (IaC) and CI checks to verify that BETTER_AUTH_SECRET and similar variables are set per environment.
- Runtime and log analysis:
- Monitor for unusual sign-in patterns, such as first-time logins with admin privileges from unknown IP ranges.
- Alert on abnormal use of the built-in SSH terminal or commands executed outside expected maintenance windows.
Automated security testing and SAST/DAST tools can assist by scanning for hardcoded credentials and weak secret management patterns early in the development lifecycle.

