Courseiva
hardMultiple Choice

CAS-004 Practice Question: During a security assessment, a tester finds that…

During a security assessment, a tester finds that a web application accepts user input and directly uses it in an LDAP query without sanitization. Which of the following attacks is most likely to be successful?

⚠ Common exam trap

The trap here is that candidates see 'user input' and 'query' and immediately think SQL injection, failing to recognize that the specific technology mentioned (LDAP) requires its own injection class, and that each injection type is tied to a distinct backend protocol.

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

✓

LDAP injection

The scenario explicitly describes unsanitized user input being used directly in an LDAP query. LDAP injection occurs when an attacker manipulates LDAP statements by injecting special characters (e.g., *, (, ), &, |, !) to alter the query logic, potentially bypassing authentication or extracting unauthorized directory information. This is a direct injection attack against the LDAP protocol (RFC 4511), not against a database or web client.

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 scripting

    Why it's wrong here

    Unsynchronised input in an LDAP filter enables LDAP injection, letting attackers alter query logic to bypass authentication or enumerate directory entries; cross-site scripting targets browser output, not directory queries. XSS is tempting because it is the classic injection answer for unsanitised input, but the sink here is an LDAP query.

  • ✗

    SQL injection

    Why it's wrong here

    SQL injection targets SQL database parsers, but the sink here is an LDAP directory query, so injected metacharacters manipulate directory filters rather than SQL statements. It is tempting because both are injection flaws from unsanitised input, yet the interpreter and syntax differ, making LDAP injection the actual risk.

  • ✗

    Remote file inclusion

    Why it's wrong here

    Remote file inclusion requires a file-inclusion function that fetches external URLs, typically via a path or URL parameter; an LDAP query sink cannot include remote files. It is tempting as another injection-class flaw, but the mechanism — loading attacker-hosted code — is absent from this directory-query context.

  • ✓

    LDAP injection

    Why this is correct

    Unsanitised input concatenated into an LDAP filter lets the tester alter query logic, so LDAP injection succeeds. The stem's constraint is direct use of user input in an LDAP query without sanitisation, which this attack specifically exploits.

About these practice questions

This CAS-005 question is part of Courseiva's 973-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.