SlideShare uma empresa Scribd logo
1 de 23
Baixar para ler offline
Web Security
● Jose Mato Mariño
3/5/15 - 12:52:45 AM
Who am I?
● Web Developer
● Web security as hobby
● http://josemato.name
● @security4dev
3/5/15 - 12:52:46 AM
Is mandatory know web security to do a web?
● YES, If someone hacks your your server... you,
developer, are screwed
– Read logs, …, a lot of logs
– Sometimes is difficult know what was happening
– Web security is easier than computer forensic
● Your client
– Angry
– Lost branding and reputation
3/5/15 - 12:52:46 AM
Why cybercriminals want
my server ???
● SPAM
● BitCoins
● Phishing
● Botnet
● Ransomware
● Data theft
3/5/15 - 12:52:46 AM
● Online community dedicated to web application security
● Guide practices and recommendations to be considered
secure application development
● OWASP TOP 10
3/5/15 - 12:52:46 AM
OWASP TOP 10 – From 2010 to 2013
3/5/15 - 12:52:46 AM
A3 – Cross Site Scripting (XSS)
● Problem: User injects code ( ActiveX, Java, VBScript,
Flash, HTML but typically javascript) into webpage
● Attacks:
– Access user session (session hijacking)
– Redirect user to exploit kit (blackhole)
– Defacement. Phishing.
– Network ip + ports scanner
● We have 5 contexts to exploit XSS
● There are two types of XSS
3/5/15 - 12:52:46 AM
A3 – XSS Context
● Context (by Ashar Javed @soaj1664ashar):
"Context is an environment where user supplied input or input
from other application(s) eventually ends-up or start living"
● Type of contexts:
– HTML context (<title>XXS</title>)
– Attribute context (input value=”XSS”)
– Script context (<script>var a = “<?php echo XSS ?>”</script>)
– URL context (write server variable to src, href, data flash, etc)
– Style context (div style=”XSS” => custom editors)
3/5/15 - 12:52:46 AM
● Reflective
– Code is not store on any database or database repo
– Payload must be on get parameter (discussion)
– User needs to click on a malicious link
● Persistent
– Code is store on a persistent store (database)
– When user enter on a hacked page, he will exec the
xploit
A3 – XSS Types
3/5/15 - 12:52:46 AM
● http://www.elmundo.es/elmundo/2010/01/04/union_europea/1262
610678.html
A3 – Famous XSS
“Mr. Bean 'se cuela' en la web oficial de la presidencia
española”
3/5/15 - 12:52:47 AM
XSS DEMO I
● Check if there is
some XSS
● Get access to user
account
3/5/15 - 12:52:47 AM
● Never trust on user input (inbound & outbound)
● Sanitize all inputs
● Enable flag httpOnly on cookies
● Content Security Policy (CSP)
A3 – XSS Mitigation
3/5/15 - 12:52:47 AM
● Access to not allowed resources
● Application fail to check if user is authorized to access to
the resource
● Common scenario:
– http://websecurity-demo.local/transcript.php?student=1536
● Attacker see a parameter and know that “1536” is his
student id
● Attacker change this student id and get the content of
another student
● This parameter could be anywhere (get, post, cookie, …)
A4 – Insecure Direct Object References
3/5/15 - 12:52:47 AM
● Technique to alter
queries into engine
store through
vulnerable
application
● Mysql, MSQL,
Postgres, LDAP,
Access, Oracle, …
● We are going to
focus on SQLi in this
talk
● Many kind of SQLi
A1 – Injection
3/5/15 - 12:52:47 AM
● Access personal data. Dump database
● Dump local users (/etc/passwd)
● Access organization CMS
● Site infection
– malware propagation
– Click abuse
A1 – SQL Injection Goals
3/5/15 - 12:52:47 AM
● Lilupophilupop SQL Injection Attack Tops 1 Million
Infected URLs
– Search SQL Injection on ASP or ColdFusion pages
with Microsoft SQL Server
– More than one million url infected
– the attackers used XSS Persistent to redirect users to
pages showing fake computer issues to buy a fake
AV
● http://threatpost.com/lilupophilupop-sql-injection-attack
-tops-1-million-infected-urls-010412/76054
A1 – Famous SQL Injection I
3/5/15 - 12:52:47 AM
● Barr’s claims that he would unmask and extinguish Anonymous
proved to be the proverbial last straw on the camel’s back.
● Anonymous find a SQL Injection:
– http://www.hbgaryfederal.com/pages.php?pageNav=2&page=
27
● Passwords were hashed but Aaron just used lower case and
numbers.
● Access CMS. Social engineer to reset email password and
access SSH. (Aaron used same password for many services!)
● http://arstechnica.com/tech-policy/2011/02/anonymous-speaks-the
-inside-story-of-the-hbgary-hack/
A1 – Famous SQL Injection II
3/5/15 - 12:52:47 AM
● SQL Injection
● Blind SQLi
– We only can use queries that retrieve a boolean value
(true or false).
– It's very slow
– Binary search to enhance performance
● Time based SQLi
– Based on heavy queries (sleep)
– Very slow
A1 – SQL Injection Types
3/5/15 - 12:52:47 AM
● Database engine has a metadata, catalog, schema or
something like that
● This catalog stores all database metainformation (table
relations, database exists, columns names with length +
datatype, …)
● Is mandatory know the catalog of the vulnerable app to
perform a pentesting
A1 – SQL Injection Walkthrough I
3/5/15 - 12:52:47 AM
● Search vulnerability (test app request and check
params)
– Number of columns
– Database names
● table names
– Column names
● Dump or insert data
● Download files
● Upload webshell
A1 – SQL Injection Walkthrough II
3/5/15 - 12:52:47 AM
● MySQL Catalog
– Retrieve databases: SELECT schema_name FROM
information_schema.SCHEMATA;
– Retrieve tables from specific database: SELECT
table_schema, table_name FROM
information_schema.TABLES WHERE table_schema =
'DATABASE';
– Retrieve columns from specific table: SELECT
column_name, column_type FROM
information_schema.columns WHERE table_name =
'TABLE' AND table_schema = 'DATABASE';
A1 – SQL Injection Walkthrough III
3/5/15 - 12:52:47 AM
A1 – SQL Injection Hacking Time :)
3/5/15 - 12:52:47 AM
Some Question??
THANKS!!
● Jose Mato
– http://josemato.name
– @security4dev
– https://github.com/josemato/
– https://www.linkedin.com/in/josematomarino

