SlideShare una empresa de Scribd logo
1 de 34
Seattle PHP
Users Group:
Security
June 13th, 2013
Hello!
Andrew Sorensen
andrewsorensen.net
andrew@andrewsorensen.net
@AndrewX192
First, a few questions for you
1. Have you dealt with a successful attack on
your website?
2. Do you have a security response procedure
and development strategies to handle
security problems?
3. Do you have an intrusion detection system
or web application firewall deployed?
4. Are you using shared, managed, or
dedicated hosting?
A brief background
● PHP 5.2+ (2007)
● Zend Framework 1.x and some 2.x
● Sysadmin of Apache/Nginx/IIS production
systems at SMBs
● Main focus is security since about 2010.
● Intern at Leviathan Security Group (starting
June 17th).
Why web security?
Websites a prime target for evil doers,
because..
● Your website is available to anyone
● Your information is stored in one place
● Successful compromise of a single website
can be of value when comprising another
individual.
● There are plenty of problems for developers
to deal with, and it's difficult to implement
measures against all of them.
Scenario: Abusing program input
1. You expected an integer, but I gave you a
string.
2. But there's no way to be sure of it (weak
typing) without checking explicitly (filter_var)
3. And you forgot to check it
4. So now anyone can do something they
shouldn't be able to.
Program Input's the issue, sure
We know program input can break our
program, but what kind of input?
● Null or empty strings
● Out of range numeric types, overflow
● Datatype issues (string vs integer)
● Injection (SQL/XSS)
● Valid, but out of place (i.e.: direct object
reference)
But it's not just program input
Not all security issues result in a compromise
(or even any indication of a page being
accessed) on your server.
Example: What happens if someone uses the
back button after they log out of your website?
Example: what can I see by looking at the
network traffic?
So what's the problem anyway?
(Yes, another OWASP top 10):
● Injection
● Broken authentication
● Cross-site scripting
● Insecure direct object reference
● Security misconfiguration
● Sensitive data exposure
● Missing function level access control
● Cross site request forgery
● Using known vulnerable components
● Unvalidated redirects and forwards
SQL Injection with Robots
Fetch item number ____ from section ____ of rack number
____, and place it on the conveyor belt.
Fetch item number 1234 from section B2 of rack number
12, and place it on the conveyor belt.
Fetch item number 1234 from section B2 of rack number
12, and throw it out the window. Then go back to your
desk and ignore the rest of this form. and place it on the
conveyor belt.
https://github.com/search?p=3&q=extension%3Aphp+mysql_query+%24_GET&ref=searchresults&type=Code
Cross Site Scripting (XSS)
<input name="search" type="search" value="
test" onmouseover="alert('xss');"/>
If *one* page of your site has an XSS
vulnerability, chances are your entire site is at
risk.
Escaping is great, if you can remember to do it
*everywhere* and you don't require rich text.
Cross site request forgery
Hello bank.com, Hello! I'm evil.com and I'd like
to send this information under the currently
logged in user? Oh sure. I'll handle that.
Solution: Use a CSRF token on every form
Better yet, find a framework or library (like
ZendForm) that will enforce this policy.
SSL: What could go wrong?
● Login pages (including the page hosting the
form) must be secured
● Never include insecure resources on a
secure page (use "//example.com/example.
js").
● Beware of third-party widgets on secure
sections of your site
● Protect against downgrade attacks
● If you can, implement Strict-Transport-
Security
"We're not storing credit cards"
Are you sure? Are you storing this information
in PHP sessions?
What can you do to protect your
site?
There's a lot of ways an attacker can ruin your
site, but fortunately there's a lot you can do to
stop them.
The big problem is understanding the risks and
implementing appropriate measures to protect
your site.
Web Application Firewalls
● Generally ineffective against motivated
attackers
● "Great" at catching automated tools
● Depending on your application, might be
worth deploying, though they can break
normal functionality if deployed incorrectly or
without adequate testing
● Some only detect problems, and don't block
them
● False positives can lead to a poor user
experience.
apache2 mod_security
mod_security is a apache module that provides
filtering (blocking) and logging of potential
attacks
Even if you don't use it to stop attacks, it's great
to have some idea of what's happening on your
site.
Directory Permissions
● Only grant read access to your code from
the apache user
● Store all user data outside of the webroot,
and make sure it cannot be executed.
● Set open_basedir.
Beware of that "edit theme" or "edit code"
feature in your favorite content management
system
Administrative portals
If you don't need the public to be able to get
them, secure beyond the application's built in
authentication measures.
This could include a different virtualhost to
access the administrative interface, or some
other form of authentication.
Backup files in webroot
[user@host config] ls
config.php.bak config.php
Solution: don't edit files on your production
server, turn off creating backup files, or add
appropriate access controls to prevent these
files from being accessed.
Default setup files
Some programs are secure, but their setup files
include many security issues (phpmyadmin).
Solution: Delete them!
Bonus: if you're using shared hosting, make
sure they don't have any of their own programs
Implement the right HTTP Headers
● X-Content-Type-Options
Stop the browser from detecting the type of
document (XSS)
● X-XSS-Protection
Activates IE8's XSS protection
● X-Frame-Options
Helps prevent clickjacking
● Cache-Control
Prevent browsers (and proxies) from storing
sensitive information
Use HTML5 Effectively
HTML5 adds a lof new functionality to the
existing HTML standard... and breaks your XSS
protections (actually they were broken already).
Make use of the new HTML5 security features
and do away with your filters (hint: Content
Security Policy)
Know what your browser(s) do:
http://html5sec.org/
Implement HTML5 Content Security
Policy!
Idea: HTML filters won't catch everything, so
let's create a whitelist of resources.
This policy allows images, scripts, AJAX, and CSS from the
same origin, and does not allow any other resources to
load (eg object, frame, media, etc). It is a good starting
point for many sites.
default-src 'none'; script-src 'self'; connect-src:
'self'; img-src: 'self'; style-src: 'self';
Watch for updates
● 5.3.12, 5.3.13 and 5.3.14 - a 8 year old
security issue was discovered.
● "Top WordPress sites vulnerable 6 weeks
after plugin patch released"
● Sometimes Zend Server has patches ahead
of the official PHP release. Find out what
your vendor's update policy is.
● Subscribe to mailing lists to get proper
notification of updates.
Setup a Honeypot
Idea: set up some paths that are not part of
your site that immediately alert you to activity
Example (in robots.txt):
Disallow: /my_cool_administrator
If you don't use /my_cool_administrator, then
the only people going to it would be bots... that
purposefully misuse robots.txt
What tools do the attackers use?
Just to name a few:
● Nessus
● sqlmap
● w3af
● OWASP ZAP
● WPScan
● Metasploit Framework
● Beef Framework
● burp suite
All of these tools are straightforward to use. A
little bit of experience can get you insight on the
security of your website
Let's look at the tooks attackers use
https://addons.mozilla.org/en-us/firefox/addon/export-cookies/
1. Most of the tools require the cookies of an
already logged in user to perform
authentication, through a mozilla "cookie jar"
file.
2. Rather than downloading all of the
previously mentioned tools, you can
download Kali Linux or OWASP WTE and
get up and ready to go in a few minutes.
Some notes on using tools
Before you use the tool, read the
README
Don't end up like this (via securityreactions)
Where to go from here
● Familiarize yourself with the OWASP top 10
● Be aware of any security issues in your
libraries. Do they assume data is already
secure, or do they handle it for you?
● Create a software development strategy for
trusted or untrusted data, and the point
where it transitions from one to the other.
● Setup appropriate logging setup to
determine the outcome of a successful
attack
● Secure your server to slow down attackers
Where to go from here
● Ask for help when you're unsure (security.
stackexchange.com)
● Have someone else audit your site
● Find out what security features the other top
sites are using (like content security policy).
● Subscribe to security mailing list(s)
● Attend the Mozilla Training next week
● Check out the OWASP Meetup Group
Questions?
Thanks!
Andrew Sorensen
andrewsorensen.net
andrew@andrewsorensen.net
@AndrewX192

