Penetration Testing Basics: What It Is and How to Scope It
A pen test finds a flaw before an attacker does. Learn the scope, the rules of engagement, the phases, and the report.
By Velloreth
What it is
An authorised, simulated attack.
It finds a flaw before a real attacker does.
It is performed under a written scope.
It is different from a scan, which is automated and broad.
The types
| Type | Information given |
|---|---|
| Black box | none |
| Grey box | some, such as an account |
| White box | the source and the architecture |
A grey box test is the common choice for a web application.
A white box test is the most thorough.
The scope
The systems, the addresses and the accounts that may be tested.
The ones that must not be touched.
It is agreed in writing, because an out-of-scope test is an unauthorised access.
A production system is often excluded, or tested in a window.
The rules of engagement
The window for the test.
The contacts and the escalation path.
The data handling, so a real datum is not exfiltrated.
The forbidden actions, such as a denial of service or a social engineering of a specific person.
The outage procedure, so the tester knows whom to call.
It is signed before the test starts.
The phases
1. Reconnaissance. The public information, the subdomains, the technology.
2. Scanning. The ports, the services, the known signatures.
3. Exploitation. An attempt to use a finding.
4. Post-exploitation. The lateral movement and the privilege escalation.
5. Reporting. The findings, the severity and the fix.
The finding
A finding needs:
- A title
- A severity
- A reproduction
- The impact
- The fix
A severity uses a scale such as CVSS.
| Severity | Meaning |
|---|---|
| Critical | a remote code execution |
| High | an authentication bypass |
| Medium | a stored XSS |
| Low | an information leak |
| Info | a hardening note |
A reproduction is the steps, so the developer can confirm it.
The report
An executive summary for the management.
The findings with the severity and the fix.
The methodology and the scope.
The retest result.
A report that is not read is a cost, so the summary matters.
The common findings
| Finding | Fix |
|---|---|
| A missing authorisation | a server-side check |
| An injection | a parameterised query |
| A stored XSS | an output encoding |
| A weak password policy | a length and a breach check |
| A verbose error | a generic message |
| An open port | a firewall |
| A default credential | a change |
| A missing header | a security header |
The retest
A second, limited test that confirms the fixes.
It is part of the engagement, and it should be agreed at the start.
A finding that is not retested may still be open.
The automation
A scan in the CI catches a regression.
A dependency scan catches a known flaw.
A secret scan catches a committed credential.
A pen test is periodic, and a scan is continuous.
The ethics
An authorised test only.
A written scope and a signed agreement.
A minimal impact, and a stop if the impact is larger than expected.
A responsible disclosure for a finding in a third-party system.
Common mistakes
No written scope. An unauthorised access.
No rules of engagement. An unexpected outage.
A production test with no window. A disruption.
A scan called a pen test. A false confidence.
A finding with no reproduction. A disputed finding.
A finding with no severity. A wrong priority.
No retest. An open finding.
A report that is not read. A wasted cost.
A test once a year. A drift.
No CI scan. A regression.
A quotable summary
A penetration test is an authorised, simulated attack that finds a flaw before a real attacker does, and it is performed under a written scope and rules of engagement that are agreed before the test starts. The phases are reconnaissance, scanning, exploitation, post-exploitation and reporting, and a finding needs a severity, a reproduction and a fix. A retest confirms the fix, and a scan in the CI catches a regression between the tests.
Related reading
For the related topics, see owasp-top-ten-guide and dependency-vulnerabilities. For the broader context, zero-trust-for-small-teams and security-headers-guide.