SlideShare uma empresa Scribd logo
1 de 33
WRITING SECURE CODE
TIMOTHY BOLTON
A Briefer History of Tim
Lots of experience coding
Lots of experience writing insecure code
Focus on PCI Compliance w.r.t. Coding
Overview
Concepts
Attacks and Mitigations
Incidence Handling
Using this in your daily life
Concepts
General security expectations
Confidentiality of data
Integrity of data
Availability of data
Defense in depth
Permission
Concepts
Confidentiality
Think “data leaks”, unprotected directories, access
control exploits.
Integrity
Data tampering, Man in the browser attacks
Availability
DoS style attacks
Defense In Depth
Layered approaches work well
Use security where it makes sense to use it
Use file system permissions for directories
Use a WAF
Use database access control (GRANT ALL???)
Diagram the moving parts, sensitive data,
and see where points of entry exist.
Defense In Depth
Least-privilege principle
Layering of Access-control
URL based access-control
File system & Server permissions
Application (business logic)
Data layer
Application Layer
Attacks and Midichlorians
We will focus on three types of attacks
Cross Site Scripting
Cross Site Request Forgery
SQL Injection
There are obviously many more, this is a
small introduction.
XSS
Exploits the trust a USER has for a site
A basic attack is going to insert some
JavaScript in the page.
Cross Site Scripting (XSS)
Persistent
Reflected
DOM
Reflected Example
Coupons, coupons, coupons!
Parameters from GET directly generating
content on the page.
Mitigation
Validate user input
Encode output (mvte instead of mvt)
Miva does this with some fields already to
mitigate against XSS Persistence attacks
Usually this is a case by case basis for how to
properly care for data and user-interaction.
Cross Site Request Forgery (CSRF)
Exploits the trust a SITE has for a browser.
All browsers are vulnerable to CSRF attacks
You see these attacks in:
XMLHttpRequests
Iframes
Image tags
Script tags
CSRF Attacks
DDoS
Bandwidth Consumption
Computationally expensive requests
Unauthorized Actions
Form submission
Images with malicious parameters
CSRF Attack Mitigation
Use POST instead of GET for forms
Miva is a bit different here..
Not bullet-proof by any means
Use Anti-CSRF tokens
Regular Session Timeouts
Check HTTP Referrer
CAPTCHA
Flow Control
Anti-CSRF Tokens
It's just a simple 62 step process.
Create an element on a form which is
required.
This element is unique and not known
Must be present on form submission
CSRF Mitigation Chart
Slight Help Weak Medium Hulk Smash
Using POST *
Timeout *
HTTP
Referrer
* *
CAPTCHA * * * *
Flow Control * *
Anti-CSRF
Tokens
* * * *
Difference Betwixt XSS and CSRF
XSS – Exploits the trust a USER has with a site
CSRF – Exploits the trust a SITE has with a
browser
XSS & CSRF
XSS and CSRF are the “Clinton's” of Security
Exploit Partnerships
Look at your inputs, look at your outputs,
look at your logs. See where attacks are
coming from.
SQL Injection
MivaScript has parameterization built in.
That doesn't always mean people use it.
30% of sites in PCI Audits still have exposed
SQL Injection vulnerabilities
Custom module development, and greater
access to lower level functionality bring this
back to the surface.
What is SQL Injection
username=tim
username=tim' OR 1=1; –
?page=9
?page=8+1
What can SQL Injection do?
Changing existing SQL queries
Extract data from the database
Alter data and structure of database
Control the host running the database, move
to other hosts on the network
Get webshells on board
SQL Injection Attacks
Non-blind SQL Injection
Error messages help clue you in to what is happening
behind the scenes.
Blind SQL Injection
Use a “Yes” or “No” approach.
“Yes” or “No” can also be determined via response time
if no visual output
More difficult for the attacker, as there aren’t error
messages helping them.
Testing with Blind SQL Injections:
http://target.com/search.php?product=10
Triggers our baseline “true” – Showing us product 10
http://target.com/search.php?product=10’
SQL Injection Attack Scenarios
Putting a webshell on board
http://target.com/search.php?query=‘
UNION SELECT “<?php
system($_REQUEST[‘cmd’]);?>” INTO OUTFILE
‘/var/www/test/shell.php’ --
Getting file contents
http://target.com/search.php?query=‘
UNION SELECT 1, load_file(/etc/passwd) --
Dropping Tables
http://target.com/search.php?query=‘ ;
SQL Attack Mitigation
Set up different SQL users with different
grants, and use them when performing that
type of query.
Sometimes using Stored Procedures makes
sense.
Monitor SQL outbound connections
Turn off error messages from SQL
Title
Parameterize your queries
If you can’t then use mysql_escape_string around user-
generated input
When it makes sense:
Only allow “known good” input
Reject bad input
This is hard to do consistently:
Bill Stinkface lives on 123 Union St.,
Chesapeake Drop, OR.
Incidence Handling
Remember Uncle Scar.. be prepared
Monitor and detect
Containment
Eradication
Restoration
What was learned?
Incidence Handling
Have a plan
Know who owns what project
Talk to those who are affected
Daily Life
Implement Code Reviews
Get a WAF (web application firewall)
Security at design
Do not use weak hashing algorithms
Use unique salted hashes
Use SSL for every page
Daily Life
Before going into production, do some pen
testing in QA
Use HSTS (HTTP Strict Transport Security)
Join the list
https://hstspreload.appspot.com/
Cut down your surface area of attack by
hardening your server
Daily Life
Set up a web application testing framework
Run incidence response scenarios
Use Anti-CSRF Tokens for forms
One Page Take Home
The order of operations for user-input and
data validation
Client side validation
Web Application Firewall (WAF)
Anti-CSRF Tokens
Validation within code
Customized validation for persistence layer
PRESENTER’S NAME

