SlideShare a Scribd company logo
Curious Case of SQLi
Miroslav Štampar
dev@sqlmap.org
Target (1)
• High profile (i.e. very important to be secure)
• It was a fancy new Web 2.0 site (lots of
Javascript) – while it first appeared as a Flash site
• Very little user interaction (but lots of clicking)
• Automatic vulnerability scanners reported nothing
more than usual nagging (e.g. clickjacking
possible, lack of security headers, etc.)
• Used Javascript libraries were up-to-date
• Custom Javascript parts were clean (e.g. no DOM
based XSS, open redirections, etc.)
Target (2)
• No user management (everybody is/was
anonymous)
• Web server was up-to-date
• Only attack points suceptable to (malicious)
user interaction were:
➢
➢

Ajax call for user search (let's call it search.asp)
search.asp)
Ajax call for search within categories (let's call it
category.asp)
category.asp)

• Burp to the rescue
Attack points (1)
Attack points (2)
Typical response
Day #1 (.1)
• First tests resulted only with #FAIL
• Trashing of values (e.g. foo')><"bar)
foo')><"bar)
resulted in prolonged HTTP error 500 responses
(cca. 90 seconds before server timeout)
• '-- resulted with SQLi (response differentiation)
• '-- WAITFOR DELAY '0:0:5' resulted in
immediate HTTP error 500 response
• Though, ' WAITFOR DELAY foobar resulted
the same
• Usual stuff like ' AND 1=1-- and/or ' OR
2>1-- resulted in prolonged error responses too
Day #1 (.2)
• Everything point(ed) that there was some kind of
WAF involved (as said, high profile target)
• Colleagues told me to "just leave it"
• Boss told me that there is no hurry and that I can
work on it as much as I want :)
• As a sqlmap developer I had an "obligation" to, at
least try to, "break it"
• I told that I need 1-2 more days to be 100% sure
• One of first ideas was to write a SQLi fuzzer that
would do the "monkey test" job
Day #1 (.3)
• At the end of the working day, left sqlmap (over
the night) to test all the parameters
• Turned on all possible boundary & payload
combinations (--level=5 --risk=3)
(--level=5 --risk=3)
• Hoped that something usable will turn out of it
• During commuting (local overcrowded bus)
thought of all the stuff learned through years
• ..., WAF bypass tricks, non-ASCII SQLi payloads,
non-disclosed SQLi attacks, non-mainstream SQL
statements (Love Thy Reference Manual), etc.
Day #2 (.1)
•
•
•
•
•

