SECURITY ENGINEERING · PART 0 · START HERE · ETHICS · 4 OF 229

White Hat vs Black Hat Hackers, Ethics and the Law

Who hackers really are: white hat, black hat and grey hat, then the attackers companies face (script kiddies, hacktivists, criminal and ransomware groups, nation-state teams and insiders) and the red, blue and purple teams that defend. Then the rules: written permission, scope, rules of engagement, responsible disclosure, and what computer misuse laws say.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 13

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • White, grey, black hats
  • five kinds of attacker
  • red, blue, purple teams
  • permission, scope, disclosure

Notes

Three hats

Hackers are sorted by hat colour, a habit borrowed from old western films. A white hat has permission. They test a system because its owner asked, and they report what they find. A black hat has no permission and attacks for money, revenge or damage. A grey hat sits between: no permission, no bad intent, perhaps they even report the flaw. It is still illegal, and companies do prosecute. Good intentions are not a legal defense.

The three hats
  • white hat: has permission, reports what they find
  • black hat: no permission, attacks for money or harm
  • grey hat: no permission, no bad intent, still illegal
  • the skill is the same; the permission is not

Who attacks

Companies face five broad kinds of attacker. Script kiddies copy tools they do not understand: low skill, lots of noise, and they still succeed against unpatched systems. Hacktivists act for a cause, defacing sites and leaking data. Criminal groups want money, through ransomware and fraud, and run like businesses. Nation-state teams spy for governments, with skill, money and patience. And insiders are already inside: an angry employee, or a careless one.

Threat actors
  • script kiddies: copy tools, low skill, lots of noise
  • hacktivists: a cause; deface and leak
  • criminal groups: money; ransomware, fraud
  • nation-state teams: spying; skilled and patient
  • insiders: already inside

Know your enemy

Knowing who might attack you decides how you defend. A small online shop mostly faces criminals and automated scans, so patching, strong logins and good backups stop most of it. A bank faces organised fraud and must add deep monitoring and controls on its own staff. A defense contractor faces nation-state teams and has to assume someone is already inside. This thinking has a name, threat modeling, and you will practise it in Part eight.

Motive shapes the defense
  • a small shop: criminals and automated scans answer: patch, MFA, backups
  • a bank: organised fraud answer: add monitoring, fraud and insider controls
  • a defense firm: nation states answer: assume breach

Red, blue, purple

Inside a company the hats become team colours. The red team attacks, with permission, the way a real enemy would. The blue team defends: it prevents, detects and responds. A purple team exercise puts both in one room, so every attack the red team runs becomes a detection the blue team improves. Penetration testers and bug bounty hunters are white hats too. All of them are paid to break things so the company can fix them first.

Team colours
  • red team: attacks, with permission, like a real enemy
  • blue team: defends, detects and responds
  • purple team: both together, every attack tunes an alert
  • pentesters and bug bounty hunters are white hats too

Permission

So what makes hacking legal? Written permission, from someone with the authority to give it. Before any test, professionals agree a scope: exactly which systems are included and which are off limits. They agree rules of engagement: the dates and hours, how aggressive the testing may be, and what is banned, such as deleting data or flooding a server. And they name a contact for emergencies. No document, no test. A verbal yes from a friend who works there is not permission.

Before any test
  • written permission from someone who owns the system
  • scope: which systems, which are off limits
  • rules of engagement: when, how hard, what is banned
  • a contact for emergencies
  • no document, no test

The law

The law is clear in almost every country. In India it is the Information Technology Act of 2000, mainly sections forty three and sixty six. In the United States it is the Computer Fraud and Abuse Act, and in the United Kingdom the Computer Misuse Act. The details differ, but the core idea is shared: accessing a computer without authorisation is an offence, even if you only look and change nothing. This is general information, not legal advice.

Computer misuse laws
  • India: IT Act 2000, sections 43 and 66
  • USA: Computer Fraud and Abuse Act
  • UK: Computer Misuse Act 1990
  • the core idea is shared: access without authorisation is an offence, even if you change nothing

Responsible disclosure