Más contenido relacionado

La actualidad más candente

Scaling-up and Automating Web Application Security Tech Talk
Scaling-up and Automating Web Application Security Tech TalkScaling-up and Automating Web Application Security Tech Talk
Scaling-up and Automating Web Application Security Tech TalkNetsparker
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practicesNeoito
 
Introduction to Metasploit
Introduction to MetasploitIntroduction to Metasploit
Introduction to MetasploitGTU
 
Introduction to metasploit
Introduction to metasploitIntroduction to metasploit
Introduction to metasploitGTU
 
Web Application Security with PHP
Web Application Security with PHPWeb Application Security with PHP
Web Application Security with PHPjikbal
 
Understanding CryptoLocker (Ransomware) with a Case Study
Understanding CryptoLocker (Ransomware) with a Case StudyUnderstanding CryptoLocker (Ransomware) with a Case Study
Understanding CryptoLocker (Ransomware) with a Case Studysecurityxploded
 
When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014Anant Shrivastava
 
The art of android hacking
The art of  android hackingThe art of  android hacking
The art of android hackingAbhinav Mishra
 
Threat Modeling for Web Applications (and other duties as assigned)
Threat Modeling for Web Applications (and other duties as assigned)Threat Modeling for Web Applications (and other duties as assigned)
Threat Modeling for Web Applications (and other duties as assigned)Mike Tetreault
 