Tried literary everything in my knowledge domain
Lots of delayed responses (very cumbersome)
sqlmap was still running (still nothing)
Almost quit (during the coffee break)
Had a hard look once more into the original
requests
• That ASC was "provoking" as hell
• Tried to Google in hope that something will turn
out
Day #2 (.2)
Day #2 (.3)
Day #2 (.4)
Day #2 (.5)
Day #2 (.6)
Day #2 (.7)
• Windows Search/Indexing Service can be SQL-ed
• Advanced Query Syntax (AQS) #FTW
• "AQS is the default query syntax used by
Windows Search to query the index and to refine
and narrow search parameters"
• A basic query searches for items that satisfy a
restriction over a property
• Users can limit the scope of their searches to
specific folder locations or data stores
• There is no single reported case of SQLi
Day #2 (.8)
Day #2 (.9)
Day #2 (.10)
Day #2 (.11)
Day #2 (.12)
Day #2 (.13)
Day #2 (.14)
Day #2 (.15)
• At the end of the day, summarized findings
• Columns of interest (SYSTEMINDEX catalog):
(SYSTEMINDEX
System.ItemFolderPathDisplay,
System.ItemFolderPathDisplay,
System.Filename,
System.Filename,
System.ItemPathDisplay, System.Size,
System.ItemPathDisplay, System.Size,
System.FileOwner
• Some columns had interesting names, but
appeared to be always empty (System.Author,
(System.Author,
System.Comment, System.ComputerName,
System.Comment, System.ComputerName,
System.Keywords, System.Subject,
System.Keywords, System.Subject,
System.Title, etc.)
System.Title, etc.)
Day #2 (.16)
• All in all, nothing special than proof of SQLi and
complete file listing with (semi-)interesting
attributes
• Went home and thought (again) in overcrowded
local bus "is that the best I can do?"
• That SQL/AQS was really limited (i.e. crippled)
• Nothing special is stored inside (than local file
listing) from security point of view
• "...or, wait a minute..."
Day #2 (.17)
• There must be a way how to search files with
keywords (it's called Search for a reason)
• Came to homeplace and immediatelly read
the whole reference manual
• Found a special operator: CONTAINS
• Using it's wildcard functionality it should be
possible to infer the content of files
• ...AND
System.ItemPathDisplay='...' AND
CONTAINS('""a*""')--
Day #3 (.1)
• Manually tried file content inference trick and it
worked as charm
• Usually, user permissions of process running the
search would pose a problem (e.g. if run with
default anonymous IIS account
IUSR_<computer_name>)
IUSR_<computer_name>)
• Administrator used external VBS script, most
probably because of simplicity and usability
• It was being run with different (more permissive)
credentials
Day #3 (.2)
• Retrieved a list of "all" local files (accessible by
the searching VBS process)
• System directories were missing (e.g.
C:Windows & C:Program Files)
Files)
• Out of the rest, directories that appeared
especially interesting were:
C:InetpubwwwrootfoobarOld &
C:InetpubwwwrootfoobarBackup
• Inside both of those there was a web.config file
• Started implementing file content inference
mechanism using CONTAINS
Day #3 (.3)
Day #3 (.4)
•
•
•
•
•
•
•
•
•
•

..AND
..AND
...
..AND
..AND
..AND
..AND
..AND
...
..AND

CONTAINS('""a*""')..
CONTAINS('""aa*""')..

(true)
(false)

CONTAINS('""ad*""').. (true)
CONTAINS('""ada*""').. (false)
CONTAINS('""adb*""').. (false)
CONTAINS('""add*""').. (true)
CONTAINS('""adda*""')..(false)
CONTAINS('""add""')..

(true)
Day #3 (.5)
Day #3 (.6)
• Inference of a configuration file containing a
sa password for a (local) SQL Server was a
pretty good catch :)
• As said, search process was constrained with
used user rights (limiting wider exposée)
• There were no opened ports than 80 (e.g.
port 1433 would be great)
• There were no (exposed) administrator pages
• Called it a day and finished a test altogether
Conclusion
• Use automatic vulnerability scanners only to
get a "sense" of target's security settings
• To get a deep understanding of target's inner
workings you'll always need to "get dirty"
• If you have a "hunch" stick with it
• You'll most probably be wrong, but you'll
learn a lot along the way
• In case that your "hunch" was right, you'll
have an interesting story to tell (highly
subjective opinion ;)
Questions?

More Related Content

What's hot

Apache Solr Workshop
Apache Solr WorkshopApache Solr Workshop
Apache Solr Workshop
JSGB
 
Professional Help for PowerShell Modules
Professional Help for PowerShell ModulesProfessional Help for PowerShell Modules
Professional Help for PowerShell Modules
June Blender
 
DanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIDanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino API
Paul Withers
 
Ln monitoring repositories
Ln monitoring repositoriesLn monitoring repositories
Ln monitoring repositories
snyff
 
Java JDBC
Java JDBCJava JDBC
Apache Solr - Enterprise search platform
Apache Solr - Enterprise search platformApache Solr - Enterprise search platform
Apache Solr - Enterprise search platform
Tommaso Teofili
 
User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014
Robert Stupp
 
Apache Solr crash course
Apache Solr crash courseApache Solr crash course
Apache Solr crash course
Tommaso Teofili
 
03 standard class library
03 standard class library03 standard class library
03 standard class library
eleksdev
 
OpenNTF Domino API - Overview Introduction
OpenNTF Domino API - Overview IntroductionOpenNTF Domino API - Overview Introduction
OpenNTF Domino API - Overview Introduction
Paul Withers
 
