Home page logo

pen-test logo Penetration Testing mailing list archives

Re: SQL injection (or not?)
From: "Mike Klingler" <whitehatguru () gmail com>
Date: Tue, 8 Aug 2006 14:07:15 -0500

On 8/8/06, rr () neo dtcom lv <rr () neo dtcom lv> wrote:

I'm having weird situation with sql injection (I guess). Unfortunately there is
no error message displayed - blind injection, so all that I know - query is
valid or not.
The first step I take when working on a blind SQL injection is to see
if I can get it to respond with a "YES' and a "NO" query.  When I
suspect a blind sql injection I will try to alter the pages content
via the injection.

For example.  If a site will list products by number doing a search
for the query productid='1' OR '1' = '1', should return the entire
list of products.  So potentially we could have a page return will an
entire list of products instead of just one.  If I was able to get the
query productid='1' AND '1'='1' to return a page will only the one
item then I would have what I call a "YES" query.  Since the item we
are questioning ( 1=1) is true.  If you were able to get the request
productid=1' AND '1'='0' to return a page with no listing, then you
would have found the answer to a "NO" query.

Some times they will check for a query that returns no rows and send
that to a generic error page.  So at times you may only get a Yes page
and a NO/error page.  Which prevents you from being able to
distinguish between a NO and a bad query.

In the end you would have the ability to put in queries like
productid='1' AND substr(@@version,1,1) > 'g' and learn if the first
character of the version was greater than G based on if the YES page
was returned or the NO/Error page.

script.aspx?parameter=' and 'a'%2b'a'='aa
no result, aparently query is invalid, so it is not MSSQL, kind of

script.aspx?parameter=' and concat('a','a')='aa
returns page, sql query turns out to be valid, MySQL??

script.aspx?parameter=' and concat('a','a','a')='aaa
no result, so it is not MySQL

also I know that database should be MSSQL

concat is first function I found to work. Maybe it is not sql injection? What
else could it be?


Michael Klingler, CISSP
SecurityMetrics Penetration Tester

This List Sponsored by: Cenzic

Concerned about Web Application Security? Why not go with the #1 solution - Cenzic, the only one to win the Analyst's Choice Award from eWeek. As attacks through web applications continue to rise, you need to proactively protect your applications from hackers. Cenzic has the most comprehensive solutions to meet your application security penetration testing and vulnerability management needs. You have an option to go with a managed service (Cenzic ClickToSecure) or an enterprise software (Cenzic Hailstorm). Download FREE whitepaper on how a managed service can help you: http://www.cenzic.com/news_events/wpappsec.php And, now for a limited time we can do a FREE audit for you to confirm your results from other product. Contact us at request () cenzic com for details.

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]