Waraxe IT Security Portal  
  Login or Register
::  Home  ::  Search  ::  Your Account  ::  Forums  ::   Waraxe Advisories  ::  Tools  ::
May 5, 2024
Menu
 Home
 Logout
 Discussions
 Forums
 Members List
 IRC chat
 Tools
 Base64 coder
 MD5 hash
 CRC32 checksum
 ROT13 coder
 SHA-1 hash
 URL-decoder
 Sql Char Encoder
 Affiliates
 y3dips ITsec
 Md5 Cracker
 User Manuals
 AlbumNow
 Content
 Content
 Sections
 FAQ
 Top
 Info
 Feedback
 Recommend Us
 Search
 Journal
 Your Account



User Info
Welcome, Anonymous
Nickname
Password
(Register)

Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9145

People Online:
Visitors: 531
Members: 0
Total: 531
PacketStorm News
·301 Moved Permanently

read more...
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> Sql injection -> Interesting SQL Injection case
Post new topic  Reply to topic View previous topic :: View next topic 
Interesting SQL Injection case
PostPosted: Tue Sep 18, 2007 4:19 pm Reply with quote
pabloski
Beginner
Beginner
 
Joined: Sep 14, 2007
Posts: 3




Hi to all, I'm new to this forum and I'm new to SQL Injection, too.

I'm studying SQL Injection and I have selected as target the famous ( mmm not so famous after all Very Happy ) blogging platform dBlog ( http://www.dblog.it if someone is interested )

Ok, I was thinking to bypass the login form, I have studied some papers and cheat sheets and it seems feasible. The blog platform in question is written in VbScript and uses Jet database ( .mdb ) as storage.

That said, I'm studying this piece of code

Code:

            FUserID = Request.Form("UserID")
   FPassword = Request.Form("Password")

   If FUserID <> "" AND FPassword <> "" Then
      SQLAutori = " SELECT [Nick], [UserID], [Password], [Admin] FROM [Autori] WHERE [UserID] = '"& ControlloSQLInjection(FUserID) &"' "
      Set RSAutori = Server.CreateObject("ADODB.Recordset")
      RSAutori.Open SQLAutori, Conn, 1, 3

      If NOT RSAutori.EOF Then
         RSAutori.MoveFirst
         If RSAutori("Password") = getSHAPassword(FPassword) Then
            Session("BLOGNick") = RSAutori("Nick")
            Session.TimeOut = 60
            If RSAutori("Admin") = True Then
               Session("BLOGAdmin") = True
            Else
               Session("BLOGAdmin") = False
            End If


the login form accepts two fields, Password and UserID, then the script verifies they are not empty and execute a query against UserID.....finally it uses the recordset obtained to verify if SHA1(Password) == stored password hash

the function ControlloSQLInjection is an anti-SQL injection measure....it replaces the following characters

[ --> [[ & Chr(0)
] --> []]
[[ & Chr(0) --> [[]
' --> ''
% --> [%]
_ --> [_]
# --> [#]

as you can see the problem is the substitution ' -- ''

I have red something about UTF7 and encodings used to bypass this kind of filters, but frankly I haven't understood the whole point at all Embarassed

so how can I insert a SQL statement if I can't use ' to pass ascii strings to the script?
View user's profile Send private message
PostPosted: Tue Sep 18, 2007 5:40 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Most of the real world ASP/VBscript website scripts are secured against sql injection by using substitution " '-->'' "or just removing single quote. So if you can find universal "way in", then you can do lot's of damage. So what I think is, that this kind of single quote sanitize is actually effective anti-hacking measure and can't be evaded in most cases.
Still - programmers can be lazy or just stupid and trust integer parameters, using them in sql clause WITHOUT single quotes. In this case you can just walk in ...
About UTF-methods - i have tried some tricks against php/mysql and php/postgresql platforms and they can work in rare cases. But against most targets it will not help (my personal opinion though ... ).
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Tue Sep 18, 2007 7:04 pm Reply with quote
pabloski
Beginner
Beginner
 
Joined: Sep 14, 2007
Posts: 3




thanks for the reply

as regards dBlog I have found some weak spots in the comment posting script, there are 3 queries that don't sanitize the input, I'll search here for some injection point to steal admin password Cool
View user's profile Send private message
PostPosted: Wed Sep 19, 2007 1:24 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Well, after you pointed out this software, I have done some research and found out something else than sql injection - it appears, that database file is exposed to web and can be downloaded directly. Success rate is ~ 20%, in most cases IIS webserver will refuse to serve mdb files. Still, there are hundreds websites, offering their database to anyone Smile

So i wrote little advisory about this case:

http://www.waraxe.us/advisory-52.html

And here is proof-of-concept screenshot:

http://www.hot.ee/http123/dblog_example.png


Wink
View user's profile Send private message Send e-mail Visit poster's website
Interesting SQL Injection case
  www.waraxe.us Forum Index -> Sql injection
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Post new topic  Reply to topic  




Powered by phpBB © 2001-2008 phpBB Group






Space Raider game for Android, free download - Space Raider gameplay video - Zone Raider mobile games
All logos and trademarks in this site are property of their respective owner. The comments and posts are property of their posters, all the rest (c) 2004-2020 Janek Vind "waraxe"
Page Generation: 0.166 Seconds