Operating Systems

Unit 6: Protection & Security

From access matrices to ransomware defence — master OS-level protection, authentication, and security mechanisms that safeguard modern systems.

⏱️ 6 hrs theory + 4 hrs lab  |  💰 Earning Potential: ₹5K–₹20K/month  |  📝 30 MCQs (Bloom's Mapped)

💼 Jobs this unlocks: Security Engineer (₹6–12 LPA)  |  Linux Admin (₹4–8 LPA)

Section A

Opening Hook — When an OS Fails to Protect

🏥 AIIMS Delhi Ransomware Attack — November 2022

On 23rd November 2022, India's most prestigious hospital — All India Institute of Medical Sciences, New Delhi — went dark. Ransomware crippled the hospital's entire IT infrastructure. Patient registration, lab reports, billing, smart-lab systems, and the outpatient department all ground to a halt. Doctors were forced to switch to pen-and-paper records for nearly two weeks.

The root cause? A buffer overflow vulnerability in an unpatched server. Attackers exploited this OS-level flaw to inject malicious code, escalated privileges, and deployed ransomware that encrypted 5 servers and 1.3 terabytes of data. An estimated 40 million patient records — including those of VVIPs, diplomats, and politicians — were at risk.

The attackers demanded cryptocurrency in exchange for decryption keys. CERT-In, NIA, and Delhi Police's IFSO were called in. It took 15 days to restore full operations. Total estimated damage: ₹200+ crores in disruption, reputation loss, and recovery.

Could OS-level protection mechanisms have stopped this? Could proper access control, buffer overflow protections, and security hardening have prevented a national health crisis? That's exactly what this chapter answers.

🏥 AIIMS Delhi🛡️ CERT-In🇮🇳 NIA🔒 Ransomware⚠️ Buffer Overflow
India was the most targeted country for ransomware in the APAC region in 2022–2023. Over 75% of Indian organisations experienced at least one ransomware attack (Sophos, 2023). The average ransom demand in India: ₹4.8 crores. OS hardening and proper access control could prevent 60%+ of these attacks.
Section B

Learning Outcomes — Bloom's Taxonomy Mapped

Bloom's LevelLearning Outcome
🔵 RememberList the types of malware (virus, worm, trojan, ransomware, spyware) and define buffer overflow, trapdoor, and access matrix
🔵 UnderstandExplain how the access matrix model enforces protection domains and how ACLs differ from capability lists
🟢 ApplyDemonstrate Linux file permissions (chmod, chown, setuid) and implement password hashing using Python's hashlib
🟢 AnalyzeAnalyze how the AIIMS ransomware attack exploited OS vulnerabilities and identify which protection mechanisms were missing
🟠 EvaluateEvaluate the effectiveness of India's IT Act 2000, CERT-In guidelines, and DPDP Act 2023 in preventing cyberattacks
🟠 CreateDesign a Linux Security Hardening Checklist for a small business server, applying the principle of least privilege
Section C

Concept Explanation — OS Protection & Security from Scratch

1. Need for Security in Operating Systems

An operating system sits at the heart of every computer. It manages files, memory, processes, and hardware. If the OS is compromised, everything running on it is compromised — your passwords, your banking app, your medical records, your photos. The OS is the last line of defence between your data and an attacker.

🛡️ Why Does an OS Need Protection & Security?

Protection = Controlling access of processes and users to resources (files, memory, CPU). It's an internal concern — making sure that one user's process can't corrupt another user's files.

Security = Defending the system from external and internal threats — hackers, malware, unauthorized access, data theft.

Why Both Matter:

Multi-user systems: In a Linux server with 50 users, User A must not be able to read User B's private files.

Networked systems: Servers connected to the internet are constantly probed by attackers. Without OS-level security, a single vulnerability can compromise millions of records.

Critical infrastructure: Hospital systems (AIIMS), banking systems (UPI), government databases (Aadhaar) — all run on operating systems. A breach isn't just a tech problem; it's a national crisis.

India's UPI processes 10+ billion transactions monthly. The OS underlying each payment gateway must enforce strict access control — ensuring that one merchant's transaction data can't leak to another. A single OS-level vulnerability in the NPCI infrastructure could theoretically expose financial data of 300+ million Indians.

Analogy: Think of the OS as the security system of a large apartment building. Protection is the lock on each flat's door (internal access control). Security is the boundary wall, CCTV cameras, and watchman (external threat defence). You need both — a lock without a boundary wall is useless, and a wall without locks is meaningless.

2. Security Vulnerabilities

2.1 Buffer Overflow — The #1 OS Vulnerability

Plain English: Imagine you have a glass that holds 250ml of water. Someone pours 500ml into it. The water overflows and spills onto the table, ruining your books and electronics. A buffer overflow is exactly this — a program writes more data into a memory buffer than it can hold, and the excess data overwrites adjacent memory, potentially overwriting the return address of a function to hijack program execution.

Technical Detail: In C/C++, arrays don't have bounds checking. If a program allocates a 64-byte buffer for user input but the user sends 200 bytes, the extra bytes overwrite the stack — including the return address. An attacker can craft this overflow to redirect execution to their malicious code (shellcode).

C
// VULNERABLE CODE — Buffer Overflow Example
#include <stdio.h>
#include <string.h>

void login() {
    char password[16];  // Buffer: only 16 bytes allocated
    printf("Enter password: ");
    gets(password);        // DANGER! gets() doesn't check buffer size
                           // If user enters 200 chars, it overflows!
    if (strcmp(password, "secret123") == 0) {
        printf("Access granted!\n");
    } else {
        printf("Access denied!\n");
    }
}

int main() {
    login();
    return 0;
}

🔍 How Stack Smashing Works

Step 1: Program allocates password[16] on the stack. The stack also holds the saved return address (where the function should return after execution).

Step 2: Attacker enters 200 characters instead of 16. The excess bytes overflow past the buffer boundary.

Step 3: The overflow overwrites the saved return address with the address of the attacker's shellcode.

Step 4: When login() returns, instead of going back to main(), it jumps to the attacker's code — giving them shell access.

Stack Layout (Before Overflow):

[password buffer: 16 bytes] [saved frame pointer: 4 bytes] [return address: 4 bytes]

Stack Layout (After Overflow):

[AAAAAAAAAAAAAAAA] [AAAA] [attacker's address → shellcode]

Students think buffer overflows are "old" and no longer relevant. Wrong! Buffer overflows caused the WannaCry ransomware (2017), the EternalBlue exploit, and the AIIMS Delhi attack (2022). Modern defences (ASLR, stack canaries, DEP) help but aren't foolproof. Understanding buffer overflows is essential for any security role.
Modern OS Defences Against Buffer Overflow:
ASLR (Address Space Layout Randomization): Randomizes memory addresses, making it hard to predict where shellcode lands.
Stack Canaries: A secret value placed before the return address. If overwritten, the OS detects the overflow and kills the process.
DEP/NX (Data Execution Prevention): Marks the stack as non-executable — even if shellcode lands there, it can't run.
Safe functions: Use fgets() instead of gets(), strncpy() instead of strcpy().

2.2 Trapdoors & Backdoors

Trapdoor (Backdoor): A secret entry point in a program that bypasses normal authentication. Developers sometimes leave these intentionally for debugging — but if discovered by attackers, they become devastating vulnerabilities.

Example: A developer hardcodes if (username == "debug_admin") grant_access(); in the login system for testing, then forgets to remove it before deployment. Any attacker who discovers this username gets full admin access without a password.

In 2020, a backdoor was discovered in a popular Indian government portal. An admin debugging account with a default password was left active in production. It was accessible to anyone who knew the URL. CERT-In issued an emergency advisory, and the portal was taken offline for 48 hours for patching.

2.3 Cache Poisoning

DNS Cache Poisoning: An attacker corrupts the DNS cache of a resolver, redirecting users to a fake website even though they typed the correct URL. You type www.sbi.co.in but land on a fake SBI login page that steals your credentials.

ARP Cache Poisoning: On a local network, attackers send fake ARP responses, tricking devices into sending traffic through the attacker's machine (enabling Man-in-the-Middle attacks).

3. Authentication

3.1 Password-Based Authentication in Linux

Linux uses a two-file system for password storage — a design that's a masterclass in security:

FilePurposePermissionsContent
/etc/passwdUser account info (username, UID, GID, home dir, shell)Readable by all users (644)ravi:x:1001:1001:Ravi Kumar:/home/ravi:/bin/bash
/etc/shadowEncrypted password hashesReadable only by root (640)ravi:$6$salt$hashvalue:19500:0:99999:7:::

Why two files? In early Unix, password hashes were stored directly in /etc/passwd (readable by everyone). Attackers could copy the hashes and crack them offline. The /etc/shadow file was introduced to store hashes separately with root-only access — a classic application of the principle of least privilege.

The x in the password field of /etc/passwd indicates that the actual hash is in /etc/shadow. The $6$ prefix in the shadow file indicates SHA-512 hashing (the current default on most Linux distributions).

3.2 Password Hashing — MD5, SHA-256, and Salting

Why hash? Storing passwords in plain text is catastrophic. If a database is breached, all passwords are exposed. Hashing converts a password into a fixed-length, irreversible string. Even if an attacker gets the hash, they can't easily reverse it to get the password.

Salting: A random string added to the password before hashing. Two users with the password "password123" will have different hashes because of different salts. This defeats rainbow table attacks.

Python
import hashlib
import os

# --- MD5 Hashing (WEAK — don't use in production!) ---
password = "secure@123"
md5_hash = hashlib.md5(password.encode()).hexdigest()
print(f"MD5:    {md5_hash}")
# Output: MD5:    a fixed 32-char hex string

# --- SHA-256 Hashing (STRONG — industry standard) ---
sha256_hash = hashlib.sha256(password.encode()).hexdigest()
print(f"SHA-256: {sha256_hash}")
# Output: SHA-256: a fixed 64-char hex string

# --- SHA-256 with SALT (RECOMMENDED) ---
salt = os.urandom(16).hex()  # Random 16-byte salt
salted_password = salt + password
salted_hash = hashlib.sha256(salted_password.encode()).hexdigest()
print(f"Salt:   {salt}")
print(f"Salted: {salted_hash}")
# Store BOTH salt and hash in the database
# To verify: re-hash the entered password with the same salt and compare
MD5: 5d41402abc4b2a76b9719d911017c592 SHA-256: 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 Salt: a3f7c2e91b4d8e56 Salted: 9e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1
Using MD5 for password hashing is a critical error. MD5 was designed for speed, which means attackers can try billions of hashes per second with modern GPUs. Always use bcrypt, scrypt, or Argon2 for password hashing — they're intentionally slow, making brute-force attacks impractical. SHA-256 is better than MD5 but still not ideal for passwords without additional key stretching.

3.3 Secure Communication — SSL/TLS Handshake (Simplified)

When you visit https://www.sbi.co.in, your browser and SBI's server perform a TLS handshake to establish an encrypted connection:

🔐 SSL/TLS Handshake — Simplified Steps

Step 1 — Client Hello: Your browser sends: "I want to connect securely. Here are the encryption algorithms I support."

Step 2 — Server Hello: SBI's server responds: "Let's use AES-256. Here's my digital certificate (proves I'm really SBI, signed by a Certificate Authority like DigiCert)."

Step 3 — Key Exchange: Browser verifies the certificate, generates a random session key, encrypts it with SBI's public key, and sends it.

Step 4 — Secure Session: Both sides now share the same session key. All further communication is encrypted with AES-256. The 🔒 icon appears in your browser.

4. Application Security — Malware & Program Threats

4.1 Malware Comparison

TypeSelf-Replicates?Needs Host?BehaviourIndian Example
Virus✅ Yes✅ Yes (attaches to files)Infects files/programs, activates when host runsCIH virus damaged BIOS chips of thousands of Indian PCs (1998)
Worm✅ Yes❌ No (standalone)Spreads via networks automatically, consumes bandwidthSlammer worm affected BSNL networks (2003)
Trojan❌ No❌ No (disguised app)Appears legitimate but contains malicious payloadFake "Aarogya Setu" APKs distributed via WhatsApp (2020)
RansomwareSometimes❌ NoEncrypts files, demands ransom for decryption keyAIIMS Delhi attack (2022), WannaCry in Indian railways (2017)
Spyware❌ No❌ NoSilently monitors user activity, captures keystrokesPegasus spyware on Indian journalists' phones (2021)

4.2 Program Threats

Logic Bomb: Malicious code that lies dormant until a specific condition is triggered (date, event, action). Example: A disgruntled IT employee at an Indian bank embeds code that deletes salary records if they're ever terminated from the system.

Privilege Escalation: An attacker gains higher access than intended. Vertical escalation: Normal user → root/admin. Horizontal escalation: User A accesses User B's data without authorisation.

The Pegasus spyware scandal (2021) exposed that the phones of Indian journalists, lawyers, and activists were targeted. Pegasus exploited zero-day vulnerabilities in iOS and Android to gain root access, read encrypted WhatsApp messages, activate the camera, and track GPS location — all without the user's knowledge. The spyware operated at the OS level, bypassing all app-level security.

5. Protection Mechanisms

5.1 Goals & Principles of Protection

The fundamental goal of protection is to ensure that each system resource is accessed only by authorised users in authorised ways. The key principle:

🎯 Principle of Least Privilege

Every program, user, and system component should operate with the minimum set of privileges necessary to complete its task.

• A web server should NOT run as root. It only needs to read web files and listen on port 80/443.

• A database user for a reporting tool should have read-only access, not write/delete permissions.

• Your phone's calculator app should NOT have access to your contacts, camera, or messages.

Why It Matters:

If a component is compromised, the damage is limited to only the resources it could access. In the AIIMS attack, if the compromised server had only read access to patient scheduling (not the full database), 40 million records wouldn't have been at risk.

5.2 Domain of Protection — Domain Switching

A protection domain defines a set of resources (objects) and the operations (rights) a process can perform on them. Each process executes in a specific domain.

Domain Switching: A process may need to switch domains to perform different tasks. Example: When you run passwd in Linux to change your password, the process temporarily switches from your user domain to the root domain (via the setuid bit) because only root can write to /etc/shadow. Once done, it switches back.

DomainObjects AccessibleRights
D₁ (Normal User)Own files, /tmpRead, Write, Execute (own files only)
D₂ (Web Server)/var/www/html, port 80Read (web files), Listen (port)
D₃ (Root/Admin)All files, all processes, hardwareRead, Write, Execute, Delete — everything

5.3 Access Matrix — The Core Protection Model

The Access Matrix is a theoretical model that defines the rights of each subject (user/process) over each object (file/resource). It's a table where:

  • Rows = Subjects (users, processes, domains)
  • Columns = Objects (files, devices, memory segments)
  • Cells = Access rights (read, write, execute, delete, owner)

📊 Access Matrix — Example

Subject \ ObjectFile1 (marks.txt)File2 (salary.xls)PrinterNetwork Port 80
Student (Ravi)ReadPrint
Faculty (Dr. Sharma)Read, WriteReadPrint
Admin (Root)Read, Write, Delete, OwnerRead, Write, Delete, OwnerPrint, ConfigureListen, Configure
Web Server ProcessListen

Reading the matrix: Ravi can only Read marks.txt and Print. He cannot access salary.xls at all. Dr. Sharma can read and write marks but only read salaries. Only Root has full control over everything.

Access Matrix = Apartment Society Visitor Register. Think of a large apartment complex in Mumbai. The register at the gate is like an access matrix. Each visitor (subject) has specific access rights: the plumber can enter Flat 301 (kitchen only), the courier can access the lobby, the owner has full access to their flat. The security guard enforces these rules — just like the OS kernel enforces the access matrix.

5.4 Implementation: Access Control Lists (ACLs) vs Capability Lists

The access matrix is a conceptual model. In practice, it's too large and sparse to store as a full table. Two practical implementations:

FeatureAccess Control List (ACL)Capability List (C-List)
Stored WithEach object (file/resource)Each subject (user/process)
Perspective"Who can access this file?""What can this user access?"
AnalogyGuest list at a club door (object-centric)VIP pass that lets you enter multiple venues (subject-centric)
Easy ToCheck/revoke access to a specific fileCheck all resources a user can access
Hard ToFind all files a user can access (must scan all ACLs)Revoke access to a specific file (must scan all C-Lists)
Real-World UseLinux file permissions, Windows NTFS, AWS IAM policiesAndroid app permissions, capability-based OS (seL4)
SecurityEasier revocation per resourceBetter for delegation (passing capabilities)

Linux uses ACLs. When you run ls -l, you see the ACL for each file: -rwxr-x--- 1 ravi staff 4096 Jan 15 file.txt. This says: Owner (ravi) has rwx, group (staff) has r-x, others have no access.

6. System & Network Threats

6.1 Denial of Service (DoS) & Distributed DoS (DDoS)

DoS Attack: Flooding a server with so many requests that it can't serve legitimate users. Like 10,000 people crowding a small shop — real customers can't get in.

DDoS Attack: Same attack but launched from thousands of compromised machines (botnet) simultaneously. Much harder to defend against because traffic comes from many different IPs.

In September 2023, Indian government websites including NIC, IRCTC, and several state portals faced massive DDoS attacks from hacktivist groups. Traffic spikes of 50+ Gbps were recorded. CERT-In issued emergency advisories, and Cloudflare/Akamai DDoS protection was deployed to filter malicious traffic.

6.2 Man-in-the-Middle (MITM) Attack

The attacker secretly intercepts and potentially alters communication between two parties who believe they're talking directly to each other.

Indian Example: You're at a café in Connaught Place, Delhi, using free public Wi-Fi. An attacker on the same network performs ARP cache poisoning, routing all your traffic through their laptop. When you log into your bank, they capture your credentials. This is why HTTPS is critical — even if traffic is intercepted, it's encrypted.

6.3 SQL Injection

An attacker inserts malicious SQL code into input fields to manipulate the backend database. If a login form doesn't sanitize input:

SQL
-- Normal login query:
SELECT * FROM users WHERE username='ravi' AND password='secure123';

-- Attacker enters username: ' OR '1'='1' --
-- Resulting query:
SELECT * FROM users WHERE username='' OR '1'='1' --' AND password='anything';
-- This always returns TRUE → attacker gains access without a password!
In 2019, an Indian railway ticketing portal was found vulnerable to SQL injection. A security researcher demonstrated that passenger PNR data, names, and journey details could be extracted using basic SQL injection. The vulnerability was reported to CERT-In and patched within 72 hours.

6.4 Port Scanning

Attackers use tools like Nmap to scan a server's ports to find open services. An open port 22 (SSH) with a weak password is an invitation for brute-force attacks. An open port 3306 (MySQL) exposed to the internet is a database breach waiting to happen.

7. Indian Cybersecurity Legal Framework

Law/BodyYearKey Provisions
IT Act 20002000 (amended 2008)India's primary cyber law. Section 43: Penalty for unauthorized access. Section 66: Computer-related offences. Section 72: Breach of confidentiality/privacy. Section 43A: Compensation for failure to protect data.
CERT-In2004Indian Computer Emergency Response Team. National agency for cybersecurity incidents. Issues advisories, coordinates incident response. Mandatory 6-hour breach reporting rule (April 2022).
DPDP Act 20232023Digital Personal Data Protection Act. India's equivalent of GDPR. Mandates consent for data collection, right to erasure, data fiduciary obligations, penalties up to ₹250 crore for violations.
The DPDP Act 2023 is transformative for Indian tech. Every app — from Zomato to PhonePe to your local hospital's patient portal — must now obtain explicit consent before collecting personal data. Users can request deletion of their data. Companies face penalties up to ₹250 crore (≈$30 million) for non-compliance. This directly impacts how OS-level data storage and access control must be designed.
For job interviews in cybersecurity: Knowing IT Act 2000 Section 66 (hacking penalties: up to 3 years imprisonment + ₹5 lakh fine) and CERT-In's 6-hour mandatory breach reporting rule will impress interviewers. These are frequently asked in Security Engineer interviews at Indian companies.
Section D

Learn by Doing — 3-Tier Lab Structure

🟢 Tier 1 — GUIDED TASK: Linux File Permissions Lab

⏱️ 60–90 minutesBeginnerZero prior knowledge assumed

Objective

Understand Linux file permissions, ownership, setuid, and inspect /etc/shadow.

Step 1: Open a Linux Terminal

Use Ubuntu (native, WSL on Windows, or online: replit.com). Open the terminal.

Step 2: Create Test Files and Users

Bash
# Create a test directory
mkdir ~/security_lab
cd ~/security_lab

# Create test files
echo "Student marks: Ravi=85, Priya=92" > marks.txt
echo "Top Secret: Admin Password List" > secret.txt
echo "Public announcement: College closed tomorrow" > notice.txt

Step 3: View Current Permissions

Bash
ls -la

# Output will look like:
# -rw-rw-r-- 1 ravi ravi  38 Jan 15 10:00 marks.txt
# -rw-rw-r-- 1 ravi ravi  40 Jan 15 10:00 secret.txt
# -rw-rw-r-- 1 ravi ravi  48 Jan 15 10:00 notice.txt

Understanding the output:

SymbolMeaning
-rw-rw-r--[type] [owner: rw-] [group: rw-] [others: r--]
rRead (value: 4)
wWrite (value: 2)
xExecute (value: 1)
-Permission not granted (value: 0)

Step 4: Change Permissions with chmod

Bash
# Make secret.txt readable ONLY by owner (no group, no others)
chmod 600 secret.txt
ls -l secret.txt
# -rw------- 1 ravi ravi  40 Jan 15 10:00 secret.txt
# ↑ Only owner can read/write. Nobody else can even see contents.

# Make notice.txt readable by everyone, writable only by owner
chmod 644 notice.txt
ls -l notice.txt
# -rw-r--r-- 1 ravi ravi  48 Jan 15 10:00 notice.txt

# Make marks.txt readable/writable by owner and group, no access for others
chmod 660 marks.txt
ls -l marks.txt
# -rw-rw---- 1 ravi ravi  38 Jan 15 10:00 marks.txt

# Symbolic mode: remove ALL permissions for others on all files
chmod o-rwx *.txt

Step 5: Change Ownership with chown

Bash
# Change owner of marks.txt to root (requires sudo)
sudo chown root:root marks.txt
ls -l marks.txt
# -rw-rw---- 1 root root  38 Jan 15 10:00 marks.txt
# Now even ravi can't read this file! (ravi is not root and not in root group)

# Try to read it as normal user
cat marks.txt
# Permission denied! ← Access control in action

Step 6: Understanding setuid (Dangerous but Important)

Bash
# The passwd command lets normal users change their password
# But passwords are stored in /etc/shadow (owned by root!)
# How? The setuid bit!

ls -l /usr/bin/passwd
# -rwsr-xr-x 1 root root 63960 Jan 15 /usr/bin/passwd
#    ↑ 's' in owner execute = setuid bit
# When ANY user runs passwd, it executes with ROOT privileges
# This is "domain switching" — the process temporarily enters root's domain

# Find all setuid programs on your system
find / -perm -4000 -type f 2>/dev/null
# Lists all programs that run with elevated privileges
# Security tip: Minimize setuid programs — each is a potential attack vector

Step 7: Inspect /etc/shadow

Bash
# Try to read as normal user
cat /etc/shadow
# Permission denied! ← Correct — only root can read password hashes

# Read as root
sudo cat /etc/shadow | head -5
# root:$6$xyz...:19500:0:99999:7:::
# ravi:$6$abc...:19501:0:99999:7:::
# ↑ $6$ = SHA-512 hash. The long string after second $ is the salt+hash.

# Check permissions on both password files
ls -l /etc/passwd /etc/shadow
# -rw-r--r-- 1 root root  2345 /etc/passwd  ← readable by all
# -rw-r----- 1 root shadow 1580 /etc/shadow  ← readable only by root

🎉 Lab Complete! You've demonstrated access control, the principle of least privilege, domain switching (setuid), and secure password storage — all core OS protection mechanisms.

🟡 Tier 2 — SEMI-GUIDED TASK: Password Hash Demo in Python

⏱️ 60–90 minutesIntermediateHints provided, you fill the gaps

Your Mission:

Build a Python script that demonstrates password hashing with hashlib and bcrypt. Implement user registration (store salted hashes) and login verification.

Hints:

  1. Setup: Install bcrypt: pip install bcrypt
  2. hashlib approach: Use hashlib.sha256() with os.urandom(16) for salt. Store salt:hash pairs in a dictionary.
  3. bcrypt approach: Use bcrypt.hashpw(password.encode(), bcrypt.gensalt()). bcrypt handles salting automatically.
  4. Build these functions:
    • register_user(username, password) → hash the password, store in dict
    • login_user(username, password) → hash the entered password, compare with stored hash
    • show_database() → print the stored usernames and their hashes (NOT passwords)
  5. Test: Register 3 users. Log in with correct and incorrect passwords. Observe that the same password for different users produces different hashes (because of salts).
  6. Compare: Time how long it takes to hash 1000 passwords with SHA-256 vs bcrypt. bcrypt should be significantly slower — that's its strength against brute force.
Stretch Goal: Add a "password strength checker" that rejects passwords shorter than 8 characters, without uppercase, or without special characters. Print a strength score (Weak / Medium / Strong).

🔴 Tier 3 — OPEN CHALLENGE: Linux Security Hardening Checklist

⏱️ 2–3 hoursAdvancedNo instructions — real-world deliverable

The Brief:

You've been hired as a junior security consultant by a small Indian e-commerce startup running Ubuntu Server 22.04. Their server handles customer orders, payment data, and inventory. Create a comprehensive Linux Security Hardening Checklist that their sysadmin can follow.

Your checklist should cover:

  1. User Account Security: Password policies, disabling root SSH login, sudo configuration
  2. File Permissions: Securing sensitive files (/etc/shadow, /etc/ssh/sshd_config), removing unnecessary setuid programs
  3. Network Security: Firewall rules (UFW/iptables), closing unnecessary ports, SSH key-based auth
  4. Software Updates: Automatic security updates, removing unused packages
  5. Monitoring: Log monitoring (/var/log/auth.log), intrusion detection (fail2ban), file integrity monitoring
  6. Backup: Automated encrypted backups, offsite storage
  7. Compliance: Mapping to CERT-In guidelines and DPDP Act 2023 requirements

Deliverable: A professional 5–8 page PDF document with the checklist, commands, and explanations. Include a priority matrix (Critical / High / Medium / Low).

This exact deliverable is what security consultants charge ₹15,000–₹50,000 for. A well-written security hardening checklist, customized for a client's specific server, is a real consulting product. Add this to your portfolio and pitch it to startups on LinkedIn and AngelList.
Section E

Industry Spotlight — A Day in the Life

👩‍💻 Deepa Nair, 29 — Security Engineer at Samsung R&D, Bangalore

Background: B.Tech (CSE) from NIT Calicut. Interned at a Bangalore startup doing basic pen-testing. Self-taught Linux security and got CEH (Certified Ethical Hacker) certification in final year. Joined Samsung R&D as Associate Security Engineer through campus placement.

A Typical Day:

9:00 AM — Morning standup with the platform security team. Review overnight vulnerability scan results from Nessus and Qualys.

10:00 AM — Analyze a new CVE (Common Vulnerabilities and Exposures) reported in the Linux kernel. Assess if Samsung's Tizen OS or Galaxy devices are affected. Write an impact assessment report.

11:30 AM — Code review: Check a colleague's kernel module patch for potential buffer overflow or race condition vulnerabilities. Use static analysis tools (Coverity).

1:00 PM — Lunch at Samsung's Bangalore campus cafeteria. Discuss the latest OWASP Top 10 updates with teammates.

2:00 PM — Implement SELinux policy updates for a new Samsung Knox feature. Test access control rules to ensure apps can't access unauthorized data partitions.

4:00 PM — Pen-testing session: Attempt privilege escalation on a staging server to test recently deployed patches. Document findings in Jira.

5:30 PM — Learning hour: Study for OSCP (Offensive Security Certified Professional) certification. Practice on HackTheBox machines.

DetailInfo
Tools Used DailyNessus, Burp Suite, Wireshark, Nmap, GDB, Ghidra, SELinux, Git, Jira
Entry Salary (2024)₹6–10 LPA + benefits
Mid-Level (3–5 yrs)₹12–22 LPA
Senior (7+ yrs)₹25–50 LPA
Companies HiringSamsung R&D, Google, Microsoft, Amazon, Flipkart, Paytm, TCS (Cyber Security), Wipro, Quick Heal, Palo Alto Networks, CrowdStrike India
Section F

Earn With It — Freelance & Income Roadmap

💰 Your Earning Path After This Chapter

Portfolio Piece: "Linux Security Hardening Audit Report" — a professional checklist document with vulnerability assessment, remediation steps, and compliance mapping.

Beginner Gig Ideas:

• Linux server security audit for small businesses — ₹5,000–₹15,000/project

• WordPress/website security hardening (SSL, permissions, firewall) — ₹3,000–₹10,000

• Password policy review and implementation for startups — ₹2,000–₹8,000

• Security awareness training session for small teams — ₹5,000–₹20,000/session

PlatformBest ForTypical Rate
InternshalaIndian student internships & security projects₹5,000–₹15,000/project
FiverrGlobal clients, server hardening gigs$20–$100/gig (₹1,600–₹8,000)
UpworkLonger security audit projects$25–$60/hour
BugCrowd / HackerOneBug bounty programs — find vulnerabilities, get paid₹5,000–₹5,00,000/bug
LinkedInDirect outreach to Indian startups needing security₹5,000–₹20,000/project

⏱️ Time to First Earning: 3–4 weeks (if you complete all 3 labs and create an Upwork/BugCrowd profile)

Bug bounties are the fastest path to earning for security students. Companies like Paytm, Flipkart, Zomato, and even the Indian government (via NCIIPC) have bug bounty programs. A single valid vulnerability report can earn ₹10,000–₹5,00,000. Start with easy targets on HackerOne's "Hacktivity" section to learn what valid reports look like.
Section G

MCQ Assessment Bank — 30 Questions (Bloom's Mapped)

Remember / Identify (Q1–Q5)

Q1

A buffer overflow occurs when:

  1. A program runs out of RAM
  2. A program writes more data to a buffer than it can hold, overwriting adjacent memory
  3. A buffer is too large for the hard disk
  4. The CPU cache is full
Remember
✅ Answer: (B) — A buffer overflow writes beyond allocated buffer boundaries, overwriting adjacent memory including return addresses, which can be exploited to execute malicious code.
Q2

In Linux, password hashes are stored in:

  1. /etc/passwd
  2. /etc/shadow
  3. /etc/security
  4. /var/log/auth.log
Remember
✅ Answer: (B) — /etc/shadow stores encrypted password hashes with root-only read access. /etc/passwd stores user info but not hashes (marked with 'x').
Q3

Which malware type encrypts files and demands payment for decryption?

  1. Virus
  2. Worm
  3. Spyware
  4. Ransomware
Remember
✅ Answer: (D) Ransomware — It encrypts victim's files and demands a ransom (usually cryptocurrency) for the decryption key. Example: WannaCry, AIIMS Delhi attack (2022).
Q4

The Access Matrix model has rows representing ______ and columns representing ______.

  1. Files; Users
  2. Subjects (users/processes); Objects (files/resources)
  3. Passwords; Permissions
  4. Ports; Protocols
Remember
✅ Answer: (B) — In the Access Matrix, rows = subjects (users, processes, domains) and columns = objects (files, devices, memory). Each cell contains the access rights.
Q5

The chmod 700 file.txt command gives:

  1. Read-only access to everyone
  2. Full access to owner; no access to group and others
  3. Full access to everyone
  4. Write access to group only
Remember
✅ Answer: (B) — 7 = rwx (owner), 0 = --- (group), 0 = --- (others). Only the owner has read, write, and execute permissions.

Understand / Explain (Q6–Q10)

Q6

Why does Linux store password hashes in /etc/shadow instead of /etc/passwd?

  1. Because /etc/passwd is too small
  2. Because /etc/passwd is readable by all users, exposing hashes to offline cracking attacks
  3. Because /etc/shadow is faster to read
  4. Because passwords are not needed in modern systems
Understand
✅ Answer: (B) — /etc/passwd has 644 permissions (world-readable) because many programs need user info. Storing hashes there lets any user copy them for offline brute-force attacks. /etc/shadow restricts access to root only.
Q7

What is the purpose of "salting" in password hashing?

  1. To make the password longer
  2. To add a random value so identical passwords produce different hashes, defeating rainbow table attacks
  3. To encrypt the password for network transmission
  4. To compress the hash for faster storage
Understand
✅ Answer: (B) — A salt is a random string prepended/appended to the password before hashing. Two users with password "password123" will have different hashes because of different salts. This makes precomputed rainbow tables useless.
Q8

How does an Access Control List (ACL) differ from a Capability List?

  1. ACL is stored with each object; Capability List is stored with each subject
  2. ACL is faster; Capability List is slower
  3. ACL uses encryption; Capability List uses hashing
  4. There is no difference
Understand
✅ Answer: (A) — ACL is object-centric ("who can access this file?") stored with the file. Capability List is subject-centric ("what can this user access?") stored with the user/process.
Q9

Why is the Principle of Least Privilege important in OS security?

  1. It makes systems faster
  2. It reduces the potential damage if a component is compromised
  3. It eliminates the need for passwords
  4. It prevents hardware failures
Understand
✅ Answer: (B) — If a process runs with minimum necessary privileges and gets compromised, the attacker can only access what that process could access — not the entire system. This limits the blast radius of a breach.
Q10

What does the setuid bit on a Linux executable do?

  1. Deletes the file after execution
  2. Runs the program with the file owner's privileges, regardless of who executes it
  3. Encrypts the file contents
  4. Prevents the file from being modified
Understand
✅ Answer: (B) — setuid causes the executable to run with the privileges of the file's owner (usually root), not the user who runs it. Example: /usr/bin/passwd runs as root so users can update /etc/shadow.

Apply / Demonstrate (Q11–Q15)

Q11

You want a file to be readable and writable by the owner, readable by the group, and not accessible by others. What chmod command would you use?

  1. chmod 640 file.txt
  2. chmod 777 file.txt
  3. chmod 600 file.txt
  4. chmod 755 file.txt
Apply
✅ Answer: (A) — 6 = rw- (owner: read+write), 4 = r-- (group: read only), 0 = --- (others: no access).
Q12

In the C code char buf[8]; gets(buf);, what happens if the user enters "AAAAAAAAAAAAAAAA" (16 A's)?

  1. The program truncates input to 8 characters
  2. Buffer overflow: excess data overwrites adjacent stack memory
  3. The program rejects the input gracefully
  4. The buffer automatically resizes to 16 bytes
Apply
✅ Answer: (B) — gets() does not check buffer boundaries. Writing 16 bytes into an 8-byte buffer overflows onto the stack, overwriting saved frame pointer and return address.
Q13

To hash a password using SHA-256 in Python, which code is correct?

  1. hashlib.sha256("password")
  2. hashlib.sha256("password".encode()).hexdigest()
  3. hashlib.encrypt("password", "sha256")
  4. sha256.hash("password")
Apply
✅ Answer: (B) — hashlib requires bytes input (.encode()) and .hexdigest() returns the hash as a hexadecimal string.
Q14

A web server process should ideally run with which level of file access?

  1. Root access to all files
  2. Read-only access to web content directory (/var/www/html) only
  3. Write access to all system logs
  4. Full access to /etc/shadow
Apply
✅ Answer: (B) — Principle of Least Privilege. A web server only needs to read HTML/CSS/JS files from its document root. Granting root or broader access creates unnecessary attack surface.
Q15

An attacker enters ' OR '1'='1' -- in a login form. This is an example of:

  1. Buffer overflow
  2. DDoS attack
  3. SQL injection
  4. DNS spoofing
Apply
✅ Answer: (C) SQL injection — The input manipulates the SQL query to always return TRUE, bypassing authentication. Prevention: use parameterized queries (prepared statements).

Analyze / Compare (Q16–Q20)

Q16

In the AIIMS Delhi ransomware attack, the root cause was a buffer overflow in an unpatched server. Which OS-level defence could have most directly prevented the initial exploitation?

  1. A stronger Wi-Fi password
  2. ASLR (Address Space Layout Randomization) and regular security patching
  3. A bigger hard disk
  4. Faster internet connection
Analyze
✅ Answer: (B) — ASLR randomizes memory addresses, making buffer overflow exploitation much harder. Regular patching would have fixed the known vulnerability before attackers could exploit it.
Q17

Compare a virus and a worm. Which statement is correct?

  1. Both need a host program to spread
  2. A virus needs a host program; a worm is standalone and spreads via networks
  3. A worm needs a host; a virus spreads independently
  4. Neither can replicate themselves
Analyze
✅ Answer: (B) — A virus attaches to and modifies legitimate files/programs and activates when the host runs. A worm is a standalone program that self-replicates across networks without needing a host.
Q18

A hospital's patient database uses an access matrix. The receptionist should be able to read patient names and appointment times but NOT medical records. The doctor should have full read/write access. Which matrix configuration is correct?

  1. Receptionist: {PatientInfo: Read, MedicalRecords: Read} / Doctor: {PatientInfo: Read, MedicalRecords: Read}
  2. Receptionist: {PatientInfo: Read} / Doctor: {PatientInfo: Read+Write, MedicalRecords: Read+Write}
  3. Both have identical full access
  4. Neither has any access
Analyze
✅ Answer: (B) — This correctly implements the principle of least privilege. The receptionist has only the access needed for scheduling. The doctor has full access to both patient info and medical records for treatment.
Q19

Why is bcrypt preferred over SHA-256 for password hashing?

  1. bcrypt produces shorter hashes
  2. bcrypt is intentionally slow (adjustable work factor), making brute-force attacks impractical
  3. bcrypt doesn't require a salt
  4. SHA-256 is no longer available in modern systems
Analyze
✅ Answer: (B) — bcrypt has a configurable cost factor that controls how slow the hashing is. This deliberate slowness means an attacker trying billions of guesses per second with SHA-256 can only try thousands per second with bcrypt.
Q20

In a DDoS attack vs a single DoS attack, the key difference is:

  1. DDoS is less dangerous than DoS
  2. DDoS uses multiple compromised machines (botnet) to attack simultaneously, making it harder to filter
  3. DoS uses multiple machines; DDoS uses one
  4. They are identical in technique
Analyze
✅ Answer: (B) — DDoS (Distributed DoS) coordinates attacks from thousands of compromised machines across different IPs and geographies, making it much harder to block compared to a single-source DoS attack.

Evaluate / Judge (Q21–Q25)

Q21

A startup stores user passwords as MD5 hashes without salting. Their security consultant says this is "adequately secure." Is this assessment correct?

  1. Yes, MD5 is a standard hashing algorithm
  2. No — MD5 is fast to compute (brute-forceable) and unsalted hashes are vulnerable to rainbow table attacks
  3. Yes, as long as the database is encrypted
  4. No, but only because MD5 hashes are too long
Evaluate
✅ Answer: (B) — MD5 without salt is dangerously weak. Modern GPUs can compute billions of MD5 hashes per second. Rainbow tables with precomputed MD5 hashes for common passwords are freely available. The startup should migrate to bcrypt or Argon2 immediately.
Q22

India's CERT-In mandates that organisations report cybersecurity incidents within 6 hours. Evaluate whether this is practical for small businesses.

  1. Fully practical — 6 hours is very generous
  2. Impractical for small businesses lacking dedicated security teams, but necessary for national security visibility
  3. Too slow — reporting should be instant
  4. Unnecessary — small businesses are never attacked
Evaluate
✅ Answer: (B) — While the 6-hour mandate helps CERT-In track national-level threats quickly, most small Indian businesses lack dedicated security teams and may not even detect a breach within 6 hours, let alone report it. This highlights the need for affordable automated monitoring tools.
Q23

A company implements ACLs for all files but doesn't use any network security (no firewall, open SSH). How would you evaluate their security posture?

  1. Excellent — ACLs are sufficient
  2. Incomplete — file-level access control without network security leaves the system vulnerable to remote attacks
  3. Over-engineered — they don't need both
  4. ACLs automatically protect against network threats
Evaluate
✅ Answer: (B) — Protection (ACLs) and security (firewalls, network controls) are complementary, not substitutes. ACLs control internal access but can't prevent an attacker from exploiting an open SSH port with a brute-forced password.
Q24

The DPDP Act 2023 imposes penalties up to ₹250 crore for data protection failures. Is this proportionate?

  1. Too harsh — it will bankrupt companies
  2. Proportionate for large companies but may be disproportionate for SMEs; graduated penalties would be better
  3. Too lenient — penalties should be higher
  4. Penalties are irrelevant to data protection
Evaluate
✅ Answer: (B) — ₹250 crore is a strong deterrent for large corporations (like the Aadhaar data breach scenario) but could destroy small businesses. Many countries use percentage-of-revenue penalties (like GDPR's 4% of global revenue) for proportionality.
Q25

A system administrator runs all services (web server, database, email) as root for "convenience." Evaluate this practice.

  1. Efficient — avoids permission issues
  2. Extremely dangerous — violates least privilege; a compromise of any service gives root access to everything
  3. Acceptable for small servers
  4. Recommended by Linux best practices
Evaluate
✅ Answer: (B) — Running services as root means a vulnerability in any one service (e.g., a web server SQL injection) immediately gives the attacker root access to the entire system. Each service should run as a dedicated, unprivileged user.

Create / Design (Q26–Q30)

Q26

You're designing the access matrix for a university portal. Which access rights should a "Student" role have?

  1. Read+Write to all student records, faculty records, and admin settings
  2. Read own grades and attendance; no access to other students' data or admin settings
  3. Full admin access for self-service
  4. No access to any data
Create
✅ Answer: (B) — Following the principle of least privilege, a student should only view their own academic data. They shouldn't access other students' records (privacy) or admin settings (security).
Q27

Design a secure password policy for an Indian e-commerce startup. Which combination is most appropriate?

  1. Minimum 4 characters, no special requirements
  2. Minimum 12 characters, requiring uppercase + lowercase + number + special character, bcrypt hashing with salt, account lockout after 5 failed attempts
  3. Minimum 8 characters, MD5 hashing, no lockout
  4. No password required — use OTP only
Create
✅ Answer: (B) — Strong passwords (12+ chars with complexity), bcrypt hashing (slow by design), salting (defeats rainbow tables), and account lockout (prevents brute force) together form a robust password policy.
Q28

You need to secure a Linux web server. Which combination of measures provides defence-in-depth?

  1. Just a strong root password
  2. Disable root SSH login + SSH key auth + UFW firewall (allow only 80, 443, 22) + fail2ban + automatic security updates + web server running as www-data user
  3. Only enable HTTPS
  4. Just install antivirus software
Create
✅ Answer: (B) — Defence-in-depth layers multiple security controls. Each measure addresses a different attack vector: SSH hardening (remote access), firewall (network), fail2ban (brute force), updates (patching), unprivileged user (least privilege).
Q29

Design an incident response plan for a small hospital (like AIIMS) experiencing a ransomware attack. What should be the FIRST step?

  1. Pay the ransom immediately
  2. Isolate affected systems from the network to prevent lateral spread
  3. Reformat all computers
  4. Send an email to all staff about the attack
Create
✅ Answer: (B) — Network isolation is critical. Ransomware spreads laterally through networks. Disconnecting affected machines prevents further encryption of other systems. Then: assess damage → restore from backups → report to CERT-In within 6 hours.
Q30

Create a permission scheme for a shared Linux server with three user types: Admin, Developer, and Intern. The /var/www/html web directory should be:

  1. 777 for everyone (full access)
  2. Admin: rwx, Developer: rwx (via group), Intern: r-x (read+execute, no write)
  3. 000 (no access for anyone)
  4. Same permissions for all three roles
Create
✅ Answer: (B) — Admin owns the directory (rwx). Developers are in the 'webdev' group with rwx to modify code. Interns can view/test (r-x) but can't modify production code. chmod 775 with Admin as owner and webdev as group, Interns as others.
Section H

Short Answer Questions (5 Questions)

Q1: Explain the difference between Protection and Security in an OS. Why are both necessary?

Model Answer:

Protection is an internal mechanism that controls how users and processes access system resources (files, memory, devices). It ensures that one user's process cannot interfere with another's data. Example: Linux file permissions (chmod 600) prevent other users from reading your private files.

Security is the defence against external and internal threats — hackers, malware, unauthorized access. It includes authentication (passwords, biometrics), encryption (SSL/TLS), and intrusion detection (firewalls, fail2ban).

Why both? Protection without security is like having locks on apartment doors but no boundary wall — internal residents are safe from each other, but anyone from outside can walk in. Security without protection is like a strong boundary wall but no locks on doors — outsiders can't enter, but insiders can access each other's flats. A secure OS needs both layers.

Q2: Describe how a buffer overflow attack works. Include the role of the stack and return address.

Model Answer:

A buffer overflow occurs when a program writes data beyond the allocated boundary of a buffer (e.g., an array). In C, functions like gets() don't check input length.

How it works on the stack:

1. When a function is called, the stack stores: local variables (buffer), saved frame pointer, and the return address (where execution should go after the function ends).

2. If the buffer is 16 bytes but the input is 200 bytes, the excess overwrites the saved frame pointer and return address.

3. The attacker crafts the input so the overwritten return address points to malicious shellcode (also placed in the overflow data).

4. When the function returns, it jumps to the attacker's code instead of the caller, giving them control — potentially root access.

Defences: ASLR, stack canaries, DEP/NX bit, using safe functions (fgets instead of gets).

Q3: What is the Access Matrix? Explain with an example and describe two ways it is implemented in practice.

Model Answer:

The Access Matrix is a protection model that defines which subjects (users/processes) can perform which operations on which objects (files/resources). It's a 2D table where rows = subjects, columns = objects, and cells = access rights (read, write, execute, delete).

Example: In a university system — Student can Read grades.txt; Faculty can Read+Write grades.txt; Admin can Read+Write+Delete grades.txt.

Implementations:

1. Access Control List (ACL): Each object stores a list of (subject, rights) pairs. Column-wise decomposition. Example: Linux file permissions. Easy to check "who can access this file" but hard to find "all files a user can access."

2. Capability List: Each subject stores a list of (object, rights) pairs. Row-wise decomposition. Example: Android app permissions. Easy to check "what can this user access" but hard to revoke access to a specific object across all users.

Q4: Explain the Principle of Least Privilege with two real-world examples.

Model Answer:

The Principle of Least Privilege states that every user, process, and program should operate with the minimum set of permissions necessary to complete its task — nothing more.

Example 1 — Web Server: An Apache web server process should only have read access to /var/www/html (to serve web pages) and should NOT run as root. If the web server is compromised, the attacker can only read web files, not the entire filesystem or /etc/shadow.

Example 2 — Mobile Apps: A calculator app on your Android phone should NOT request access to contacts, camera, or location. If it does, it's likely violating least privilege and may be spyware. Android 13+ enforces granular permission controls.

In the AIIMS attack: If the compromised server had been restricted to only patient scheduling data (not the entire database), the 40 million patient records wouldn't have been at risk.

Q5: Compare viruses, worms, and trojans. How does each spread and what makes each dangerous?

Model Answer:

FeatureVirusWormTrojan
Self-Replicates?YesYesNo
Needs Host?Yes (attaches to files)No (standalone)No (disguised as legit app)
Spread MethodInfected files shared via USB, email, downloadsNetwork — auto-spreads via vulnerabilitiesUser downloads/installs fake app
Primary DangerCorrupts/destroys filesConsumes bandwidth, crashes networksCreates backdoors, steals data
ExampleCIH/Chernobyl virusWannaCry, SlammerFake Aarogya Setu APK

Key Insight: A virus is like a disease that infects healthy files. A worm is like a contagious plague that spreads through the network on its own. A trojan is like a spy disguised as a friend — it doesn't spread, but it opens the door for attackers.

Section I

Case Studies

📋 Case Study 1: AIIMS Delhi Ransomware Attack (November 2022)

Background:

AIIMS Delhi, India's premier medical institution, suffered a devastating ransomware attack on 23rd November 2022. The attack encrypted data across 5 servers hosting approximately 1.3 TB of data. Hospital operations — including OPD, emergency, lab reports, and billing — were disrupted for nearly 15 days. An estimated 30–40 million patient records were at risk, including those of former Prime Ministers, Supreme Court judges, and senior bureaucrats.

Technical Analysis:

  • Entry Point: A buffer overflow vulnerability in an unpatched server allowed initial code execution.
  • Lateral Movement: After gaining access, attackers escalated privileges and moved laterally through the network, which lacked proper segmentation.
  • Encryption: Ransomware encrypted critical databases. The attackers demanded ₹200 crore in cryptocurrency.
  • Recovery: CERT-In, NIA, and Delhi Police IFSO were involved. Data was eventually recovered from backups (though some were outdated).

Security Failures Identified:

  1. Unpatched servers (known vulnerability exploited)
  2. Lack of network segmentation — one compromised server gave access to the entire network
  3. Services running with excessive privileges (violation of least privilege)
  4. Outdated backup strategy — no recent offline backups
  5. No intrusion detection system (IDS) to flag suspicious activity

Discussion Questions:

Q1: Map each security failure to a specific protection mechanism discussed in this chapter. Which mechanism would have prevented each failure?

Q2: The ransom demand was ₹200 crore. Should AIIMS have paid? Discuss the ethical and practical considerations.

Q3: Design a post-incident security architecture for AIIMS using the principle of least privilege, network segmentation, and mandatory access control.

📋 Case Study 2: Aadhaar Data Breach Controversy

Background:

In January 2018, The Tribune newspaper reported that Aadhaar data (name, address, phone number, email, and even bank details linked to Aadhaar) of over 1 billion Indians was being sold on WhatsApp for as little as ₹500. The seller provided an unauthorized login to the UIDAI system that allowed searches by Aadhaar number. A few months later, a French security researcher demonstrated that an unprotected API endpoint could be used to access Aadhaar details.

Technical Analysis:

  • Access Control Failure: API endpoints were not properly authenticated. Some endpoints allowed unauthenticated queries.
  • Excessive Access Rights: Authorized users (ration shop operators, telecom agents) had broader access than needed — violating the principle of least privilege.
  • Lack of Audit Trails: Unauthorized access was not detected for months, indicating insufficient logging and monitoring.
  • Scale: With 1.4 billion Aadhaar numbers, even a small vulnerability affects hundreds of millions.

UIDAI's Response:

  • Denied large-scale breach; claimed data was encrypted with 2048-bit encryption
  • Filed FIR against The Tribune journalist (controversial — criticised as shooting the messenger)
  • Implemented Virtual ID system — users can generate a temporary virtual Aadhaar number for verification instead of sharing actual Aadhaar number
  • Enhanced API security with token-based authentication and rate limiting

Discussion Questions:

Q1: How could a proper Access Matrix implementation have prevented unauthorized data access by ration shop operators?

Q2: Evaluate the DPDP Act 2023's effectiveness in preventing future Aadhaar-like breaches. What additional measures would you recommend?

Q3: UIDAI filed an FIR against the journalist who exposed the breach. Discuss: Is this approach beneficial or harmful to cybersecurity?

Section J

Chapter Summary

🔑 Key Takeaways — Unit 6: Protection & Security

1. Protection vs Security: Protection controls internal access to resources (file permissions, access matrices). Security defends against external/internal threats (authentication, encryption, malware defence). Both are essential.

2. Buffer Overflow: The #1 OS vulnerability. Writing beyond buffer boundaries can overwrite return addresses, letting attackers hijack execution. Defences: ASLR, stack canaries, DEP, safe coding practices.

3. Authentication: Linux uses /etc/passwd + /etc/shadow for secure password storage. Passwords should be hashed (bcrypt/Argon2) with salts. SSL/TLS secures network communication.

4. Malware Types: Virus (host-dependent), Worm (self-spreading via network), Trojan (disguised), Ransomware (encrypts for ransom), Spyware (monitors silently). Each requires different defence strategies.

5. Access Matrix: Rows = subjects, Columns = objects, Cells = rights. Implemented as ACLs (object-centric, used in Linux/Windows) or Capability Lists (subject-centric, used in Android).

6. Principle of Least Privilege: Every component should have minimum necessary access. Limits damage when breaches occur.

7. Network Threats: DoS/DDoS (flooding), MITM (interception), SQL injection (database manipulation), Port scanning (reconnaissance).

8. Indian Legal Framework: IT Act 2000 (cyber offences), CERT-In (6-hour incident reporting), DPDP Act 2023 (data protection, ₹250 crore penalties).

Section K

Earning Checkpoint — What You Can Do Now

Skill LearnedTool/PlatformPortfolio DeliverableEarning Ready?
Linux File PermissionsUbuntu, chmod, chownPermissions Lab Screenshot + Report✅ Yes — sysadmin entry skill
Password HashingPython hashlib, bcryptPassword Security Demo Script✅ Yes — backend security skill
Security ConceptsConceptual✅ Yes — interview ready
Security HardeningLinux CLI, UFW, fail2banLinux Hardening Checklist PDF✅ Yes — ₹5K–₹20K/project
Access Control DesignConceptual + Linux ACLsAccess Matrix Design Document✅ Yes — can pitch to startups
Indian Cyber LawIT Act, DPDP Act✅ Yes — compliance consulting
Minimum Viable Earning Setup after this chapter: A LinkedIn profile highlighting "Linux Security" + a security hardening checklist sample + an Upwork/Fiverr profile offering server security audits = you can earn ₹5,000–₹20,000/month from security consulting gigs while still in college.

✅ Unit 6 complete. MCQs: 30. Ready for Unit 7: Memory Management!

[QR: Link to EduArtha video tutorial — OS Protection & Security]