What is new in CFEngine 3.6
What is new in CFEngine 3.6What is new in CFEngine 3.6
What is new in CFEngine 3.6
Jonathan Clarke
 
Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring Clojurescript
Luke Donnet
 
SUTOL 2015 - Utilizing the OpenNTF Domino API
SUTOL 2015 - Utilizing the OpenNTF Domino APISUTOL 2015 - Utilizing the OpenNTF Domino API
SUTOL 2015 - Utilizing the OpenNTF Domino API
Oliver Busse
 
Data file handling
Data file handlingData file handling
Data file handling
Saurabh Patel
 
libAttachSQL, The Next-Generation C Connector For MySQL
libAttachSQL, The Next-Generation C Connector For MySQLlibAttachSQL, The Next-Generation C Connector For MySQL
libAttachSQL, The Next-Generation C Connector For MySQL
Andrew Hutchings
 
Unix/Linux
Unix/Linux Unix/Linux
Unix/Linux
Saurabh Upadhyay
 
CNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: ShellcodeCNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: Shellcode
Sam Bowne
 
Introduction to Solr
Introduction to SolrIntroduction to Solr
Introduction to Solr
Erik Hatcher
 
XNA L01–Introduction
XNA L01–IntroductionXNA L01–Introduction
XNA L01–Introduction
Mohammad Shaker
 
Introduction to char device driver
Introduction to char device driverIntroduction to char device driver
Introduction to char device driver
Vandana Salve
 

What's hot (20)

Apache Solr Workshop
Apache Solr WorkshopApache Solr Workshop
Apache Solr Workshop
 
Professional Help for PowerShell Modules
Professional Help for PowerShell ModulesProfessional Help for PowerShell Modules
Professional Help for PowerShell Modules
 
DanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIDanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino API
 
Ln monitoring repositories
Ln monitoring repositoriesLn monitoring repositories
Ln monitoring repositories
 
Java JDBC
Java JDBCJava JDBC
Java JDBC
 
Apache Solr - Enterprise search platform
Apache Solr - Enterprise search platformApache Solr - Enterprise search platform
Apache Solr - Enterprise search platform
 
User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014User defined-functions-cassandra-summit-eu-2014
User defined-functions-cassandra-summit-eu-2014
 
Apache Solr crash course
Apache Solr crash courseApache Solr crash course
Apache Solr crash course
 
03 standard class library
03 standard class library03 standard class library
03 standard class library
 
OpenNTF Domino API - Overview Introduction
OpenNTF Domino API - Overview IntroductionOpenNTF Domino API - Overview Introduction
OpenNTF Domino API - Overview Introduction
 
What is new in CFEngine 3.6
What is new in CFEngine 3.6What is new in CFEngine 3.6
What is new in CFEngine 3.6
 
Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring Clojurescript
 
SUTOL 2015 - Utilizing the OpenNTF Domino API
SUTOL 2015 - Utilizing the OpenNTF Domino APISUTOL 2015 - Utilizing the OpenNTF Domino API
SUTOL 2015 - Utilizing the OpenNTF Domino API
 
Data file handling
Data file handlingData file handling
Data file handling
 
libAttachSQL, The Next-Generation C Connector For MySQL
libAttachSQL, The Next-Generation C Connector For MySQLlibAttachSQL, The Next-Generation C Connector For MySQL
libAttachSQL, The Next-Generation C Connector For MySQL
 
Unix/Linux
Unix/Linux Unix/Linux
Unix/Linux
 
CNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: ShellcodeCNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: Shellcode
 
Introduction to Solr
Introduction to SolrIntroduction to Solr
Introduction to Solr
 
XNA L01–Introduction
XNA L01–IntroductionXNA L01–Introduction
XNA L01–Introduction
 
Introduction to char device driver
Introduction to char device driverIntroduction to char device driver
Introduction to char device driver
 

Viewers also liked

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 Now
Miroslav Stampar
 
Hash DoS Attack
Hash DoS AttackHash DoS Attack
Hash DoS Attack
Miroslav Stampar
 
Smashing the Buffer
Smashing the BufferSmashing the Buffer
Smashing the Buffer
Miroslav Stampar
 
