Limited-Time Offer: Enjoy 50% Savings! Ends in 00h 00m 00s Coupon code: 50OFF
Skip to content

Free CompTIA PenTest+ Exam PT0-003 Exam Questions

Page: 1 / 25 Total 365 questions

Want more questions? Get Premium Access.

Question 1

A penetration tester launches an attack against company employees. The tester clones the company's intranet login page and sends the link via email to all employees.

Which of the following best describes the objective and tool selected by the tester to perform this activity?

Correct Answer: C. Harvesting credentials using SET
Explanation:

The tester is conducting a phishing attack by cloning the company's login page to steal employee credentials.

Option A (BeEF) : BeEF is used for browser exploitation, not phishing.

Option B (theHarvester) : Used for OSINT, gathering emails, but does not conduct phishing attacks.

Option C (SET - Social Engineering Toolkit) : Correct.

SET allows testers to clone web pages and perform phishing attacks.

Option D (GoPhish) : GoPhish is a phishing simulation tool, but SET is specifically designed for credential harvesting.

Reference: CompTIA PenTest+ PT0-003 Official Guide -- Social Engineering & Phishing Attacks


Question 2

A penetration tester reviews a SAST vulnerability scan report. The following vulnerability has been reported as high severity:

Source file: components.ts

Issue 2 of 12: Command injection

Severity: High

Call: .innerHTML = response

The tester inspects the source file and finds the variable response is defined as a constant and is not referred to or used in other sections of the code. Which of the following describes how the tester should classify this reported vulnerability?

Correct Answer: B. False positive
Explanation:

A false positive occurs when a vulnerability scan incorrectly flags a security issue that does not exist or is not exploitable in the context of the application. Here's the reasoning:

Definition of Command Injection:Command injection vulnerabilities occur when user-controllable data is passed to an interpreter or command execution context without proper sanitization, allowing an attacker to execute arbitrary commands.

Code Analysis:

The response variable is defined as a constant (const), which implies its value is immutable during runtime.

The response is not sourced from user input nor used elsewhere, meaning there is no attack surface or exploitation pathway for an attacker to influence the content of response.

Scanner Misclassification:Static Application Security Testing (SAST) tools may flag vulnerabilities based on patterns (e.g., .innerHTML usage) without assessing the source and flow of data, resulting in false positives.

Final Classification:Since the response variable is static and unchangeable, the flagged issue is not exploitable. This makes it a false positive.

CompTIA Pentest+ Reference:

Domain 3.0 (Attacks and Exploits)

Domain 4.0 (Penetration Testing Tools)

OWASP Static Code Analysis Guide


Question 3

During an assessment, a penetration tester gains a low-privilege shell and then runs the following command:

findstr /SIM /C:"pass" *.txt *.cfg *.xml

Which of the following is the penetration tester trying to enumerate?

Correct Answer: D. Secrets
Explanation:

The command searches for the keyword 'pass' (passwords) across all .txt, .cfg, and .xml files, which are common locations for stored credentials.

Option A (Configuration files) : While .cfg files may contain settings, the search is specifically for secrets (passwords).

Option B (Permissions) : The command does not list permissions.

Option C (Virtual hosts) : This does not relate to virtual host enumeration.

Option D (Secrets) : Correct. The tester is looking for stored passwords or sensitive data.

Reference: CompTIA PenTest+ PT0-003 Official Guide -- Privilege Escalation Techniques


Question 4

A penetration tester needs to launch an Nmap scan to find the state of the port for both TCP and UDP services. Which of the following commands should the tester use?

Correct Answer: C. nmap -sU -sT -p 1-65535 example.com
Explanation:

To find the state of both TCP and UDP ports using Nmap, the appropriate command should combine both TCP and UDP scan options:

Understanding the Options:

-sU: Performs a UDP scan.

-sT: Performs a TCP connect scan.

Command

Command: nmap -sU -sT -p 1-65535 example.com

This command will scan both TCP and UDP ports from 1 to 65535 on the target example.com. Combining -sU and -sT ensures that both types of services are scanned.

Comparison with Other Options:

-sW: Initiates a TCP Window scan, not relevant for identifying the state of TCP and UDP services.

-sY: Initiates a SCTP INIT scan, not relevant for this context.

-sN: Initiates a TCP Null scan, which is not used for discovering UDP services.


Question 5

A penetration tester obtains a reverse shell on a server and executes the following command on the compromised server:

echo '' >> /var/www/public/index.php

