Content Security Policy. Vlastimil Zíma 24. listopadu 2017

Similar documents
Know Your Own Risks: Content Security Policy Report Aggregation and Analysis

CSP ODDITIES. Michele Spagnuolo Lukas Weichselbaum

Content Security Policy

Browser code isolation

Extending the browser to secure applications

Match the attack to its description:

HTTP Security Headers Explained

BOOSTING THE SECURITY

Ge#ng The Most Out Of CSP: A Deep Dive. Sergey Shekyan

Moving your website to HTTPS - HSTS, TLS, HPKP, CSP and friends

High -Tech Bridge s Web Server Security Service API Developer Documentation Version v1.3 February 13 th 2018

CSE361 Web Security. Attacks against the client-side of web applications. Nick Nikiforakis

Northeastern University Systems Security Lab

Markup Language. Made up of elements Elements create a document tree

Modern client-side defenses. Deian Stefan

Content Security Policy

Using HTTPS - HSTS, TLS, HPKP, CSP and friends

Django-CSP Documentation

BOOSTING THE SECURITY OF YOUR ANGULAR 2 APPLICATION

Defense-in-depth techniques. for modern web applications

Fixed Size Ad Specifications

So we broke all CSPs. You won't guess what happened next!

Writing Secure Chrome Apps and Extensions

CSP STS PKP SRI ETC OMG WTF BBQ

last time: command injection

Scripting for Multimedia LECTURE 5: INTRODUCING CSS3

Security and Frontend Performance

Deccansoft Software Services

Static Webpage Development

Rediscover Google AMP Learn to integrate AMP with your Drupal project Twin Cities Drupal Camp June 9, 2018

Design Document V2 ThingLink Startup

Matteo Fogli. Web Performance

SEEM4570 System Design and Implementation. Lecture 4 AJAX and Demo

Setting Up a Development Server What Is a WAMP, MAMP, or LAMP? Installing a WAMP on Windows Testing the InstallationAlternative WAMPs Installing a

The Structure of the Web. Jim and Matthew

AN EVALUATION OF THE GOOGLE CHROME EXTENSION SECURITY ARCHITECTURE

CSE361 Web Security. Attacks against the client-side of web applications. Nick Nikiforakis

Website Report for test.com

Web basics: HTTP cookies

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

Flexible and LEAN Ads

Web Security. CSU CS557 - Fall 2017 Instructor: Lorenzo De Carli

Website Report for facebook.com

Best Practices Chapter 5

Executive Summary. Performance Report for: The web should be fast. Top 1 Priority Issues. How does this affect me?

Website Report for colourways.com.au

Build Site Create your site

In this project, you ll learn how to create your own webpage to tell a story, joke or poem. Think about the story you want to tell.

CSS Cascading Style Sheets

Client Side Security And Testing Tools

Web development using PHP & MySQL with HTML5, CSS, JavaScript

SOCIAL LOGIN FOR MAGENTO 2

Web Security: Vulnerabilities & Attacks

Executive Summary. Performance Report for: The web should be fast. Top 5 Priority Issues

Website Report for bangaloregastro.com

Care & Feeding of Programmers: Addressing App Sec Gaps using HTTP Headers. Sunny Wear OWASP Tampa Chapter December

Website Report for

Project 3 Web Security Part 1. Outline

Lecture : 3. Practical : 2. Course Credit. Tutorial : 0. Total : 5. Course Learning Outcomes

October 08: Introduction to Web Security

Computer Systems Department, University of Castilla-La Mancha Albacete, Spain

Executive Summary. Performance Report for: The web should be fast. Top 5 Priority Issues. How does this affect me?

Introduction to WEB PROGRAMMING

W3Conf, November 15 & 16, Brad Scott

Cascading Style Sheets CSCI 311

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

WEB DEVELOPER BLUEPRINT

Web Development & Design Foundations with HTML5, 8 th Edition Instructor Materials Chapter 3 Test Bank

Brand Tools. Technical Channel Integration Guide

SOCIAL LOGIN FOR MAGENTO 2 USER GUIDE

HTML HTML5. DOM(Document Object Model) CSS CSS

HTML 5 and CSS 3, Illustrated Complete. Unit M: Integrating Social Media Tools

Executive Summary. Performance Report for: The web should be fast. Top 5 Priority Issues. How does this affect me?

HTML + CSS. ScottyLabs WDW. Overview HTML Tags CSS Properties Resources

How is state managed in HTTP sessions. Web basics: HTTP cookies. Hidden fields (2) The principle. Disadvantage of this approach

Web basics: HTTP cookies

PIC 40A. Midterm 1 Review

FRONT END DEVELOPER CAREER BLUEPRINT

CompuScholar, Inc. Alignment to Utah's Web Development I Standards

Clojure Web Security. FrOSCon Joy Clark & Simon Kölsch

Standard 1 The student will author web pages using the HyperText Markup Language (HTML)

WEB SECURITY: XSS & CSRF

JavaScript: Events, the DOM Tree, jquery and Timing

Client Side Injection on Web Applications

Technical Requirements

Receiving Courses Iframe Integration

Executive Summary. Performance Report for: The web should be fast. Top 5 Priority Issues. How does this affect me?

Stamp Builder. Documentation. v1.0.0

Complimentary SEO Analysis & Proposal. Rashima Marjara

Speeding up Web Page Loads with Shandian. Sophia Wang University of Washington

HTML and CSS COURSE SYLLABUS

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

Extending the Web Security Model with Information Flow Control

Your Scripts in My Page: What Could Possibly Go Wrong? Sebastian Lekies / Ben Stock Martin Johns