sqlmap - Under the Hood
sqlmap - Under the Hoodsqlmap - Under the Hood
sqlmap - Under the Hood
Miroslav Stampar
 
sqlmap - security development in Python
sqlmap - security development in Pythonsqlmap - security development in Python
sqlmap - security development in Python
Miroslav Stampar
 
Analysis of mass SQL injection attacks
Analysis of mass SQL injection attacksAnalysis of mass SQL injection attacks
Analysis of mass SQL injection attacks
Miroslav Stampar
 
Heuristic methods used in sqlmap
Heuristic methods used in sqlmapHeuristic methods used in sqlmap
Heuristic methods used in sqlmap
Miroslav Stampar
 
It all starts with the ' (SQL injection from attacker's point of view)
It all starts with the ' (SQL injection from attacker's point of view)It all starts with the ' (SQL injection from attacker's point of view)
It all starts with the ' (SQL injection from attacker's point of view)
Miroslav Stampar
 
sqlmap - why (not how) it works?
sqlmap - why (not how) it works?sqlmap - why (not how) it works?
sqlmap - why (not how) it works?
Miroslav Stampar
 
Spot the Web Vulnerability
Spot the Web VulnerabilitySpot the Web Vulnerability
Spot the Web Vulnerability
Miroslav Stampar
 
DNS exfiltration using sqlmap
DNS exfiltration using sqlmapDNS exfiltration using sqlmap
DNS exfiltration using sqlmap
Miroslav Stampar
 
Riding the Overflow - Then and Now
Riding the Overflow - Then and NowRiding the Overflow - Then and Now
Riding the Overflow - Then and Now
Miroslav Stampar
 
Bilgi Teknolojilerinin Temel Kavramları 1
Bilgi Teknolojilerinin Temel Kavramları 1Bilgi Teknolojilerinin Temel Kavramları 1
Bilgi Teknolojilerinin Temel Kavramları 1
Zekai Uçan
 
Psychological science and beliefs
Psychological science and beliefsPsychological science and beliefs
Psychological science and beliefs
Lance Jones
 
Проект змін до ЗУ «Про сприяння соціальному становленню та розвитку молоді в ...
Проект змін до ЗУ «Про сприяння соціальному становленню та розвитку молоді в ...Проект змін до ЗУ «Про сприяння соціальному становленню та розвитку молоді в ...
Проект змін до ЗУ «Про сприяння соціальному становленню та розвитку молоді в ...ProstirUA
 
CHS Reunion Slide Show 2001
CHS Reunion Slide Show 2001CHS Reunion Slide Show 2001
CHS Reunion Slide Show 2001
kbexter
 
Program pss bersama kartunis
Program pss bersama kartunisProgram pss bersama kartunis
Program pss bersama kartunis
Laila Mustafa
 
Kejohanan balapan & padang
Kejohanan balapan & padangKejohanan balapan & padang
Kejohanan balapan & padangLaila Mustafa
 
redBorder: Open or die
redBorder: Open or dieredBorder: Open or die
redBorder: Open or die
Nextel S.A.
 

Viewers also liked (20)

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)
 
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
 
Smashing the Buffer
Smashing the BufferSmashing the Buffer
Smashing the Buffer
 
sqlmap - Under the Hood
sqlmap - Under the Hoodsqlmap - Under the Hood
sqlmap - Under the Hood
 
sqlmap - security development in Python
sqlmap - security development in Pythonsqlmap - security development in Python
sqlmap - security development in Python
 
Analysis of mass SQL injection attacks
Analysis of mass SQL injection attacksAnalysis of mass SQL injection attacks
Analysis of mass SQL injection attacks
 
Heuristic methods used in sqlmap
Heuristic methods used in sqlmapHeuristic methods used in sqlmap
Heuristic methods used in sqlmap
 
It all starts with the ' (SQL injection from attacker's point of view)
It all starts with the ' (SQL injection from attacker's point of view)It all starts with the ' (SQL injection from attacker's point of view)
It all starts with the ' (SQL injection from attacker's point of view)
 
sqlmap - why (not how) it works?
sqlmap - why (not how) it works?sqlmap - why (not how) it works?
sqlmap - why (not how) it works?
 
