Waraxe IT Security Portal
Login or Register
November 22, 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: 53
Members: 0
Total: 53
Full disclosure
APPLE-SA-11-19-2024-5 macOS Sequoia 15.1.1
Local Privilege Escalations in needrestart
APPLE-SA-11-19-2024-4 iOS 17.7.2 and iPadOS 17.7.2
APPLE-SA-11-19-2024-3 iOS 18.1.1 and iPadOS 18.1.1
APPLE-SA-11-19-2024-2 visionOS 2.1.1
APPLE-SA-11-19-2024-1 Safari 18.1.1
Reflected XSS - fronsetiav1.1
XXE OOB - fronsetiav1.1
St. Poelten UAS | Path Traversal in Korenix JetPort 5601
St. Poelten UAS | Multiple Stored Cross-Site Scripting in SEH utnserver Pro
Apple web content filter bypass allows unrestricted access to blocked content (macOS/iOS/iPadOS/visionO S/watchOS)
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
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.065 Seconds