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.
Describe how you would perform web content discovery (directory/file brute forcing) against a single web host in scope. Include tool choices, recommended wordlists, options for handling rate-limiting and auth-protected areas, techniques to detect wildcard or custom error pages, and safeguards to avoid triggering intrusion prevention systems.
Sample Answer
I run content discovery in stages: a small, curated wordlist at a deliberately low request rate first, to learn how the app behaves, then wider coverage once I understand its error-page patterns, so I find hidden paths without tripping rate limits or an intrusion prevention system (IPS), the automated control that blocks or throttles traffic it judges malicious.
Approach
- Tool choice: ffuf and gobuster for speed and simple concurrency control, wfuzz when I need multi-position fuzzing (fuzzing a parameter and a path segment at once), and Burp Intruder for anything that needs an authenticated session already loaded in the same tool I'm using to inspect responses.
- Wordlists: I start with a small, curated list matched to the app's apparent technology (a CMS-specific path list, for example) before ever reaching for a huge generic list like SecLists' full Discovery/Web-Content set, since a targeted list finds real hits faster and generates far less noise.
- Rate-limiting and auth-protected areas: low thread counts (single digits), a randomized delay between requests, and testing authenticated and unauthenticated areas as two separate passes using a valid session cookie for the authenticated one, since a path that 404s unauthenticated may exist and matter once logged in.
- Detecting wildcard or custom error pages: before trusting any "hit," I request a few random, guaranteed-nonexistent paths (like a random UUID-shaped path) and record their response. If the app returns HTTP 200 with an identical or near-identical body for every made-up path, that is a wildcard or catch-all response, and I need a better signal than status code alone.
- Safeguards against the IPS: keep concurrency low, avoid a tool's default aggressive settings, watch for a spike in HTTP 429 or 403 responses and back off immediately, and confirm the discovery window is inside what the client agreed to.
Worked example
Say the target returns HTTP 200 for every path I request, including invented ones like /asdkj123. That is the wildcard signature. I take that response's body length (say, 2,441 bytes) and a hash of its content as a baseline, and only flag a later result as a real hit when its body differs from that baseline by more than a rough threshold I set (for example, a length difference alongside a hash mismatch), so a flood of identical catch-all pages doesn't get reported as hundreds of "discoveries."
Trade-offs and pitfalls
A common pitfall is running a very large wordlist against every path without first checking for a wildcard response, then reporting hundreds of "hits" that are all the same catch-all page. The core trade-off is coverage versus time and noise: a bigger wordlist finds more real paths but takes longer and is noisier; a senior tester sizes the wordlist to the time box and the app's apparent stack instead of defaulting to the largest list available.
Describe a methodology to test for broken access control in a web application that uses role-based pages and APIs. Include techniques to discover horizontal and vertical privilege escalation, indirect object reference testing, endpoint-level enforcement validation, and an approach to automate repetitive authorization checks.
Sample Answer
I test access control by first mapping every role's view of the application, then deliberately trying each role's session against every other role's resources and privileged actions at the endpoint level, since access-control bugs live in the gap between what the interface shows and what the server actually enforces.
Discovery and mapping
Log in as every distinct role (regular user, manager, admin) and capture the full set of pages, API endpoints, and object identifiers each role can reach through Burp or OWASP ZAP, noting which UI elements are merely hidden versus genuinely blocked by the server.
Horizontal privilege escalation
Same privilege level, wrong object: as User A, replay a request that references User B's resource identifier (swap ?user_id=123 for 124) and check whether the server returns User B's data. This overlaps with insecure direct object reference (IDOR) testing: fuzzing identifiers in URLs, headers, and JSON bodies while watching for a 200-with-data response instead of a 403 or 404.
Vertical privilege escalation
Wrong privilege level entirely: replay a lower-privileged session's cookie or token against an admin-only endpoint or action (a "delete user" call, for example), and separately check for any role or permission field a client could tamper with, such as a claim inside a JSON Web Token (JWT) or a hidden form field claiming role=admin.
Endpoint-level enforcement
Bypass the UI entirely and call the underlying API directly for actions the interface hides for a given role. A common finding is that the UI correctly hides the delete button for a regular user, but the server never re-checks permission when the delete request itself arrives.
Automating repetitive checks
Script a matrix of every role against every endpoint using each role's saved session, replaying the same request set and diffing the resulting status codes against an expected access matrix built during mapping, so inconsistent enforcement across dozens of endpoints surfaces without manually retesting each one by hand.
Worked example
For an app with 40 API endpoints and 3 roles, I capture one authenticated request per endpoint per role (120 total), then script a replay of each captured request under every role's session and diff the resulting status codes against the expected access matrix. A single endpoint returning 200 for the "viewer" role's session where the matrix says it should return 403 is a concrete, reproducible finding, not a guess.
Trade-offs and pitfalls
A common pitfall is testing only through the UI and concluding access control is fine because the interface hides the option, missing that the API itself never checks. Another is confusing "the response looks different" with "access was actually denied," since some apps return HTTP 200 with an empty or error-shaped body instead of a proper 403, which a naive automated diff can miss entirely.
Explain XML External Entity (XXE) injection and how it can impact confidentiality and availability. Describe how you would detect XXE in an application that accepts XML or SOAP payloads, and provide a safe, non-destructive payload or technique to confirm the vulnerability in a controlled environment.
Sample Answer
Direct answer: XML External Entity (XXE) injection happens when an application parses XML input and its parser is configured to resolve external entities, letting an attacker define a custom entity that points at a local file, an internal resource, or an out-of-band callback, which the parser then fetches, turning ordinary XML parsing into a way to read files or reach internal systems.
Structured elaboration
Confidentiality impact: a malicious entity can reference a local file or an internal-network address, and if the parsed result is reflected back or used elsewhere in the response, the attacker reads data they were never authorized to see.
Availability impact: an entity that references itself repeatedly (an entity-expansion payload) can force the parser to expand exponentially, consuming memory and processing time until the service becomes unresponsive, a denial of service through parsing alone.
Detecting XXE in an application accepting XML or SOAP (an XML-based messaging format used by many enterprise application programming interfaces) payloads:
- Identify every input that accepts XML directly or indirectly, a file-upload feature accepting a format that is XML internally counts too.
- Submit a request containing an externally-defined entity that references a domain you control, and watch for an outbound callback to that domain. This confirms the parser resolves external entities even when nothing sensitive appears in the visible response, a blind XXE.
- If the response does reflect parsed content back to you, confirm safely by referencing a well-known, non-sensitive local path whose existence alone proves file-read is possible, rather than reaching for a configuration or credential file first.
Safe confirmation technique, described rather than given as a ready payload: define a custom entity in the document's type declaration that references either your own controlled endpoint, for a blind test, or a clearly non-sensitive local path, for a direct-reflection test, and use that entity once in the document body. Never point the confirmation at third-party infrastructure you don't control, and stop at confirming resolution rather than extracting real files or pivoting to internal services once XXE is proven. To picture the shape: the document's type declaration (the <!DOCTYPE ...> block at the top of an XML document, often shortened to DTD) can define a named placeholder called an entity, for example <!ENTITY probe SYSTEM "http://a-server-you-control.example/ping">, and the document body then uses &probe; where that placeholder should be filled in. A vulnerable parser fetches the URL the moment it expands &probe;, so a single ping arriving at your own server confirms external entities resolve; the same skeleton pointed at a harmless local path instead of your URL is the direct-reflection version.
Trade-offs and pitfalls. The category has moved between standards editions: OWASP's Top 10:2017 listed XXE as its own category (A4:2017), while OWASP Top 10:2021 folded it into A05:2021, Security Misconfiguration, since the root cause is a misconfigured parser rather than a distinct injection class; cite the edition so the mapping is unambiguous. The standard fix, disabling external entity resolution and document-type declarations at the parser level, is a configuration change, not a code rewrite, so point at the specific parser setting rather than a vague "sanitize XML input." Testing the denial-of-service variant against production risks actually taking it down; treat it as a discussion point in the report, or a throttled test against staging, rather than something to fire at random.
List and describe the essential sections of a penetration test report intended for mixed stakeholders (executives, security engineers, legal). For each section explain its purpose, minimum required content, primary audience, and one example of how much detail to include so the report remains useful but concise. Include suggestions for cross-references and traceability between sections.
Sample Answer
Direct answer
A pentest report for mixed stakeholders has to work as several documents in one: a short business-risk narrative for executives, a defensible scope-and-methodology record for auditors and legal, and a technically reproducible findings record for engineers. The core sections are an executive summary, scope and methodology, detailed findings with risk ratings, a remediation roadmap, and appendices, tied together with consistent finding IDs so a claim in one section can be traced to its evidence in another.
Structured elaboration
| Section | Purpose | Minimum content | Primary audience | Example level of detail |
|---|---|---|---|---|
| Executive summary | A risk-based narrative decision-makers can act on without technical background | Overall risk posture, count of findings by severity, top 2 to 3 business risks, whether critical exploitation was achieved | Executives, legal, board | One tight paragraph, for example: "testers obtained administrative access to the customer database by chaining a low-severity information leak with a medium-severity authentication weakness; we recommend prioritizing the authentication fix," with no finding IDs or step-by-step technique |
| Scope and methodology | Define exactly what was tested, when, and how, so results are reproducible and defensible in an audit | In-scope assets, testing window, methodology framework referenced (for example PTES, the Penetration Testing Execution Standard, or NIST Special Publication 800-115), test type (black, gray, or white box), explicit exclusions | Security engineers, auditors, legal and compliance | A bulleted asset list with IP ranges and domains, plus start and end dates and the named framework |
| Detailed findings | Give engineers everything needed to reproduce, understand, and fix each issue | Per finding: title, unique ID, CVSS (Common Vulnerability Scoring System) score and vector, affected asset, description, reproduction steps, evidence, business impact, remediation guidance, references | Security engineers, developers | Roughly half a page to a page per finding, including a redacted screenshot or log excerpt as evidence |
| Risk ratings summary | A fast, sortable overview that ties the narrative to the detail | A table of finding ID, title, CVSS score, severity band, and remediation status | Everyone; the bridge between summary and detail | One sortable table near the front of the report, cross-referenced by finding ID |
| Recommendations and remediation roadmap | Surface systemic patterns, not just per-finding fixes | Short, medium, and long-term buckets, for example "patch this issue now" versus "adopt a secrets-management platform this quarter" | Engineering and security leadership | A short prioritized list distinct from the line-by-line findings |
| Appendices | Preserve full raw evidence without cluttering the narrative sections | Full tool output, timestamps, tester names, tool versions, raw logs | Engineers doing deep verification, future auditors | Verbatim console output blocks, referenced by finding ID from the main body |
For cross-references and traceability: give every finding a stable ID (F-01, F-02, and so on) the moment it's discovered, and use that same ID everywhere the finding is mentioned, in the executive summary's severity counts, in the risk-ratings table, in the detailed-findings section, and in the appendix evidence. A reader should be able to start at "we found 3 critical issues" in the executive summary and trace each one, by ID, down to the exact evidence that proves it.
Worked example
For a web application engagement, finding F-07 might read "F-07: Stored Cross-Site Scripting in Product Review Field (High, CVSS 7.1)." The risk-ratings table lists F-07 as High. The executive summary's count of high-severity findings includes it. The detailed-findings section under F-07 gives reproduction steps and a screenshot showing an alert firing in a second, unrelated test browser session, proving persistence. The appendix stores the full raw request and response pair as item F-07-1, so an engineer can copy the exact request into their own tooling and confirm the fix during retest.
Trade-offs and pitfalls
- Cramming technical remediation steps into the executive summary loses the executive reader; cramming business-risk framing into the detailed findings wastes an engineer's time. Keep the register consistent per section.
- A report with no consistent finding-ID scheme forces every stakeholder to re-read the whole document to connect a risk-summary line to its evidence, which is one of the most common structural complaints clients raise about pentest reports.
- Don't let the appendix become a dumping ground; if raw evidence isn't cited by ID from somewhere in the main body, it isn't traceable, it's just noise.
What's the difference between automated vulnerability scanning and manual penetration testing? For each, describe its strengths, weaknesses, and typical deliverables, and explain how the two complement each other in a real security program.
Sample Answer
Direct answer
Automated vulnerability scanning runs signature and configuration checks against a target at scale and speed, producing a list of known, pattern-matched issues; it's cheap, repeatable, and good at breadth. Manual penetration testing puts a human in the loop who chains findings, applies business context, and looks for logic flaws no signature can describe; it's expensive and time-boxed but finds the things that actually cause a breach. A mature security program runs both: continuous or frequent automated scanning for baseline coverage, and periodic manual testing that validates the scanner's output and goes after what it structurally cannot see.
Structured elaboration
| Automated vulnerability scanning | Manual penetration testing | |
|---|---|---|
| Strengths | Fast, cheap, repeatable, covers a large asset inventory continuously, strong at known-CVE (Common Vulnerabilities and Exposures) and misconfiguration coverage | Context-aware, chains low- and medium-severity issues into a real attack path, finds business-logic and authorization flaws, proves exploitability rather than guessing at it |
| Weaknesses | High false-positive rate without manual triage, blind to custom application logic and multi-step authorization flaws, limited to what's already a known signature | Expensive, a snapshot of a single point in time, quality depends heavily on the individual tester's skill, doesn't scale to daily or weekly coverage of a large environment |
| Typical deliverable | A scored, often noisy list of findings mapped to CVEs or a compliance checklist | A narrative report showing proven exploit chains, business impact, and prioritized remediation guidance |
How they complement each other in a real program: scanning gives continuous, broad coverage across an entire fleet of assets at a cadence manual testing could never afford, weekly or even daily, which surfaces known issues quickly and cheaply. Manual pentesting is scheduled periodically (commonly quarterly external, annual internal, or triggered by a major release) and does two things scanning cannot: it triages the scanner's findings to separate real exploitable issues from noise, and it spends focused human time hunting for the class of flaw a scanner is structurally blind to, like an authorization check that's present on one endpoint but missing on a near-identical one.
Worked example
A scanner flags a server as running an outdated TLS (Transport Layer Security) library version with a critical CVE. A human tester manually verifies that the specific vulnerable code path is actually reachable from the internet-facing interface before treating it as a real critical risk, since some scanners flag a version string without confirming the vulnerable feature is even enabled. Separately, that same manual test finds a "view invoice" endpoint that accepts an arbitrary invoice ID from any authenticated user with no ownership check, a purely logic-driven authorization flaw no vulnerability scanner's signature database would catch, because there's no known "bad" pattern to match, just a missing business rule.
Trade-offs and pitfalls
- Treating scanner output as a report deliverable on its own, common in immature programs, drowns real risk in false positives and misses the logic flaws that actually cause incidents.
- Treating manual pentesting as a substitute for continuous scanning wastes expensive human time re-finding issues a much cheaper automated tool would have caught between engagements.
- The two are sequenced, not interchangeable: scanning first for breadth and triage, manual testing second for depth on what matters most.
Unlock Full Question Bank
Get access to all 36 Penetration Testing Methodology and Execution interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.