Skip to content

fix: guard socketPath with own() to prevent prototype pollution SSRF#10901

Open
nezukoagent wants to merge 1 commit into
axios:v1.xfrom
nezukoagent:fix/socketPath-prototype-pollution
Open

fix: guard socketPath with own() to prevent prototype pollution SSRF#10901
nezukoagent wants to merge 1 commit into
axios:v1.xfrom
nezukoagent:fix/socketPath-prototype-pollution

Conversation

@nezukoagent
Copy link
Copy Markdown

@nezukoagent nezukoagent commented May 17, 2026

Summary

CVE-2026-42264 fix introduced the own() helper to guard config reads from prototype pollution, but socketPath and allowedSocketPaths were missed.

The Bug

// lib/adapters/http.js:886
if (config.socketPath) {  // ❌ reads from prototype chain!
    options.socketPath = config.socketPath;
}

12 other properties use own() (auth, beforeRedirect, data, transport, insecureHTTPParser, etc.) but socketPath does not.

PoC

const axios = require("axios");
Object.prototype.socketPath = "/var/run/docker.sock";
axios.get("http://example.com/api");
// → Request routes to Docker daemon!

Impact

  • Docker container escape
  • Kubernetes node access
  • CI/CD pipeline hijacking

Fix

Use own("socketPath") and own("allowedSocketPaths") instead of direct config.xxx access:

const socketPath = own("socketPath");
if (socketPath) {
    const allowedSocketPaths = own("allowedSocketPaths");
    // ...
}

References


Summary by cubic

Guards socketPath and allowedSocketPaths with own() in the HTTP adapter to close a prototype pollution SSRF vector in axios. Completes CVE-2026-42264 coverage (GHSA-72mg-mc2j-cwf6) by preventing polluted prototypes from redirecting requests to Unix sockets.

  • Bug Fixes

    • Read socketPath and allowedSocketPaths via own() in lib/adapters/http.js; keep type checks and allowlist validation on resolved paths.
    • Ignores inherited properties and blocks SSRF to Unix sockets.
    • Docs: Update /docs/ adapter config for socketPath, allowedSocketPaths, and setting an explicit allowlist.
  • Testing

    • No tests added. Needed:
      • Inherited socketPath on Object.prototype is ignored.
      • Non-string socketPath throws ERR_BAD_OPTION_VALUE.
      • Requests proceed only when socketPath matches allowedSocketPaths (string and array).
    • Semantic version impact: patch (bug fix, no API/behavior change for valid configs).

Written for commit cf258f5. Summary will update on new commits. Review in cubic

@nezukoagent nezukoagent requested a review from jasonsaayman as a code owner May 17, 2026 11:53
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

CVE-2026-42264 fix introduced the own() helper to guard config reads,
but socketPath and allowedSocketPaths were missed. An attacker who can
pollute Object.prototype.socketPath (via another dependency) can
redirect all axios requests to a Unix socket (e.g. Docker daemon),
enabling SSRF and container escape.

Fix: use own('socketPath') and own('allowedSocketPaths') instead of
direct config property access.

Ref: GHSA-72mg-mc2j-cwf6
Fixes: CVE-2026-42264 (complete)
@nezukoagent nezukoagent force-pushed the fix/socketPath-prototype-pollution branch from 50c4da6 to cf258f5 Compare May 17, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant