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: 87
Members: 0
Total: 87
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 -> Basic SQL Injection
Post new topicReply to topic View previous topic :: View next topic
Basic SQL Injection
PostPosted: Wed Feb 25, 2009 11:08 pm Reply with quote
Cool_Man
Beginner
Beginner
Joined: Feb 26, 2009
Posts: 3




Hi

I'm trying to learn SQL injection (spent 4-5 hours). I have setup a basic

PHP+APACHE+MYSQL development area; with a user table and a basic front end using PHP.

I'm trying to do the basic SQL injection, where I'm inserting
Code:
'' or '' = ''";


inside one of the inputs. The result I'm getting is

Code:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\xampp\login.php on line 20
--- Incorrect Username or Password ---


However, I dont quite get how this is a exploit... (i know it sounds stupid)
View user's profile Send private message
PostPosted: Wed Feb 25, 2009 11:16 pm Reply with quote
slsl
Advanced user
Advanced user
Joined: Oct 14, 2008
Posts: 66




try different things what it is saying with that error is that your syntax is wrong try:

Code:

' OR 1=1--+
" OR 1=1--+

it has to do with how your statment in the code is set up if your code was


Code:

SELECT * FROM USERS WHERE password = ' . $pass .' ORDER BY DESC


you would use something like ' OR 1=1 --+

SQL injection is a common security flaw in sites where the don't sanitize user input that goes into SQL queries. This allows users to manipulate that database and the returned input in many ways, that is why I would call it an exploit.

i recommend you visit a tutorial like http://www.securiteam.com/securityreviews/5DP0N1P76E.html
View user's profile Send private message
PostPosted: Thu Feb 26, 2009 12:10 am Reply with quote
Cool_Man
Beginner
Beginner
Joined: Feb 26, 2009
Posts: 3




slsl wrote:

Code:

' OR 1=1--+



Now i got three senarios



    If i use the above for both input boxes, I login as normal

    If I use it on only one inpux box, I dont login in however get error message

    If i use normal invalid username and password, i dont login with no error message
View user's profile Send private message
PostPosted: Thu Feb 26, 2009 1:06 am Reply with quote
slsl
Advanced user
Advanced user
Joined: Oct 14, 2008
Posts: 66




that would be because how the SQL query is formed.

say the query is


Code:
SELECT * FROM users WHERE username = ' . $user . ' AND password = ' . $pass . '


when you use ' OR 1=1 --+ you are saying Grab the user from users table where username is NULL or if 1=1 grab a user. since 1=1 is always true it will grab all users in the database. if you use invalid info it is saying grab the user with that username AND that password but since it does not exist it returns NULL. Also you should know that the -- is the comment symbol in SQL so it disregards anything after the "--"

If you don't really know how SQL works and how to form statements use http://www.w3schools.com/sql/ I Would recommend that site for almost any web programming language
View user's profile Send private message
PostPosted: Fri Feb 27, 2009 11:39 pm Reply with quote
Cool_Man
Beginner
Beginner
Joined: Feb 26, 2009
Posts: 3




Thanks for the help

I have done few experiments on UNION ALL SELECT and blind injection (brute...)

Don't want to sound stupid but, is it possible to INSERT and DELETE data from the URL? because I have not managed to do it.

What I have tried

Code:
www.example.com/users.php?id=2'; DELETE FROM users WHERE 1 or username = '";


Thanks
View user's profile Send private message
PostPosted: Sat Feb 28, 2009 2:27 am Reply with quote
waraxe
Site admin
Site admin
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




In case of Mysql/Php you can't use stacked sql queries (separated by ; ). So you can manipulate with UPDATE only if there is sql injection in UPDATE query and same for INSERT and DELETE.
View user's profile Send private message Send e-mail Visit poster's website
Basic SQL Injection
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.048 Seconds