Getting Started With Hacking Android & iOS Apps? Tools, Techniques and resources
Getting Started With Hacking Android & iOS Apps? Tools, Techniques and resourcesGetting Started With Hacking Android & iOS Apps? Tools, Techniques and resources
Getting Started With Hacking Android & iOS Apps? Tools, Techniques and resourcesOWASP Delhi
 
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014Anant Shrivastava
 
.NET Security Topics
.NET Security Topics.NET Security Topics
.NET Security TopicsShawn Gorrell
 
Security hardening and drown attack prevention for mobile backend developers
Security hardening and drown attack prevention for mobile backend developersSecurity hardening and drown attack prevention for mobile backend developers
Security hardening and drown attack prevention for mobile backend developersJiri Danihelka
 
(ISC)2 Cincinnati Tri-State Chapter: Phishing Forensics - Is it just suspicio...
(ISC)2 Cincinnati Tri-State Chapter: Phishing Forensics - Is it just suspicio...(ISC)2 Cincinnati Tri-State Chapter: Phishing Forensics - Is it just suspicio...
(ISC)2 Cincinnati Tri-State Chapter: Phishing Forensics - Is it just suspicio...CiNPA Security SIG
 
NIC 2017 - Attack and detection in Windows Environments
NIC 2017 - Attack and detection in Windows EnvironmentsNIC 2017 - Attack and detection in Windows Environments
NIC 2017 - Attack and detection in Windows EnvironmentsOddvar Moe
 
Application Security Tools
Application Security ToolsApplication Security Tools
Application Security ToolsLalit Kale
 
Malware Evasion Techniques
Malware Evasion TechniquesMalware Evasion Techniques
Malware Evasion TechniquesThomas Roccia
 
BSides Indianapolis: Phishing Forensics - Is it just suspicious or is it mali...
BSides Indianapolis: Phishing Forensics - Is it just suspicious or is it mali...BSides Indianapolis: Phishing Forensics - Is it just suspicious or is it mali...
BSides Indianapolis: Phishing Forensics - Is it just suspicious or is it mali...CiNPA Security SIG
 

La actualidad más candente (20)

Scaling-up and Automating Web Application Security Tech Talk
Scaling-up and Automating Web Application Security Tech TalkScaling-up and Automating Web Application Security Tech Talk
Scaling-up and Automating Web Application Security Tech Talk
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practices
 
Introduction to Metasploit
Introduction to MetasploitIntroduction to Metasploit
Introduction to Metasploit
 
