Waraxe IT Security Portal
Login or Register
June 17, 2025
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: 82
Members: 0
Total: 82
Full disclosure
SEC Consult SA-20250604-0 :: Local Privilege Escalation and Default Credentials in INDAMED - MEDICAL OFFICE (Medical practice management) Demo version
Full Disclosure: CVE-2025-31200 & CVE-2025-31201 – 0-Click iMessage Chain ? Secure Enclave Key Theft, Wormable RCE, Crypto Theft
Defense in depth -- the Microsoft way (part 89): user grouppolicies don't deserve tamper protection
CVE-2025-45542: Time-Based Blind SQL Injection in CloudClassroom PHP Project v1.0
ERPNext v15.53.1 Stored XSS in bio Field Allows Arbitrary Script Execution in Profile Page
ERPNext v15.53.1 Stored XSS in user_image Field Allows Script Execution via Injected Image Path
Local information disclosure in apport and systemd-coredump
Stored XSS via File Upload - adaptcmsv3.0.3
IDOR "Change Password" Functionality - adaptcmsv3.0.3
Stored XSS "Send Message" Functionality - adaptcmsv3.0.3
Authenticated File Upload to RCE - adaptcmsv3.0.3
Stored XSS in "Description" Functionality - cubecartv6.5.9
Multiple Vulnerabilities in SAP GuiXT Scripting
CVE-2024-47081: Netrc credential leak in PSF requests library
Exploit CVE-2019-9978: Remote Code Execution in Social Warfare WordPress Plugin (<= 3.5.2)
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



PCWizardHub - Helping you fix, build, and optimize your PC life
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.030 Seconds