Cyber Security News

PHP XXE Injection Vulnerability Allows Attackers to Access Config Files & Private Keys

A newly uncovered XML External Entity (XXE) injection vulnerability in PHP has demonstrated how attackers can bypass multiple security mechanisms to access sensitive configuration files and private keys.

The vulnerability, detailed by web application security researcher Aleksandr Zhurnakov, highlights the risks posed by improper XML parsing configurations, even in seemingly secure implementations.

The exploit leverages a combination of PHP’s libxml extension and its wrappers, enabling attackers to bypass restrictions such as LIBXML_NONET, LIBXML_DTDLOAD, and other flags.

These flags are designed to prevent loading external entities or accessing external resources, but the research reveals how they can be circumvented using advanced payloads and techniques.

Bypassing Security Flags and Filters

The vulnerability arises from the way PHP handles XML parsing via the DOMDocument class. By default, external entity loading is disabled, but certain flags like LIBXML_DTDLOAD allow attackers to load malicious DTD files.

These files can then be crafted to exfiltrate data such as /etc/passwd or private keys by exploiting PHP wrappers like php://filter.

One of the critical bypasses involves replacing http:// URLs with alternative wrappers such as php://filter/resource=, effectively sidestepping the LIBXML_NONET restriction.

PHP XXE InjectionPHP XXE Injection
inbound HTTP request

Additionally, by abusing parameter entities (%name;), attackers can inject malicious content into the XML structure before security checks are applied.

Further complicating matters, the research demonstrates how payloads can be compressed using filters like zlib.deflate and encoded in base64 to reduce their size, allowing them to fit within common server constraints for GET parameters or query strings.

According to PT Swarm Report, this approach also facilitates exfiltration via DNS subdomains when outbound TCP connections are blocked on the server.

Real-World Implications and CVE Assignment

The vulnerability has already been observed in specific applications.

For instance, an XXE flaw in SimpleSAMLphp (CVE-2024-52596) allowed unauthenticated users to read configuration files, extract private keys, and forge authentication assertions.

working xxe payload

This effectively enabled attackers to bypass authentication mechanisms entirely when SimpleSAMLphp was configured as an Identity Provider.

Zhurnakov’s research underscores the importance of secure XML parsing practices in PHP applications.

Developers are advised to disable all unnecessary libxml flags (LIBXML_DTDLOAD, LIBXML_NOENT, etc.) and ensure that the latest PHP versions with enhanced XXE protections (such as LIBXML_NO_XXE introduced in PHP 8.4) are deployed.

This vulnerability serves as a stark reminder of how complex attack vectors can emerge from seemingly minor misconfigurations, emphasizing the need for rigorous testing and secure coding practices in web application development.

Are you from SOC/DFIR Teams? – Analyse Malware Incidents & get live Access with ANY.RUN -> Start Now for Free. 

Aman Mishra

Aman Mishra is a Security and privacy Reporter covering various data breach, cyber crime, malware, & vulnerability.

Recent Posts

Threat Actors Use Fake DocuSign Notifications to Steal Corporate Data

DocuSign has emerged as a cornerstone for over 1.6 million customers worldwide, including 95% of…

4 hours ago

Government Calls on Organizations to Adopt SIEM and SOAR Solutions

In a landmark initiative, international cybersecurity agencies have released a comprehensive series of publications to…

4 hours ago

WordPress TI WooCommerce Wishlist Plugin Flaw Puts Over 100,000 Websites at Risk of Cyberattack

A severe security flaw has been identified in the TI WooCommerce Wishlist plugin, a widely…

5 hours ago

Microsoft Alerts on Void Blizzard Hackers Targeting Telecommunications and IT Sectors

Microsoft Threat Intelligence Center (MSTIC) has issued a critical warning about a cluster of global…

5 hours ago

Hackers Use Fake OneNote Login to Capture Office365 and Outlook Credentials

A recent investigation by security analysts has uncovered a persistent phishing campaign targeting Italian and…

5 hours ago

Hackers Exploit Craft CMS Vulnerability to Inject Cryptocurrency Miner Malware

Threat actors have exploited a critical Remote Code Execution (RCE) vulnerability, identified as CVE-2025-32432, in…

5 hours ago