Introduction to metasploit
Introduction to metasploitIntroduction to metasploit
Introduction to metasploit
 
Web Application Security with PHP
Web Application Security with PHPWeb Application Security with PHP
Web Application Security with PHP
 
Security fundamentals
Security fundamentals Security fundamentals
Security fundamentals
 
Understanding CryptoLocker (Ransomware) with a Case Study
Understanding CryptoLocker (Ransomware) with a Case StudyUnderstanding CryptoLocker (Ransomware) with a Case Study
Understanding CryptoLocker (Ransomware) with a Case Study
 
When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014
 
The art of android hacking
The art of  android hackingThe art of  android hacking
The art of android hacking
 
Threat Modeling for Web Applications (and other duties as assigned)
Threat Modeling for Web Applications (and other duties as assigned)Threat Modeling for Web Applications (and other duties as assigned)
Threat Modeling for Web Applications (and other duties as assigned)
 
Real life hacking101
Real life hacking101Real life hacking101
Real life hacking101
 
Getting Started With Hacking Android & iOS Apps? Tools, Techniques and resources
Getting Started With Hacking Android & iOS Apps? Tools, Techniques and resourcesGetting Started With Hacking Android & iOS Apps? Tools, Techniques and resources
Getting Started With Hacking Android & iOS Apps? Tools, Techniques and resources
 
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
 
.NET Security Topics
.NET Security Topics.NET Security Topics
.NET Security Topics
 
Security hardening and drown attack prevention for mobile backend developers
Security hardening and drown attack prevention for mobile backend developersSecurity hardening and drown attack prevention for mobile backend developers
Security hardening and drown attack prevention for mobile backend developers
 
(ISC)2 Cincinnati Tri-State Chapter: Phishing Forensics - Is it just suspicio...
(ISC)2 Cincinnati Tri-State Chapter: Phishing Forensics - Is it just suspicio...(ISC)2 Cincinnati Tri-State Chapter: Phishing Forensics - Is it just suspicio...
(ISC)2 Cincinnati Tri-State Chapter: Phishing Forensics - Is it just suspicio...
 
NIC 2017 - Attack and detection in Windows Environments
NIC 2017 - Attack and detection in Windows EnvironmentsNIC 2017 - Attack and detection in Windows Environments
NIC 2017 - Attack and detection in Windows Environments
 
Application Security Tools
Application Security ToolsApplication Security Tools
Application Security Tools
 
Malware Evasion Techniques
Malware Evasion TechniquesMalware Evasion Techniques
Malware Evasion Techniques
 
BSides Indianapolis: Phishing Forensics - Is it just suspicious or is it mali...
BSides Indianapolis: Phishing Forensics - Is it just suspicious or is it mali...BSides Indianapolis: Phishing Forensics - Is it just suspicious or is it mali...
BSides Indianapolis: Phishing Forensics - Is it just suspicious or is it mali...
 

Similar a Web Security: What's wrong, and how the bad guys can break your website

CISSP Week 14
CISSP Week 14CISSP Week 14
CISSP Week 14jemtallon
 
Finalppt metasploit
Finalppt metasploitFinalppt metasploit
Finalppt metasploitdevilback
 
Survey Presentation About Application Security
Survey Presentation About Application SecuritySurvey Presentation About Application Security
Survey Presentation About Application SecurityNicholas Davis
 
Secure programming with php
Secure programming with phpSecure programming with php
Secure programming with phpMohmad Feroz
 
Break it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure softwareBreak it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure softwareLeigh Honeywell
 
Drupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January MeetupDrupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January MeetupChris Hales
 
Metasploit Computer security testing tool
Metasploit  Computer security testing toolMetasploit  Computer security testing tool
Metasploit Computer security testing toolmedoelkang600
 
Security engineering 101 when good design & security work together
Security engineering 101  when good design & security work togetherSecurity engineering 101  when good design & security work together
Security engineering 101 when good design & security work togetherWendy Knox Everette
 