Spot the Web Vulnerability
Spot the Web VulnerabilitySpot the Web Vulnerability
Spot the Web Vulnerability
 
DNS exfiltration using sqlmap
DNS exfiltration using sqlmapDNS exfiltration using sqlmap
DNS exfiltration using sqlmap
 
Riding the Overflow - Then and Now
Riding the Overflow - Then and NowRiding the Overflow - Then and Now
Riding the Overflow - Then and Now
 
Bilgi Teknolojilerinin Temel Kavramları 1
Bilgi Teknolojilerinin Temel Kavramları 1Bilgi Teknolojilerinin Temel Kavramları 1
Bilgi Teknolojilerinin Temel Kavramları 1
 
Psychological science and beliefs
Psychological science and beliefsPsychological science and beliefs
Psychological science and beliefs
 
Проект змін до ЗУ «Про сприяння соціальному становленню та розвитку молоді в ...
Проект змін до ЗУ «Про сприяння соціальному становленню та розвитку молоді в ...Проект змін до ЗУ «Про сприяння соціальному становленню та розвитку молоді в ...
Проект змін до ЗУ «Про сприяння соціальному становленню та розвитку молоді в ...
 
CHS Reunion Slide Show 2001
CHS Reunion Slide Show 2001CHS Reunion Slide Show 2001
CHS Reunion Slide Show 2001
 
Program pss bersama kartunis
Program pss bersama kartunisProgram pss bersama kartunis
Program pss bersama kartunis
 
Kejohanan balapan & padang
Kejohanan balapan & padangKejohanan balapan & padang
Kejohanan balapan & padang
 
redBorder: Open or die
redBorder: Open or dieredBorder: Open or die
redBorder: Open or die
 

Similar to Curious Case of SQLi

Oracle forensics 101
Oracle forensics 101Oracle forensics 101
Oracle forensics 101
fangjiafu
 
Introduction to libre « fulltext » technology
Introduction to libre « fulltext » technologyIntroduction to libre « fulltext » technology
Introduction to libre « fulltext » technology
Robert Viseur
 
Advanced Windows Exploitation
Advanced Windows ExploitationAdvanced Windows Exploitation
Advanced Windows Exploitation
UTD Computer Security Group
 
SQL Injection Defense in Python
SQL Injection Defense in PythonSQL Injection Defense in Python
SQL Injection Defense in Python
Public Broadcasting Service
 
Workshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with VolatilityWorkshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with Volatility
Andrew Case
 
Esage on non-existent 0-days, stable binary exploits and user interaction
Esage   on non-existent 0-days, stable binary exploits and user interactionEsage   on non-existent 0-days, stable binary exploits and user interaction
Esage on non-existent 0-days, stable binary exploits and user interaction
DefconRussia
 
On non existent 0-days, stable binary exploits and
On non existent 0-days, stable binary exploits andOn non existent 0-days, stable binary exploits and
On non existent 0-days, stable binary exploits and
Alisa Esage Шевченко
 
CamSec Sept 2016 - Tricks to improve web app excel export attacks
CamSec Sept 2016 - Tricks to improve web app excel export attacksCamSec Sept 2016 - Tricks to improve web app excel export attacks
CamSec Sept 2016 - Tricks to improve web app excel export attacks
Jerome Smith
 
SQL Queries on Smalltalk Objects
SQL Queries on Smalltalk ObjectsSQL Queries on Smalltalk Objects
SQL Queries on Smalltalk Objects
ESUG
 
.NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar...
.NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar....NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar...
.NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar...
Karel Zikmund
 
Live Memory Forensics on Android devices
Live Memory Forensics on Android devicesLive Memory Forensics on Android devices
Live Memory Forensics on Android devices
Nikos Gkogkos
 
Introduction to .NET Performance Measurement
Introduction to .NET Performance MeasurementIntroduction to .NET Performance Measurement
Introduction to .NET Performance Measurement
Sasha Goldshtein
 
Mac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityMac Memory Analysis with Volatility
Mac Memory Analysis with Volatility
Andrew Case
 
