No sign-up needed

Free CompTIA PenTest+ practice test

20 questions, each with a clear explanation.

Quick PracticeQuestion 1 of 20
Your progress through this set
Engagement ManagementStep 1 · Choose one answer

An external penetration test is authorized for two IP ranges listed in the statement of work. While reviewing public DNS records, the tester finds a VPN gateway that appears to belong to the client but sits on an address outside both ranges. What should the tester do next?

Question review

All 20 CompTIA PenTest+ questions with explanations

Try the set above first, then use this list to review. Each answer and explanation stays closed until you open it.

  1. Question 1 · Engagement Management

    An external penetration test is authorized for two IP ranges listed in the statement of work. While reviewing public DNS records, the tester finds a VPN gateway that appears to belong to the client but sits on an address outside both ranges. What should the tester do next?

    1. Run one light port scan of it, since a single scan carries little risk
    2. Include it in testing, because the client clearly appears to own it
    3. Leave it alone and ask the client contact to approve it in writing
    4. Drop it from the notes and keep working only on the listed ranges
    Show answer and explanation for question 1

    Correct answer: C · Leave it alone and ask the client contact to approve it in writing

    NIST SP 800-115 says the rules of engagement should list authorized and unauthorized IP addresses, and calls it crucial to identify systems that are not authorized for testing. An address outside the agreed ranges stays out of scope until the client changes the scope in writing, so the tester leaves it alone and raises it through the engagement's communication path. A light port scan is still testing without authorization. Apparent ownership does not grant permission, and the address might belong to a hosting provider or another third party. Dropping the host from the notes loses information the client would want, so the tester records it and asks.

    Look for this next time: An asset outside the written scope stays untouched until the client approves a scope change in writing.

  2. Question 2 · Engagement Management

    A company hires a tester to assess its workloads in AWS: EC2 instances, an Amazon RDS database, and Lambda functions. The company's IT manager also asks for tests against the AWS-managed hosts that run the RDS service. Under AWS's penetration testing policy, which requested target is off-limits even with the company's written authorization?

    1. The underlying hosts that AWS manages to run the RDS service
    2. The EC2 instances that run the company's own web application
    3. The company's RDS database instance and its connection settings
    4. The Lambda functions that the company deployed behind its API
    Show answer and explanation for question 2

    Correct answer: A · The underlying hosts that AWS manages to run the RDS service

    AWS's penetration testing policy lets customers assess their own AWS resources on its list of permitted services, which includes EC2 instances, Amazon RDS, and Lambda functions, without prior approval. The same policy says customers are not permitted to assess AWS infrastructure or the AWS services themselves. That split follows the shared responsibility model: the company can authorize tests only of what it controls. Its EC2 instances, its RDS database instance, and its Lambda functions are customer resources on the permitted list. The hosts that run the managed service belong to AWS, so the company's signature cannot authorize testing them.

    Look for this next time: A cloud customer can authorize tests of its own resources, not of the provider's infrastructure, so check the provider's testing policy during scoping.

  3. Question 3 · Engagement Management

    A draft report finding: the search box on a client's web application builds its SQL query by joining the user's input into the query string, and the tester read table names through it. Which remediation should the report list as the primary fix?

    1. Add a web application firewall rule for known injection strings
    2. Replace detailed database errors with one generic error page for users
    3. Escape the quote characters in the input before adding it to the query
    4. Rewrite the query as a parameterized statement that binds the input
    Show answer and explanation for question 3

    Correct answer: D · Rewrite the query as a parameterized statement that binds the input

    OWASP's SQL Injection Prevention Cheat Sheet names parameterized queries as the preferred defense: the SQL structure is defined separately and the input is bound as a data value, so it cannot change the query. The cheat sheet calls manual escaping error-prone and strongly discouraged, because escaping rules differ between databases and settings. A web application firewall rule and a generic error page can reduce what an attacker sends or sees, but the vulnerable query stays in the code. A report can list them as added layers, along with least-privilege database accounts, after the primary fix.

    Look for this next time: For SQL injection, recommend parameterized queries as the root-cause fix; WAF rules and error handling are added layers.

  4. Question 4 · Reconnaissance and Enumeration

    Before any active testing starts, a tester wants a list of the client's subdomains without sending a single packet to the client's own servers. Which source meets that condition?

    1. A zone transfer request sent to the client's own name servers
    2. Certificate transparency logs that list the certificates for the domain
    3. Hostname guesses from a wordlist, each resolved by the client's DNS servers
    4. A crawl of the client's website for linked hostnames
    Show answer and explanation for question 4

    Correct answer: B · Certificate transparency logs that list the certificates for the domain

    The Certificate Transparency project describes CT logs as publicly available, append-only records that let anyone see which certificate authorities issued which certificates, when, and for which domains. Searching them reveals hostnames named in certificates without contacting the client's systems, which makes it passive reconnaissance. A zone transfer request and a wordlist resolved against the client's name servers both send queries to the client's DNS, and crawling the website sends requests to its web server, so each one touches the target. Names found in CT logs can be old or internal, so the tester still checks them against the scope before any testing.

    Look for this next time: Certificate transparency logs are a passive source of subdomains because they are public records of issued certificates.

  5. Question 5 · Reconnaissance and Enumeration

    A UDP scan of an in-scope server lists port 161/udp as open|filtered. The scanner retried the probe and received no reply of any kind. What does that state tell the tester?

    1. A service replied to the probe, so the port is confirmed open
    2. The whole host is down, since the UDP probe went unanswered
    3. The port is closed, and the host sent back an ICMP error message
    4. Nmap cannot tell whether the port is open or a filter dropped it
    Show answer and explanation for question 5

    Correct answer: D · Nmap cannot tell whether the port is open or a filter dropped it

    Nmap's reference guide says a UDP port is classified as open|filtered when no response arrives after retransmissions: the port could be open, or a packet filter could be blocking the traffic. A UDP reply from a service would prove the port open, and an ICMP port unreachable error would mark it closed, so neither fits a probe that got no answer. The state describes one port, not the host, and says nothing about the host being down. Nmap's documentation adds that version detection can help tell truly open ports from filtered ones.

    Look for this next time: In a UDP scan, open|filtered means no reply came back, so the port may be open or filtered; version detection can help resolve it.

  6. Question 6 · Reconnaissance and Enumeration

    A tester's Bash loop pings each address from 10.20.30.1 to 10.20.30.254 once and prints all of ping's output, including every timeout. The tester wants the loop to print only the addresses that reply. Which change does that?

    1. Run ping quietly inside an if test and echo the address on success
    2. Swap the for loop for a while loop that counts from 1 to 254 instead
    3. Add a one-second sleep between pings so fewer replies get dropped
    4. Pipe the loop's whole output into sort so that replies are listed first
    Show answer and explanation for question 6

    Correct answer: A · Run ping quietly inside an if test and echo the address on success

    The GNU Bash manual says an if statement runs its then branch when the test command returns a zero status. The ping manual page says ping exits with code 1 when it receives no reply at all and 0 otherwise, which makes the exit code usable to see whether a host is alive. Running ping with its output discarded as the if test, and echoing the address in the then branch, prints only the hosts that answered. A while loop changes how the loop counts, not what it prints. A sleep slows the sweep without filtering anything, and sorting reorders the output but still shows every timeout.

    Look for this next time: In shell scripts, test a command's exit status with if; ping returns 0 when a reply arrives.

  7. Question 7 · Reconnaissance and Enumeration

    While enumerating an in-scope website, a tester reads its robots.txt file. It contains Disallow lines for /backup-2025/ and /staging/. How should the tester treat those entries?

    1. As proof that both paths are protected by a login on the server
    2. As the client's list of paths that are excluded from the test
    3. As requests to crawlers, which do not control access to the paths
    4. As evidence that both paths were removed from the web server
    Show answer and explanation for question 7

    Correct answer: C · As requests to crawlers, which do not control access to the paths

    RFC 9309, the Robots Exclusion Protocol, says the rules in robots.txt are not a form of access authorization. A Disallow line asks well-behaved crawlers to skip a path, so it neither protects the path with a login nor proves that the path was removed. Listed paths can still exist and respond, which is why a tester notes them for review within the agreed scope. Scope comes from the rules of engagement and the statement of work, not from a file written for search engines, so the entries do not exclude anything from the test.

    Look for this next time: robots.txt asks crawlers to skip paths; it is not access control and does not define the test scope.

  8. Question 8 · Vulnerability Discovery and Analysis

    A client's web application is built mostly from open-source libraries. The client wants to know which of those third-party components carry known vulnerabilities. Which type of scan fits that request?

    1. Static application security testing of the client's own source code
    2. Software composition analysis of the libraries the app depends on
    3. Dynamic application security testing of the running application
    4. A wireless channel scan of the network in the client's main office
    Show answer and explanation for question 8

    Correct answer: B · Software composition analysis of the libraries the app depends on

    OWASP describes component analysis as identifying risk from the use of third-party and open-source components, and says that with a limited scope it is commonly called software composition analysis (SCA). Checking the app's libraries for known vulnerabilities is exactly that. OWASP describes static application security testing tools as analyzing source code to find security flaws, which suits the client's own code, and web application vulnerability scanners as testing a running app, normally from the outside. Neither is built to inventory third-party components. A wireless channel scan looks at radio networks, not software.

    Look for this next time: To find known vulnerabilities in third-party and open-source libraries, use software composition analysis.

  9. Question 9 · Vulnerability Discovery and Analysis

    A vulnerability scan flags a Red Hat Enterprise Linux web server for a CVE because the Apache version in its banner is older than the upstream release that fixed the flaw. The server receives regular updates from Red Hat. What should the tester do before reporting the finding?

    1. Check Red Hat's advisory for the CVE against the installed package
    2. Report it as critical, based on the banner's version alone
    3. Upgrade Apache to the newest upstream release, then scan it again
    4. Run the same unauthenticated scan again to confirm the first result
    Show answer and explanation for question 9

    Correct answer: A · Check Red Hat's advisory for the CVE against the installed package

    Red Hat explains that it backports security fixes into older package versions, so the version number alone does not show whether a system is vulnerable, and that tools judging only by version produce false positives. Red Hat names the CVEs in its advisories, so comparing the advisory with the installed package shows whether the fix is present. Reporting the flaw as critical from the banner alone risks a false positive. Upgrading the server is the client's decision, not a validation step. Repeating the same version-based scan would repeat the same result without new evidence.

    Look for this next time: Validate version-based findings against the vendor's advisories, because backported fixes keep old version numbers.

  10. Question 10 · Vulnerability Discovery and Analysis

    A client asks whether any cloud access keys were ever committed to its internal Git repository, including in commits that were later reverted. Which tool is built for that check?

    1. Nikto, which scans web servers for outdated software and risky files
    2. Nmap, which discovers hosts and reports the state of their ports
    3. WiGLE, which maps wireless networks that users record
    4. TruffleHog, which looks for leaked credentials in Git repositories
    Show answer and explanation for question 10

    Correct answer: D · TruffleHog, which looks for leaked credentials in Git repositories

    TruffleHog's documentation describes it as a tool to find, verify, and analyze leaked credentials, and lists Git among the places it scans. Its output records the commit in which each secret was found, so a key removed in a later commit can still turn up in the commit that added it. Nikto is a web server scanner, Nmap reports hosts and port states, and WiGLE maps wireless networks, and none of them reads a repository's history. Any live key found should be reported so the client can revoke and replace it, because deleting the line from the code does not invalidate the key.

    Look for this next time: Secrets scanners such as TruffleHog check a repository's commits, so a key removed later can still be found and must be revoked.

  11. Question 11 · Attacks and Exploits

    Two findings have similar CVSS base scores. FIRST's EPSS gives the first CVE a score of 0.85 and the second a score of 0.02. What does the 0.85 score tell the tester?

    1. The flaw rates 8.5 out of 10 on FIRST's severity scale for CVEs
    2. There is an estimated 85% chance of exploitation in the next 30 days
    3. About 85% of the hosts on the scanned network have the same flaw
    4. The vendor has released patches for 85% of the affected versions
    Show answer and explanation for question 11

    Correct answer: B · There is an estimated 85% chance of exploitation in the next 30 days

    FIRST describes the Exploit Prediction Scoring System as a model that estimates the probability that a published CVE will be exploited in the wild in the next 30 days, published daily as a 0–1 probability for every CVE. A score of 0.85 is an estimated 85% probability, which makes that CVE the stronger candidate for priority when the severity of the two is similar. EPSS is not a severity scale; CVSS describes severity. It also says nothing about how many hosts in this network share the flaw or how many versions a vendor has patched.

    Look for this next time: EPSS estimates the chance that a CVE will be exploited in the wild within 30 days; CVSS describes severity.

  12. Question 12 · Attacks and Exploits

    During an authorized internal test, the tester confirms a vulnerability on a server that the rules of engagement label a fragile production system. Proving the issue would require an action that could stop the server's main service. What should the tester do?

    1. Prove it after hours, when fewer users depend on the service
    2. Prove it at once while watching the service so it can be restarted fast
    3. Pause and raise it with the client contact before taking any action
    4. Leave it out of the report, since it could not be proven safely
    Show answer and explanation for question 12

    Correct answer: C · Pause and raise it with the client contact before taking any action

    NIST SP 800-115 says the rules of engagement should identify the risks of intrusive tests and the techniques used to reduce them, give criteria for halting testing, and set out the communication path and points of contact. CompTIA's objectives also list scope limitations and labeling sensitive systems under preparing attacks. A system already labeled fragile calls for the client's explicit decision before any step that could disrupt it, so the tester pauses and asks. A quieter hour or a watched restart is a choice the client must approve, not one the tester makes alone. Leaving out a confirmed weakness hides a real risk from the client.

    Look for this next time: When a proof step could disrupt a system the client labeled sensitive, stop and get the client's decision first.

  13. Question 13 · Attacks and Exploits

    An authorized test of a client's internet-facing sign-in portal found two accounts using a common password, guessed by trying that one password once against many accounts. No account locked out, and the portal relies on passwords alone. Which recommendation most directly addresses this finding?

    1. Require multifactor authentication for every sign-in on the portal
    2. Lower the per-account lockout threshold from five failures to three
    3. Show one generic error for every failed sign-in
    4. Make every user change passwords every 30 days from now on
    Show answer and explanation for question 13

    Correct answer: A · Require multifactor authentication for every sign-in on the portal

    MITRE ATT&CK describes password spraying as trying one or a few common passwords against many accounts to avoid the lockouts that repeated guesses against one account would trigger, and lists multifactor authentication on externally facing services among its mitigations. With a second factor required, a guessed password alone no longer opens the account. A lower per-account threshold does not help when each account sees a single attempt, and MITRE warns that overly strict lockout policies can lock out legitimate users. A generic error message still lets a correct password in, and a 30-day change schedule does not stop users from picking another common password.

    Look for this next time: Password spraying stays under per-account lockout limits, so the direct fix is multifactor authentication on exposed sign-ins.

  14. Question 14 · Attacks and Exploits

    Signed in as test user A on a client's web portal, the tester opens invoice 10452, changes the number in the URL to 10453, and sees an invoice that belongs to test user B. Which remediation should the report recommend?

    1. Switch invoice numbers to random identifiers that are hard to guess
    2. Encrypt the invoice number in the URL with a server-side secret key
    3. Hide the invoice number from the address bar with a POST request
    4. Check on the server that each invoice belongs to the signed-in user
    Show answer and explanation for question 14

    Correct answer: D · Check on the server that each invoice belongs to the signed-in user

    OWASP's Insecure Direct Object Reference Prevention Cheat Sheet says IDOR comes from a missing object-level authorization check, which lets a user reach objects that are not theirs by changing an identifier. It adds that even hard-to-guess identifiers still need access control checks, because a leaked reference would still work. The fix is a server-side check that each invoice belongs to the signed-in user. Random or encrypted identifiers only make references harder to guess. Moving the number into a POST body changes where it travels, not whether the server checks ownership, and the cheat sheet notes that values in a POST body can be manipulated too.

    Look for this next time: Fix IDOR with a server-side ownership check on every object request; hard-to-guess IDs alone are not access control.

  15. Question 15 · Attacks and Exploits

    A tester finds that a client's Amazon S3 bucket of database backups lets anyone on the internet read its objects. The client confirms the bucket should be private. Which remediation should the report recommend first?

    1. Rename the bucket so that its address is harder for others to guess
    2. Turn on default encryption for every object stored in the bucket
    3. Turn on S3 Block Public Access for the bucket and the account
    4. Turn on server access logging to record each request to the bucket
    Show answer and explanation for question 15

    Correct answer: C · Turn on S3 Block Public Access for the bucket and the account

    AWS's documentation says S3 Block Public Access settings override bucket policies, access point policies, and object permissions to limit public access, and that they are enforced regardless of how the resources are created. That directly ends the public read the tester found. A new bucket name is obscurity, not access control. Default encryption protects the stored data at rest, but it does not decide who may read the objects. Access logging records requests, which helps the client investigate what was already read, but it does not stop anyone from reading the backups. Both can follow as added steps.

    Look for this next time: For an S3 bucket that should be private, block public access first; encryption and logging do not change who can read it.

  16. Question 16 · Attacks and Exploits

    In an authorized social engineering test, several employees approved push sign-in prompts on their phones that they had not started, after receiving many prompts in a row. The client already requires MFA for every account. Which recommendation addresses this finding most directly?

    1. Shorten the time each push prompt stays open before it expires
    2. Turn on number matching so approving needs the code on the screen
    3. Add a note to the yearly training that MFA prompts can be fake
    4. Raise the minimum password length from 12 to 16 characters
    Show answer and explanation for question 16

    Correct answer: B · Turn on number matching so approving needs the code on the screen

    CISA's October 2022 fact sheet on number matching describes MFA fatigue, also called push bombing, as flooding a user with push prompts until the user approves one. It recommends number matching for organizations that cannot yet move to phishing-resistant MFA, because a user cannot approve a request without the numbers shown on the sign-in screen, which makes repeated prompts ineffective. CISA calls phishing-resistant MFA the stronger goal. A shorter prompt lifetime still lets a tired user tap approve. CISA also recommends training users to report unknown requests, but training does not change the approval step. A longer password does not help once the password is known.

    Look for this next time: MFA fatigue is countered most directly by number matching, with phishing-resistant MFA as the stronger long-term goal.

  17. Question 17 · Attacks and Exploits

    A client's support chatbot summarizes files that customers upload. During an authorized test, a document with hidden text instructions made the chatbot reveal internal ticket notes to the uploader. Which mitigation fits this finding best?

    1. Scan every uploaded file with antivirus before the chatbot reads it
    2. Require customers to sign in to the portal before they can upload
    3. Log every chatbot conversation so the team can review it each week
    4. Treat uploaded text as untrusted data and cut the bot's note access
    Show answer and explanation for question 17

    Correct answer: D · Treat uploaded text as untrusted data and cut the bot's note access

    OWASP's LLM01:2025 Prompt Injection entry describes indirect prompt injection: a model accepts input from external sources such as websites or files, and content inside them changes the model's behavior. Its prevention list includes separating and clearly marking untrusted external content and enforcing least privilege, so the model cannot reach data it does not need. Antivirus scanning looks for malicious code, not instructions written as plain text. Signing in identifies the uploader but does not make the document's content safe. Logging helps the team review what happened afterward, but it does not prevent the next disclosure.

    Look for this next time: Indirect prompt injection arrives inside external content, so treat that content as untrusted and limit what the model can reach.

  18. Question 18 · Post-exploitation and Lateral Movement

    On the last day of an internal test, two domain accounts that the tester created to demonstrate access are still active. The rules of engagement require the test team to clean up what it created. What should happen to the accounts?

    1. Remove them as agreed with the client, and record that in the report
    2. Leave them active so the client's team can study how they were used
    3. Disable them only once the final report has reached the client
    4. Keep them active for six months in case the client orders a retest
    Show answer and explanation for question 18

    Correct answer: A · Remove them as agreed with the client, and record that in the report

    CompTIA's PT0-003 objectives list removing tester-created credentials, removing tools, and removing persistence mechanisms among cleanup and restoration activities. NIST SP 800-115 says the rules of engagement should explain the required actions for files the testers create once testing is completed, and that tools and the files they generate should be removed from systems. Leaving the accounts active for study, until the report arrives, or for a possible retest keeps valid credentials in the client's directory that no one is watching. The report should record what the team created and when it was removed.

    Look for this next time: Accounts and other artifacts created during a test are removed at the end, as agreed with the client, and the removal is documented.

  19. Question 19 · Post-exploitation and Lateral Movement

    A client's security team asks for the part of the penetration test report that walks through, in order, how the tester moved from the first compromised host to the file servers, so the team can see where monitoring missed each step. Which report component is that?

    1. The executive summary, written for the client's senior leaders
    2. The methodology section, which names the standards the test followed
    3. The attack narrative, which tells the story of the test step by step
    4. The test limitations, which record what the team could not cover
    Show answer and explanation for question 19

    Correct answer: C · The attack narrative, which tells the story of the test step by step

    CompTIA's PT0-003 objectives list the attack narrative as its own report component, next to the executive summary, methodology, detailed findings, and recommendations, and the exam page's summary of the post-exploitation domain mentions creating attack narratives. A narrative follows the test in sequence, so the client's team can match each step with what its tools recorded. The executive summary is written for decision-makers in plain language. The methodology section explains how the test was run, and the limitations and assumptions record what was not covered or what was assumed.

    Look for this next time: The attack narrative retells the test in order, which helps defenders trace each step against their monitoring.

  20. Question 20 · Post-exploitation and Lateral Movement

    To prove access, the tester copied a small sample of customer records from a client database. The report has been delivered, and the data-handling section of the assessment plan says client data must be destroyed after delivery. What should the tester do with the sample?

    1. Keep it in an encrypted archive in case the client asks for a retest later
    2. Destroy it securely and confirm the destruction to the client contact
    3. Email it back to the client so the security team has its own copy
    4. Move it to the team's shared drive for later tests
    Show answer and explanation for question 20

    Correct answer: B · Destroy it securely and confirm the destruction to the client contact

    NIST SP 800-115 says the assessment plan should address data handling, including how data is stored and transmitted during and after the assessment and how it is removed when the assessment ends. CompTIA's PT0-003 objectives list secure data destruction among cleanup activities. Here the plan requires destruction after delivery, so the tester destroys the sample securely and confirms it in writing. Keeping an encrypted copy breaks the agreed plan. Emailing customer records creates a new copy in transit, and a shared drive spreads the data further. The client already holds the original records.

    Look for this next time: Client data taken as proof follows the engagement's data-handling plan, which often ends in secure destruction and a written confirmation.

Use the sample well

The rationale matters more than the score.

A short set can show you what deserves another look. A strong run shows you can read a scoping detail, a tool result, or a finding and choose the step a careful, authorized tester would take. Twenty questions are a small sample, so the result does not predict a 750 on the 100–900 scale.

01

Answer before reviewing

Pick the one answer that fits every condition in the scenario. Then read why each other option falls short.

02

Read every rationale

Confirm why the best option fits, even when you were right.

03

Follow the pattern

Use recurring misses—not one score—to choose your next focus.