Courseiva
mediumMultiple ChoiceObjective-mapped

CAS-004 Practice Question: A security analyst reviews a web application that…

A security analyst reviews a web application that accepts user-supplied data to generate PDF reports. The application uses a legacy library that directly inserts user input into SQL queries and also includes user input in the PDF generation without sanitization. Which is the most effective countermeasure?

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

Use parameterized queries and output encoding

Parameterized queries prevent SQL injection by separating SQL logic from user input, and output encoding prevents injection in PDF generation by ensuring user input is treated as data, not executable code. Option B (HTTPS/HSTS) only encrypts in transit and does not prevent injection attacks. Option C (WAF) can be bypassed and does not address the root cause. Option D (SIEM) only logs events, not prevents them.

Answer analysis

Option-by-option breakdown

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

  • Use parameterized queries and output encoding

    Why this is correct

    Parameterized queries prevent SQL injection; output encoding prevents XSS in PDF output.

  • Enable HTTPS and HSTS

    Why it's wrong here

    HTTPS only protects data in transit, not against injection attacks.

  • Implement a web application firewall (WAF) to block malicious input

    Why it's wrong here

    A WAF can be bypassed with crafted payloads and does not fix the root cause.

  • Deploy a SIEM to log all database queries and PDF generation events

    Why it's wrong here

    Logging only provides visibility, not prevention.

About these practice questions

Courseiva writes every CAS-005 question from scratch — 968 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.