The Axios Security Vulnerability: How CVE-2023-45857 Silently Leaked Auth Tokens and What It Reveals About npm Dependency Risk | Lorikeet Security Skip to main content
Back to Blog
Security Incidents

The Axios Security Vulnerability: How CVE-2023-45857 Silently Leaked Auth Tokens and What It Reveals About npm Dependency Risk

Lorikeet Security · April 4, 2026 · 11 min read

Axios is the HTTP client library that most JavaScript developers reach for without thinking twice. With over 50 million weekly npm downloads and a transitive dependency footprint that spans hundreds of thousands of applications, it is as close to ubiquitous as a single npm package gets. React apps use it. Vue apps use it. Node.js microservices use it. It has been the default choice for making HTTP requests in JavaScript for nearly a decade.

In November 2023, a critical vulnerability was disclosed in axios: CVE-2023-45857, CVSS score 8.8 (High). The vulnerability allowed attackers to perform CSRF-style attacks that caused axios to forward the HTTP Authorization header — containing bearer tokens, API keys, and session credentials — to a different, attacker-controlled origin than the one the application intended to contact.

The vulnerability was silent. No error. No log entry. The auth token simply went to the wrong place.

Vulnerability Summary
CVE-2023-45857 — CVSS 8.8 (High)

Package: axios (npm)
Affected versions: < 1.6.0
Fixed in: 1.6.0 (November 2023)
Impact: Authorization header forwarded to unintended origins on cross-origin redirects
Vector: Network, no authentication required, user interaction required (CSRF)


What the Vulnerability Actually Did

To understand CVE-2023-45857, you need to understand how HTTP redirects and browser security policies interact with custom headers.

When a browser's native fetch() API follows a redirect from origin A to a different origin B, it strips sensitive headers like Authorization before making the second request. This is correct security behavior — you authenticated with server A, and server B should not automatically receive that token.

Axios, which implements its own HTTP handling layer, failed to apply this same check before a fix was introduced in version 1.6.0. When axios followed a redirect that crossed origins, it forwarded all headers from the original request — including Authorization — to the redirected destination.

The attack scenario

An attacker who can cause an axios-based application to make a request to a URL they control — or who can cause a server they influence to issue a redirect — can receive the application's Authorization header at their own endpoint. The typical CSRF attack chain looks like this:

  1. Application makes an axios request to api.legitimate.com/resource with Authorization: Bearer <token>
  2. The server at api.legitimate.com issues a 302 redirect to attacker-controlled.com/capture
  3. Axios follows the redirect without stripping headers
  4. Axios sends the request to attacker-controlled.com/capture with Authorization: Bearer <token> included
  5. Attacker captures the token and uses it to authenticate as the victim
Why "User Interaction Required" Doesn't Mean Low Risk The CVSS score notes "user interaction required," which might suggest lower exploitability. In practice, this means an attacker needs a way to trigger the axios request — for example, convincing a user to click a link, or exploiting an SSRF vulnerability in a server-side application that uses axios. In modern web apps where axios runs both client-side and server-side (Node.js), the attack surface is significantly broader than the CVSS description implies.

Server-side axios exposure

The risk is not limited to client-side web apps. Many Node.js microservices use axios to make requests to internal APIs — often with service account tokens or API keys in the Authorization header. A server-side SSRF vulnerability that allows an attacker to influence the URL that axios fetches could chain into auth token theft via redirect manipulation. This is a particularly high-severity scenario because service account tokens often have broader permissions than user tokens.


What the Fix Looked Like

Prior to 1.6.0, axios had no origin check before forwarding headers on redirect. The fix introduced a comparison between the original request origin and the redirect destination. If they differ, sensitive headers are stripped — matching the behavior of native browser APIs.

// Vulnerable pattern (pre-1.6.0 conceptual illustration) // axios followed redirects and forwarded all request headers, // including Authorization, regardless of whether the redirect // crossed origins. const response = await axios.get('https://api.your-app.com/data', { headers: { 'Authorization': `Bearer ${userToken}` } }); // If api.your-app.com redirects to attacker.com, // the Authorization header goes with it. // Safe pattern — explicitly prevent header forwarding on cross-origin redirects const response = await axios.get('https://api.your-app.com/data', { headers: { 'Authorization': `Bearer ${userToken}` }, maxRedirects: 0, // Disable redirect following entirely, handle manually // OR: upgrade to axios >= 1.6.0 which handles this automatically });

Checking your current version