Memory Analysis of the Dalvik (Android) Virtual Machine
Memory Analysis of the Dalvik (Android) Virtual MachineMemory Analysis of the Dalvik (Android) Virtual Machine
Memory Analysis of the Dalvik (Android) Virtual Machine
Andrew Case
 
06.1 .Net memory management
06.1 .Net memory management06.1 .Net memory management
06.1 .Net memory management
Victor Matyushevskyy
 
ShmooCON 2009 : Re-playing with (Blind) SQL Injection
ShmooCON 2009 : Re-playing with (Blind) SQL InjectionShmooCON 2009 : Re-playing with (Blind) SQL Injection
ShmooCON 2009 : Re-playing with (Blind) SQL Injection
Chema Alonso
 
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
Chris Gates
 
Getting Started with Java
Getting Started with JavaGetting Started with Java
Getting Started with Java
Michael Redlich
 
Windows 7 forensics jump lists-rv3-public
Windows 7 forensics jump lists-rv3-publicWindows 7 forensics jump lists-rv3-public
Windows 7 forensics jump lists-rv3-public
CTIN
 
Memcached-инъекции - они существуют и работают, Иван Новиков (ONsec)
Memcached-инъекции - они существуют и работают, Иван Новиков (ONsec)Memcached-инъекции - они существуют и работают, Иван Новиков (ONsec)
Memcached-инъекции - они существуют и работают, Иван Новиков (ONsec)
Ontico
 

Similar to Curious Case of SQLi (20)

Oracle forensics 101
Oracle forensics 101Oracle forensics 101
Oracle forensics 101
 
Introduction to libre « fulltext » technology
Introduction to libre « fulltext » technologyIntroduction to libre « fulltext » technology
Introduction to libre « fulltext » technology
 
Advanced Windows Exploitation
Advanced Windows ExploitationAdvanced Windows Exploitation
Advanced Windows Exploitation
 
SQL Injection Defense in Python
SQL Injection Defense in PythonSQL Injection Defense in Python
SQL Injection Defense in Python
 
Workshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with VolatilityWorkshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with Volatility
 
Esage on non-existent 0-days, stable binary exploits and user interaction
Esage   on non-existent 0-days, stable binary exploits and user interactionEsage   on non-existent 0-days, stable binary exploits and user interaction
Esage on non-existent 0-days, stable binary exploits and user interaction
 
On non existent 0-days, stable binary exploits and
On non existent 0-days, stable binary exploits andOn non existent 0-days, stable binary exploits and
On non existent 0-days, stable binary exploits and
 
CamSec Sept 2016 - Tricks to improve web app excel export attacks
CamSec Sept 2016 - Tricks to improve web app excel export attacksCamSec Sept 2016 - Tricks to improve web app excel export attacks
CamSec Sept 2016 - Tricks to improve web app excel export attacks
 
SQL Queries on Smalltalk Objects
SQL Queries on Smalltalk ObjectsSQL Queries on Smalltalk Objects
SQL Queries on Smalltalk Objects
 
.NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar...
.NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar....NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar...
.NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar...
 
Live Memory Forensics on Android devices
Live Memory Forensics on Android devicesLive Memory Forensics on Android devices
Live Memory Forensics on Android devices
 
Introduction to .NET Performance Measurement
Introduction to .NET Performance MeasurementIntroduction to .NET Performance Measurement
Introduction to .NET Performance Measurement
 
Mac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityMac Memory Analysis with Volatility
Mac Memory Analysis with Volatility
 
Memory Analysis of the Dalvik (Android) Virtual Machine
Memory Analysis of the Dalvik (Android) Virtual MachineMemory Analysis of the Dalvik (Android) Virtual Machine
Memory Analysis of the Dalvik (Android) Virtual Machine
 
06.1 .Net memory management
06.1 .Net memory management06.1 .Net memory management
06.1 .Net memory management
 
ShmooCON 2009 : Re-playing with (Blind) SQL Injection
ShmooCON 2009 : Re-playing with (Blind) SQL InjectionShmooCON 2009 : Re-playing with (Blind) SQL Injection
ShmooCON 2009 : Re-playing with (Blind) SQL Injection
 
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
 
