HackTheBox — Web Attacks: XXE with Blind Exfiltration Data

In my previou blog post, HackTheBox — Web Attacks: Error Based XXE to exfiltrate data, I went over the scenario in which we take advantage of web applications’ displaying error messages to exfiltrate data from the target machine. In this blog post, I will go over how we obtain information even when we neither get the output of any of the XML entities nor do we get any PHP errors displayed.
Out-Of-Band data exfiltration
The techniques used in this scenario will be using Out-of-band attacks, which makes the target communicate with our attacking machine.
First, we create an entity and save it in blind-xxe.dtd file that requests the resources we desire to obtain and host it on our attacking machine:

The entity file will request a file /etc/passwd and based-64 encode the file.
Then I write a small script, index.php,to automatically decode the strings once we get them.
<?php
if(isset($_GET['content'])){
error_log("\n\n" . base64_decode($_GET['content']));
}
?>Run the PHP server on the attacking machine
php -S 0.0.0.0:8000In Burp Suite, inject the payload like the below image

If the attack is successful, we should get the content of /etc/passwd from the target machine.

Using similar technique, we can obtain the flag from the section by modifying the request file

We keep the same payload and resend the request. We should get the flag from the specified file

HTB{1_d0n7_n33d_0u7pu7_70_3xf1l7r473_d474}






