Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2021-32052

CVE-2021-32052: Django URLValidator XSS Vulnerability

CVE-2021-32052 is an XSS vulnerability in Django URLValidator that allows header injection through newlines and tabs. This article covers the technical details, affected Django versions, security impact, and mitigation.

Published: February 25, 2026

CVE-2021-32052 Overview

CVE-2021-32052 is an HTTP Response Splitting vulnerability affecting Django web framework versions 2.2 before 2.2.22, 3.1 before 3.1.10, and 3.2 before 3.2.2 when used with Python 3.9.5 or later. The vulnerability exists in the URLValidator class which fails to prohibit newlines and tabs in URL values. When applications use URL values containing newline characters in HTTP responses, attackers can inject malicious HTTP headers, potentially leading to cross-site scripting attacks or cache poisoning.

Critical Impact

Applications using Django's URLValidator with unsanitized URL values in HTTP responses may be vulnerable to header injection attacks, enabling cross-site scripting (XSS) or response manipulation. Django's core HttpResponse class is unaffected as it already prohibits newlines in HTTP headers.

Affected Products

  • Django 2.2.x versions before 2.2.22
  • Django 3.1.x versions before 3.1.10
  • Django 3.2.x versions before 3.2.2
  • Python 3.9.5 and later (when used with affected Django versions)
  • Fedora 34 (bundled Django packages)

Discovery Timeline

  • 2021-05-06 - CVE-2021-32052 published to NVD
  • 2021-05-06 - Django Project releases security patches (versions 2.2.22, 3.1.10, 3.2.2)
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-32052

Vulnerability Analysis

This vulnerability is classified under CWE-79 (Improper Neutralization of Input During Web Page Generation), though it primarily manifests as an HTTP Response Splitting issue. The root problem lies in Django's URLValidator class which validates URLs but does not reject URLs containing newline (\n, \r) or tab (\t) characters. When Python 3.9.5 introduced stricter URL parsing, certain behaviors changed that exposed this weakness in Django's validation logic.

The vulnerability requires specific conditions to be exploitable: an application must accept user-controlled URL values validated through URLValidator (outside of URLField form fields which have additional protections) and subsequently include those values in HTTP response headers or body without additional sanitization.

Root Cause

The vulnerability stems from insufficient input validation in Django's URLValidator class. While the validator checks for proper URL structure and protocol schemes, it does not strip or reject control characters like carriage returns (\r), line feeds (\n), and tabs (\t). These characters are significant in HTTP protocol as they can terminate headers and start new ones, enabling header injection.

The URLField form field is not affected because it performs additional sanitization. However, developers using URLValidator directly or storing validated URLs without using URLField may inadvertently create vulnerable code paths. Django's HttpResponse class provides built-in protection by rejecting newlines in headers, but this doesn't protect all use cases such as redirects using user-supplied URLs or custom response generation.

Attack Vector

The attack requires network access and user interaction. An attacker crafts a malicious URL containing encoded newline characters. When this URL passes through Django's URLValidator and is subsequently used in an HTTP response context, the injected characters can split the HTTP response. This enables various attacks including injecting arbitrary HTTP headers for XSS payloads, setting malicious cookies, or manipulating caching behavior.

For example, an attacker could submit a URL like https://example.com%0d%0aSet-Cookie:%20malicious=value which, when improperly handled, could inject a Set-Cookie header into the response.

Detection Methods for CVE-2021-32052

Indicators of Compromise

  • HTTP response logs showing unexpected header values or malformed responses
  • Application logs containing URLs with URL-encoded newline sequences (%0d%0a, %0a, %0d)
  • Evidence of cross-site scripting attacks originating from header injection
  • Cache servers returning unexpected content for legitimate URLs

Detection Strategies

  • Review application code for direct usage of URLValidator outside of form fields
  • Scan web server access logs for URL parameters containing encoded newline characters (%0d, %0a, %0D, %0A)
  • Implement web application firewall (WAF) rules to detect and block CRLF injection attempts
  • Audit Django applications for custom response handling that includes user-supplied URLs

Monitoring Recommendations

  • Configure log analysis to alert on URLs containing CRLF sequences in request parameters
  • Monitor for anomalous HTTP response sizes or unexpected headers in reverse proxy logs
  • Implement runtime application self-protection (RASP) to detect header injection attempts
  • Set up alerts for Django applications running vulnerable version ranges

How to Mitigate CVE-2021-32052

Immediate Actions Required

  • Upgrade Django to patched versions: 2.2.22+, 3.1.10+, or 3.2.2+ immediately
  • Audit all code paths using URLValidator directly for potential exposure
  • Implement input sanitization to strip newlines and tabs from URL values before use
  • Review and restrict URL-based redirects to prevent open redirect exploitation

Patch Information

Django released security patches on May 6, 2021, addressing this vulnerability. The fix ensures that URLValidator properly rejects URLs containing newline and tab characters. Organizations should upgrade to Django 2.2.22, 3.1.10, or 3.2.2 (or later versions). Detailed information is available in the Django Security Release Documentation and the Django Weblog Security Release Update. Fedora users should update their packages as noted in the Fedora Package Announcement.

Workarounds

  • Use URLField form fields instead of URLValidator directly where possible, as they include additional sanitization
  • Implement custom validation to strip or reject newline and tab characters before URL processing
  • Configure web application firewalls to block requests containing CRLF sequences in URL parameters
  • Ensure HTTP responses use Django's HttpResponse class which already blocks newlines in headers
bash
# Upgrade Django to patched version
pip install --upgrade 'Django>=3.2.2'

# Verify installed version
python -c "import django; print(django.VERSION)"

# For requirements.txt, update the Django version constraint
# Django>=3.2.2

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechDjangoproject Django

  • SeverityMEDIUM

  • CVSS Score6.1

  • EPSS Probability2.57%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityLow
  • AvailabilityNone
  • CWE References
  • CWE-79
  • Technical References
  • Django Announcements Google Group

  • Fedora Package Announcement Mailing List

  • NetApp Security Advisory NTAP-20210611-0002
  • Vendor Resources
  • Openwall OSS Security Mailing List

  • Django Security Release Documentation

  • Django Weblog Security Release Update
  • Related CVEs
  • CVE-2026-25673: Djangoproject Django DoS Vulnerability

  • CVE-2026-1312: Djangoproject Django SQLi Vulnerability

  • CVE-2026-1207: Django SQLi Vulnerability in RasterField

  • CVE-2025-13473: Django Auth Bypass Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English