TL;DR
If direct XXE attacks are blocked, explore alternative paths like external entity resolution with local files, internal network interaction, and blind XXE techniques. Focus on identifying accessible resources and exploiting XML parsers’ features.
1. Understand the Blockage
Before trying alternatives, confirm how XXE is blocked. Common methods include:
- Input Validation: Filtering characters like <, >, and &.
- XML Parser Configuration: Disabling external entities or DTD processing.
- Web Application Firewall (WAF): Rules detecting XXE patterns.
Knowing the block will guide your next steps.
2. Local File Inclusion via External Entities
If external entity resolution is allowed for local files, you can read sensitive data:
- Craft a malicious XML payload:
- Send the payload to the application.
- Check the response: If successful, you’ll see the contents of
/etc/passwd(or another file).
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [<entity name="xxe" value="file:///etc/passwd"/>]
<root>&xxe;
Note: The exact path format may vary depending on the operating system and XML parser.
3. Internal Network Interaction
If the application server has access to an internal network, you can attempt to read files from other servers:
- Identify accessible internal resources: Use techniques like port scanning or information gathering.
- Modify the external entity definition: Point it to an internal resource.
- Send the payload and check the response.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [<entity name="xxe" value="http://internal-server/sensitive_data.txt"/>]
<root>&xxe;
Firewall rules on the internal network may prevent this.
4. Blind XXE Exploitation
If you don’t see the file contents directly, try blind XXE:
- Time-based Blind XXE: Use a delay to confirm if an entity is resolved.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [<entity name="xxe" value="file:///etc/passwd"/>]
<root>&xxe;
Blind XXE requires more patience and analysis of server responses.
5. DTD vs. External Entities
If external entities are blocked, try using a Document Type Definition (DTD) to define the entities:
- Craft a malicious XML payload with a DTD:
- Send the payload and check the response.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [<entity name="xxe" value="file:///etc/passwd"/>]
<root>&xxe;
Some parsers may block DTDs as well.
6. XML External Parameter Entity (XEP) Injection
This is a more general term for XXE, but it’s worth noting that different parsers handle XEP differently. Experiment with variations of the payload and entity definitions.
7. Consider Server-Side Request Forgery (SSRF)
XXE can sometimes be chained with SSRF if the application allows external entities to interact with internal URLs. This is a more advanced technique but can lead to significant vulnerabilities.

