Top Banner
Web Security Course: EPL 682 Name: Savvas Savva [1] A. Barth and C. Jackson and J. Mitchell , “Robust Defenses for Cross-Site Request Forgery”, pub. in 15th ACM Conference, 2008. [2] L. Huang and A. Moshchuk and H. Wang , “Clickjacking: Attacks and Defenses”, pub. in USENIX Security Symposium, 2012.
57

Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Mar 24, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Web SecurityCourse: EPL 682

Name: Savvas Savva

[1] A. Barth and C. Jackson and J. Mitchell , “Robust Defenses for Cross-Site Request Forgery”, pub. in 15th ACM Conference, 2008.[2] L. Huang and A. Moshchuk and H. Wang , “Clickjacking: Attacks and Defenses”, pub. in USENIX Security Symposium, 2012.

Page 2: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Robust Defenses for Cross-Site Request Forgery

Course: EPL 682Name: Savvas Savva

This presentation is based on:[1] A. Barth and C. Jackson and J. Mitchell , “Robust Defenses for Cross-Site Request Forgery”, pub. in 15th ACM Conference, 2008.

Page 3: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

CSRF AttackCSRF = Cross-Site Request Forgery:

● The victim's browser, instructed by a malicious “site”, sent a request to an

honest site.

● This attack: ○ Leveraging Network Connectivity.

○ Leveraging Browser state.

○ Disrupts integrity of the victim session with a honest site.

○ In login CSRF attack, an attacker uses the victim’s browser to forge a cross-site

request to the honest site’s login URL, supplying the attacker’s username and

password.

Page 4: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Contribution / Contents● Paper Contribution about the topic:

○ A good explanation of the CSRF threat model.

○ A study of current browser behavior.

○ A proposal for an Origin header containing the information necessary for CSRF defense.

○ A study of related session initialization vulnerabilities.

Page 5: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

CSRF Definition● Network Connectivity.

● Read Browser State.

● Write Browser State.

● In-Scope Threats○ Forum Poster.

○ Web Attacker.

○ Network Attacker.

Page 6: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Attack A: Login CSRF Attack

Page 7: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Another CSRF Attack Detailed

Page 8: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Defending Techniques● Using a secret request Token:

○ Validating using this secret token.

○ Fraught with pitfalls.

○ A Popular technique.

● Validating the HTTP Referer Header○ Simple technique.

○ Referer header can be suppressed.

● Validating Custom Headers attached to XMLHttpRequests○ Ajax interface.

○ Requires sites to valid all state-modifying requests.

Page 9: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Experiment Design ● Build Advertising networks and make it available from 5 April 2008 to 8

April 2008.

● 283945 advertisement impressions from 163767 unique IP address.

● GET and POST requests both over HTTP and HTTPS.

● Requests are generated by submitting forms, requesting images, and

issuing XMLHttpRequests.

● Same-domain requests to the primary server and cross-domain requests

to the secondary server.

● Log Referer header, User-Agent header, date, client’s class C network,

session identifier, document.referer .

● Did not log the client’s IP address, instead logged the HMAC of client’s IP

address.

Page 10: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

img Tag with malicious URL

Page 11: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

img tag with malicious URL<script>

document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" :

"http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E"));

</script>

<noscript>

<img src="http://b.scorecardresearch.com/p?c1=2&c2=8027488&c3=&c4=&c5=&c6=&c15=&cj=1" />

</noscript>

Page 12: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Execute malicious form using Http/Https POST Method

Page 13: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Experiment Results

Page 14: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Experiment Results● The Referer header is suppressed more often for HTTP requests than for

HTTPS requests.

● Browsers that suppress the Referer header also suppress the

document.referrer value.

● But when Referer is suppressed in the network, the document.referrer

value is not suppressed.

Page 15: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Experiment Results● The document.referrer value being suppressed:

○ PlayStation 3 browser does not support

○ Opera suppresses for cross-site HTTPS request

○ Bug in Firefox 1.0 and 1.5

Page 16: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Experiment Conclusions● CSRF Defense over HTTPS

○ HTTP: percentage (3-11%) of users

○ HTTPS: percentage (0.05-0.22%) of users

○ Site must reject requests that omit the Referer header

● Privacy Matters○ Must address privacy concerns in order to effective in large-scale deployments

Page 17: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Proposed SolutionOrigin Header:

● Privacy○ Includes only the information required to identify the principal that initiated the request.

○ Sent only for POST requests.

● Server Behavior○ All state-modifying requests, including login requests, must be sent using the POST

method.

○ Server must reject any requests whose Origin header contains an undesired value.

Page 18: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Proposed SolutionOrigin Header:

● Security Analysis○ Rollback and Suppression, DNS Rebinding ,Plug-ins

● Adoption○ Improves and unifies four other proposals and has been adopted by several working

groups

● Implementation○ Browser side: WebKit, Safari, Firefox

○ Server side: ModSecurity, Apache

Page 19: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

What exactly is Origin header ● Improves and unifies previous proposals:

○ Cross-Site XMLHttpRequest: The proposed standard for cross-site XMLHttpRequest

included a Access-Control-Origin header to identify the origin issuing the request.

○ XDomainRequest: The XDomainRequest API in Internet Explorer 8 Beta 1 sends cross-site

HTTP requests that omit the path and query from the Referer header.

Page 20: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

What exactly is Origin header ● Improves and unifies previous proposals:

○ JSONRequest: The JSONRequest API for crosssite HTTP requests included a Domain

header that identifies the host name of the requester.

○ Cross-Document Messaging: The HTML 5 specification proposes a new browser API for

authenticated client-side communication between HTML documents

Page 21: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

To clear misleading

● Http Referer Header not equal to the proposed Origin Header.

● The Origin header is became HTML5 feature.

Page 22: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Malicious XMLHttpRequest

Page 23: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Session Initialization● Authenticated as User

○ Predictable session identifier

● Authenticated as Attacker○ Login CSRF

● Two common approaches to mounting an attack on session initialization○ HTTP Requests and Cookie Overwriting

Page 24: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

HTTP Requests● OpenID:

1. Web attacker visits the Relying Party (Blogger) and beings the

authentication process with the Identity Provider (Yahoo!)

2. Identity Provider redirects the attacker’s browser to the “return to”

URL of the Relying Party

3. Attacker directs the user’s browser to the return to URL

4. The Relying Party completes the OpenID protocol and stores a

session cookie in the user’s browser

5. The user is now logged in as the attacker

Page 25: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

HTTP Requests● PHP Cookieless Authentication:

1. The web attacker logs into the honest web site.

2. The web attacker redirects the user’s browser to the URL currently

displayed in the attacker’s location bar.

3. Because this URL contains the attacker’s session identifier, the user is

now logged in as the attacker.

Page 26: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Cookie Overwriting● An active network attacker can supply a Set-Cookie header over a HTTP

connection to the same host name as the site and install either a Secure

or a non-Secure cookie of the same name

● Defense cannot be deployed “without breaking standards and existing

web apps”

● Cookie-Integrity header

Page 27: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Related Work● RequestRodeo

○ Strips implicit authorization information from outgoing cross-site HTTP requests

○ Breaks existing web site functionality

● CAPTCHA○ Attacker can manually solve CAPTCHAs

○ Attacker can address captchas to be solved online from captcha solvers.

Page 28: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Conclusions● Login CSRF

○ Strict Referer validation

● Third-party Content○ Images, hyperlinks should use a framework that implements secret token validation

correctly

● Origin header○ Eliminating the privacy concerns

○ HTTPS and non-HTTPS requests both work

Page 29: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Thanks For Watching!Any Questions?

Page 30: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Clickjacking: Attacks and Defenses

Course: EPL 682Name: Savvas Savva

This presentation is based on: [2] L. Huang and A. Moshchuk and H. Wang , “Clickjacking: Attacks and Defenses”, pub. in USENIX Security Symposium, 2012.

Page 31: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Introduction● Defining clickjacking

○ The user is tricked to click on something he didn’t intend to click on.

● Existing defenses are insufficient○ This is proven in this paper with three new attack variants from existing clickjacking

techniques.

○ Clickjacking attacks can cause severe damages.

○ Better results and more effective than Social engineering.

● New defense to address root causes○ The paper user study demonstrates its effectiveness.

Page 32: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

What is Clickjacking ?Simple definition:

The user is tricked to click on something he didn’t intend to click on.

An attacker application presents a sensitive UI Element of a target application

out of context to a user (e.g. hiding sensitive UI ELement by make it

transparent ect).

Some examples:

● Likejacking

● Sharejacking

(Transparently overlaying on

top of a safe UI element)

Page 33: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Defining clickjacking Formally● Prerequisite: multiple mutually distrusting

applications sharing the same display.

● An attack application

compromises context

integrity of another

application’s UI when

the user acts on the UI.

Page 34: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Hiding the target Element - Likejacking Example

Claim

Your Free

iPad Pro

Temporal integrity , for some noticeable amount of time transform to facebook page like button

C

B

A

Cursorjacking is not Performed. Could be done Using CSS cursor property. Also, can perform strokejacking attack for fake blink in keyboard typing cursor and fake text input. The same appears in twitter tweet button to create the TweetBomb attack. Video link : https://www.youtube.com/watch?v=zbbYBKDUPDU,

From Daniel Correa . All rights to him.

Page 35: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Compromise visual integrity – target● Hiding the target as previously shown.

Use opacity 0 in css or attribute hidden.

