What Cross-site scripting (XSS) means
XSS can steal sessions, deface pages or redirect users. It usually comes from code that displays user input without cleaning it, often in plugins. Secure coding, updates and a Content Security Policy reduce the risk.
Why it matters for your website
An XSS flaw can let attackers steal login sessions, redirect customers to scam sites or skim payment details entered on your pages. These bugs often come from outdated plugins or custom code that does not clean user input. Keeping software updated and coding carefully closes most of these holes.
A vulnerable comment plugin on a small news site lets an attacker post a comment containing a hidden script. Updating the plugin and cleaning the stored comments removes the threat.
Tips
- Update plugins and themes quickly when security fixes are released.
- Remove unused plugins, since they can still carry vulnerabilities.
- Use a Content Security Policy as an extra layer of defense.
Common mistakes
- Displaying user input on a page without escaping it first.
- Ignoring security update notices because the site seems to work fine.

