The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
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
    • 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-23437

CVE-2021-23437: Python Pillow ReDoS Vulnerability

CVE-2021-23437 is a Regular Expression Denial of Service flaw in Python Pillow affecting versions 5.2.0 through 8.3.1. The getrgb function can be exploited to cause service disruption. This article covers technical details, affected versions, impact analysis, and mitigation strategies.

Published: February 25, 2026

CVE-2021-23437 Overview

CVE-2021-23437 is a Regular Expression Denial of Service (ReDoS) vulnerability affecting Python Pillow versions 5.2.0 and before 8.3.2. The vulnerability exists in the getrgb function within the ImageColor module, which processes color specifier strings without proper length validation. An attacker can exploit this flaw by supplying specially crafted, excessively long color strings that cause catastrophic backtracking in the regular expression parser, leading to denial of service conditions.

Critical Impact

Remote attackers can cause application-level denial of service by providing maliciously crafted color specifier strings to applications using vulnerable Pillow versions, potentially exhausting CPU resources and rendering services unavailable.

Affected Products

  • Python Pillow versions 5.2.0 through 8.3.1
  • Fedora 33 (with vulnerable Pillow packages)
  • Fedora 34 (with vulnerable Pillow packages)

Discovery Timeline

  • September 3, 2021 - CVE CVE-2021-23437 published to NVD
  • November 21, 2024 - Last updated in NVD database

Technical Details for CVE-2021-23437

Vulnerability Analysis

This vulnerability is classified as a Regular Expression Denial of Service (ReDoS) attack, which occurs when specially crafted input causes regular expression evaluation to take an excessive amount of time. In Pillow's ImageColor.py module, the getrgb function parses color specifier strings to convert them into RGB tuples. Prior to the fix, there was no validation on the length of input strings passed to this function.

When an attacker supplies an extremely long color specifier string, the regular expression matching operations within getrgb can enter a state of catastrophic backtracking. This algorithmic complexity issue causes the CPU to spend exponentially more time processing longer strings, effectively freezing the application thread handling the request.

Root Cause

The root cause is the absence of input length validation in the getrgb function before processing color specifier strings. Without a maximum length check, arbitrarily long strings can be passed to the regular expression engine, triggering worst-case algorithmic behavior. The vulnerability affects the color parsing logic in src/PIL/ImageColor.py, where color strings are matched against multiple patterns to determine the color format (hex, RGB, HSL, etc.).

Attack Vector

The attack vector is network-based, requiring no authentication or user interaction. Any application that accepts user-controlled input and passes it to Pillow's getrgb function (directly or indirectly through other Pillow APIs that parse color strings) is potentially vulnerable. Common attack scenarios include:

  • Web applications that accept color parameters from users
  • Image processing services that parse color specifications from API requests
  • Any Python application using Pillow for image manipulation with user-supplied color values
python
# Security patch in src/PIL/ImageColor.py - Raise ValueError if color specifier is too long
     :param color: A color string
     :return: ``(red, green, blue[, alpha])``
     """
+    if len(color) > 100:
+        raise ValueError("color specifier is too long")
     color = color.lower()

     rgb = colormap.get(color, None)

Source: GitHub Pillow Commit

Detection Methods for CVE-2021-23437

Indicators of Compromise

  • Unusual CPU spikes in Python processes running Pillow image processing
  • Application threads becoming unresponsive during color parsing operations
  • Timeout errors in web applications handling image color parameters
  • Log entries showing excessively long color specifier strings in request parameters

Detection Strategies

  • Monitor for abnormally long string parameters being passed to image processing endpoints
  • Implement application-level logging for Pillow function calls with input length tracking
  • Deploy runtime application self-protection (RASP) to detect ReDoS attack patterns
  • Use dependency scanning tools to identify vulnerable Pillow versions in your codebase

Monitoring Recommendations

  • Set up alerting for Python process CPU utilization exceeding normal thresholds
  • Implement request timeout monitoring for endpoints that process color specifications
  • Enable verbose logging for image processing operations during security assessments
  • Regularly audit dependencies using tools like pip-audit or Snyk to identify vulnerable packages

How to Mitigate CVE-2021-23437

Immediate Actions Required

  • Upgrade Python Pillow to version 8.3.2 or later immediately
  • Audit applications to identify any usage of getrgb or color parsing functions with user input
  • Implement input validation to reject excessively long color specifier strings at the application layer
  • Consider implementing request timeouts for image processing operations as a defense-in-depth measure

Patch Information

The vulnerability was patched in Pillow version 8.3.2. The fix adds a simple length check at the beginning of the getrgb function that raises a ValueError if the color specifier string exceeds 100 characters. This prevents the regular expression engine from processing maliciously long strings.

Upgrade using pip:

bash
pip install --upgrade Pillow>=8.3.2

For detailed information, refer to the Pillow 8.3.2 Release Notes and the security fix commit.

Workarounds

  • Implement application-level input validation to limit color string length to 100 characters or less
  • Add request timeout configurations to prevent long-running operations from blocking resources
  • Use a web application firewall (WAF) rule to filter requests with excessively long color parameters
  • Consider wrapping Pillow color parsing calls in a timeout decorator as a temporary mitigation
bash
# Configuration example - Validate input length before passing to Pillow
# Add this validation in your application code before calling getrgb:
# if len(color_string) > 100:
#     raise ValueError("Color specifier too long")

# Upgrade Pillow to patched version
pip install "Pillow>=8.3.2"

# Verify installed version
pip show Pillow | grep Version

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

  • Vulnerability Details
  • TypeDOS

  • Vendor/TechPython Pillow

  • SeverityHIGH

  • CVSS Score7.5

  • EPSS Probability0.21%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-125
  • Technical References
  • Debian LTS Security Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Gentoo GLSA 2022-11-10
  • Vendor Resources
  • GitHub Pillow Commit Update

  • Pillow Release Notes 8.3.2

  • Snyk Vulnerability Database Entry
  • Related CVEs
  • CVE-2023-44271: Python Pillow DOS Vulnerability

  • CVE-2024-28219: Python Pillow Buffer Overflow Vulnerability

  • CVE-2025-48379: Python Pillow Buffer Overflow Vulnerability

  • CVE-2023-50447: Python Pillow RCE Vulnerability
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