CVE-2021-21707: Special characters break path parsing in XML functions

Published Nov 15, 2021
·
Updated

A flaw was found in PHP. A special character is breaking the path in XML function.

Reference: https://bugs.php.net/bug.php?id=79971

Upstream patch: https://github.com/php/php-src/commit/f15f8fc573eb38c3c73e23e0930063a6f6409ed4

Other sources

Fixed bug (special character is breaking the path in xml function). (CVE-2021-21707)

— PHP

In PHP versions 7.3.x below 7.3.33, 7.4.x below 7.4.26 and 8.0.x below 8.0.13, certain XML parsing functions, like simplexmlloadfile(), URL-decode the filename passed to them. If that filename contains URL-encoded NUL character, this may cause the function to interpret this as the end of the filename, thus interpreting the filename differently from what the user intended, which may lead it to reading a different file than intended.

— Launchpad

Special characters break path parsing in XML functions

— Microsoft

Affected Software

28 affected componentsFixes available
PHP PHP<8.0.13
8.0.13
PHP PHP>=7.3.0<7.3.33
PHP PHP>=7.4.0<7.4.26
PHP PHP>=8.0.0<8.0.13
NetApp Clustered Data ONTAP
Debian Debian Linux=10.0
Debian Debian Linux=11.0
Tenable Tenable.Sc<5.21.0
Microsoft cbl2 php
alpine/php7<7.3.33-r0
7.3.33-r0
alpine/php7<7.4.26-r0
7.4.26-r0
alpine/php7<7.4.26-r0
7.4.26-r0
alpine/php7<7.4.26-r0
7.4.26-r0
alpine/php8<8.0.13-r0
8.0.13-r0
alpine/php8<8.0.13-r0
8.0.13-r0
alpine/php8<8.0.13-r0
8.0.13-r0
alpine/php8<8.0.13-r0
8.0.13-r0
alpine/php81<8.1.0-r0
8.1.0-r0
alpine/php81<8.1.0-r0
8.1.0-r0
alpine/php81<8.1.0-r0
8.1.0-r0
alpine/php81<8.1.0-r0
8.1.0-r0
redhat/php-8.1.0 php<7.3.33
7.3.33
debian/php7.4<7.4.28-1+deb11u1
7.4.28-1+deb11u1
debian/php7.0
debian/php7.3
7.3.31-1~deb10u2
debian/php7.4
7.4.28-1+deb11u17.4.26-1
debian/php8.0
debian/php8.1
8.1.0-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 8.0.13
  2. Upgrade

    Upgrade alpine/php7 to a version that resolves this vulnerability.

    Fixed in 7.3.33-r0
  3. Upgrade

    Upgrade alpine/php7 to a version that resolves this vulnerability.

    Fixed in 7.4.26-r0
  4. Upgrade

    Upgrade alpine/php8 to a version that resolves this vulnerability.

    Fixed in 8.0.13-r0
  5. Upgrade

    Upgrade alpine/php81 to a version that resolves this vulnerability.

    Fixed in 8.1.0-r0
  6. Upgrade

    Upgrade redhat/php-8.1.0 php to a version that resolves this vulnerability.

    Fixed in 7.3.33
  7. Upgrade

    Upgrade debian/php7.4 to a version that resolves this vulnerability.

    Fixed in 7.4.28-1+deb11u1
  8. Upgrade

    Upgrade debian/php7.3 to a version that resolves this vulnerability.

    Fixed in 7.3.31-1~deb10u2
  9. Upgrade

    Upgrade debian/php7.4 to a version that resolves this vulnerability.

    Fixed in 7.4.28-1+deb11u1Fixed in 7.4.26-1
  10. Upgrade

    Upgrade debian/php8.1 to a version that resolves this vulnerability.

    Fixed in 8.1.0-1
  11. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 7.3.33
  12. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 7.4.26

Event History

Nov 15, 2021
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness
Nov 18, 2021
Data Sourced
via PHP·12:00 AM
DescriptionAffected Software
Updated
12:00 AM
DescriptionAffected Software
Updated
12:00 AM
Affected Software
Nov 23, 2021
Data Sourced
via Red Hat·05:09 PM
DescriptionSeverityAffected Software
Nov 25, 2021
Data Sourced
12:00 AM
DescriptionAffected Software
Updated
12:00 AM
DescriptionAffected Software
Nov 29, 2021
Data Sourced
12:00 AM
RemedySeverity
Data Sourced
via Ubuntu·12:00 AM
RemedyDescriptionSeverityAffected Software
Updated
via Ubuntu·12:00 AM
DescriptionAffected Software
CVE Published
via MITRE·06:25 AM
Data Sourced
via OSV·07:15 AM
DescriptionSeverityAffected Software
Feb 16, 2023
Data Sourced
03:07 AM
Weakness
Data Sourced
via NVD·03:07 AM
RemedyDescriptionSeverityWeaknessAffected Software
Updated
03:07 AM
Affected Software
Nov 21, 2024
Updated
via NVD·05:48 AM
RemedyAffected Software
Sep 8, 2025
Exploit Published
via GitHub·10:19 AM
Oct 1, 2025
Data Sourced
via Microsoft·11:11 PM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·11:11 PM
Affected Software
Jun 17, 2026
Updated
via NVD·03:36 AM
Affected Software
Nov 24, 2026
Withdrawn
via OSV·04:29 AM

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is the vulnerability ID for this bug?

The vulnerability ID for this bug is CVE-2021-21707.

2

What is the severity level of CVE-2021-21707?

The severity level of CVE-2021-21707 is medium with a severity value of 5.3.

3

Which versions of PHP are affected by CVE-2021-21707?

PHP versions 7.3.x below 7.3.33, 7.4.x below 7.4.26, and 8.0.x below 8.0.13 are affected by CVE-2021-21707.

4

How does CVE-2021-21707 impact the affected software?

CVE-2021-21707 can cause certain XML parsing functions in PHP to interpret an URL-encoded NUL character as the end of the filename, potentially leading to file path manipulation.

5

Where can I find more information about CVE-2021-21707?

More information about CVE-2021-21707 can be found at the following references: [Mitre](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-21707), [Ubuntu Security Notices - USN-5300-1](https://ubuntu.com/security/notices/USN-5300-1), [Ubuntu Security Notices - USN-5300-2](https://ubuntu.com/security/notices/USN-5300-2).

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203