Skip to content
LATEST

🚀 Welcome to Upgradix by Shrash Studio – Your destination for free technology learning and career growth.

Upgradix
Upgradix Code. Learn. Ship.
Updated Dec 01, 2026

Ethical Hacking - Legal Frameworks, Ethics & Lab Setup

Learn the legal and ethical foundations of cybersecurity—including Rules of Engagement (RoE), scope boundaries, bug bounty vs. enterprise VAPT, and ISO 27001, PCI-DSS, and CERT-In compliance—then build a fully isolated VirtualBox/VMware cyber range running Kali Linux, Metasploitable, OWASP Juice Shop, and a Windows Server AD lab.

Legal Frameworks, Ethics & Lab Setup

Before running your first port scan or exploiting a single vulnerability, you must understand the line that separates an ethical security professional from a cybercriminal: explicit written authorization. Technical skills without legal discipline can lead to severe civil and criminal penalties.

In this foundational chapter, you will learn how professional security engagements are governed through Rules of Engagement, scope boundaries, and global compliance frameworks. Then, you will build a completely isolated VirtualBox/VMware cyber range so you can practice offensive and defensive techniques safely on your own hardware.

What you will learn
  • How Rules of Engagement (RoE) and strict scope boundaries protect both testers and organizations.
  • Key differences between Bug Bounty programs and Enterprise VAPT engagements.
  • How ISO 27001, PCI-DSS, and CERT-In guidelines drive real-world security testing.
  • Hands-On Lab: Build an isolated VirtualBox/VMware cyber range using Host-Only and NAT networks running Kali Linux, Metasploitable, OWASP Juice Shop, and a Windows Server Active Directory domain lab.

1. Rules of Engagement (RoE) & Scope Boundaries

A Rules of Engagement (RoE) document is a formal, legally binding agreement signed before any testing begins. It defines exactly what a tester is permitted to touch, when they can test, and how emergencies are handled.

  • In-Scope Assets: Explicit IP ranges (e.g., 192.168.10.0/24), specific domains, APIs, or applications authorized for testing.
  • Out-of-Scope Assets: Third-party SaaS platforms, production payment gateways, or shared cloud infrastructure you must never scan.
  • Allowed vs. Restricted Techniques: Clarifies whether social engineering, physical intrusion, or Denial-of-Service (DoS) testing is permitted (DoS is almost always prohibited).
  • Testing Windows & Emergency Contacts: Specifies approved hours (e.g., off-peak maintenance windows) and a 24/7 technical point of contact if a critical service crashes.
  • Data Handling & Disclosure: Defines how proof-of-concept screenshots, credentials, and sensitive findings are encrypted, stored, and destroyed after the engagement.
Golden Rule of Ethical Hacking: Never scan, probe, or exploit any system you do not own or have explicit written permission to test. Unauthorized access is illegal under laws such as India's IT Act 2000 (Sections 43 & 66) and the US Computer Fraud and Abuse Act (CFAA).

2. Bug Bounty vs. Enterprise VAPT

Organizations test their security through two primary models: crowdsourced Bug Bounty programs and structured Enterprise Vulnerability Assessment & Penetration Testing (VAPT).

Dimension Bug Bounty Programs Enterprise VAPT
Authorization Public or invite-only Safe Harbor policy Signed Master Services Agreement (MSA), NDA, and RoE
Compensation Paid per valid, unique vulnerability (severity-based) Fixed fee or time-and-materials contract
Testing Depth Black-box / Gray-box; focused on high-impact bugs Black, Gray, or White-box; comprehensive coverage
Compliance Value Supplements security; rarely satisfies audit alone Produces formal audit-ready executive & technical reports
Timeline Continuous / ongoing Time-boxed (typically 1–4 weeks)

3. Compliance Standards Driving Security Testing

