Summary
danmu_api contains an authentication bypass that may allow unauthenticated attackers to change server environment configuration when the default TOKEN is active and ADMIN_TOKEN is not configured. Successful manipulation can enable operator lockout, server-side request forgery through redirected endpoints, and redeployment under attacker-controlled settings.
danmu_api contains an authentication bypass that may allow unauthenticated attackers to change server environment configuration when the default TOKEN is active and ADMIN_TOKEN is not configured. Successful manipulation can enable operator lockout, server-side request forgery through redirected endpoints, and redeployment under attacker-controlled settings.
Affected context
The vulnerability occurs in danmu_api deployments where the default TOKEN remains in use and ADMIN_TOKEN is unset. The environment-management endpoints /api/env/set, /api/env/add, and /api/env/del may accept unauthenticated POST requests, allowing external callers to alter security-sensitive settings and trigger operational changes.
The vulnerability occurs in danmu_api deployments where the default TOKEN remains in use and ADMIN_TOKEN is unset. The environment-management endpoints /api/env/set, /api/env/add, and /api/env/del may accept unauthenticated POST requests, allowing external callers to alter security-sensitive settings and trigger operational changes.
Exploit preconditions
- Attack surface: HTTP API endpoints exposed by the danmu_api service
- Required access: Network access to the affected API; no valid authenticated session may be required
- Trigger point: POST requests sent to
/api/env/set,/api/env/add, or/api/env/del - Required configuration state: The default TOKEN is being used and ADMIN_TOKEN is unset
- Why exploitation is possible: The affected environment-management operations do not consistently enforce authentication before applying configuration changes
- Attack surface: HTTP API endpoints exposed by the danmu_api service
- Required access: Network access to the affected API; no valid authenticated session may be required
- Trigger point: POST requests sent to
/api/env/set,/api/env/add, or/api/env/del - Required configuration state: The default TOKEN is being used and ADMIN_TOKEN is unset
- Why exploitation is possible: The affected environment-management operations do not consistently enforce authentication before applying configuration changes
Why this happens
The underlying flaw is missing or ineffective authentication enforcement on administrative configuration endpoints. When the application relies on a default token and does not require a separately configured administrative credential, unauthenticated requests can reach sensitive state-changing operations. This behavior maps to CWE-306: Missing Authentication for Critical Function, because privileged functionality is exposed without adequately verifying the caller's identity.
The underlying flaw is missing or ineffective authentication enforcement on administrative configuration endpoints. When the application relies on a default token and does not require a separately configured administrative credential, unauthenticated requests can reach sensitive state-changing operations. This behavior maps to CWE-306: Missing Authentication for Critical Function, because privileged functionality is exposed without adequately verifying the caller's identity.
Potential impact
- Attackers may set or replace ADMIN_TOKEN and lock out legitimate operators.
- Attackers could redirect OTHER_SERVER or PROXY_URL to attacker-controlled destinations.
- The service may be abused for server-side request forgery.
- Configuration changes can cause unauthorized redeployment or service disruption.
- Compromised settings may enable follow-on attacks against connected systems.
- Attackers may set or replace ADMIN_TOKEN and lock out legitimate operators.
- Attackers could redirect OTHER_SERVER or PROXY_URL to attacker-controlled destinations.
- The service may be abused for server-side request forgery.
- Configuration changes can cause unauthorized redeployment or service disruption.
- Compromised settings may enable follow-on attacks against connected systems.
General mitigation guidance
Mitigation should focus on enforcing authentication and authorization for every environment-management operation, including failure-safe behavior when administrative credentials are absent.
Common defensive patterns include:
- Requiring a unique, non-default administrative credential before enabling management endpoints.
- Rejecting administrative requests unless authentication and authorization checks succeed.
- Disabling or isolating environment mutation endpoints when they are not required.
- Validating and restricting proxy, upstream, and redirect destinations against explicit allowlists.
- Applying least-privilege service permissions and limiting redeployment capabilities.
- Treating missing security configuration as a deployment error rather than falling back to a default token.
Mitigation should focus on enforcing authentication and authorization for every environment-management operation, including failure-safe behavior when administrative credentials are absent.
Common defensive patterns include:
- Requiring a unique, non-default administrative credential before enabling management endpoints.
- Rejecting administrative requests unless authentication and authorization checks succeed.
- Disabling or isolating environment mutation endpoints when they are not required.
- Validating and restricting proxy, upstream, and redirect destinations against explicit allowlists.
- Applying least-privilege service permissions and limiting redeployment capabilities.
- Treating missing security configuration as a deployment error rather than falling back to a default token.
How teams detect issues like this
Detection can include:
- Static analysis and code review checks for administrative routes that lack centralized authentication middleware.
- Searches for default-token fallbacks, empty administrative credentials, and authorization checks performed after state changes.
- API inventory reviews confirming that all configuration mutation endpoints require authenticated and authorized access.
- Monitoring for unauthenticated POST requests to
/api/env/set,/api/env/add, and/api/env/del. - Alerts for unexpected changes to ADMIN_TOKEN, OTHER_SERVER, PROXY_URL, or redeployment-related settings.
- Policy enforcement in CI and API gateways that blocks exposure of management endpoints without authentication.
Detection can include:
- Static analysis and code review checks for administrative routes that lack centralized authentication middleware.
- Searches for default-token fallbacks, empty administrative credentials, and authorization checks performed after state changes.
- API inventory reviews confirming that all configuration mutation endpoints require authenticated and authorized access.
- Monitoring for unauthenticated POST requests to
/api/env/set,/api/env/add, and/api/env/del. - Alerts for unexpected changes to ADMIN_TOKEN, OTHER_SERVER, PROXY_URL, or redeployment-related settings.
- Policy enforcement in CI and API gateways that blocks exposure of management endpoints without authentication.

