SlideShare a Scribd company logo
1 of 53
Download to read offline
sqlmap - security
development in
    Miroslav Štampar
Who are we?
 Bernardo Damele A. G. (@inquisb)
     Security Consultant / White-hat hacker
     NGS Secure
     London / UK
     Lots of conference talks
 Miroslav Stampar (@stamparm)
     Professional software developer
     AVL Croatia
     Zagreb / Croatia
     First conference talk

EuroPython 2011, Florence (Italy)        June 23, 2011   2
What is sqlmap?
 “sqlmap is an open source penetration testing
  tool that automates the process of detecting
  and exploiting SQL injection flaws and taking
  over of database server(s)”
 AIO (All-In-One) SQL injection tool
 Over 10k updates and/or downloads monthly
 Part of popular security distros: Backtrack,
  Backbox, Web Security Dojo, OWASP Web
  Testing,...



EuroPython 2011, Florence (Italy)   June 23, 2011   3
Short history
 Daniele Bellucci (@belch) – July 25th of 2006 –
  birthday of sqlmap
 September 2006 – Daniele leaves the project,
  Bernardo takes it over
 December 2009 – Miroslav replies to the call for
  developers




EuroPython 2011, Florence (Italy)     June 23, 2011   4
Current status (v1.0-dev)
 Powerful detection engine
 State of the art enumeration engine
 Takeover functionalities (Metasploit,...)
 Support for IDS/WAF evasion in form of
  “tampering” scripts
 Numerous optimizations
 Remote file manipulation
 Brute force methods



EuroPython 2011, Florence (Italy)      June 23, 2011   5
Short future
 GUI
 Professional reporting (XML, PDF,...)
 Out-of-Band (OOB) advanced techniques
 Support for few DBMSes left
 Generic lexical SQL parser
 Advanced IDS/WAF evasion techniques
 Upgrade to Python 3




EuroPython 2011, Florence (Italy)   June 23, 2011   6
Project statistics (ohloh.net)
 Languages used



 LOC (Lines of code)




EuroPython 2011, Florence (Italy)   June 23, 2011   7
Features
 Fully supported backend DBMSes (and
  growing): MySQL, Oracle, PostgreSQL, Microsoft
  SQL Server, Microsoft Access, SQLite, Firebird,
  Sybase and SAP MaxDB
 Fully supported SQL injection techniques:
  Blind, Error, Union (partial & full), Timed,
  Stacked
 Enumeration of: database users, users'
  password hashes, users' privileges, users'
  roles, databases, tables and columns


EuroPython 2011, Florence (Italy)    June 23, 2011   8
Features (2)
 Recognition and cracking of password hashes
 Web server file upload/download
 Arbitrary command execution and retrieval of
  standard output
 Establishment of an out-of-band TCP/UDP
  connection between the attacker's machine
  and the database server




EuroPython 2011, Florence (Italy)   June 23, 2011   9
Community
 Huge pool of pen/beta-testers active at our
  mailing list (this moment 200 subscribed)
 White/Grey/Black hat hackers
 They all provide indispensable help by:
     Reporting problems/bugs from real-life scenarios
     Feature requests
     Keeping morale high
     Modest donations (covering SVN server costs)




EuroPython 2011, Florence (Italy)        June 23, 2011   10
SQL injection for dummies
 Vulnerable code (PHP/PgSQL):
    $query = "SELECT * FROM products WHERE
    product_id=" . $_GET['id']
 Attack vector:
    http://www.store.com/store.php?id=7; DROP TABLE
    users
 Resulting SQL statements:
    SELECT * FROM products WHERE product_id=7; DROP
    TABLE users




EuroPython 2011, Florence (Italy)      June 23, 2011   11
Well known attacks
 In period 2005 till 2007 Albert Gonzalez has
  stolen 130 million credit card numbers
 June 2007 – Microsoft U.K. Website defaced
 December 2009 – RockYou (32 million
  credentials stolen)
 December 2009 – NASA
 July 2010 – The Pirate Bay




