Penetration Testing Methodology and Execution Questions
Running structured penetration-testing engagements end to end. Covers the pentest lifecycle, reconnaissance and information gathering, network scanning and enumeration (Nmap, service/version detection), tool selection and usage (Metasploit, Burp Suite), engagement scoping and planning, testing across target types, and findings reporting. The methodical offensive-assessment workflow.
You must create scanning profiles for internal pentests across prod, staging, and dev environments. Describe which profile parameters you would tune (scan types, timings, excluded ports, authenticated vs unauthenticated scans, retries), how you would document each profile, and how profile choices differ between environments based on risk appetite.
Sample Answer
I build a separate scan profile per environment, because the same aggressive settings that are fine on a disposable dev box can cause a real outage on production, so the profiles differ mainly in timing, scan intrusiveness, and how much you rely on authenticated checks versus live network probing.
Parameters to tune per environment
- Scan type: prefer authenticated, credentialed checks and passive service enumeration on production; reserve intrusive, unauthenticated exploit-verification checks for dev and staging.
- Timing and concurrency: production uses conservative timing, low parallelism, and deliberate delays between probes; dev can run at full speed since an accidental disruption there has no business impact.
- Excluded hosts and ports: every profile carries an explicit exclusion list for known-fragile services, such as legacy industrial control or supervisory control and data acquisition (SCADA) systems, live database replication ports, and out-of-band management interfaces, regardless of environment, since some devices simply cannot tolerate being scanned at all.
- Retries and timeouts: production uses fewer retries and longer timeouts to avoid amplifying load on an already-live system; dev can afford more retries and shorter timeouts to move faster.
Documenting each profile
A short template per profile lists its name, purpose, target environment, owner, exact scan-type settings, timing configuration, exclusion list, and an explicit maintenance window. This documentation matters as much as the technical settings, since it's what lets someone else, or your future self, safely re-run the same scan without re-deriving the safe parameters from scratch.
How profiles differ by risk appetite
Production tolerates the least risk, so its profile trades scan depth for safety: authenticated, throttled, and exclusion-heavy. Staging is a middle ground, often close to production settings but with room for a few more intrusive checks since it typically carries no real customer data. Dev tolerates the most risk and gets the most thorough, fastest, most intrusive profile, since a mistake there costs little.
Worked example
For a production profile, I might document: a TCP SYN scan, a polite (slow) timing setting, one retry, a five-second timeout, explicit exclusion of the SCADA subnet and the database replication port, run only in a pre-approved 2 to 4 a.m. maintenance window. The dev profile for the same host list drops the timing restriction, adds authenticated vulnerability checks, and removes the maintenance-window requirement entirely.
Trade-offs and pitfalls
A common pitfall is reusing one "default" profile across all three environments to save setup work, which either under-tests dev, missing findings you could safely go deeper on, or over-tests production, risking an outage. Another is documenting the technical settings but not the maintenance window or owner, so nobody knows who to call if the "safe" production scan still causes an unexpected issue.
Define Cross-Site Request Forgery (CSRF) and explain how you would test whether a state-changing endpoint is vulnerable to it. Describe the controls you would check for and against, and walk through a simple attack you might craft in a controlled test environment to prove the endpoint is exploitable.
Sample Answer
Direct answer
Cross-Site Request Forgery (CSRF) tricks a victim's browser into sending a state-changing request to a site where the victim is already authenticated, using the browser's automatic behavior of attaching cookies to every request regardless of which page triggered it. The attacker never sees the victim's session; they just get the browser to spend it. You test for it by finding a state-changing endpoint, checking whether the request's authenticity depends on anything besides the session cookie, and then trying to replay that request from a different origin without the value you suspect is missing.
Structured elaboration
- What makes an endpoint testable: it must change server-side state (change email, transfer funds, delete an item, elevate a role) and it must rely on cookie-based session authentication, since CSRF specifically exploits a browser's automatic, cross-origin cookie attachment.
- Controls that actually stop CSRF: a synchronizer token pattern (a random, per-session or per-request token embedded in the form or a custom header, validated server-side against the session, not just checked for presence); the SameSite cookie attribute set to Strict or Lax, which tells the browser not to send the cookie on most cross-site requests in the first place; a double-submit cookie pattern (a token sent both as a cookie and as a request parameter, compared server-side); and requiring a custom request header that only same-origin JavaScript can set, since a plain cross-origin form submission cannot add arbitrary headers without triggering a CORS (Cross-Origin Resource Sharing) preflight the server can reject.
- Controls that look like protection but often aren't: a token that's present in the request but never actually validated against the session server-side; a token passed in a URL query string, since it leaks into browser history, proxy logs, and the Referer header; relying on the Referer or Origin header alone with no token, since both can be stripped or omitted by some clients and proxies; and a fix that only covers the primary form but not a secondary GET-based action that also changes state.
Worked example
Say a banking app exposes POST /account/update-email, and the request body is just email=new@example.com, authenticated purely by the session cookie with no token field anywhere in the form or headers. To prove it's exploitable in a controlled test environment, you'd host a minimal, self-submitting HTML page under your own test domain:
<!-- illustrative proof-of-concept skeleton; run only against your own authorized test account -->
<body onload="document.forms[0].submit()">
<form action="https://target.example/account/update-email" method="POST">
<input type="hidden" name="email" value="attacker-controlled@example.com">
</form>
</body>
With your authorized test account still logged into the target app in the same browser, you open this page. The browser automatically attaches the session cookie to the cross-origin POST, and if the endpoint has no real CSRF defense, the email address changes. You confirm the state actually changed, which is your proof, and revert it immediately. In Burp Suite, the faster path is to capture the real authenticated request in the Proxy history and use the built-in "Generate CSRF PoC" engagement tool, which builds an equivalent auto-submitting form and lets you strip out any token field to confirm whether removing it still succeeds.
Trade-offs and pitfalls
- A negative result from a simple auto-submitting form doesn't prove safety by itself: an endpoint might reject standard form submissions but still be vulnerable to a JSON-based CSRF variant if it loosely accepts a content type like
text/plain, so check the endpoint's actual content-type handling, not just the happy path. - Don't forget GET-based state changes, an old but still-seen mistake, like a "delete" link with no confirmation, since those are trivially forgeable with a single image tag and no JavaScript at all.
- Always test with your own authorized account and revert any state you change; this is a live, state-changing test even in a controlled environment, and it deserves the same evidence-handling discipline as any other finding.
List and describe the types of evidence that should accompany a technical finding in a penetration test report. For each evidence type, explain preferred file formats, minimum metadata to include (timestamps, tester ID, environment), and how to reference it in the finding so engineers can reproduce the issue.
Sample Answer
A technical finding is only as credible and reproducible as the evidence behind it, and different evidence types need different formats and metadata: screenshots and packet captures for visual and network proof, logs and request/response dumps for exact reproduction, and proof-of-concept (PoC) scripts or configuration snippets when the issue is easier to show than to describe in prose.
Evidence types, formats, and required metadata
| Evidence type | Preferred format | Minimum metadata | How it's referenced |
|---|---|---|---|
| Annotated screenshots | PNG, or a single PDF for a multi-step sequence | Timestamp (UTC), tester ID, target hostname, browser/OS, one-line action description | "See S-01.png (2026-02-15T14:22:31Z); annotations A-C map to steps 3-5" |
| Packet captures (PCAP) | .pcap or .pcapng | Capture start/end time, capture filter used, tester ID, capture interface | "See P-01.pcapng, filtered to the target IP; packet #345 shows the injected payload" |
| Server or application logs | Raw .log or .txt, compressed if large | Time range (UTC), log source, correlation ID if available, tester ID | "See server-app-2026-02-15.log, lines 1024-1040, matching the 14:22:31Z timestamp" |
| HTTP request/response dumps | Raw text export from the proxy tool used | Full headers, timestamp, tool used to capture it | "Full request/response saved as req-12.txt; the injected parameter is on line 4" |
| Proof-of-concept (PoC) scripts | Plain source file with a comment header | Purpose, target, tester ID, explicit note that it is non-destructive | "poc_idor_check.py demonstrates the object-reference swap described above" |
| Configuration snippets | Plain text, secrets redacted | Source file/host, timestamp collected, redaction note | "Excerpt from web.config confirming the missing security header, secrets redacted" |
Worked example
For an insecure-direct-object-reference finding, the evidence bundle is: the two HTTP request/response pairs (User A requesting User B's record, and the resulting 200 response), a screenshot of the browser rendering User B's data while logged in as User A, and one line of metadata: 2026-02-15T14:22:31Z, tester JD, staging environment. That's enough for an engineer to reproduce the exact request without a follow-up call.
Trade-offs and pitfalls
A serious pitfall is dumping a raw, unredacted config file or log that contains real secrets, like API keys or password hashes, directly into the report, which turns evidence collection into its own security incident; redact before attaching, always. A subtler one is relying on a screenshot alone for something that needs byte-level proof, like a header change, when a raw request/response dump would settle the question without any ambiguity.
Describe the core categories of penetration testing tools across the testing lifecycle: reconnaissance, vulnerability scanning, exploitation, post-exploitation, lateral movement, traffic analysis, and reporting. For each category provide 2-3 representative tools (open-source and commercial) and one common limitation to be aware of when using tools in that category.
Sample Answer
Direct answer
Across a pentest lifecycle, tooling sorts into seven natural categories, reconnaissance, vulnerability scanning, exploitation, post-exploitation, lateral movement, traffic analysis, and reporting, each with its own representative open-source and commercial tools and its own structural blind spot. The meta-skill an interviewer is actually probing is knowing which category a task belongs to and which tool's limitation you're willing to accept, not memorizing a tool list.
Structured elaboration
| Category | Representative tools | Common limitation |
|---|---|---|
| Reconnaissance | theHarvester, Shodan, Recon-ng | Passive data can be stale (cached DNS records, old scan snapshots) and doesn't reflect the target's current state |
| Vulnerability scanning | Nessus, OpenVAS (Greenbone), Qualys | High false-positive rate without manual verification, and largely blind to custom application logic |
| Exploitation | Metasploit Framework, Cobalt Strike | Well-known, canned modules are increasingly fingerprinted and blocked by modern EDR (Endpoint Detection and Response) tooling |
| Post-exploitation | Mimikatz, BloodHound | Generates significant forensic artifacts (new processes, credential material in memory) that a well-monitored environment may detect even if initial access wasn't |
| Lateral movement | Impacket, Evil-WinRM | Relies on legitimate administrative protocols, so a well-instrumented network can flag unusual host-to-host traffic even though the protocol itself is normal |
| Traffic analysis | Wireshark, tcpdump | Encrypted (TLS) traffic limits visibility unless you're also positioned to decrypt it, such as through an authorized intercepting proxy |
| Reporting | Dradis, PlexTrac | Organizes evidence and templates the structure, but doesn't write the risk narrative or judge severity for you |
Worked example
On a single internal engagement you might move theHarvester output into your target list, use Nessus to identify a credentialed, confirmed vulnerability on a host, exploit it with Metasploit to gain initial access, use Mimikatz and BloodHound to harvest credentials and map a path to a more privileged account, use Impacket to move onto that next host with the harvested credentials, watch the traffic with Wireshark to confirm nothing unexpected is happening on the wire, and log every command into Dradis throughout so the final report writes itself from already-organized evidence.
Trade-offs and pitfalls
- Defaulting to the flashiest tool in a category, an exploitation framework, before doing the cheaper reconnaissance and scanning work first wastes engagement time and is usually a sign of checklist-driven testing rather than judgment.
- Commercial tools often justify their cost through better false-positive tuning, support, or reporting integration, not through fundamentally different technical capability; know when a client's budget or existing tooling makes the open-source equivalent the better choice.
- A tool's limitation is not a reason to skip the category, it's a reason to plan a manual step around it, such as verifying a scanner finding by hand.
You must scan a /16 within 48 hours. Compare using masscan for a fast port sweep versus using nmap for more accurate results. Discuss the tradeoffs in speed, accuracy, handling of packet loss, resource consumption, and how you would pipeline masscan and nmap together to maximize coverage while keeping error rates low.
Sample Answer
I'd use masscan for a fast, full-port sweep to find where anything is listening across the entire /16, then hand only the discovered open ports to nmap for accurate service and version detection, because masscan is fast but shallow while nmap is accurate but far too slow to run at full depth against 65,536 hosts in 48 hours.
Comparison
| Dimension | masscan | nmap |
|---|---|---|
| Speed | Extremely fast; stateless, sends raw SYN packets without a full TCP/IP stack | Much slower; connection-oriented, performs a real TCP handshake and follow-up probes |
| Accuracy | Lower; no service or version detection by default, more false positives on lossy or filtered networks | High; robust service/version detection, OS fingerprinting, and Nmap Scripting Engine (NSE) checks |
| Packet loss handling | Needs manual rate tuning to avoid saturating the link; no automatic retransmission by default | Built-in retransmission and backoff, more resilient on a lossy path |
| Resource consumption | Low CPU per packet, but a naive high rate can flood the local interface or the target's capacity | Higher CPU, memory, and connection-table use on the scanning host, and sometimes visibly on the target |
Worked example (illustrative rate)
A /16 has 65,536 addresses. A full TCP port sweep, ports 1 through 65,535, of every host is 65,536 x 65,535 = 4,294,901,760 SYN packets. At an illustrative, conservative masscan rate of 100,000 packets per second, tuned down from masscan's theoretical maximum to avoid saturating the link, that sweep takes 4,294,901,760 divided by 100,000, which is 42,949 seconds, or roughly 11 hours 56 minutes. That leaves about 36 of the 48 hours for nmap to run detailed service, version, and NSE checks only against the hosts and ports masscan actually found open, which in practice is a much smaller list than the full address space, and comfortably fits the time box.
Pipelining the two tools
Run masscan first for full-port discovery, export the results, extract the list of host:port pairs that came back open, and feed only that (much shorter) list into nmap with its full detection flags. This keeps nmap's slower, richer probing focused on real targets instead of the entire /16.
Trade-offs and pitfalls
A common pitfall is running nmap's full port range and default timing against the entire /16 from the start; at realistic per-host handshake and probe overhead it cannot finish a full 65,535-port sweep of 65,536 hosts inside 48 hours. Another is pushing masscan's rate higher than the link can actually sustain, causing dropped packets that masscan has no built-in way to detect or retry, which silently under-reports open ports rather than failing loudly.
Unlock Full Question Bank
Get access to all Penetration Testing Methodology and Execution interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.