> For the complete documentation index, see [llms.txt](https://alham-rizvi.gitbook.io/alhamrizvi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alham-rizvi.gitbook.io/alhamrizvi/ethical-hacking/1.-what-is-hacking.md).

# 1. What is Hacking?

### Simple Explanation

"Hacking" just means finding clever/unintended ways to make a system do something. It is not automatically bad — it depends on **permission and intent**. Ethical hacking is when a skilled person is **hired/authorized** to break into a system on purpose, so that the weaknesses can be fixed before a real criminal finds them. Think of it like a bank hiring someone to try to rob its own vault, so they can fix the locks.

***

### 1. What is Hacking?

Hacking = the process of finding and exploiting weaknesses (vulnerabilities) in computer systems, networks, or applications to gain unauthorized access, control, or information.

Originally "hacker" meant a clever programmer who found smart solutions. Over time, media made it mean "criminal who breaks into computers." Today the security industry separates hackers by **intent**, not skill.

### 2. Types of Hackers (very important for exams)

| Type                   | Also called        | Intent                                                                                                                 | Legal?                     |
| ---------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| White Hat              | Ethical Hacker     | Finds and fixes vulnerabilities with permission                                                                        | Legal                      |
| Black Hat              | Cracker            | Breaks in for personal gain, theft, damage                                                                             | Illegal                    |
| Grey Hat               | —                  | Hacks without permission but not for malicious reasons (may report the flaw after)                                     | Illegal but not malicious  |
| Red Hat                | Vigilante hacker   | Attacks black hats aggressively to stop them                                                                           | Illegal / grey area        |
| Blue Hat               | —                  | Outside security consultants invited to test systems before launch (e.g., bug-bounty testers before a product release) | Legal                      |
| Script Kiddie          | —                  | Uses existing tools/scripts without deep knowledge                                                                     | Illegal if unauthorized    |
| Hacktivist             | —                  | Hacks to promote a political/social cause (e.g., Anonymous)                                                            | Illegal                    |
| State-Sponsored Hacker | Nation-state actor | Works for a government for espionage/cyberwarfare                                                                      | Depends on country/context |
| Suicide Hacker         | —                  | Doesn't care about being caught, aims for maximum damage                                                               | Illegal                    |

### 3. Ethical Hacking — Formal Definition

Ethical Hacking is the **authorized, legal practice** of bypassing system security to identify potential data breaches and threats in a network, done with the owner's consent, following an agreed scope, and reporting findings responsibly.

#### The "Five Rules" of an Ethical Hacker

1. **Stay Legal** — get written permission (a signed contract/authorization) before testing.
2. **Define the Scope** — know exactly what is and isn't allowed to be tested.
3. **Report Vulnerabilities** — don't exploit for personal gain; tell the organization.
4. **Respect Data Sensitivity** — sign an NDA (Non-Disclosure Agreement) if required.
5. **Clean Up** — remove any tools, backdoors, or accounts created during testing.

### 4. Hacker Classes vs Security Professional Roles

| Role               | Description                                                          |
| ------------------ | -------------------------------------------------------------------- |
| Penetration Tester | Simulates real attacks against a defined scope, with a time limit    |
| Security Analyst   | Monitors systems, investigates alerts (mostly defensive)             |
| Red Team           | Simulates a real adversary over a longer period, tests detection too |
| Blue Team          | Defenders — detect and respond to attacks                            |
| Purple Team        | Red + Blue working together to improve both offense and defense      |

### 5. Hacking Phases (the "Hacking Lifecycle")

This is one of the most commonly asked diagram/theory questions.

1. **Reconnaissance (Footprinting)** — gathering information about the target before attacking (passive or active).
2. **Scanning** — actively probing the target to find open ports, live hosts, services, and vulnerabilities.
3. **Gaining Access** — actually exploiting a vulnerability to get into the system.
4. **Maintaining Access** — installing backdoors/rootkits so the attacker can return later.
5. **Clearing Tracks** — deleting logs and evidence to avoid detection.

*(In ethical hacking, phase 4 and 5 are often skipped or done only in a controlled, reversible way, and everything is documented instead of hidden.)*

### 6. Core Cyber Security Terminology (definitions you must know)

| Term           | Meaning                                                                                           |
| -------------- | ------------------------------------------------------------------------------------------------- |
| Asset          | Anything of value to an organization (data, server, reputation)                                   |
| Threat         | A potential danger that could exploit a vulnerability (e.g., a hacker, malware, natural disaster) |
| Vulnerability  | A weakness in a system that can be exploited                                                      |
| Exploit        | Code/technique that takes advantage of a vulnerability                                            |
| Risk           | The likelihood of a threat exploiting a vulnerability × the impact it would cause                 |
| Attack         | An actual attempt to exploit a vulnerability                                                      |
| Attack Vector  | The path/method used to attack (e.g., email, USB, network)                                        |
| Attack Surface | All the possible points where an attacker could try to get in                                     |
| Zero-Day       | A vulnerability that is unknown to the vendor (no patch exists yet)                               |
| Payload        | The part of malware/exploit that does the actual damage                                           |
| Backdoor       | A hidden way to bypass normal authentication                                                      |
| Patch          | A fix released by a vendor for a known vulnerability                                              |

### 7. CIA Triad (foundation of all security)

* **Confidentiality** — only authorized people can see the data (protected using encryption, access control)
* **Integrity** — data is accurate and not tampered with (protected using hashing, checksums)
* **Availability** — systems/data are accessible when needed (protected using backups, redundancy, DoS protection)

Some add two more (making it the "Parkerian Hexad"): **Authenticity** and **Non-repudiation** (the sender cannot deny sending a message — proven using digital signatures).

### 8. Hacktivism, Cyberwarfare, and Cyber Terrorism

* **Hacktivism** — hacking for a political/social cause (e.g., defacing a website to protest something).
* **Cyberwarfare** — a nation-state attacking another nation's digital infrastructure (power grid, defense systems).
* **Cyber Terrorism** — attacks meant to cause fear/panic or serious harm to civilians via digital means.

### 9. Legal and Ethical Boundaries (Indian & Global context)

* **IT Act 2000 (India)** — main law governing cybercrime and electronic commerce in India. Covers hacking (Section 66), identity theft, cyber terrorism, data breach penalties, etc.
* **Global laws** referenced in CEH: Computer Fraud and Abuse Act (CFAA - USA), GDPR (EU - data protection), HIPAA (USA - healthcare data).
* **Authorization document types**: Rules of Engagement (RoE), Scope of Work (SoW), Non-Disclosure Agreement (NDA), "Get Out of Jail Free" letter (written permission a pentester carries in case of being questioned).

### 10. Skills Required to Be an Ethical Hacker

* Networking fundamentals (TCP/IP, OSI model)
* Operating systems (Linux especially, since most tools run on Linux/Kali)
* Programming/scripting (Python, Bash, sometimes C)
* Knowledge of databases, web technologies
* Understanding of security tools (Nmap, Wireshark, Burp Suite, Metasploit)
* Soft skills: report writing, communication, ethics

***

### Exam Points (Quick Revision)

* Hacker types: White/Black/Grey/Red/Blue Hat, Script Kiddie, Hacktivist, State-Sponsored, Suicide Hacker.
* 5 Hacking Phases: Recon → Scan → Gain Access → Maintain Access → Clear Tracks. **(Very frequently asked)**
* CIA Triad = Confidentiality, Integrity, Availability.
* Vulnerability ≠ Threat ≠ Risk ≠ Exploit — know the difference, commonly confused in exams.
* Ethical hacking requires **written authorization** — always mention this in any answer.
* Zero-day = vulnerability with no patch yet.
* Red Team = attackers (simulated), Blue Team = defenders, Purple Team = both together.
