ghsa-x4m5-4cw8-vc44
Vulnerability from github
Published
2025-12-30 15:37
Modified
2025-12-30 15:37
Summary
axios-cache-interceptor Vulnerable to Cache Poisoning via Ignored HTTP Vary Header
Details

Summary

When a server calls an upstream service using different auth tokens, axios-cache-interceptor returns incorrect cached responses, leading to authorization bypass.

Details

The cache key is generated only from the URL, ignoring request headers like Authorization. When the server responds with Vary: Authorization (indicating the response varies by auth token), the library ignores this, causing all requests to share the same cache regardless of authorization.

Impact

Affected: Server-side applications (APIs, proxies, backend services) that:

  • Use axios-cache-interceptor to cache requests to upstream services
  • Handle requests from multiple users with different auth tokens
  • Upstream services replies on Vary to differentiate caches

Not affected: Browser/client-side applications (single user per browser session).

Services using different auth tokens to call upstream services will return incorrect cached data, bypassing authorization checks and leaking user data across different authenticated sessions.

Solution

After v1.11.1, automatic Vary header support is now enabled by default.

When server responds with Vary: Authorization, cache keys now include the authorization header value. Each user gets their own cache.

js // v1.11.1+ (automatic, no config needed) // User 123: key = hash(url + {authorization: 'Bearer 123'}) // User 456: key = hash(url + {authorization: 'Bearer 456'}) // ✓ Different caches, no poisoning

Remediation

Upgrade to v1.11.1 or later. No code changes required, protection is automatic

Proof of Concept

```js const http = require('node:http'); const axios = require('axios'); const { setupCache } = require('axios-cache-interceptor');

// Server that returns different responses based on Authorization const server = http.createServer((req, res) => { const auth = req.headers.authorization;

res.setHeader('Vary', 'Authorization');

if (auth === 'Bearer 123') { res.write('Hello, user 123!'); } else if (auth === 'Bearer 456') { res.write('Hello, user 456!'); } else { res.write('Unknown'); }

res.end(); });

server.listen(5000);

// Client making requests with different tokens const cachedAxios = setupCache(axios.create());

const server2 = http.createServer(async (_req, res) => { const authHeader = Math.random() < 0.5 ? 'Bearer 123' : 'Bearer 456';

const response = await cachedAxios.get('http://localhost:5000', { headers: { Authorization: authHeader } });

console.log({ response: response.data, cached: response.cached, auth: authHeader }); res.write(response.data); res.end(); });

server2.listen(5001);

// Trigger 10 requests Promise.all( Array.from({ length: 10 }, () => axios.get('http://localhost:5001').catch(console.error) ) ).finally(() => { server.close(); server2.close(); }); ```

All 10 responses return "Hello, user 123!" even when using "Bearer 456" - users receive each other's cached data.

Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "axios-cache-interceptor"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.11.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2025-69202"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-524"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2025-12-30T15:37:55Z",
    "nvd_published_at": "2025-12-29T20:15:42Z",
    "severity": "MODERATE"
  },
  "details": "## Summary\n\nWhen a server calls an upstream service using different auth tokens, axios-cache-interceptor returns incorrect cached responses, leading to authorization bypass.\n\n## Details\n\nThe cache key is generated only from the URL, ignoring request headers like `Authorization`. When the server responds with `Vary: Authorization` (indicating the response varies by auth token), the library ignores this, causing all requests to share the same cache regardless of authorization.\n\n## Impact\n\n**Affected:** Server-side applications (APIs, proxies, backend services) that:\n\n- Use axios-cache-interceptor to cache requests to upstream services\n- Handle requests from multiple users with different auth tokens\n- Upstream services replies on `Vary` to differentiate caches\n\n**Not affected:** Browser/client-side applications (single user per browser session).\n\nServices using different auth tokens to call upstream services will return incorrect cached data, bypassing authorization checks and leaking user data across different authenticated sessions.\n\n## Solution\n\nAfter `v1.11.1`, automatic `Vary` header support is now enabled by default.\n\nWhen server responds with `Vary: Authorization`, cache keys now include the authorization header value. Each user gets their own cache.\n\n```js\n// v1.11.1+ (automatic, no config needed)\n// User 123: key = hash(url + {authorization: \u0027Bearer 123\u0027})\n// User 456: key = hash(url + {authorization: \u0027Bearer 456\u0027})\n// \u2713 Different caches, no poisoning\n```\n\n## Remediation\n\nUpgrade to v1.11.1 or later. _No code changes required, protection is automatic_\n\n\n## Proof of Concept\n\n```js\nconst http = require(\u0027node:http\u0027);\nconst axios = require(\u0027axios\u0027);\nconst { setupCache } = require(\u0027axios-cache-interceptor\u0027);\n\n// Server that returns different responses based on Authorization\nconst server = http.createServer((req, res) =\u003e {\n  const auth = req.headers.authorization;\n\n  res.setHeader(\u0027Vary\u0027, \u0027Authorization\u0027);\n\n  if (auth === \u0027Bearer 123\u0027) {\n    res.write(\u0027Hello, user 123!\u0027);\n  } else if (auth === \u0027Bearer 456\u0027) {\n    res.write(\u0027Hello, user 456!\u0027);\n  } else {\n    res.write(\u0027Unknown\u0027);\n  }\n\n  res.end();\n});\n\nserver.listen(5000);\n\n// Client making requests with different tokens\nconst cachedAxios = setupCache(axios.create());\n\nconst server2 = http.createServer(async (_req, res) =\u003e {\n  const authHeader =\n    Math.random() \u003c 0.5 ? \u0027Bearer 123\u0027 : \u0027Bearer 456\u0027;\n\n  const response = await cachedAxios.get(\u0027http://localhost:5000\u0027, {\n    headers: { Authorization: authHeader }\n  });\n\n  console.log({\n    response: response.data,\n    cached: response.cached,\n    auth: authHeader\n  });\n  res.write(response.data);\n  res.end();\n});\n\nserver2.listen(5001);\n\n// Trigger 10 requests\nPromise.all(\n  Array.from({ length: 10 }, () =\u003e\n    axios.get(\u0027http://localhost:5001\u0027).catch(console.error)\n  )\n).finally(() =\u003e {\n  server.close();\n  server2.close();\n});\n```\n\nAll 10 responses return \"Hello, user 123!\" even when using \"Bearer 456\" - users receive each other\u0027s cached data.",
  "id": "GHSA-x4m5-4cw8-vc44",
  "modified": "2025-12-30T15:37:55Z",
  "published": "2025-12-30T15:37:55Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/arthurfiorette/axios-cache-interceptor/security/advisories/GHSA-x4m5-4cw8-vc44"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-69202"
    },
    {
      "type": "WEB",
      "url": "https://github.com/arthurfiorette/axios-cache-interceptor/commit/49a808059dfc081b9cc23d48f243d55dfce15f01"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/arthurfiorette/axios-cache-interceptor"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:L/SI:L/SA:N",
      "type": "CVSS_V4"
    }
  ],
  "summary": "axios-cache-interceptor Vulnerable to Cache Poisoning via Ignored HTTP Vary Header"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…