[41613] in bugtraq

home help back first fref pref prev next nref lref last post

Re: [KAPDA::#16] - SMF SQL Injection

daemon@ATHENA.MIT.EDU (ascii)
Mon Dec 12 19:44:43 2005

Message-ID: <439C56EE.6020000@katamail.com>
Date: Sun, 11 Dec 2005 17:42:22 +0100
From: ascii <ascii@katamail.com>
MIME-Version: 1.0
To: grudge@securityfocus.com, simplemachines@securityfocus.com,
        org@securityfocus.com, bugtraq@securityfocus.com,
        full-disclosure@lists.grok.org.uk, trueend5@yahoo.com
In-Reply-To: <20051210115126.18697.qmail@securityfocus.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

grudge@securityfocus.com 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

home help back first fref pref prev next nref lref last post