Sometimes you find a flaw by accident. The right way to handle it is responsible disclosure. Check whether the company publishes a security.txt file or a bug bounty page, which states what testing it allows. Stop as soon as you can prove the issue. Never keep, copy or share data you saw. Report it privately, give the company reasonable time to fix it, and only then talk about it. A bug bounty programme is permission in advance, but only inside its published scope.

Reporting a flaw
  • look for /.well-known/ security.txt or a bug bounty page: it states the rules
  • stop as soon as you can prove the issue
  • never keep or share the data
  • report privately, give time to fix, then publish

Your rules

Here are the rules for this track. Attack only three things: your own lab, ShopRung running on your own machine, and sites built for legal practice. Never test your college, your employer or a friend's website without written permission, however harmless it feels. Keep your lab network isolated, so a tool pointed at the wrong address cannot reach a real system. And when you are unsure whether something is in scope, the answer is simple: do not touch it.

Safe practice
  • attack only: your own lab, ShopRung on your machine, sites built for practice
  • never: your college, your employer, a friend's site, without written permission
  • keep the lab network isolated
  • when unsure, do not touch it

Ethics

Beyond the law are the habits of a professional. Do the least harm needed to prove a point: read one record, not the whole table. Protect any data you see as if it were your own. Report everything you did, including your mistakes, because a tester who hides an accident cannot be trusted. Do not show off access to friends. And write it up clearly, because a finding nobody understands never gets fixed.

A professional
  • does the least harm needed to prove a point
  • protects any data they see
  • reports everything, including their own mistakes
  • does not show off access
  • writes it down so it gets fixed

Common mistakes

Mistakes that get beginners into real trouble. Believing that only testing is a defense. Scanning real websites for practice. Treating a verbal yes as permission. Wandering outside the agreed scope because a neighbouring system looked interesting. Keeping stolen data as proof. Posting a flaw publicly before the owner can fix it. And trying security tools on your employer's network, which can end a job on the same day.

Avoid these
  • "I was only testing"
  • scanning sites for practice
  • a verbal yes as permission
  • going outside the scope
  • keeping data as proof
  • posting the flaw publicly
  • trying tools on work systems

Say it like this

In the interview: what makes a hacker ethical is permission and scope. An ethical hacker has written authorisation from the system owner, stays inside the agreed scope and rules of engagement, does the least harm needed to prove an issue, protects any data they see, and reports everything so it can be fixed. The techniques are the same as a criminal's. The authorisation and the purpose are not.

In the interview
  • "Permission and scope. An ethical hacker has written
  • authorisation, stays inside the agreed scope and rules of engagement, does the least
  • harm needed, protects any data
  • seen, and reports everything
  • so it can be fixed."

Interview questions

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

A white hat tests systems with the owner's permission and reports findings. A black hat attacks without permission for gain or harm. A grey hat acts without permission but without malicious intent, which is still illegal.

Q2What makes hacking ethical?

Written authorisation from the system owner, a defined scope and rules of engagement, doing the least harm needed to prove an issue, protecting any data seen, and reporting all findings so they can be fixed.

Q3What are rules of engagement?

The agreed terms of a security test: which systems are in and out of scope, the dates and hours, which techniques are allowed or banned (for example denial of service), how to handle data, and who to contact in an emergency.

Q4What is responsible disclosure?

Privately reporting a vulnerability to the owner, giving them reasonable time to fix it before any public discussion, and never exploiting it further or keeping the data. Many companies publish the process in a security.txt file or bug bounty policy.

Q5What are the main types of threat actor?

Script kiddies using ready-made tools, hacktivists with a cause, organised criminal and ransomware groups after money, nation-state teams doing espionage, and insiders who misuse or mishandle legitimate access.

Q6What do red team, blue team and purple team mean?

The red team attacks with permission to test defenses, the blue team prevents, detects and responds, and purple teaming is the two working together so each simulated attack improves a detection or control.

Q7Is it legal to scan or test a website without permission if you cause no damage?

In most countries no. Computer misuse laws make unauthorised access an offence regardless of damage or intent, and even scanning can breach terms of service. Practise only on your own lab or systems that explicitly allow it.

Q8What is a bug bounty programme?

A standing invitation from a company to test specific systems under published rules, with rewards for valid findings. It is permission in advance, but only within the stated scope and conditions.