Thursday, December 24, 2020

Clickjacking

  • Clickjacking

Clickjacking, also known as a “UI redress attack”, is when an attacker uses multiple transparent or opaque layers to trick a user into clicking on a button or link on another page when they were intending to click on the top level page. Thus, the attacker is “hijacking” clicks meant for their page and routing them to another page, most likely owned by another application, domain, or both.

Using a similar technique, keystrokes can also be hijacked. With a carefully crafted combination of stylesheets, iframes, and text boxes, a user can be led to believe they are typing in the password to their email or bank account, but are instead typing into an invisible frame controlled by the attacker

Examples
For example, imagine an attacker who builds a web site that has a button on it that says “click here for a free iPod”. However, on top of that web page, the attacker has loaded an iframe with your mail account, and lined up exactly the “delete all messages” button directly on top of the “free iPod” button. The victim tries to click on the “free iPod” button but instead actually clicked on the invisible “delete all messages” button. In essence, the attacker has “hijacked” the user’s click, hence the name “Clickjacking”.

Defending against Clickjacking
There are two main ways to prevent clickjacking:

Sending the proper Content Security Policy (CSP) frame-ancestors directive response headers that instruct the browser to not allow framing from other domains. (This replaces the older X-Frame-Options HTTP headers.)
Employing defensive code in the UI to ensure that the current frame is the most top level window

https://owasp.org/www-community/attacks/Clickjacking#:~:text=Clickjacking%2C%20also%20known%20as%20a,on%20the%20top%20level%20page.

  1. Clickjacking categories

Classic: works mostly through a web browser
Likejacking: utilizes Facebook's social media capabilities
Nested: clickjacking tailored to affect Google+
Cursorjacking: manipulates the cursor's appearance and location
MouseJacking: inject keyboard or mouse input via remote RF link
Browserless: does not use a browser
Cookiejacking: acquires cookies from browsers
Filejacking: capable of setting up the affected device as a file server
Password manager attack: clickjacking that utilizes a vulnerability in the autofill capability of browsers

Prevention

Client-side
NoScript
NoClickjack
GuardedID
Gazelle
Intersection Observer v2

Server-side
Framekiller
X-Frame-Options
Content Security Policy

https://en.wikipedia.org/wiki/Clickjacking