Which of the following best explains what the penetration tester is trying to do?

Correct Answer: D. Establish persistence.
Explanation:

The command appends PHP code to a web-accessible file, effectively creating a simple web shell. By adding system($_GET['c']); into index.php, the tester can later execute operating system commands remotely through the web server by passing a parameter in the URL. This is most closely associated with establishing persistence, because it gives the tester a reusable method to regain command execution even if the original reverse shell session is lost. It is not primarily lateral movement, since the action is being performed on the already compromised host rather than expanding to another system. It is also not mainly about avoiding detection or bypassing a specific security control. The key objective is maintaining durable access through an alternate remote execution channel.


Question 6

After exploiting a vulnerability in an insecure service to gain access to a Linux system, a penetration tester executes the following commands:

sudo -l

route

netstat -a

last

who

Which of the following best describes the tester's purpose for running these commands?

Correct Answer: D. To gather data to prepare for lateral movement
Explanation:

The correct answer is D. To gather data to prepare for lateral movement

These commands are commonly used during post-exploitation enumeration to understand the compromised host, network connectivity, active users, login history, and possible privilege escalation paths. This information helps the tester determine where and how to move next inside the environment.

sudo -l checks what commands the current user can run with elevated privileges.

route displays the system routing table and can reveal reachable internal networks.

netstat -a shows active connections and listening services, which may identify connected hosts or services useful for pivoting.

last shows previous login activity and can reveal user accounts, source systems, and administrative access patterns.

who shows currently logged-in users.

A is incorrect because some commands may reveal information about other systems, but the full set of commands is broader and supports post-exploitation planning.

B is incorrect because the commands do not primarily enumerate all users and services. They collect privilege, network, session, and login information.

C is incorrect because persistence would involve creating or modifying access mechanisms, such as users, SSH keys, startup scripts, cron jobs, or services. These commands are reconnaissance and enumeration commands, not persistence actions.

In PenTest+ terms, this falls under Attacks and Exploits, specifically post-exploitation enumeration and lateral movement preparation.


Question 7

A penetration tester currently conducts phishing reconnaissance using various tools and accounts for multiple intelligence-gathering platforms. The tester wants to consolidate some of the tools and accounts into one solution to analyze the output from the intelligence-gathering tools. Which of the following is the best tool for the penetration tester to use?

Correct Answer: C. Maltego
Explanation:

Penetration testers use OSINT (Open-Source Intelligence) tools to collect and analyze reconnaissance data.

Maltego (Option C):

Maltego is a powerful graph-based OSINT tool that integrates data from multiple sources (e.g., social media, DNS records, leaked credentials).

It automates data correlation and helps visualize connections.


Incorrect options:

Option A (Caldera): Used for adversary emulation, not OSINT.

Option B (SpiderFoot): A reconnaissance tool but lacks data correlation capabilities.

Option D (WIGLE.net): A wireless network database, not an OSINT analysis tool.

Question 8

During a penetration test, a tester attempts to pivot from one Windows 10 system to another Windows system. The penetration tester thinks a local firewall is blocking connections. Which of the following command-line utilities built into Windows is most likely to disable the firewall?

Correct Answer: D. netsh.exe
Explanation:

Understanding netsh.exe:

Purpose: Configures network settings, including IP addresses, DNS, and firewall settings.

Firewall Management: Can enable, disable, or modify firewall rules.

Disabling the Firewall:

Command: Use netsh.exe to disable the firewall.

netsh advfirewall set allprofiles state off

Usage in Penetration Testing:

Pivoting: Disabling the firewall can help the penetration tester pivot from one system to another by removing network restrictions.

Command Execution: Ensure the command is executed with appropriate privileges.

Reference from Pentesting Literature:

netsh.exe is commonly mentioned in penetration testing guides for configuring network settings and managing firewalls.

HTB write-ups often reference the use of netsh.exe for managing firewall settings during network-based penetration tests.


Penetration Testing - A Hands-on Introduction to Hacking

HTB Official Writeups

Question 9

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?

Correct Answer: 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:

To bypass two-factor authentication (2FA) and gain access to the executives' accounts, the tester should use Evilginx with a typosquatting domain. Evilginx is a man-in-the-middle attack framework used to bypass 2FA by capturing session tokens.

Phishing with Evilginx:

Evilginx is designed to proxy legitimate login pages, capturing credentials and 2FA tokens in the process.

It uses 'phishlets' which are configurations that simulate real login portals.

