42. Evading IDS, Firewalls and Honeypots – Detection Games
42.8 Lab – Suricata or firewalld Logging on OWN VM
Pick one Blue stack (both if time). Target stays host-only.
Path A – Suricata (Ubuntu often easiest; Amazon Linux 2023: try yum, extras, or use Ubuntu sensor VM):
# Amazon Linux / CentOS-style
sudo yum install suricata
# Ubuntu:
# sudo apt update && sudo apt install -y suricata
sudo service suricata start
sudo service suricata status
# Confirm interface in /etc/suricata/suricata.yaml (host-only nic – name varies)
# Set HOME_NET to "[192.168.56.0/24]" then:
sudo service suricata restart
sudo tail -f /var/log/suricata/fast.log
# JSON (if eve enabled):
# sudo tail -f /var/log/suricata/eve.json
Path B – firewalld only (Amazon Linux friendly):
sudo yum install firewalld
sudo systemctl enable firewalld
sudo service firewalld start
sudo firewall-cmd --set-log-denied=all
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.56.0/24" port port="1-1024" protocol="tcp" log prefix="LAB-SCAN " level="warning" drop'
# (lab example – don't blindly drop 22 if you still need SSH; exclude mgmt port)
sudo firewall-cmd --reload
sudo tail -f /var/log/messages
Then from Kali (OWN only):
nmap -sS -T2 192.168.56.20
nmap -sS -T2 -p 22,80,443 192.168.56.40
Expected: some alert or LAB-SCAN / denied line. If zero: wrong NIC, HOME_NET, or VirtualBox host-only promiscuous mode off (needed only if sensor is not the destination). Ghabru naka – debugging the sensor is the lab.
| Red team (attacker) does | Blue team (defender) detects / stops |
|---|---|
| Nmap against OWN Metasploitable / edge VM | fast.log / eve.json / firewalld denied with src 192.168.56.10 |
| Hopes student left Suricata stopped | sudo service suricata status in the lab checklist |
| Scans too fast and blames IDS for "spam" | Use -T2; tune SID; don't disable the engine |
Ravindra Bagale's Tip
Students copy-paste systemctl start – in our notes it is sudo service suricata start, with enable only for boot. After editing the yaml, restart and prove it with tail. Interview: walk through "install → HOME_NET → generate traffic → show alert". Keep this in mind.
Ravindra Bagale's Tip – मराठी
Students systemctl start copy-paste करतात – आपल्या notes मध्ये sudo service suricata start, enable फक्त boot साठी. Yaml edit नंतर restart आणि tail ने prove करा. Interview: "install → HOME_NET → generate traffic → show alert" सांगा. लक्षात ठेवा.
Ravindra Bagale's Tip – हिंदी
Students systemctl start copy-paste करते हैं – हमारे notes में sudo service suricata start, enable सिर्फ़ boot के लिए. Yaml edit के बाद restart और tail से prove करो. Interview: "install → HOME_NET → generate traffic → show alert" बताओ. ध्यान रखो.
Lab
Pair: Amir installs Path A or B on .40; Zoya runs the two nmap lines from Kali. Both sign the ethics line (host-only). Screenshot alert + matching nmap timestamp. Revert if rules lock you out of SSH.
Extended teaching notes
Why this lesson matters
A SOC turns logs into action. Good juniors triage with playbooks: what fired, which asset, how bad, contain or escalate, write the timeline.
- Prepare: asset list, contacts, runbooks.
- Detect: SIEM/EDR alerts with context.
- Contain: disable account, isolate host, block IOC.
- Eradicate & recover: patch, rebuild, restore.
- Lessons: one improvement ticket per incident.
Indian company (sample)
A 24×7 SOC at a large Indian IT services firm handles phishing and malware for many clients. Tier-1 analysts follow a script; they do not freestyle on production.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.