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 theretriesargument (when passed as an integer like0, or asFalse, or as aRetryobject withredirect=0) to ensure that the internalRetryobject for thePoolManagerinstance was configured to disallow redirects. The patch (commitf05b1329126d5be6de501f9d1e3e36738bc08857) introduces specific logic in__init__to correctly create or modify theRetryobject to set itsraise_on_redirectattribute 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 theRetryobject associated with thePoolManager(if not overridden by a request-specificRetryobject). In vulnerable versions,urlopenwould use theRetryobject that__init__had failed to correctly configure for disabling redirects. Consequently,urlopenwould follow redirects even when thePoolManagerwas 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.