Re: SQLInjecting DB2

From: Frederic Charpentier (fcharpen_at_xmcopartners.com)
Date: 02/18/05

  • Next message: Noel Rosenberg: "Re: Cryptocard database"
    Date: Fri, 18 Feb 2005 17:35:49 +0100
    To: Andres Molinetti <andymolinetti@hotmail.com>
    
    

    hi,

    have you tried a such request :
    ?param=' union select 1 from SYSCAT.COLUMNS;

    maybe you can retrieve better error messages .

    also, sometimes the error message becomes more explicit with a request
    like : "?param=aaaaaaaaaaaaa'aaa'aaaaaaaaa' OR 1=1 --" instead of
    "?param='--". I don't know why, maybe it's due to sql buffer.

    I saw you work on websphere, maybe you can have a look to the last
    advisories (jsp source code disclosure with unicode in the url) :

    http://www-1.ibm.com/support/docview.wss?uid=swg24008814

    Fred.

    Andres Molinetti wrote:
    > Hi, I'm currently testing a Websphere/DB2 Web Application of one of our
    > clients.
    > I've found that it is vulnerable to SQL Injection.
    > I 've also discovered that there is a table named SYSTABLES with a NAME
    > column in it.
    >
    > Using the "GROUP by 1--" trick I've discovered two columns in the table
    > over which the query is being executed.
    > After doing "GROUP by A, B--", I get no more errors, so I asume that
    > only these two columns are taking part on the query..(is that ok?)
    >
    > Column A is probaby CLOB or VARCHAR and B probably and INTEGER. (any
    > whay to confirm this?)
    >
    > I can say this because I've tried this query: ' AND A=CLOB('A')--
    > and it returns no error
    > when this one: ' AND A=BIGINT(132123)--
    > returns error on type comparison
    >
    > So then I proceeded to do a: ' UNION ALL SELECT 1 FROM SYSTABLES--
    > Then I get "Error 500: java.sql.SQLException: [SQL0415] Operandos UNION
    > no compatibles."
    >
    > I suppose that the column types are different.
    >
    > Anyway, I submit this query: ' UNION ALL SELECT 1,1 FROM SYSTABLES--
    > Then I get "Error 500: java.sql.SQLException: [SQL0421] Número de
    > operandos UNION no igual."
    > Meaning that the number of columns are not equal...
    >
    > Here are my questions:
    > 1). Is there any way to get the "original" table name (the one where
    > the original query executes)?
    > 2). I've done a script that checks for different column numbers and it
    > have already tested with about 200 columns, and it keep saying that
    > number of operands is not equal. What could be happening?
    >
    > Any ideas would be greatly appreciated!!
    >
    > Thanks, Andy
    >
    > _________________________________________________________________
    > Un amor, una aventura, compañía para un viaje. Regístrate gratis en MSN
    > Amor & Amistad. http://match.msn.es/match/mt.cfm?pg=channel&tcid=162349
    >
    >

    -- 
    _______________________________________
    Frederic Charpentier - Xmco Partners
    Security Consulting / Pentest
    web  : http://www.xmcopartners.com
    

  • Next message: Noel Rosenberg: "Re: Cryptocard database"

    Relevant Pages

    • Re: unable to connect to internet on remote computer
      ... ping request could not find host www.yahoo.co.uk. ... 'internet explorer could not open the search page' ... Report success / exact text of error messages. ...
      (microsoft.public.windowsxp.network_web)
    • Re: Web Service timeout
      ... I tried out a 2k client box, ... System.Net.WebException: The underlying connection was closed: An unexpected ... I also don't understand why I get differing error messages from XP ...
      (microsoft.public.dotnet.framework.webservices)
    • Re: (repost) problem with 840374
      ... Select the "Contact Microsoft" link and a new web page will load. ... Support Options and Pricing" link for phone number ... If you'd like to submit a support request over the Internet, ... There were no error messages ...
      (microsoft.public.windowsupdate)
    • Re: Back button not working after move to windows 2003 server
      ... With friendly error messages turned off, ... this does not look like a problem with IIS but some other ... either of the network or the web application on the server. ... > 2003 definitely handles that like any other HTTP request. ...
      (microsoft.public.inetserver.iis)
    • Problems browsing web sites
      ... >We are having some problems browsing some web sites. ... get error messages ... >your system administrator. ... Made http request for GET ...
      (microsoft.public.isa)