/

CVE-2026-116485

Severity:

CRITICAL RISK

(9.8)

Authentication Bypass (CWE-306) in danmu_api Config

CVE-2026-116485

Deferred

Vulnerability type

Category:

Authentication Bypass

CWE:

CWE-306

Impact:

Unauthorized Configuration Modification and Server-Side Request Forgery

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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.

Sources

SourceLink
github.comgithub.com/huangxd-/danmu_api
github.comgithub.com/huangxd-/danmu_api/blob/5ef63a01bae7c4bad4dcd7bafbbcdcf33aa82564/danmu_api/worker.js#L223-L244
github.comgithub.com/huangxd-/danmu_api/commit/6e93478064a0ce4e7ed3bc2eae88adaad1b7ab02
github.comgithub.com/huangxd-/danmu_api/issues/531
vulncheck.comvulncheck.com/advisories/danmu-api-before-1.21.7-authentication-bypass-via-default-token-in-env-endpoints

Frequently asked

questions

Yes. If the affected API is network-accessible and the default TOKEN is active while ADMIN_TOKEN is unset, an attacker may be able to send unauthenticated requests remotely.

No authenticated account may be required. Network reachability to the vulnerable management endpoints and the insecure credential configuration are the key conditions.

Require strong, non-default authentication and authorization before processing any environment-management request, and fail closed when administrative credentials are missing.

Use centralized authorization middleware, prohibit default credentials, restrict management endpoints at the network boundary, validate sensitive configuration changes, and monitor administrative API activity.

Yes. If the affected API is network-accessible and the default TOKEN is active while ADMIN_TOKEN is unset, an attacker may be able to send unauthenticated requests remotely.

No authenticated account may be required. Network reachability to the vulnerable management endpoints and the insecure credential configuration are the key conditions.

Require strong, non-default authentication and authorization before processing any environment-management request, and fail closed when administrative credentials are missing.

Use centralized authorization middleware, prohibit default credentials, restrict management endpoints at the network boundary, validate sensitive configuration changes, and monitor administrative API activity.

Find out what's already
exploitable in your codebase.