GHSA-hcpx-6fm6-wx23: Axios form serializer maxDepth bypass via {} metatoken
Axios versions in the fixed lines for GHSA-62hf-57xw-28j9 still contain an incomplete depth-limit bypass in lib/helpers/toFormData.js. When serializing an object with a top-level key ending in {}, axios calls JSON.stringify() on that value before the formSerializer.maxDepth guard can inspect the nested structure.
An attacker who can control object keys and nested values passed by an application into axios form or parameter serialization can trigger a raw RangeError: Maximum call stack size exceeded, causing a denial of service in the affected request path.
The maxDepth=100 guard added in axios 1.15.0 to fix GHSA-62hf-57xw-28j9 lives inside the build() recursion in lib/helpers/toFormData.js. The default visitor at lib/helpers/toFormData.js:166-170 still has a top-level shortcut that calls JSON.stringify(value) whenever a key ends in '{}', before build() ever sees the nested value. JSON.stringify on a deeply nested object stack-overflows with RangeError: Maximum call stack size exceeded, which propagates synchronously out of the axios call. The exact attacker-data flow that the original advisory described (proxy-style code that forwards client JSON into axios({ data, params })) still crashes the process at depth ~3000 on a default Node.js stack, despite v1.16.0 being patched.
References
- github.com/advisories/GHSA-hcpx-6fm6-wx23
- github.com/axios/axios/commit/1417285c69344bbcc6420a021f67dee0c6fedb2d
- github.com/axios/axios/commit/32fc489632377d214db55bfa4e2c48486a7d7ce2
- github.com/axios/axios/pull/11000
- github.com/axios/axios/pull/11001
- github.com/axios/axios/releases/tag/v0.33.0
- github.com/axios/axios/releases/tag/v1.18.0
- github.com/axios/axios/security/advisories/GHSA-hcpx-6fm6-wx23
Code Behaviors & Features
Detect and mitigate GHSA-hcpx-6fm6-wx23 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →