Please enable JavaScript to use CodeHS

Cybersecurity // Beginner

What Is a Penetration Test? Hacking Your Own Systems to Make Them Safer

Some of the best hackers in the world get paid to break in. Their job is to try to get past the locks first, so the owners can fix the weak spots before a real attacker finds them. Learn how a pen test works, then explore a school network and write your own security report.

Cybersecurity ~12 min Beginner friendly
01 / The Big Idea

Break in on purpose, with permission

Imagine you own a castle. You think the walls are strong. But how can you be sure? You could hire a locksmith to try to get in. If she finds a back door you forgot about, she tells you, you lock it, and your castle is safer.

A penetration test (also called a pen test) is the computer version of that. A security expert is hired to try to break into a school, a company, or an app. They use the same ideas a real attacker would. But they have permission, they follow rules, and at the end they write a report that helps the owner fix every problem they found.

vulnerabilityA weak spot that an attacker could use, like a door with a broken lock.
attack surfaceAll the doors and windows an attacker could try. A bigger surface means more places to defend.
exploitUsing a vulnerability to actually get in. Picking the lock, not just noticing it is broken.
pen testerA person who is paid to find weak spots by trying to break in, with permission.

A pen test is not the same as a scan

Vulnerability scan

A program checks for known weak spots and prints a list. It is fast and cheap. Think of a guard walking around trying every door handle.

Penetration test

A human uses that list, then tries to get through and link small problems together. Think of a locksmith who also shows what she could reach once she was inside.


02 / The Six Stages

How a pen test goes, step by step

Real pen tests follow a plan. Each stage has a job. Pick a stage to see what the tester does and what it looks like in the castle story. Use the arrow keys or the buttons to move.

Pen test timeline

Stage 1 of 6

03 / Map the Castle

Explore an attack surface

Here is a made-up school called Maple Ridge School. It is fictional, so nothing here is a real system. You are the pen tester, and the school has given you permission. Inspect each numbered spot on the map. Some are weak. Some are well protected. A good tester has to tell the difference.

Maple Ridge School // network map

Inspected 0/8 · Weak spots found 0/6

Click a numbered circle on the map, or pick it from the list below the map. Amber means weak. Green means safe.

school network firewall internet

    Why the weak spots are boring: most real break-ins do not use movie-style magic. They use small, ordinary mistakes: a password that was never changed, software that was never updated, or a person who clicked a link. Fixing the basics stops a lot of attacks.


    04 / Hats and Rules

    White hat, grey hat, black hat

    People in hacking are often described by hat colors. The color is about permission and intent, not about how skilled someone is.

    • White hat: has permission, follows the rules, and wants to help the owner. Pen testers are white hats.
    • Black hat: breaks in without permission to steal, cause harm, or make money. This is a crime.
    • Grey hat: breaks in without permission, but says they just wanted to help or to show off. Good intentions do not cancel the missing permission, so it can still be illegal.

    What keeps a pen tester a white hat is a short agreement written before any testing starts. It is called the rules of engagement.

    ScopeWhich systems are okay to test, and which are off limits. If it is not on the list, do not touch it.
    PermissionA signed note from someone who has the authority to say yes. A friend saying "sure, go ahead" is not enough.
    TimingWhen testing is allowed, so the school is not surprised and nothing breaks during a big exam.
    Stop rulesWhat to do if something goes wrong or private data shows up: stop and tell the owner right away.

    Try it yourself. For each case, pick the hat that fits.

    Which hat is this?

    Score 0/5
    Case 1 of 5


    05 / The Report

    Rank the findings and pick the fixes

    The report is the most valuable part of a pen test. A long list of problems is hard to act on. The owner needs to know what to fix first. Testers rank each finding by two questions:

    • Likelihood: how easy is it for an attacker to use this? (1 = hard, 3 = very easy)
    • Impact: how bad is the damage if they do? (1 = small, 3 = big)

    Multiply them. The score from 1 to 9 gives the severity: 1 to 2 is Low, 3 to 4 is Medium, 6 is High, and 9 is Critical.

    Likelihood \ Impact
    Impact 1
    Impact 2
    Impact 3
    Likelihood 3
    3 Medium
    6 High
    9 Critical
    Likelihood 2
    2 Low
    4 Medium
    6 High
    Likelihood 1
    1 Low
    2 Low
    3 Medium

    Now it is your turn. These are the six weak spots from the map. For each one, choose a likelihood, an impact, and the best fix. Your ranked report builds as you go. When you are ready, press Check my report.

    Report builder

    Rated 0/6

    Findings report: Maple Ridge School

    Sorted from most to least severe. Fix from the top.

      Rate a finding above and it will appear here.

      The last stage is not "write the report and walk away." Once the school fixes a problem, the tester retests it. That proves the door is really locked now, and that the fix did not open a new hole somewhere else.


      06 / Responsible Use

      Only test what you own or have written permission to test

      The ideas in this tutorial are for understanding and defense. Trying to get into a computer, account, school system, or website that is not yours can be a crime. That is true even if you do not damage anything, and even if you plan to tell the owner afterward.

      If you find a weak spot by accident, do not poke around. Stop and tell a trusted adult, a teacher, or the owner. If you want to practice, use your own devices, or practice sites and challenges that are made for learning and clearly say you may test them.


      07 / Quick Answers

      Quick answers

      What is a penetration test in simple words?

      A penetration test, or pen test, is a planned and legal attempt to break into a computer system. An organization hires a security expert to try the same tricks a real attacker might use, then to write down what they found so the weak spots can be fixed.

      Is penetration testing legal?

      It is legal when the owner of the system gives clear, written permission and the tester stays inside the agreed rules. Testing a system without permission can be a crime, even if the person means well.

      What is the difference between a pen test and a vulnerability scan?

      A vulnerability scan is an automatic check that lists known weak spots. A pen test goes further. A human tries to actually use the weak spots, link them together, and show what damage a real attacker could do.

      What are the stages of a penetration test?

      A common order is scope and permission, reconnaissance, scanning, exploitation, reporting, and then fixing and retesting. Different teams name the stages slightly differently, but the flow is the same: agree on the rules, learn about the target, look for weak spots, try them safely, report, and check the fixes.

      What is the difference between white hat, grey hat, and black hat hackers?

      A white hat hacker has permission and works to help. A black hat hacker breaks in without permission to cause harm or to steal. A grey hat hacker has no permission but says they mean well. Acting without permission is still not allowed, so grey hat behavior can still break the law.

      How do I start learning penetration testing?

      Start with the basics of how computers, networks, and websites work, and learn to program. Then practice only in places built for it, such as your own lab or legal practice challenges. Never test a system you do not own or do not have written permission to test.


      08 / Check Yourself

      Quick quiz

      1. What makes a penetration test different from a real attack?

      2. A tester finds an easy-to-use weak spot that could expose every student record. In the report, where should it go?

      3. Someone breaks into a website they do not own, finds a bug, then emails the owner to help. Which hat is this?

      Keep learning about security

      Now you know how defenders test their own locks. Explore how ethical hacking works more broadly, how people get paid to report bugs, and what jobs in cybersecurity look like.

      Maple Ridge School is a made-up example created for this tutorial.