Think You're Ready?

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

A penetration tester finds that an application responds with the contents of the /etc/passwd file when the following payload is sent:

xml
Copy code


]>
&foo;

Which of the following should the tester recommend in the report to best prevent this type of vulnerability?

A. Drop all excessive file permissions with chmod o-rwx.

B. Ensure the requests application access logs are reviewed frequently.

C. Disable the use of external entities.

D. Implement a WAF to filter all incoming requests.

C.   Disable the use of external entities.

Explanation:

The payload provided is a classic example of an XML External Entity (XXE) injection attack. This vulnerability occurs when an XML parser is configured to process Document Type Definitions (DTDs) and resolve external entities. In this specific scenario, the SYSTEM identifier instructs the parser to fetch the contents of a local URI (file:///etc/passwd) and assign it to the entity &foo;. When the application processes &foo;, it substitutes the entity with the sensitive system file's content, which is then returned in the application's response.

Incorrect Options Analysis

Drop all excessive file permissions (A):
While following the principle of least privilege is a good security practice, it is not the "best" prevention. Restricting permissions on /etc/passwd might break system functionality, and the attacker could still use XXE for other purposes, such as Server-Side Request Forgery (SSRF) or accessing other files the application has permission to read.

Ensure logs are reviewed frequently (B):
Log review is a detective control, not a preventative one. It helps identify that an attack occurred but does not stop the vulnerability from being exploited in the first place.

Implement a WAF (D):
A Web Application Firewall (WAF) is a compensating control. While it can filter known XXE patterns, it can often be bypassed with encoding or alternative XML structures. It addresses the symptom rather than fixing the underlying insecure code configuration.

References

CompTIA PenTest+ (PT0-003) Objective 4.2: Given a scenario, analyze the output of application assessment tools and recommend mitigation.

OWASP Top 10: A05:2021 – Security Misconfiguration (formerly its own category, XML External Entities).

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?

A. Smurfing

B. Credential stuffing

C. RFID cloning

D. Card skimming

C.   RFID cloning

Explanation:

The scenario describes RFID cloning, a common physical security attack where a penetration tester captures the unique data stored on a physical access badge and copies it onto a new, unauthorized card. Most modern corporate badges use Radio Frequency Identification (RFID) or Near Field Communication (NFC) to communicate with building readers.

In an RFID cloning attack, the tester uses a specialized hardware device (such as a Proxmark3 or a Flipper Zero) to read the radio frequency signal emitted by the target badge. If the badge uses low-frequency (125 kHz) technology or poorly encrypted high-frequency standards, the device can capture the card's unique identifier (UID). The tester then "writes" this captured data onto a blank, writable RFID chip. Once complete, the duplicate badge is indistinguishable from the original to the building's access control system, allowing the tester to gain entry without triggering an alarm.

Incorrect Options Analysis

Smurfing (A):
This is a type of Distributed Denial of Service (DDoS) attack. It involves sending large amounts of ICMP (ping) traffic with a spoofed source IP address to a network's broadcast address, causing the network to overwhelm the victim's machine with responses. It is unrelated to physical badges.

Credential Stuffing (B):
This is a digital attack where stolen username and password pairs from one data breach are "stuffed" into the login portals of other unrelated services. It relies on the common habit of users reusing passwords across multiple platforms.

Card Skimming (D):
While similar, skimming typically refers to the theft of payment card information (credit or debit cards) during a legitimate transaction. A skimmer is a physical device placed over a card reader (like at a gas pump or ATM) to capture the magnetic stripe data or chip info for financial fraud, rather than facility access.

References
CompTIA PenTest+ (PT0-003) Objective 3.4: Given a scenario, perform physical security attacks.
MITRE ATT&CK Framework: Technique T1122 (Replication through Removable Media/Hardware).

Which of the following is within the scope of proper handling and most crucial when working on a penetration testing report?

A. Keeping both video and audio of everything that is done

B. Keeping the report to a maximum of 5 to 10 pages in length

C. Basing the recommendation on the risk score in the report

D. Making the report clear for all objectives with a precise executive summary

D.   Making the report clear for all objectives with a precise executive summary

Explanation:

A penetration testing report is the primary deliverable of an engagement and serves as the only tangible evidence of the work performed. The most crucial aspect of proper report handling is ensuring it is clear, comprehensive, and accessible to different audiences. This is achieved by aligning the technical findings with the original project objectives and providing a precise executive summary.

The Executive Summary is a high-level overview designed for non-technical stakeholders (such as C-suite executives and board members). It translates technical vulnerabilities into business risks, providing a clear picture of the organization's security posture without requiring deep technical expertise. Simultaneously, the body of the report must detail the specific objectives met, the methodology used, and the evidence of exploitation. Without a clear structure that satisfies both the executive and technical teams, the report fails to provide the necessary roadmap for remediation.

Incorrect Options Analysis

Keeping video and audio (A):
While evidence (screenshots, command logs) is vital, recording "everything" in video and audio is often impractical, creates massive storage/security burdens, and is rarely a requirement for a standard professional report.

Maximum of 5 to 10 pages (B):
Report length should be dictated by the findings and scope. Artificially limiting a report to 10 pages for a complex enterprise environment would likely lead to omitting critical technical details and remediation steps.

Basing recommendations on risk score (C):
While risk scores (like CVSS) are important for prioritization, recommendations should be based on the specific business context and technical feasibility. A "Medium" risk vulnerability might be more critical to fix than a "High" one if it sits on a core business path.

References
CompTIA PenTest+ (PT0-003) Objective 4.1: Given a scenario, report on and explain a technical vulnerability and its risk.

NIST SP 800-115: Technical Guide to Information Security Testing and Assessment (Reporting Phase).

A penetration tester creates a list of target domains that require further enumeration. The tester writes the following script to perform vulnerability scanning across the domains:

line 1: #!/usr/bin/bash
line 2: DOMAINS_LIST = "/path/to/list.txt"
line 3: while read -r i; do
line 4: nikto -h $i -o scan-$i.txt &
line 5: done

The script does not work as intended. Which of the following should the tester do to fix the script?

A. Change line 2 to {"domain1", "domain2", "domain3", }.

B. Change line 3 to while true; read -r i; do.

C. Change line 4 to nikto $i | tee scan-$i.txt.

D. Change line 5 to done < "$DOMAINS_LIST".

D.   Change line 5 to done < "$DOMAINS_LIST".

Explanation:

The provided Bash script fails because the while loop in Line 3 is initialized to read input, but it has no defined input source. In Bash scripting, when using read inside a loop to process a file line-by-line, the file must be redirected into the done statement at the end of the loop.

By changing Line 5 to done < "$DOMAINS_LIST", the script tells the shell to take the contents of the file defined in the variable $DOMAINS_LIST and feed them into the while loop. Without this redirection, the read command waits indefinitely for input from stdin (the keyboard), and the script appears to hang or does nothing.

Additionally, note a syntax error in Line 2: In Bash, variable assignments must not have spaces around the equals sign (e.g., DOMAINS_LIST="/path/to/list.txt"). While Option D specifically fixes the functional logic of the loop, the spacing in Line 2 would also need correction for the script to execute successfully.

Incorrect Options Analysis

Change Line 2 to a manual list (A):
While this creates an array, the while read logic is specifically designed to iterate through a file. Changing the variable to a manual list would still require a different loop structure (like for i in "${DOMAINS[@]}") to function.

Change Line 3 to while true (B):
This would create an infinite loop. It does not solve the problem of reading the actual domain names from the text file.

Change Line 4 to tee (C):
The tee command redirects output to both a file and the screen. While useful for logging, it does not fix the primary issue of the loop not receiving any input data to process.

References
CompTIA PenTest+ (PT0-003) Objective 5.1: Given a scenario, use basic scripting concepts (Bash, Python, PowerShell).
GNU Bash Manual: Redirections and the read builtin.

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?

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

B. cat data.csv | find . -iname Username,Password

C. cat data.csv | grep 'username|Password'

D. cat data.csv | grep -i "admin" | grep -v
"WINS212\|HRDB\|WAS01\|10.111.41.74\|10.13.9.212\|192.168.23.13"

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

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.

A penetration tester gains access to the target network and observes a running SSH server. Which of the following techniques should the tester use to obtain the version of SSH running on the target server?

A. Network sniffing

B. IP scanning

C. Banner grabbing

D. DNS enumeration

C.   Banner grabbing

Explanation:

Banner grabbing involves connecting to an open port (e.g., SSH on TCP/22) and reading the service’s initial response. SSH servers typically disclose their software and version in that banner unless manually hardened. Example: SSH-2.0-OpenSSH_8.9p1. This allows the tester to identify vulnerable versions.

Why other options are incorrect

A. Network sniffing
– Passive traffic capture may not see the SSH banner unless the tester initiates a connection (which then becomes banner grabbing). Encryption also hides version details.

B. IP scanning
– Only discovers live hosts and open ports (e.g., “port 22 open”). It does not retrieve service version banners without additional probes (which is still banner grabbing).

D. DNS enumeration
– Maps domain names, subdomains, and DNS records. It provides no information about running SSH services or their versions.

References:

CompTIA PenTest+ PT0-003 Exam Objectives – Domain 2.2 (Information Gathering): “Perform service and port scanning including banner grabbing for fingerprinting.”

Nmap documentation – Version detection (-sV) is a form of banner grabbing.

MITRE ATT&CK T1592.002 – “Gather Victim Host Information: Software” – banner grabbing is a common method.

A penetration tester completes a scan and sees the following Nmap output on a host:

Nmap scan report for victim (10.10.10.10)
Host is up (0.0001s latency)
PORT STATE SERVICE
161/udp open snmp
445/tcp open microsoft-ds
3389/tcp open ms-wbt-server
Running Microsoft Windows 7
OS CPE: cpe:/o:microsoft:windows_7::sp0

The tester wants to obtain shell access. Which of the following related exploits should the tester try first?

A. exploit/windows/smb/psexec

B. exploit/windows/smb/ms08_067_netapi

C. exploit/windows/smb/ms17_010_eternalblue

D. auxiliary/scanner/snmp/snmp_login

C.   exploit/windows/smb/ms17_010_eternalblue

Explanation:

The Nmap scan shows three critical services: SNMP (161/udp), SMB (445/tcp), and RDP (3389/tcp). The host is identified as Windows 7 SP0, which is historically vulnerable to MS17-010 (EternalBlue) if unpatched. EternalBlue is a remote code execution exploit against SMBv1 that allows attackers to gain shell access without authentication. Since the tester’s goal is shell access, this is the most direct and effective exploit to attempt first.

Option A: exploit/windows/smb/psexec
PsExec requires valid credentials to execute commands remotely over SMB. Without credentials, this exploit cannot succeed, so it is not the first choice.

Option B: exploit/windows/smb/ms08_067_netapi
MS08-067 targets Windows XP and Server 2003 systems. While extremely famous, it does not apply to Windows 7, making it irrelevant in this scenario.

Option D: auxiliary/scanner/snmp/snmp_login
This module only attempts SNMP login brute force. It can provide information but does not yield shell access. Since the tester’s objective is shell access, this option is not suitable.

Therefore, MS17-010 EternalBlue is the correct exploit to try first. It directly targets the SMB service on port 445, matches the OS fingerprint (Windows 7), and is known to provide remote shell access if the system is unpatched. In penetration testing methodology, testers prioritize exploits that match the identified OS and services, especially those with high impact and no credential requirement.

References

CompTIA PenTest+ PT0-003 Exam Objectives – Domain 3.0 Attacks and Exploits (Network-based vulnerabilities).
Microsoft Security Bulletin MS17-010: CVE-2017-0144 (EternalBlue) – Microsoft Learn (learn.microsoft.com in Bing)

A penetration tester sets up a C2 (Command and Control) server to manage and control payloads deployed in the target network. Which of the following tools is the most suitable for establishing a robust and stealthy connection?

A. ProxyChains

B. Covenant

C. PsExec

D. sshuttle

B.   Covenant

Explanation:

Covenant is a .NET-based command and control (C2) framework designed specifically for post-exploitation and payload management. It supports encrypted communication, multiple listeners (HTTP/HTTPS), and is highly extensible. Its stealth features include HTTPS beaconing, jitter, and custom traffic profiles, making it robust and stealthy for C2 operations.

Why other options are incorrect

A. ProxyChains
– Forces any TCP traffic through a proxy chain (e.g., Tor, SOCKS). Useful for anonymizing scans or tool traffic, but it is not a C2 framework — it does not manage payloads or provide remote control capabilities.

C. PsExec
– A Windows Sysinternals tool for remote command execution via SMB. It is not a C2 server; it executes a single command or launches a remote shell but lacks persistent beaconing, listener management, or multi-session control.

D. sshuttle
– A transparent proxy over SSH that forwards traffic like a VPN. It is excellent for pivoting or routing traffic through an SSH server but does not function as a C2 framework — no payload generation, no beaconing, no encrypted C2 channel management.

References
CompTIA PenTest+ PT0-003 – Domain 3.0 (Attacks and Exploits): “Compare and contrast C2 frameworks (Covenant, Cobalt Strike, Empire).”
Covenant GitHub / Wiki – Describes itself as “a .NET command and control framework for red teamers.”
MITRE ATT&CK – T1071 (Application Layer Protocol) for C2 communication; Covenant supports HTTPS.

Which of the following is the most likely LOLBin to be used to perform an exfiltration on a Microsoft Windows environment?

A. procdump.exe

B. msbuild.exe

C. bitsadmin.exe

D. cscript.exe

C.   bitsadmin.exe

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.

Which of the following techniques is the best way to avoid detection by Data Loss Prevention (DLP) tools?

A. Encoding

B. Compression

C. Encryption

D. Obfuscation

C.   Encryption

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.

Page 10 out of 28 Pages