Typosquatting:

Typosquatting involves registering domains that are misspelled versions of legitimate domains (e.g., example.co instead of example.com).

This technique tricks users into visiting the malicious domain, thinking it's legitimate.

Steps:

Configure an External Domain: Register a typosquatting domain similar to the company's domain.

Set Up Evilginx: Install and configure Evilginx on a server. Use a phishlet that mimics the company's mail portal.

Send Phishing Emails: Craft phishing emails targeting the executives, directing them to the typosquatting domain.

Capture Credentials and 2FA Tokens: When executives log in, Evilginx captures their credentials and session tokens, effectively bypassing 2FA.

Pentest Reference:

Phishing: Social engineering technique to deceive users into providing sensitive information.

Two-Factor Authentication Bypass: Advanced phishing attacks like those using Evilginx can capture and reuse session tokens, bypassing 2FA mechanisms.

OSINT and Reconnaissance: Identifying key targets (executives) and crafting convincing phishing emails based on gathered information.

Using Evilginx with a typosquatting domain allows the tester to bypass 2FA and gain access to high-value accounts, demonstrating the effectiveness of advanced phishing techniques.


Question 10

A penetration tester obtains command execution on an Ubuntu web server and wants to establish persistence. The tester must avoid recurring network-traffic patterns and establish a stable encrypted channel that can be opened on demand. Which of the following is the best way to achieve this objective?

Correct Answer: C. Add the tester's public key to the authorized-keys file.
Explanation:

Adding an authorized SSH public key to the appropriate user's ~/.ssh/authorized_keys file creates an encrypted, on-demand access method. The system does not need to generate periodic outbound beacon traffic, and the tester can initiate an SSH session only when needed.

A beacon implant normally produces recurring command-and-control traffic that may be detected through network-pattern analysis. A scheduled reverse shell also creates predictable outbound connections. A listener on an unusual ephemeral port may be conspicuous and might not use a properly encrypted protocol.

Reference status: PT0-003-aligned persistence concepts involving SSH keys, authorized-keys modification, encrypted access, and command-and-control traffic.


Question 11

A penetration tester runs a network scan but has some issues accurately enumerating the vulnerabilities due to the following error:

OS identification failed

Which of the following is most likely causing this error?

Correct Answer: D. The scan cannot gather one or more fingerprints from the target.
Explanation:

OS identification in tools like Nmap relies on fingerprinting techniques, which analyze response characteristics (e.g., TCP/IP stack behavior).

The scan cannot gather one or more fingerprints from the target (Option D):

If the system is configured to block ICMP responses, or if certain ports are closed, fingerprinting fails.

Some modern firewalls and intrusion prevention systems (IPS) interfere with OS fingerprinting by modifying packet responses.


Incorrect options:

Option A (Firewall block rule): A firewall may block the scan, but typically it would result in no response rather than an 'OS identification failed' message.

Option B (Outdated scanner database): While an outdated database might miss vulnerabilities, it does not directly cause OS detection failure.

Option C (False positive): A false positive refers to incorrect detection, but this is an OS detection failure, not a misidentified OS.

Question 12

During a red-team exercise, a penetration tester obtains an employee's access badge. The tester uses the badge's information to create a duplicate for unauthorized entry.

Which of the following best describes this action?

Correct Answer: C. RFID cloning
Explanation:

RFID cloning involves copying data from an existing access card to create a duplicate badge. Attackers use tools like Proxmark3 or Flipper Zero to capture and replicate RFID signals.

Option A (Smurfing) : A DDoS attack technique, unrelated to physical security.

Option B (Credential stuffing) : Uses compromised usernames/passwords, not RFID badges.

Option C (RFID cloning) : Correct. Creates a duplicate access badge using RFID technology.

Option D (Card skimming) : Steals credit card data, but does not duplicate RFID badges.

Reference: CompTIA PenTest+ PT0-003 Official Guide -- Physical Security Testing & RFID Cloning


Question 13

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

Correct Answer: D. Attack narrative
Explanation:

An attack narrative is a crucial part of a penetration testing report. It explains how the tester was able to exploit vulnerabilities, providing a story-like structure of the attack path taken. This helps the client understand the sequence of actions, from initial access to potential compromise, and the real-world impact.

The attack narrative often includes:

Initial access methods

Privilege escalation steps

Lateral movement within the network

Data exfiltration scenarios

Tools and techniques used

According to the CompTIA PenTest+ PT0-003 Official Study Guide (Chapter 11: Reporting and Communication):

