Question 502 of 185
mediumMultiple ChoiceObjective-mapped
PT0-002 Practice Question: A penetration tester is analyzing a Python script…
A penetration tester is analyzing a Python script that uses the 'requests' library. The script sends a GET request to a target URL with a crafted parameter value containing a SQL sleep function, then measures the response time. What attack is the script most likely performing?
⚠ Common exam trap
The trap here is that candidates see 'sleep function' and assume it is a command injection payload, but the `SLEEP()` function is a SQL-specific function, not an OS command, and the context of the `requests` library sending a GET request with a crafted parameter points directly to SQL injection, not command injection.
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
✓
Blind time-based SQL injection.
The script sends a crafted parameter containing a SQL sleep function (e.g., `' OR SLEEP(5)--`) and measures the response time. If the database executes the sleep, the response is delayed, confirming a SQL injection vulnerability without relying on visible output. This is the hallmark of a blind time-based SQL injection attack using the `requests` library to time the HTTP response.
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 (XSS) attack.
Why it's wrong here
Cross-site scripting (XSS) involves injecting client-side scripts (e.g., JavaScript) into web pages viewed by other users, with execution occurring in the victim's browser. The described Python script measures response-time differences created by a database sleep function, which is a server-side database behavior, not a client-side browser execution. XSS payloads do not typically cause reproducible server-side delays, so the timing-based detection logic is fundamentally incompatible with identifying XSS vulnerabilities.
- ✓
Blind time-based SQL injection.
Why this is correct
Blind time-based SQL injection is correctly identified because the script injects a payload containing a database sleep() call (e.g., MySQL's SLEEP(5) or SQL Server's WAITFOR DELAY) into a query parameter. After sending the request, the script measures elapsed time; a significantly longer response indicates that the injected condition executed on the server, confirming the vulnerability without needing to see error messages or data in the response. This technique is used against blind SQL injection scenarios where the application does not return query results or database errors, making response time the only observable side channel.
- ✗
Command injection attack.
Why it's wrong here
Command injection would aim to execute system commands, not necessarily rely on sleep to check for vulnerability. The sleep function could be used, but the presence of SQL sleep is more indicative of SQL injection.
- ✗
Error-based SQL injection.
Why it's wrong here
Error-based SQL injection relies on crafting queries that trigger database errors, which are then reflected in the HTTP response, allowing an attacker to extract information from the error text (e.g., using CONVERT with an invalid type in SQL Server or UPDATEXML in MySQL). The script described only measures elapsed time to detect delays; it does not request, parse, or analyze any error messages in the response body. Therefore, while error-based SQLi is a real attack vector, the script's timing-based detection logic does not match that method, making this option incorrect.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 11, 2026
This PT0-003 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 PT0-003 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.