● Partial overlaysFor example in the older trusted paypal checkout

iFrame.

● CroppingCrop elements in other visa checkout payments or

the old paypal iFrame and leave only a pay button.

Page 36: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Existing defenses to protect visual integrity● User confirmation

○ Degrades user experience.

● UI randomization○ Unreliable (e.g. multi-click attacks).

● Framebusting (X-Frame-Options)○ Incompatible with embedding 3rd-party objects.

Page 37: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Existing defenses to protect visual integrity● Opaque overlay policy (Gazelle browser)

○ Breaks legitimate sites.

● Visibility detection on click (NoScript)○ False positives.

Page 38: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Protecting temporal integrity ● Imposing a delay after displaying UI

○ Annoying to user.

None of current defenses consider pointer (Photo from Lifehacker)

Page 39: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Proposed Clickjacking Attack1. Accessing user’s webcam

2. Stealing user’s email

3. Revealing user’s identity

Page 40: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Evaluating attacks• 2064 Amazon Mechanical Turk web users

– Cost was 25 cents per user.

– Users can only participate once, and only for one Treatment.

– The user study on Amazon Mechanical Turk shows that people fall for

these attacks with success rate 43% to 98%.

Page 41: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Accessing User’s Webcam - Cursor Spoofing Attack

Attack technique: cursor-spoofing Attack success: 43% (31/72)

Page 42: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Stealing User’s Emails Double Click Attack

Attack technique: pop-up window

Attack success: 47% (43/90)

Page 43: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Revealing User’s Identity - LikeJacking Attack● Compromise web surfing anonymity. Whack-a-mole game.

Attack technique: cursor-spoofing + fast-paced clicking

Attack success: 98% (83/84)

Page 44: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

InContext Defense Design Goals:

● Should support embedding 3rd-party objects.

● Should not prompt users for their actions.

● Should not break existing sites.

● Should be resilient to new attack vectors.

Page 45: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

InContext Defense

Page 46: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Proposed InContext Defense● InContext let websites mark their sensitive ui elements and then lets the

browsers enforce the context integrity of user actions on the sensitive UI

Elements.

● A set of techniques to ensure context integrity

for user actions.

● Server opt-in approach:

– Let websites indicate their sensitive UIs.

– Let browsers enforce context integrity

when users act on the sensitive UIs.

Page 47: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Ensuring visual integrity of target● Dynamic OS-level screenshot comparison

– processing delay on click < 30ms (prototype on IE 9)

Page 48: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Ensuring visual integrity of pointer● Remove cursor customization

– Attack success: 43% -> 16%

● Freeze screen around target on pointer entry

– Attack success: 43% -> 15%

– Attack success (margin=10px): 12%

– Attack success (margin=20px): 4% (baseline:5%) (GOOD)

● Lightbox effect around target on pointer entry – Attack success (Freezing

+ lightbox): 2%

Page 49: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Accessing User’s Webcam Attack

Attack technique: cursor-spoofing Attack success: 43% (31/72)

Page 50: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Enforcing temporal integrity

● UI delay: after visual changes on

target or pointer, invalidate clicks

for some ms

● Pointer re-entry: after visual

changes on target, invalidate clicks

until pointer re-enters target

Page 51: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper
Page 52: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Enforcing temporal integrity● UI delay: after visual changes on target or

pointer, invalidate clicks for some ms

– Attack success (delay=250ms):

47% -> 2% (2/91)

– Attack success (delay=500ms):

1% (1/89)

● Pointer re-entry:

after visual changes on target,

invalidate clicks until pointer

re-enters target – Attack success: 0% (0/88)

Page 53: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Stealing User’s Emails Double Click Attack

Attack technique: pop-up window

Attack success: 47% (43/90)

Page 54: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Whack-a-mole attack● Exclude victims who were moving their pointer around the Like button for

many seconds, and deliberating whether or not to click.

● Defense against clickjacking aspects:

– Screen freezing, margin=20px: 98% -> 16%

– Screen freezing, margin=20px, pointer entry delay=500ms: 4%

– Screen freezing, margin=20px, pointer entry delay=1000ms: 1%

● Social Engineering:

– 63% users intentionally clicked on Like button after the proposed

defenses made them fully aware of this.

Page 55: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Revealing User’s Identity Attack

Attack technique: cursor-spoofing + fast-paced clicking

Attack success: 98% (83/84)

Page 56: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Conclusion● This paper demonstrates new clickjacking variants that can evade current

defenses.

● The paper user studies show that our attacks are highly effective (success

rates 43% to 98%).

● In the paper the InContext defense can be very effective against

clickjacking.

Page 57: Web Security - UCY · Defining clickjacking The user is tricked to click on something he didn’t intend to click on. Existing defenses are insufficient This is proven in this paper

Thanks For Watching!Any Questions?