CVE-2026-42041
JSON

4.8medium

Axios: Authentication Bypass via Prototype Pollution Gadget in `validateStatus` Merge Strategy

Severity
4.8medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.62% (higher than 50% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-w9j2-pvgh-6h63

Description

Axios is a promise based HTTP client for the browser and Node.js. Prior to 1.15.1 and 0.31.1, the Axios library is vulnerable to a Prototype Pollution "Gadget" attack that allows any Object.prototype pollution to silently suppress all HTTP error responses (401, 403, 500, etc.), causing them to be treated as successful responses. This completely bypasses application-level authentication and error handling. The root cause is that validateStatus is the only config property using the mergeDirectKeys merge strategy, which uses JavaScript's in operator — an operator that inherently traverses the prototype chain. When Object.prototype.validateStatus is polluted with () => true, all HTTP status codes are accepted as success. This vulnerability is fixed in 1.15.1 and 0.31.1.

Affected

Product or packageVersionsReported by
axios axios>= 1.0.0, < 1.15.1, < 0.31.1, before 0.31.1, from 1.0.0 before 1.15.1CVE List, NVD
axiosNot specifiedCVE List
multicluster-engine/console-mce-rhel9Not specified
Not affected: from 1780917531 before *, from 1780910888 before *, from 1778511348 before *, from 1778383863 before *, from 1778532610 before *
CVE List
network-observability/network-observability-console-plugin-compat-rhel9Not specified
Not affected: from 1778508956 before *
CVE List
network-observability/network-observability-console-plugin-rhel9Not specified
Not affected: from 1778510461 before *
CVE List
rhacm2/console-rhel9Not specified
Not affected: from 1783451729 before *, from 1780876734 before *, from 1780600823 before *
CVE List
advanced-cluster-security/rhacs-main-rhel8Not specified
Not affected: from 1779371594 before *, from 1779293013 before *
CVE List
rhdh/rhdh-hub-rhel9Not specified
Not affected: from 1779841586 before *, from 1782761244 before *
CVE List
discovery/discovery-ui-rhel9Not specified
Not affected: from 1778156756 before *
CVE List
rhmtc/openshift-migration-ui-rhel8Not specified
Not affected: from 1780590717 before *
CVE List
mta/mta-ui-rhel9Not specified
Not affected: from 1785169013 before *
CVE List
rhoai/odh-dashboard-rhel9Not specified
Not affected: from 1780467029 before *
CVE List

All scores

GitHub_M4.8medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
redhat-SADP8.2high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N
GitHub4.8medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
NVD6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N

Classification

CWE-287CWE-915CWE-1321

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

What each source says

CVE List

Axios is a promise based HTTP client for the browser and Node.js. Prior to 1.15.1 and 0.31.1, the Axios library is vulnerable to a Prototype Pollution "Gadget" attack that allows any Object.prototype pollution to silently suppress all HTTP error responses (401, 403, 500, etc.), causing them to be treated as successful responses. This completely bypasses application-level authentication and error handling. The root cause is that validateStatus is the only config property using the mergeDirectKeys merge strategy, which uses JavaScript's in operator — an operator that inherently traverses the prototype chain. When Object.prototype.validateStatus is polluted with () => true, all HTTP status codes are accepted as success. This vulnerability is fixed in 1.15.1 and 0.31.1.

GitHub Advisory Database

Vulnerability Disclosure: Authentication Bypass via Prototype Pollution Gadget in validateStatus Merge Strategy

Summary

The Axios library is vulnerable to a Prototype Pollution "Gadget" attack that allows any Object.prototype pollution to silently suppress all HTTP error responses (401, 403, 500, etc.), causing them to be treated as successful responses. This completely bypasses application-level authentication and error handling.

The root cause is that validateStatus is the only config property using the mergeDirectKeys merge strategy, which uses JavaScript's in operator — an operator that inherently traverses the prototype chain. When Object.prototype.validateStatus is polluted with () => true, all HTTP status codes are accepted as success.

Severity: High (CVSS 8.2) Affected Versions: All versions (v0.x - v1.x including v1.15.0) Vulnerable Component: lib/core/mergeConfig.js (mergeDirectKeys strategy) + lib/core/settle.js

CWE

  • CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
  • CWE-287: Improper Authentication

CVSS 3.1

Score: 8.2 (High)

Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N

MetricValueJustification
Attack VectorNetworkPP is triggered remotely
Attack ComplexityLowOnce PP exists, a single property assignment exploits this. Consistent with GHSA-fvcv-3m26-pcqx
Privileges RequiredNoneNo authentication needed
User InteractionNoneNo user interaction required
ScopeUnchangedImpact within the application
ConfidentialityLow401 treated as success may expose data behind auth gates
IntegrityHighAll error handling and auth checks are silently bypassed — application operates on invalid assumptions
AvailabilityNoneThe function works correctly (returns true), no crash

Usage of "Helper" Vulnerabilities

This vulnerability requires Zero Direct User Input.

If an attacker can pollute Object.prototype via any other library in the stack, Axios will automatically inherit the polluted validateStatus function during config merge. The in operator in mergeDirectKeys makes this property uniquely susceptible to prototype pollution compared to all other config properties.

Why validateStatus Is Uniquely Vulnerable

All other config properties use defaultToConfig2, which reads config2[prop] (traverses prototype). But validateStatus uses mergeDirectKeys, which uses the in operator:

// mergeConfig.js:58-64 — mergeDirectKeys (ONLY used by validateStatus)
function mergeDirectKeys(a, b, prop) {
  if (prop in config2) {           // ← `in` traverses prototype chain!
    return getMergedValue(a, b);
  } else if (prop in config1) {
    return getMergedValue(undefined, a);
  }
}

// mergeConfig.js:94
const mergeMap = {
  // ... all others use defaultToConfig2 ...
  validateStatus: mergeDirectKeys,   // ← ONLY property using this strategy
};

The in operator is a more aggressive prototype traversal than property access. While config2['validateStatus'] also traverses the prototype, the explicit in check makes the intent clearer and the vulnerability more direct.

Proof of Concept

1. The Setup (Simulated Pollution)
Object.prototype.validateStatus = () => true;
2. The Gadget Trigger (Safe Code)
// Application checks authentication via HTTP status codes
try {
  const response = await axios.get('https://api.internal/admin/users');
  // Developer expects: 401 → catch block → redirect to login
  // Reality: 401 → treated as success → displays admin data
  processAdminData(response.data);  // Executes with 401 response body!
} catch (error) {
  redirectToLogin();  // NEVER REACHED for 401/403/500
}
3. The Execution
// mergeConfig.js:58 — 'validateStatus' in config2
// config2 = { url: '/admin/users', method: 'get' }
// 'validateStatus' in config2 → checks prototype → finds () => true → TRUE
// → getMergedValue(defaultValidator, () => true) → returns () => true

// settle.js:16 — ALL status codes resolve
const validateStatus = response.config.validateStatus;  // () => true
if (!response.status || !validateStatus || validateStatus(response.status)) {
  resolve(response);  // 401, 403, 500 all resolve here!
}
4. The Impact
Before pollution:
  HTTP 200 → resolve (success)
  HTTP 401 → reject (auth error) → redirectToLogin()
  HTTP 403 → reject (forbidden) → showAccessDenied()
  HTTP 500 → reject (server error) → showErrorPage()

After pollution:
  HTTP 200 → resolve (success)
  HTTP 401 → resolve (SUCCESS!) → processAdminData() with error body
  HTTP 403 → resolve (SUCCESS!) → application thinks user has access
  HTTP 500 → resolve (SUCCESS!) → application processes error as data

Verified PoC Output

--- Before Pollution ---
401: REJECTED as expected - Request failed with status code 401
500: REJECTED as expected - Request failed with status code 500

--- After Pollution ---
200: RESOLVED as success (status: 200)
301: RESOLVED as success (status: 301)
401: RESOLVED as success (status: 401)
403: RESOLVED as success (status: 403)
404: RESOLVED as success (status: 404)
500: RESOLVED as success (status: 500)
503: RESOLVED as success (status: 503)

--- Authentication Bypass Demo ---
Auth check bypassed! 401 treated as success.
Application proceeds with: { status: 401, message: 'Response with status 401' }

Impact Analysis

  • Authentication Bypass: Applications relying on axios rejecting 401/403 to enforce auth will silently accept unauthorized responses, allowing unauthenticated access to protected resources.
  • Silent Error Swallowing: 500-series errors are treated as success, causing applications to process error bodies as valid data — leading to data corruption or logic errors.
  • Security Control Bypass: Rate limiting (429), WAF blocks (403), and CAPTCHA challenges are suppressed.
  • Universal Scope: Affects every axios instance in the application, including third-party libraries.

Recommended Fix

Replace the in operator with hasOwnProperty in mergeDirectKeys:

// FIXED: lib/core/mergeConfig.js
function mergeDirectKeys(a, b, prop) {
  if (Object.prototype.hasOwnProperty.call(config2, prop)) {
    return getMergedValue(a, b);
  } else if (Object.prototype.hasOwnProperty.call(config1, prop)) {
    return getMergedValue(undefined, a);
  }
}

Resources

Timeline

DateEvent
2026-04-15Vulnerability discovered during source code audit
2026-04-15PoC developed and vulnerability confirmed
2026-04-16Report revised for accuracy
TBDReport submitted to vendor via GitHub Security Advisory
NVD (es)

Axios es un cliente HTTP basado en promesas para el navegador y Node.js. Anterior a 1.15.1 y 0.31.1, la biblioteca Axios es vulnerable a un ataque de ’Gadget’ de Contaminación de Prototipos que permite que cualquier contaminación de Object.prototype suprima silenciosamente todas las respuestas de error HTTP (401, 403, 500, etc.), haciendo que sean tratadas como respuestas exitosas. Esto elude completamente la autenticación a nivel de aplicación y el manejo de errores. La causa raíz es que validateStatus es la única propiedad de configuración que utiliza la estrategia de fusión mergeDirectKeys, la cual usa el operador ’in’ de JavaScript - un operador que inherentemente recorre la cadena de prototipos. Cuando Object.prototype.validateStatus es contaminado con () => true, todos los códigos de estado HTTP son aceptados como éxito. Esta vulnerabilidad está corregida en 1.15.1 y 0.31.1.

References

https://github.com/axios/axios/security/advisories/GHSA-w9j2-pvgh-6h63exploit, mitigation, vendor-advisory, web
https://access.redhat.com/security/cve/CVE-2026-42041vdb-entry
https://bugzilla.redhat.com/show_bug.cgi?id=2461629issue-tracking
https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-42041.json
https://access.redhat.com/errata/RHSA-2026:25089vendor-advisory
https://access.redhat.com/errata/RHSA-2026:16874vendor-advisory
https://access.redhat.com/errata/RHSA-2026:36882vendor-advisory
https://access.redhat.com/errata/RHSA-2026:24539vendor-advisory
https://access.redhat.com/errata/RHSA-2026:25273vendor-advisory
https://access.redhat.com/errata/RHSA-2026:20938vendor-advisory
https://access.redhat.com/errata/RHSA-2026:20889vendor-advisory
https://access.redhat.com/errata/RHSA-2026:22619vendor-advisory

Sources

SourceRecordLicence
CVE ListCVE-2026-42041 changed 2026-09-10CVE Terms of Use
GitHub Advisory DatabaseGHSA-w9j2-pvgh-6h63 changed 2026-09-10CC-BY-4.0
NVDCVE-2026-42041 changed 2026-11-11Public domain