Question 297 of 510

Quick Answer

The correct answer is cross-site scripting (XSS) via inline script injection because the Content Security Policy (CSP) misconfiguration includes the 'unsafe-inline' keyword within the script-src directive. This directive explicitly permits inline JavaScript, such as <script> tags or event handlers like onclick, to execute without being blocked, which directly undermines CSP’s core defense against XSS. While the policy restricts external scripts to the same origin and a trusted CDN, the presence of 'unsafe-inline' leaves the application wide open to stored, reflected, or DOM-based XSS attacks. On the CompTIA SecurityX CAS-004 exam, this scenario tests your ability to identify CSP weaknesses that bypass security controls—a common trap where candidates focus only on external script sources and overlook inline script risks. A key memory tip: if you see 'unsafe-inline' in script-src, think “inline = injectable,” as it explicitly allows the very attack CSP is designed to prevent.

CAS-004 CSP vulnerability Practice Question

This CAS-004 practice question tests your understanding of application environment, configuration and security. Match the stated requirement to the specific cloud service, access model, or configuration option — many options are valid in isolation but not for this scenario. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

During a security review, you find that a web application uses a Content Security Policy (CSP) header with the value: 'default-src 'self'; script-src 'self' 'unsafe-inline' https://cdn.example.com;'. Which attack is the application still vulnerable to?

Question 1hardmultiple choice
Full question →

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) via inline script injection

Option B is correct because the CSP includes 'unsafe-inline' in the script-src directive, which explicitly allows inline scripts. This bypasses the primary protection CSP offers against XSS, as an attacker can inject malicious JavaScript directly into the HTML (e.g., via a <script> tag or event handler) without violating the policy. The 'self' source only restricts external scripts to the same origin, but inline scripts remain permitted, leaving the application vulnerable to stored, reflected, or DOM-based XSS attacks.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Cross-site request forgery (CSRF)

    Why it's wrong here

    CSP does not directly prevent CSRF; CSRF is mitigated by anti-CSRF tokens.

  • SQL injection

    Why it's wrong here

    CSP is a browser-side security mechanism and does not prevent server-side SQL injection.

  • Man-in-the-middle (MITM) attack due to CDN inclusion

    Why it's wrong here

    The CDN is over HTTPS, so MITM is not the primary vulnerability; 'unsafe-inline' is the issue.

Option-by-option analysis

Why each answer is right or wrong

Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The CAS-004 exam frequently reuses these exact scenarios with slightly different constraints.

Cross-site scripting (XSS) via inline script injectionCorrect answer
Cross-site request forgery (CSRF)Wrong answer — click to see why

Why this is wrong here

CSP does not directly prevent CSRF; CSRF is mitigated by anti-CSRF tokens.

SQL injectionWrong answer — click to see why

Why this is wrong here

CSP is a browser-side security mechanism and does not prevent server-side SQL injection.

Man-in-the-middle (MITM) attack due to CDN inclusionWrong answer — click to see why

Why this is wrong here

The CDN is over HTTPS, so MITM is not the primary vulnerability; 'unsafe-inline' is the issue.

Analysis generated from the official CAS-004blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”

Common exam traps

Common exam trap: answer the scenario, not the keyword

Cisco often tests the misconception that CSP alone prevents all XSS, but the trap here is that 'unsafe-inline' explicitly disables CSP's inline script protection, making XSS via script injection still possible despite the policy.

Detailed technical explanation

How to think about this question

CSP's script-src directive without 'unsafe-inline' relies on cryptographic nonces or hashes to allow specific inline scripts; the presence of 'unsafe-inline' overrides this mechanism per the CSP specification (W3C CSP Level 2). In a real-world scenario, an attacker exploiting a reflected XSS vulnerability in a search parameter could inject <script>alert('xss')</script>, and the browser would execute it because the policy permits inline execution. The 'default-src' acts as a fallback for other resource types (e.g., style-src, img-src), but script-src explicitly overrides it for scripts.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A security administrator must allow nursing staff to reach a patient records server while blocking access from the guest Wi-Fi VLAN. After applying an extended ACL, traffic is still blocked from nursing workstations. The ACL was applied outbound instead of inbound on the wrong interface. Questions like this test ACL direction and placement rules.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related CAS-004 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free CAS-004 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this CAS-004 question test?

Application Environment, Configuration and Security — This question tests Application Environment, Configuration and Security — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Cross-site scripting (XSS) via inline script injection — Option B is correct because the CSP includes 'unsafe-inline' in the script-src directive, which explicitly allows inline scripts. This bypasses the primary protection CSP offers against XSS, as an attacker can inject malicious JavaScript directly into the HTML (e.g., via a <script> tag or event handler) without violating the policy. The 'self' source only restricts external scripts to the same origin, but inline scripts remain permitted, leaving the application vulnerable to stored, reflected, or DOM-based XSS attacks.

What should I do if I get this CAS-004 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More CAS-004 practice questions

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This CAS-004 practice question is part of Courseiva's free CompTIA 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 CAS-004 exam.