Summary
@acastellon/auth: Authentication bypass via spoofable headers in validateToken()
@acastellon/auth v2.2.0 appears to allow an unauthenticated authentication bypass in validateToken() through spoofable auth-user and Host request headers.
The validateToken middleware contains a service-to-service bypass for auth-user: service-brother when req.get('host').startsWith(getHostName()). Both values involved in the check can be influenced by an unauthenticated HTTP client: auth-user is a request header, and Host is also client-controlled. As a result, a remote unauthenticated attacker can send a request with crafted headers and bypass token validation before the normal legacy/JWT/OIDC validation logic runs.
Impact:
An attacker may be able to access routes protected by validateToken() without a valid token. In deployments where downstream services trust auth-user or is-* headers, this may also lead to privilege escalation.
Affected package:
@acastellon/auth v2.2.0
Affected code:
auth.js, validateToken()
The issue is related to the service-brother bypass and getHostName() check.
Example request:
GET /protected HTTP/1.1
Host: <configured CNAME or hostname>
auth-user: service-brother
is-admin: true
Expected behavior:
The request should require a valid authentication token.
Actual behavior:
The middleware calls next() before token validation.
Fix implemented in v2.3.0+:
Removed the spoofable bypass.
Always sanitize incoming auth-user and is-* headers.
Added mTLS client certificate based service auth (with optional TRUSTED_MTLS_SERVICES allowlist).
Updated consumers (rest, graphql, dns-client) for mTLS support.
Unit tests added for sanitization + mTLS path.
Impact
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-58399? CVE-2026-58399 is a critical-severity security vulnerability in @acastellon/auth (npm), affecting versions < 2.3.0. It is fixed in 2.3.0.
- Which versions of @acastellon/auth are affected by CVE-2026-58399? @acastellon/auth (npm) versions < 2.3.0 is affected.
- Is there a fix for CVE-2026-58399? Yes. CVE-2026-58399 is fixed in 2.3.0. Upgrade to this version or later.
- Is CVE-2026-58399 exploitable, and should I be worried? Whether CVE-2026-58399 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-58399 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-58399? Upgrade
@acastellon/authto 2.3.0 or later.