CompTIA certification · Exam PT0-003

PT0-003 Mock Exam Page 2

CompTIA PenTest+

Free PT0-003 questions on Tools and Code Analysis, each with the answer and an explanation.

20 questions · 37 minutes · free, no sign-up

Tools and Code Analysis questions

11–16 of 16 free
Question 11 Choose 1
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?
Show answerHide answer

Correct answer: C Host discovery

Explanation

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.
Question 12 Choose 1
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?
Show answerHide answer

Correct answer: D CrackMapExec

Explanation

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).
Question 13 Choose 1
A penetration tester exports the following CSV data from a scanner. The tester wants to parse the data using Bash and input it into another tool. CSV data before parsing:

cat data.csv
Host, IP, Username, Password
WINS212, 10.111.41.74, admin, Spring11
HRDB, 10.13.9.212, hradmin, HRForTheWin
WAS01, 192.168.23.13, admin, Snowfall97
Intended output:

admin Spring11
hradmin HRForTheWin
admin Snowfall97
Which of the following will provide the intended output?
Show answerHide answer

Correct answer: A cat data.csv | grep -v "IP" | cut -d"," -f 3,4 | sed -e 's/,/ /'

Explanation

Explanation:

The provided solution uses a combination of core Linux utilities—grep, cut, and sed—to transform raw CSV data into a specific space-delimited format. Each command in the pipeline performs a critical transformation step:

grep -v "IP": This filters out the header row. The -v flag stands for "invert-match," meaning it excludes any line containing the string "IP". This prevents the column headers ("Username, Password") from appearing in the final output.

cut -d"," -f 3,4: This command extracts specific columns. The -d"," flag sets the delimiter to a comma, and -f 3,4 tells the utility to keep only the third and fourth fields (Username and Password). At this stage, the output still contains commas (e.g., admin, Spring11).

sed -e 's/,/ /': The Stream Editor (sed) performs a substitution. The expression 's/,/ /' searches for the first comma on each line and replaces it with a space. This results in the final intended format: admin Spring11.

This pipeline is a standard approach in penetration testing for "data wrangling," allowing the tester to quickly reformat scan results for input into brute-forcing tools or credential stuffing scripts.

Incorrect Options Analysis

Option B (find . -iname):
The find command is used for searching the file system for filenames and directories. It cannot parse the internal contents of a CSV file.

Option C (grep 'username|Password'):
This command simply searches for lines containing those specific strings. It does not perform any field extraction or character replacement, and the syntax for the OR operator (|) would require the -E (Extended Regex) flag to function as intended.

Option D:
While this attempts to use grep -v to exclude hostnames and IPs, it is highly inefficient and manual. It relies on knowing every single value in the Host and IP columns beforehand, which is not practical for large datasets.

References

CompTIA PenTest+ (PT0-003) Objective 5.1: Given a scenario, use basic scripting concepts (Bash).

GNU Coreutils: Documentation for grep, cut, and sed.
Question 14 Choose 1
Which of the following is the most likely LOLBin to be used to perform an exfiltration on a Microsoft Windows environment?
Show answerHide answer

Correct answer: C bitsadmin.exe

Explanation

Explanation:

bitsadmin.exe is a legitimate Windows command-line tool used to create and manage Background Intelligent Transfer Service (BITS) jobs. BITS transfers files in the background using idle network bandwidth, supports resumption of interrupted transfers, and can blend in with normal Windows traffic. Attackers abuse it for stealthy exfiltration because BITS jobs are persistent, use HTTP/HTTPS, and are less monitored than standard file copies.

Why other options are incorrect

A. procdump.exe
– A Sysinternals tool for dumping process memory (e.g., LSASS for credentials). It is not used for exfiltration; it captures memory locally.

B. msbuild.exe
– A build tool for .NET applications. Often abused for inline execution of C# code (bypassing application whitelisting), but not typically for exfiltration of files.

