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
    • 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-31535

CVE-2021-31535: X.org libX11 RCE Vulnerability

CVE-2021-31535 is a remote code execution vulnerability in X.org libX11 that allows attackers to execute arbitrary code through malicious color-name requests. This article covers technical details, affected versions, and mitigations.

Published: February 25, 2026

CVE-2021-31535 Overview

CVE-2021-31535 is a buffer overflow vulnerability in LookupCol.c within X.Org X through X11R7.7 and libX11 before version 1.7.1 that allows remote attackers to execute arbitrary code. The vulnerability exists in the libX11 XLookupColor request function, which is designed for server-side color lookup operations. The flaw allows a client to send color-name requests with a name longer than the maximum size permitted by the X protocol, and also longer than the maximum packet size for normal-sized packets.

When exploited, the user-controlled data exceeding the maximum size is interpreted by the X server as additional X protocol requests and executed. This can lead to catastrophic consequences, including the complete disabling of X server authorization. A notable attack scenario involves malicious terminal control sequences for color codes—if a victim encounters such sequences (for example, in a malicious file or through a compromised terminal session), the attacker may gain full control of the running graphical session.

Critical Impact

Remote attackers can achieve arbitrary code execution and potentially take complete control of graphical sessions by exploiting insufficient length checks in the XLookupColor request, allowing X protocol request injection.

Affected Products

  • X.Org libX11 (versions before 1.7.1)
  • X.Org X Window System (through X11R7.7)
  • Fedora 33

Discovery Timeline

  • May 2021 - CVE-2021-31535 assigned
  • 2021-05-27 - CVE-2021-31535 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-31535

Vulnerability Analysis

The vulnerability resides in the XLookupColor function within LookupCol.c. This function is responsible for translating color names to their RGB values by communicating with the X server. The fundamental issue is an insufficient length check that fails to properly validate the size of color-name strings before processing them.

Under normal operation, the X protocol has defined maximum sizes for request packets. However, the vulnerable code path does not enforce these limits correctly, allowing an attacker to craft oversized color-name requests that overflow the intended buffer boundaries. When the oversized data reaches the X server, the server misinterprets the excess bytes as additional valid X protocol requests.

This protocol injection capability is particularly dangerous because it allows attackers to execute arbitrary X protocol commands with the privileges of the X server. One documented exploitation technique demonstrates how this can be used to disable X server authorization entirely, effectively opening the graphical session to unauthorized access.

Root Cause

The root cause is a classic buffer overflow condition (CWE-120) stemming from insufficient bounds checking in the XLookupColor request handling code. The function fails to validate that the color-name string length conforms to protocol-mandated maximum sizes before copying the data into fixed-size buffers and transmitting it to the X server.

The lack of proper length validation means that when an oversized string is provided, the excess data overflows the expected request structure and is placed in memory locations where the X server expects to find subsequent protocol requests.

Attack Vector

The attack can be delivered remotely through the network since it exploits the X protocol communication layer. A particularly insidious attack vector involves embedding malicious terminal escape sequences in content that a victim might view:

  1. An attacker crafts terminal control sequences containing malicious color codes with oversized color names
  2. The victim opens a file or views content containing these sequences in an X terminal emulator (such as xterm)
  3. The terminal emulator processes the color escape sequences and calls XLookupColor with the malicious payload
  4. The oversized color name triggers the buffer overflow, causing the X server to interpret the overflow data as protocol requests
  5. The injected protocol requests execute, potentially disabling authorization or executing other malicious actions

The attack requires no authentication and can be triggered without explicit user interaction beyond viewing malicious content, making it particularly dangerous in multi-user environments or scenarios where users may encounter untrusted data.

Detection Methods for CVE-2021-31535

Indicators of Compromise

  • Unusual or excessively long color lookup requests in X server logs
  • Unexpected changes to X server authorization settings or access controls
  • Anomalous X protocol traffic containing oversized request packets
  • Terminal emulators processing suspicious escape sequences with abnormally long color names

Detection Strategies

  • Monitor X server logs for malformed or oversized XLookupColor requests that exceed normal protocol limits
  • Implement network-based detection rules to identify X protocol packets with abnormal sizes or structure
  • Deploy endpoint detection to identify processes making suspicious X library calls with oversized parameters
  • Audit system configurations for unauthorized modifications to X server authorization files

Monitoring Recommendations

  • Enable verbose logging on X servers in sensitive environments to capture detailed request information
  • Monitor for changes to .Xauthority files and X server access control lists
  • Implement file integrity monitoring on X server configuration files
  • Track and alert on unusual process behavior involving libX11 function calls

How to Mitigate CVE-2021-31535

Immediate Actions Required

  • Update libX11 to version 1.7.1 or later immediately on all affected systems
  • Apply vendor-specific security patches from your Linux distribution (Debian, Fedora, Gentoo, etc.)
  • Restrict X server network access using firewall rules where remote X connections are not required
  • Consider using X server access control mechanisms to limit which clients can connect

Patch Information

X.Org has released libX11 version 1.7.1 which addresses this vulnerability by implementing proper length validation in the XLookupColor request handling code. The fix ensures that color-name strings are validated against protocol-defined maximum sizes before processing.

The patch commit is available in the GitLab libX11 repository. Additional information is available in the X.Org May 2021 security announcement.

Major Linux distributions have released security updates:

  • Debian: DSA-4920 and Debian LTS announcement
  • Gentoo: GLSA 202105-16
  • Fedora: Updates available via package announcements

Workarounds

  • Disable X server network listening by starting X with the -nolisten tcp option if remote X connections are not required
  • Use SSH X forwarding with proper access controls instead of direct X network connections
  • Implement application sandboxing to limit the impact of potential exploitation
  • Consider using Wayland-based display servers as an alternative to X11 where application compatibility permits
bash
# Disable X server TCP listening (add to X startup configuration)
# For Xorg configuration file /etc/X11/xorg.conf.d/10-security.conf
Section "ServerFlags"
    Option "DisableTCP" "true"
EndSection

# Or start X with network listening disabled
startx -- -nolisten tcp

# Verify libX11 version to confirm patch status
dpkg -l libx11-6 2>/dev/null || rpm -q libX11 2>/dev/null

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechLibx11

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability2.06%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-120
  • Technical References
  • Packet Storm Injection Advisory

  • Full Disclosure May 2021 Thread

  • OpenWall OSS Security Discussion

  • GitLab Commit on libX11

  • Apache Kafka Dev Thread

  • Apache Kafka Users Thread

  • Apache Kafka Dev Notification

  • Apache Kafka Users Notification

  • Debian LTS Security Notice

  • Fedora Package Announcement

  • X.Org Archives

  • Gentoo GLSA 2021-05-16

  • NetApp Security Advisory

  • Unparalleled Blog on Xterm Use

  • Unparalleled Advisory UNPAR-2021-1

  • Debian Security Notice DSA-4920

  • OpenWall OSS Security Discussion

  • OpenWall OSS Security Discussion
  • Vendor Resources
  • X.Org May 2021 Announcement
  • Related CVEs
  • CVE-2023-43787: X.org libX11 Privilege Escalation Flaw

  • CVE-2023-43786: X.org libX11 DOS Vulnerability

  • CVE-2023-43785: X.org libX11 Information Disclosure Flaw

  • CVE-2020-14363: X.org libX11 Use-After-Free 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