''The attack narrative should be a detailed timeline of the tester's actions, findings, and techniques used during the assessment. It allows technical and non-technical stakeholders to understand the context of the findings.''


Question 14

A penetration tester needs to evaluate the order in which the next systems will be selected for testing. Given the following output:

Hostname | IP address | CVSS 2.0 | EPSS

hrdatabase | 192.168.20.55 | 9.9 | 0.50

financesite | 192.168.15.99 | 8.0 | 0.01

legaldatabase | 192.168.10.2 | 8.2 | 0.60

fileserver | 192.168.125.7 | 7.6 | 0.90

Which of the following targets should the tester select next?

Correct Answer: A. fileserver
Explanation:

Given the output, the penetration tester should select the fileserver as the next target for testing, considering both CVSS and EPSS scores.

CVSS (Common Vulnerability Scoring System):

Purpose: CVSS provides a numerical score to represent the severity of vulnerabilities, helping to prioritize remediation efforts.

Higher Scores: Indicate more severe vulnerabilities.

EPSS (Exploit Prediction Scoring System):

Purpose: EPSS estimates the likelihood that a vulnerability will be exploited in the wild within the next 30 days.

Higher Scores: Indicate a higher likelihood of exploitation.

Evaluation:

hrdatabase: CVSS = 9.9, EPSS = 0.50

financesite: CVSS = 8.0, EPSS = 0.01

legaldatabase: CVSS = 8.2, EPSS = 0.60

fileserver: CVSS = 7.6, EPSS = 0.90

The fileserver has the highest EPSS score, indicating a high likelihood of exploitation, despite having a slightly lower CVSS score compared to hrdatabase and legaldatabase.

Pentest Reference:

Prioritization: Balancing between severity (CVSS) and exploitability (EPSS) is crucial for effective vulnerability management.

Risk Assessment: Evaluating both the impact and the likelihood of exploitation helps in making informed decisions about testing priorities.

By selecting the fileserver, which has a high EPSS score, the penetration tester focuses on a target that is more likely to be exploited, thereby addressing the most immediate risk.


Question 15

During a security assessment, a penetration tester gains access to an internal server and manipulates some data to hide its presence. Which of the following is the best way for the penetration tester to hide the activities performed?

Correct Answer: A. Clear the Windows event logs.
Explanation:

During a penetration test, one of the critical steps for maintaining access and covering tracks is to clear evidence of the attack. Manipulating data to hide activities on an internal server involves ensuring that logs and traces of the attack are removed. Here's a detailed explanation of why clearing the Windows event logs is the best method for this scenario:

Understanding Windows Event Logs: Windows event logs are a key forensic artifact that records system, security, and application events. These logs can provide detailed information about user activities, system changes, and potential security incidents.

Why Clear Windows Event Logs:

Comprehensive Coverage: Clearing the event logs removes all recorded events, including login attempts, application errors, and security alerts. This makes it difficult for an investigator to trace back the actions performed by the attacker.

Avoiding Detection: Penetration testers clear event logs to ensure that their presence and activities are not detected by system administrators or security monitoring tools.

Method to Clear Event Logs:

Use the built-in Windows command line utility wevtutil to clear logs. For example:

shell

Copy code

wevtutil cl System

wevtutil cl Security

wevtutil cl Application

These commands clear the System, Security, and Application logs, respectively.

Alternative Options and Their Drawbacks:

Modify the System Time: Changing the system time can create confusion but is easily detectable and can be reverted. It does not erase existing log entries.

Alter Log Permissions: Changing permissions might prevent new entries but does not remove existing ones and can alert administrators to suspicious activity.

Reduce Log Retention Settings: This can limit future logs but does not affect already recorded logs and can be easily noticed by administrators.

Case Reference:

HTB Writeups: Many Hack The Box (HTB) writeups demonstrate the importance of clearing logs post-exploitation to maintain stealth. For example, in the 'Gobox' and 'Writeup' machines, maintaining a low profile involved managing log data to avoid detection.

Real-World Scenarios: In real-world penetration tests, attackers often clear logs to avoid detection by forensic investigators and incident response teams. This step is crucial during red team engagements and advanced persistent threat (APT) simulations.

In conclusion, clearing Windows event logs is a well-established practice for hiding activities during a penetration test. It is the most effective way to remove evidence of the attack from the system, thereby maintaining stealth and ensuring that the tester's actions remain undetected.