How to Secure Web Apps — A Web App Security Checklist
How to Secure Web Apps — A Web App Security ChecklistHow to Secure Web Apps — A Web App Security Checklist
How to Secure Web Apps — A Web App Security ChecklistPixel Crayons
 
FBI & Secret Service- Business Email Compromise Workshop
FBI & Secret Service- Business Email Compromise WorkshopFBI & Secret Service- Business Email Compromise Workshop
FBI & Secret Service- Business Email Compromise WorkshopErnest Staats
 
Google Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docxGoogle Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docxwhittemorelucilla
 
Dev and Blind - Attacking the weakest Link in IT Security
Dev and Blind - Attacking the weakest Link in IT SecurityDev and Blind - Attacking the weakest Link in IT Security
Dev and Blind - Attacking the weakest Link in IT SecurityMario Heiderich
 
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 DefaultMohammed ALDOUB
 
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
 
Security .NET.pdf
Security .NET.pdfSecurity .NET.pdf
Security .NET.pdfAbhi Jain
 
Shields up - improving web application security
Shields up - improving web application securityShields up - improving web application security
Shields up - improving web application securityKonstantin Mirin
 
Basics of getting Into Bug Bounty Hunting
Basics of getting Into Bug Bounty HuntingBasics of getting Into Bug Bounty Hunting
Basics of getting Into Bug Bounty HuntingMuhammad Khizer Javed
 
10 Best DevSecOps Tools for 2023
10 Best DevSecOps Tools for 202310 Best DevSecOps Tools for 2023
10 Best DevSecOps Tools for 2023SofiaCarter4
 

Similar a Web Security: What's wrong, and how the bad guys can break your website (20)

CISSP Week 14
CISSP Week 14CISSP Week 14
CISSP Week 14
 
Finalppt metasploit
Finalppt metasploitFinalppt metasploit
Finalppt metasploit
 
Survey Presentation About Application Security
Survey Presentation About Application SecuritySurvey Presentation About Application Security
Survey Presentation About Application Security
 
Secure programming with php
Secure programming with phpSecure programming with php
Secure programming with php
 
Break it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure softwareBreak it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure software
 
Drupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January MeetupDrupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January Meetup
 
App locker
App lockerApp locker
App locker
 
Metasploit Computer security testing tool
Metasploit  Computer security testing toolMetasploit  Computer security testing tool
Metasploit Computer security testing tool
 
Security engineering 101 when good design & security work together
Security engineering 101  when good design & security work togetherSecurity engineering 101  when good design & security work together
Security engineering 101 when good design & security work together
 
How to Secure Web Apps — A Web App Security Checklist
How to Secure Web Apps — A Web App Security ChecklistHow to Secure Web Apps — A Web App Security Checklist
How to Secure Web Apps — A Web App Security Checklist
 
DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019
 
FBI & Secret Service- Business Email Compromise Workshop
FBI & Secret Service- Business Email Compromise WorkshopFBI & Secret Service- Business Email Compromise Workshop
FBI & Secret Service- Business Email Compromise Workshop
 
Google Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docxGoogle Hacking Lab ClassNameDate This is an introducti.docx
Google Hacking Lab ClassNameDate This is an introducti.docx
 
Dev and Blind - Attacking the weakest Link in IT Security
Dev and Blind - Attacking the weakest Link in IT SecurityDev and Blind - Attacking the weakest Link in IT Security
Dev and Blind - Attacking the weakest Link in IT Security
 
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
 
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...
 
Security .NET.pdf
Security .NET.pdfSecurity .NET.pdf
Security .NET.pdf
 
Shields up - improving web application security
Shields up - improving web application securityShields up - improving web application security
Shields up - improving web application security
 
Basics of getting Into Bug Bounty Hunting
Basics of getting Into Bug Bounty HuntingBasics of getting Into Bug Bounty Hunting
Basics of getting Into Bug Bounty Hunting
 