# Check installed axios version (direct + transitive) npm list axios # Run npm security audit — will flag CVE-2023-45857 if affected version found npm audit # Check for all axios versions across the full dependency tree npm list axios --all # Update axios to safe version npm install axios@latest # If axios is a transitive dependency (installed by another package), # force resolution in package.json: # "overrides": { "axios": ">=1.6.0" }

Timeline of the Disclosure

October 2023
Vulnerability reported to the axios maintainers. The issue traced to the library's redirect-following logic not applying the same origin-stripping behavior as native browser fetch.
November 8, 2023
axios 1.6.0 released, including the origin check fix. Release notes document the security fix. The GitHub advisory is published simultaneously with the CVE assignment.
November 2023 (disclosure)
CVE-2023-45857 officially published with CVSS score 8.8. Security tools including Snyk, npm audit, and Dependabot begin flagging vulnerable versions. Wide coverage in the JavaScript and security communities.
Ongoing
Millions of applications remain on older axios versions due to update inertia, pinned dependencies, or transitive dependency conflicts. npm's weekly download statistics for sub-1.6.0 versions remain significant months after the fix.

The Broader npm Supply Chain Problem

The axios CVE is illustrative of a structural problem with npm dependency management that goes beyond any single library. Modern JavaScript applications routinely have hundreds or thousands of transitive dependencies — code written by individuals or small teams that your application trusts implicitly because it appears in your node_modules directory.

The scale of npm dependency risk

Consider what a typical medium-sized React application's dependency graph actually contains:

Each of these packages is implicitly trusted with the ability to execute code in your environment, access environment variables, make network requests, and read the filesystem. A malicious or compromised package anywhere in that tree can exfiltrate secrets, install backdoors, or silently manipulate your application's behavior.

Recent npm supply chain incidents

The axios CVE was a vulnerability in legitimate code — a bug, not malicious intent. But the npm ecosystem has also faced deliberate supply chain attacks:

The Transitive Dependency Blind Spot Most developers can tell you what their direct dependencies do. Very few can tell you what their transitive dependencies do. When the ua-parser-js compromise happened, most affected organizations did not know they were using ua-parser-js at all — they used a package that used it. This blind spot is systemic and not easily solved without dedicated tooling and process.

What Your Application Security Review Should Cover

The axios CVE should prompt a broader review of how your application handles HTTP client security. Here is what a proper assessment looks like:

HTTP client configuration review

Dependency security process


What Pentesters Look for in Applications Using Axios

When we test web applications that use axios, the CVE-2023-45857 vulnerability is one item on a longer checklist of HTTP client security issues. Here is what a comprehensive assessment examines:

SSRF via user-controlled URLs

If your application accepts a URL as user input and passes it to axios (webhook endpoints, import-from-URL features, link previews, avatar fetching), we test whether we can redirect that request to internal services. The axios redirect-following behavior made SSRF-to-credential-theft chains particularly attractive because the auth header came with the redirect.

Token leakage via open redirects

Open redirect vulnerabilities on your own domain become significantly more dangerous when your application uses axios with default headers. An attacker who finds an open redirect on api.yourapp.com/redirect?url=attacker.com can potentially capture authorization tokens from any authenticated request that follows that redirect.

Global header configuration review

Applications frequently set auth headers globally using axios interceptors without considering which requests should and should not carry those credentials. A proper code review maps all outbound HTTP requests from your application and verifies that sensitive headers are only attached to requests going to the intended authenticated endpoint.


The Lesson That Applies Beyond Axios

CVE-2023-45857 is not a story about axios being uniquely insecure. axios is a well-maintained library with active contributors and a fast response to the disclosure. The vulnerability was fixed within weeks of being reported and disclosed responsibly.

The lesson is about assumption of trust in the dependency ecosystem. Every package your application depends on — whether directly or transitively — is code you are executing in your environment. The security model of your application includes every package in node_modules. Most development teams do not review dependency code with the same rigor they apply to their own application code.

The organizations that handled the axios CVE well were the ones that already had:

The organizations that were still running vulnerable axios versions months after the fix were the ones treating security as something that happens during audits rather than as a continuous engineering practice.

Is Your Application Still Running Vulnerable Dependencies?

Our web application penetration tests include a dependency security review as part of the assessment scope. We identify vulnerable packages, test for exploitable paths in your specific application context, and provide prioritized remediation guidance.

Request an Assessment
-- views
Link copied!
Lorikeet Security

Lorikeet Security Team

Penetration Testing & Cybersecurity Consulting

We've completed 170+ security engagements across web apps, APIs, cloud infrastructure, and AI-generated codebases. Everything we publish here comes from patterns we see in real client work.

Lory waving

Hi, I'm Lory! Need help finding the right service? Click to chat!