mediumMultiple ChoiceObjective-mapped
CISSP Practice Question: During a web application security test, a tester…
During a web application security test, a tester attempts to inject JavaScript into a search field and observes that the script executes when the page is loaded. This indicates a vulnerability to:
⚠ Common exam trap
ISC2 often tests the distinction between XSS and CSRF by presenting a scenario where script execution occurs, leading candidates to confuse the client-side injection (XSS) with a cross-site request forgery (CSRF) that relies on forged requests, not injected scripts.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Cross-site scripting (XSS)
The observed behavior—JavaScript injected into a search field executing when the page loads—is the hallmark of stored (persistent) cross-site scripting (XSS). In this attack, the tester's input is stored on the server (e.g., in a database or log) and later served to other users without proper output encoding, causing the browser to interpret the injected script as part of the page's HTML DOM. This directly violates the same-origin policy and allows arbitrary script execution in the context of the victim's session.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
SQL injection
Why it's wrong here
SQL injection targets the database backend, allowing an attacker to manipulate or extract data by injecting malicious SQL code into input fields. This attack focuses on altering server-side database queries, not on executing scripts within the client's web browser. Therefore, it does not involve the direct injection of client-side scripts into web pages.
- ✓
Cross-site scripting (XSS)
Why this is correct
Cross-site scripting (XSS) is a web security vulnerability that enables attackers to inject malicious client-side scripts, typically JavaScript, into web pages viewed by other users. When a victim's browser executes these injected scripts, the attacker can bypass access controls, steal session cookies, deface websites, or redirect users to malicious sites. This directly aligns with the scenario of a tester attempting to inject client-side scripts.
- ✗
Command injection
Why it's wrong here
Command injection exploits vulnerabilities where an application executes user-supplied input as part of an operating system command on the server. This allows an attacker to run arbitrary system commands on the web server, potentially gaining control over the host system. Unlike XSS, command injection targets the server's underlying operating system, not the client's browser for script execution.
- ✗
Cross-site request forgery (CSRF)
Why it's wrong here
Cross-site request forgery (CSRF) is an attack that tricks authenticated users into submitting an unintended request to a web application. The attacker crafts a malicious request and embeds it into a page that the victim is likely to visit while authenticated to the target site. This attack leverages the victim's existing session to perform actions on their behalf, without directly injecting or executing scripts within the victim's browser.
Go deeper
Related to this question
Learn chapter
Security Governance and Principles
Key term
Policy
A policy is a set of rules or guidelines that defines how an organization manages, secures, and operates its IT systems and services.
Key term
Security
Security in IT is the practice of protecting systems, networks, and data from unauthorized access, damage, or theft.
About these practice questions
One of 747 original CISSP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CISSP practice question is part of Courseiva's free ISC2 certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CISSP exam.