Thursday, May 8, 2025
Homecyber securityPHP XXE Injection Vulnerability Allows Attackers to Access Config Files & Private...

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

Published on

SIEM as a Service

Follow Us on Google News

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.

- Advertisement - Google News

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

PHP XXE Injection
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
Aman Mishra is a Security and privacy Reporter covering various data breach, cyber crime, malware, & vulnerability.

Latest articles

Critical Vulnerability in Ubiquiti UniFi Protect Camera Allows Remote Code Execution by Attackers

Critical security vulnerabilities in Ubiquiti’s UniFi Protect surveillance ecosystem-one rated the maximum severity score...

IXON VPN Client Vulnerability Allows Privilege Escalation for Attackers

A critical security vulnerability in IXON’s widely used VPN client has exposed Windows, Linux,...

Cisco IOS Software SISF Vulnerability Could Enable Attackers to Launch DoS Attacks

Cisco has released security updates addressing a critical vulnerability in the Switch Integrated Security...

Seamless AI Communication: Microsoft Azure Adopts Google’s A2A Protocol

Microsoft has announced its support for the Agent2Agent (A2A) protocol, an open standard developed...

Resilience at Scale

Why Application Security is Non-Negotiable

The resilience of your digital infrastructure directly impacts your ability to scale. And yet, application security remains a critical weak link for most organizations.

Application Security is no longer just a defensive play—it’s the cornerstone of cyber resilience and sustainable growth. In this webinar, Karthik Krishnamoorthy (CTO of Indusface) and Phani Deepak Akella (VP of Marketing – Indusface), will share how AI-powered application security can help organizations build resilience by

Discussion points


Protecting at internet scale using AI and behavioral-based DDoS & bot mitigation.
Autonomously discovering external assets and remediating vulnerabilities within 72 hours, enabling secure, confident scaling.
Ensuring 100% application availability through platforms architected for failure resilience.
Eliminating silos with real-time correlation between attack surface and active threats for rapid, accurate mitigation

More like this

Critical Vulnerability in Ubiquiti UniFi Protect Camera Allows Remote Code Execution by Attackers

Critical security vulnerabilities in Ubiquiti’s UniFi Protect surveillance ecosystem-one rated the maximum severity score...

IXON VPN Client Vulnerability Allows Privilege Escalation for Attackers

A critical security vulnerability in IXON’s widely used VPN client has exposed Windows, Linux,...

Cisco IOS Software SISF Vulnerability Could Enable Attackers to Launch DoS Attacks

Cisco has released security updates addressing a critical vulnerability in the Switch Integrated Security...