Getting Started with Java
Getting Started with JavaGetting Started with Java
Getting Started with Java
 
Windows 7 forensics jump lists-rv3-public
Windows 7 forensics jump lists-rv3-publicWindows 7 forensics jump lists-rv3-public
Windows 7 forensics jump lists-rv3-public
 
Memcached-инъекции - они существуют и работают, Иван Новиков (ONsec)
Memcached-инъекции - они существуют и работают, Иван Новиков (ONsec)Memcached-инъекции - они существуют и работают, Иван Новиков (ONsec)
Memcached-инъекции - они существуют и работают, Иван Новиков (ONsec)
 

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
 
Blind WAF identification
Blind WAF identificationBlind WAF identification
Blind WAF identification
Miroslav Stampar
 
sqlmap internals
sqlmap internalssqlmap internals
sqlmap internals
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
 
sqlmap internals
sqlmap internalssqlmap internals
sqlmap internals
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 Denoise
Miroslav Stampar
 
APT Attacks on Critical Infrastructure
APT Attacks on Critical InfrastructureAPT Attacks on Critical Infrastructure
APT Attacks on Critical Infrastructure
Miroslav Stampar
 
WARNING: Do Not Feed the Bears
WARNING: Do Not Feed the BearsWARNING: Do Not Feed the Bears
WARNING: Do Not Feed the Bears
Miroslav Stampar
 
Non-Esoteric XSS Tips & Tricks
Non-Esoteric XSS Tips & TricksNon-Esoteric XSS Tips & Tricks
Non-Esoteric XSS Tips & Tricks
Miroslav Stampar
 
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
Miroslav Stampar
 

More from Miroslav Stampar (10)

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?
 
sqlmap internals
sqlmap internalssqlmap internals
sqlmap internals
 
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
 
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
 

Recently uploaded

WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
flufftailshop
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Jeffrey Haguewood
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
saastr
 

Recently uploaded (20)

WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
 

