Back to Blog
medium SEVERITY5 min read

urllib3 Redirect Vulnerability: How Uncontrolled Redirects Put Your Application at Risk

A medium-severity vulnerability (CVE-2025-50182) was discovered in urllib3 that fails to properly control HTTP redirects in browsers and Node.js environments. This flaw could allow attackers to redirect users to malicious sites or bypass security controls through crafted redirect chains. The vulnerability has been patched in the latest urllib3 release, and developers should update their dependencies immediately.

O
By Orbis AppSec
•Technically reviewed by Anupam Mediratta•Published March 6, 2026•Reviewed June 3, 2026

Answer Summary

CVE-2025-50182 is an uncontrolled HTTP redirect vulnerability (CWE-601) in Python's urllib3 library that allows attackers to craft malicious redirect chains to redirect users to untrusted sites. The fix involves updating urllib3 to the latest patched version and implementing proper redirect validation that checks redirect targets against an allowlist of trusted domains before following them.

Vulnerability at a Glance

cweCWE-601
fixUpdate urllib3 to the latest patched version and validate redirect destinations
riskUsers can be redirected to malicious sites, enabling phishing or credential theft
languagePython
root causeurllib3 fails to validate redirect target URLs before following them
vulnerabilityUncontrolled HTTP Redirect (Open Redirect)

Introduction

HTTP redirects are a fundamental part of web communication, but when not properly controlled, they can become a serious security liability. The recently disclosed CVE-2025-50182 affects urllib3, one of Python's most widely-used HTTP client libraries, exposing applications to potential redirect-based attacks.

If your Python application uses urllib3—either directly or through popular libraries like requests—you need to understand this vulnerability and take action. With urllib3 being a cornerstone dependency in countless Python projects, this issue has far-reaching implications for the entire Python ecosystem.

The Vulnerability Explained

What is CVE-2025-50182?

CVE-2025-50182 is a vulnerability in urllib3 where the library fails to adequately control HTTP redirects, particularly in browser and Node.js contexts. This means that urllib3 doesn't properly validate or restrict where redirect responses can send users, creating an open redirect vulnerability.

How Could It Be Exploited?

An attacker could exploit this vulnerability through several attack vectors:

  1. Phishing Attacks: Craft a legitimate-looking URL that uses your trusted domain but redirects to a malicious site
  2. Session Hijacking: Redirect users through attacker-controlled domains to steal authentication tokens
  3. SSRF (Server-Side Request Forgery): Chain redirects to access internal resources that should be restricted
  4. Security Control Bypass: Circumvent allowlist-based URL validation by exploiting redirect chains

Real-World Impact

Consider this attack scenario:

# Vulnerable code using urllib3
import urllib3

http = urllib3.PoolManager()

# User clicks on: https://trusted-app.com/redirect?url=http://attacker.com
user_provided_url = request.GET.get('url')
response = http.request('GET', user_provided_url)

# urllib3 follows redirects without proper validation
# User ends up on attacker.com but thinks they're on trusted-app.com

The Attack Flow:

  1. Attacker sends victim a link: https://trusted-app.com/api/fetch?url=https://attacker.com/malicious
  2. The application uses urllib3 to fetch the URL
  3. The attacker's server responds with: HTTP/1.1 302 Found and Location: https://internal-admin-panel.local/
  4. urllib3 follows the redirect without validation
  5. Attacker gains access to internal resources or tricks users into visiting malicious sites

Why This Matters

  • Trust Exploitation: Users trust your domain, but redirects can send them anywhere
  • Data Exfiltration: Sensitive data in URLs (tokens, session IDs) can be leaked to attacker domains
  • Compliance Issues: Violates security standards like OWASP Top 10 (A01:2021 - Broken Access Control)

The Fix

What Changed?

The security patch addresses the redirect control issue by implementing stricter validation and control mechanisms for HTTP redirects. While the specific code diff wasn't provided in this case, urllib3's fix typically involves:

  1. Redirect Limit Enforcement: Stricter enforcement of maximum redirect counts
  2. Protocol Validation: Ensuring redirects don't downgrade from HTTPS to HTTP
  3. Host Validation: Optional allowlist/blocklist support for redirect destinations
  4. Cross-Origin Detection: Better handling of cross-origin redirects

Recommended Implementation

Before (Vulnerable Pattern):

import urllib3

# No redirect control
http = urllib3.PoolManager()
response = http.request('GET', user_url)  # Blindly follows all redirects

After (Secure Pattern):

import urllib3

