Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 53 ยท Foundations and Ethics

What Ethical Hacking Is

Learn what ethical hacking is, how white, grey and black hat differ, what red, blue and purple teams do, which careers exist, and how this course stays defensive.

Every system that holds something of value attracts people who want to take it, break it or misuse it. Ethical hacking is the practice of finding the weaknesses in a system before those people do, with the owner's permission, and then helping fix them. The skills are the same ones an attacker uses: you learn how software, networks and people fail. The difference is the purpose and, above all, the permission.

This course teaches security from the defender's side of the table. You will learn how attacks work well enough to recognize them, test for them in a lab you control, and close the gaps they use. Nothing here is a recipe for breaking into somebody else's computer, and no lesson asks you to touch a system you do not own. The real tools (scanners, proxies, exploit frameworks) cannot run inside this website, so their commands are shown read-only, and every lesson has small runnable stand-ins that model the idea in code. Each lesson says honestly which parts are real and which are the model.

Three questions decide everything

Permission Did the owner agree in writing?
Intent Is the goal to fix or to harm?
Scope Did you stay inside the agreed limits?

Remove any one of these and the activity stops being ethical hacking.

1 / 2

Attackers and defenders

Security is a contest with an unfair rule: the defender must close every door, while the attacker needs to find only one that is open. Defenders also have to keep the business running, which limits how tightly they can lock things down. Attackers choose the time, the target and the method, and they can try thousands of times for free.

That asymmetry explains why the field exists. Organizations cannot see their own weak spots well, because the people who built a system tend to test only how it should work. An ethical hacker deliberately asks how it can be made to fail. Finding a flaw during an authorized test costs a report and a patch. Finding it after a real breach costs money, customers and sometimes the company.

White, grey and black hat

The "hat" colors are shorthand for a person's relationship to permission:

Hat Permission Typical goal Legal status
White hat Written authorization from the owner Find and fix weaknesses Legal, a profession
Black hat None Profit, damage, espionage, fame Criminal
Grey hat None, but no harmful intent Curiosity, "helping" by reporting Still often illegal

The grey hat deserves a warning. Someone who probes a website they do not own and then emails the owner "I found a hole, you're welcome" has good intentions but broke the rule that matters: they had no permission. Many laws do not care about intent, only about unauthorized access. The next lesson, Law, Scope and Rules of Engagement, goes into exactly where that line sits and how bug bounty programs create a legal way to do this kind of work.

Good intentions are not authorization. Testing a system you have not been invited to test can be a crime in most countries, even if you cause no damage and report everything. When in doubt, ask for permission in writing first, and do nothing until you have it.

Other types of hackers

The three hats are a simplification. Security teams also talk about attackers by motive and skill, because that predicts what they do:

Type Who they are Typical behavior
Script kiddie Low skill, runs tools written by others Noisy, opportunistic attacks such as defacing sites or launching downloaded flood tools
Green hat A newcomer eager to learn Practices in labs and capture-the-flag contests; harmless when kept to permitted targets
Blue hat An outside tester invited to check software before release (or an angry outsider seeking revenge, in other usage) Bug-testing launches, or targeted grudge attacks
Red hat A vigilante who attacks black hats Counter-attacks, which are still illegal when unauthorized
Hacktivist Politically or socially motivated Defacements, data leaks and denial-of-service campaigns to make a point
State-sponsored Employed or funded by a government Espionage and sabotage with large budgets and patience; "advanced persistent threats"
Criminal groups Organized profit seekers Ransomware, fraud, stolen-data markets
Malicious insider An employee or contractor with legitimate access Theft or sabotage from the inside, hard to spot because access looks normal
Whistleblower An insider who exposes wrongdoing Leaks information, motivated by ethics; the legal risk is real

Not every threat is a person at a keyboard. Poorly secured devices such as webcams, routers and jailbroken or rooted phones give attackers footholds, so defenders must account for the devices as well as the humans.

Red, blue and purple teams

Larger organizations split security work into teams with different jobs:

  • Red team: acts as a realistic adversary. Goals are things like "reach the finance database" or "read the CEO's mailbox", and it may use technical attacks, phishing or physical entry. It tests the whole defense, including whether anyone notices.
  • Blue team: runs the defenses. It hardens systems, collects logs, watches alerts, responds to incidents and recovers. Most security jobs are on the blue side.
  • Purple team: not a separate department so much as a way of working. Red and blue sit together, the red team runs a technique, and the blue team checks whether it was logged and detected. Gaps are fixed on the spot.

