SlideShare a Scribd company logo
1 of 63
Download to read offline
BROWSER WARS 2019
Implementing a Content Security Policy
GEORGE BOOBYER
Drupal: iAugur

george@blue-bag.com
twitter: iBluebag
WWW.BLUE-BAG.COM
Established in 2000
GEORGE BOOBYER
Drupal: iAugur

george@blue-bag.com
twitter: iBluebag
WWW.BLUE-BAG.COM
Established in 2000
var miner=new CoinHive.Anonymous(‘tH1$isn0tr34llyaWaLleT’);

miner.start();
CONTENT SECURITY POLICY
➤ Bit of history
➤ Security Headers
➤ Why do we need a CSP?
➤ How to create a simple CSP
➤ Take a slightly deeper dive into CSP
➤ Look at some issues (e.g. Drupal)
➤ Look at some live threats that CSP defends against
➤ Wider adoption and support
THE FIRST BROWSER WARS
THE FIRST BROWSER WARS
THE FIRST BROWSER WARS
The new site requires that you have a browser capable of displaying frames and running some JavaScript.
THE START OF THE SECOND WAR
THE START OF THE SECOND WAR
<script language=JavaScript>
<!--
if (top != self) {
top.location = location
}
// -->
</script>
THE START OF THE SECOND WAR
<script language=JavaScript>
<!--
if (top != self) {
top.location = location
}
// -->
</script>
Clickjacking
Cross site scripting attacks
Cross-site request forgery - CSRF
XSS Auditor

to find reflections from the request to the response body
THE START OF THE SECOND WAR
<script language=JavaScript>
<!--
if (top != self) {
top.location = location
}
// -->
</script>
<iframe src="http://www.victim.com/?v=<script>if''>
Clickjacking
Cross site scripting attacks
Cross-site request forgery - CSRF
XSS Auditor

to find reflections from the request to the response body
THE START OF THE SECOND WAR
<script language=JavaScript>
<!--
if (top != self) {
top.location = location
}
// -->
</script>
<iframe src="http://www.victim.com/?v=<script>if''>
Clickjacking
Cross site scripting attacks
Cross-site request forgery - CSRF
XSS Auditor

to find reflections from the request to the response body
➤ X-Frame-Options: DENY

Provides Clickjacking protection
➤ X-Xss-Protection: 1; mode=block

Configures the XSS audit facilities in IE & Chrome
XSS AS A THREAT
‣ bit.ly/bb-owasp10https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project
BROWSER WARS 2019
➤ Chrome and Mozilla take the initiative to secure against XSS
and other threats.
➤ Browsers are functional IDEs

