← PHP / Laravel · Contents

PHP-085 / Beginner

Clickjacking: allowing framing

A05:2021 Security Misconfiguration · CWE-1021 Improper Restriction of Rendered UI Layers

Why is this a problem?

Users are made to click buttons through a transparent iframe.

How to fix it

php
$response->headers->set('X-Frame-Options', 'DENY');
$response->headers->set('Content-Security-Policy', "frame-ancestors 'none'");

Further reading