10 Best DevSecOps Tools for 2023
10 Best DevSecOps Tools for 202310 Best DevSecOps Tools for 2023
10 Best DevSecOps Tools for 2023
 

Último

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Último (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Web Security: What's wrong, and how the bad guys can break your website

  • 3. First, a few questions for you 1. Have you dealt with a successful attack on your website? 2. Do you have a security response procedure and development strategies to handle security problems? 3. Do you have an intrusion detection system or web application firewall deployed? 4. Are you using shared, managed, or dedicated hosting?
  • 4. A brief background ● PHP 5.2+ (2007) ● Zend Framework 1.x and some 2.x ● Sysadmin of Apache/Nginx/IIS production systems at SMBs ● Main focus is security since about 2010. ● Intern at Leviathan Security Group (starting June 17th).
  • 5. Why web security? Websites a prime target for evil doers, because.. ● Your website is available to anyone ● Your information is stored in one place ● Successful compromise of a single website can be of value when comprising another individual. ● There are plenty of problems for developers to deal with, and it's difficult to implement measures against all of them.
  • 6. Scenario: Abusing program input 1. You expected an integer, but I gave you a string. 2. But there's no way to be sure of it (weak typing) without checking explicitly (filter_var) 3. And you forgot to check it 4. So now anyone can do something they shouldn't be able to.
  • 7. Program Input's the issue, sure We know program input can break our program, but what kind of input? ● Null or empty strings ● Out of range numeric types, overflow ● Datatype issues (string vs integer) ● Injection (SQL/XSS) ● Valid, but out of place (i.e.: direct object reference)
  • 8. But it's not just program input Not all security issues result in a compromise (or even any indication of a page being accessed) on your server. Example: What happens if someone uses the back button after they log out of your website? Example: what can I see by looking at the network traffic?
  • 9. So what's the problem anyway? (Yes, another OWASP top 10): ● Injection ● Broken authentication ● Cross-site scripting ● Insecure direct object reference ● Security misconfiguration ● Sensitive data exposure ● Missing function level access control ● Cross site request forgery ● Using known vulnerable components ● Unvalidated redirects and forwards
  • 10. SQL Injection with Robots Fetch item number ____ from section ____ of rack number ____, and place it on the conveyor belt. Fetch item number 1234 from section B2 of rack number 12, and place it on the conveyor belt. Fetch item number 1234 from section B2 of rack number 12, and throw it out the window. Then go back to your desk and ignore the rest of this form. and place it on the conveyor belt. https://github.com/search?p=3&q=extension%3Aphp+mysql_query+%24_GET&ref=searchresults&type=Code
  • 11. Cross Site Scripting (XSS) <input name="search" type="search" value=" test" onmouseover="alert('xss');"/> If *one* page of your site has an XSS vulnerability, chances are your entire site is at risk. Escaping is great, if you can remember to do it *everywhere* and you don't require rich text.
  • 12. Cross site request forgery Hello bank.com, Hello! I'm evil.com and I'd like to send this information under the currently logged in user? Oh sure. I'll handle that. Solution: Use a CSRF token on every form Better yet, find a framework or library (like ZendForm) that will enforce this policy.
  • 13. SSL: What could go wrong? ● Login pages (including the page hosting the form) must be secured ● Never include insecure resources on a secure page (use "//example.com/example. js"). ● Beware of third-party widgets on secure sections of your site ● Protect against downgrade attacks ● If you can, implement Strict-Transport- Security
  • 14. "We're not storing credit cards" Are you sure? Are you storing this information in PHP sessions?
  • 15. What can you do to protect your site? There's a lot of ways an attacker can ruin your site, but fortunately there's a lot you can do to stop them. The big problem is understanding the risks and implementing appropriate measures to protect your site.
  • 16. Web Application Firewalls ● Generally ineffective against motivated attackers ● "Great" at catching automated tools ● Depending on your application, might be worth deploying, though they can break normal functionality if deployed incorrectly or without adequate testing ● Some only detect problems, and don't block them ● False positives can lead to a poor user experience.
  • 17. apache2 mod_security mod_security is a apache module that provides filtering (blocking) and logging of potential attacks Even if you don't use it to stop attacks, it's great to have some idea of what's happening on your site.
  • 18. Directory Permissions ● Only grant read access to your code from the apache user ● Store all user data outside of the webroot, and make sure it cannot be executed. ● Set open_basedir. Beware of that "edit theme" or "edit code" feature in your favorite content management system
  • 19. Administrative portals If you don't need the public to be able to get them, secure beyond the application's built in authentication measures. This could include a different virtualhost to access the administrative interface, or some other form of authentication.
  • 20. Backup files in webroot [user@host config] ls config.php.bak config.php Solution: don't edit files on your production server, turn off creating backup files, or add appropriate access controls to prevent these files from being accessed.
  • 21. Default setup files Some programs are secure, but their setup files include many security issues (phpmyadmin). Solution: Delete them! Bonus: if you're using shared hosting, make sure they don't have any of their own programs
  • 22. Implement the right HTTP Headers ● X-Content-Type-Options Stop the browser from detecting the type of document (XSS) ● X-XSS-Protection Activates IE8's XSS protection ● X-Frame-Options Helps prevent clickjacking ● Cache-Control Prevent browsers (and proxies) from storing sensitive information
  • 23. Use HTML5 Effectively HTML5 adds a lof new functionality to the existing HTML standard... and breaks your XSS protections (actually they were broken already). Make use of the new HTML5 security features and do away with your filters (hint: Content Security Policy) Know what your browser(s) do: http://html5sec.org/
  • 24. Implement HTML5 Content Security Policy! Idea: HTML filters won't catch everything, so let's create a whitelist of resources. This policy allows images, scripts, AJAX, and CSS from the same origin, and does not allow any other resources to load (eg object, frame, media, etc). It is a good starting point for many sites. default-src 'none'; script-src 'self'; connect-src: 'self'; img-src: 'self'; style-src: 'self';
  • 25. Watch for updates ● 5.3.12, 5.3.13 and 5.3.14 - a 8 year old security issue was discovered. ● "Top WordPress sites vulnerable 6 weeks after plugin patch released" ● Sometimes Zend Server has patches ahead of the official PHP release. Find out what your vendor's update policy is. ● Subscribe to mailing lists to get proper notification of updates.
  • 26. Setup a Honeypot Idea: set up some paths that are not part of your site that immediately alert you to activity Example (in robots.txt): Disallow: /my_cool_administrator If you don't use /my_cool_administrator, then the only people going to it would be bots... that purposefully misuse robots.txt
  • 27. What tools do the attackers use? Just to name a few: ● Nessus ● sqlmap ● w3af ● OWASP ZAP ● WPScan ● Metasploit Framework ● Beef Framework ● burp suite All of these tools are straightforward to use. A little bit of experience can get you insight on the security of your website
  • 28. Let's look at the tooks attackers use
  • 29. https://addons.mozilla.org/en-us/firefox/addon/export-cookies/ 1. Most of the tools require the cookies of an already logged in user to perform authentication, through a mozilla "cookie jar" file. 2. Rather than downloading all of the previously mentioned tools, you can download Kali Linux or OWASP WTE and get up and ready to go in a few minutes. Some notes on using tools
  • 30. Before you use the tool, read the README Don't end up like this (via securityreactions)
  • 31. Where to go from here ● Familiarize yourself with the OWASP top 10 ● Be aware of any security issues in your libraries. Do they assume data is already secure, or do they handle it for you? ● Create a software development strategy for trusted or untrusted data, and the point where it transitions from one to the other. ● Setup appropriate logging setup to determine the outcome of a successful attack ● Secure your server to slow down attackers
  • 32. Where to go from here ● Ask for help when you're unsure (security. stackexchange.com) ● Have someone else audit your site ● Find out what security features the other top sites are using (like content security policy). ● Subscribe to security mailing list(s) ● Attend the Mozilla Training next week ● Check out the OWASP Meetup Group