Mais conteúdo relacionado

Mais procurados

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
Ahmed AbdelSatar
 
Advanced Sql Injection ENG
Advanced Sql Injection ENGAdvanced Sql Injection ENG
Advanced Sql Injection ENG
Dmitry Evteev
 
SQL Injection - Mozilla Security Learning Center
SQL Injection - Mozilla Security Learning CenterSQL Injection - Mozilla Security Learning Center
SQL Injection - Mozilla Security Learning Center
Michael Coates
 
A Brief Introduction in SQL Injection
A Brief Introduction in SQL InjectionA Brief Introduction in SQL Injection
A Brief Introduction in SQL Injection
Sina Manavi
 

Mais procurados (20)

SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya MorimotoSQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
 
SQL injection prevention techniques
SQL injection prevention techniquesSQL injection prevention techniques
SQL injection prevention techniques
 
SQL Injection Defense in Python
SQL Injection Defense in PythonSQL Injection Defense in Python
SQL Injection Defense in Python
 
seminar report on Sql injection
seminar report on Sql injectionseminar report on Sql injection
seminar report on Sql injection
 
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
 
Advanced Sql Injection ENG
Advanced Sql Injection ENGAdvanced Sql Injection ENG
Advanced Sql Injection ENG
 
What is advanced SQL Injection? Infographic
What is advanced SQL Injection? InfographicWhat is advanced SQL Injection? Infographic
What is advanced SQL Injection? Infographic
 
SQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developersSQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developers
 
SQL Injection - Mozilla Security Learning Center
SQL Injection - Mozilla Security Learning CenterSQL Injection - Mozilla Security Learning Center
SQL Injection - Mozilla Security Learning Center
 
XSS And SQL Injection Vulnerabilities
XSS And SQL Injection VulnerabilitiesXSS And SQL Injection Vulnerabilities
XSS And SQL Injection Vulnerabilities
 
SQL Injection Attack Detection and Prevention Techniques to Secure Web-Site
SQL Injection Attack Detection and Prevention Techniques to Secure Web-SiteSQL Injection Attack Detection and Prevention Techniques to Secure Web-Site
SQL Injection Attack Detection and Prevention Techniques to Secure Web-Site
 
SQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationSQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint Presentation
 
What is SQL Injection Attack | How to prevent SQL Injection Attacks? | Cybers...
What is SQL Injection Attack | How to prevent SQL Injection Attacks? | Cybers...What is SQL Injection Attack | How to prevent SQL Injection Attacks? | Cybers...
What is SQL Injection Attack | How to prevent SQL Injection Attacks? | Cybers...
 
Sql Injection attacks and prevention
Sql Injection attacks and preventionSql Injection attacks and prevention
Sql Injection attacks and prevention
 
Sql injection
Sql injectionSql injection
Sql injection
 
Web application attacks using Sql injection and countermasures
Web application attacks using Sql injection and countermasuresWeb application attacks using Sql injection and countermasures
Web application attacks using Sql injection and countermasures
 
A Brief Introduction in SQL Injection
A Brief Introduction in SQL InjectionA Brief Introduction in SQL Injection
A Brief Introduction in SQL Injection
 
SQL Injection
SQL Injection SQL Injection
SQL Injection
 
Advanced SQL Injection
Advanced SQL InjectionAdvanced SQL Injection
Advanced SQL Injection
 
How To Detect Xss
How To Detect XssHow To Detect Xss
How To Detect Xss
 

Destaque

Destaque (7)

Evolution Of Web Security
Evolution Of Web SecurityEvolution Of Web Security
Evolution Of Web Security
 
Discovering the Value of Verifying Web Application Security Using IBM Rationa...
Discovering the Value of Verifying Web Application Security Using IBM Rationa...Discovering the Value of Verifying Web Application Security Using IBM Rationa...
Discovering the Value of Verifying Web Application Security Using IBM Rationa...
 
WEB APPLICATION VULNERABILITIES: DAWN, DETECTION, EXPLOITATION AND DEFENSE
WEB APPLICATION VULNERABILITIES: DAWN, DETECTION, EXPLOITATION AND DEFENSEWEB APPLICATION VULNERABILITIES: DAWN, DETECTION, EXPLOITATION AND DEFENSE
WEB APPLICATION VULNERABILITIES: DAWN, DETECTION, EXPLOITATION AND DEFENSE
 
Web Security
Web SecurityWeb Security
Web Security
 
NTXISSACSC4 - Layered Security / Defense in Depth
NTXISSACSC4 - Layered Security / Defense in DepthNTXISSACSC4 - Layered Security / Defense in Depth
NTXISSACSC4 - Layered Security / Defense in Depth
 
Application Security: Last Line of Defense
Application Security: Last Line of DefenseApplication Security: Last Line of Defense
Application Security: Last Line of Defense
 
IBM Security Software Solutions - Powerpoint
 IBM Security Software Solutions - Powerpoint IBM Security Software Solutions - Powerpoint
IBM Security Software Solutions - Powerpoint
 

Semelhante a Web Security attacks and defense

SecureWV: Exploiting Web APIs
SecureWV: Exploiting Web APIsSecureWV: Exploiting Web APIs
SecureWV: Exploiting Web APIs
ThreatReel Podcast
 