NoScript, CSP and ABE: When The Browser Is Not Your Enemy

GrooveCar Welcome Packet

Implementing a chat button on TECHNICAL PAPER

Executive Summary. Performance Report for: The web should be fast. Top 5 Priority Issues

Web Security Checklist (v1.11)

Basics of Web Technologies

Transcription:

Content Security Policy Vlastimil Zíma vlastimil.zima@nic.cz 24. listopadu 2017

Content Security Policy Obrana před XSS apod. Vázaný na HTML stránku https://content-security-policy.com/ Level 2, ve vývoji Level 3

Jak to funguje HTML + CSP Prohlížeč https://example.cz/style.css https://example.cz/script.js https://evil.example.cz/script.js eval() CSP

Základní direktivy script-src JS style-src CSS object-src <object> apod. img-src obrázky media-src audio, video apod. child-src frame-src <frame>, <iframe> worker-src Worker apod. font-src fonty connect-src AJAX apod. default-src

Hodnoty direktiv Speciální hodnoty 'self' 'none' * 'unsafe-inline' <style>, style=, <script>, on*= apod. 'unsafe-eval' eval, settimeout a setinterval Schémata https: data: Zdroje example.cz https://example.cz *.example.cz example.cz:8000 Výjimky pro inline 'nonce-vybrana-hodnota' 'sha256-base64-hodnota'

Hlášení report-uri Závislé na prohlížeči Zobrazují se v konzoli {"csp-report" : { "document-uri" : "https://example.cz/", "referrer" : "", "blocked-uri" : "https://evil.example.cz/", "violated-directive" : "default-src 'self'", "original-policy" : "default-src 'self'; report-uri https://example.cz/report/", "status-code" : 200, "effective-directive" : "style-src", "source-file" : "https://example.cz/", "line-number" : 31, "column-number" : 21 }}

Kam s ním HTTP hlavička HTML meta Level 2+ Content-Security-Policy Content-Security-Policy-Report-Only X-Content-Security-Policy X-Content-Security-Policy-Report-Only

Jak na to 1 default-src 'none' 2 Otestovat 3 Opravit kód / CSP

Jak na to 1 default-src 'none' 2 Otestovat 3 Opravit kód / CSP eval, settimeout a setinterval <script>, on*= apod. <style>, style= apod. data: URI

Prokletí sociálních sítí Chybí návody Pokus-omyl

Prokletí sociálních sítí Chybí návody Pokus-omyl Twitter widget <meta name="twitter:widgets:csp" content="on" /> script-src https://platform.twitter.com https://cdn.syndication.twimg.com style-src https://platform.twitter.com connect-src https://syndication.twitter.com

Prokletí sociálních sítí Chybí návody Pokus-omyl Facebook +1 script-src https://connect.facebook.net

Prokletí sociálních sítí Chybí návody Pokus-omyl Google script-src https://*.googleapis.com mapy, překlady, CDN script-src https://*.google.com Google+, mapy, recaptcha script-src https://www.gstatic.com recaptcha style-src https://fonts.googleapis.com fonty v mapách font-src https://fonts.googleapis.com fonty v mapách

Naše direktivy https://www.nic.cz/, https://www.mojeid.cz/,... default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://test-ipv6.nic.cz https://*.test-ipv6.nic.cz https://piwik.nic.cz/piwik.js https://platform.twitter.com https://cdn.syndication.twimg.com https://s.ytimg.com https://*.googleapis.com https://*.google.com https://connect.facebook.net https://*.mapy.cz; style-src 'self' 'unsafe-inline' https://www.rhybar.cz https://platform.twitter.com https://*.nic.cz https://fonts.googleapis.com https://api.mapy.cz; img-src * data:; media-src *; child-src *; frame-src *; worker-src 'none'; font-src 'self' https://fonts.gstatic.com; connect-src 'self' https://*.test-ipv6.nic.cz https://*.labs.nic.cz https://piwik.nic.cz/piwik.php https://www.nic.cz/files/cors/projects-bar/ https://mojeid.cz https://syndication.twitter.com; report-uri https://csp.nic.cz/report/

Naše direktivy https://mojeid.cz/ default-src 'self'; script-src 'self' https://piwik.nic.cz/piwik.js; object-src 'none'; img-src * data:; media-src 'none'; child-src 'none'; frame-src 'none'; connect-src 'self' https://piwik.nic.cz/piwik.php https://www.nic.cz/files/cors/projects-bar/; report-uri https://csp.nic.cz/report/

Naše CSP HTTP server HTTP hlavičky https://csp.nic.cz/report/ https://github.com/adamalton/django-csp-reports

Statistiky 40 000 zobrazení/den

Statistiky 40 000 zobrazení/den 110 000 hlášení/den

Statistiky 40 000 zobrazení/den 110 000 hlášení/den 70 % script-src se self URI "script-sample":"onfocusin attribute on DIV element"

Statistiky 40 000 zobrazení/den 110 000 hlášení/den 70 % script-src se self URI "script-sample":"onfocusin attribute on DIV element" 15 % prázdná URI "source-file":"https://mojeid.cz/password_reset/", "line-number":19, "column-number":26

Statistiky 40 000 zobrazení/den 110 000 hlášení/den 70 % script-src se self URI "script-sample":"onfocusin attribute on DIV element" 15 % prázdná URI "source-file":"https://mojeid.cz/password_reset/", "line-number":19, "column-number":26 10 % font-src se https://sxt.cdn.skype.com/, https://fonts.gstatic.com/,... URI

Děkuji za pozornost Vlastimil Zíma vlastimil.zima@nic.cz