Curious Case of SQLi

  • 1. Curious Case of SQLi Miroslav Štampar dev@sqlmap.org
  • 2. Target (1) • High profile (i.e. very important to be secure) • It was a fancy new Web 2.0 site (lots of Javascript) – while it first appeared as a Flash site • Very little user interaction (but lots of clicking) • Automatic vulnerability scanners reported nothing more than usual nagging (e.g. clickjacking possible, lack of security headers, etc.) • Used Javascript libraries were up-to-date • Custom Javascript parts were clean (e.g. no DOM based XSS, open redirections, etc.)
  • 3. Target (2) • No user management (everybody is/was anonymous) • Web server was up-to-date • Only attack points suceptable to (malicious) user interaction were: ➢ ➢ Ajax call for user search (let's call it search.asp) search.asp) Ajax call for search within categories (let's call it category.asp) category.asp) • Burp to the rescue
  • 7. Day #1 (.1) • First tests resulted only with #FAIL • Trashing of values (e.g. foo')><"bar) foo')><"bar) resulted in prolonged HTTP error 500 responses (cca. 90 seconds before server timeout) • '-- resulted with SQLi (response differentiation) • '-- WAITFOR DELAY '0:0:5' resulted in immediate HTTP error 500 response • Though, ' WAITFOR DELAY foobar resulted the same • Usual stuff like ' AND 1=1-- and/or ' OR 2>1-- resulted in prolonged error responses too
  • 8. Day #1 (.2) • Everything point(ed) that there was some kind of WAF involved (as said, high profile target) • Colleagues told me to "just leave it" • Boss told me that there is no hurry and that I can work on it as much as I want :) • As a sqlmap developer I had an "obligation" to, at least try to, "break it" • I told that I need 1-2 more days to be 100% sure • One of first ideas was to write a SQLi fuzzer that would do the "monkey test" job
  • 9. Day #1 (.3) • At the end of the working day, left sqlmap (over the night) to test all the parameters • Turned on all possible boundary & payload combinations (--level=5 --risk=3) (--level=5 --risk=3) • Hoped that something usable will turn out of it • During commuting (local overcrowded bus) thought of all the stuff learned through years • ..., WAF bypass tricks, non-ASCII SQLi payloads, non-disclosed SQLi attacks, non-mainstream SQL statements (Love Thy Reference Manual), etc.
  • 10. Day #2 (.1) • • • • • Tried literary everything in my knowledge domain Lots of delayed responses (very cumbersome) sqlmap was still running (still nothing) Almost quit (during the coffee break) Had a hard look once more into the original requests • That ASC was "provoking" as hell • Tried to Google in hope that something will turn out
  • 16. Day #2 (.7) • Windows Search/Indexing Service can be SQL-ed • Advanced Query Syntax (AQS) #FTW • "AQS is the default query syntax used by Windows Search to query the index and to refine and narrow search parameters" • A basic query searches for items that satisfy a restriction over a property • Users can limit the scope of their searches to specific folder locations or data stores • There is no single reported case of SQLi
  • 24. Day #2 (.15) • At the end of the day, summarized findings • Columns of interest (SYSTEMINDEX catalog): (SYSTEMINDEX System.ItemFolderPathDisplay, System.ItemFolderPathDisplay, System.Filename, System.Filename, System.ItemPathDisplay, System.Size, System.ItemPathDisplay, System.Size, System.FileOwner • Some columns had interesting names, but appeared to be always empty (System.Author, (System.Author, System.Comment, System.ComputerName, System.Comment, System.ComputerName, System.Keywords, System.Subject, System.Keywords, System.Subject, System.Title, etc.) System.Title, etc.)
  • 25. Day #2 (.16) • All in all, nothing special than proof of SQLi and complete file listing with (semi-)interesting attributes • Went home and thought (again) in overcrowded local bus "is that the best I can do?" • That SQL/AQS was really limited (i.e. crippled) • Nothing special is stored inside (than local file listing) from security point of view • "...or, wait a minute..."
  • 26. Day #2 (.17) • There must be a way how to search files with keywords (it's called Search for a reason) • Came to homeplace and immediatelly read the whole reference manual • Found a special operator: CONTAINS • Using it's wildcard functionality it should be possible to infer the content of files • ...AND System.ItemPathDisplay='...' AND CONTAINS('""a*""')--
  • 27. Day #3 (.1) • Manually tried file content inference trick and it worked as charm • Usually, user permissions of process running the search would pose a problem (e.g. if run with default anonymous IIS account IUSR_<computer_name>) IUSR_<computer_name>) • Administrator used external VBS script, most probably because of simplicity and usability • It was being run with different (more permissive) credentials
  • 28. Day #3 (.2) • Retrieved a list of "all" local files (accessible by the searching VBS process) • System directories were missing (e.g. C:Windows & C:Program Files) Files) • Out of the rest, directories that appeared especially interesting were: C:InetpubwwwrootfoobarOld & C:InetpubwwwrootfoobarBackup • Inside both of those there was a web.config file • Started implementing file content inference mechanism using CONTAINS
  • 30. Day #3 (.4) • • • • • • • • • • ..AND ..AND ... ..AND ..AND ..AND ..AND ..AND ... ..AND CONTAINS('""a*""').. CONTAINS('""aa*""').. (true) (false) CONTAINS('""ad*""').. (true) CONTAINS('""ada*""').. (false) CONTAINS('""adb*""').. (false) CONTAINS('""add*""').. (true) CONTAINS('""adda*""')..(false) CONTAINS('""add""').. (true)
  • 32. Day #3 (.6) • Inference of a configuration file containing a sa password for a (local) SQL Server was a pretty good catch :) • As said, search process was constrained with used user rights (limiting wider exposée) • There were no opened ports than 80 (e.g. port 1433 would be great) • There were no (exposed) administrator pages • Called it a day and finished a test altogether
  • 33. Conclusion • Use automatic vulnerability scanners only to get a "sense" of target's security settings • To get a deep understanding of target's inner workings you'll always need to "get dirty" • If you have a "hunch" stick with it • You'll most probably be wrong, but you'll learn a lot along the way • In case that your "hunch" was right, you'll have an interesting story to tell (highly subjective opinion ;)