EuroPython 2011, Florence (Italy)    June 23, 2011   12
Well known attacks (2)
 February 2011 – HBGary
 March 2011 – MySQL (vulnerable page has
  been:
    http://mysql.com/customers/view/index.html?id=1170
 March & May 2011 – Comodo (certificate
  reseller)
 May 2011... – PBS, Sony (#sownage – 20 sites
  and counting), Fox, Infragard, Nintendo, CNN...




EuroPython 2011, Florence (Italy)          June 23, 2011   13
Lizamoon (mass injection)
 “LizaMoon mass injection hits over 226,000 URLs” -
  Websense Security Labs (29th Mar 2011)
 “The world was rocked today by LizaMoon - a SQL
  injection attack which has compromised well over
  one million Websites” – PCWorld (2nd Apr 2011)




EuroPython 2011, Florence (Italy)      June 23, 2011   14
Random Quote




      “Structured Query Language is becoming the
              Achilles heel of the Internet.”




EuroPython 2011, Florence (Italy)     June 23, 2011   15
“Exploits of a Mom” (XKCD #327)




EuroPython 2011, Florence (Italy)   June 23, 2011   16
Funny Sweds
 The following lines were in Swedish election votes (swe.
  VALJ = engl. voting):
  ;13;Hallands län;80;Halmstad;01;Halmstads
  västra valkrets;0904;Söndrum 4;pwn DROP TABLE
  VALJ;1
 “At least 'pwn DROP TABLE VALJ' got 1 vote in the
  Swedish election” (comment on reddit :)




EuroPython 2011, Florence (Italy)           June 23, 2011   17
Форум АНТИЧАТ - SQL Инъекции
 “Awkward” Russian underground (open) forum
 No chat, only vulnerable targets
 Around 14 thousand targets (and growing)
  available to anyone




EuroPython 2011, Florence (Italy)   June 23, 2011   18
Blind-based technique
 Also known as “boolean” based and/or “1=1”
 4 out of 5 vulnerable cases are affected
 Slow – 1 request per 1 bit of information
 Very demanding and sensitive for
  implementation (detection part)
 Differentiation approach (difflib.quick_ratio())
  or “exact” approach (e.g. “You are logged in” in
  page)
 Greatest obstacle is “dinamicity”
 Multi-threading is most welcome

EuroPython 2011, Florence (Italy)     June 23, 2011   19
Blind-based technique (2)
 Original



 “True”



 “False”




EuroPython 2011, Florence (Italy)   June 23, 2011   20
Error-based technique
 1 out of 4 vulnerable cases are affected
 Deliberate provoking of “invalid SQL query”
  and retrieval of information from response
  messages
 Fast – 1 request per item of information
 Easy detection and implementation
 Greatest obstacle is trimming of error
  messages (“substringing”)
 Too DBMS specific
 Advice: Turn off the error/debug messages!

EuroPython 2011, Florence (Italy)    June 23, 2011   21
Error-based technique (2)
 Example:




EuroPython 2011, Florence (Italy)   June 23, 2011   22
Union query technique
 Also known as “inband”
 1 out of 2 vulnerable cases are affected
 Fast(est) – 1 request per (multiple) item of
  information
 Partial vs Full union
 Greatest obstacle is speed of detection part
 Easy for implementation, at least for usage
  part




EuroPython 2011, Florence (Italy)    June 23, 2011   23
Union query technique (2)
 Example 1 (partial):




 Example 2 (full):




EuroPython 2011, Florence (Italy)   June 23, 2011   24
Time delay-based technique
 Pretty much the same as blind-based
 Among slowest – 1 request per 1 bit of
  information
 Expect every second response to be delayed
 Very demanding and sensitive for
  implementation
 Greatest obstacle is “lagging”
 Single threading is a must for stable data
  retrieval


EuroPython 2011, Florence (Italy)   June 23, 2011   25
Time delay-based technique (2)
 Example (delayed by 5 seconds):




 Resulting SQL statement:
  SELECT * FROM users WHERE id=1 AND 1=
    (SELECT 1 FROM PG_SLEEP(5))--




EuroPython 2011, Florence (Italy)   June 23, 2011   26
Stacked query technique
 Pretty much identical to the time-based
 Around 1 out of 2 DBMSes supports it
 Deadly (Lizamoon)
 MsSQL is most affected
 Non-query based commands (INSERT,
  DELETE,...)




EuroPython 2011, Florence (Italy)    June 23, 2011   27
Stacked query technique (2)
 Example (delayed by 5 seconds)




EuroPython 2011, Florence (Italy)   June 23, 2011   28
Basic working examples
 Blind-based: ...id=1 AND ASCII(SUBSTR((SELECT
    password FROM public.users OFFSET 0 LIMIT
    1)::text,1,1)) > 64--
 Error-based: ...id=1 AND 6561=CAST(':abc:'||
    (SELECT password FROM public.users OFFSET 0
    LIMIT 1)::text||':def:' AS NUMERIC)--
 Union query: ...id=1 UNION ALL SELECT NULL,
    NULL,':abc:'||password||':def:'||':ghi:'||
    password||':jkl:'||':mno:'||id||':pqr:' FROM
    public.users--




EuroPython 2011, Florence (Italy)      June 23, 2011   29
Basic working examples (2)
 Time-delay based: id=1 AND 1924=(CASE WHEN
    (ASCII(SUBSTR((SELECT password FROM
    public.users OFFSET 0 LIMIT 1)::text,1,1)) >
    64) THEN (SELECT 1924 FROM PG_SLEEP(1)) ELSE
    1924 END)--
 Stacked query: id=1; SELECT(CASE WHEN
    (ASCII(SUBSTR((SELECT password FROM
    public.users OFFSET 0 LIMIT 1)::text,1,1)) >
    64) THEN (SELECT 1924 FROM PG_SLEEP(1)) ELSE
    1924 END);--




EuroPython 2011, Florence (Italy)      June 23, 2011   30
Program's structure
 doc – manual, THANKS,...
 lib – core modules
 extra – 3rd party modules (chardet,
  clientform,...)
 plugins – DBMS specific modules
 shell – stagers and backdoors (php, jsp,
  asp,...)
 tamper – tampering scripts (ifnull2ifisnull,...)
 txt – wordlist, user-agents,...
 xml – queries, payloads,...

EuroPython 2011, Florence (Italy)       June 23, 2011   31
Program's workflow

            Setup        Detection   Fingerprinting   Enumeration    Takeover




         Configuration   Boolean        MySQL         Databases      Web shell

          Knowledge
                           Error        MsSQL           Tables      Metasploit
            base

           Session        Union         PgSQL          Columns        ICMPsh


         Connection       Timed         Oracle          Users       File access


           Payloads      Stacked      MsAccess        Passwords      Registry


           Queries                         ...            ...           ...


             ...
EuroPython 2011, Florence (Italy)                                   June 23, 2011   32
Development environment
 Subversion (version control)
 Redmine (project management)
 Python 2.6 and/or 2.7
 Text editor of choice (TC/Notepad++ on
  Windows, Krusader/KrViewer on Linux)
 Debugger of choice (pdb)
 Proxy MITM tool (Burp)
 Web browser of choice (Firefox)



EuroPython 2011, Florence (Italy)   June 23, 2011   33
Testing environment
 VMWare virtual machines
 Linux Debian 5.0 32-bit (most used one)
     Apache/PHP
          MySQL, Oracle, PgSQL, Firebird, SQLite
 Windows XP 32-bit
     XAMPP/PHP
          MySQL, SAP MaxDB, Sybase, SQLite, Access, etc.
     IIS/ASP(.NET)
          MsSQL, MySQL, etc.




EuroPython 2011, Florence (Italy)              June 23, 2011   34
Inference (binary search)
 O(Log2n) complexity
 Can be used in boolean, timed and stacked
 e.g.:
     Initial table      ['A','B',...'Z']
     AND (...)          > 'M' → (True) → ['N',...'Z']
     AND (...)          > 'S' → (False) → ['N',...'S']
     AND (...)          > 'O' → (True) → ['P', 'R', 'S']
     AND (...)          > 'R' → (False) → ['P', 'R']
     AND (...)          > 'P' → (False) → ['P'] (resulting
      char)

EuroPython 2011, Florence (Italy)                 June 23, 2011   35
Character prediction
 High probability of prefix reuse
 Common DBMS identificator names
 Dynamic “prediction” tree
 Example:
     Input: CREATE SYNONYM, CREATE TABLE,
      CREATE TRIGGER, CREATE USER, CREATE VIEW
     Output tree: [C][R][E][A][T][E][S|T|U|V]
 Appropriate for blind/time/stacked techniques




EuroPython 2011, Florence (Italy)    June 23, 2011   36
“Null-connection”
 Special HTTP requests (Web server specific)
 Example (Apache):
     Request: Range: bytes=-1
     Response: Content-range: bytes 74-74/75 (True)
     Response: Content-range: bytes 126-126/127
      (False)
 Example (IIS):
     Request: HEAD
     Response: Content-Length: 75 (True)
     Response: Content-Length: 127 (False)


EuroPython 2011, Florence (Italy)       June 23, 2011   37
Dinamicity removal
 Biggest obstacle of blind/boolean technique
 Javascript, ads, banners,...
 Differentiation approach (difflib)
 “Static blocks” vs “Dynamic blocks” (gaps)
 Regular expressions to the rescue
 Example:
     </p></table>dynamic part<iframe><ul>
     r“</p></table>.*?<iframe><ul>”




EuroPython 2011, Florence (Italy)    June 23, 2011   38
Reflective values
 Copy of payload (encoded?) inside response
 Causing problems for blind/boolean technique
 Source of lots of false positives/negatives (in
  other tools :)
 Regular expressions to the rescue
 Example:
     ?id=1 AND 2>1
     ?id=1%20AND%202%3e1
     r“(?i)id[^n<]+1[^n<]+AND[^n<]+2[^n<]
      +1”

EuroPython 2011, Florence (Italy)     June 23, 2011   39
Statistics is our friend
 Normal distribution (bell curve)




 “It shows how much variation or 'dispersion'
  there is from the average (mean, or expected
  value)”
 99.9999999997440% of “normal” data inside 7σ
EuroPython 2011, Florence (Italy)    June 23, 2011   40
Statistics is our friend (2)
 UNION injection detection:
     id=1 UNION ALL SELECT NULL, NULL,...
     Right number of columns should stick out
 Time-delay injection detection/usage:
     id=1 AND 1=SELECT 1 FROM PG_SLEEP(5))--
     Response time should stick out
 Stacked-query injection detection/usage:
     id=1; SELECT 1 FROM PG_SLEEP(5))--
     Response time should stick out



