BugTraq
Re: [KAPDA::#16] - SMF SQL Injection Dec 10 2005 11:51AM
grudge securityfocus com, simplemachines securityfocus com,org securityfocus com (1 replies)
Re: [KAPDA::#16] - SMF SQL Injection Dec 11 2005 04:42PM
ascii (ascii katamail com)
grudge (at) securityfocus (dot) com [email concealed] wrote:
> I'm a developer from over at simplemachines and
> I do not see how this can pose an exploit?

/* tabs are evil */
if (!is_numeric($_REQUEST['start'])) {

$request = db_query("SELECT COUNT(ID_MEMBER)
FROM {$db_prefix}members
WHERE LOWER(SUBSTRING(realName, 1, 1)) < '".
substr(strtolower($_REQUEST['start']), 0, 1)
."' AND is_activated = 1", __FILE__, __LINE__);

list ($_REQUEST['start']) = mysql_fetch_row($request);
mysql_free_result($request);
}

me too, this piece of code isn't exploitable

at last you can inject a ' that will issue a
php error (path disclosure, error log filling
but not an usable sql injection)

> The code is entered at this point:
> if (!is_numeric($_REQUEST['start']))

i would prefer ctype_digit or preg_match [09]
cause is_numeric accept also hex, signed and
floats

> substr(strtolower($_REQUEST['start']), 0, 1)
> I simply cannot see how you could possibly
> exploit SQL from this?

it's impossible imho, but don't relay on magic quotes
or this type of stuff, put a beautiful
mysql_real_escape_string on each string passed to the db
and cast integers (int)intval($_GET['id'])

seems KAPDA Researchers researched this 'vuln' too fast : )

ascii - http://www.ush.it

[ reply ]


 

Privacy Statement
Copyright 2010, SecurityFocus