CVE-2025-50181:
urllib3 PoolManager Redirect Configuration Bypass Vulnerability
5.3
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
urllib3 | pip | < 2.5.0 | 2.5.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability CVE-2025-50181 in urllib3 (versions < 2.5.0) arises from the PoolManager
failing to disable redirects when configured to do so via its retries
parameter during instantiation. For example, PoolManager(retries=0)
or PoolManager(retries=False)
was intended to prevent any redirects, but this setting was ignored.
The root cause lies in two key methods of urllib3.poolmanager.PoolManager
:
-
urllib3.poolmanager.PoolManager.__init__
: The constructor was flawed because it did not properly process theretries
argument (when passed as an integer like0
, or asFalse
, or as aRetry
object withredirect=0
) to ensure that the internalRetry
object for thePoolManager
instance was configured to disallow redirects. The patch (commitf05b1329126d5be6de501f9d1e3e36738bc08857
) introduces specific logic in__init__
to correctly create or modify theRetry
object to set itsraise_on_redirect
attribute appropriately, thereby enforcing the no-redirect policy. -
urllib3.poolmanager.PoolManager.urlopen
: This method is responsible for making the actual HTTP request and applying the retry/redirect logic. It uses theRetry
object associated with thePoolManager
(if not overridden by a request-specificRetry
object). In vulnerable versions,urlopen
would use theRetry
object that__init__
had failed to correctly configure for disabling redirects. Consequently,urlopen
would follow redirects even when thePoolManager
was initialized with the intent to disable them.
If an application relied on disabling redirects at the PoolManager
level to mitigate risks like Server-Side Request Forgery (SSRF) or open redirects, this vulnerability would leave it exposed because the redirects would still be followed. The fix ensures that the retries
parameter in PoolManager.__init__
correctly translates to a redirect policy that urlopen
then enforces.
Vulnerable functions
urllib3.poolmanager.PoolManager.__init__
src/urllib3/poolmanager.py
urllib3.poolmanager.PoolManager.urlopen
src/urllib3/poolmanager.py