Courseiva
hardMultiple ChoiceObjective-mapped

CAS-004 CSP vulnerability Practice Question

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?

⚠ Common exam trap

The CAS-004 exam 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.

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

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.

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-005 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-005blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”

About these practice questions

This CAS-005 question is part of Courseiva's 968-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CAS-005 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-005 exam.