Mr. Mohammed Aldoub - A case study of django web applications that are secur...
Mr. Mohammed Aldoub  - A case study of django web applications that are secur...Mr. Mohammed Aldoub  - A case study of django web applications that are secur...
Mr. Mohammed Aldoub - A case study of django web applications that are secur...
nooralmousa
 
PwnSchool: Exploiting Web APIs
PwnSchool: Exploiting Web APIsPwnSchool: Exploiting Web APIs
PwnSchool: Exploiting Web APIs
ThreatReel Podcast
 
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.ppt
SilverGold16
 
Introduction To ICT Security Audit OWASP Day Malaysia 2011
Introduction To ICT Security Audit OWASP Day Malaysia 2011Introduction To ICT Security Audit OWASP Day Malaysia 2011
Introduction To ICT Security Audit OWASP Day Malaysia 2011
Linuxmalaysia Malaysia
 
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
Positive Hack Days
 

Semelhante a Web Security attacks and defense (20)

Owasp top 10 2013
Owasp top 10 2013Owasp top 10 2013
Owasp top 10 2013
 
Security .NET.pdf
Security .NET.pdfSecurity .NET.pdf
Security .NET.pdf
 
SecureWV: Exploiting Web APIs
SecureWV: Exploiting Web APIsSecureWV: Exploiting Web APIs
SecureWV: Exploiting Web APIs
 
Mr. Mohammed Aldoub - A case study of django web applications that are secur...
Mr. Mohammed Aldoub  - A case study of django web applications that are secur...Mr. Mohammed Aldoub  - A case study of django web applications that are secur...
Mr. Mohammed Aldoub - A case study of django web applications that are secur...
 
Case Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by DefaultCase Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by Default
 
Security Best Practices for Bot Builders
Security Best Practices for Bot BuildersSecurity Best Practices for Bot Builders
Security Best Practices for Bot Builders
 
Flipping the script
Flipping the scriptFlipping the script
Flipping the script
 
WordPress Security 101 – WordCamp Finland 2016 presentation by Otto Kekäläine...
WordPress Security 101 – WordCamp Finland 2016 presentation by Otto Kekäläine...WordPress Security 101 – WordCamp Finland 2016 presentation by Otto Kekäläine...
WordPress Security 101 – WordCamp Finland 2016 presentation by Otto Kekäläine...
 
Django (Web Applications that are Secure by Default)
Django �(Web Applications that are Secure by Default�)Django �(Web Applications that are Secure by Default�)
Django (Web Applications that are Secure by Default)
 
CiNPA Security SIG - Exploiting the Tiredful API
CiNPA Security SIG - Exploiting the Tiredful APICiNPA Security SIG - Exploiting the Tiredful API
CiNPA Security SIG - Exploiting the Tiredful API
 
Password Pusher Media Resources
Password Pusher Media ResourcesPassword Pusher Media Resources
Password Pusher Media Resources
 
Sql securitytesting
Sql  securitytestingSql  securitytesting
Sql securitytesting
 
PwnSchool: Exploiting Web APIs
PwnSchool: Exploiting Web APIsPwnSchool: Exploiting Web APIs
PwnSchool: Exploiting Web APIs
 
13.02 Network Security
13.02   Network Security13.02   Network Security
13.02 Network Security
 
Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)
 
How to hack or what is ethical hacking
How to hack or what is ethical hackingHow to hack or what is ethical hacking
How to hack or what is ethical hacking
 
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.ppt
 
Awareness Guide For Social Media Influencers - Influencers Meetup - CyberForg...
Awareness Guide For Social Media Influencers - Influencers Meetup - CyberForg...Awareness Guide For Social Media Influencers - Influencers Meetup - CyberForg...
Awareness Guide For Social Media Influencers - Influencers Meetup - CyberForg...
 
Introduction To ICT Security Audit OWASP Day Malaysia 2011
Introduction To ICT Security Audit OWASP Day Malaysia 2011Introduction To ICT Security Audit OWASP Day Malaysia 2011
Introduction To ICT Security Audit OWASP Day Malaysia 2011
 
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
 

Último

Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
raffaeleoman
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
Kayode Fayemi
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
Sheetaleventcompany
 

Último (20)

Air breathing and respiratory adaptations in diver animals
Air breathing and respiratory adaptations in diver animalsAir breathing and respiratory adaptations in diver animals
Air breathing and respiratory adaptations in diver animals
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyCall Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
 
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
 
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docxANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
 
Causes of poverty in France presentation.pptx
Causes of poverty in France presentation.pptxCauses of poverty in France presentation.pptx
Causes of poverty in France presentation.pptx
 
ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
SaaStr Workshop Wednesday w/ Lucas Price, Yardstick
SaaStr Workshop Wednesday w/ Lucas Price, YardstickSaaStr Workshop Wednesday w/ Lucas Price, Yardstick
SaaStr Workshop Wednesday w/ Lucas Price, Yardstick
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxMohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
 
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesVVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
 
Presentation on Engagement in Book Clubs
Presentation on Engagement in Book ClubsPresentation on Engagement in Book Clubs
Presentation on Engagement in Book Clubs
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
 
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
 

