Skip to content
Velloreth
Cybersecurity 4 min read

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

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

TypeInformation given
Black boxnone
Grey boxsome, such as an account
White boxthe 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.

SeverityMeaning
Criticala remote code execution
Highan authentication bypass
Mediuma stored XSS
Lowan information leak
Infoa 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

FindingFix
A missing authorisationa server-side check
An injectiona parameterised query
A stored XSSan output encoding
A weak password policya length and a breach check
A verbose errora generic message
An open porta firewall
A default credentiala change
A missing headera 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.

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.

Frequently asked questions

What is a penetration test?
An authorised, simulated attack on a system to find a security flaw before a real attacker does. It is performed under a written scope and rules of engagement, and it produces a report with the findings, the severity and the fix. It is different from a vulnerability scan, which is automated and broad.
What is the difference between a pen test and a vulnerability scan?
A scan runs an automated tool and reports the known signatures, so it is broad and shallow. A pen test is a human who chains the findings and attempts an exploit, so it is narrow and deep. A scan is a starting point and a pen test is the confirmation.
What is the scope?
The list of the systems, the addresses and the accounts that may be tested, and the ones that must not be touched. It is agreed in writing before the test, because an out-of-scope test is an unauthorised access. A production system is often excluded, or tested in a window.
What are the rules of engagement?
The agreement on how the test is performed: the window, the contacts, the escalation path, the data handling, and the actions that are forbidden. It includes what to do if the test causes an outage. It is signed before the test starts.
What is the difference between black box, grey box and white box?
A black box test gives the tester no information, which simulates an external attacker. A white box test gives the source and the architecture, which is more thorough. A grey box gives some information, such as a user account, which is the common choice for a web application.
What is a retest?
A second, limited test that confirms the fixes for the findings. It is part of the engagement and it should be agreed at the start. A finding that is not retested is a finding that may still be open.