D. cscript.exe
– Executes VBScript or JScript scripts. Can be used for many malicious actions (downloaders, keyloggers), but BITS is specifically designed for file transfer and is the most likely LOLBin for exfiltration due to its native background transfer capabilities.

References:

CompTIA PenTest+ PT0-003 – Domain 3.5 (Post-Exploitation): “Data exfiltration using native Windows tools (LOLBins).”

LOLBAS (Living Off the Land Binaries, Scripts, and Libraries) – bitsadmin.exe listed as a file transfer and exfiltration tool.
Question 15 Choose 1
Which of the following techniques is the best way to avoid detection by Data Loss Prevention (DLP) tools?
Show answerHide answer

Correct answer: C Encryption

Explanation

Explanation:

Encryption transforms data into an unreadable format without the proper decryption key. Most DLP tools rely on content inspection (e.g., regex patterns, fingerprints, keywords) to detect sensitive data like credit card numbers, SSNs, or trade secrets. Encrypted data appears as high-entropy, random binary, which DLP cannot inspect or match against policies. Properly encrypted exfiltration bypasses DLP entirely unless the DLP has the decryption key or performs SSL/TLS interception.

Why other options are incorrect

A. Encoding (e.g., Base64, hex)
– Easily reversible and not secret. DLP tools trivially decode and inspect the original content. Encoding offers zero security.

B. Compression (e.g., ZIP, GZIP)
– Reduces size but does not hide content. DLP tools can decompress and inspect the original data. Some DLP even recursively unpacks archives.

D. Obfuscation (e.g., XOR with known key, ROT13)
– Weak, often reversible without a secret key. DLP can be configured to de-obfuscate common patterns. Not cryptographically secure.

References

CompTIA PenTest+ PT0-003 – Domain 3.5 (Post-Exploitation Data Exfiltration): “Bypassing DLP using encryption.”

NIST SP 800-175B – Encryption provides confidentiality; DLP cannot inspect encrypted payloads without keys.
Question 16 Choose 1
A penetration tester is attempting to discover vulnerabilities in a company's web application. Which of the following tools would most likely assist with testing the security of the web application?
Show answerHide answer

Correct answer: C sqlmap

Explanation

Explanation:

sqlmap is an open-source tool specifically designed to automate the detection and exploitation of SQL injection vulnerabilities in web applications. It supports multiple database backends (MySQL, MSSQL, Oracle, PostgreSQL), can extract data, bypass WAF rules, and even gain OS shell access. For testing a web application's security, SQL injection remains one of the most critical and common flaws, and sqlmap is the industry-standard tool for this purpose.

Why other options are incorrect

A. OpenVAS – A full-featured vulnerability scanner for networks and hosts (e.g., missing patches, weak configs). It is not specialized for web application logic flaws like SQLi or XSS.

B. Nessus – Another network vulnerability scanner. While it includes some web application checks, it is not as deep or flexible as dedicated web app testing tools like sqlmap or Burp Suite.

D. Nikto – A web server scanner that checks for outdated server versions, dangerous files, and common misconfigurations. It does not actively exploit SQL injection or deeply test application logic.

References:

CompTIA PenTest+ PT0-003 – Domain 2.4 (Web Application Scanning): "Use sqlmap to detect and exploit SQL injection vulnerabilities."

OWASP Top 10 – A1:2021 – Broken Access Control / A3:2021 – Injection (SQLi). sqlmap is the referenced tool for SQLi automation.

That's the last free question in Tools and Code Analysis

You've seen the free 30% (16 of 55 questions). Full access unlocks every question and full-length PT0-003 mock exams (90 questions, 165 minutes), a different mock on every attempt.

Unlock full mock exam
Full mock exam

Sit the PT0-003 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real PT0-003 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full PT0-003 mock exam
  • 90questions per mock
  • 165 mintime limit
  • 361questions in the bank
  • Newmock on every attempt