While reviewing logs, a security administrator identifies the following code: Which of the following best describes the vulnerability being exploited?
Choose an answer
Tap an option to check your answer.
Correct answer: XSS.
Why this is the answer
The code document.cookie is JavaScript, and its presence in a log often indicates an attempt to steal session cookies. This is a classic example of a Cross-Site Scripting (XSS) attack. XSS vulnerabilities allow attackers to inject malicious client-side scripts into web pages viewed by other users, often to bypass access controls, impersonate users, or steal sensitive information like cookies. SQLi (SQL Injection) involves injecting malicious SQL queries into input fields to manipulate a database, which is not what this JavaScript code does. DDoS (Distributed Denial of Service) attacks aim to overwhelm a system with traffic, not execute client-side scripts. CSRF (Cross-Site Request Forgery) tricks a user into executing unwanted actions on a web application where they are authenticated, but it doesn't typically involve injecting document.cookie directly into a script for theft.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed