The vulnerability, identified as GHSA-m7pr-hjqh-92cm, is a Server-Side Request Forgery (SSRF) bypass in the axios library's handling of the no_proxy environment variable. The root cause of this vulnerability is the shouldBypassProxy function's failure to correctly identify and normalize loopback address aliases. Initially, the function performed a direct string comparison, which meant that an entry like no_proxy=localhost would not prevent requests from being sent to 127.0.0.1 or [::1] through a configured proxy.
An attacker could exploit this flaw by crafting a request to a loopback IP address instead of the hostname, bypassing the intended proxy restrictions and potentially accessing sensitive internal services. The vulnerability was addressed through a series of patches.
The first patch, in commit 163da7226fd2cd21f0f238f99b2f75a51bf9b2a3, introduced a helper function, isLoopback, to check against a static set of loopback addresses (localhost, 127.0.0.1, ::1) and modified shouldBypassProxy to use this check. However, this fix was found to be incomplete.
A subsequent commit, e033f243a08e3514c03e510f76658da1e0fac3bd, provided a more comprehensive solution by significantly enhancing the loopback detection logic. It introduced more robust helper functions, isIPv4Loopback and isIPv6Loopback, to correctly identify a wider range of loopback IP address formats, including the entire 127.0.0.0/8 range and various IPv6 representations. The isLoopback function was updated to use these new, more thorough checks.
Therefore, the primary vulnerable function is shouldBypassProxy, as it contained the flawed logic. The helper function isLoopback is also identified as a key part of the vulnerability and its fix, as its initial implementation was insufficient. During exploitation, a runtime profile would show calls to shouldBypassProxy when axios processes an outgoing request in an environment with a proxy configured.