Penetration Testing: What It Is, How It Works, and How Much It Costs

Penetration Testing: types of pentests, operational phases, and what the report contains. Here's when it's needed and the differences between vulnerability assessments and red teams.
- Posted on 2026-11-01
- Reading time: 8 min
Penetration Testing: A Guide to Types, Phases, and Methodology #
A penetration test (or penetration testing , abbreviated pentest ) is a controlled and authorized simulation of a cyber attack, conducted to find vulnerabilities in a system before someone with real intentions does. Unlike an automated scan, a pentest is conducted by a human who thinks like an attacker: they chain together multiple weaknesses, explore paths that an automated tool wouldn't consider, and demonstrate the concrete impact of what they find.
It is one of the core activities of ethical hacking , and is often required, directly or indirectly, by regulations and contracts: the NIS 2 directive , for example, requires evaluating the effectiveness of the security measures adopted without specifying a specific tool, and pentesting is one of the most concrete ways to do so.
Penetration testing in brief #
| questions | Response |
|---|---|
| What | Authorized simulation of a cyber attack |
| Target | Identify and demonstrate exploitable vulnerabilities |
| Who performs it | Penetration tester, internal team or specialized company |
| What is testing? | Network, web, API, cloud, Active Directory, mobile |
| Method | Manual analysis, supported by automatic tools |
| output | Report with executive summary, finding, CVSS and remediation |
| Difference from VA | Pentesting verifies exploitation and impact |
| Difference from the red team | The red team is broader and more goal-oriented |
Penetration testing: what it is: the difference between it and a vulnerability assessment #
These two terms are often confused, but they describe different activities:
| Vulnerability Assessment | Penetration test | |
|---|---|---|
| Target | Find and classify as many vulnerabilities as possible | Demonstrate whether and how a vulnerability is actually exploitable |
| Method | Mostly automated (scanner) | Manual analysis, concatenation of multiple techniques |
| output | List of vulnerabilities with severity level | Full attack path, with demonstrated impact |
| False positives | Most frequent | Reduced, because each finding is manually verified |
A penetration test may include vulnerability assessment activities, but its goal goes beyond identifying vulnerabilities: the scanner can tell you that a port is open, the pentester demonstrates what an attacker could actually do with that access.
Types of penetration tests by level of knowledge #
| Type | System knowledge | When using |
|---|---|---|
| Black box | None, like a real winger | Simulate an attack from the outside without privileged information |
| white box | Complete: source code, architecture, credentials | Maximum depth, useful for critical or newly developed systems |
| Grey box | Partial, for example a standard user account | A common compromise: realistic but time-efficient |
The grey box is often a good compromise: it reflects a plausible scenario (a malicious employee, a compromised account) without the time cost of a true black box, which often consumes most of the effort just in the reconnaissance phase.
Types of penetration tests by scope #
| Scope | What is tested? |
|---|---|
| Network / infrastructure | Servers, firewalls, exposed services, network segmentation |
| Web applications | Application logic, authentication, user input, according to methodologies such as OWASP Testing Guide |
| Active Directory / internal network | Internal privilege escalation paths, often mapped with tools like BloodHound |
| Cloud | IAM configurations, exposed storage, managed services |
| Mobile | iOS/Android app, communication with backends |
| wireless | Enterprise Wi-Fi networks, authentication, segmentation |
| Physical | Building access controls, badges, tailgating |
| Social engineering | Resistance of people and processes, not just technology: we talk about it in the guide to social engineering |
| API | Authentication, authorization, excessive data exposure |
A real-world engagement often covers multiple areas at once: an “infrastructure” penetration test that uncovers weak credentials can easily extend to an application or Active Directory test, if the agreed-upon objective allows it.
The phases of a penetration test #
Most professional pentests follow a similar structure to that defined by frameworks such as the Penetration Testing Execution Standard ( PTES ); parallel frameworks such as the NIST SP 800-115 technical guide or the OWASP Web Security Testing Guide for the web follow a similar underlying logic, only with phases organized under different names.
- Pre-engagement: definition of objectives, perimeter (scope), rules of engagement, and, most importantly, written authorization. Without this step, everything else is illegal.
- Reconnaissance (information gathering): gathering information about the target, often using techniques OSINT and tools like Nmap to map exposed services and ports.
- Threat modeling and vulnerability analysis: Identify potential weaknesses and prioritize them based on their likely impact.
- Exploitation: attempt to exploit the vulnerabilities found — what MITRE ATT&CK classifies as the Initial access — to concretely demonstrate its impact.
- Post-exploitation: once access is gained, it is assessed how far an attacker could reach: the same tactics that ATT&CK catalogues as Privilege Escalation, lateral movement, P ed exfiltration — other systems reachable, sensitive data exposed, possibility of persistence.
- Reporting: the most important result of the entire test. A useful report not only lists the vulnerabilities, but assigns each a severity score according to a recognized standard such as CVSS (Common Vulnerability Scoring System), explains the concrete impact, the path followed and the remediation actions, with clear priorities based on that score.
Reporting is often the weak point of low-quality pentests: a list of vulnerabilities without context, CVSS, or priority is of little use to those who need to decide what to fix first.
What you need before you start: authorization and rules of engagement #
No legitimate penetration test begins without a written document explicitly authorizing the activity, signed by someone who actually has the authority to do so (informal permission from a single employee won't suffice). This document, often called a rules of engagement or a get-out-of-jail card , defines:
- which systems are within the perimeter and which are explicitly excluded;
- the engagement time window;
- emergency contacts, in case something goes wrong (for example a production service goes down);
- what is allowed and what is not (for example, whether social engineering of employees is included or excluded).
In Italy, testing a system without this authorization, even just to "check if it is secure," may be considered unauthorized access to a computer system (Article 615-ter of the Criminal Code), regardless of the intent of the perpetrator.
What does a penetration test report contain? #
The report is what the client actually receives. A good report has two levels of interpretation: one for the decision maker (risk and priority) and one for the corrector (technical details).
| Section | Content |
|---|---|
| executive summary | Overall risk and conclusions, in non-technical language |
| Scope and methodology | Tested systems, period, approach (black/grey/white box), framework followed |
| Findings | Each vulnerability found, with description and system involved |
| Severity | Severity of each finding, usually with CVSS score |
| proof of concept | Evidence and reproduction steps |
| Remediation | How to fix, with priority |
| Retest | Follow-up verification that the fixes worked (often a separate service) |
How much does a penetration test cost? #
There's no single price, and be wary of anyone who offers one without knowing the scope. The cost depends primarily on the time required (often quantified in man-days) and therefore on:
- scope: number of IPs, applications, endpoints, users and roles to test;
- type of test: a black box typically requires more reconnaissance than a grey or white box;
- scope: web, internal network, Active Directory, cloud and mobile have different complexities;
- depth: only vulnerability research or also exploitation and post-exploitation;
- reporting: level of detail, executive summary, presentation of results;
- retest: included or separate.
How long does a penetration test last? #
It follows the same logic. In terms of magnitude, a small web application requires less time than an internal network with Active Directory, and a cloud test or a multi-scope engagement requires even more time. Preparation (scoping and authorizations) and reporting, which account for a significant portion of the engagement, must be added to the test duration.
When to do a penetration test #
- before the release of a new application or service exposed on the Internet;
- after major changes to infrastructure or architecture;
- after a cloud migration or acquisition;
- after a security incident, to verify that the doors used have actually been closed;
- before an audit or certification;
- periodically, according to the level of risk;
- when required by law or contracts.
Is penetration testing mandatory? #
There is no general requirement for all organizations, but some contexts require it. The PCI DSS (card payments) standard requires periodic pentesting, at least once every 12 months and after significant changes. The European DORA regulation, for financial entities falling within its scope, requires advanced threat-based testing ( TLPT , Threat-Led Penetration Testing) at least every three years, unless otherwise specified by the competent authority. For NIS 2, the same applies: the effectiveness of measures must be demonstrated, and pentesting is one of the tools.
Who performs a penetration test? #
- Internal Penetration Testers: the organization's security team, with the advantage of knowing the systems well.
- Specialized companies or external consultants: provide an independent assessment, often requested by customers, auditors and regulations.
- red team: for larger, goal-oriented engagements.
The difference with an automatic scanner is the person: the scanner performs known checks, the tester thinks about the context, chains together the weaknesses and evaluates the real impact.
Penetration testing, vulnerability assessment, red team: the differences #
| Target | Typical duration | Approach | |
|---|---|---|---|
| Vulnerability assessment | Find as many vulnerabilities as possible | Days | Mostly automated |
| Penetration test | Demonstrate the real-world impact of an attack path, on an agreed-upon perimeter | Days-weeks | Manual, focused |
| red team | Simulate a complete realistic attack; based on the rules of engagement, the defense team (blue team) may not be informed | Weeks-months | Goal-centric, covers multiple vectors together (technical, physical, human) |
Penetration testing answers the question, "What vulnerabilities exist and are they exploitable?" Red teaming answers a different question: "Would my security team detect a real attack, and how would they respond?"
How to recognize a good penetration test #
- Clear scope: A vague perimeter leads to incomplete testing or, worse, touching systems outside of authorization.
- Recognized methodologyFrameworks like PTES or the OWASP Guide for Web Applications provide systematic coverage, not just random scanning.
- Manual verificationA scanner produces false positives; a pentester verifies whether a reported vulnerability is actually exploitable in that specific context.
- Proof of concept, not just theory: concretely demonstrating the impact (for example, access obtained, not just “hypothesized”) makes the report much more convincing to those who have to allocate budgets for the remediation.
- Actionable Report: clear priorities, reproduction steps, specific recommendations for each finding, not a generic list of best practices.
How to get started in penetration testing #
Those who want to approach penetration testing professionally typically start with a solid foundation in networks and operating systems (Linux and Windows), progressing to practice on legal platforms like HackTheBox, TryHackMe, or VulnLab, using dedicated distributions like Kali Linux , and then moving on to industry-recognized certifications. A typical progression begins with entry-level certifications like eJPT, progressing to OSCP (the most well-known benchmark for generalist penetration testing, as it requires demonstrating practical skills on real machines, not just theoretical ones), and, for those specializing in Active Directory environments, moving on to more vertical certifications like CRTP or CRTO. The most underestimated aspect for beginners is almost always methodology and reporting : knowing how to exploit a vulnerability means less if you can't document it clearly and usefully for those who need to fix it.
Frequently Asked Questions about Penetration Testing #
What is a penetration test? #
A controlled and authorized simulation of a cyber attack, conducted to find and demonstrate the real-world impact of a system's vulnerabilities before an attacker does.
What is the difference between penetration testing and vulnerability assessment? #
Vulnerability assessment identifies and classifies vulnerabilities, often automatically. Penetration testing manually verifies whether those vulnerabilities are actually exploitable and demonstrates their actual impact.
What is a black box penetration test? #
A test conducted without any privileged information about the system, simulating a real external attack.
What is the difference between white box and grey box? #
The white box provides the tester with full access to the code and configurations for maximum depth. The gray box provides partial information, like a standard user account, balancing realism and time requirements.
Is a penetration test legal? #
Yes, if conducted with explicit written authorization from those with authority over the system. Without this authorization, the same activity could constitute a crime.
What is the difference between penetration testing and red teams? #
Penetration testing verifies vulnerabilities within an agreed-upon perimeter. The red team simulates a complete, realistic, target-oriented attack to also test detection and response capabilities. Depending on the rules of engagement, the defense team may not be notified.
How often should a penetration test be done? #
It depends on the risk, but a common practice is to do this at least annually and after significant changes to infrastructure or applications, as well as when required by regulations or contracts (e.g., PCI DSS or DORA).
How much does a penetration test cost? #
It depends on the scope, the type of test (black, grey, or white box), the scope (web, network, Active Directory, cloud), the depth, and the reporting. The cost primarily reflects the required workload: no serious price can be given without defining the scope.
How long does a penetration test take? #
From a few days to several weeks, depending on the scope and complexity, plus the time required to prepare and write the report.
Is penetration testing mandatory? #
Not generally, but it can be contextual: PCI DSS requires it at least every 12 months, DORA requires TLPT testing at least every 3 years for covered financial entities, and NIS 2 requires evaluating the effectiveness of security measures.
What does a penetration test report contain? #
Executive summary, scope and methodology, list of findings with severity (often CVSS), proof of concept, remediation recommendations and, if applicable, retest.
How do you become a penetration tester? #
With a solid foundation in networks and operating systems, practice on legal platforms like HackTheBox or TryHackMe, and industry-recognized certifications like the OSCP, which test real-world skills.








