CVE-2023-3823

Security issue with external entity loading in XML without enabling it

Published Aug 11, 2023 CVSS 3.1 · 8.6 High EPSS 1.6% KEV · Not listed
Description
In PHP versions 8.0.* before 8.0.30, 8.1.* before 8.1.22, and 8.2.* before 8.2.8 various XML functions rely on libxml global state to track configuration variables, like whether external entities are loaded. This state is assumed to be unchanged unless the user explicitly changes it by calling appropriate function. However, since the state is process-global, other modules - such as ImageMagick - may also use this library within the same process, and change that global state for their internal purposes, and leave it in a state where external entities loading is enabled. This can lead to the situation where external XML is parsed with external entities loaded, which can lead to disclosure of any local files accessible to PHP. This vulnerable state may persist in the same process across many requests, until the process is shut down.

Remediation

Vendor Workaround

Disable external entity loader, e.g. like this: libxml_set_external_entity_loader(function () { return null; });

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DLA Debian DLA DLA-3555-1 php7.3 security update
Debian DSA Debian DSA DSA-5660-1 php7.4 security update
Debian DSA Debian DSA DSA-5661-1 php8.2 security update
EUVD EUVD EUVD-2023-44451 In PHP versions 8.0.* before 8.0.30, 8.1.* before 8.1.22, and 8.2.* before 8.2.8 various XML functions rely on libxml global state to track configuration variables, like whether external entities are loaded. This state is assumed to be unchanged unless the user explicitly changes it by calling appropriate function. However, since the state is process-global, other modules - such as ImageMagick - may also use this library within the same process, and change that global state for their internal purposes, and leave it in a state where external entities loading is enabled. This can lead to the situation where external XML is parsed with external entities loaded, which can lead to disclosure of any local files accessible to PHP. This vulnerable state may persist in the same process across many requests, until the process is shut down.
Ubuntu USN Ubuntu USN USN-6305-1 PHP vulnerabilities
Ubuntu USN Ubuntu USN USN-6305-2 PHP vulnerabilities
History
Type Values Removed Values Added
Description In PHP versions 8.0.* before 8.0.30, 8.1.* before 8.1.22, and 8.2.* before 8.2.8 various XML functions rely on libxml global state to track configuration variables, like whether external entities are loaded. This state is assumed to be unchanged unless the user explicitly changes it by calling appropriate function. However, since the state is process-global, other modules - such as ImageMagick - may also use this library within the same process, and change that global state for their internal purposes, and leave it in a state where external entities loading is enabled. This can lead to the situation where external XML is parsed with external entities loaded, which can lead to disclosure of any local files accessible to PHP. This vulnerable state may persist in the same process across many requests, until the process is shut down.  In PHP versions 8.0.* before 8.0.30, 8.1.* before 8.1.22, and 8.2.* before 8.2.8 various XML functions rely on libxml global state to track configuration variables, like whether external entities are loaded. This state is assumed to be unchanged unless the user explicitly changes it by calling appropriate function. However, since the state is process-global, other modules - such as ImageMagick - may also use this library within the same process, and change that global state for their internal purposes, and leave it in a state where external entities loading is enabled. This can lead to the situation where external XML is parsed with external entities loaded, which can lead to disclosure of any local files accessible to PHP. This vulnerable state may persist in the same process across many requests, until the process is shut down.
Weaknesses

Sources

Status
PUBLISHED
Assigner
php
Published
Updated
Feb 13, 2025, 5:01 PM
Reserved
Jul 21, 2023, 4:16 PM
Status
Modified
Published
Aug 11, 2023, 6:15 AM
Modified
Jun 17, 2026, 6:14 AM
Severity
Moderate
Public date
Aug 3, 2023, 12:00 AM