Please enable JavaScript to use CodeHS

Cybersecurity Basics

What Is a Data Breach?

A data breach is when private information a company was storing — like usernames, passwords, or credit card numbers — gets accessed or stolen by someone who was never supposed to see it. Learn how breaches happen, what attackers do with the data afterward, and try a simulator that shows exactly why reusing passwords is so risky.

Security ~9 min Beginner friendly
The Big Idea

What is a data breach?

Every time you sign up for a website — a game, an app, a school portal — you hand over some private information. It usually gets stored in a database, which is just a huge organized filing cabinet, sitting on a server owned by that company. Things like your username, your password, your email, and sometimes your address or credit card number all live there.

A data breach is what happens when that filing cabinet gets broken into. Someone who was never supposed to have access — an outside attacker, or even someone inside the company misusing their access — gets their hands on some or all of that stored information.

Simple definition: a data breach is when private information stored by a company is accessed or stolen by someone who wasn't supposed to see it.

Here's the important part to understand: when your information shows up in a breach, it is almost never because you did something wrong. It's the company holding the data that got broken into — not you. You didn't leave a door unlocked; they did.

That said, don't stop reading yet. What a breach doesn't decide is what happens after — and what you do once you find out you're affected still matters a lot. That's what the rest of this tutorial is about.


How It Happens

How breaches typically happen

Breaches don't always involve some genius hacker typing furiously in a dark room. Most of them come down to one of a few common, kind of ordinary causes:

A hacked server

The company's own servers have weak security or a known software vulnerability that never got patched, and an attacker breaks in through it directly.

A tricked employee

An attacker sends a convincing phishing email to someone who works there, who clicks a link or hands over a password without realizing it — no "hacking" required, just a good trick.

An exposed database

Sometimes a database gets set up without a password or left open to the entire internet by mistake — no break-in at all, just an unlocked front door nobody noticed.

An insider misusing access

Someone who legitimately works at the company and already has access to the data decides to copy or sell it — misusing permission they were actually given.

Notice that only one of those four involves classic "hacking." The other three are about a mistake, a trick, or a person with access making a bad choice. That's why cybersecurity for a company isn't just about firewalls and encryption — it's also about training people and locking down mistakes.


Why It Matters

Where the stolen data goes

Once attackers have a pile of usernames, passwords, and emails, that data doesn't just sit there. It becomes a product.

Sold on the dark web

Stolen data often gets bundled up and sold in bulk to other criminals on hidden marketplaces, sometimes for just a few cents per account.

Identity theft

Names, birthdates, and addresses can be pieced together to open fake accounts, apply for loans, or impersonate someone else entirely.

Credential stuffing

Attackers take the leaked username-and-password pairs and try that exact same combination on other popular websites — banking, email, social media.

Credential stuffing is the one worth slowing down on, because it explains why a breach on a site you barely use can still be a big deal. It only works because so many people reuse the same password on multiple sites. If your gaming account and your email account share a password, a breach of the gaming site hands the attacker a working key to your email too — even though your email was never breached at all.

Why this matters for password habits: a unique password on every site turns a breach into a small, contained problem — one leaked account, not all of them. That's exactly why a password manager (and a strong, unique password for every login) is worth the setup.


Interactive

Credential stuffing simulator

Below is a fictional leaked database from a made-up game called GlowUp Games. Pick one of the three leaked accounts, then watch an attacker's bot try that exact username and password against two other sites — one where the person reused the password, and one where they didn't.

LEAKED DATABASE — GlowUp Games (fictional breach)
The bot now tries jordan_p94 / Sunshine22! on two other popular sites
StreamFlix

This person reused the same password here.

CodeVault Bank

This person used a different, unique password here.


What To Do

What to do if you're in a breach

Companies that get breached usually send out a notification email once they figure out what happened. If you ever get one of those (or hear about a breach involving a site you use), here's the order of operations:

1

Change the password on the breached site — and anywhere else you reused it. The second part matters just as much as the first. Update every account that shared that password, not only the one that got breached.

2

Turn on two-factor authentication if you haven't already. Even if an attacker somehow gets the correct password, 2FA usually stops them from actually logging in without your phone or authenticator app.

3

Watch for phishing emails pretending to be about "your account." Scammers know breaches make headlines, and they send fake "your account was compromised, click here" emails hoping panicked people click without thinking.

4

Don't trust links in a breach notification email — go to the real site yourself. Type the company's website address in directly, or use a bookmark, instead of clicking a link in the email. That way you know you're actually changing your password on the real site, not a fake one built to steal it.

Remember: the breach itself usually wasn't your fault. But what you do in the hours and days after finding out about it is completely on you — and it's the part that actually determines whether the breach costs you anything.


Your Turn

Check your understanding

A gaming site you use gets breached, and you realize you used that exact same password on your email account too. What's the most important thing to do first, and why does the order matter?

Your answer:

Sample answer: change the password on both the gaming site and the email account, but especially prioritize the email account first if you can only do one right away — email is often used to reset passwords on everything else, so it's the most valuable target for an attacker doing credential stuffing. After that, turn on two-factor authentication on both accounts, and keep an eye out for phishing emails that might try to take advantage of the situation.


Check Yourself

Quick quiz

1. Which of these best describes a data breach?

2. Why do attackers try leaked username-and-password pairs on other, unrelated websites?

3. You get an email saying "your account was part of a data breach — click here to reset your password." What's the safest move?

Keep learning about digital safety

You've now seen how one breach can put many accounts at risk. Next, learn what happens when attackers target a server directly with overwhelming traffic instead of stolen credentials.

Part of the Cybersecurity Basics tutorial series.