Simple Web 0x23(Lab - XXE)

Simple Web 0x23(Lab - XXE)

tags: NTUSTWS CTF Web

Challenge: http://h4ck3r.quest:8604/

Background

  • exploit type

Source code

1
2
3
4
5
6
7
8
9
10
<?php
   $xmlfile = urldecode(file_get_contents('php://input'));
   if (!$xmlfile) die(show_source(__FILE__));

   $dom = new DOMDocument();
   $dom->loadXML($xmlfile, LIBXML_NOENT | LIBXML_DTDLOAD);
   $creds = simplexml_import_dom($dom);
   $user = $creds->user;
   echo "You have logged in as user $user";
?>

Exploit - XXE

  1. Normal Usage in this webpage