CertSafari

    Free CompTIA PenTest+ Sample Questions

    35 free sample questions from our bank of 349+, covering every exam domain, with answers and detailed explanations. Updated October 2026.

    Domain 1: Engagement Management

    Subdomain 1.1: Summarize pre-engagement activities.

    1.A client runs a workload on Amazon EC2 and asks for an assessment of the guest operating system, installed applications, and security group rules. The tester also proposes adding the physical hosts and hypervisor layer to the scan to find host-level flaws. How should the tester respond under the shared responsibility model?

    1. A.Include the hypervisor hosts, because the client pays for the instances and therefore holds authority over the hosts that carry its workload.
    2. B.Include the hypervisor hosts once the client signs an additional authorization letter that extends the existing scope to the host layer.
    3. C.Include only the provider's management network, since it is the sole layer that customers are normally allowed to assess without notice.
    4. D.Exclude them, because the provider is responsible for infrastructure beneath the guest operating system and only it can authorize testing.
    Show answer & explanation

    Correct answer: D — Exclude them, because the provider is responsible for infrastructure beneath the guest operating system and only it can authorize testing.

    • A. Paying for instances does not transfer ownership of the underlying infrastructure. The provider operates and secures the hosts, so the client cannot grant permission to test them.
    • B. Authorization must come from whoever owns the asset. A letter from the client cannot cover systems belonging to the cloud provider, no matter how thoroughly it is worded.
    • C. The provider's management plane is part of its own infrastructure and is not opened to customer testing. This claim reverses the model by assigning the most provider-controlled layer to the customer.
    • D. Under the shared responsibility model the provider secures the physical and virtualization layers, while the customer secures the guest OS, applications, and configuration. Testing is limited to the customer's layer and any provider testing policy.

    Subdomain 1.1: Summarize pre-engagement activities.

    2.While reviewing an in-scope file server, a tester discovers files that appear to contain child sexual abuse material. The NDA requires confidentiality for all findings. What should the tester do?

    1. A.Delete the files from the share to stop further distribution, then record the deletion in the activity log as an immediate remediation step.
    2. B.Honor the NDA by listing the files as an ordinary finding in the final report, leaving any disclosure choice to the client's own counsel.
    3. C.Stop examining the content, leave it unaltered, and promptly notify the designated client contact and the authorities as the law requires.
    4. D.Copy the files to an encrypted laptop to assemble a complete evidence package, then postpone notification until the report is finalized.
    Show answer & explanation

    Correct answer: C — Stop examining the content, leave it unaltered, and promptly notify the designated client contact and the authorities as the law requires.

    • A. Deleting suspected illegal content destroys evidence and exceeds the authorized test cases. The tester must not alter the material, even with good intentions.
    • B. Confidentiality terms do not override mandatory reporting obligations. Waiting until the final report delays a legal duty that is triggered by the discovery itself.
    • C. Some discoveries carry mandatory reporting requirements that an NDA cannot waive. Halting, preserving the material untouched, and reporting protects the tester from allegations of possession or tampering.
    • D. Copying suspected illegal material onto the tester's own system creates serious legal risk for the tester. Delaying notification also compounds that risk instead of reducing it.

    Subdomain 1.2: Explain collaboration and communication activities.

    3.A client wants help prioritizing remediation of 30 findings from a penetration test. A tester proposes using the client's business impact analysis (BIA) outputs. Which TWO BIA elements are most useful for ranking the findings?(Select 2)

    1. A.Maximum tolerable downtime and recovery time objectives for each business process that depends on affected systems
    2. B.Relative criticality ratings of the systems and data that support revenue-generating or regulated business processes
    3. C.The exact version numbers of operating systems installed across each department's laptops, servers and virtual machines
    4. D.The list of exploit modules available in the testing framework that the team used during the whole engagement
    5. E.The names of every tester who contributed screenshots and evidence to each finding in the final report
    Show answer & explanation

    Correct answers: A, B — Maximum tolerable downtime and recovery time objectives for each business process that depends on affected systems; Relative criticality ratings of the systems and data that support revenue-generating or regulated business processes

    • A. Correct. Tolerable downtime and recovery objectives show how quickly an outage hurts the business, so findings on systems with tight limits rise in priority.
    • B. Correct. BIA criticality ratings tie each system to revenue or regulated processes, letting findings on the most critical assets be fixed first.
    • C. Incorrect. Operating system version inventories describe technical assets and patch levels but are not a BIA output and say nothing about business consequence.
    • D. Incorrect. Available exploit modules describe attacker capability, which affects likelihood, not the business impact that a BIA quantifies.
    • E. Incorrect. Contributor names are report metadata used for accountability and have no bearing on how critical an affected business process is.

    Subdomain 1.3: Compare and contrast testing frameworks and methodologies.

    4.Using PTES, a team has completed intelligence gathering on a retailer. Before scanning for weaknesses, the lead wants to identify the business assets that matter most and the adversary profiles likely to target them, so test effort follows realistic attack paths. Which phase covers this next step?

    1. A.Threat modeling, where critical business assets and likely attacker profiles are identified and used to prioritize attack paths
    2. B.Vulnerability analysis, where discovered services are probed with scanners and manual checks to confirm exploitable weaknesses
    3. C.Post exploitation, where compromised hosts are assessed for data value and persistence options after initial access is gained
    4. D.Pre-engagement interactions, where scope, rules of engagement, and communication lines are negotiated and signed with the client
    Show answer & explanation

    Correct answer: A — Threat modeling, where critical business assets and likely attacker profiles are identified and used to prioritize attack paths

    • A. PTES places threat modeling directly after intelligence gathering; it uses the gathered data to identify high-value assets and relevant threat actors before testing begins.
    • B. Vulnerability analysis comes after threat modeling and focuses on discovering and validating weaknesses, not on ranking assets and attacker profiles.
    • C. Post exploitation happens after access has been obtained and evaluates the value of compromised systems, so it cannot precede scanning.
    • D. Pre-engagement interactions occur before intelligence gathering and settle scope and rules; by this point those items have already been agreed.

    Subdomain 1.4: Explain the components of a penetration test report.

    5.A tester confirmed SQL injection in the login form of a legacy application. The vendor cannot ship a code fix for six months. Which remediation guidance is most appropriate for the report?

    1. A.Move the application's data to a NoSQL store and keep the existing query-building code, since the new database type removes injection risk entirely
    2. B.Add JavaScript that escapes single quotes in the login form fields, which stops injected characters before the request reaches the server
    3. C.Deploy a web application firewall rule for the login endpoint and mark the finding as resolved, because the exploit string is now blocked
    4. D.Convert queries to parameterized statements with server-side validation, and meanwhile add a WAF rule and cut the database account's privileges
    Show answer & explanation

    Correct answer: D — Convert queries to parameterized statements with server-side validation, and meanwhile add a WAF rule and cut the database account's privileges

    • A. Injection flaws come from how untrusted input is combined with queries, and NoSQL stores have injection variants of their own. Switching databases without fixing the input handling does not resolve the issue.
    • B. Client-side filtering is trivially bypassed by sending requests directly to the server. It cannot be relied upon as a security control.
    • C. A WAF rule is only a compensating control that signatures and encoding tricks can bypass. Marking the finding resolved hides the underlying flaw that still needs a code fix.
    • D. Parameterized queries remove the root cause, while the WAF rule and least-privilege account limit exposure until the fix ships. Pairing a permanent fix with interim compensating controls is sound remediation guidance.

    Subdomain 1.5: Given a scenario, analyze the findings and recommend the appropriate remediation within a report.

    6.A source-code review across four consecutive releases keeps finding the same classes of defects: missing authorization checks, injection flaws and outdated third-party libraries. Developers fix each reported bug, but new ones of the same type appear. Which administrative recommendation best addresses the root cause?

    1. A.Schedule an external penetration test after every release and require the vendor to retest each fix before the change is merged to production.
    2. B.Adopt a secure software development life cycle that adds threat modeling, secure coding standards, automated SAST and dependency scanning, and peer review gates.
    3. C.Replace the development team's workstations with hardened images that block removable media and restrict all outbound traffic to a short list of approved repositories.
    4. D.Create a role-based access control matrix for the production servers so only named release managers can deploy code or change any configuration files.
    Show answer & explanation

    Correct answer: B — Adopt a secure software development life cycle that adds threat modeling, secure coding standards, automated SAST and dependency scanning, and peer review gates.

    • A. Late external testing finds defects after they are written and does not change how the team builds software. The recurring pattern would continue between tests.
    • B. A secure SDLC moves security into requirements, design, coding and review, so defect classes are prevented earlier and consistently. This addresses the recurring root cause rather than individual bugs.
    • C. Hardening developer workstations reduces the risk of tampering with the build environment but has no influence on the quality of the code the developers write.
    • D. RBAC on production limits who can deploy changes, which is a sound governance step. It does not prevent insecure code from being written in the first place.

    Domain 2: Reconnaissance and Enumeration

    Subdomain 2.4: Given a scenario, use the appropriate tools for reconnaissance and enumeration.

    7.A tester using Recon-ng creates a new workspace for each customer with `workspaces create acme` before loading any modules. What is the main purpose of doing this?

    1. A.It keeps harvested hosts, contacts, and credentials for one engagement in a separate database so results never mix
    2. B.It runs every loaded module inside a sandbox so that network requests never leave the tester's own host during collection
    3. C.It encrypts the stored API keys with an engagement passphrase so other local users cannot read the keys saved for the modules
    4. D.It defines a scope list of CIDR ranges that all installed modules are forbidden to send queries outside of while running
    Show answer & explanation

    Correct answer: A — It keeps harvested hosts, contacts, and credentials for one engagement in a separate database so results never mix

    • A. Each Recon-ng workspace has its own database and settings, so data collected for one client stays isolated from other engagements.
    • B. Workspaces are logical data containers. Modules still make normal outbound requests to the third-party services they query.
    • C. API keys are stored in a keys database that is separate from workspaces, and workspaces do not encrypt anything.
    • D. Recon-ng does not enforce a CIDR scope per workspace. Scope control is the tester's responsibility, using the seed records they insert.

    Subdomain 2.3: Given a scenario, modify scripts for reconnaissance and enumeration.

    8.A tester enumerates servers with `Get-ADComputer -Filter * -Properties OperatingSystem | Where-Object { $_.OperatingSystem -eq 'Windows Server' }` and gets no output, although the stored values read `Windows Server 2019 Datacenter`. Which modification fixes the filter?

    1. A.Replace `-eq` with `-ceq` so the comparison becomes case-sensitive and ignores the edition text after the product name
    2. B.Replace `-eq` with `-like 'Windows Server*'` so the trailing wildcard matches the full edition and version text
    3. C.Wrap `$_.OperatingSystem` in `[int]` so the numeric year in the value is compared instead of the whole string
    4. D.Replace `Where-Object` with `Select-Object` so the filter is applied before the operating system property is loaded
    Show answer & explanation

    Correct answer: B — Replace `-eq` with `-like 'Windows Server*'` so the trailing wildcard matches the full edition and version text

    • A. Incorrect: `-ceq` is still an exact comparison, only case-sensitive, so the longer stored string would still fail to match.
    • B. Correct: `-eq` requires an exact full-string match, while `-like` with a trailing wildcard accepts any edition suffix.
    • C. Incorrect: casting a descriptive string to `[int]` throws a conversion error, and it would not select servers by name anyway.
    • D. Incorrect: `Select-Object` chooses properties and does not filter objects, so it would return every computer in the directory.

    Subdomain 2.3: Given a scenario, modify scripts for reconnaissance and enumeration.

    9.A wordlist was created on Windows and used by a recon script. Every request returns 404 although the paths exist, and proxy logs show URLs like `/admin%0D`. Which TWO changes correct the cause?(Select 2)

    1. A.Switch from `requests.get` to `requests.post` so the body carries the path and the trailing character is ignored
    2. B.Add a browser-style `User-Agent` header to the requests so the web server stops treating the traffic as scripted
    3. C.Call `line.strip()` on each wordlist entry in Python before the path is appended to the base URL of the request
    4. D.Convert the file with `dos2unix` or `tr -d '\r'` before the Bash loop reads the entries, then rerun the scan
    5. E.Pass each entry through `urllib.parse.quote` so the carriage return is treated as a trusted character by the server
    Show answer & explanation

    Correct answers: C, D — Call `line.strip()` on each wordlist entry in Python before the path is appended to the base URL of the request; Convert the file with `dos2unix` or `tr -d '\r'` before the Bash loop reads the entries, then rerun the scan

    • A. Incorrect: a POST does not move the path into the body; the request line still contains the bad character and the server still returns 404.
    • B. Incorrect: a header affects bot detection, not the malformed path, so the resource would still be requested with a trailing `%0D`.
    • C. Correct: `strip()` removes the trailing carriage return and newline so the request path matches the real resource.
    • D. Correct: converting CRLF line endings to LF removes the stray `\r` before the loop variable ever contains it.
    • E. Incorrect: percent-encoding keeps the carriage return in the path as `%0D`, which is exactly the broken request being sent.

    Subdomain 2.1: Given a scenario, apply information gathering techniques.

    10.The rules of engagement for an external assessment forbid sending any packets to the client's address space during the first week. Which activity is still permitted during that week?

    1. A.Running a low-and-slow TCP SYN scan with Nmap against the client's published /24 netblock using the paranoid timing template
    2. B.Querying certificate transparency logs and public DNS datasets for hostnames tied to the client's registered domains
    3. C.Sending crafted ICMP echo requests to the client's border routers to infer which internal subnets are routed behind them
    4. D.Connecting with Netcat to the client's public web server on port 80 to read the HTTP response headers it returns
    Show answer & explanation

    Correct answer: B — Querying certificate transparency logs and public DNS datasets for hostnames tied to the client's registered domains

    • A. Incorrect. A slow timing template reduces noise but every SYN probe still reaches the client's hosts, so it is active reconnaissance and breaks the restriction.
    • B. Correct. Certificate transparency logs and third-party DNS datasets are maintained by others, so the tester collects hostnames without sending a single packet to the client.
    • C. Incorrect. Crafted ICMP echo requests are delivered to the client's routers, which makes this active reconnaissance regardless of how little traffic is sent.
    • D. Incorrect. Opening a TCP connection with Netcat and reading headers is banner grabbing, an active technique that contacts the client's server directly.

    Subdomain 2.1: Given a scenario, apply information gathering techniques.

    11.Requesting a nonexistent URL on the client's web application returns a page with a full stack trace showing the framework version, file paths under /var/www/app and a fragment of a SQL query. How should the tester classify and use this?

    1. A.Record it as broken access control, because stack traces appear only when authorization checks fail for the requesting session
    2. B.Record it as confirmed SQL injection, since any error page containing a query fragment proves attacker-controlled input reached the database
    3. C.Record it as information disclosure from verbose error handling and use the framework version and paths to research targeted flaws
    4. D.Record it as a banner grabbing result from the load balancer, because error pages are generated by the network device instead of the application
    Show answer & explanation

    Correct answer: C — Record it as information disclosure from verbose error handling and use the framework version and paths to research targeted flaws

    • A. Incorrect. A missing page is not an authorization failure, and the trace appears because debug output is enabled, not because access control was broken.
    • B. Incorrect. A query fragment in an error is not proof of injection; no attacker-controlled input was shown to alter the query.
    • C. Correct. Verbose errors that reveal versions, paths and query structure are information disclosure, and the details narrow later vulnerability research.
    • D. Incorrect. The trace names application framework paths, so the application generated it, not a load balancer.

    Subdomain 2.2: Given a scenario, apply enumeration techniques.

    12.A tester is assessing a single-page application and wants to find hardcoded third-party API keys without any credentials. Where should the search begin?

    1. A.Inspect the TLS certificate's subject alternative names, since issued certificates embed the API keys the application uses at runtime
    2. B.Review the DNS SPF record for the domain, since the TXT data lists the API tokens that outbound services present when authenticating
    3. C.Read the entries in robots.txt, since crawler exclusion rules store the credentials that integrated services need to call their endpoints
    4. D.Search the downloaded JavaScript bundles and any exposed source maps for key-like strings, since client code ships to every visitor
    Show answer & explanation

    Correct answer: D — Search the downloaded JavaScript bundles and any exposed source maps for key-like strings, since client code ships to every visitor

    • A. Incorrect because certificates contain names and public keys, never application API keys.
    • B. Incorrect because SPF TXT records name authorized mail senders and hold no API tokens.
    • C. Incorrect because robots.txt lists crawler directives and paths, not stored credentials.
    • D. Correct because anything bundled into client-side code is downloadable by anyone, and keys embedded in scripts or source maps can be found by pattern matching.

    Domain 3: Vulnerability Discovery and Analysis

    Subdomain 3.1: Given a scenario, conduct vulnerability discovery using various techniques.

    13.Before a release, a team needs a list of known CVEs affecting the OS packages and language dependencies inside a container image. Only the built image or its SBOM is available, not the source. Which action accomplishes this?

    1. A.Run BloodHound collectors inside the container so Active Directory sessions and group paths are graphed for review
    2. B.Run kube-hunter in pod mode so the cluster API server and kubelet are probed for unauthenticated endpoints
    3. C.Run Grype against the image or its SBOM so installed package versions are matched to published vulnerability data
    4. D.Run Nikto against the container's exposed port so server banners and default files are compared to its test database
    Show answer & explanation

    Correct answer: C — Run Grype against the image or its SBOM so installed package versions are matched to published vulnerability data

    • A. Incorrect. BloodHound analyzes Active Directory relationships and has no function for matching image packages to CVEs.
    • B. Incorrect. kube-hunter hunts for weaknesses in Kubernetes clusters, not CVEs in the packages inside one container image.
    • C. Correct. Grype is a software composition analysis tool that inventories packages in an image or SBOM and matches them against vulnerability databases without needing source code.
    • D. Incorrect. Nikto tests a running web server for outdated software and dangerous files; it does not inventory the packages baked into an image.

    Subdomain 3.2: Given a scenario, analyze output from reconnaissance, scanning, and enumeration phases.

    14.A tester selected a public proof-of-concept from Exploit-DB for a confirmed flaw on a client's staging server. What should be done before running it against the in-scope system?

    1. A.Review the source to see exactly what it executes, remove any hardcoded callback addresses, and test it first on an isolated lab replica
    2. B.Run it immediately with the default settings, because the Verified marker on the entry guarantees that it is safe and has no side effects
    3. C.Submit the script to a public malware-analysis site to confirm it is clean, since uploads to such sites remain private to the user
    4. D.Compile it on the client's staging server to ensure library compatibility, because building elsewhere changes the exploit's behavior
    Show answer & explanation

    Correct answer: A — Review the source to see exactly what it executes, remove any hardcoded callback addresses, and test it first on an isolated lab replica

    • A. Public code may contain hardcoded addresses or extra functionality, so reading it and testing on a replica prevents data leakage, instability, or actions outside the rules of engagement.
    • B. A Verified marker only indicates that the exploit worked as described; it does not guarantee safety or absence of side effects on the client's own environment.
    • C. Uploads to public analysis services are generally visible to other users, which could disclose client details and does not substitute for reviewing the code.
    • D. Building tools on the client's system alters the target and leaves artifacts, and compiling in a controlled lab produces the same behavior.

    Subdomain 3.2: Given a scenario, analyze output from reconnaissance, scanning, and enumeration phases.

    15.In Nmap output, a TCP port is reported with the state "filtered". What does this state indicate?

    1. A.The port replied with a SYN/ACK packet, so a service is listening and accepting new TCP connections from the scanner
    2. B.A firewall or filter dropped the probes or answered with ICMP unreachable, so open versus closed cannot be determined
    3. C.The port replied with a RST packet, so the host is reachable but no service is currently listening on that port
    4. D.The service responded but its version could not be identified, so Nmap needs a further version-detection pass to finish scanning
    Show answer & explanation

    Correct answer: B — A firewall or filter dropped the probes or answered with ICMP unreachable, so open versus closed cannot be determined

    • A. A SYN/ACK response is what Nmap reports as open, not filtered.
    • B. Filtered means Nmap cannot tell whether the port is open because packet filtering prevents the probes from reaching it, typically shown as no response or an ICMP unreachable. This matters for completeness because filtered ports may hide services.
    • C. A RST reply is how Nmap identifies a closed port, so the state is the opposite of filtered.
    • D. Unidentified versions are shown against open ports as unknown service details, and do not relate to the filtered state.

    Subdomain 3.3: Explain physical security concepts.

    16.A pentest report shows that a tester cloned a legacy proximity badge from a distance of a few inches while standing in a coffee line. Which mitigations reduce the risk of badge cloning? (Select all that apply.)(Select 3)

    1. A.Print the employee name in larger type on the badge so security can verify holders visually
    2. B.Add multi-factor access, such as a PIN or biometric, at doors protecting sensitive areas
    3. C.Issue RFID-blocking sleeves or wallets so cards are not readable while carried in public areas
    4. D.Lengthen the badge lanyard so the card hangs lower and sits closer to the employee's waist
    5. E.Migrate to credentials that use mutual authentication and encrypted communication between card and reader
    Show answer & explanation

    Correct answers: B, C, E — Add multi-factor access, such as a PIN or biometric, at doors protecting sensitive areas; Issue RFID-blocking sleeves or wallets so cards are not readable while carried in public areas; Migrate to credentials that use mutual authentication and encrypted communication between card and reader

    • A. Larger printed names help visual checks but do not affect what the card transmits over radio. A cloned badge with a legible name still opens the door.
    • B. A second factor means a cloned card alone does not open the door. A PIN or biometric limits the damage when a credential is copied.
    • C. Shielded sleeves block unwanted reads in crowded places, which removes the opportunity to capture a card from a short distance. It is a low-cost compensating control.
    • D. Moving the card by a few centimeters does not defeat a reader held close to a person's body. Distance of that scale is irrelevant to short-range cloning.
    • E. Mutual authentication and encryption remove the static identifier that cloning tools capture. This is the root-cause fix for the legacy technology.

    Domain 4: Attacks and Exploits

    Subdomain 4.5: Given a scenario, perform web application attacks using the appropriate tools.

    17.During an authorized test of a staging site, you captured a login POST request in Burp Suite and suspect the `username` field is injectable. Which approach with sqlmap is the most appropriate and controlled?

    1. A.Save the intercepted request to a file, run sqlmap with `-r` against it, limit testing to the suspect field with `-p`, and keep default level and risk values
    2. B.Point sqlmap with `-u` at the site root using `--crawl=5 --level=5 --risk=3` so every discovered form receives the heaviest payload sets available
    3. C.Replay the saved request through Wfuzz with a SQL keyword wordlist and treat every HTTP 200 response as confirmation that the field is injectable
    4. D.Launch sqlmap with `--os-shell` first, because obtaining an operating system shell is the fastest way to prove that the field is vulnerable
    Show answer & explanation

    Correct answer: A — Save the intercepted request to a file, run sqlmap with `-r` against it, limit testing to the suspect field with `-p`, and keep default level and risk values

    • A. Feeding a saved request with `-r` preserves cookies, headers and body, and `-p` focuses testing on the one suspect parameter. Default level and risk keep the traffic low-impact on a shared staging system.
    • B. Crawling the whole site at maximum level and risk generates huge request volume and risky payloads such as stacked or heavy time-based queries. That is not a controlled test of one suspected field.
    • C. Wfuzz sends wordlist entries but does not analyze database error or timing behavior, and a 200 status says nothing about injection. Many non-vulnerable pages also return 200.
    • D. Requesting an OS shell is a post-exploitation step that goes beyond proving injection and may exceed the rules of engagement. Detection should come first, with escalation only when authorized.

    Subdomain 4.5: Given a scenario, perform web application attacks using the appropriate tools.

    18.A cookie contains a base64-encoded serialized object that the application deserializes on each request. Which THREE measures reduce the risk of a deserialization attack?(Select 3)

    1. A.Sign the serialized data with a keyed hash on the server and reject any value whose signature does not verify
    2. B.Avoid native object deserialization for untrusted input and use a data-only format such as JSON with strict schemas
    3. C.Restrict deserialization to an allowlist of expected classes so that unexpected types are refused before instantiation
    4. D.Apply a second layer of base64 encoding to the cookie so that the structure of the object is harder to recognize
    5. E.Increase the maximum cookie size so that larger serialized objects can be accepted without truncation
    6. F.Compress the serialized data before sending it so that the payload cannot be edited by hand
    Show answer & explanation

    Correct answers: A, B, C — Sign the serialized data with a keyed hash on the server and reject any value whose signature does not verify; Avoid native object deserialization for untrusted input and use a data-only format such as JSON with strict schemas; Restrict deserialization to an allowlist of expected classes so that unexpected types are refused before instantiation

    • A. Server-side integrity protection stops tampered objects from being processed, provided the signing key stays secret.
    • B. Data-only formats with strict schemas avoid object instantiation from attacker-supplied input, removing the main attack surface.
    • C. An allowlist of permitted classes prevents attacker-chosen types from being instantiated during deserialization.
    • D. Extra encoding is reversible by anyone and offers no integrity protection, so an attacker can still craft a valid value.
    • E. Allowing larger cookies provides more room for crafted data and does nothing to validate it.
    • F. Compression is reversible and unauthenticated, so an attacker can decompress, alter and recompress the data.

    Subdomain 4.9: Explain common attacks against specialized systems.

    19.An assessor on an ICS engagement has network access to a water-treatment PLC that speaks Modbus/TCP. Using a crafted frame, the assessor sends function code 0x06 to overwrite a holding register that stores the chlorine dosing setpoint. Which attack does this demonstrate?

    1. A.Replay attack, resending a previously captured legitimate frame to trigger an identical earlier controller action
    2. B.CAN bus attack, injecting arbitration-priority frames onto a shared vehicle bus to override other nodes' messages
    3. C.Plaintext attack, deriving the controller's session key from known cleartext and ciphertext pairs captured earlier
    4. D.Register manipulation, abusing the protocol's lack of authentication to write process values directly to the controller
    Show answer & explanation

    Correct answer: D — Register manipulation, abusing the protocol's lack of authentication to write process values directly to the controller

    • A. Incorrect. A replay attack resends previously captured traffic unchanged, whereas here the tester built a new frame with an attacker-chosen setpoint value.
    • B. Incorrect. A CAN bus attack concerns vehicle and industrial CAN networks with arbitration IDs; this scenario uses Modbus/TCP to a PLC over Ethernet.
    • C. Incorrect. A plaintext attack in this context concerns reading cleartext protocol data; no key is derived from plaintext and ciphertext pairs, and Modbus has no encryption layer at all.
    • D. Correct. Writing a chosen value to a holding register with a crafted Modbus write function is register manipulation, possible because Modbus performs no authentication or authorization.

    Subdomain 4.6: Given a scenario, perform cloud-based attacks using the appropriate tools.

    20.A tester exploits a server-side request forgery flaw in a web application hosted on a cloud virtual machine and wants to demonstrate how the metadata service could leak role credentials. Which control most directly mitigates this attack path?

    1. A.Rotate the application's TLS certificate every 30 days so credentials captured in transit cannot be replayed later
    2. B.Turn on VPC flow logs for the subnet so each request to the link-local address is blocked automatically
    3. C.Resize the instance to a larger type so the metadata endpoint rejects requests that carry no authentication header
    4. D.Require IMDSv2 session tokens with a hop limit of 1, so a forwarded SSRF GET request cannot fetch role credentials
    Show answer & explanation

    Correct answer: D — Require IMDSv2 session tokens with a hop limit of 1, so a forwarded SSRF GET request cannot fetch role credentials

    • A. Incorrect. Certificate rotation protects transport identity and does nothing about an SSRF request that reaches the link-local metadata address from inside the instance.
    • B. Incorrect. Flow logs only record traffic metadata for later analysis, and link-local metadata traffic never leaves the host, so they neither block nor capture it.
    • C. Incorrect. Instance size has no bearing on metadata service behavior, and the original IMDSv1 endpoint answers plain requests regardless of the instance type.
    • D. Correct. IMDSv2 demands a token obtained through a PUT request, and a hop limit of 1 keeps the response from crossing a proxy or container, which breaks simple SSRF-based credential theft.

    Subdomain 4.1: Given a scenario, analyze output to prioritize and prepare attacks.

    21.A vulnerability scan flags an Apache Tomcat server on a development subnet. The Nmap service output shows the Manager application reachable at its default path, and the vendor-default credentials for it still authenticate. The rules of engagement permit exploitation on this subnet. How should the tester treat this finding when ranking targets?

    1. A.Rank it highly, but only after a custom exploit has been written, since the default credentials are insufficient on their own to gain access
    2. B.Rank it low, because development subnets contain no production data and therefore cannot provide a path toward high-value assets
    3. C.Rank it highly, because default credentials on a management interface need no exploit development and can lead to code execution
    4. D.Rank it low, because default configurations are informational findings that scanners report but that rarely lead to a real foothold on hosts
    Show answer & explanation

    Correct answer: C — Rank it highly, because default credentials on a management interface need no exploit development and can lead to code execution

    • A. Incorrect. Valid default credentials already grant access; writing a custom exploit adds effort without any benefit here.
    • B. Incorrect. Development hosts frequently connect to production networks or hold credentials and source code, so they can be a pivot toward valuable assets.
    • C. Correct. A management console that accepts default credentials gives authenticated access with minimal effort, and deploying an application is a well-known route to command execution, so it is a quick high-value win.
    • D. Incorrect. Default configurations are among the most commonly abused weaknesses and often provide the initial foothold, so treating them as informational understates the risk.

    Subdomain 4.1: Given a scenario, analyze output to prioritize and prepare attacks.

    22.At the end of the preparation phase, the engagement lead asks the tester to produce a document showing the sequence of hosts, vulnerabilities, and privilege changes that lead from the internet-facing web server to the domain controller. Which deliverable fits this request?

    1. A.A vulnerability severity matrix that sorts findings only by CVSS base score and ignores host relationships
    2. B.An attack path document that chains footholds, pivots, and privilege escalations toward the objective
    3. C.A low-level network diagram of the client's VLANs, cabling runs, and switch port assignments for the site
    4. D.A storyboard of the social engineering pretext written as scenes for the awareness training presentation
    Show answer & explanation

    Correct answer: B — An attack path document that chains footholds, pivots, and privilege escalations toward the objective

    • A. Incorrect. A severity matrix ranks isolated findings, so it cannot show how they connect into a chain leading to the domain controller.
    • B. Correct. An attack path documents how individual weaknesses and access levels combine into a route from the initial foothold to the goal, which is exactly what was requested.
    • C. Incorrect. A low-level diagram shows detailed infrastructure layout such as addressing or ports, not the exploitation sequence between systems.
    • D. Incorrect. A storyboard illustrates the narrative or steps of a scenario for communication purposes, not the technical chain of hosts and privilege changes.

    Subdomain 4.2: Given a scenario, perform network attacks using the appropriate tools.

    23.Which statement accurately describes the switch spoofing variant of VLAN hopping?

    1. A.An attacker floods a switch's CAM table with forged MAC addresses until it fails open and forwards all frames out every port like a hub, exposing traffic from every VLAN it carries.
    2. B.An attacker crafts a frame with two stacked 802.1Q tags so the first switch strips only the outer tag and forwards the inner frame onto a different VLAN than the access port's native VLAN.
    3. C.An attacker configures a host's NIC to negotiate trunk mode with the connected port, for example by mimicking DTP, so the host receives tagged traffic from every VLAN on that trunk.
    4. D.An attacker gains physical access to an unused switch port left in a VLAN with no authentication and connects a rogue device that simply assumes the native VLAN assigned to that port.
    Show answer & explanation

    Correct answer: C — An attacker configures a host's NIC to negotiate trunk mode with the connected port, for example by mimicking DTP, so the host receives tagged traffic from every VLAN on that trunk.

    • A. This describes MAC flooding, a separate attack against the switch's content-addressable memory table, not the trunk-negotiation technique that defines switch spoofing.
    • B. This describes double tagging, a distinct VLAN hopping variant that abuses tag stripping at the first switch rather than negotiating trunk status with the attacker's own port.
    • C. Switch spoofing works exactly this way: the attacking host imitates a trunking switch during negotiation so the real switch places the port into trunk mode and forwards every VLAN's tagged traffic to it.
    • D. Simply connecting to an unused, unauthenticated port only grants access to whatever single VLAN that port is already assigned to, with no trunk negotiation or tag manipulation involved.

    Subdomain 4.3: Given a scenario, perform authentication attacks using the appropriate tools.

    24.The rules of engagement allow online guessing against a login portal that locks an account for 30 minutes after five failed attempts. The tester has a list of 2,000 valid usernames and wants to use a tool such as Hydra or Medusa without locking accounts. Which approach fits best?

    1. A.Try several thousand passwords against one high-value account in rapid succession to exhaust a large dictionary quickly.
    2. B.Replay username and password pairs leaked in unrelated public breaches against every account at maximum thread count.
    3. C.Launch a mask attack against each account simultaneously, using maximum parallelism to finish before alerting thresholds trip.
    4. D.Try one or two common passwords across all usernames, then wait past the lockout window before the next password round.
    Show answer & explanation

    Correct answer: D — Try one or two common passwords across all usernames, then wait past the lockout window before the next password round.

    • A. Concentrating many guesses on one account is a classic brute-force pattern that trips the five-failure lockout almost immediately.
    • B. Replaying leaked pairs is credential stuffing. It relies on password reuse rather than staying under the per-account threshold, and high speed would still generate noise.
    • C. Mask attacks are an offline cracking technique, and running many guesses per account in parallel would exceed the lockout threshold.
    • D. Correct. This is password spraying: few guesses per account per window keeps each account below the lockout threshold while still testing many users against common passwords.

    Subdomain 4.8: Given a scenario, perform social engineering attacks using the appropriate tools.

    25.A tester must choose spearphishing targets by visualizing how employees, email addresses, domains, and social media accounts relate to one another from public data. Which tool is designed for this link analysis?

    1. A.BeEF, which sends commands to browsers that have loaded its hook and reports their details
    2. B.Gophish, which groups recipients in a campaign and records which of them opened the message
    3. C.Maltego, which uses transforms to graph relationships between people, domains, and accounts
    4. D.Evilginx, which proxies the login flow of a real site and captures the issued session tokens
    Show answer & explanation

    Correct answer: C — Maltego, which uses transforms to graph relationships between people, domains, and accounts

    • A. BeEF manages hooked browsers after exploitation. It has no function for building relationship graphs from open sources.
    • B. Gophish delivers and tracks campaigns after targets are chosen. It does not discover or graph relationships between people, domains, and accounts.
    • C. Maltego runs transforms against public sources and renders entities and their relationships as a graph, which supports picking high-value targets and pretexts.
    • D. Evilginx is a reverse proxy used for capturing sessions during phishing. It performs no reconnaissance or relationship mapping.

    Subdomain 4.8: Given a scenario, perform social engineering attacks using the appropriate tools.

    26.The scope includes the client's reception area and open-plan floor. Which THREE activities are physical or in-person social engineering techniques that the tester may perform? (Select three.)(Select 3)

    1. A.Injecting a hook script into a third-party website that employees frequent
    2. B.Serving a cloned portal with the Social Engineering Toolkit's site cloner
    3. C.Following a courier through a secured door before it closes behind them
    4. D.Sending text messages that contain a shortened link to a cloned login page
    5. E.Sorting through discarded printouts left in an unlocked recycling bin
    6. F.Reading a receptionist's password by watching the keyboard over their shoulder
    Show answer & explanation

    Correct answers: C, E, F — Following a courier through a secured door before it closes behind them; Sorting through discarded printouts left in an unlocked recycling bin; Reading a receptionist's password by watching the keyboard over their shoulder

    • A. Injecting a hook into a visited website is a watering hole attack carried out remotely, so it is not a physical technique.
    • B. Serving a cloned portal is credential harvesting performed over the network. It is remote activity and not an in-person technique.
    • C. Tailgating behind another person through a secured door is a physical technique that needs no badge and fits the reception and floor scope.
    • D. Texting a link to a cloned login page is smishing, which is delivered over a mobile messaging channel and does not rely on physical presence.
    • E. Searching discarded paper is dumpster diving, a physical technique that requires access to bins within scope, not any network activity.
    • F. Shoulder surfing means observing someone entering credentials in person, so it is a physical technique suited to a reception desk.

    Subdomain 4.10: Given a scenario, use scripting to automate attacks.

    27.A tester is writing a Python script that must authenticate to a list of Windows servers, speak SMB and Kerberos natively, and perform remote operations against each one. Which library provides the protocol primitives the script needs?

    1. A.Atomic Red Team, a set of small ATT&CK-mapped tests used to validate host and network detection coverage.
    2. B.Impacket, a Python collection implementing SMB, Kerberos, and WMI primitives that a script can call directly.
    3. C.Scapy, a Python library for constructing, transmitting, and dissecting packets at arbitrary network layers.
    4. D.PowerSploit, a PowerShell module set that performs reconnaissance and post-exploitation actions on Windows hosts.
    Show answer & explanation

    Correct answer: B — Impacket, a Python collection implementing SMB, Kerberos, and WMI primitives that a script can call directly.

    • A. Atomic Red Team provides small technique tests for detection validation rather than protocol libraries that a script can invoke against remote hosts.
    • B. Impacket provides Python classes that implement SMB, Kerberos, and related Windows protocols, which is exactly what a script needs to authenticate and act against remote servers.
    • C. Scapy works at the packet layer and is used to craft and dissect traffic; it does not supply ready-made SMB or Kerberos client behaviour for remote operations.
    • D. PowerSploit is a PowerShell module set for Windows reconnaissance and post-exploitation; it is not a Python protocol library.

    Subdomain 4.4: Given a scenario, perform host-based attacks using the appropriate tools.

    28.A penetration tester reviews a Windows host and finds a service whose binary path is `C:\Program Files\Vendor Tools\agent\svc.exe` and is not wrapped in quotation marks. The directory `C:\Program Files\Vendor Tools\agent\` does not exist, the service runs as LocalSystem, and the tester's low-privileged user can write to `C:\Program Files\Vendor Tools\`. Which host-based attack does this configuration enable?

    1. A.DLL search order hijacking, since the service loads an unqualified dependency from its own working directory when it first starts
    2. B.Process hollowing, since the running service would be unmapped and replaced by a suspended copy of the tester's payload
    3. C.Token impersonation, since a low-privileged process duplicates the LocalSystem token the service already holds
    4. D.Unquoted service path injection, since Windows resolves a space-containing path to an executable it finds earlier in the search order
    Show answer & explanation

    Correct answer: D — Unquoted service path injection, since Windows resolves a space-containing path to an executable it finds earlier in the search order

    • A. DLL search order hijacking depends on an unqualified or missing DLL being resolved from a writable directory, and it is not driven by how the service control manager parses the binary path itself.
    • B. Process hollowing starts a legitimate process suspended and replaces its in-memory image with other code, which is unrelated to the parsing of a service binary path.
    • C. Token impersonation reuses an access token from another process or session and does not follow from a service path that simply lacks quotation marks.
    • D. An unquoted service path containing a space causes Windows to try each space-delimited prefix as a candidate executable before the intended binary, so a writable parent directory turns the misconfiguration into code execution as the service account.

    Subdomain 4.4: Given a scenario, perform host-based attacks using the appropriate tools.

    29.A tester is mapping where credential material can be recovered from a compromised Windows environment. Which three of the following artifacts commonly hold credential material?(Select 3)

    1. A.The event trace log files, which record kernel and provider telemetry for the operating system
    2. B.The NTDS.dit database on a domain controller, which stores the hashes for domain accounts
    3. C.The SAM registry database, which stores the local account password hashes for the host
    4. D.The Prefetch directory, which stores execution metadata used to speed up application launches
    5. E.LSASS process memory, which caches credential and ticket material for logged-on sessions
    Show answer & explanation

    Correct answers: B, C, E — The NTDS.dit database on a domain controller, which stores the hashes for domain accounts; The SAM registry database, which stores the local account password hashes for the host; LSASS process memory, which caches credential and ticket material for logged-on sessions

    • A. Event trace log files hold provider telemetry about system and application activity and do not store account passwords or hashes.
    • B. On a domain controller, the NTDS.dit database holds the password hashes for domain accounts and is therefore a high-value credential store.
    • C. The SAM registry database stores the password hashes for the host's local accounts and is readable with sufficient privileges on that system.
    • D. Prefetch holds execution metadata such as run counts and loaded modules, which supports forensic timeline work but contains no authentication material.
    • E. LSASS process memory holds credential material such as password hashes and Kerberos tickets for logged-on sessions, which is why it is a primary credential access target.

    Subdomain 4.7: Given a scenario, perform wireless attacks using the appropriate tools.

    30.A penetration tester is conducting a passive wireless assessment at a client site. The client wants continuous monitoring that alerts when an unauthorized access point appears advertising the corporate SSID, and when management frames such as deauthentication are observed on the monitored channels. Which tool best fits this requirement?

    1. A.InSSIDer, which maps signal strength and channel overlap across a floor plan and exports survey reports for the facilities team
    2. B.Kismet, which keeps the adapter passive and alerts when new access points or management frames appear on monitored channels
    3. C.WiGLE.net, which correlates GPS-tagged scan results contributed by many wardrivers into a searchable online map of discovered networks
    4. D.Aircrack-ng, which recovers WPA2 pre-shared keys from captured four-way handshakes using dictionary and rule-based attacks
    Show answer & explanation

    Correct answer: B — Kismet, which keeps the adapter passive and alerts when new access points or management frames appear on monitored channels

    • A. InSSIDer is a graphical site-survey utility that charts signal strength, channel usage, and overlap so facilities teams can plan coverage. It offers no rogue-AP alerting or management-frame monitoring, so it does not satisfy the monitoring requirement.
    • B. Kismet operates the wireless adapter passively, enumerates access points and associated clients, and can raise alerts on rogue devices and unusual management frames. That alerting and management-frame visibility is exactly what continuous monitoring of a single site requires.
    • C. WiGLE.net is a crowd-sourced database that plots GPS-tagged wireless scan results on an online map. It has no live monitoring or alerting capability for a single corporate site during an engagement.
    • D. Aircrack-ng is built around capturing 802.11 frames and recovering keys from four-way handshakes with wordlists and rules. Its purpose is key recovery from captures rather than ongoing detection of unauthorized access points.

    Domain 5: Post-exploitation and Lateral Movement

    Subdomain 5.4: Explain cleanup and restoration activities.

    31.A tester left a web shell in an upload directory of a production web server. The file has been deleted. Which additional step best confirms that this persistence mechanism has been fully removed?

    1. A.Restart the web service and assume the shell is gone, since the process would no longer be able to load the deleted file.
    2. B.Compare the web root to the known-good deployment by hash, and have the client review server logs for later requests to it.
    3. C.Scan the client's internal network for the same file name and delete any matching names that are discovered on other hosts.
    4. D.Change the permissions on the upload directory to read-only, so that any remaining files can no longer be executed by the web server.
    Show answer & explanation

    Correct answer: B — Compare the web root to the known-good deployment by hash, and have the client review server logs for later requests to it.

    • A. Incorrect: a restart does not prove that no copies or modified files remain, and it disrupts a production service without verifying anything.
    • B. Correct: a hash comparison against a trusted deployment shows unexpected or modified files, and the logs show whether the shell was accessed by anyone else.
    • C. Incorrect: deleting matching names on other hosts risks removing legitimate files and goes beyond what the tester created.
    • D. Incorrect: a permission change is a new unapproved configuration change that may break uploads and does not confirm that anything was removed.

    Subdomain 5.3: Summarize concepts related to staging and exfiltration.

    32.Which Windows file system capability lets a tester attach a staged archive to an existing, innocuous-looking file so that a normal directory listing shows no extra file and the host file's displayed size is unchanged?

    1. A.The hidden file attribute set with attrib, which removes an item from a default listing
    2. B.NTFS alternate data streams, which store extra named data inside an existing file record
    3. C.A directory junction pointing to a folder located on a different mounted volume
    4. D.Volume shadow copies, which preserve earlier versions of files in a protected store
    Show answer & explanation

    Correct answer: B — NTFS alternate data streams, which store extra named data inside an existing file record

    • A. The hidden attribute only suppresses a default listing. The file still appears with dir /a, and it is a separate file with its own size, so it does not match the described behavior.
    • B. NTFS alternate data streams hang named streams off a host file such as report.txt:stage. The host's reported size does not change, and defenders can find the streams with dir /r or streams.exe.
    • C. A junction redirects a path to another folder. Its target files remain ordinary, visible files, so it does not conceal data inside another file.
    • D. Shadow copies keep point-in-time versions of files for recovery. They are not a way to attach extra data to a file or to hide staged content.

    Subdomain 5.1: Given a scenario, perform tasks to establish and maintain persistence.

    33.A tester obtains root on a Linux server and needs persistence that re-establishes access after a reboot without requiring any user to sign in. Which two mechanisms meet the requirement?(Select 2)

    1. A.A command appended to the user's `.bashrc` file that restarts the implant on each interactive shell.
    2. B.An entry added under `/etc/cron.d` that runs the implant on a fixed recurring schedule.
    3. C.A bind shell started manually in the current session that listens on a high TCP port for reconnection.
    4. D.A unit file installed under `/etc/systemd/system` that starts the implant during system boot.
    5. E.A banner line added to the system-wide `/etc/motd` file that is displayed at each user login.
    Show answer & explanation

    Correct answers: B, D — An entry added under `/etc/cron.d` that runs the implant on a fixed recurring schedule.; A unit file installed under `/etc/systemd/system` that starts the implant during system boot.

    • A. A line in a user's `.bashrc` executes only when that user opens an interactive shell, so the mechanism depends on a person logging in and does not satisfy the requirement.
    • B. A file processed from `/etc/cron.d` is handled by the system cron daemon on its schedule regardless of whether anyone is logged on, so it also survives a reboot.
    • C. A bind shell started by hand exists only in the current session. A reboot terminates the process and nothing restarts it, so no persistence is achieved.
    • D. A systemd unit placed in the system directory is started by the init system during boot, so it re-establishes access with no dependency on any user signing in.
    • E. A message-of-the-day line only prints text at login time. It provides no execution path or reconnection capability and therefore no persistence.

    Subdomain 5.2: Given a scenario, perform tasks to move laterally throughout the environment.

    34.A tester with local administrator rights on a Windows workstation needs to recover cached plaintext credentials and Kerberos tickets from the running operating system. Which tool and technique fits this requirement?

    1. A.Run Hashcat in NTLM mode against the local SAM database file that was copied from the workstation while it was online.
    2. B.Run `net use` against the administrative share to mount the workstation registry and read the stored credential backup.
    3. C.Run `secretsdump.py` against the remote host to pull the SAM and SYSTEM hives over the network for offline parsing.
    4. D.Run Mimikatz with the `sekurlsa` module to read credential material that the Local Security Authority keeps in memory.
    Show answer & explanation

    Correct answer: D — Run Mimikatz with the `sekurlsa` module to read credential material that the Local Security Authority keeps in memory.

    • A. Hashcat works offline against a hash file, so it can recover a local account password but not the in-memory tickets and plaintext credentials being sought.
    • B. Mounting the administrative share reaches files and registry hives on disk, not the volatile credential structures held in the memory of the running system.
    • C. Pulling the SAM and SYSTEM hives yields local account hashes only; it does not recover plaintext secrets or ticket material held in the live credential store.
    • D. Mimikatz reads the credential material held in the memory of the Local Security Authority, including plaintext passwords and Kerberos tickets for logged-on sessions.

    Subdomain 5.2: Given a scenario, perform tasks to move laterally throughout the environment.

    35.A foothold host can reach an internal web administration interface on TCP 8080, but the attack platform has no route to that network, SSH is not available on the foothold, and the tester only needs this single service. Which approach provides access?

    1. A.Publish the internal port to the attack platform with an `ssh -R` remote forward created from the foothold host's shell session.
    2. B.Add a static route on the attack platform for the internal subnet that names the foothold host as the next hop address.
    3. C.Relay the port with Netcat: one instance listening on the attack platform and piping to a second that connects out to the internal service.
    4. D.Start a Metasploit SOCKS proxy through an existing Meterpreter session and use proxychains to reach the interface from the browser.
    Show answer & explanation

    Correct answer: C — Relay the port with Netcat: one instance listening on the attack platform and piping to a second that connects out to the internal service.

    • A. An ssh -R remote forward would publish the port, but the scenario states that SSH is not available on the foothold host.
    • B. A static route only tells the attack platform where to send packets; the foothold does not forward them without a listening relay or tunnel.
    • C. Chaining a listening Netcat on the attack platform to a second Netcat that connects out from the foothold forwards the single port without needing SSH or a framework session.
    • D. A Meterpreter SOCKS proxy would also reach the interface, but it assumes an existing Meterpreter session that the scenario has not established.

    Want the full experience?

    These are just samples. Practice the full CompTIA PenTest+ question bank in quiz mode — free, no signup, with domain practice and exam simulation.