🚫
Security

XSS attacks: Cross-Site Scripting protection

10.02.2025
← All articles

XSS — executing foreign JavaScript on your site. Cookie theft, session hijack.

Types

Reflected, Stored, DOM-based.

Protection: escaping

htmlspecialchars($input, ENT_QUOTES, 'UTF-8').

CSP

Content-Security-Policy header — blocks external scripts.

HttpOnly cookies

JS can't read cookies.

Framework auto-escape

React, Vue, Angular.

Related articles

🔐 Laravel Application Security: Debug Mode, APP_KEY and Protecting .env 🧩 Checking Composer packages for security: a guide for PHP project owners 🈲 Japanese SEO spam hack: strange pages from your site appear in Google 🐘 Critical PHP vulnerabilities: why you should not delay updating
🌐 Language
🇺🇿 O⁠'zbek 🇺🇿 Özbek (yangi) 🇺🇿 Ўзбек 🇷🇺 Русский 🇬🇧 English ✓