A penetration test is narrower than a red team exercise. It aims to find as many weaknesses as possible in an agreed target within a fixed time, and the defenders usually know it is happening. The Penetration Testing Process compares the two in detail.

flowchart LR
    R["Red team<br/>runs an attack technique"] --> L["Logs and alerts"]
    L --> B["Blue team<br/>checks detection"]
    B --> F["Fix gaps and<br/>tune rules"]
    F --> R

A purple team loop: attack, observe, improve, repeat.

Careers and entry paths

Ethical hacking is a skill set used in many jobs, not just one:

  • Penetration tester / security consultant: authorized testing of clients' systems, ending in a written report.
  • Security analyst (SOC): watches alerts and investigates suspicious activity.
  • Application security engineer: reviews code and designs, and helps developers fix flaws.
  • Incident responder / forensic analyst: investigates breaches after the fact.
  • Security engineer / architect: builds secure systems and designs defenses.
  • Bug bounty researcher: finds flaws in programs that openly invite testing and pays for valid reports.

Almost everyone starts from solid fundamentals: networking, operating systems (especially Linux), some programming, and web technology. Offensive skill is built on top of understanding how things normally work. That is why the early chapters of this course are about the lab, Linux and networking before any attack concept appears.

How this course stays defensive

Each lesson follows the same pattern, so you can practice responsibly:

  1. Concept first: how the weakness arises and why it matters.
  2. A safe model: a small program in your browser that reproduces the logic using made-up data. You change it and see the result, but nothing leaves the page.
  3. The fix: what a developer or administrator does to prevent it, and how to detect it in logs.
  4. Lab only: when a lesson mentions a real tool, the command is read-only, and you are told to run it only against machines in your own home lab.

A first stand-in: the attack and defence tradeoff

The following model is a deliberate simplification, but it shows an important idea. Each defensive layer (patching, MFA, monitoring) stops some fraction of attacks. An attacker who needs to get past all layers faces the product of the chances, so a few moderately good layers beat a single strong one. This is called defense in depth.

This is a model only. Real controls are not independent and real probabilities are unknown, but the arithmetic explains why layered security works.

JS Defense in depth: chance an attack gets through

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Notice that four average controls beat the single 90% wall. In real life the single wall also has a worse property: when it fails, nothing else is left. Layers give the defenders extra chances to notice and respond.

Stand-in two: classify the activity

Whether something counts as ethical hacking depends on the three questions from the first slide, not on the technique. The same port scan can be a professional service or an offence. This tiny classifier makes the rule explicit.

JS Is this activity ethical hacking?

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The second case is the one that surprises beginners: even someone with a contract can step outside it, and that is a serious professional mistake. You will practice the scope check in the next lesson.

Limitations of ethical hacking

Ethical hacking is valuable, but it is not a guarantee. A test covers a fixed scope and a fixed time window, so it finds only the flaws a tester reaches in those days; new vulnerabilities appear afterwards. Testers work under rules of engagement that rule out destructive actions, social engineering of certain staff or production outages, so some real-world attack paths stay untested. Results depend on the tester's skill, tools produce false positives and false negatives, and a report is a snapshot that ages quickly. Testing also costs money and can disturb fragile systems. Treat it as one control among many: combine it with secure development, patching, monitoring and regular retests. See pentest methodology.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What most clearly separates an ethical hacker from a criminal attacker?

    The techniques overlap heavily. What makes the work ethical is authorization, a defensive purpose and staying within scope.
  2. 2. A student finds a flaw in a website they do not own and reports it politely. What hat is this usually called?

    Good intent does not replace authorization. Many laws only ask whether access was unauthorized.
  3. 3. What is the main idea of a purple team?

    A purple team turns an attack into a learning loop: run the technique, see whether it was logged and alerted, fix the gap.
  4. 4. Why do several average controls often beat one very strong control?

    That is defense in depth: the chances of passing each layer multiply, and later layers can still catch what an earlier one missed.

Summary

  • Ethical hacking is authorized, scoped testing whose goal is to find and fix weaknesses.
  • Permission, intent and scope decide whether work is ethical; technique does not.
  • White hat means authorized, black hat means criminal, grey hat means unauthorized but not malicious, which is still risky.
  • Red teams imitate attackers, blue teams defend, and purple teams combine both to improve detection.
  • Careers include penetration testing, SOC analysis, application security, incident response and bug bounty work.
  • This course shows real tools read-only and teaches with safe, runnable stand-ins.
  • Defense in depth works because an attacker has to defeat every layer.

Next: Law, Scope and Rules of Engagement.