Ethical Hacking Fundamentals

πŸ“ Concept Note β€” EHPT Unit I | Source: MCA Sem III Syllabus


What is Hacking?

Hacking is the practice of finding vulnerabilities in systems and exploiting them. The intent behind it determines whether it’s ethical or criminal.


Types of Hackers

TypeHat ColourMotivationLegal Status
White Hat⬜Improve security, authorised testingLegal (with permission)
Black Hat⬛Financial gain, destruction, espionageIllegal
Grey HatπŸ”²Finds vulns without permission, reports themLegally questionable
Hacktivistβ€”Political/social causeUsually illegal
Script Kiddieβ€”Fun, bragging β€” uses others’ tools blindlyUsually illegal
Nation-Stateβ€”Espionage, sabotage, warfareState-sponsored

How Ethical Hacking Strengthens Security

  • Find vulnerabilities before criminals do
  • Test defences under realistic conditions
  • Validate security controls actually work
  • Comply with regulatory requirements
  • Build confidence in security posture

Why Companies Pay for Penetration Tests

  • Regulatory compliance (PCI-DSS, HIPAA, ISO 27001)
  • Insurance requirements
  • Customer trust and contractual obligations
  • Real-world validation that automated scans can’t provide

SectionOffenceRelevance
43Unauthorised access to computer systemTesting without permission = violation
65Tampering with computer source codeModifying systems without authorisation
66BIdentity theftUsing stolen credentials
66CCheating by personation using computerImpersonation attacks
66FCyber terrorismAttacks on critical infrastructure

Rules of Engagement (RoE)

A legal document signed before any penetration test that defines:

  • Scope β€” What systems can be tested
  • Out of scope β€” What must NOT be touched
  • Testing window β€” When testing can occur
  • Contact information β€” Who to call if something breaks
  • Acceptable methods β€” What techniques are allowed
  • Data handling β€” How discovered data is treated

Critical Rule

⚠️ Testing without written permission is a CRIME. Even if you find a vulnerability and report it responsibly, unauthorized testing can lead to prosecution.

Non-Disclosure Agreements (NDAs)

  • Tester must not reveal vulnerabilities to anyone except the client
  • Test results are confidential
  • Discovered data (passwords, PII) must be handled securely

The 5 Phases of Ethical Hacking

Phase 1          Phase 2              Phase 3          Phase 4          Phase 5
Reconnaissance β†’ Scanning &     β†’  Gaining    β†’  Maintaining  β†’  Covering
                 Enumeration        Access         Access          Tracks

Phase 1: Reconnaissance

Gathering information about the target without directly interacting with it.

  • Google Dorking, WHOIS, DNS lookups
  • Social media, LinkedIn, job postings
  • Passive β€” no direct contact with target

Phase 2: Scanning & Enumeration

Actively probing the target to discover open ports, services, and vulnerabilities.

  • Nmap port scanning, Nessus vulnerability scanning
  • Service enumeration (SMB, SMTP, SNMP)
  • Active β€” directly touches the target

Phase 3: Gaining Access

Exploiting vulnerabilities to gain unauthorized access.

  • Metasploit exploits, password attacks
  • Web application attacks (SQLi, XSS)
  • Social engineering

Phase 4: Maintaining Access

Ensuring persistent access even if the system is rebooted or patched.

  • Backdoors, rootkits, trojans
  • Creating admin accounts
  • Scheduled tasks / cron jobs

Phase 5: Covering Tracks

Removing evidence of the intrusion.

  • Clearing log files
  • Modifying timestamps
  • Deleting tools used during attack

πŸ’‘ Ethical hackers document phases 4 and 5 as findings in their report. They demonstrate these techniques to show risk but restore systems to original state.


Cyber Kill Chain (Lockheed Martin)

Maps how attackers operate β€” defenders use it to detect and interrupt at each phase:

Kill Chain PhaseAttacker ActionDefender Response
1. ReconnaissanceResearch targetMonitor for OSINT exposure
2. WeaponisationCreate exploit/payloadThreat intelligence
3. DeliverySend phishing email / exploitEmail filtering, web proxy
4. ExploitationTrigger vulnerabilityPatch management, IPS
5. InstallationInstall backdoorEndpoint detection (EDR)
6. Command & ControlEstablish C2 channelNetwork monitoring, DNS filtering
7. Actions on ObjectivesSteal data, encrypt filesDLP, network segmentation

πŸ’‘ The earlier you break the chain, the less damage the attacker can do.


Red Team vs Blue Team vs Purple Team

TeamRoleFocus
Red TeamAttackersSimulate real-world attacks, find vulnerabilities
Blue TeamDefendersDetect, respond, and prevent attacks
Purple TeamCollaborationRed + Blue work together to improve both

VAPT vs Vulnerability Assessment vs Penetration Test

AspectVulnerability AssessmentPenetration TestVAPT
ApproachAutomated scanningManual exploitationBoth combined
DepthBroad, surface-levelDeep, targetedComprehensive
ExploitationNo β€” finds and listsYes β€” proves exploitabilityYes
OutputList of vulnerabilitiesProof of compromiseBoth
ToolsNessus, OpenVASMetasploit, Burp SuiteAll

Key Standards & Frameworks

PTES (Penetration Testing Execution Standard)

Defines 7 phases: Pre-engagement β†’ Intelligence Gathering β†’ Threat Modelling β†’ Vulnerability Analysis β†’ Exploitation β†’ Post-Exploitation β†’ Reporting

OWASP Testing Guide v4.2

Comprehensive guide for web application security testing β€” covers testing methodology for all OWASP Top 10 categories.

Lab Environment Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     Host-Only Network     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Kali Linux  β”‚ ←───────────────────────→ β”‚ Metasploitable 2  β”‚
β”‚  (Attacker)  β”‚                            β”‚  (Vulnerable VM)  β”‚
β”‚              β”‚                            β”‚                   β”‚
β”‚  Tools:      β”‚                            β”‚  Services:        β”‚
β”‚  - Nmap      β”‚                            β”‚  - vsftpd 2.3.4   β”‚
β”‚  - Metasploitβ”‚ ←─────────────────────→   β”‚  - SSH, Telnet    β”‚
β”‚  - Burp Suiteβ”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚  - Samba, MySQL   β”‚
β”‚  - Nessus    β”‚     β”‚   DVWA     β”‚        β”‚  - Apache, etc.   β”‚
β”‚  - Hydra     β”‚     β”‚ (Web App)  β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

⚠️ ALWAYS use isolated host-only networks for lab work. Never scan networks you don’t own.