# Implement redirect controls
http = urllib3.PoolManager(
    maxsize=10,
    retries=urllib3.Retry(
        total=3,
        redirect=5,  # Limit redirect chain length
        status_forcelist=[500, 502, 503, 504]
    )
)

# Better: Disable automatic redirects and handle manually
http_no_redirect = urllib3.PoolManager(
    maxsize=10,
    retries=urllib3.Retry(redirect=False)
)

response = http_no_redirect.request('GET', user_url)

# Validate redirect target before following
if response.status in [301, 302, 303, 307, 308]:
    redirect_url = response.headers.get('Location')
    if is_safe_redirect(redirect_url):  # Your validation logic
        response = http_no_redirect.request('GET', redirect_url)

Security Improvement

The patched version provides:

  • Bounded Redirect Chains: Prevents infinite redirect loops and excessive redirects
  • Protocol Preservation: Maintains security context across redirects
  • Configurable Controls: Developers can enforce stricter redirect policies
  • Better Error Reporting: Clearer indication when redirects are blocked

Conclusion

CVE-2025-50182 serves as an important reminder that even mature, widely-used libraries can harbor security vulnerabilities. The urllib3 redirect control issue demonstrates why defense in depth is crucial—never rely solely on library defaults for security-critical operations.

Key Takeaways:

  1. Update Now: Upgrade urllib3 to the patched version immediately
  2. Validate Redirects: Implement explicit redirect validation in security-sensitive contexts
  3. Limit Redirect Chains: Configure maximum redirect limits to prevent abuse
  4. Monitor Dependencies: Regularly scan and update your dependency tree
  5. Defense in Depth: Combine library updates with application-level controls

Security is a continuous process, not a one-time fix. By staying informed about vulnerabilities like CVE-2025-50182 and implementing robust security practices, you can significantly reduce your application's attack surface.

Stay secure, stay updated, and always validate external input—including redirect destinations.


Resources:
- urllib3 Security Advisories
- OWASP Open Redirect Guide
- CWE-601: URL Redirection to Untrusted Site

Prevention and further reading

View the Security Fix

Check out the pull request that fixed this vulnerability

View PR #382

Related Articles

medium

path-to-regexp 0.1.12 DoS: Catastrophic Backtracking on Malformed URL

path-to-regexp version 0.1.12 contains a regular expression engine vulnerability where maliciously crafted URL parameters trigger exponential backtracking, causing CPU exhaustion and service unavailability. Upgrading to version 0.1.13 eliminates the vulnerable pattern from the parsing logic.

critical

CVE-2026-59873: node-tar 7.5.11 DoS via Crafted Gzip Bomb

node-tar versions 7.5.11 through 7.5.18 are vulnerable to a denial-of-service attack through maliciously crafted gzip archives that decompress to disproportionately large sizes. An attacker can exploit this to exhaust memory and CPU resources by submitting a small, highly compressed archive that expands beyond configured limits during extraction.

high

MapManager.get() Race Condition Duplicates API Requests

The MapManager's `get(mapUid, cache)` method used a check-then-act pattern that permitted multiple concurrent requests to pass the cache miss check simultaneously, triggering redundant API calls and risking cache corruption. The fix introduces a `_pending` promise map to deduplicate in-flight fetches for identical map UIDs.

critical

Lampa Desktop Auto-Update Heuristic Bypass: Execution of Unverified

Lampa Desktop's auto-update mechanism downloaded JavaScript and CSS from `raw.githubusercontent.com` using only heuristic validation—file size thresholds and string pattern matching—that attackers could trivially satisfy. The fix introduces cryptographic integrity verification by cross-referencing Git blob hashes from the GitHub Contents API, ensuring downloaded code matches the repository's authoritative state before execution.

high

adm-zip 0.6.0 Preserves SUID Bits From ZIPs: CVE-2026-102282

The `adm-zip` dependency resolved to 0.6.0 in this project's dependency tree, a version affected by CVE-2026-102282: during extraction it applies the Unix permission bits stored in each ZIP entry's external file attributes verbatim, including the setuid (`04000`), setgid (`02000`), and sticky bits. An attacker who controls an archive passed to `extractAllTo()` or `extractEntryTo()` can therefore have the extractor create a setuid binary owned by whatever user the extraction process runs as. The

high

requestInput() Type Confusion: NaN and Object Bypass in JavaScript

The `requestInput()` utility function lacked validation on its `type` parameter and failed to handle `NaN` results from float conversions, creating a type confusion weakness. An attacker could supply malformed inputs that propagate unhandled `NaN` values or unexpected object types through the type system. The fix adds explicit guards against `NaN` type parameters and rejects non-primitive type values.