Waraxe IT Security Portal
Login or Register
November 17, 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: 9144

People Online:
Visitors: 51
Members: 0
Total: 51
Full disclosure
SEC Consult SA-20241112-0 :: Multiple vulnerabilities in Siemens Energy Omnivise T3000 (CVE-2024-38876, CVE-2024-38877, CVE-2024-38878, CVE-2024-38879)
Security issue in the TX Text Control .NET Server for ASP.NET.
SEC Consult SA-20241107-0 :: Multiple Vulnerabilities in HASOMED Elefant and Elefant Software Updater
Unsafe eval() in TestRail CLI
4 vulnerabilities in ibmsecurity
32 vulnerabilities in IBM Security Verify Access
xlibre Xnest security advisory & bugfix releases
APPLE-SA-10-29-2024-1 Safari 18.1
SEC Consult SA-20241030-0 :: Query Filter Injection in Ping Identity PingIDM (formerly known as ForgeRock Identity Management) (CVE-2024-23600)
SEC Consult SA-20241023-0 :: Authenticated Remote Code Execution in Multiple Xerox printers (CVE-2024-6333)
APPLE-SA-10-28-2024-8 visionOS 2.1
APPLE-SA-10-28-2024-7 tvOS 18.1
APPLE-SA-10-28-2024-6 watchOS 11.1
APPLE-SA-10-28-2024-5 macOS Ventura 13.7.1
APPLE-SA-10-28-2024-4 macOS Sonoma 14.7.1
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 topicReply 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 topicReply 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-2024 Janek Vind "waraxe"
Page Generation: 0.034 Seconds