XSS

보안

정의

크로스 사이트 스크립팅(Cross-Site Scripting). 공격자가 다른 사용자가 보는 웹 페이지에 악성 스크립트를 삽입할 수 있는 웹 취약점. XSS는 세션 쿠키 탈취, 사용자 리디렉션, 웹사이트 훼손 등을 유발할 수 있으며, 출력 인코딩과 CSP 헤더로 완화할 수 있습니다.

Reflected vs. Stored vs. DOM XSS

Cross-Site Scripting injects malicious scripts into web pages viewed by other users. Reflected XSS embeds the payload in a URL parameter; the server echoes it back and the browser executes it. Stored XSS persists the payload in a database (a comment, a username) and fires for every visitor who loads that content. DOM-based XSS never touches the server — client-side JavaScript writes attacker-controlled data into the DOM without sanitization.

Real-World Impact

XSS payloads can steal session cookies (bypassing HTTPSHTTP Secure. The encrypted version of HTTP that uses TLS to protect data in transit between a browser and a web server. Identified by the padlock icon in browsers and the https:// URL scheme. if the HttpOnly flag is missing), redirect users to PhishingA social engineering attack that uses fraudulent emails, websites, or messages to trick users into revealing credentials, financial data, or installing malware. Spear phishing targets specific individuals with personalized content. pages, log keystrokes, or silently exfiltrate form data. When combined with CSRFCross-Site Request Forgery. An attack that tricks an authenticated user's browser into sending an unintended request to a web application. Prevented by anti-CSRF tokens, SameSite cookies, and verifying the Origin header., XSS can perform authenticated actions on behalf of the victim without any user interaction.

Defense Strategies

SQL InjectionA code injection attack that inserts malicious SQL statements into application input fields to manipulate or extract data from a backend database. Prevented by parameterized queries and input validation. and XSS are the two most widespread web injection vulnerabilities; both are addressed by the same principle — never trust user input.

관련 용어

보안에서 더 보기