Bypass of maxBodyLength in Axios Fetch Adapter: Uncontrolled Stream Uploads

axios Updated 21 Jul 2026

Summary

20/07/2026
MODERATE
Yes i
Moderate
6.3

GHSA-jqh4-m9w3-8hp9: Axios: Fetch adapter ReadableStream uploads bypass maxBodyLength. Affects axios versions >= 1.7.0, < 1.18.0. Fixed in 1.18.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Axios is a popular JavaScript library used for making HTTP requests from both Node.js and browser environments. It provides a simple API for handling requests and responses, making it a go-to choice for developers. The library includes a fetch adapter for environments where the native fetch API is available. However, a recent vulnerability has been identified in the fetch adapter that allows untrusted upload streams to bypass the configured maximum body length, potentially leading to unexpected network egress and resource exhaustion.

Vulnerability Detail

The vulnerability arises from the fetch adapter's failure to enforce the maxBodyLength limit for live WHATWG ReadableStream request bodies. When an application uses the fetch adapter and relies on maxBodyLength to restrict untrusted uploads, it can inadvertently send the entire stream, even if it exceeds the specified limit. This can lead to uncontrolled data egress, resource consumption, and potential exhaustion of API quotas or bandwidth. The issue is rooted in the lack of a branch in the body-length resolution logic for ReadableStream, which results in the maxBodyLength check being skipped for unknown-length streams.

How To Fix

Latest published version: 1.20.0 as of 22 Oct 2026

npm install axios@1.20.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.18.0

This is the first release that contains the fix.

npm install axios@1.18.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, use the HTTP adapter for untrusted stream uploads in Node.js environments. Alternatively, you can wrap or count the stream at the application layer and abort it when it exceeds the intended limit. Here is an example of how to implement a simple stream wrapper that checks the byte length:

function limitStream(stream, maxBytes) {
  let totalBytes = 0;
  return new ReadableStream({
    pull(controller) {
      if (totalBytes >= maxBytes) {
        controller.close();
    return;
      }
      stream.getReader().read().then(({ done, value }) => {
        if (done) {
          controller.close();
      return;
        }
    totalBytes += value.byteLength;
        controller.enqueue(value);
      });
    }
  });
}

Conclusion

The Axios fetch adapter vulnerability allows untrusted streams to bypass the maxBodyLength limit, posing risks of uncontrolled data egress and resource exhaustion. Updating to version 1.18.0 or later is essential to mitigate this issue. Until then, using workarounds like the HTTP adapter or stream wrappers can help manage the risk.

See every vulnerability recorded for axios →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 6.3, indicating a moderate level of risk.

Axios versions from 1.7.0 up to, but not including, 1.18.0 are affected by this vulnerability.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected without requiring any signup.

The vulnerability can lead to uncontrolled data egress, resource exhaustion, and bypassing of API quotas or bandwidth limits, which can impact application performance and costs.

Yes, you can use the HTTP adapter for untrusted stream uploads or implement a stream wrapper that limits the byte length of the upload.

Related vulnerabilities

Recent vulnerabilities recorded for axios.

How To Fix

Latest published version: 1.20.0 as of 22 Oct 2026

npm install axios@1.20.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.18.0

This is the first release that contains the fix.

npm install axios@1.18.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback