Skip to content

Commit e8661bf

Browse files
committed
Added section for cookie samesite attribute
1 parent 9e593cc commit e8661bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

4-frames-and-windows/06-clickjacking/article.md

+6
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ The demo:
189189

190190
[codetabs src="protector"]
191191

192+
## Samesite cookie attribute
193+
194+
The `samesite` cookie attribute can also prevent clickjacking attacks. The purpose of the attribute is to prevent cookies from being sent to a website when the user doesn't intend to visit the website. It mainly prevents cross-site request forgery attacks, but also helps with clickjacking. When a cookie has the `samesite` attribute, whether the value is `strict` or `lax`, cookies are not sent to a website when it is loaded inside an iframe. A clickjacking attempt would fail because the user is not considered logged into, for example, Facebook, so they can't "Like" anything through the iframe.
195+
196+
The samesite attribute will not have an effect when cookies are not used. This may allow websites to easily show public, unauthenticated pages in iframes on unaffiliated websites. However, this may also allow clickjacking attacks to work in a few limited cases. An anonymous polling website that prevents duplicate voting by checking IP addresses, for example, would still be vulnerable to clickjacking because it does not authenticate users using cookies.
197+
192198
## Summary
193199

194200
Clickjacking is a way to "trick" users into clicking on a malicious site without even knowing what's happening. That's dangerous if there are important click-activated actions.

0 commit comments

Comments
 (0)