EuroPython 2011, Florence (Italy)      June 23, 2011   41
False positives
 Boolean, timed and stacked affected
 Example: search engine queries
 Simple arithmetic tests
 Searching for mere signs of “intelligence”
 Example:
     1+2==3
     4==5
     2==(7-5)
     (6+5)==(6-5)



EuroPython 2011, Florence (Italy)     June 23, 2011   42
Heuristic test
 “Blatant” logic used for detection
 Insufficient but great one shot test
 Parameter “poisoning” with invalid (SQL) chars
 Example:
     ?id=1''))(“(''(
 Error message parsing and DBMS recognition




EuroPython 2011, Florence (Italy)    June 23, 2011   43
Tampering scripts
 IDS/WAF applications are getting better
 Need for anti-anti hacking techniques
 Example:
     'UNION SELECT' → 'UnIOn SeleCT'
     'A>B' → 'A NOT BETWEEN 0 AND B'
     'SELECT password' → 'SELECT/**/password'
 Input: payload Output: ftamper(payload)
 Order of appearance & prioritized
 14 till now and counting
 Automation in near future

EuroPython 2011, Florence (Italy)     June 23, 2011   44
“Pivoting”
 Dumping technique
 When lacking LIMIT/OFFSET mechanism
 Around 1 in 2 DBMSes affected (e.g. MsSQL)
 Count number of DISTINCT values
 Choose column with highest number as “pivot”
 Pivoting:
     SELECT MIN(pivotCol) … WHERE pivotCol >
      <previous_pivot_value>
     SELECT otherCol … WHERE pivotCol =
      <current_pivot_value>

EuroPython 2011, Florence (Italy)   June 23, 2011   45
“SQL harvesting”
 Google is our friend
     filetype:sql "CREATE TABLE"
     filetype:sql "INSERT INTO"
 Extraction of table and column names
 Decision based on frequency
 Gathered data used by (brute force switches):
     --common-tables
          ...AND EXISTS(SELECT * FROM table)
     --common-columns
          ...AND EXISTS(SELECT column FROM table)


EuroPython 2011, Florence (Italy)        June 23, 2011   46
Hash cracking
 Implemented DBMS specific hash functions
 10 and counting (mysql_passwd,
  mysql_old_passwd, mssql_passwd, ...)
 Regular expression based recognition
 High-quality (10MB) dictionary/wordlist
 Automatic brute-force approach
 Blazing fast (core routines from hashlib)




EuroPython 2011, Florence (Italy)   June 23, 2011   47
Quality tests
 --live-test
     All relevant tests for 4 major DBMSes
     Batch-like workflow
     Declared in a structured XML file
     Run against testing VMs
 --smoke-test
     Recursively finds all modules
     Tries importing every single one of them
     Runs doctests if explicitly written
 ./extra/shutils/pylint.py


EuroPython 2011, Florence (Italy)        June 23, 2011   48
Best “self-protection” advice




     ...you can get from a dude that makes this all
     anti WAF/IDS, statistics, pivoting, dynamicity,
     reflective values and similar mambo-jambo...




EuroPython 2011, Florence (Italy)       June 23, 2011   49
Parametrized SQL statements
 Don't sanitize your database inputs yourself
  (prone to errors!)
 Use language/library specific parametrized SQL
  statements
 Functions/libraries automatically sanitize
  provided parameters
 Good reference: http://bobby-tables.com/




EuroPython 2011, Florence (Italy)   June 23, 2011   50
Parametrized SQL statements (2)
 Example (Python DB API):
     Don't:
          cmd = "UPDATE people SET name='%s' WHERE
           id='%s'" % (name, id)
          cursor.execute(cmd)
     Instead:
          cursor.execute('UPDATE people SET name=:1
           WHERE id=:2', [name, id])




EuroPython 2011, Florence (Italy)        June 23, 2011   51
Questions?




EuroPython 2011, Florence (Italy)   June 23, 2011   52
Join the project
 Project's web page:
    http://sqlmap.sourceforge.net/
 Contact:
    dev@sqlmap.org
 Users list:
    sqlmap-users@lists.sourceforge.net
 Twitter:
    @sqlmap
 Repository:
    https://svn.sqlmap.org/sqlmap/trunk/sqlmap

EuroPython 2011, Florence (Italy)        June 23, 2011   53

More Related Content

What's hot

Got database access? Own the network!
Got database access? Own the network!Got database access? Own the network!
Got database access? Own the network!Bernardo Damele A. G.
 
Heuristic methods used in sqlmap
Heuristic methods used in sqlmapHeuristic methods used in sqlmap
Heuristic methods used in sqlmapMiroslav Stampar
 
Sql injection with sqlmap
Sql injection with sqlmapSql injection with sqlmap
Sql injection with sqlmapHerman Duarte
 
SQL INJECTION
SQL INJECTIONSQL INJECTION
SQL INJECTIONMentorcs
 
Ppt on sql injection
Ppt on sql injectionPpt on sql injection
Ppt on sql injectionashish20012
 
Types of sql injection attacks
Types of sql injection attacksTypes of sql injection attacks
Types of sql injection attacksRespa Peter
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySandip Chaudhari
 
Data Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection AttacksData Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection AttacksMiroslav Stampar
 
Advanced Sql Injection ENG
Advanced Sql Injection ENGAdvanced Sql Injection ENG
Advanced Sql Injection ENGDmitry Evteev
 
DNS exfiltration using sqlmap
DNS exfiltration using sqlmapDNS exfiltration using sqlmap
DNS exfiltration using sqlmapMiroslav Stampar
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassCODE WHITE GmbH
 
SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012
SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012
SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012Scott Sutherland
 
Sql Injection attacks and prevention
Sql Injection attacks and preventionSql Injection attacks and prevention
Sql Injection attacks and preventionhelloanand
 
SQL injection prevention techniques
SQL injection prevention techniquesSQL injection prevention techniques
SQL injection prevention techniquesSongchaiDuangpan
 

What's hot (20)

Got database access? Own the network!
Got database access? Own the network!Got database access? Own the network!
Got database access? Own the network!
 
Heuristic methods used in sqlmap
Heuristic methods used in sqlmapHeuristic methods used in sqlmap
Heuristic methods used in sqlmap
 
Sql injection with sqlmap
Sql injection with sqlmapSql injection with sqlmap
Sql injection with sqlmap
 
Sql injection
Sql injectionSql injection
Sql injection
 
SQL INJECTION
SQL INJECTIONSQL INJECTION
SQL INJECTION
 
Ppt on sql injection
Ppt on sql injectionPpt on sql injection
Ppt on sql injection
 
Types of sql injection attacks
Types of sql injection attacksTypes of sql injection attacks
Types of sql injection attacks
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and Security
 
Sql injection attack
Sql injection attackSql injection attack
Sql injection attack
 
Data Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection AttacksData Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection Attacks
 
Advanced Sql Injection ENG
Advanced Sql Injection ENGAdvanced Sql Injection ENG
Advanced Sql Injection ENG
 
DNS exfiltration using sqlmap
DNS exfiltration using sqlmapDNS exfiltration using sqlmap
DNS exfiltration using sqlmap
 
Sql Injection 0wning Enterprise
Sql Injection 0wning EnterpriseSql Injection 0wning Enterprise
Sql Injection 0wning Enterprise
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug Class
 
SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012
SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012
SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012
 
Sql Injection attacks and prevention
Sql Injection attacks and preventionSql Injection attacks and prevention
Sql Injection attacks and prevention
 
Sql injection
Sql injectionSql injection
Sql injection
 
Sql injection
Sql injectionSql injection
Sql injection
 
SQL Injection
SQL InjectionSQL Injection
SQL Injection
 
SQL injection prevention techniques
SQL injection prevention techniquesSQL injection prevention techniques
SQL injection prevention techniques
 

Similar to sqlmap - security development in Python

Open comrtos formally_developed _rtos_for_heterogeneous_systems
Open comrtos formally_developed _rtos_for_heterogeneous_systemsOpen comrtos formally_developed _rtos_for_heterogeneous_systems
Open comrtos formally_developed _rtos_for_heterogeneous_systemsEric Verhulst
 
Mining Software Repositories
Mining Software RepositoriesMining Software Repositories
Mining Software RepositoriesIsrael Herraiz
 
Tarantool 1.6 talk at SECR 2014 conference
Tarantool 1.6 talk at SECR 2014 conferenceTarantool 1.6 talk at SECR 2014 conference
Tarantool 1.6 talk at SECR 2014 conferenceKostja Osipov
 
A client-side vulnerability under the microscope!
A client-side vulnerability under the microscope!A client-side vulnerability under the microscope!
A client-side vulnerability under the microscope!Nelson Brito
 
Leveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case Study
Leveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case StudyLeveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case Study
Leveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case StudyLuca Berardinelli
 
Ingredients for Semantic Sensor Networks
Ingredients for Semantic Sensor NetworksIngredients for Semantic Sensor Networks
Ingredients for Semantic Sensor NetworksOscar Corcho
 
Scc2012 Scala
Scc2012 ScalaScc2012 Scala
Scc2012 Scalasteccami
 
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...Laurent Lefort
 
XML Prague 2005 EXSLT
XML Prague 2005 EXSLTXML Prague 2005 EXSLT
XML Prague 2005 EXSLTjimfuller2009
 
jEQN a java-based language for the distributed simulation of queueing networks
jEQN a java-based language for the distributed simulation of queueing networksjEQN a java-based language for the distributed simulation of queueing networks
jEQN a java-based language for the distributed simulation of queueing networksDaniele Gianni
 
Entity Framework V1 and V2
Entity Framework V1 and V2Entity Framework V1 and V2
Entity Framework V1 and V2ukdpe
 
Would you Rather Have Telemetry into 2 Attacks or 20? An Insight Into Highly ...
Would you Rather Have Telemetry into 2 Attacks or 20? An Insight Into Highly ...Would you Rather Have Telemetry into 2 Attacks or 20? An Insight Into Highly ...
Would you Rather Have Telemetry into 2 Attacks or 20? An Insight Into Highly ...MITRE ATT&CK
 
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It Poses
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It PosesEnterprise Java: Just What Is It and the Risks, Threats, and Exposures It Poses
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It PosesAlex Senkevitch
 
Erlang
ErlangErlang
ErlangESUG
 
Brains, Data, and Machine Intelligence (2014 04 14 London Meetup)
Brains, Data, and Machine Intelligence (2014 04 14 London Meetup)Brains, Data, and Machine Intelligence (2014 04 14 London Meetup)
Brains, Data, and Machine Intelligence (2014 04 14 London Meetup)Numenta
 
The top 10 web application intrusion techniques
The top 10 web application intrusion techniquesThe top 10 web application intrusion techniques
The top 10 web application intrusion techniquesAntonio Fontes
 
Microkernels and Beyond
Microkernels and BeyondMicrokernels and Beyond
Microkernels and BeyondDavid Evans
 

Similar to sqlmap - security development in Python (20)

Open comrtos formally_developed _rtos_for_heterogeneous_systems
Open comrtos formally_developed _rtos_for_heterogeneous_systemsOpen comrtos formally_developed _rtos_for_heterogeneous_systems
Open comrtos formally_developed _rtos_for_heterogeneous_systems
 
Mining Software Repositories
Mining Software RepositoriesMining Software Repositories
Mining Software Repositories
 
Tarantool 1.6 talk at SECR 2014 conference
Tarantool 1.6 talk at SECR 2014 conferenceTarantool 1.6 talk at SECR 2014 conference
Tarantool 1.6 talk at SECR 2014 conference
 
A client-side vulnerability under the microscope!
A client-side vulnerability under the microscope!A client-side vulnerability under the microscope!
A client-side vulnerability under the microscope!
 
WoT @ Oracle-Labs
WoT @ Oracle-LabsWoT @ Oracle-Labs
WoT @ Oracle-Labs
 
Leveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case Study
Leveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case StudyLeveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case Study
Leveraging Model-Driven Technologies for JSON Artefacts: The Shipyard Case Study
 
Ingredients for Semantic Sensor Networks
Ingredients for Semantic Sensor NetworksIngredients for Semantic Sensor Networks
Ingredients for Semantic Sensor Networks
 
Scc2012 Scala
Scc2012 ScalaScc2012 Scala
Scc2012 Scala
 
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...
 
XML Prague 2005 EXSLT
XML Prague 2005 EXSLTXML Prague 2005 EXSLT
XML Prague 2005 EXSLT
 
jEQN a java-based language for the distributed simulation of queueing networks
jEQN a java-based language for the distributed simulation of queueing networksjEQN a java-based language for the distributed simulation of queueing networks
jEQN a java-based language for the distributed simulation of queueing networks
 
Entity Framework V1 and V2
Entity Framework V1 and V2Entity Framework V1 and V2
Entity Framework V1 and V2
 
Would you Rather Have Telemetry into 2 Attacks or 20? An Insight Into Highly ...
Would you Rather Have Telemetry into 2 Attacks or 20? An Insight Into Highly ...Would you Rather Have Telemetry into 2 Attacks or 20? An Insight Into Highly ...
Would you Rather Have Telemetry into 2 Attacks or 20? An Insight Into Highly ...
 
DhevendranResume
DhevendranResumeDhevendranResume
DhevendranResume
 
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It Poses
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It PosesEnterprise Java: Just What Is It and the Risks, Threats, and Exposures It Poses
Enterprise Java: Just What Is It and the Risks, Threats, and Exposures It Poses
 
Erlang
ErlangErlang
Erlang
 
Brains, Data, and Machine Intelligence (2014 04 14 London Meetup)
Brains, Data, and Machine Intelligence (2014 04 14 London Meetup)Brains, Data, and Machine Intelligence (2014 04 14 London Meetup)
Brains, Data, and Machine Intelligence (2014 04 14 London Meetup)
 
The top 10 web application intrusion techniques
The top 10 web application intrusion techniquesThe top 10 web application intrusion techniques
The top 10 web application intrusion techniques
 
Microkernels and Beyond
Microkernels and BeyondMicrokernels and Beyond
Microkernels and Beyond
 
Userland Hooking in Windows
Userland Hooking in WindowsUserland Hooking in Windows
Userland Hooking in Windows
 

More from Miroslav Stampar

sqlmap - "One Tiny Step At a Time"
sqlmap - "One Tiny Step At a Time"sqlmap - "One Tiny Step At a Time"
sqlmap - "One Tiny Step At a Time"Miroslav Stampar
 
Why everybody should do CTF / Wargames?
Why everybody should do CTF / Wargames?Why everybody should do CTF / Wargames?
Why everybody should do CTF / Wargames?Miroslav Stampar
 
Improving Network Intrusion Detection with Traffic Denoise
Improving Network Intrusion Detection with Traffic DenoiseImproving Network Intrusion Detection with Traffic Denoise
Improving Network Intrusion Detection with Traffic DenoiseMiroslav Stampar
 
APT Attacks on Critical Infrastructure
APT Attacks on Critical InfrastructureAPT Attacks on Critical Infrastructure
APT Attacks on Critical InfrastructureMiroslav Stampar
 
WARNING: Do Not Feed the Bears
WARNING: Do Not Feed the BearsWARNING: Do Not Feed the Bears
WARNING: Do Not Feed the BearsMiroslav Stampar
 
Non-Esoteric XSS Tips & Tricks
Non-Esoteric XSS Tips & TricksNon-Esoteric XSS Tips & Tricks
Non-Esoteric XSS Tips & TricksMiroslav Stampar
 
2014 – Year of Broken Name Generator(s)
2014 – Year of Broken Name Generator(s)2014 – Year of Broken Name Generator(s)
2014 – Year of Broken Name Generator(s)Miroslav Stampar
 
Riding the Overflow - Then and Now
Riding the Overflow - Then and NowRiding the Overflow - Then and Now
Riding the Overflow - Then and NowMiroslav Stampar
 
Riding the Overflow - Then and Now
Riding the Overflow - Then and NowRiding the Overflow - Then and Now
Riding the Overflow - Then and NowMiroslav Stampar
 
Spot the Web Vulnerability
Spot the Web VulnerabilitySpot the Web Vulnerability
Spot the Web VulnerabilityMiroslav Stampar
 
Analysis of mass SQL injection attacks
Analysis of mass SQL injection attacksAnalysis of mass SQL injection attacks
Analysis of mass SQL injection attacksMiroslav Stampar
 

More from Miroslav Stampar (16)

sqlmap - "One Tiny Step At a Time"
sqlmap - "One Tiny Step At a Time"sqlmap - "One Tiny Step At a Time"
sqlmap - "One Tiny Step At a Time"
 
Blind WAF identification
Blind WAF identificationBlind WAF identification
Blind WAF identification
 
sqlmap internals
sqlmap internalssqlmap internals
sqlmap internals
 
Why everybody should do CTF / Wargames?
Why everybody should do CTF / Wargames?Why everybody should do CTF / Wargames?
Why everybody should do CTF / Wargames?
 
Improving Network Intrusion Detection with Traffic Denoise
Improving Network Intrusion Detection with Traffic DenoiseImproving Network Intrusion Detection with Traffic Denoise
Improving Network Intrusion Detection with Traffic Denoise
 
APT Attacks on Critical Infrastructure
APT Attacks on Critical InfrastructureAPT Attacks on Critical Infrastructure
APT Attacks on Critical Infrastructure
 
WARNING: Do Not Feed the Bears
WARNING: Do Not Feed the BearsWARNING: Do Not Feed the Bears
WARNING: Do Not Feed the Bears
 
Non-Esoteric XSS Tips & Tricks
Non-Esoteric XSS Tips & TricksNon-Esoteric XSS Tips & Tricks
Non-Esoteric XSS Tips & Tricks
 
2014 – Year of Broken Name Generator(s)
2014 – Year of Broken Name Generator(s)2014 – Year of Broken Name Generator(s)
2014 – Year of Broken Name Generator(s)
 
Smashing the Buffer
Smashing the BufferSmashing the Buffer
Smashing the Buffer
 
Riding the Overflow - Then and Now
Riding the Overflow - Then and NowRiding the Overflow - Then and Now
Riding the Overflow - Then and Now
 
Riding the Overflow - Then and Now
Riding the Overflow - Then and NowRiding the Overflow - Then and Now
Riding the Overflow - Then and Now
 
Hash DoS Attack
Hash DoS AttackHash DoS Attack
Hash DoS Attack
 
Curious Case of SQLi
Curious Case of SQLiCurious Case of SQLi
Curious Case of SQLi
 
Spot the Web Vulnerability
Spot the Web VulnerabilitySpot the Web Vulnerability
Spot the Web Vulnerability
 
Analysis of mass SQL injection attacks
Analysis of mass SQL injection attacksAnalysis of mass SQL injection attacks
Analysis of mass SQL injection attacks
 

Recently uploaded

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Recently uploaded (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

sqlmap - security development in Python

  • 1. sqlmap - security development in Miroslav Štampar
  • 2. Who are we?  Bernardo Damele A. G. (@inquisb) Security Consultant / White-hat hacker NGS Secure London / UK Lots of conference talks  Miroslav Stampar (@stamparm) Professional software developer AVL Croatia Zagreb / Croatia First conference talk EuroPython 2011, Florence (Italy) June 23, 2011 2
  • 3. What is sqlmap?  “sqlmap is an open source penetration testing tool that automates the process of detecting and exploiting SQL injection flaws and taking over of database server(s)”  AIO (All-In-One) SQL injection tool  Over 10k updates and/or downloads monthly  Part of popular security distros: Backtrack, Backbox, Web Security Dojo, OWASP Web Testing,... EuroPython 2011, Florence (Italy) June 23, 2011 3
  • 4. Short history  Daniele Bellucci (@belch) – July 25th of 2006 – birthday of sqlmap  September 2006 – Daniele leaves the project, Bernardo takes it over  December 2009 – Miroslav replies to the call for developers EuroPython 2011, Florence (Italy) June 23, 2011 4
  • 5. Current status (v1.0-dev)  Powerful detection engine  State of the art enumeration engine  Takeover functionalities (Metasploit,...)  Support for IDS/WAF evasion in form of “tampering” scripts  Numerous optimizations  Remote file manipulation  Brute force methods EuroPython 2011, Florence (Italy) June 23, 2011 5
  • 6. Short future  GUI  Professional reporting (XML, PDF,...)  Out-of-Band (OOB) advanced techniques  Support for few DBMSes left  Generic lexical SQL parser  Advanced IDS/WAF evasion techniques  Upgrade to Python 3 EuroPython 2011, Florence (Italy) June 23, 2011 6
  • 7. Project statistics (ohloh.net)  Languages used  LOC (Lines of code) EuroPython 2011, Florence (Italy) June 23, 2011 7
  • 8. Features  Fully supported backend DBMSes (and growing): MySQL, Oracle, PostgreSQL, Microsoft SQL Server, Microsoft Access, SQLite, Firebird, Sybase and SAP MaxDB  Fully supported SQL injection techniques: Blind, Error, Union (partial & full), Timed, Stacked  Enumeration of: database users, users' password hashes, users' privileges, users' roles, databases, tables and columns EuroPython 2011, Florence (Italy) June 23, 2011 8
  • 9. Features (2)  Recognition and cracking of password hashes  Web server file upload/download  Arbitrary command execution and retrieval of standard output  Establishment of an out-of-band TCP/UDP connection between the attacker's machine and the database server EuroPython 2011, Florence (Italy) June 23, 2011 9
  • 10. Community  Huge pool of pen/beta-testers active at our mailing list (this moment 200 subscribed)  White/Grey/Black hat hackers  They all provide indispensable help by: Reporting problems/bugs from real-life scenarios Feature requests Keeping morale high Modest donations (covering SVN server costs) EuroPython 2011, Florence (Italy) June 23, 2011 10
  • 11. SQL injection for dummies  Vulnerable code (PHP/PgSQL): $query = "SELECT * FROM products WHERE product_id=" . $_GET['id']  Attack vector: http://www.store.com/store.php?id=7; DROP TABLE users  Resulting SQL statements: SELECT * FROM products WHERE product_id=7; DROP TABLE users EuroPython 2011, Florence (Italy) June 23, 2011 11
  • 12. Well known attacks  In period 2005 till 2007 Albert Gonzalez has stolen 130 million credit card numbers  June 2007 – Microsoft U.K. Website defaced  December 2009 – RockYou (32 million credentials stolen)  December 2009 – NASA  July 2010 – The Pirate Bay EuroPython 2011, Florence (Italy) June 23, 2011 12
  • 13. Well known attacks (2)  February 2011 – HBGary  March 2011 – MySQL (vulnerable page has been: http://mysql.com/customers/view/index.html?id=1170  March & May 2011 – Comodo (certificate reseller)  May 2011... – PBS, Sony (#sownage – 20 sites and counting), Fox, Infragard, Nintendo, CNN... EuroPython 2011, Florence (Italy) June 23, 2011 13
  • 14. Lizamoon (mass injection)  “LizaMoon mass injection hits over 226,000 URLs” - Websense Security Labs (29th Mar 2011)  “The world was rocked today by LizaMoon - a SQL injection attack which has compromised well over one million Websites” – PCWorld (2nd Apr 2011) EuroPython 2011, Florence (Italy) June 23, 2011 14
  • 15. Random Quote “Structured Query Language is becoming the Achilles heel of the Internet.” EuroPython 2011, Florence (Italy) June 23, 2011 15
  • 16. “Exploits of a Mom” (XKCD #327) EuroPython 2011, Florence (Italy) June 23, 2011 16
  • 17. Funny Sweds  The following lines were in Swedish election votes (swe. VALJ = engl. voting): ;13;Hallands län;80;Halmstad;01;Halmstads västra valkrets;0904;Söndrum 4;pwn DROP TABLE VALJ;1  “At least 'pwn DROP TABLE VALJ' got 1 vote in the Swedish election” (comment on reddit :) EuroPython 2011, Florence (Italy) June 23, 2011 17
  • 18. Форум АНТИЧАТ - SQL Инъекции  “Awkward” Russian underground (open) forum  No chat, only vulnerable targets  Around 14 thousand targets (and growing) available to anyone EuroPython 2011, Florence (Italy) June 23, 2011 18
  • 19. Blind-based technique  Also known as “boolean” based and/or “1=1”  4 out of 5 vulnerable cases are affected  Slow – 1 request per 1 bit of information  Very demanding and sensitive for implementation (detection part)  Differentiation approach (difflib.quick_ratio()) or “exact” approach (e.g. “You are logged in” in page)  Greatest obstacle is “dinamicity”  Multi-threading is most welcome EuroPython 2011, Florence (Italy) June 23, 2011 19
  • 20. Blind-based technique (2)  Original  “True”  “False” EuroPython 2011, Florence (Italy) June 23, 2011 20
  • 21. Error-based technique  1 out of 4 vulnerable cases are affected  Deliberate provoking of “invalid SQL query” and retrieval of information from response messages  Fast – 1 request per item of information  Easy detection and implementation  Greatest obstacle is trimming of error messages (“substringing”)  Too DBMS specific  Advice: Turn off the error/debug messages! EuroPython 2011, Florence (Italy) June 23, 2011 21
  • 22. Error-based technique (2)  Example: EuroPython 2011, Florence (Italy) June 23, 2011 22
  • 23. Union query technique  Also known as “inband”  1 out of 2 vulnerable cases are affected  Fast(est) – 1 request per (multiple) item of information  Partial vs Full union  Greatest obstacle is speed of detection part  Easy for implementation, at least for usage part EuroPython 2011, Florence (Italy) June 23, 2011 23
  • 24. Union query technique (2)  Example 1 (partial):  Example 2 (full): EuroPython 2011, Florence (Italy) June 23, 2011 24
  • 25. Time delay-based technique  Pretty much the same as blind-based  Among slowest – 1 request per 1 bit of information  Expect every second response to be delayed  Very demanding and sensitive for implementation  Greatest obstacle is “lagging”  Single threading is a must for stable data retrieval EuroPython 2011, Florence (Italy) June 23, 2011 25
  • 26. Time delay-based technique (2)  Example (delayed by 5 seconds):  Resulting SQL statement: SELECT * FROM users WHERE id=1 AND 1= (SELECT 1 FROM PG_SLEEP(5))-- EuroPython 2011, Florence (Italy) June 23, 2011 26
  • 27. Stacked query technique  Pretty much identical to the time-based  Around 1 out of 2 DBMSes supports it  Deadly (Lizamoon)  MsSQL is most affected  Non-query based commands (INSERT, DELETE,...) EuroPython 2011, Florence (Italy) June 23, 2011 27
  • 28. Stacked query technique (2)  Example (delayed by 5 seconds) EuroPython 2011, Florence (Italy) June 23, 2011 28
  • 29. Basic working examples  Blind-based: ...id=1 AND ASCII(SUBSTR((SELECT password FROM public.users OFFSET 0 LIMIT 1)::text,1,1)) > 64--  Error-based: ...id=1 AND 6561=CAST(':abc:'|| (SELECT password FROM public.users OFFSET 0 LIMIT 1)::text||':def:' AS NUMERIC)--  Union query: ...id=1 UNION ALL SELECT NULL, NULL,':abc:'||password||':def:'||':ghi:'|| password||':jkl:'||':mno:'||id||':pqr:' FROM public.users-- EuroPython 2011, Florence (Italy) June 23, 2011 29
  • 30. Basic working examples (2)  Time-delay based: id=1 AND 1924=(CASE WHEN (ASCII(SUBSTR((SELECT password FROM public.users OFFSET 0 LIMIT 1)::text,1,1)) > 64) THEN (SELECT 1924 FROM PG_SLEEP(1)) ELSE 1924 END)--  Stacked query: id=1; SELECT(CASE WHEN (ASCII(SUBSTR((SELECT password FROM public.users OFFSET 0 LIMIT 1)::text,1,1)) > 64) THEN (SELECT 1924 FROM PG_SLEEP(1)) ELSE 1924 END);-- EuroPython 2011, Florence (Italy) June 23, 2011 30
  • 31. Program's structure  doc – manual, THANKS,...  lib – core modules  extra – 3rd party modules (chardet, clientform,...)  plugins – DBMS specific modules  shell – stagers and backdoors (php, jsp, asp,...)  tamper – tampering scripts (ifnull2ifisnull,...)  txt – wordlist, user-agents,...  xml – queries, payloads,... EuroPython 2011, Florence (Italy) June 23, 2011 31
  • 32. Program's workflow Setup Detection Fingerprinting Enumeration Takeover Configuration Boolean MySQL Databases Web shell Knowledge Error MsSQL Tables Metasploit base Session Union PgSQL Columns ICMPsh Connection Timed Oracle Users File access Payloads Stacked MsAccess Passwords Registry Queries ... ... ... ... EuroPython 2011, Florence (Italy) June 23, 2011 32
  • 33. Development environment  Subversion (version control)  Redmine (project management)  Python 2.6 and/or 2.7  Text editor of choice (TC/Notepad++ on Windows, Krusader/KrViewer on Linux)  Debugger of choice (pdb)  Proxy MITM tool (Burp)  Web browser of choice (Firefox) EuroPython 2011, Florence (Italy) June 23, 2011 33
  • 34. Testing environment  VMWare virtual machines  Linux Debian 5.0 32-bit (most used one) Apache/PHP  MySQL, Oracle, PgSQL, Firebird, SQLite  Windows XP 32-bit XAMPP/PHP  MySQL, SAP MaxDB, Sybase, SQLite, Access, etc. IIS/ASP(.NET)  MsSQL, MySQL, etc. EuroPython 2011, Florence (Italy) June 23, 2011 34
  • 35. Inference (binary search)  O(Log2n) complexity  Can be used in boolean, timed and stacked  e.g.: Initial table ['A','B',...'Z'] AND (...) > 'M' → (True) → ['N',...'Z'] AND (...) > 'S' → (False) → ['N',...'S'] AND (...) > 'O' → (True) → ['P', 'R', 'S'] AND (...) > 'R' → (False) → ['P', 'R'] AND (...) > 'P' → (False) → ['P'] (resulting char) EuroPython 2011, Florence (Italy) June 23, 2011 35
  • 36. Character prediction  High probability of prefix reuse  Common DBMS identificator names  Dynamic “prediction” tree  Example: Input: CREATE SYNONYM, CREATE TABLE, CREATE TRIGGER, CREATE USER, CREATE VIEW Output tree: [C][R][E][A][T][E][S|T|U|V]  Appropriate for blind/time/stacked techniques EuroPython 2011, Florence (Italy) June 23, 2011 36
  • 37. “Null-connection”  Special HTTP requests (Web server specific)  Example (Apache): Request: Range: bytes=-1 Response: Content-range: bytes 74-74/75 (True) Response: Content-range: bytes 126-126/127 (False)  Example (IIS): Request: HEAD Response: Content-Length: 75 (True) Response: Content-Length: 127 (False) EuroPython 2011, Florence (Italy) June 23, 2011 37
  • 38. Dinamicity removal  Biggest obstacle of blind/boolean technique  Javascript, ads, banners,...  Differentiation approach (difflib)  “Static blocks” vs “Dynamic blocks” (gaps)  Regular expressions to the rescue  Example: </p></table>dynamic part<iframe><ul> r“</p></table>.*?<iframe><ul>” EuroPython 2011, Florence (Italy) June 23, 2011 38
  • 39. Reflective values  Copy of payload (encoded?) inside response  Causing problems for blind/boolean technique  Source of lots of false positives/negatives (in other tools :)  Regular expressions to the rescue  Example: ?id=1 AND 2>1 ?id=1%20AND%202%3e1 r“(?i)id[^n<]+1[^n<]+AND[^n<]+2[^n<] +1” EuroPython 2011, Florence (Italy) June 23, 2011 39
  • 40. Statistics is our friend  Normal distribution (bell curve)  “It shows how much variation or 'dispersion' there is from the average (mean, or expected value)”  99.9999999997440% of “normal” data inside 7σ EuroPython 2011, Florence (Italy) June 23, 2011 40
  • 41. Statistics is our friend (2)  UNION injection detection: id=1 UNION ALL SELECT NULL, NULL,... Right number of columns should stick out  Time-delay injection detection/usage: id=1 AND 1=SELECT 1 FROM PG_SLEEP(5))-- Response time should stick out  Stacked-query injection detection/usage: id=1; SELECT 1 FROM PG_SLEEP(5))-- Response time should stick out EuroPython 2011, Florence (Italy) June 23, 2011 41
  • 42. False positives  Boolean, timed and stacked affected  Example: search engine queries  Simple arithmetic tests  Searching for mere signs of “intelligence”  Example: 1+2==3 4==5 2==(7-5) (6+5)==(6-5) EuroPython 2011, Florence (Italy) June 23, 2011 42
  • 43. Heuristic test  “Blatant” logic used for detection  Insufficient but great one shot test  Parameter “poisoning” with invalid (SQL) chars  Example: ?id=1''))(“(''(  Error message parsing and DBMS recognition EuroPython 2011, Florence (Italy) June 23, 2011 43
  • 44. Tampering scripts  IDS/WAF applications are getting better  Need for anti-anti hacking techniques  Example: 'UNION SELECT' → 'UnIOn SeleCT' 'A>B' → 'A NOT BETWEEN 0 AND B' 'SELECT password' → 'SELECT/**/password'  Input: payload Output: ftamper(payload)  Order of appearance & prioritized  14 till now and counting  Automation in near future EuroPython 2011, Florence (Italy) June 23, 2011 44
  • 45. “Pivoting”  Dumping technique  When lacking LIMIT/OFFSET mechanism  Around 1 in 2 DBMSes affected (e.g. MsSQL)  Count number of DISTINCT values  Choose column with highest number as “pivot”  Pivoting: SELECT MIN(pivotCol) … WHERE pivotCol > <previous_pivot_value> SELECT otherCol … WHERE pivotCol = <current_pivot_value> EuroPython 2011, Florence (Italy) June 23, 2011 45
  • 46. “SQL harvesting”  Google is our friend filetype:sql "CREATE TABLE" filetype:sql "INSERT INTO"  Extraction of table and column names  Decision based on frequency  Gathered data used by (brute force switches): --common-tables  ...AND EXISTS(SELECT * FROM table) --common-columns  ...AND EXISTS(SELECT column FROM table) EuroPython 2011, Florence (Italy) June 23, 2011 46
  • 47. Hash cracking  Implemented DBMS specific hash functions  10 and counting (mysql_passwd, mysql_old_passwd, mssql_passwd, ...)  Regular expression based recognition  High-quality (10MB) dictionary/wordlist  Automatic brute-force approach  Blazing fast (core routines from hashlib) EuroPython 2011, Florence (Italy) June 23, 2011 47
  • 48. Quality tests  --live-test All relevant tests for 4 major DBMSes Batch-like workflow Declared in a structured XML file Run against testing VMs  --smoke-test Recursively finds all modules Tries importing every single one of them Runs doctests if explicitly written  ./extra/shutils/pylint.py EuroPython 2011, Florence (Italy) June 23, 2011 48
  • 49. Best “self-protection” advice ...you can get from a dude that makes this all anti WAF/IDS, statistics, pivoting, dynamicity, reflective values and similar mambo-jambo... EuroPython 2011, Florence (Italy) June 23, 2011 49
  • 50. Parametrized SQL statements  Don't sanitize your database inputs yourself (prone to errors!)  Use language/library specific parametrized SQL statements  Functions/libraries automatically sanitize provided parameters  Good reference: http://bobby-tables.com/ EuroPython 2011, Florence (Italy) June 23, 2011 50
  • 51. Parametrized SQL statements (2)  Example (Python DB API): Don't:  cmd = "UPDATE people SET name='%s' WHERE id='%s'" % (name, id)  cursor.execute(cmd) Instead:  cursor.execute('UPDATE people SET name=:1 WHERE id=:2', [name, id]) EuroPython 2011, Florence (Italy) June 23, 2011 51
  • 52. Questions? EuroPython 2011, Florence (Italy) June 23, 2011 52
  • 53. Join the project  Project's web page: http://sqlmap.sourceforge.net/  Contact: dev@sqlmap.org  Users list: sqlmap-users@lists.sourceforge.net  Twitter: @sqlmap  Repository: https://svn.sqlmap.org/sqlmap/trunk/sqlmap EuroPython 2011, Florence (Italy) June 23, 2011 53