creating custom browser extensions › hitbsecconf2018dxb... · host header injection w - the...

23
Creating custom browser extensions

Upload: others

Post on 09-Jun-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

Creating custom browser extensions

Page 2: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

whoami● Rewanth Cool - @Rewanth_Cool

● Full stack developer

● Open source contributor

● Penetration tester

● Bug bounty hunter

● CTF player

● Event organizer

Page 3: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

ComparisonSheet

Page 4: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

What this talk is about● Low hanging fruits

○ CORS

○ Host header injection

○ Clickjacking

● Firefox extension to detect above vulnerabilities

Page 5: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

BASICS FIRST

Page 6: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

We will discuss all vulnerabilities in simple WEBD terms.

What it is ?

Exploitability

Biggest Bounties

Detection

Page 7: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

CORS MisconfigurationW - Gives permissions to load scripts/request resources from other pages/domains.

E - If the website allows loading scripts, then attackers will be able to exploit it.

B - https://hackerone.com/reports/235200 ($1000)

D - $(curl -I URL -H “Origin: evil.com”)

Page 8: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

CORS Misconfiguration (Cont..,)Request headers - Origin: evil.com

Access-Control-Allow-Origin: ( http://evil.com || * || null )

Access-Control-Allow-Credentials: true

Page 9: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

Host Header InjectionW - The host-Header tells the webserver which virtual host to use (if set up).

E - Causes redirection, Password Reset Poisoning(change host header to evil.com and

reset link gets emailed as evil.com/token/lja830ru28f)

B - https://hackerone.com/reports/317476 ($7560)

D - Modify/Add X-Forwarded-Host header and

page redirects to evil.com

Page 10: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

Host Header Injection (Cont..,)Request headers - X-Forwarded-Host: attacker.com

Response headers - Location: http://attacker.com/*

Find-virtual-hosts (https://pentest-tools.com/information-gathering/find-virtual-hosts)

Page 11: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

ClickjackingW - Used to load/embed particular iframes in a website

E - Attackers can load embedded hidden iframes if options are not set properly.

B - https://medium.com/@raushanraj_65039/google-clickjacking-6a04132b918a

($12600)

D - if x-frame-options is missing, then its likely vulnerable to clickjacking

Page 12: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

Clickjacking (Cont..,)Response headers -

X-Frame-Options: DENY

X-Frame-Options: SAMEORIGIN

X-Frame-Options: ALLOW-FROM *.domain.com

Page 13: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

vuln-headers-extensionhttps://github.com/rewanth1997/vuln-headers-extension/

https://medium.com/@rewanthcool/firefox-vuln-headers-extension-e848b6d80d14

Page 14: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,
Page 16: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

manifest.json

Page 17: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

browserAction event listeners

Page 18: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

browserAction event SYNTAX

Page 19: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

onBeforeSendHeaders event SYNTAX

Page 20: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

onHeadersReceived event SYNTAX

Page 21: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

DEMO TIME

Page 22: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

Any doubts?

Page 23: Creating custom browser extensions › hitbsecconf2018dxb... · Host Header Injection W - The host-Header tells the webserver which virtual host to use (if set up). E - Causes redirection,

THANK YOU