Web Security attacks and defense

  • 1. Web Security ● Jose Mato Mariño
  • 2. 3/5/15 - 12:52:45 AM Who am I? ● Web Developer ● Web security as hobby ● http://josemato.name ● @security4dev
  • 3. 3/5/15 - 12:52:46 AM Is mandatory know web security to do a web? ● YES, If someone hacks your your server... you, developer, are screwed – Read logs, …, a lot of logs – Sometimes is difficult know what was happening – Web security is easier than computer forensic ● Your client – Angry – Lost branding and reputation
  • 4. 3/5/15 - 12:52:46 AM Why cybercriminals want my server ??? ● SPAM ● BitCoins ● Phishing ● Botnet ● Ransomware ● Data theft
  • 5. 3/5/15 - 12:52:46 AM ● Online community dedicated to web application security ● Guide practices and recommendations to be considered secure application development ● OWASP TOP 10
  • 6. 3/5/15 - 12:52:46 AM OWASP TOP 10 – From 2010 to 2013
  • 7. 3/5/15 - 12:52:46 AM A3 – Cross Site Scripting (XSS) ● Problem: User injects code ( ActiveX, Java, VBScript, Flash, HTML but typically javascript) into webpage ● Attacks: – Access user session (session hijacking) – Redirect user to exploit kit (blackhole) – Defacement. Phishing. – Network ip + ports scanner ● We have 5 contexts to exploit XSS ● There are two types of XSS
  • 8. 3/5/15 - 12:52:46 AM A3 – XSS Context ● Context (by Ashar Javed @soaj1664ashar): "Context is an environment where user supplied input or input from other application(s) eventually ends-up or start living" ● Type of contexts: – HTML context (<title>XXS</title>) – Attribute context (input value=”XSS”) – Script context (<script>var a = “<?php echo XSS ?>”</script>) – URL context (write server variable to src, href, data flash, etc) – Style context (div style=”XSS” => custom editors)
  • 9. 3/5/15 - 12:52:46 AM ● Reflective – Code is not store on any database or database repo – Payload must be on get parameter (discussion) – User needs to click on a malicious link ● Persistent – Code is store on a persistent store (database) – When user enter on a hacked page, he will exec the xploit A3 – XSS Types
  • 10. 3/5/15 - 12:52:46 AM ● http://www.elmundo.es/elmundo/2010/01/04/union_europea/1262 610678.html A3 – Famous XSS “Mr. Bean 'se cuela' en la web oficial de la presidencia española”
  • 11. 3/5/15 - 12:52:47 AM XSS DEMO I ● Check if there is some XSS ● Get access to user account
  • 12. 3/5/15 - 12:52:47 AM ● Never trust on user input (inbound & outbound) ● Sanitize all inputs ● Enable flag httpOnly on cookies ● Content Security Policy (CSP) A3 – XSS Mitigation
  • 13. 3/5/15 - 12:52:47 AM ● Access to not allowed resources ● Application fail to check if user is authorized to access to the resource ● Common scenario: – http://websecurity-demo.local/transcript.php?student=1536 ● Attacker see a parameter and know that “1536” is his student id ● Attacker change this student id and get the content of another student ● This parameter could be anywhere (get, post, cookie, …) A4 – Insecure Direct Object References
  • 14. 3/5/15 - 12:52:47 AM ● Technique to alter queries into engine store through vulnerable application ● Mysql, MSQL, Postgres, LDAP, Access, Oracle, … ● We are going to focus on SQLi in this talk ● Many kind of SQLi A1 – Injection
  • 15. 3/5/15 - 12:52:47 AM ● Access personal data. Dump database ● Dump local users (/etc/passwd) ● Access organization CMS ● Site infection – malware propagation – Click abuse A1 – SQL Injection Goals
  • 16. 3/5/15 - 12:52:47 AM ● Lilupophilupop SQL Injection Attack Tops 1 Million Infected URLs – Search SQL Injection on ASP or ColdFusion pages with Microsoft SQL Server – More than one million url infected – the attackers used XSS Persistent to redirect users to pages showing fake computer issues to buy a fake AV ● http://threatpost.com/lilupophilupop-sql-injection-attack -tops-1-million-infected-urls-010412/76054 A1 – Famous SQL Injection I
  • 17. 3/5/15 - 12:52:47 AM ● Barr’s claims that he would unmask and extinguish Anonymous proved to be the proverbial last straw on the camel’s back. ● Anonymous find a SQL Injection: – http://www.hbgaryfederal.com/pages.php?pageNav=2&page= 27 ● Passwords were hashed but Aaron just used lower case and numbers. ● Access CMS. Social engineer to reset email password and access SSH. (Aaron used same password for many services!) ● http://arstechnica.com/tech-policy/2011/02/anonymous-speaks-the -inside-story-of-the-hbgary-hack/ A1 – Famous SQL Injection II
  • 18. 3/5/15 - 12:52:47 AM ● SQL Injection ● Blind SQLi – We only can use queries that retrieve a boolean value (true or false). – It's very slow – Binary search to enhance performance ● Time based SQLi – Based on heavy queries (sleep) – Very slow A1 – SQL Injection Types
  • 19. 3/5/15 - 12:52:47 AM ● Database engine has a metadata, catalog, schema or something like that ● This catalog stores all database metainformation (table relations, database exists, columns names with length + datatype, …) ● Is mandatory know the catalog of the vulnerable app to perform a pentesting A1 – SQL Injection Walkthrough I
  • 20. 3/5/15 - 12:52:47 AM ● Search vulnerability (test app request and check params) – Number of columns – Database names ● table names – Column names ● Dump or insert data ● Download files ● Upload webshell A1 – SQL Injection Walkthrough II
  • 21. 3/5/15 - 12:52:47 AM ● MySQL Catalog – Retrieve databases: SELECT schema_name FROM information_schema.SCHEMATA; – Retrieve tables from specific database: SELECT table_schema, table_name FROM information_schema.TABLES WHERE table_schema = 'DATABASE'; – Retrieve columns from specific table: SELECT column_name, column_type FROM information_schema.columns WHERE table_name = 'TABLE' AND table_schema = 'DATABASE'; A1 – SQL Injection Walkthrough III
  • 22. 3/5/15 - 12:52:47 AM A1 – SQL Injection Hacking Time :)
  • 23. 3/5/15 - 12:52:47 AM Some Question?? THANKS!! ● Jose Mato – http://josemato.name – @security4dev – https://github.com/josemato/ – https://www.linkedin.com/in/josematomarino