๐—ฆ๐˜๐—ผ๐—ฝ ๐—–๐—ฆ๐—ฅ๐—™ ๐—”๐˜๐˜๐—ฎ๐—ฐ๐—ธ๐˜€ ๐—œ๐—ป ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐—ฃ๐—›๐—ฃ ๐—”๐—ฑ๐—บ๐—ถ๐—ป ๐—ฃ๐—ฎ๐—ป๐—ฒ๐—น

A researcher found a hole in my admin panel. He published a video to the front page using a fake form. He did not need a password. This is CSRF.

Standard tokens failed for two reasons.

I used double-submit cookies instead.

Plain cookies have one flaw. Subdomains send fake cookies. I fixed this with two steps.

Follow these rules for your code.

The researcher now gets a 403 error. Your admin panel must be secure by default.

Source: https://dev.to/ahmet_gedik778845/implementing-csrf-double-submit-cookies-in-a-php-video-admin-panel-2c60