Enterprise VAPT is frequently mandated by regulatory and industry standards. Understanding these frameworks helps you align your technical findings with business risk.

  • ISO/IEC 27001: The international standard for an Information Security Management System (ISMS). Annex A controls require regular technical vulnerability management, risk assessments, and independent security reviews.
  • PCI-DSS (Payment Card Industry Data Security Standard): Mandatory for any organization storing, processing, or transmitting credit card data. Requirement 11 mandates quarterly external ASV scans and annual internal/external penetration testing, including network segmentation checks.
  • CERT-In Guidelines (India): Issued by the Indian Computer Emergency Response Team. Key mandates include reporting specified cybersecurity incidents within 6 hours of detection, retaining ICT system logs securely for 180 days within Indian jurisdiction, and synchronizing all system clocks via NTP.

4. Cyber Range Architecture: NAT vs. Host-Only Isolation

To practice safely, your vulnerable machines (Metasploitable, OWASP Juice Shop, Windows Server) must never be exposed to your home Wi-Fi or the public internet. We achieve this by placing all target VMs on an isolated Host-Only Network (192.168.56.0/24) and giving only Kali Linux a secondary NAT adapter for downloading updates.

Isolated VirtualBox / VMware Cyber Range Topology

NAT Network 10.0.2.0/24 Updates Only (Outbound) ISOLATED HOST-ONLY: 192.168.56.0/24 Kali Linux (Attacker) eth0: NAT (Internet) eth1: 192.168.56.10 Dual-NIC Bridge Point 1. Metasploitable 2 (Linux Target) 192.168.56.20 | Host-Only NIC Practice: Network scanning, service & kernel exploits 2. OWASP Juice Shop (Web App Target) 192.168.56.30:3000 | Host-Only NIC Practice: OWASP Top 10, SQLi, XSS, Broken Auth 3. Windows Server AD Domain Lab 192.168.56.40 | Domain: lab.local Practice: SMB, Kerberoasting, Active Directory hardening

Only Kali Linux has a NAT adapter for package updates. All intentionally vulnerable targets sit strictly inside the Host-Only subnet with zero internet exposure.

5. Hands-On Lab: Build Your Isolated Cyber Range

Hardware Prerequisites

  • CPU: 4+ cores with Virtualization (Intel VT-x or AMD-V) enabled in BIOS.
  • RAM: 16 GB recommended (8 GB minimum if running 2 VMs at a time).
  • Hypervisor: Oracle VirtualBox 7.x (free) or VMware Workstation Pro/Player.
  • Disk Space: At least 60 GB free SSD space.

Step 1: Create the Isolated Host-Only Network

In VirtualBox, open File → Tools → Network Manager → Host-only Networks and create vboxnet0 (or VMnet1 in VMware) with the following settings:

  • IPv4 Address: 192.168.56.1
  • IPv4 Network Mask: 255.255.255.0
  • DHCP Server: Enabled (192.168.56.100 to 192.168.56.200) or disabled if assigning static IPs.

Step 2: Configure Kali Linux (Dual-NIC Attacker Machine)

Import the official pre-built Kali Linux VirtualBox/VMware image (2 vCPU, 4 GB RAM). Before booting, open Settings → Network:

  • Adapter 1: Attached to NAT (allows apt update and tool downloads).
  • Adapter 2: Attached to Host-only Adapter (vboxnet0).

Assign a static IP on Kali's Host-Only interface (eth1)

sudo ip addr add 192.168.56.10/24 dev eth1
sudo ip link set eth1 up
ip -4 addr show eth1

Step 3: Deploy the Three Vulnerable Targets (Host-Only Only)

Target A – Metasploitable 2: Download the Metasploitable 2 VMDK, attach it to a new Linux VM (1 vCPU, 1 GB RAM), and set Adapter 1 to Host-only Adapter. Boot and log in with msfadmin / msfadmin, then assign 192.168.56.20.
Target B – OWASP Juice Shop: On a lightweight Ubuntu Server VM attached only to the Host-Only network (192.168.56.30) — or locally via Docker — run the official container:

Start OWASP Juice Shop container