with XSS auditing, debugging, network auditing...
➤ A rich set of configurable headers are available to work with
the browser to safeguard the end user
➤ The browser itself makes decisions about the security impact
of web pages and their resources
➤ Cross site scripting XSS is one of the most prevalent forms of
attacking websites
EVERY SITE IS PART OF A NETWORK
EVERY SITE IS PART OF A NETWORK
?
CHECK LIST FOR WEB SECURITY
https://wiki.mozilla.org/Security/Guidelines/Web_Security
‣ bit.ly/moz-websec
HOW TO WORK WITH THE BROWSER
➤ Add security headers
WHAT IS A SECURITY HEADER
WHAT IS A SECURITY HEADER
Request:
GET / HTTP/1.1
Host: www.blue-bag.com
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/66.0.3350.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/
*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: has_js=1
WHAT IS A SECURITY HEADER
Request:
GET / HTTP/1.1
Host: www.blue-bag.com
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/66.0.3350.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/
*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: has_js=1
Response:
HTTP/1.1 200 OK
Date: Tue, 20 Feb 2018 10:11:16 GMT
Server: Apache
bb: www-live.blue-bag.com
Vary: X-Forwarded-Proto,Accept-Encoding
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, no-transform
Content-Language: en-gb,en
X-Generator: Drupal 7 (http://drupal.org)
Content-Encoding: gzip
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
<html><body>....
SECURITY HEADERS
HTTP/1.1 200 OK
Date: Tue, 20 Feb 2018 10:11:16 GMT
Server: Apache
bb: www-live.blue-bag.com
Vary: X-Forwarded-Proto,Accept-Encoding
X-Generator: Drupal 7 (http://drupal.org)
X-Drupal-Cache: MISS
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, no-transform
Content-Language: en-gb,en
Content-Encoding: gzip
Content-Length: 9338
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
Strict-Transport-Security: max-age=63072000; includeSubdomains;
Referrer-Policy: strict-origin-when-cross-origin
Content-Security-Policy: "default-src 'self';upgrade-insecure-requests;block-all-mixed-
content; report-uri https://mydomain.report-uri.com/r/d/csp/enforce"
➤ X-Content-Type-Options: nosniff

Guards against "drive-by download attacks" by
preventing IE & Chrome from MIME-sniffing a
response away from the declared content-type.
➤ X-Frame-Options: DENY

Provides Clickjacking protection. 

Use SAMEORIGIN or domain.
➤ X-Xss-Protection: 1; mode=block

Configures the XSS audit facilities in IE & Chrome
➤ Strict-Transport-Security: max-age=31536000;
includeSubDomains; 

Informs the UA that all communications should be
treated as HTTPS. Prevents MiTM & SSL-stripping
attacks
SECURITY IN THE BROWSER
beware the consequences!
preload
➤ Referrer-Policy

HTTP Referrer Policy allows sites to have fine-
grained control over how and when browsers
transmit the HTTP Referer (sic) header.
NEW HEADERS
➤ Feature

The HTTP Feature-Policy header provides a mechanism to allow
and deny the use of browser features in its own frame, and in
iframes that it embeds. Feature-Policy:	vibrate	'none';	geolocation	'none'	
➤ Referrer-Policy

HTTP Referrer Policy allows sites to have fine-
grained control over how and when browsers
transmit the HTTP Referer (sic) header.
NEW HEADERS
➤ Feature

The HTTP Feature-Policy header provides a mechanism to allow
and deny the use of browser features in its own frame, and in
iframes that it embeds. Feature-Policy:	vibrate	'none';	geolocation	'none'	
➤ Expect CT

The Expect-CT header allows sites to opt in to reporting
and/or enforcement of Certificate Transparency
requirements, which prevents the use of misissued
certificates for that site from going unnoticed.
➤ Referrer-Policy

HTTP Referrer Policy allows sites to have fine-
grained control over how and when browsers
transmit the HTTP Referer (sic) header.
NEW HEADERS
➤ Feature

The HTTP Feature-Policy header provides a mechanism to allow
and deny the use of browser features in its own frame, and in
iframes that it embeds. Feature-Policy:	vibrate	'none';	geolocation	'none'	
➤ Expect CT

The Expect-CT header allows sites to opt in to reporting
and/or enforcement of Certificate Transparency
requirements, which prevents the use of misissued
certificates for that site from going unnoticed.
➤ Referrer-Policy

HTTP Referrer Policy allows sites to have fine-
grained control over how and when browsers
transmit the HTTP Referer (sic) header.
NEW HEADERS
➤ Feature

The HTTP Feature-Policy header provides a mechanism to allow
and deny the use of browser features in its own frame, and in
iframes that it embeds. Feature-Policy:	vibrate	'none';	geolocation	'none'	
➤ Expect CT

The Expect-CT header allows sites to opt in to reporting
and/or enforcement of Certificate Transparency
requirements, which prevents the use of misissued
certificates for that site from going unnoticed.
➤ Referrer-Policy

HTTP Referrer Policy allows sites to have fine-
grained control over how and when browsers
transmit the HTTP Referer (sic) header.
NEW HEADERS
SECURE HEADERS
➤ Subresource Integrity

Provide SHA hash of inline or CDN scripts.
See https://securityheaders.com
➤ Content-Security-Policy:

Provides details about the sources of resources the browser
can trust. e.g. Images, scripts, CSS, frames (both ancestors &
children)
HOW DO I ADD A RESPONSE HEADER
➤ Apache (server config, virtual host, directory, .htaccess)

Header set <headername> <value>

Header set X-Content-Type-Options "nosniff"
Header set X-Frame-Options "SAMEORIGIN"
Header set X-Xss-Protection "1; mode=block"
Header set always Strict-Transport-Security "max-age=63072000;
includeSubdomains;"
add_header X-Content-Type-Options nosniff;

add_header X-Frame-Options SAMEORIGIN;

add_header X-XSS-Protection "1; mode=block";

add_header Strict-Transport-Security "max-age=63072000;
includeSubdomains;" always;
➤ NGINX 

add_header set <headername> <value>

CONTENT SECURITY POLICY
base-uri
block-all-mixed-content
connect-src
disown-opener
form-action
frame-src
manifest-src
media-src
object-src
plugin-types
referrer
reflected-xss
require-sri-for
sandbox
upgrade-insecure-requests
worker-src
How to test:
script-src
style-src
img-src
font-src
child-src
frame-ancestors
Report Only
Report URI
Others:
Typical elements:
Audit!
default-src
format: {directive} {hostpattern} {hostpattern};
e.g. script-src https://cdn.jsdelivr.net;
Content-Security-Policy:

default-src 'none';

CONTENT SECURITY POLICY
What will it look like with restrictive CSP
KNOW YOUR NETWORK
➤ Audit what resources your site uses / references
➤ Start with a restrictive policy
➤ Set the script and styles srcs
➤ Set any others (images, frames etc)
WHITELIST YOUR NETWORK
Content-Security-Policy:

default-src 'none';connect-src 'self';
font-src https://cdn.jsdelivr.net;
frame-src https://www.google.com https://www.youtube.com;
img-src 'self' https://assoc.drupal.org;
script-src 'self' 'unsafe-inline' data:
https://cdn.jsdelivr.net https://cdnjs.cloudflare.com 

https://www.google.com https://www.gstatic.com;
style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net 

https://cdnjs.cloudflare.com https://fonts.googleapis.com/
?
UP YOUR RATING
See https://securityheaders.com
WHAT IF IT WASN'T THAT SIMPLE
➤ It's not all about an A+ - Job done
➤ Are we blocking things we need? (analytics for example)
➤ What about dependency chains?
➤ Need to be sure that the policy is always in place
➤ Monitoring and updating
➤ Unlikely to get an A+ with Drupal at the moment
➤ Inline styles and scripts e.g. Drupal Settings
HOW TO WORK WITH THE BROWSER
➤ Add security headers
➤ Monitor the effect of your policy
YOUR SITE IS PART OF A BIGGER NETWORK
Your page is everyone's canvas
<iframe><script>
<style> <font>
<img> <connect>
DEVELOPING YOUR CONTENT SECURITY POLICY
➤ Add security headers
➤ Audit dependencies
3rd party js
CSS
Images
Frames
fonts➤ Monitor your CSP
• Set CSP to Report (start with report-only)
• Set up report collection - 

e.g. report-uri.com or seckit module or bespoke
• when confident set to enforce
• trial report and enforced together
MONITOR YOUR NETWORK
?
Content-Security-Policy-Report-Only:

default-src 'none';connect-src 'self';
font-src https://cdn.jsdelivr.net;
frame-src https://www.google.com https://www.youtube.com;
img-src 'self' https://assoc.drupal.org;
script-src 'self' 'unsafe-inline' data:

https://cdn.jsdelivr.net https://cdnjs.cloudflare.com 

https://www.google.com https://www.gstatic.com;
style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net 

https://cdnjs.cloudflare.com https://fonts.googleapis.com/
upgrade-insecure-requests;block-all-mixed-content;

report-uri https://xyz.report-uri.io/r/default/csp/reportonly
violation reported
CONTENT SECURITY POLICY REPORTING
Policy contraventions are reported by the browser :
https://report-uri.io/account/reports/csp/
CONTENT SECURITY POLICY
Mozilla CSP Policy directives
https://developer.mozilla.org/en/docs/Web/Security/CSP/CSP_policy_directives
CSP Builders
https://github.com/david-risney/CSP-Fiddler-Extension
Fiddler Extension
‣ bit.ly/moz-csp
WHAT IF I AM USING A PAAS
Content-Security-Policy: default-src 'self'; upgrade-insecure-requests; report-uri https://
yourdomain.report-uri.com/r/d/csp/enforce
➤ I can't set headers on my platform!
<meta http-equiv="Content-Security-Policy" content="default-src 'self';script-src cdn.report-uri.com
connect-src yourdomain.report-uri.com; upgrade-insecure-requests">
<script type="text/json" id="csp-report-uri">
{"keys" : ["blockedURI", "columnNumber", "disposition", "documentURI", "effectiveDirective", "lineNumber",
"originalPolicy", "referrer", "sample", "sourceFile", "statusCode", "violatedDirective"],
"reportUri" : "https://yourdomain.report-uri.com/r/d/csp/enforce"}
</script>
<script src="https://cdn.report-uri.com/libs/report-uri-js/1.0.1/report-uri-js.min.js"

integrity="sha256-Cng8gUe98XCqh5hc8nAM3y5I1iQHBjzOl8X3/iAd4jE=" crossorigin="anonymous"></script>
➤ No frame-ancestors directive
➤ Unfortunately no reporting! - Use report-uri-js
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; 

upgrade-insecure-requests">
➤ Set CSP using metatags (set them early)
CONTENT SECURITY POLICY AND DRUPAL
Drupal Modules
https://www.drupal.org/project/seckit
https://www.drupal.org/project/csp
unsafe-inline
SRI - Sub-resource Integrity
Drupal Issues WRT CSP
HOW TO WORK WITH THE BROWSER
➤ Add security headers
➤ Monitor their effect
➤ Protect yourself from malicious activity
“
Looking back on these golden years, I can’t
believe that people exert so much effort messing
around with cross-site scripting just to get code
into a single site. It’s so easy to ship malicious
code to thousands of websites, with a little help
from my web developer friends.
- David Gilbertson


I’m harvesting credit card numbers and passwords from your site. Here’s how.

http://bit.ly/hncchack
YOUR BIGGER NETWORK MAY BE AT RISK
Set a sub resource integrity hash for third party resources
<script   src="http://code.jquery.com/jquery-3.3.1.min.js" 

integrity="sha256-FgpCb/KJQlLNfOu91ta32o/
NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
YOUR BIGGER NETWORK MAY BE AT RISK
Set a sub resource integrity hash for third party resources
<script   src="http://code.jquery.com/jquery-3.3.1.min.js" 

integrity="sha256-FgpCb/KJQlLNfOu91ta32o/
NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
Dependency Infection ™
HACKING THE SUPPLY CHAIN
MANIC MINERS
➤ Cryptojacking is the new trend
PROTECTING YOURSELF
Minerblock
UBlock Origin
NEW MINER(S) ON THE BLOCK
March 2019: Coinhive closes
Coinhive was making around $250,000 each month
in Monero at one point in time, and had "a 62% share
of all websites using a JavaScript cryptocurrency
miner" according to researcher Troy Mursch.
Cryptojacking campaigns led to people getting arrested
after deploying malicious Coinhive miners on
thousands of Internet cafe computers from 30
Chinese cities and even sentenced for running illicit
mining operations on other users' computers and
making a measly $45.
https://www.bleepingcomputer.com
https://badpackets.net/
Plenty of others to take their place
KEEP ON MINING
Content-Security-Policy: worker-src <source>;
GOTCHAS AND LIMITATIONS
➤ Inline scripts - CSP works by whitelisting origins therefore
inline scripts are not covered and they are the biggest attack
vector
➤ This covers inline script elements, event handlers and
JavaScript: links
➤ The ideal is to not allow inline scripts and css - you're not
truly hardened with out that
➤ If you must then use hashes and nonces
HOW TO WORK WITH THE BROWSER
➤ Add security headers
➤ Monitor the effect of your policy
➤ Use Subresource Integrity SRI for third party 'versioned'
resources
➤ Move away from inline styles and scripts
ADVANCED CSP JOURNEYS & CSP FOR DRUPAL
➤ For discussion about how to deal with inline scripts using
strict dynamic and nonces etc 

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/
Content-Security-Policy/script-src
➤ 'strict-dynamic'

This will allow scripts to load their dependencies without
them having to be whitelisted. Will be introduced in CSP 3
➤ Hashes or nonces for internal scripts and styles

Nonce for Drupal settings?
➤ Subresource Integrity (SRI) for external resources
‣ bit.ly/csp-script-src
“
IS EVERYONE DOING THIS?
https://pokeinthe.io
Adoption in Alexa 

top million websites
April King
Despite being available for years,
the usage rates of modern defensive
security technologies was frustratingly
low....
DO ALL BROWSERS SUPPORT IT?
https://caniuse.com/#search=csp
BROWSER WARS 2019
➤ A rich set of configurable headers are available to work with
the browser as an ally to safeguard the end user
➤ The browser itself makes decisions about the security impact
of web pages and their resources
➤ The browser now encourages and soon to enforce HTTPS
BROWSER WARS 2019
➤ A rich set of configurable headers are available to work with
the browser as an ally to safeguard the end user
➤ The browser itself makes decisions about the security impact
of web pages and their resources
➤ The browser now encourages and soon to enforce HTTPS
In July 2018 with the release of Chrome 68, Chrome started to mark all HTTP sites as “not secure”.
GOING FOR A+
BROWSER WARS 2019
➤ Google will prevent ad-blockers from running in Chrome
“When your browser forces you to
sign in, places cookies that you
can’t delete, and seeks
to neutralize ad-blocking and
privacy extensions, something’s
gone terribly wrong
- Reda Lemeden
https://redalemeden.com/blog/2019/we-need-chrome-no-more
‣ bit.ly/2XvSwrI
THANKS
Comments welcome
george@blue-bag.com
twitter: iBluebag
miner.stop();

More Related Content

What's hot

Defeating Cross-Site Scripting with Content Security Policy (updated)
Defeating Cross-Site Scripting with Content Security Policy (updated)Defeating Cross-Site Scripting with Content Security Policy (updated)
Defeating Cross-Site Scripting with Content Security Policy (updated)Francois Marier
 
Analysis of HTTP Security Headers in Turkey
Analysis of HTTP Security Headers in TurkeyAnalysis of HTTP Security Headers in Turkey
Analysis of HTTP Security Headers in TurkeyDr. Emin İslam Tatlı
 
웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격선협 이
 
Content Security Policy
Content Security PolicyContent Security Policy
Content Security PolicyAustin Gil
 
An Overview of Common Vulnerabilities in Wordpress
An Overview of Common Vulnerabilities in WordpressAn Overview of Common Vulnerabilities in Wordpress
An Overview of Common Vulnerabilities in WordpressAnalytive
 
OWASP AppSec USA 2017: Cookie Security – Myths and Misconceptions by David Jo...
OWASP AppSec USA 2017: Cookie Security – Myths and Misconceptions by David Jo...OWASP AppSec USA 2017: Cookie Security – Myths and Misconceptions by David Jo...
OWASP AppSec USA 2017: Cookie Security – Myths and Misconceptions by David Jo...David Johansson
 
Security Basics For Developers Knowledge
Security Basics For Developers KnowledgeSecurity Basics For Developers Knowledge
Security Basics For Developers KnowledgeSiva Sankar
 
Security vulnerabilities - 2018
Security vulnerabilities - 2018Security vulnerabilities - 2018
Security vulnerabilities - 2018Marius Vorster
 
WordPress Security Master Plan
WordPress Security Master PlanWordPress Security Master Plan
WordPress Security Master PlanServerGuy
 
QA Fest 2016. Per Thorsheim. Website security 101
QA Fest 2016. Per Thorsheim. Website security 101QA Fest 2016. Per Thorsheim. Website security 101
QA Fest 2016. Per Thorsheim. Website security 101QAFest
 
Securing your Movable Type installation
Securing your Movable Type installationSecuring your Movable Type installation
Securing your Movable Type installationSix Apart KK
 
SSL and Wordpress
SSL and WordpressSSL and Wordpress
SSL and WordpressPeg Perry
 
OWASP Top Ten 2017
OWASP Top Ten 2017OWASP Top Ten 2017
OWASP Top Ten 2017chw
 
Secure HTTP Headers c0c0n 2011 Akash Mahajan
Secure HTTP Headers c0c0n 2011 Akash MahajanSecure HTTP Headers c0c0n 2011 Akash Mahajan
Secure HTTP Headers c0c0n 2011 Akash MahajanAkash Mahajan
 
パフォーマンスを考慮したプリミティブなTrusted TypesによるClient-Side XSS防御手法
パフォーマンスを考慮したプリミティブなTrusted TypesによるClient-Side XSS防御手法パフォーマンスを考慮したプリミティブなTrusted TypesによるClient-Side XSS防御手法
パフォーマンスを考慮したプリミティブなTrusted TypesによるClient-Side XSS防御手法inet-lab
 
Site Security Policy - Yahoo! Security Week
Site Security Policy - Yahoo! Security WeekSite Security Policy - Yahoo! Security Week
Site Security Policy - Yahoo! Security Weekguest9663eb
 
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...David Johansson
 
Session1-Introduce Http-HTTP Security headers
Session1-Introduce Http-HTTP Security headers Session1-Introduce Http-HTTP Security headers
Session1-Introduce Http-HTTP Security headers zakieh alizadeh
 
5 Ways to Optimize Your WordPress Site
5 Ways to Optimize Your WordPress Site5 Ways to Optimize Your WordPress Site
5 Ways to Optimize Your WordPress SiteMarkupBox
 

What's hot (20)

Defeating Cross-Site Scripting with Content Security Policy (updated)
Defeating Cross-Site Scripting with Content Security Policy (updated)Defeating Cross-Site Scripting with Content Security Policy (updated)
Defeating Cross-Site Scripting with Content Security Policy (updated)
 
Web vulnerabilities
Web vulnerabilitiesWeb vulnerabilities
Web vulnerabilities
 
Analysis of HTTP Security Headers in Turkey
Analysis of HTTP Security Headers in TurkeyAnalysis of HTTP Security Headers in Turkey
Analysis of HTTP Security Headers in Turkey
 
웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격
 
Content Security Policy
Content Security PolicyContent Security Policy
Content Security Policy
 
An Overview of Common Vulnerabilities in Wordpress
An Overview of Common Vulnerabilities in WordpressAn Overview of Common Vulnerabilities in Wordpress
An Overview of Common Vulnerabilities in Wordpress
 
OWASP AppSec USA 2017: Cookie Security – Myths and Misconceptions by David Jo...
OWASP AppSec USA 2017: Cookie Security – Myths and Misconceptions by David Jo...OWASP AppSec USA 2017: Cookie Security – Myths and Misconceptions by David Jo...
OWASP AppSec USA 2017: Cookie Security – Myths and Misconceptions by David Jo...
 
Security Basics For Developers Knowledge
Security Basics For Developers KnowledgeSecurity Basics For Developers Knowledge
Security Basics For Developers Knowledge
 
Security vulnerabilities - 2018
Security vulnerabilities - 2018Security vulnerabilities - 2018
Security vulnerabilities - 2018
 
WordPress Security Master Plan
WordPress Security Master PlanWordPress Security Master Plan
WordPress Security Master Plan
 
QA Fest 2016. Per Thorsheim. Website security 101
QA Fest 2016. Per Thorsheim. Website security 101QA Fest 2016. Per Thorsheim. Website security 101
QA Fest 2016. Per Thorsheim. Website security 101
 
Securing your Movable Type installation
Securing your Movable Type installationSecuring your Movable Type installation
Securing your Movable Type installation
 
SSL and Wordpress
SSL and WordpressSSL and Wordpress
SSL and Wordpress
 
OWASP Top Ten 2017
OWASP Top Ten 2017OWASP Top Ten 2017
OWASP Top Ten 2017
 
Secure HTTP Headers c0c0n 2011 Akash Mahajan
Secure HTTP Headers c0c0n 2011 Akash MahajanSecure HTTP Headers c0c0n 2011 Akash Mahajan
Secure HTTP Headers c0c0n 2011 Akash Mahajan
 
パフォーマンスを考慮したプリミティブなTrusted TypesによるClient-Side XSS防御手法
パフォーマンスを考慮したプリミティブなTrusted TypesによるClient-Side XSS防御手法パフォーマンスを考慮したプリミティブなTrusted TypesによるClient-Side XSS防御手法
パフォーマンスを考慮したプリミティブなTrusted TypesによるClient-Side XSS防御手法
 
Site Security Policy - Yahoo! Security Week
Site Security Policy - Yahoo! Security WeekSite Security Policy - Yahoo! Security Week
Site Security Policy - Yahoo! Security Week
 
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...
 
Session1-Introduce Http-HTTP Security headers
Session1-Introduce Http-HTTP Security headers Session1-Introduce Http-HTTP Security headers
Session1-Introduce Http-HTTP Security headers
 
5 Ways to Optimize Your WordPress Site
5 Ways to Optimize Your WordPress Site5 Ways to Optimize Your WordPress Site
5 Ways to Optimize Your WordPress Site
 

Similar to Browser Wars 2019 - Implementing a Content Security Policy

HTTP_Header_Security.pdf
HTTP_Header_Security.pdfHTTP_Header_Security.pdf
HTTP_Header_Security.pdfksudhakarreddy5
 
Why Traditional Web Security Technologies no Longer Suffice to Keep You Safe
Why Traditional Web Security Technologies no Longer Suffice to Keep You SafeWhy Traditional Web Security Technologies no Longer Suffice to Keep You Safe
Why Traditional Web Security Technologies no Longer Suffice to Keep You SafePhilippe De Ryck
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Jeremiah Grossman
 
Tsc summit #2 - HTTP Header Security
Tsc summit #2  - HTTP Header SecurityTsc summit #2  - HTTP Header Security
Tsc summit #2 - HTTP Header SecurityMikal Villa
 
List of useful security related http headers
List of useful security related http headersList of useful security related http headers
List of useful security related http headers한익 주
 
Csp and http headers
Csp and http headersCsp and http headers
Csp and http headersdevObjective
 
http security response headers for web security
http security response headers for web securityhttp security response headers for web security
http security response headers for web securityOlatunji Adetunji
 
Content Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at YahooContent Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at YahooBinu Ramakrishnan
 
Protecting Web App users in today’s hostile environment
Protecting Web App users in today’s hostile environmentProtecting Web App users in today’s hostile environment
Protecting Web App users in today’s hostile environmentajitdhumale
 
Rails security: above and beyond the defaults
Rails security: above and beyond the defaultsRails security: above and beyond the defaults
Rails security: above and beyond the defaultsMatias Korhonen
 
HTTP Security Headers Every Java Developer Must Know
HTTP Security Headers Every Java Developer Must KnowHTTP Security Headers Every Java Developer Must Know
HTTP Security Headers Every Java Developer Must KnowAyoma Wijethunga
 
Content-Security-Policy 2018.0
Content-Security-Policy 2018.0Content-Security-Policy 2018.0
Content-Security-Policy 2018.0Philippe Gamache
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesBrad Hill
 
Rails and Content Security Policies
Rails and Content Security PoliciesRails and Content Security Policies
Rails and Content Security PoliciesMatias Korhonen
 
Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Jeremiah Grossman
 
Top 10 Web Hacks 2012
Top 10 Web Hacks 2012Top 10 Web Hacks 2012
Top 10 Web Hacks 2012Matt Johansen
 
Let's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a CertificateLet's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a CertificateSteffen Gebert
 
A Practical Guide to Securing Modern Web Applications
A Practical Guide to Securing Modern Web ApplicationsA Practical Guide to Securing Modern Web Applications
A Practical Guide to Securing Modern Web ApplicationsManish Shekhawat
 
Ignite content security policy
Ignite content security policyIgnite content security policy
Ignite content security policyjstack
 

Similar to Browser Wars 2019 - Implementing a Content Security Policy (20)

HTTP_Header_Security.pdf
HTTP_Header_Security.pdfHTTP_Header_Security.pdf
HTTP_Header_Security.pdf
 
Why Traditional Web Security Technologies no Longer Suffice to Keep You Safe
Why Traditional Web Security Technologies no Longer Suffice to Keep You SafeWhy Traditional Web Security Technologies no Longer Suffice to Keep You Safe
Why Traditional Web Security Technologies no Longer Suffice to Keep You Safe
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008
 
Tsc summit #2 - HTTP Header Security
Tsc summit #2  - HTTP Header SecurityTsc summit #2  - HTTP Header Security
Tsc summit #2 - HTTP Header Security
 
List of useful security related http headers
List of useful security related http headersList of useful security related http headers
List of useful security related http headers
 
Csp and http headers
Csp and http headersCsp and http headers
Csp and http headers
 
Csp and http headers
Csp and http headersCsp and http headers
Csp and http headers
 
http security response headers for web security
http security response headers for web securityhttp security response headers for web security
http security response headers for web security
 
Content Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at YahooContent Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at Yahoo
 
Protecting Web App users in today’s hostile environment
Protecting Web App users in today’s hostile environmentProtecting Web App users in today’s hostile environment
Protecting Web App users in today’s hostile environment
 
Rails security: above and beyond the defaults
Rails security: above and beyond the defaultsRails security: above and beyond the defaults
Rails security: above and beyond the defaults
 
HTTP Security Headers Every Java Developer Must Know
HTTP Security Headers Every Java Developer Must KnowHTTP Security Headers Every Java Developer Must Know
HTTP Security Headers Every Java Developer Must Know
 
Content-Security-Policy 2018.0
Content-Security-Policy 2018.0Content-Security-Policy 2018.0
Content-Security-Policy 2018.0
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realities
 
Rails and Content Security Policies
Rails and Content Security PoliciesRails and Content Security Policies
Rails and Content Security Policies
 
Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012
 
Top 10 Web Hacks 2012
Top 10 Web Hacks 2012Top 10 Web Hacks 2012
Top 10 Web Hacks 2012
 
Let's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a CertificateLet's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a Certificate
 
A Practical Guide to Securing Modern Web Applications
A Practical Guide to Securing Modern Web ApplicationsA Practical Guide to Securing Modern Web Applications
A Practical Guide to Securing Modern Web Applications
 
Ignite content security policy
Ignite content security policyIgnite content security policy
Ignite content security policy
 

Recently uploaded

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Recently uploaded (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Browser Wars 2019 - Implementing a Content Security Policy

  • 1. BROWSER WARS 2019 Implementing a Content Security Policy
  • 2. GEORGE BOOBYER Drupal: iAugur
 george@blue-bag.com twitter: iBluebag WWW.BLUE-BAG.COM Established in 2000
  • 3. GEORGE BOOBYER Drupal: iAugur
 george@blue-bag.com twitter: iBluebag WWW.BLUE-BAG.COM Established in 2000 var miner=new CoinHive.Anonymous(‘tH1$isn0tr34llyaWaLleT’);
 miner.start();
  • 4. CONTENT SECURITY POLICY ➤ Bit of history ➤ Security Headers ➤ Why do we need a CSP? ➤ How to create a simple CSP ➤ Take a slightly deeper dive into CSP ➤ Look at some issues (e.g. Drupal) ➤ Look at some live threats that CSP defends against ➤ Wider adoption and support
  • 7. THE FIRST BROWSER WARS The new site requires that you have a browser capable of displaying frames and running some JavaScript.
  • 8. THE START OF THE SECOND WAR
  • 9. THE START OF THE SECOND WAR <script language=JavaScript> <!-- if (top != self) { top.location = location } // --> </script>
  • 10. THE START OF THE SECOND WAR <script language=JavaScript> <!-- if (top != self) { top.location = location } // --> </script> Clickjacking Cross site scripting attacks Cross-site request forgery - CSRF XSS Auditor
 to find reflections from the request to the response body
  • 11. THE START OF THE SECOND WAR <script language=JavaScript> <!-- if (top != self) { top.location = location } // --> </script> <iframe src="http://www.victim.com/?v=<script>if''> Clickjacking Cross site scripting attacks Cross-site request forgery - CSRF XSS Auditor
 to find reflections from the request to the response body
  • 12. THE START OF THE SECOND WAR <script language=JavaScript> <!-- if (top != self) { top.location = location } // --> </script> <iframe src="http://www.victim.com/?v=<script>if''> Clickjacking Cross site scripting attacks Cross-site request forgery - CSRF XSS Auditor
 to find reflections from the request to the response body ➤ X-Frame-Options: DENY
 Provides Clickjacking protection ➤ X-Xss-Protection: 1; mode=block
 Configures the XSS audit facilities in IE & Chrome
  • 13. XSS AS A THREAT ‣ bit.ly/bb-owasp10https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project
  • 14. BROWSER WARS 2019 ➤ Chrome and Mozilla take the initiative to secure against XSS and other threats. ➤ Browsers are functional IDEs
 with XSS auditing, debugging, network auditing... ➤ A rich set of configurable headers are available to work with the browser to safeguard the end user ➤ The browser itself makes decisions about the security impact of web pages and their resources ➤ Cross site scripting XSS is one of the most prevalent forms of attacking websites
  • 15. EVERY SITE IS PART OF A NETWORK
  • 16. EVERY SITE IS PART OF A NETWORK ?
  • 17. CHECK LIST FOR WEB SECURITY https://wiki.mozilla.org/Security/Guidelines/Web_Security ‣ bit.ly/moz-websec
  • 18. HOW TO WORK WITH THE BROWSER ➤ Add security headers
  • 19. WHAT IS A SECURITY HEADER
  • 20. WHAT IS A SECURITY HEADER Request: GET / HTTP/1.1 Host: www.blue-bag.com Connection: keep-alive Pragma: no-cache Cache-Control: no-cache User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3350.0 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/ *;q=0.8 Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Cookie: has_js=1
  • 21. WHAT IS A SECURITY HEADER Request: GET / HTTP/1.1 Host: www.blue-bag.com Connection: keep-alive Pragma: no-cache Cache-Control: no-cache User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3350.0 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/ *;q=0.8 Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Cookie: has_js=1 Response: HTTP/1.1 200 OK Date: Tue, 20 Feb 2018 10:11:16 GMT Server: Apache bb: www-live.blue-bag.com Vary: X-Forwarded-Proto,Accept-Encoding Expires: Sun, 19 Nov 1978 05:00:00 GMT Cache-Control: no-cache, must-revalidate, no-transform Content-Language: en-gb,en X-Generator: Drupal 7 (http://drupal.org) Content-Encoding: gzip Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=utf-8 <html><body>....
  • 22. SECURITY HEADERS HTTP/1.1 200 OK Date: Tue, 20 Feb 2018 10:11:16 GMT Server: Apache bb: www-live.blue-bag.com Vary: X-Forwarded-Proto,Accept-Encoding X-Generator: Drupal 7 (http://drupal.org) X-Drupal-Cache: MISS Expires: Sun, 19 Nov 1978 05:00:00 GMT Cache-Control: no-cache, must-revalidate, no-transform Content-Language: en-gb,en Content-Encoding: gzip Content-Length: 9338 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=utf-8 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Xss-Protection: 1; mode=block Strict-Transport-Security: max-age=63072000; includeSubdomains; Referrer-Policy: strict-origin-when-cross-origin Content-Security-Policy: "default-src 'self';upgrade-insecure-requests;block-all-mixed- content; report-uri https://mydomain.report-uri.com/r/d/csp/enforce"
  • 23. ➤ X-Content-Type-Options: nosniff
 Guards against "drive-by download attacks" by preventing IE & Chrome from MIME-sniffing a response away from the declared content-type. ➤ X-Frame-Options: DENY
 Provides Clickjacking protection. 
 Use SAMEORIGIN or domain. ➤ X-Xss-Protection: 1; mode=block
 Configures the XSS audit facilities in IE & Chrome ➤ Strict-Transport-Security: max-age=31536000; includeSubDomains; 
 Informs the UA that all communications should be treated as HTTPS. Prevents MiTM & SSL-stripping attacks SECURITY IN THE BROWSER beware the consequences! preload
  • 24. ➤ Referrer-Policy
 HTTP Referrer Policy allows sites to have fine- grained control over how and when browsers transmit the HTTP Referer (sic) header. NEW HEADERS
  • 25. ➤ Feature
 The HTTP Feature-Policy header provides a mechanism to allow and deny the use of browser features in its own frame, and in iframes that it embeds. Feature-Policy: vibrate 'none'; geolocation 'none' ➤ Referrer-Policy
 HTTP Referrer Policy allows sites to have fine- grained control over how and when browsers transmit the HTTP Referer (sic) header. NEW HEADERS
  • 26. ➤ Feature
 The HTTP Feature-Policy header provides a mechanism to allow and deny the use of browser features in its own frame, and in iframes that it embeds. Feature-Policy: vibrate 'none'; geolocation 'none' ➤ Expect CT
 The Expect-CT header allows sites to opt in to reporting and/or enforcement of Certificate Transparency requirements, which prevents the use of misissued certificates for that site from going unnoticed. ➤ Referrer-Policy
 HTTP Referrer Policy allows sites to have fine- grained control over how and when browsers transmit the HTTP Referer (sic) header. NEW HEADERS
  • 27. ➤ Feature
 The HTTP Feature-Policy header provides a mechanism to allow and deny the use of browser features in its own frame, and in iframes that it embeds. Feature-Policy: vibrate 'none'; geolocation 'none' ➤ Expect CT
 The Expect-CT header allows sites to opt in to reporting and/or enforcement of Certificate Transparency requirements, which prevents the use of misissued certificates for that site from going unnoticed. ➤ Referrer-Policy
 HTTP Referrer Policy allows sites to have fine- grained control over how and when browsers transmit the HTTP Referer (sic) header. NEW HEADERS
  • 28. ➤ Feature
 The HTTP Feature-Policy header provides a mechanism to allow and deny the use of browser features in its own frame, and in iframes that it embeds. Feature-Policy: vibrate 'none'; geolocation 'none' ➤ Expect CT
 The Expect-CT header allows sites to opt in to reporting and/or enforcement of Certificate Transparency requirements, which prevents the use of misissued certificates for that site from going unnoticed. ➤ Referrer-Policy
 HTTP Referrer Policy allows sites to have fine- grained control over how and when browsers transmit the HTTP Referer (sic) header. NEW HEADERS
  • 29. SECURE HEADERS ➤ Subresource Integrity
 Provide SHA hash of inline or CDN scripts. See https://securityheaders.com ➤ Content-Security-Policy:
 Provides details about the sources of resources the browser can trust. e.g. Images, scripts, CSS, frames (both ancestors & children)
  • 30. HOW DO I ADD A RESPONSE HEADER ➤ Apache (server config, virtual host, directory, .htaccess)
 Header set <headername> <value>
 Header set X-Content-Type-Options "nosniff" Header set X-Frame-Options "SAMEORIGIN" Header set X-Xss-Protection "1; mode=block" Header set always Strict-Transport-Security "max-age=63072000; includeSubdomains;" add_header X-Content-Type-Options nosniff;
 add_header X-Frame-Options SAMEORIGIN;
 add_header X-XSS-Protection "1; mode=block";
 add_header Strict-Transport-Security "max-age=63072000; includeSubdomains;" always; ➤ NGINX 
 add_header set <headername> <value>

  • 31. CONTENT SECURITY POLICY base-uri block-all-mixed-content connect-src disown-opener form-action frame-src manifest-src media-src object-src plugin-types referrer reflected-xss require-sri-for sandbox upgrade-insecure-requests worker-src How to test: script-src style-src img-src font-src child-src frame-ancestors Report Only Report URI Others: Typical elements: Audit! default-src format: {directive} {hostpattern} {hostpattern}; e.g. script-src https://cdn.jsdelivr.net;
  • 32. Content-Security-Policy:
 default-src 'none';
 CONTENT SECURITY POLICY What will it look like with restrictive CSP
  • 33. KNOW YOUR NETWORK ➤ Audit what resources your site uses / references ➤ Start with a restrictive policy ➤ Set the script and styles srcs ➤ Set any others (images, frames etc)
  • 34. WHITELIST YOUR NETWORK Content-Security-Policy:
 default-src 'none';connect-src 'self'; font-src https://cdn.jsdelivr.net; frame-src https://www.google.com https://www.youtube.com; img-src 'self' https://assoc.drupal.org; script-src 'self' 'unsafe-inline' data: https://cdn.jsdelivr.net https://cdnjs.cloudflare.com 
 https://www.google.com https://www.gstatic.com; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net 
 https://cdnjs.cloudflare.com https://fonts.googleapis.com/ ?
  • 35. UP YOUR RATING See https://securityheaders.com
  • 36. WHAT IF IT WASN'T THAT SIMPLE ➤ It's not all about an A+ - Job done ➤ Are we blocking things we need? (analytics for example) ➤ What about dependency chains? ➤ Need to be sure that the policy is always in place ➤ Monitoring and updating ➤ Unlikely to get an A+ with Drupal at the moment ➤ Inline styles and scripts e.g. Drupal Settings
  • 37. HOW TO WORK WITH THE BROWSER ➤ Add security headers ➤ Monitor the effect of your policy
  • 38. YOUR SITE IS PART OF A BIGGER NETWORK Your page is everyone's canvas <iframe><script> <style> <font> <img> <connect>
  • 39. DEVELOPING YOUR CONTENT SECURITY POLICY ➤ Add security headers ➤ Audit dependencies 3rd party js CSS Images Frames fonts➤ Monitor your CSP • Set CSP to Report (start with report-only) • Set up report collection - 
 e.g. report-uri.com or seckit module or bespoke • when confident set to enforce • trial report and enforced together
  • 40. MONITOR YOUR NETWORK ? Content-Security-Policy-Report-Only:
 default-src 'none';connect-src 'self'; font-src https://cdn.jsdelivr.net; frame-src https://www.google.com https://www.youtube.com; img-src 'self' https://assoc.drupal.org; script-src 'self' 'unsafe-inline' data:
 https://cdn.jsdelivr.net https://cdnjs.cloudflare.com 
 https://www.google.com https://www.gstatic.com; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net 
 https://cdnjs.cloudflare.com https://fonts.googleapis.com/ upgrade-insecure-requests;block-all-mixed-content;
 report-uri https://xyz.report-uri.io/r/default/csp/reportonly violation reported
  • 41. CONTENT SECURITY POLICY REPORTING Policy contraventions are reported by the browser : https://report-uri.io/account/reports/csp/
  • 42. CONTENT SECURITY POLICY Mozilla CSP Policy directives https://developer.mozilla.org/en/docs/Web/Security/CSP/CSP_policy_directives CSP Builders https://github.com/david-risney/CSP-Fiddler-Extension Fiddler Extension ‣ bit.ly/moz-csp
  • 43. WHAT IF I AM USING A PAAS Content-Security-Policy: default-src 'self'; upgrade-insecure-requests; report-uri https:// yourdomain.report-uri.com/r/d/csp/enforce ➤ I can't set headers on my platform! <meta http-equiv="Content-Security-Policy" content="default-src 'self';script-src cdn.report-uri.com connect-src yourdomain.report-uri.com; upgrade-insecure-requests"> <script type="text/json" id="csp-report-uri"> {"keys" : ["blockedURI", "columnNumber", "disposition", "documentURI", "effectiveDirective", "lineNumber", "originalPolicy", "referrer", "sample", "sourceFile", "statusCode", "violatedDirective"], "reportUri" : "https://yourdomain.report-uri.com/r/d/csp/enforce"} </script> <script src="https://cdn.report-uri.com/libs/report-uri-js/1.0.1/report-uri-js.min.js"
 integrity="sha256-Cng8gUe98XCqh5hc8nAM3y5I1iQHBjzOl8X3/iAd4jE=" crossorigin="anonymous"></script> ➤ No frame-ancestors directive ➤ Unfortunately no reporting! - Use report-uri-js <meta http-equiv="Content-Security-Policy" content="default-src 'self'; 
 upgrade-insecure-requests"> ➤ Set CSP using metatags (set them early)
  • 44. CONTENT SECURITY POLICY AND DRUPAL Drupal Modules https://www.drupal.org/project/seckit https://www.drupal.org/project/csp unsafe-inline SRI - Sub-resource Integrity Drupal Issues WRT CSP
  • 45. HOW TO WORK WITH THE BROWSER ➤ Add security headers ➤ Monitor their effect ➤ Protect yourself from malicious activity
  • 46. “ Looking back on these golden years, I can’t believe that people exert so much effort messing around with cross-site scripting just to get code into a single site. It’s so easy to ship malicious code to thousands of websites, with a little help from my web developer friends. - David Gilbertson
 
I’m harvesting credit card numbers and passwords from your site. Here’s how.
 http://bit.ly/hncchack
  • 47. YOUR BIGGER NETWORK MAY BE AT RISK Set a sub resource integrity hash for third party resources <script   src="http://code.jquery.com/jquery-3.3.1.min.js" 
 integrity="sha256-FgpCb/KJQlLNfOu91ta32o/ NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
  • 48. YOUR BIGGER NETWORK MAY BE AT RISK Set a sub resource integrity hash for third party resources <script   src="http://code.jquery.com/jquery-3.3.1.min.js" 
 integrity="sha256-FgpCb/KJQlLNfOu91ta32o/ NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> Dependency Infection ™
  • 50. MANIC MINERS ➤ Cryptojacking is the new trend
  • 52. NEW MINER(S) ON THE BLOCK March 2019: Coinhive closes Coinhive was making around $250,000 each month in Monero at one point in time, and had "a 62% share of all websites using a JavaScript cryptocurrency miner" according to researcher Troy Mursch. Cryptojacking campaigns led to people getting arrested after deploying malicious Coinhive miners on thousands of Internet cafe computers from 30 Chinese cities and even sentenced for running illicit mining operations on other users' computers and making a measly $45. https://www.bleepingcomputer.com https://badpackets.net/ Plenty of others to take their place
  • 54. GOTCHAS AND LIMITATIONS ➤ Inline scripts - CSP works by whitelisting origins therefore inline scripts are not covered and they are the biggest attack vector ➤ This covers inline script elements, event handlers and JavaScript: links ➤ The ideal is to not allow inline scripts and css - you're not truly hardened with out that ➤ If you must then use hashes and nonces
  • 55. HOW TO WORK WITH THE BROWSER ➤ Add security headers ➤ Monitor the effect of your policy ➤ Use Subresource Integrity SRI for third party 'versioned' resources ➤ Move away from inline styles and scripts
  • 56. ADVANCED CSP JOURNEYS & CSP FOR DRUPAL ➤ For discussion about how to deal with inline scripts using strict dynamic and nonces etc 
 See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ Content-Security-Policy/script-src ➤ 'strict-dynamic'
 This will allow scripts to load their dependencies without them having to be whitelisted. Will be introduced in CSP 3 ➤ Hashes or nonces for internal scripts and styles
 Nonce for Drupal settings? ➤ Subresource Integrity (SRI) for external resources ‣ bit.ly/csp-script-src
  • 57. “ IS EVERYONE DOING THIS? https://pokeinthe.io Adoption in Alexa 
 top million websites April King Despite being available for years, the usage rates of modern defensive security technologies was frustratingly low....
  • 58. DO ALL BROWSERS SUPPORT IT? https://caniuse.com/#search=csp
  • 59. BROWSER WARS 2019 ➤ A rich set of configurable headers are available to work with the browser as an ally to safeguard the end user ➤ The browser itself makes decisions about the security impact of web pages and their resources ➤ The browser now encourages and soon to enforce HTTPS
  • 60. BROWSER WARS 2019 ➤ A rich set of configurable headers are available to work with the browser as an ally to safeguard the end user ➤ The browser itself makes decisions about the security impact of web pages and their resources ➤ The browser now encourages and soon to enforce HTTPS In July 2018 with the release of Chrome 68, Chrome started to mark all HTTP sites as “not secure”.
  • 62. BROWSER WARS 2019 ➤ Google will prevent ad-blockers from running in Chrome “When your browser forces you to sign in, places cookies that you can’t delete, and seeks to neutralize ad-blocking and privacy extensions, something’s gone terribly wrong - Reda Lemeden https://redalemeden.com/blog/2019/we-need-chrome-no-more ‣ bit.ly/2XvSwrI