Mais conteúdo relacionado

Mais procurados

PCI security requirements secure coding and code review 2014
PCI security requirements   secure coding and code review 2014PCI security requirements   secure coding and code review 2014
PCI security requirements secure coding and code review 2014
Haitham Raik
 
Web Application Firewall intro
Web Application Firewall introWeb Application Firewall intro
Web Application Firewall intro
Rich Helton
 
OWASP Khartoum Top 10 A3 - 6th meeting
OWASP Khartoum   Top 10 A3 - 6th meetingOWASP Khartoum   Top 10 A3 - 6th meeting
OWASP Khartoum Top 10 A3 - 6th meeting
OWASP Khartoum
 

Mais procurados (20)

A2 - broken authentication and session management(OWASP thailand chapter Apri...
A2 - broken authentication and session management(OWASP thailand chapter Apri...A2 - broken authentication and session management(OWASP thailand chapter Apri...
A2 - broken authentication and session management(OWASP thailand chapter Apri...
 
.NET Security Topics
.NET Security Topics.NET Security Topics
.NET Security Topics
 
Web application security
Web application securityWeb application security
Web application security
 
Secure code practices
Secure code practicesSecure code practices
Secure code practices
 
Діана Пінчук "Як відрізнити авторизацію від аутентифікації та перестати бояти...
Діана Пінчук "Як відрізнити авторизацію від аутентифікації та перестати бояти...Діана Пінчук "Як відрізнити авторизацію від аутентифікації та перестати бояти...
Діана Пінчук "Як відрізнити авторизацію від аутентифікації та перестати бояти...
 
PCI security requirements secure coding and code review 2014
PCI security requirements   secure coding and code review 2014PCI security requirements   secure coding and code review 2014
PCI security requirements secure coding and code review 2014
 
[DevDay2018] Security Testing - By Thuy Nguyen, Software Engineer at Axon Act...
[DevDay2018] Security Testing - By Thuy Nguyen, Software Engineer at Axon Act...[DevDay2018] Security Testing - By Thuy Nguyen, Software Engineer at Axon Act...
[DevDay2018] Security Testing - By Thuy Nguyen, Software Engineer at Axon Act...
 
OWASPTop 10
OWASPTop 10OWASPTop 10
OWASPTop 10
 
Owasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOwasp top 10 vulnerabilities
Owasp top 10 vulnerabilities
 
Security-testing presentation
Security-testing presentationSecurity-testing presentation
Security-testing presentation
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)
 
Web application attacks
Web application attacksWeb application attacks
Web application attacks
 
Web Application Firewall intro
Web Application Firewall introWeb Application Firewall intro
Web Application Firewall intro
 
Why You Need A Web Application Firewall
Why You Need A Web Application FirewallWhy You Need A Web Application Firewall
Why You Need A Web Application Firewall
 
Owasp webgoat
Owasp webgoatOwasp webgoat
Owasp webgoat
 
Web Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedWeb Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or Succeed
 
Spring Security 3
Spring Security 3Spring Security 3
Spring Security 3
 
Microsoft Fakes, Unit Testing the (almost) Untestable Code
Microsoft Fakes, Unit Testing the (almost) Untestable CodeMicrosoft Fakes, Unit Testing the (almost) Untestable Code
Microsoft Fakes, Unit Testing the (almost) Untestable Code
 
OWASP Khartoum Top 10 A3 - 6th meeting
OWASP Khartoum   Top 10 A3 - 6th meetingOWASP Khartoum   Top 10 A3 - 6th meeting
OWASP Khartoum Top 10 A3 - 6th meeting
 
Security asp.net application
Security asp.net applicationSecurity asp.net application
Security asp.net application
 

Semelhante a Pci compliance writing secure code

OWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root CausesOWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root Causes
Marco Morana
 
Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Jayasree Veliyath
 
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
Leigh Honeywell
 
SalemPhilip_ResearchReport
SalemPhilip_ResearchReportSalemPhilip_ResearchReport
SalemPhilip_ResearchReport
Philip Salem
 
Web Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok ChernWeb Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok Chern
Quek Lilian
 
Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009
mirahman
 

Semelhante a Pci compliance writing secure code (20)

ASP.NET Web Security
ASP.NET Web SecurityASP.NET Web Security
ASP.NET Web Security
 
Application and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionApplication and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental Edition
 
OWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root CausesOWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root Causes
 
Security In PHP Applications
Security In PHP ApplicationsSecurity In PHP Applications
Security In PHP Applications
 
Protecting Your Web Site From SQL Injection & XSS
Protecting Your Web SiteFrom SQL Injection & XSSProtecting Your Web SiteFrom SQL Injection & XSS
Protecting Your Web Site From SQL Injection & XSS
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application Security
 
ieee
ieeeieee
ieee
 
Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013
 
Prevention of SQL Injection Attack in Web Application with Host Language
Prevention of SQL Injection Attack in Web Application with Host LanguagePrevention of SQL Injection Attack in Web Application with Host Language
Prevention of SQL Injection Attack in Web Application with Host Language
 
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
 
Web Security - OWASP - SQL injection & Cross Site Scripting XSS
Web Security - OWASP - SQL injection & Cross Site Scripting XSSWeb Security - OWASP - SQL injection & Cross Site Scripting XSS
Web Security - OWASP - SQL injection & Cross Site Scripting XSS
 
Jan 2008 Allup
Jan 2008 AllupJan 2008 Allup
Jan 2008 Allup
 
SalemPhilip_ResearchReport
SalemPhilip_ResearchReportSalemPhilip_ResearchReport
SalemPhilip_ResearchReport
 
Security For Application Development
Security For Application DevelopmentSecurity For Application Development
Security For Application Development
 
Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008
 
Owasp Top 10 2017
Owasp Top 10 2017Owasp Top 10 2017
Owasp Top 10 2017
 
A Study on Detection and Prevention of SQL Injection Attack
A Study on Detection and Prevention of SQL Injection AttackA Study on Detection and Prevention of SQL Injection Attack
A Study on Detection and Prevention of SQL Injection Attack
 
Web Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok ChernWeb Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok Chern
 
Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009
 
C01461422
C01461422C01461422
C01461422
 

Mais de Miva

Mais de Miva (20)

2016 Ecommerce Trends & Conversion Best Practices
2016 Ecommerce Trends & Conversion Best Practices2016 Ecommerce Trends & Conversion Best Practices
2016 Ecommerce Trends & Conversion Best Practices
 
Miva ReadyThemes for Store Owners
Miva ReadyThemes for Store OwnersMiva ReadyThemes for Store Owners
Miva ReadyThemes for Store Owners
 
Facebook Advertising: From Content to Conversions
Facebook Advertising: From Content to ConversionsFacebook Advertising: From Content to Conversions
Facebook Advertising: From Content to Conversions
 
Artistry and Ethics in Email Marketing
Artistry and Ethics in Email MarketingArtistry and Ethics in Email Marketing
Artistry and Ethics in Email Marketing
 
Secrets to Writing Content That Matters - Gillian Muessig
Secrets to Writing Content That Matters - Gillian MuessigSecrets to Writing Content That Matters - Gillian Muessig
Secrets to Writing Content That Matters - Gillian Muessig
 
Content Marketing Data That Moves the Needle
Content Marketing Data That Moves the NeedleContent Marketing Data That Moves the Needle
Content Marketing Data That Moves the Needle
 
7 Actionable SEO Strategies to Build Real Revenue Now
7 Actionable SEO Strategies to Build Real Revenue Now7 Actionable SEO Strategies to Build Real Revenue Now
7 Actionable SEO Strategies to Build Real Revenue Now
 
Wizards & Executors - Gillian Muessig
Wizards & Executors  - Gillian MuessigWizards & Executors  - Gillian Muessig
Wizards & Executors - Gillian Muessig
 
What's New in Miva Merchant 9
What's New in Miva Merchant 9What's New in Miva Merchant 9
What's New in Miva Merchant 9
 
Increasing Conversions with Relevancy, Merchandising & Actionable Insights
Increasing Conversions with Relevancy, Merchandising & Actionable InsightsIncreasing Conversions with Relevancy, Merchandising & Actionable Insights
Increasing Conversions with Relevancy, Merchandising & Actionable Insights
 
Google Analytics for Miva Merchants
Google Analytics for Miva MerchantsGoogle Analytics for Miva Merchants
Google Analytics for Miva Merchants
 
Expanding Product Sales Using eBay & Amazon
Expanding Product Sales Using eBay & AmazonExpanding Product Sales Using eBay & Amazon
Expanding Product Sales Using eBay & Amazon
 
Web Development Trends 2016
Web Development Trends 2016Web Development Trends 2016
Web Development Trends 2016
 
Trust Drives Ecommerce Differentiations & Conversions
Trust Drives Ecommerce Differentiations & ConversionsTrust Drives Ecommerce Differentiations & Conversions
Trust Drives Ecommerce Differentiations & Conversions
 
Best Practices in Order Fulfillment
Best Practices in Order FulfillmentBest Practices in Order Fulfillment
Best Practices in Order Fulfillment
 
2016 Mobile Design & UX Trends
2016 Mobile Design & UX Trends2016 Mobile Design & UX Trends
2016 Mobile Design & UX Trends
 
On Page SEO & Miva Merchant 2016
On Page SEO & Miva Merchant 2016On Page SEO & Miva Merchant 2016
On Page SEO & Miva Merchant 2016
 
Miva Merchant 9 Admin - Optimizing Daily Workflow
Miva Merchant 9 Admin - Optimizing Daily WorkflowMiva Merchant 9 Admin - Optimizing Daily Workflow
Miva Merchant 9 Admin - Optimizing Daily Workflow
 
Merchandising & Miva Merchant 9 - Price Groups
Merchandising & Miva Merchant 9 - Price GroupsMerchandising & Miva Merchant 9 - Price Groups
Merchandising & Miva Merchant 9 - Price Groups
 
Usability & User Engagement
Usability & User EngagementUsability & User Engagement
Usability & User Engagement
 

Último

Último (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Pci compliance writing secure code

  • 2. A Briefer History of Tim Lots of experience coding Lots of experience writing insecure code Focus on PCI Compliance w.r.t. Coding
  • 3. Overview Concepts Attacks and Mitigations Incidence Handling Using this in your daily life
  • 4. Concepts General security expectations Confidentiality of data Integrity of data Availability of data Defense in depth Permission
  • 5. Concepts Confidentiality Think “data leaks”, unprotected directories, access control exploits. Integrity Data tampering, Man in the browser attacks Availability DoS style attacks
  • 6. Defense In Depth Layered approaches work well Use security where it makes sense to use it Use file system permissions for directories Use a WAF Use database access control (GRANT ALL???) Diagram the moving parts, sensitive data, and see where points of entry exist.
  • 7. Defense In Depth Least-privilege principle Layering of Access-control URL based access-control File system & Server permissions Application (business logic) Data layer Application Layer
  • 8. Attacks and Midichlorians We will focus on three types of attacks Cross Site Scripting Cross Site Request Forgery SQL Injection There are obviously many more, this is a small introduction.
  • 9. XSS Exploits the trust a USER has for a site A basic attack is going to insert some JavaScript in the page.
  • 10. Cross Site Scripting (XSS) Persistent Reflected DOM
  • 11. Reflected Example Coupons, coupons, coupons! Parameters from GET directly generating content on the page.
  • 12. Mitigation Validate user input Encode output (mvte instead of mvt) Miva does this with some fields already to mitigate against XSS Persistence attacks Usually this is a case by case basis for how to properly care for data and user-interaction.
  • 13. Cross Site Request Forgery (CSRF) Exploits the trust a SITE has for a browser. All browsers are vulnerable to CSRF attacks You see these attacks in: XMLHttpRequests Iframes Image tags Script tags
  • 14. CSRF Attacks DDoS Bandwidth Consumption Computationally expensive requests Unauthorized Actions Form submission Images with malicious parameters
  • 15. CSRF Attack Mitigation Use POST instead of GET for forms Miva is a bit different here.. Not bullet-proof by any means Use Anti-CSRF tokens Regular Session Timeouts Check HTTP Referrer CAPTCHA Flow Control
  • 16. Anti-CSRF Tokens It's just a simple 62 step process. Create an element on a form which is required. This element is unique and not known Must be present on form submission
  • 17. CSRF Mitigation Chart Slight Help Weak Medium Hulk Smash Using POST * Timeout * HTTP Referrer * * CAPTCHA * * * * Flow Control * * Anti-CSRF Tokens * * * *
  • 18. Difference Betwixt XSS and CSRF XSS – Exploits the trust a USER has with a site CSRF – Exploits the trust a SITE has with a browser
  • 19. XSS & CSRF XSS and CSRF are the “Clinton's” of Security Exploit Partnerships Look at your inputs, look at your outputs, look at your logs. See where attacks are coming from.
  • 20. SQL Injection MivaScript has parameterization built in. That doesn't always mean people use it. 30% of sites in PCI Audits still have exposed SQL Injection vulnerabilities Custom module development, and greater access to lower level functionality bring this back to the surface.
  • 21. What is SQL Injection username=tim username=tim' OR 1=1; – ?page=9 ?page=8+1
  • 22. What can SQL Injection do? Changing existing SQL queries Extract data from the database Alter data and structure of database Control the host running the database, move to other hosts on the network Get webshells on board
  • 23. SQL Injection Attacks Non-blind SQL Injection Error messages help clue you in to what is happening behind the scenes. Blind SQL Injection Use a “Yes” or “No” approach. “Yes” or “No” can also be determined via response time if no visual output More difficult for the attacker, as there aren’t error messages helping them. Testing with Blind SQL Injections: http://target.com/search.php?product=10 Triggers our baseline “true” – Showing us product 10 http://target.com/search.php?product=10’
  • 24. SQL Injection Attack Scenarios Putting a webshell on board http://target.com/search.php?query=‘ UNION SELECT “<?php system($_REQUEST[‘cmd’]);?>” INTO OUTFILE ‘/var/www/test/shell.php’ -- Getting file contents http://target.com/search.php?query=‘ UNION SELECT 1, load_file(/etc/passwd) -- Dropping Tables http://target.com/search.php?query=‘ ;
  • 25. SQL Attack Mitigation Set up different SQL users with different grants, and use them when performing that type of query. Sometimes using Stored Procedures makes sense. Monitor SQL outbound connections Turn off error messages from SQL
  • 26. Title Parameterize your queries If you can’t then use mysql_escape_string around user- generated input When it makes sense: Only allow “known good” input Reject bad input This is hard to do consistently: Bill Stinkface lives on 123 Union St., Chesapeake Drop, OR.
  • 27. Incidence Handling Remember Uncle Scar.. be prepared Monitor and detect Containment Eradication Restoration What was learned?
  • 28. Incidence Handling Have a plan Know who owns what project Talk to those who are affected
  • 29. Daily Life Implement Code Reviews Get a WAF (web application firewall) Security at design Do not use weak hashing algorithms Use unique salted hashes Use SSL for every page
  • 30. Daily Life Before going into production, do some pen testing in QA Use HSTS (HTTP Strict Transport Security) Join the list https://hstspreload.appspot.com/ Cut down your surface area of attack by hardening your server
  • 31. Daily Life Set up a web application testing framework Run incidence response scenarios Use Anti-CSRF Tokens for forms
  • 32. One Page Take Home The order of operations for user-input and data validation Client side validation Web Application Firewall (WAF) Anti-CSRF Tokens Validation within code Customized validation for persistence layer