docker run -d --name juice-shop -p 192.168.56.30:3000:3000 bkimminich/juice-shop
Target C – Windows Server Active Directory Lab: Install Windows Server 2022 Evaluation ISO (2 vCPU, 4 GB RAM) on the Host-only Adapter with static IP 192.168.56.40. Open Server Manager, install the Active Directory Domain Services (AD DS) role, and promote the server to a Domain Controller for a new forest named lab.local.

Step 4: Verify Connectivity & Strict Isolation

From Kali Linux, run a host discovery scan across your Host-Only subnet to confirm all targets are reachable.

Discover lab targets from Kali Linux

nmap -sn 192.168.56.0/24

Expected output

Starting Nmap 7.95 ( https://nmap.org )
Nmap scan report for 192.168.56.1   (Host Machine)
Nmap scan report for 192.168.56.10  (Kali Linux)
Nmap scan report for 192.168.56.20  (Metasploitable 2)
Nmap scan report for 192.168.56.30  (OWASP Juice Shop)
Nmap scan report for 192.168.56.40  (Windows Server AD DC)
Nmap done: 256 IP addresses (5 hosts up) scanned in 2.14 seconds

Next, log into Metasploitable 2 and verify it has zero internet access:

Confirm isolation on Metasploitable 2

ping -c 2 8.8.8.8

Expected output (isolation verified)

connect: Network is unreachable
Take Clean Snapshots Now: Before running any exploits, shut down each VM and take a VirtualBox/VMware snapshot named Clean-Baseline. If an exploit crashes a service or corrupts Active Directory, you can revert in 5 seconds.

6. Hands-On Practice

Beginner Exercise 1: Verify OWASP Juice Shop from Kali

Open Firefox inside your Kali Linux VM and navigate to http://192.168.56.30:3000. Confirm the Juice Shop storefront loads and verify you can inspect its HTTP headers using curl -I http://192.168.56.30:3000.

Intermediate Exercise 2: Draft a Mini Rules of Engagement

Write a 1-page RoE for your home lab defining 192.168.56.20–40 as In-Scope, your home router (192.168.1.1) as Out-of-Scope, and listing allowed testing tools.

Advanced Exercise 3: Join a Windows 10 Client to lab.local

Deploy a Windows 10/11 VM on the same Host-Only network (192.168.56.41), point its Primary DNS server to 192.168.56.40, and join it to the lab.local domain to prepare for lateral movement labs.

7. Interview Questions

Q1. What should you do if you accidentally discover a critical vulnerability on an out-of-scope domain during a VAPT?

Answer: Stop testing that asset immediately. Do not attempt to exploit it further or extract data. Document what you inadvertently observed and notify the client's authorized point of contact right away so they can decide whether to formally expand the scope in writing.

Q2. Why do we use a Host-Only network instead of Bridged networking for a vulnerable cyber range?

Answer: Bridged networking connects your intentionally vulnerable VMs directly to your physical LAN, exposing them to other devices on your network (and potentially the internet if misconfigured). A Host-Only network isolates all vulnerable traffic inside a private virtual subnet.

Q3. What are the two most important operational requirements under India's CERT-In guidelines?

Answer: Organizations must report specified cybersecurity incidents to CERT-In within 6 hours of noticing them, and must maintain all ICT system logs securely for a rolling period of 180 days within Indian jurisdiction with NTP-synchronized clocks.

Conclusion

Strong security engineering starts with legal clarity and disciplined lab hygiene. By respecting Rules of Engagement, understanding compliance drivers like ISO 27001, PCI-DSS, and CERT-In, and building a clean, isolated Host-Only cyber range, you now have a professional foundation ready for reconnaissance, vulnerability scanning, and exploitation in the chapters ahead.

Official Documentation

Upgradix by Shrash Studio – Learn Technology. Build Your Future.

Discussion & Comments

0
Guest mode · Login / Register
Post directly as a guest or log in first.

No comments yet

Start the discussion above — ask a question, share a tip, or reply to a comment.

This article is protected. Printing and saving as PDF are disabled.