

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Cross-Site Scripting (XSS)
incomplete
2: Fix Cross-Site Scripting
incomplete
3: Cross-Site Request Forgery (CSRF)
incomplete
4: CSRF Tokens
incomplete
5: Content Security Policy
incomplete
6: Legitimate Inline Scripts
incomplete
7: Sandboxing 'iframe' Elements
incomplete
8: Clickjacking
incomplete
9: Same-Origin and Referrer Policies
incomplete
10: Cross-Origin Resource Sharing
incomplete
11: CORS in Express
incomplete
12: Helmet
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Clickjacking tricks a user into clicking on a real application that has been disguised (or hidden) inside an attacker's page.
The attacker might place a sensitive page underneath a fake button:
<button>Claim free gems</button>
<iframe
src="https://bank.example.com/confirm-transfer"
style="opacity: 0; position: absolute; top: 0; left: 0;"
></iframe>
If the victim is signed in to bank.example.com, the framed page loads with their bank session. The attacker doesn't need to read the page, they just need to bait the victim into clicking on the fake button and triggering the real page's action.
The frame-ancestors CSP directive controls which parent origins can embed a response:
Content-Security-Policy: frame-ancestors 'self'
'self' allows same-origin parents while blocking an attacker's origin.
The older X-Frame-Options header can provide a fallback for older browsers:
X-Frame-Options: SAMEORIGIN
If your app never needs to be framed, just use frame-ancestors 'none' and X-Frame-Options: DENY. If it intentionally supports same-origin framing, use 'self' and SAMEORIGIN instead.
Bearly Evil can frame Bearly Secure's account page. Block cross-origin framing without breaking Acorn Express.
npm run attacker-lab
With Bearly Secure and Bearly Evil still running, run and submit the CLI tests from the project root.
You can stop Bearly Evil after successfully submitting this lesson.