Author: Janek Vind "waraxe"
Date: 25. September 2007
Location: Estonia, Tartu
Web: http://www.waraxe.us/advisory-53.html
Target software description:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.nukescripts.net/modules.php?name=Downloads&op=getit&lid=1063
NukeSentinel is anti-hacking sofware, meant to be make phpnuke CMS more secure.
As known for everyone, phpnuke is one of the most unsecurely written content
management systems in history and even now, A.D. 2007 it's not better. Instead
of rewriting phpnuke from scatch, there are huge collection of various patches,
fixes, protector systems, platinum and whatever else editions and so on and
so on. All for adding additional "security" layers around buggy, bloated and
highly unoptimized phpnuke engine.
NukeSentinel seems to be most respected and powerful "protection system" for
phpnuke and yes - it can make attacking nuke-powered website more complicated.
But as we can see from current advisory, NukeSentinel itself has security
holes and can be exploited to attack website engine below.
Vulnerabilities: Critical Sql Injection in "nsbypass.php"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So let's look at script "includes/nsbypass.php" source code:
------------>[source code]<------------
if(isset($_COOKIE['admin']) && !empty($_COOKIE['admin'])) {
$abadmin = base64_decode($_COOKIE['admin']);
$abadmin = explode(":", $abadmin);
$a_aid = "$abadmin[0]";
$a_pas = "$abadmin[1]";
}
$num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_authors
WHERE `aid`='$a_aid' AND `pwd`='$a_pas'"));
------------>[/source code]<-----------
As many times before in phpnuke insecurities history the attack comes through
base64 encoding/decoding. After base64_decode() there can be single quotes in
"$abadmin", but no variable sanitize applied! And it is easy to see sql
injection possibilities here. This can lead to stealing arbitrary information
from underlying database, inlcuding admin username and password md5 hash.
Next step can be cracking hash to reveal plaintext password or using md5 hash
directly for cookie manipulation, both leading to gain phpnuke admin privileges.
Now why it is critical sql injection IMHO?
1. "register_globals" does not matter, because attack comes from "$_COOKIES".
2. "magic_quotes" does not matter either, thanks to base64 encoding.
3. Sentinel itself will not catch attack in this case :)
4. We don't need UNION, because sql injection is located in query, dealing
with authors table. So we can attack even websites, using oldest mysql 3.x
5. We can attack even without knowing table prefix, which is great news.
And is there anything, making attack harder or unreliable? I can see only one
factor - we need to use blind sql injection method, using timing attack.
There can be possibility for faster, half-blind method too, but that's will
not work in many cases.
Now - I have written proof-of-concept exploit, which will steal admin password
md5 hash in less than 10 minutes. This exploit can be found from:
http://www.waraxe.us/forum-10.html
//-----> See ya soon and have a nice day ;) <-----//
How to fix:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Let's hope, that NukeSentinel's new version will be out soon ...
Greetings:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Greets to ToXiC, LINUX, y3dips, Sm0ke, Heintz, slimjim100, Chb
and anyone else who know me!
Greetings to Raido Kerna.
Tervitusi Torufoorumi rahvale!
Contact:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
come2waraxe@yahoo.com
Janek Vind "waraxe"
Homepage: http://www.waraxe.us/
Copyright © by Waraxe IT Security Portal All Right Reserved.
Published on: 2007-09-25 (16100 reads)
[ Go Back ]