Courseiva
easyMultiple ChoiceObjective-mapped

CAS-004 Practice Question: A web application generates an Ansible playbook…

Exhibit

input_user = request.args.get('user')
playbook = """
- hosts: all
  tasks:
    - name: Greet {{ user }}
      debug:
        msg: "Hello {{ user }}"
""".replace('{{ user }}', input_user)

A web application generates an Ansible playbook from user input as shown. What is the primary security risk?

⚠ Common exam trap

CompTIA CASP+ often tests the distinction between generic injection types (SQL, LDAP) and technology-specific injection (Ansible modules, PowerShell, Terraform HCL), so candidates mistakenly choose a familiar injection type instead of recognizing the automation framework context.

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

The user input could be crafted to execute arbitrary Ansible modules.

The application directly incorporates user input into an Ansible playbook without sanitization or validation. An attacker can inject arbitrary YAML or Ansible module directives (e.g., `shell`, `command`, `raw`) to execute unauthorized commands on managed hosts. This is a classic injection vulnerability specific to automation frameworks, not a generic injection type.

Answer analysis

Option-by-option breakdown

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

  • The application is vulnerable to SQL injection.

    Why it's wrong here

    There is no database interaction in this context.

  • The user input could be crafted to execute arbitrary Ansible modules.

    Why this is correct

    YAML injection can lead to arbitrary module execution, compromising hosts.

  • The application is vulnerable to LDAP injection.

    Why it's wrong here

    LDAP is not involved.

  • The playbook may fail to run if input contains special characters.

    Why it's wrong here

    While possible, the primary risk is injection, not just failure.

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.