SQL Injection
SQL Injection
Akhil S Pramod
intern@cybersapiens
SQL Injection is a security flaw in web applications where
attackers insert harmful SQL code through user inputs. This
can allow them to access sensitive data, change database
contents or even take control of the system. It’s important to
know about SQL Injection to keep web applications secure.
Simple Characters
Inserting special characters such as ’, ”, #, ;, /, and ) into
input fields can help detect SQL injection vulnerabilities. If
the application returns an error or behaves unexpectedly,
it might be vulnerable.
Logic Testing
• page.asp?id=1 or 1=1 -- true
• page.asp?id=1' or 1=1 -- true
• page.asp?id==1" or 1=1 - true
• page.asp?id=1 and 1=2 -- false
By injecting these logical statements, testers can
observe if the application responds differently to
true or false conditions, indicating a potential
SQL injection vulnerability.
Arithmetic Testing
• product.asp?id=1/1 -- true
• product.asp?id=1/abs(1) -- true
• product.asp?id=1/0 -- false
• product.asp?id=1/abf(1) -- false
is equivalent to:
Avoiding Whitespace
If the application blocks or strips whitespace from your
input, you can use comments to simulate whitespace
within your injected data. You can insert inline comments
in SQL statements, similar to C++, by embedding them
between /* and ’/.
For example, the input 0/””/or/**/J is equivalent to 0 or J
Stripped Input
Some input validation routines use a blacklist to
block or remove any supplied data that appears on
this list. In this instance, you can look for
coilnmon defects in validation and
canonicalization mechanisms.
• SeLeCt
• %00SELECT
• SELSELECTECT
• %53%45%4c%45%43%54
• %2553%2545%254c%2545%2543%2554
Impact
• Data Breach: Unauthorized access to sensitive
information such as personal details, financial
data, and business records.
• Authentication Bypass: Gaining unauthorized
access to the application by bypassing login
mechanisms.
• Loss of Data Integrity: Corruption or
compromise of data integrity, leading to
inaccurate or misleading information.
• Database Destruction: Dropping tables or databases,
leading to a loss of essential data.
• Denial of Service (DoS): Making the database
unavailable by overwhelming it with malicious
queries.
• Reputation Damage: Loss of customer trust and brand
reputation due to security breaches.
• Financial Loss: Costs associated with incident
response, data recovery, legal penalties, and
compensation to attacked parties.
Step 2 : Login
Step 3 : Try the username and password as - admin