Courseiva
Web Application and Injection AttacksmediumMultiple ChoiceObjective-mapped

CEH Web Application and Injection Attacks Practice Question

A web application allows users to upload profile pictures. The application uses the filename provided by the user to save the file on the server. An attacker uploads a file named 'malicious.php%00.png' and the server saves it as 'malicious.php'. Which vulnerability is being exploited?

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

Null byte injection

This is a null byte injection attack, where the %00 (null byte) terminates the string, bypassing extension checks to upload a PHP file.

Answer analysis

Option-by-option breakdown

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

  • Directory traversal

    Why it's wrong here

    Directory traversal, also known as path traversal, exploits vulnerabilities in file system access controls by manipulating file paths, typically using sequences like "../" or "..\". Attackers aim to access or execute files stored in arbitrary directories on the server, such as configuration files or system binaries, by navigating outside the intended web root. This technique focuses on unauthorized directory access rather than bypassing file extension validation during an upload.

  • Command injection

    Why it's wrong here

    Command injection occurs when an application constructs a system command using user-supplied input without proper sanitization, allowing an attacker to inject and execute arbitrary operating system commands. This vulnerability typically targets functions that interact with the underlying shell, such as exec() or system(), enabling actions like listing directories, reading files, or even establishing reverse shells. It is fundamentally about executing server-side commands, not manipulating file extensions during a file upload process.

  • Null byte injection

    Why this is correct

    Null byte injection exploits the \x00 (or %00 in URL-encoded form) character, which is interpreted as a string terminator by many C-based functions and some older APIs. When used in a filename like "filename.php%00.jpg", the server's file type validation might see ".jpg" due to string processing, but the underlying file system or save function truncates the name at the null byte, resulting in "filename.php". This allows an attacker to upload a malicious file with a forbidden extension by effectively tricking the filter.

  • Cross-Site Scripting (XSS)

    Why it's wrong here

    Cross-Site Scripting (XSS) is a client-side code injection vulnerability where malicious scripts are injected into trusted websites, typically targeting other users. Attackers exploit XSS to execute arbitrary JavaScript in a victim's browser, enabling actions such as stealing session cookies, defacing websites, or redirecting users to malicious sites. This attack primarily impacts the client's browser and web page rendering, bearing no direct relation to manipulating file extensions or server-side file upload logic.

About these practice questions

Courseiva writes every CEH question from scratch — 870 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 CEH practice question is part of Courseiva's free EC-Council 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 CEH exam.