# What is penetration testing?

Canonical: https://hackergpt.org/learn/penetration-testing/

**Penetration testing, or pentesting, is an authorised, simulated attack on a system to find out which weaknesses an attacker could actually use and how far they could get. Unlike a scan, a pentest tries to exploit and chain findings, within a written scope, and reports each one with evidence and a fix.**

## Why it matters

NIST describes penetration testing as security testing in which evaluators mimic real-world attacks to identify ways to circumvent the security features of an application, system or network. The value is in that mimicry: a scanner lists possible issues, while a tester checks which of them are real, which combine into something worse, and which business-logic flaws no signature would catch.

NIST SP 800-115 lays out the phases most methodologies share: planning, where scope and rules of engagement are agreed in writing; discovery, which is reconnaissance and attack surface mapping; attack, where findings are verified; and reporting. The OWASP Web Security Testing Guide breaks the web part into concrete tests per area, from information gathering to authorization and input validation.

## Example: a first pentest plan for your own site

Before any request, write the scope down, even when the site is yours: which hosts, which accounts, what is off limits, when testing happens. Then work through the phases on https://your-app.example, or on CyberGym if you want a target built for practice:

```
Scope:     your-app.example, api.your-app.example (production read-only, staging full)
Accounts:  test-user-a, test-user-b, test-admin (created for testing)
Excluded:  payment provider, email sending, denial of service

1. Discover   map pages, logins, API endpoints and the auth each requires
2. Test       per endpoint: access control across users, input handling, errors
3. Verify     reproduce each finding, note the exact request and response
4. Report     finding, evidence, impact, fix; then retest after the fix
```

A pentest's result is a list of findings, each with evidence; it is not a certificate. A clean report means these tests, in this scope, at this time, found nothing, which is useful to know and is not the same as being secure. Run it again after significant changes.

## Common mistakes

- **Calling a scan a pentest.** An automated scan is a useful input. A pentest verifies, chains and explains what the scan only suggests.
- **Testing without written permission.** Even on a site you manage, hosting providers and third-party services may need notice. Never test a site you do not own or have permission for.
- **Testing production writes blindly.** Use test accounts and staging for anything that creates, changes or deletes data.
- **Never retesting.** A fix is not done until the original request fails. Retest each finding.

## Related terms

- [Attack surface mapping](https://hackergpt.org/learn/attack-surface-mapping/)
- [OSINT](https://hackergpt.org/learn/osint/)
- [OWASP Top 10](https://hackergpt.org/learn/owasp-top-10/)
- [Deliberately vulnerable app](https://hackergpt.org/learn/deliberately-vulnerable-app/)

## Go deeper

- [How to pentest your own website with an AI agent](https://hackergpt.org/blog/how-to-pentest-your-own-website/)
- [Map a web app's attack surface before you test it](https://hackergpt.org/blog/map-web-app-attack-surface/)
- [HackerGPT features: an AI agent that pentests your own website](https://hackergpt.org/features/)

## Sources

- [NIST CSRC glossary: penetration testing](https://csrc.nist.gov/glossary/term/penetration_testing)
- [NIST SP 800-115: Technical Guide to Information Security Testing and Assessment](https://csrc.nist.gov/pubs/sp/800/115/final)
- [OWASP Web Security Testing Guide](https://owasp.org/www-project-web-security-testing-guide/)

Test only sites you own or have written permission to test. To practise without one, use CyberGym, a legal, deliberately vulnerable target. [Practise on CyberGym](https://cybergym.hackergpt.app).
