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-21707

CVE-2021-21707: PHP XXE Vulnerability in XML Parsing

CVE-2021-21707 is an XXE vulnerability in PHP's XML parsing functions that allows attackers to manipulate file paths through URL-encoded NUL characters. This article covers technical details, affected versions, and mitigation.

Published: February 25, 2026

CVE-2021-21707 Overview

CVE-2021-21707 is an input validation vulnerability in PHP that affects certain XML parsing functions, including simplexml_load_file(). The vulnerability arises because these functions URL-decode the filename parameter passed to them. When a filename contains a URL-encoded NUL character (%00), the function interprets this as the end of the filename string, causing it to read a different file than the user intended. This path traversal issue can lead to unintended information disclosure.

Critical Impact

Attackers can manipulate file paths using URL-encoded NUL characters to access files outside the intended directory scope, potentially exposing sensitive configuration files or application data.

Affected Products

  • PHP versions 7.3.x below 7.3.33
  • PHP versions 7.4.x below 7.4.26
  • PHP versions 8.0.x below 8.0.13
  • NetApp Clustered Data ONTAP
  • Debian Linux 10.0 and 11.0
  • Tenable.sc

Discovery Timeline

  • 2021-11-29 - CVE-2021-21707 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-21707

Vulnerability Analysis

This vulnerability stems from improper input validation in PHP's XML parsing functions. Functions such as simplexml_load_file(), which are commonly used to load and parse XML documents from files, automatically URL-decode the filename parameter before processing. This behavior becomes problematic when attackers inject URL-encoded NUL characters (%00) into the filename string.

When the NUL character is decoded, PHP's internal string handling treats it as a string terminator. This causes the function to truncate the filename at the NUL character position, effectively allowing an attacker to manipulate which file gets read. For example, a filename like /var/www/data/user.xml%00.png would be interpreted as /var/www/data/user.xml, bypassing file extension restrictions or accessing unintended files.

The vulnerability is classified under CWE-159 (Improper Handling of Invalid Use of Special Elements), reflecting the core issue of failing to properly sanitize special characters in user-controlled input.

Root Cause

The root cause lies in the URL-decoding logic applied to filename parameters before they are passed to the underlying file system operations. PHP's XML parsing functions perform this decoding step without validating or sanitizing the resulting string for NUL characters. This creates a disconnect between the user's intended filename and the actual file path resolved by the system, as NUL bytes serve as string terminators in C-based implementations.

Attack Vector

The attack vector is network-based, requiring no authentication or user interaction. An attacker can exploit this vulnerability by crafting HTTP requests or API calls that pass malicious filenames to vulnerable PHP applications. The attack requires that the target application use affected XML parsing functions with user-controllable filename inputs.

A typical exploitation scenario involves:

  1. Identifying a PHP application that accepts user input for XML file processing
  2. Injecting a filename containing URL-encoded NUL characters (e.g., target.xml%00ignored.txt)
  3. The XML parsing function URL-decodes the input and truncates at the NUL byte
  4. The application reads an unintended file, potentially exposing sensitive data

Applications that validate file extensions before passing filenames to XML functions are particularly vulnerable, as the NUL byte injection can bypass these checks while still allowing access to arbitrary files.

Detection Methods for CVE-2021-21707

Indicators of Compromise

  • HTTP request parameters or file paths containing %00 (URL-encoded NUL characters)
  • Unusual XML parsing errors in application logs indicating file path mismatches
  • Access logs showing requests with truncated or unexpected file paths
  • Error messages referencing files that don't match the requested resource

Detection Strategies

  • Monitor web application logs for URL-encoded NUL characters (%00) in file path parameters
  • Implement input validation rules to detect and block requests containing NUL bytes
  • Use web application firewalls (WAF) with rules to identify path manipulation attempts
  • Deploy runtime application security protection to detect anomalous file access patterns

Monitoring Recommendations

  • Enable verbose logging for PHP XML parsing functions in development and staging environments
  • Configure file integrity monitoring on sensitive configuration and data directories
  • Implement security information and event management (SIEM) correlation rules for NUL byte injection patterns
  • Review access logs regularly for path traversal indicators

How to Mitigate CVE-2021-21707

Immediate Actions Required

  • Upgrade PHP to version 7.3.33, 7.4.26, or 8.0.13 or later immediately
  • Audit application code for user-controllable inputs passed to XML parsing functions
  • Implement input validation to reject filenames containing NUL characters before processing
  • Review and restrict file system permissions for PHP processes

Patch Information

PHP has released patched versions that address this vulnerability. Upgrade to the following versions or later:

  • PHP 7.3.33 for the 7.3.x branch
  • PHP 7.4.26 for the 7.4.x branch
  • PHP 8.0.13 for the 8.0.x branch

For detailed information, refer to the PHP Bug Report #79971. Debian users should consult DSA-5082 and the Debian LTS Announcement. NetApp customers should review the NetApp Security Advisory. Tenable.sc users should apply updates per TNS-2022-09.

Workarounds

  • Sanitize all user input by stripping or rejecting NUL characters before passing to XML functions
  • Use basename() or similar functions to normalize file paths before processing
  • Implement allowlist validation for permitted file paths and extensions
  • Consider using realpath() to resolve canonical paths and validate against expected directories
bash
# Example: Input validation in shell scripts processing PHP files
# Strip NUL characters from filename input before processing
sanitized_filename=$(echo "$user_input" | tr -d '\0')

# Validate against allowed directory
if [[ "$sanitized_filename" != /var/www/allowed/* ]]; then
    echo "Invalid file path"
    exit 1
fi

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

  • Vulnerability Details
  • TypeXXE

  • Vendor/TechPhp

  • SeverityMEDIUM

  • CVSS Score5.3

  • EPSS Probability0.56%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityNone
  • CWE References
  • CWE-159

  • NVD-CWE-Other
  • Technical References
  • Debian LTS Announcement

  • NetApp Security Advisory

  • Debian Security Advisory DSA-5082
  • Vendor Resources
  • PHP Bug Report #79971

  • Tenable Security Notification TNS-2022-09
  • Related CVEs
  • CVE-2023-3823: PHP XXE Vulnerability via libxml State

  • CVE-2026-22427: GoTravel Path Traversal Vulnerability

  • CVE-2025-69409: PJ Coaching Theme Path Traversal Flaw

  • CVE-2025-52023: Gems CMS Information Disclosure 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