Network Security & Perimeter Monitoring
The Big Picture
An enterprise network is one connected ecosystem. Compromise one part and the attacker can reach the rest. The perimeter is the boundary between your network and the internet, and it's where attackers start. So it's usually where the SOC sees them first.
This room teaches four things:
- What is in a network, and why attackers want each part
- How we see what's happening (host vs network logs)
- Where the perimeter is and what defends it
- How to investigate a real attack through the logs, from first scan to stolen data
1. Network Components — What Attackers Want and What to Watch
| Component | What it does | Why attackers want it | What to monitor |
|---|---|---|---|
| Workstations (endpoints) | PCs and laptops employees use | Most common entry point (phishing, malicious downloads). Often less monitored | Endpoint logs → malicious processes. Network logs → C2 connections (often visible here first) |
| File & database servers | Store the business's data: shared files, customer, HR and financial records | Data theft; ransomware targets file servers for maximum damage; exfiltration | Unusual access, large transfers out |
| Application servers (web, email, VPN) | Services for employees and customers | Internet-facing, so scanned constantly for vulnerabilities and weak configs. One exploit gives a foothold inside | App logs, firewall alerts, IDS signatures: exploit attempts (SQL injection), brute force (email/VPN), suspicious external IPs |
| Active Directory / authentication | Identity backbone: users, groups, computers, access rights | Privilege escalation, persistence, lateral movement. One compromised domain admin = the whole enterprise | Auth logs: many failures (password spraying), odd hours/external IPs, accounts touching systems they shouldn't |
| Routers & switches | Routers link networks (LAN ↔ internet); switches link devices in one LAN. The circulatory system | Rarely exposed, but if owned: Man-in-the-Middle, backdoors via rerouting, hidden channels to the internet | Config changes, flow data |
| Firewalls / perimeter devices | Primary security gateway: allow or block traffic by rules. Modern ones also do app inspection, intrusion prevention, malware detection | Bypass = direct access | Every connection, allowed or blocked. Often the earliest sign of scans, brute force and exploits |
| Wireless access points | (Mentioned in the room summary) Connect Wi-Fi devices | Rogue or weak Wi-Fi = entry that skips the perimeter | Unknown devices, rogue APs |
One-line summary: endpoints are the door, AD is the master key, servers hold the treasure, the firewall is the gate, and routers/switches are the roads.
2. Visibility — You Can't Defend What You Can't See
Network visibility = being able to monitor and understand what's happening across the network. It's not about tracking every packet. It's about having the sources to build a clear picture.
What visibility enables
| Capability | Meaning |
|---|---|
| Detect anomalies | Spot unusual patterns |
| Investigate incidents | Rebuild what happened |
| Hunt for threats | Proactively search for hidden attackers |
| Ensure compliance | Meet legal and regulatory logging requirements |
Two kinds of logs
| Host-centric logs | Network-centric logs | |
|---|---|---|
| Come from | Individual devices: servers, workstations, laptops | Network appliances watching traffic pass |
| Tell you | What happened ON a machine | What happened BETWEEN machines |
| Analogy | What happened inside a room | Who entered and left the building |
| View | Ground-level, detailed | Bird's-eye overview |
| Sources | OS logs (Windows Event Logs, Linux syslog, macOS logs), application logs (Apache, Nginx, MySQL, MSSQL), security tools (antivirus, EDR, HIDS) | Firewalls, IDS/IPS, routers/switches (flow data), web proxies, VPN |
| Answers | Which files were touched? Which process ran? Was PowerShell used? Who logged in with what privileges? What did the malware change (registry, files, services)? | When, where, how? Recon attempts, C2, lateral movement, exfiltration, scope of the attack |
Network-centric sources in detail
| Source | What it records | Best for |
|---|---|---|
| Firewall | Every connection allowed or denied | First place to look for unauthorized connections from the internet |
| IDS/IPS | Traffic matching signatures (known attacks) or anomalies (unusual behaviour) | Detecting active attacks in real time, and they say why something was flagged |
| Routers & switches | Flow data: who talked to whom, for how long, how much | High-level overview |
| Web proxy | Every website users visit | Web threats, policy violations, exfiltration via web |
| VPN | Who connected remotely, from where, when | Remote-access security |
The key rule: neither log type is enough alone. Correlate both to build an accurate incident timeline.
3. The Network Perimeter
Perimeter = the boundary separating the internal network (trusted) from the internet (untrusted). All traffic in or out must pass through it, like the main gate of a secure building.
- It's not one device. It's a collection of controls working together.
- It's no longer just hardware at the edge: it also includes virtual gateways, cloud connections and remote access points.
Perimeter components
| Component | Role |
|---|---|
| Firewall | Gatekeeper: inspects and filters traffic |
| Router / gateway | Routes traffic and enforces access rules |
| DMZ (Demilitarized Zone) | A buffer segment for public-facing servers (web, mail, VPN) |
| Remote access gateway / VPN | Secure entry for employees outside the office |
Small enterprise layout
INTERNET (untrusted)
│
[ ROUTER ]
│
[ FIREWALL ] ─────── [ DMZ ] ← web server (public can reach it)
│
┌─────────────┼──────────────┐
[ AD server ] [ File server ] [ Database ] ← INTERNAL: employees only
│
[ Workstations ]
Remote employees ──► [ VPN gateway ] ──► internal networkWhy a DMZ? The public has to reach the web server, so it's exposed. Putting it in a separate zone means that if it's hacked, the attacker is still outside the internal network. Public services stay isolated; only controlled traffic reaches inside.
Why the perimeter matters
Attackers always probe from the outside first. A weak or misconfigured perimeter allows:
- Exploiting exposed services (RDP, SSH, MySQL, SMB) → unauthorized access
- Scanning and reconnaissance → mapping your network
- Brute-force attacks on login services
- Exfiltration channels → data breaches
- Malware infiltration
The analyst's job at the perimeter
- Review firewall logs (blocked and allowed)
- Spot scanning and brute-force attempts
- Flag unusual outbound traffic (beaconing, exfiltration)
- Know what should and shouldn't be exposed (e.g. RDP on the internet = never)
4. Reading Perimeter Logs — Three Classic Patterns
Scenario 1: Port scan (firewall log)
08:30:04 ALLOW TCP 198.51.100.45:49876 -> 10.0.0.51:80 ← normal web visitor
08:30:05 BLOCK TCP 203.0.113.10:50001 -> 10.0.0.20:21 ┐
08:30:06 BLOCK TCP 203.0.113.10:50002 -> 10.0.0.20:22 │
08:30:07 ALLOW TCP 192.0.2.115:51235 -> 10.0.0.50:443 │ same IP,
08:30:08 BLOCK TCP 203.0.113.10:50003 -> 10.0.0.20:23 │ same target,
08:30:09 BLOCK TCP 203.0.113.10:50004 -> 10.0.0.20:25 │ different port
08:30:11 BLOCK TCP 203.0.113.10:50005 -> 10.0.0.20:53 ┘ every secondClues: one source → one host → many ports → in seconds. The ports (21 FTP, 22 SSH, 23 Telnet, 25 SMTP, 53 DNS) are common services. Even the source port counts up by 1 (50001, 50002...), a sign of a scanning tool. Verdict: port scan. The attacker is looking for an open service. The firewall blocked it, but this IP is now on your watchlist.
Scenario 2: Web attacks (WAF log)
A WAF (Web Application Firewall) inspects web requests and says what kind of attack it saw. That's more context than a normal firewall gives.
action=ALLOW request="GET /index.html" ← normal
action=ALLOW request="GET /products.php?id=9" ← normal
action=BLOCK request="GET /search.php?q=<script>alert('XSS')</script>" rule_id=941100 attack_type=XSS
action=ALLOW request="GET /css/style.css" ← normal
action=BLOCK request="GET /../../../../etc/passwd" rule_id=930120 attack_type="Directory Traversal"| Attack | What the request tries to do | Giveaway |
|---|---|---|
| SQL Injection | Trick the database into dumping data | SQL fragments in input: ' OR 1=1, UNION SELECT |
| XSS (Cross-Site Scripting) | Inject malicious scripts that run in other users' browsers | <script> in input |
| Directory traversal | Climb out of the web folder to read server files | ../../ and paths like /etc/passwd |
Fast triage: filter action=BLOCK → the WAF has already found and labelled the threats.
Verdict: one source trying several attack types = high-confidence, active targeting of the website.
Scenario 3: VPN brute force
10:12:08 FAILED_AUTH [REDACTED]:31249 -> 10.0.0.1:443 (user 'guest')
10:12:09 FAILED_AUTH [REDACTED]:31250 -> 10.0.0.1:443 (user 'user')
10:12:11 FAILED_AUTH [REDACTED]:31245 -> 10.0.0.1:443 (user 'admin')
10:12:15 FAILED_AUTH [REDACTED]:31248 -> 10.0.0.1:443 (user 'admin')
10:12:21 SUCCESS_AUTH 198.51.100.88:41233 -> 10.0.0.1:443 (user 'b.jones') ← normal employeeMethod: group by source IP → one IP has hundreds of failures in a short time.
Clues: generic usernames (admin, guest, user, root, test) = a username list, not a real person who forgot their password.
Verdict: brute force against the VPN. The scattered successes from other IPs are normal employees.
⚠️ Notice the course's log isn't in time order (10:12:21 comes before 10:12:08). Real logs often arrive out of order, so sort by timestamp before building a timeline.
Pattern cheat sheet
| Pattern in the logs | What it means |
|---|---|
| One source → many ports/hosts | Scanning |
| One source → one target, repeated logins | Brute force |
| One source → many accounts, few tries each | Password spraying |
| Traffic at perfectly regular intervals | Malware beaconing (C2) |
| Large or repeated outbound uploads | Data exfiltration |
| Compromised internal host → many internal hosts | Lateral movement |
Context beats volume. An IDS alert that says why something was flagged is worth more than a plain firewall block.
5. The Investigation — Following One Attack End to End
The challenge reconstructs a complete attack using three files: firewall.log, ids_alerts.log, vpn_auth.log.
The method: find a suspicious indicator → pivot → find the next one. Each answer becomes the next search.
The attack chain you uncover
1. RECON external IP scans the perimeter (firewall BLOCKs)
2. INITIAL ACCESS firewall ALLOWs + VPN brute force works (firewall ALLOW, vpn_auth)
3. FOOTHOLD attacker gets an internal VPN IP (vpn_auth assigned_ip)
4. LATERAL MOVE internal IP probes/exploits other hosts (firewall + IDS)
5. C2 compromised host beacons to port 4444 (IDS TROJAN alerts)
6. EXFILTRATION large HTTP POST uploads out (firewall + IDS)Step 0 — Look at each log first
head firewall.log # first 10 lines: date time ACTION proto src:port -> dst:port
head ids_alerts.log # signature ID, alert name, classification, priority
head vpn_auth.log # date time src_ip user SUCCESS/FAIL assigned_ipAlways learn the format first. You need to know which field is which before you can use cut.
Step 1 — Reconnaissance: who's getting blocked?
cat firewall.log | grep "BLOCK" | head→ An external IP is probing internal IPs on 22, 23, 21, 445, 3389 (SSH, Telnet, FTP, SMB, RDP), exactly the services that should never be exposed.
Which IP has the most blocks?
cat firewall.log | grep "BLOCK" | cut -d' ' -f5 | cut -d: -f1 | sort | uniq -c | sort -nrcut -d' ' -f5→ 5th space-separated field =src_ip:portcut -d: -f1→ keep only the part before:= the IP- Result: one IP with 279 blocks stands out → the suspect.
Step 2 — Did anything get through?
cat firewall.log | grep <suspect_ip> | grep "ALLOW"→ ALLOWED connections from the suspect to 4444, 445, 22, 3389, 23.
- The firewall blocked some and allowed others: a misconfiguration.
- Port 4444 is the default Metasploit listener port, a big red flag.
Step 3 — Credential access: VPN brute force
cat vpn_auth.log | grep FAIL | cut -d' ' -f3 | sort | uniq -c | sort -nr- Field 3 = source IP → the suspect has 118 failed logins.
cat vpn_auth.log | grep <suspect_ip>02:19:00 svc_[REDACTED] FAIL
02:19:10 svc_[REDACTED] FAIL ← every 10 seconds = automated tool
02:19:20 svc_[REDACTED] FAIL
02:19:30 svc_[REDACTED] FAIL
...
02:19:40 svc_[REDACTED] SUCCESS assigned_ip=[REDACTED] ← BREACHWhat happened: repeated failures against one account → then SUCCESS → the VPN gave the attacker an internal IP. They're inside now.
Why a svc_ account? Service accounts (used by applications, not people) are prime targets: their passwords often never expire, they usually have no MFA, they often have broad privileges, and nobody notices odd logins on them.
Pivot: the assigned internal IP is now the compromised host. Search for it next.
Step 4 — Lateral movement
cat firewall.log | grep <compromised_internal_ip> | grep "ALLOW" | head06:00:00 → :22 06:10:00 → :445 06:20:00 → :22
06:40:00 → :3389 07:30:00 → :22 08:00:00 → :22→ The compromised host is probing 10.0.0.20, 10.0.0.51, 10.0.0.60 on SMB / RDP / SSH (445 / 3389 / 22). These are the classic remote access and file sharing services used to spread. → The neat 10-minute spacing again suggests automation.
Confirm with the IDS:
cat ids_alerts.log | grep <compromised_ip> | head→ Possible SSH Scan, Possible MS-SMB Lateral Movement, Possible RDP Brute Force, all Priority 1.
Narrow to SMB:
cat ids_alerts.log | grep -n <compromised_ip> | grep 'SMB' | cut -d' ' -f6,7,8,9,10,19,21 | headgrep -n→ adds line numbers (handy for jumping back to the full line)cut ... -f6,7,...→ keep only the alert name and IP fields so it's readable → Repeated MS-SMB Lateral Movement to port 445 → SMB exploited, lateral movement achieved.
Step 5 — Command & Control (C2) beaconing
cat ids_alerts.log | grep C2 | head2025-09-11 01:00:00 ET TROJAN Possible C2 Beaconing
2025-09-11 07:00:00 ET TROJAN Possible C2 Beaconing
2025-09-11 13:00:00 ET TROJAN Possible C2 Beaconing
2025-09-11 19:00:00 ...→ Exactly every 6 hours, to the second. Perfectly regular timing = a machine, not a human. That's what beaconing means: the malware checks in with the attacker's server on a schedule. → Classification: "A network Trojan was detected", Priority 1.
Summarize all alerts for the infected host:
cat ids_alerts.log | grep -n <compromised_ip> | cut -d' ' -f6,7,8,9,10,19,22,23 | sort | uniq -c | sort -nr | headCorrect counts (from the course's own screenshot):
80 TROJAN Possible C2 Beaconing → :4444
32 INFO Possible HTTP POST Large → :80
28 INFO Possible HTTP POST Large → :8080
23 POLICY Suspicious HTTP
2 WEB_SERVER Possible SQL Injection → various ports→ The external IP on port 4444 is the C2 server. The internal network is fully compromised.
Step 6 — Data exfiltration
cat firewall.log | grep <compromised_ip> | cut -d' ' -f5,6,7 | sort | uniq[host]:40000 -> [external]:8080
[host]:40001 -> [external]:8080
[host]:40003 -> [external]:80
... (40000, 40001, 40002 ... sequential source ports)→ Many connections to an external IP on 80 / 8080 (web ports, which blend in with normal traffic). → Sequential source ports = a script sending data in chunks.
cat ids_alerts.log | grep <compromised_ip> | tail→ ET INFO Possible HTTP POST Large Upload | Classification: Potential Data Exfiltration, every 4 hours.
- POST = sending data to a server. Large POSTs out of a network = data leaving.
Verdict: evidence of data exfiltration.
The whole story in one table
| Stage | Evidence | Log |
|---|---|---|
| Recon | External IP: 279 BLOCKs across 21/22/23/445/3389 | firewall |
| Misconfig | Same IP ALLOWED on 4444/445/22/3389 | firewall |
| Credential access | 118 FAILs on a svc_ account, then SUCCESS | vpn_auth |
| Foothold | VPN assigned an internal IP | vpn_auth |
| Lateral movement | Internal IP → 3 hosts on 445/3389/22; SMB exploit alerts | firewall + IDS |
| C2 | 80 beaconing alerts → port 4444, every 6 h | IDS |
| Exfiltration | Large HTTP POSTs to external 80/8080, every 4 h | firewall + IDS |
Lesson: no single log showed the attack. Firewall + VPN + IDS together, each pivot feeding the next, revealed the full chain.
6. Linux Command Toolkit
| Command | What it does | Example |
|---|---|---|
head | First 10 lines (-n 15 for 15) | head firewall.log |
tail | Last 10 lines | tail ids_alerts.log |
cat | Print the whole file | cat vpn_auth.log |
grep "X" | Keep lines containing X | grep "BLOCK" |
grep -n | …and show line numbers | grep -n 10.0.0.5 |
grep -v | Keep lines NOT containing X | grep -v "ALLOW" |
cut -d' ' -f5 | Split by space, keep field 5 | extract src:port |
cut -d: -f1 | Split by :, keep field 1 | ip:port → ip |
cut -f6,7,8 | Keep several fields | readable alert summary |
sort | Sort lines alphabetically | groups identical lines together |
sort -n / -nr | Sort numerically / numerically reversed (largest first) | rank counts |
uniq | Remove adjacent duplicate lines | |
uniq -c | Count adjacent duplicates | |
| (pipe) | Send one command's output into the next | chain filters |
⚠️ The sort/uniq trap — the course's own screenshots prove it
uniq only merges duplicates that are next to each other. If identical lines are scattered, it counts them as separate groups.
The course ran the same search in two orders:
| Pipeline | Result for C2 Beaconing |
|---|---|
... | uniq -c | sort -nr ❌ (no sort before uniq) | 32, then 3, then 2 more: the same alert split into fragments |
... | sort -nr | uniq -c ✅ (sorted first) | 80: the true total |
Always use:
... | sort | uniq -c | sort -nr
# group count biggest first- First
sort→ puts identical lines next to each other uniq -c→ counts each group correctly- Last
sort -nr→ ranks by count, biggest offender on top
The universal "who's doing this most?" recipe:
cat file.log | grep "<filter>" | cut -d' ' -f<field> | sort | uniq -c | sort -nr | head7. Method 2 — Splunk (a SIEM)
Manual grep is fine for small files but tedious at scale. Splunk ingests logs from all sources into one searchable place.
Access: browser → localhost:8000 → Search & Reporting → search index="network_logs"
The logs are already loaded:
| Sourcetype | Events | Share |
|---|---|---|
firewall_logs | 1,284 | 51.67% |
ids_logs | 983 | 39.56% |
vpn_logs | 218 | 8.77% |
| Total | 2,485 | 100% |
Splunk terms:
| Term | Meaning |
|---|---|
| index | The storage bucket the logs live in (network_logs) |
| sourcetype | The type/format of log (firewall, IDS, VPN) |
| source | The original file (ids_alerts.json) |
| host | The machine that sent the logs (perimeter_logs) |
| Fields sidebar | Click any field (e.g. sourcetype, action, alert) → Top values, Rare values, Events with this field |
The same investigation as Splunk searches (SPL). Field names here are typical; confirm the exact names in the Fields sidebar:
index="network_logs" sourcetype="firewall_logs" action="BLOCK" | stats count by src_ip | sort -count
index="network_logs" sourcetype="vpn_logs" "FAIL" | stats count by src_ip | sort -count
index="network_logs" sourcetype="ids_logs" "C2" | table _time alert src_ip dest_ip
index="network_logs" "<suspect_ip>" | sort _timestats count by X= Splunk's version ofsort | uniq -c, but always correct, with no adjacency trap.sort -count= biggest first.- The last search shows every log type for one IP in time order: an instant cross-log timeline.
8. The Analyst's Role
- Recognize normal vs suspicious traffic (know the baseline)
- Escalate unusual activity to higher SOC tiers (L2/L3), with your evidence
- Understand how each component fits into enterprise defense
Core Rules
- Endpoints are the door, AD is the master key, the perimeter is the gate.
- Host logs = inside the room; network logs = who came and went. Correlate both.
- The perimeter is where attackers show up first, so watch it closely.
- Read the pattern: many ports = scan; many logins = brute force; regular timing = beaconing; big uploads = exfiltration.
- Check ALLOWs, not just BLOCKs. Blocks show attempts; allows show successes.
- Pivot: every suspicious value (IP, user, assigned IP) is the next search.
- Always
sortbeforeuniq -c. - Context beats volume. An IDS/WAF alert that says why beats a bare block.
Port Cheat Sheet (ports in this room)
| Port | Service | Why attackers care |
|---|---|---|
| 21 | FTP | Cleartext file transfer, weak logins |
| 22 | SSH | Remote command-line access, brute force |
| 23 | Telnet | Cleartext remote access, should never be exposed |
| 25 | SMTP | Email: relay abuse, phishing |
| 53 | DNS | Tunneling and exfiltration channel |
| 80 | HTTP | Web: exploits, cleartext, exfiltration that blends in |
| 443 | HTTPS | Encrypted web; VPN gateways often use it |
| 445 | SMB | Windows file sharing: lateral movement, ransomware spread |
| 3389 | RDP | Remote desktop: #1 brute-force target, never expose it |
| 4444 | (Metasploit default) | Common attacker listener / C2 port |
| 8080 | HTTP alternate | Proxies, web apps, exfiltration |
Acronyms
| Acronym | Meaning |
|---|---|
| AD | Active Directory |
| C2 | Command and Control |
| DMZ | Demilitarized Zone |
| EDR | Endpoint Detection and Response |
| HIDS | Host-based Intrusion Detection System |
| IDS / IPS | Intrusion Detection / Prevention System |
| LAN / WAN | Local / Wide Area Network |
| MFA | Multi-Factor Authentication |
| MitM | Man-in-the-Middle |
| RDP | Remote Desktop Protocol |
| SIEM | Security Information and Event Management (e.g. Splunk) |
| SMB | Server Message Block |
| SOC | Security Operations Center |
| SPL | Search Processing Language (Splunk's query language) |
| SQL | Structured Query Language |
| SSH | Secure Shell |
| VPN | Virtual Private Network |
| WAF | Web Application Firewall |
| XSS | Cross-Site Scripting |
| ET | Emerging Threats, the IDS rule set naming these alerts (ET TROJAN, ET SCAN) |
Network Discovery & Scanning Detection
The Big Picture
Before attacking, an attacker has to find a way in. Scanning is how they map your attack surface. Defenders scan too, and so do search engines and researchers. So the SOC's real job isn't "detect scanning". It's:
Tell good scanning from bad, and work out how far the attacker has already got.
The single most important question about any scan: Where did it come from?
- Outside → in = attacker is still knocking on the door (low severity)
- Inside → in = attacker is already in the house (high severity)
1. Attack Surface — What Everyone Is Trying to Map
Attack surface = all of an organization's assets reachable from the public internet.
Same activity, opposite goals
| Attacker | Defender | |
|---|---|---|
| Wants to know | What assets can I reach? | What assets do we have? (inventory, everything documented) |
| IPs, ports, OS, services running | Is anything open that shouldn't be? | |
| Service versions: any exploitable vulnerability? | Are vulnerabilities patched (at least the exploitable ones)? | |
| Goal | Find an opening | Shrink the attack surface |
Attacker and defender run the same scans and get the same answers. The difference is what they do with them.
2. The Detection Problem — Good vs Bad Discovery
Scanning comes from many sources:
- Attackers
- Your own security team (vulnerability scanners, asset discovery)
- Search engines and web crawlers
- Research organizations mapping the internet
Alerting on all of it = drowning in noise. SOC teams handle it three ways:
| Technique | How it works | Weakness |
|---|---|---|
| 1. Allowlist known scanners | Internal scanners and known benign external scanners don't trigger alerts | Creates a blind spot: if an allowlisted scanner host is compromised, the attacker scans invisibly |
| 2. Threat-intel–only alerting | Alert only when the scanning source is a known malicious/suspicious IP | Misses new attackers whose IPs aren't in any feed yet |
| 3. Threat intel raises severity (best practice) | Alert on scanning behaviour generally; threat intel raises the priority when the source is known-bad | More alerts to handle, but nothing is silently dropped |
The lesson: threat intel is best for ranking alerts, not as the only reason to alert.
Know your own scanners
Organizations run internal scans to find vulnerabilities, spot rogue assets, and reduce the attack surface. A SOC analyst should know:
- Which IPs the authorized scanners run from
- What type of scan they do
- When they're scheduled
These should be excluded from detection rules to reduce noise. Good practice: allowlist by source IP + expected schedule. A "scanner" running at 3 AM outside its window is suspicious.
3. External vs Internal Scanning — The Severity Rule
| External scanning | Internal scanning | |
|---|---|---|
| Source → destination | Public IP → organization's IP (usually public-facing assets on the perimeter) | Private IP → private IP (inside → inside) |
| What it means | Attacker has no foothold yet, looking for initial access | Attacker already has a foothold, preparing to move |
| MITRE ATT&CK tactic | Reconnaissance (TA0043) | Discovery (TA0007), also called "internal reconnaissance" |
| Severity | 🟢 Low | 🔴 High |
| Response | Block the IP on the perimeter firewall | Rule out authorized activity → escalate → start Incident Response → root cause analysis |
| Why that response | Attacker is still outside, so blocking stops this attempt | Attacker is inside. Blocking one IP doesn't remove them from the compromised machine |
Caveats
- External: blocking an IP is whack-a-mole. Attackers return from a new IP (VPNs, proxies, cloud servers, botnets). It also matters what followed the scan: a scan followed by a successful connection is no longer low severity.
- Internal: always check first that it isn't your own vulnerability scanner or IT team. That's the most common "false alarm".
Private IP ranges (how to recognize "internal")
| Range | Typical use |
|---|---|
10.0.0.0/8 (10.x.x.x) | Large corporate networks |
172.16.0.0/12 (172.16.x.x – 172.31.x.x) | Corporate / cloud |
192.168.0.0/16 (192.168.x.x) | Small offices, home networks |
Both source and destination in these ranges = internal scanning.
4. MITRE ATT&CK — Where Scanning Sits
MITRE ATT&CK = a public knowledge base of adversary tactics (the attacker's goals) and techniques (how they achieve them).
The 14 Enterprise tactics
| # | Tactic | Attacker's goal |
|---|---|---|
| 1 | Reconnaissance | Gather info about the target ← external scanning |
| 2 | Resource Development | Set up infrastructure (servers, accounts, tools) |
| 3 | Initial Access | Get in |
| 4 | Execution | Run malicious code |
| 5 | Persistence | Stay in, survive reboots |
| 6 | Privilege Escalation | Get higher permissions |
| 7 | Defense Evasion | Avoid detection |
| 8 | Credential Access | Steal passwords and credentials |
| 9 | Discovery | Learn the internal environment ← internal scanning |
| 10 | Lateral Movement | Move to other machines |
| 11 | Collection | Gather target data |
| 12 | Command and Control | Communicate with compromised systems |
| 13 | Exfiltration | Steal data out |
| 14 | Impact | Disrupt, destroy, encrypt (e.g. ransomware) |
Relevant techniques:
- T1595 Active Scanning → under Reconnaissance
- T1046 Network Service Discovery → under Discovery
⚠️ Two corrections to the course diagram
- ATT&CK is a matrix, not a strict sequence. Real attacks skip, repeat and loop through tactics. The numbering shows the typical flow, not a rule.
- The course diagram puts Exfiltration before Command and Control. In the official ATT&CK order Command and Control comes first (12), then Exfiltration (13). In practice C2 is usually set up early, since attackers need it to control the machine in the first place.
Why this matters for the SOC: the further right an activity sits, the deeper the attacker is and the more urgent the response. Recon = early warning. Discovery = active intrusion.
5. Horizontal vs Vertical Scans
Once attackers know which hosts exist, they look for which ports are open.
Horizontal scan — one port, many hosts
Attacker ──:445──► 192.168.1.1
──:445──► 192.168.1.2
──:445──► 192.168.1.3
──:445──► 192.168.1.4
──:445──► 192.168.1.5- Goal: find every machine exposing a specific port, usually because the attacker already has an exploit for that service.
- Classic example: WannaCry (2017). The ransomware scanned for port 445 to spread through the SMBv1 vulnerability (the EternalBlue exploit, patched by MS17-010). It hopped worm-like from machine to machine.
- Log signature: same source IP + same destination port + many destination IPs
Vertical scan — one host, many ports
┌─ :80
├─ :25
Attacker ──────► ├─ :22 192.168.1.25
├─ :445
├─ :3389
└─ :443- Goal: footprint one valuable host. Find everything it exposes, then look for a weakness.
- Example: an organization exposes only one server to the internet, so an attacker vertically scans that server to see every service on it.
- Log signature: same source IP + same destination IP + many destination ports
Side by side
| Horizontal | Vertical | |
|---|---|---|
| Picture | A row of hosts, one port each | A column of ports on one host |
| Constant | Destination port | Destination IP |
| Varies | Destination IPs | Destination ports |
| Attacker mindset | "I have an exploit. Who's vulnerable?" | "This target matters. What can I attack?" |
| Typical of | Worms, mass exploitation | Targeted attacks |
Mixed / block scans = many hosts × many ports at once, combining both.
Detecting them by counting (concept)
Count distinct values per source:
- Horizontal: for each
(source IP, destination port), count distinct destination IPs → high number = horizontal scan - Vertical: for each
(source IP, destination IP), count distinct destination ports → high number = vertical scan
Splunk-style example (exact field names depend on the data):
... | stats dc(dest_ip) AS hosts BY src_ip, dest_port | where hosts > 20 ← horizontal
... | stats dc(dest_port) AS ports BY src_ip, dest_ip | where ports > 20 ← verticaldc() = distinct count. The threshold (20 here) is a tuning choice; set it from your baseline.
6. How Scans Work — Three Techniques
Ping sweep (ICMP) — "Is anyone home?"
Scanner ──ICMP Echo Request──► Host
Scanner ◄──ICMP Echo Reply──── Host = host is ONLINE- Sends an ICMP packet to each address; a reply means the host is alive.
- Most basic technique; finds hosts, not ports.
- ⚠️ Often blocked by firewalls nowadays, so it's easy to defeat. A host that doesn't answer pings may still be online.
- Log signature: one source → ICMP to many sequential IPs in a short time.
TCP SYN scan — "half-open" scan
Normal TCP 3-way handshake: SYN → SYN-ACK → ACK (connection open).
A SYN scan never finishes it:
Scanner ──SYN──────► Host:port
Scanner ◄──SYN-ACK── Host → port OPEN (scanner then sends RST, never ACK)
Scanner ◄──RST────── Host → port CLOSED (host is online)
(no reply) → port FILTERED (a firewall is likely dropping it)- Why "stealthy": the connection is never completed, so many applications never log it. A single SYN also looks like the start of normal traffic.
- But: IDS/IPS and firewalls can detect it, through many SYNs with no completed handshakes from one source.
- The most popular default scan type (e.g. Nmap's default when run with admin rights).
UDP scan — slow and unreliable
UDP has no handshake, so the scanner sends a (usually empty) UDP packet and interprets the reaction:
| Response | Meaning |
|---|---|
| ICMP Port Unreachable | Port CLOSED (host online) |
| No response before timeout | Port open… or filtered. Not clear evidence |
| UDP reply (rare) | Port OPEN (clear evidence) |
- Unreliable: silence is ambiguous. A firewall dropping packets looks identical to an open port.
- The course says the scanner "marks it open". Tools like Nmap actually label it
open|filtered, admitting they can't tell.
- The course says the scanner "marks it open". Tools like Nmap actually label it
- Slow: the scanner must wait for a timeout on every silent port, and hosts often rate-limit ICMP replies.
Technique comparison
| Ping sweep | TCP SYN scan | UDP scan | |
|---|---|---|---|
| Protocol | ICMP | TCP | UDP |
| Finds | Live hosts | Hosts + open TCP ports | Hosts + open UDP ports |
| Speed | Fast | Fast | Slow |
| Reliability | Low (often blocked) | High | Low (ambiguous silence) |
| Stealth | Noisy, obvious | Stealthy (half-open) | Moderate |
| Log clue | ICMP to many IPs | Many SYNs, few completed connections | Many UDP probes + ICMP unreachable replies |
7. Analyst Decision Flow
Scanning detected
│
├─ Is the source an authorized scanner (known IP + schedule)?
│ └─ YES → expected, ignore (should already be excluded)
│
├─ Is the source EXTERNAL → our public assets?
│ └─ Reconnaissance → LOW severity
│ → check threat intel (raises priority if known-bad)
│ → did any connection SUCCEED after the scan? If yes → escalate
│ → block the IP at the perimeter firewall
│
└─ Is the source INTERNAL → internal hosts?
└─ Discovery → HIGH severity (attacker likely inside)
→ confirm it isn't authorized IT activity
→ ESCALATE + start Incident Response
→ investigate the source machine + root cause analysis
(blocking the IP is NOT enough)Core Rules
- Everyone scans. The skill is telling good scans from bad.
- Direction decides severity: outside→in = low (Recon); inside→inside = high (Discovery).
- External: block, but expect them back from a new IP.
- Internal: don't just block. Investigate the host and escalate.
- Horizontal = one port, many hosts (worm/exploit hunting). Vertical = one host, many ports (targeted footprinting).
- Threat intel should raise priority, not be the only trigger.
- Allowlisting creates blind spots. Allowlist narrowly (IP + schedule).
- SYN scans are quiet; UDP scans are slow and ambiguous; ping sweeps are often blocked.
Terms
| Term | Meaning |
|---|---|
| Attack surface | All assets reachable from the internet |
| Attack surface reduction | Closing unnecessary ports/services, patching, removing exposed assets |
| Rogue asset | An unknown, undocumented device on the network |
| Allowlist | A list of trusted sources excluded from alerting |
| Threat Intelligence (TI) | Data about known malicious IPs, domains, hashes and behaviour |
| Use case | A detection rule/scenario the SOC alerts on |
| Foothold | Initial access inside the target network |
| Root cause analysis | Finding how the attacker got in, so the hole can be closed |
| MITRE ATT&CK | Knowledge base of attacker tactics and techniques |
| Tactic / Technique | The attacker's goal / how they achieve it |
| ICMP | Internet Control Message Protocol (ping, error messages) |
| SYN / SYN-ACK / ACK / RST | TCP flags: start / accept / confirm / reset (abort) |
| TCP / UDP | Connection-oriented, reliable / connectionless, no handshake |
| SMB / SMBv1 | Windows file sharing on port 445 / its old, vulnerable version |
| EternalBlue / MS17-010 | The SMBv1 exploit WannaCry used / Microsoft's patch for it |
| Nmap | The most common network scanner |
| dc() | Splunk "distinct count" |
Data Exfiltration — Detection Notes
The Big Picture
Data exfiltration = the unauthorized transfer of data from an organization to an external destination controlled by an adversary.
It happens in three ways:
| Source | Example |
|---|---|
| Deliberate insider | An employee uploads customer lists to personal Dropbox before leaving |
| Malware | An infected host sends files to a C2 server |
| Compromised credentials | An attacker logs in as a real user and downloads data |
The core difficulty: exfiltration hides inside normal traffic: web uploads, DNS lookups, pings, cloud sync. You rarely catch it with one alert. You catch it by correlating host, network and cloud evidence.
What a good investigation answers:
- Who accessed the data? (user / host / process)
- What was transferred? (files, volume)
- How was it staged? (compressed, encoded, encrypted)
- Where was it sent? (IP, domain, cloud account)
1. Why Adversaries Steal Data
| Motive | What they do with it |
|---|---|
| Financial gain | Sell credit cards and personal records on the dark web, or commit fraud |
| Espionage | Nation-states take intellectual property, trade secrets, classified data |
| Ransomware & extortion | Steal data, then threaten to leak it unless paid |
| Disruption & sabotage | Leak internal data to damage reputation or operations |
| Persistence & reconnaissance | Use stolen data (network maps, credentials) to plan future attacks |
2. Real Threat Actors & Their Methods
| Actor / campaign | Technique | What happened | Lesson for defenders |
|---|---|---|---|
| APT29 (Cozy Bear) | HTTPS over legitimate domains | Encrypted channels used to steal from government networks | Encrypted traffic to "trusted" domains still needs metadata checks |
| FIN7 | HTTP POST to C2 servers | Stolen data embedded in POST requests | Watch POST volume and destinations |
| Lunar Spider (Zloader) | Encrypted C2 channels | Two-month intrusion with staged exfiltration | Slow, patient exfil defeats short-window alerts |
| DarkSide ransomware | Double extortion: exfil + encryption | Stole data before encrypting, then threatened leaks | Ransomware is also a data breach. Backups don't fix the leak |
| APT10 (Cloud Hopper) | Cloud-to-cloud transfer | Took data from managed service providers via cloud APIs | Data may never touch your network. You need cloud logs |
The course table says "dual extortion"; the common industry term is double extortion. Same thing.
3. The Exfiltration Lifecycle
Data theft isn't one event. It's a sequence, and each stage leaves different evidence:
1. DISCOVERY / COLLECTION ─► 2. STAGING / COMPRESSION ─► 3. TRANSPORT ─► (4. C2 coordinates it all)
find the files bundle, shrink, hide move it out orders + confirms receipt| Stage | What the attacker does | Where you see it |
|---|---|---|
| Discovery / Collection | Locates sensitive files | Many file-read events (Windows 4663), share enumeration |
| Staging / Compression | Aggregates, compresses (ZIP, RAR, 7z, tar), encrypts or encodes (Base64, steganography) | New archives in odd places (C:\Users\Public\, /tmp), 7z.exe/rar.exe command lines (Sysmon EventID 1 and 11) |
| Exfiltration transport | Sends it out over the network, removable media, cloud or covert channels | Proxy, firewall, NetFlow, DNS, USB events |
| C2 coordination | Orchestrates the transfer and confirms receipt | Regular beaconing to the same host before and after uploads |
Catch it at staging if you can. A 4 GB archive appearing in a temp folder at 2 AM is a better early warning than the upload itself.
4. Techniques and Where to Look
| Technique | Examples | Indicators & where to look |
|---|---|---|
| Network-based | HTTP/HTTPS uploads to S3 / Azure Blob / webmail, FTP/SFTP/SCP, DNS tunneling, ICMP/covert protocols, custom TCP/UDP | Proxy/web gateway (large POSTs, uploads to cloud endpoints), firewall/NGFW (high bytes to one IP/ASN), NetFlow (outbound spikes), DNS logs (long hostnames, TXT queries) |
| Host-based | PowerShell Invoke-WebRequest, rclone, awscli, curl/wget, archive creation (zip/rar), USB drives, ADS (hidden NTFS streams) | Sysmon/EDR (Process Create, Network Connect, File Create), Windows Security 4663/4656 (object access), auditd/shell history on Linux, removable-media events |
| Cloud exfiltration | S3 PutObject / multipart upload, Azure Blob uploads, Google Cloud Storage objects.insert, Drive/SharePoint external sharing | AWS CloudTrail / Azure Activity / GCP Audit, cloud storage access logs, unusual service-account or IP activity |
| Covert & encoding | DNS tunneling, Base64 or chunked encoding, steganography in images/audio, many small requests (low-and-slow) | DNS logs, proxy logs with many small POSTs, intermittent uploads correlated with suspicious process activity |
| Insider & collaboration tools | Slack / Teams / Dropbox / Google Drive / Box uploads or sharing with external users; compromised employee accounts | Audit logs (share events, file downloads), mail logs |
General triage signals (any technique)
- Large outbound volume to external IPs/domains
- Unknown destination domains (never seen in the baseline)
- Suspicious processes / command lines
- Many file reads followed by an outbound connection. This is the single strongest pattern.
- Multipart / streamed uploads
Sysmon & Windows event IDs worth memorizing
| ID | Source | Meaning | Exfil relevance |
|---|---|---|---|
| 1 | Sysmon | Process Create (with command line) | rclone.exe copy, 7z a, curl -T, powershell Invoke-WebRequest |
| 3 | Sysmon | Network Connection | Which process opened the outbound connection |
| 11 | Sysmon | File Create | New archive files during staging |
| 4663 | Windows Security | An object (file) was accessed | Mass file reads during collection |
| 4656 | Windows Security | A handle to an object was requested | Same, earlier in the access |
4663/4656 only appear if object access auditing is enabled on the files or folders. Many organizations never turn it on.
Living off the land
Most tools in the host-based row are legitimate admin software (rclone, awscli, curl, PowerShell). They're signed, trusted and often allowed. So the tool alone isn't the indicator. The indicator is who runs it, on which host, with which arguments, to which destination. rclone on a developer's laptop may be normal; rclone on a domain controller at 3 AM is not.
5. DNS Exfiltration & Tunneling
Why attackers love DNS
| Property | Why it helps the attacker |
|---|---|
| Always on | Almost every host does DNS lookups, and DNS is allowed outbound almost everywhere |
| High cover | Queries look like normal lookups unless inspected closely |
| Flexible payload | Data fits in subdomain labels (outbound) or TXT responses (inbound) |
| Often unfiltered | Frequently forwarded straight to public resolvers without inspection |
DNS basics: mostly UDP port 53. TCP 53 is used for zone transfers and large responses. Record types: A (IPv4), AAAA (IPv6), TXT (text), MX (mail), CNAME (alias).
How it works
Stolen data: "password123"
└─ encode → cGFzc3dvcmQxMjM
└─ query: cGFzc3dvcmQxMjM.exfil.attacker.com
└─ your DNS server can't answer → forwards it to the attacker's
authoritative server for attacker.com → attacker logs the subdomain = data receivedThe attacker owns the authoritative DNS server for their domain, so every query reaches them, even through your internal DNS.
DNS size limits (why exfil needs many queries):
- Max 63 characters per label (each part between dots)
- Max 253 characters for the full name
So a file becomes thousands of queries to one domain. That volume is what gives it away.
Indicators
| Indicator | Why it's suspicious |
|---|---|
| Many queries to one external domain, far above baseline | Normal browsing spreads queries across many domains |
| Long subdomain labels / long full names (> 60–100 chars) | Normal names are short and readable |
High entropy / Base32-Base64-like strings (mixed case, digits, = padding) | Encoded data looks random; real hostnames contain words |
| Rare record types (TXT, NULL) or many large TXT responses | Normal clients mostly ask for A/AAAA |
| Frequent NXDOMAIN | The attacker only needs the query to arrive, not a real answer |
| TCP DNS or large UDP DNS | Normal lookups are small UDP packets |
| Queries at regular intervals | Beaconing |
Encoding giveaways:
| Encoding | Character set | Padding |
|---|---|---|
| Base64 | A–Z, a–z, 0–9, +, / | = |
| Base64url | A–Z, a–z, 0–9, -, _ | = (optional) |
| Base32 | A–Z, 2–7 | = |
| Hex | 0–9, a–f | none |
Base32 and hex are popular for DNS because DNS names are case-insensitive and + and / aren't allowed in hostnames.
Hunting it
Wireshark:
dns all DNS
dns.qry.name.len > 50 long query names
dns.qry.type == 16 TXT queries
dns.flags.rcode == 3 NXDOMAIN responses
dns.qry.name contains "attacker" one suspicious domainThen use Statistics → Conversations or Statistics → DNS to see which host sends the most queries.
Splunk (field names vary by data source):
index=* sourcetype=dns | eval qlen=len(query) | where qlen > 60
| stats count dc(query) AS unique_queries BY src_ip, domain | sort -countMany unique subdomains under one domain from one host is the classic tunneling fingerprint.
6. FTP Exfiltration
FTP = one of the oldest file transfer protocols. Attackers use it to move large amounts of data, often through compromised credentials, misconfigured servers or ephemeral accounts.
How attackers use it
- Legitimate FTP servers (public or misconfigured internal ones) to stage or transfer data
- Compromised credentials (service accounts, user accounts)
- Non-standard ports or tunneling to blend in
Why FTP is easy to analyse
Plain FTP is cleartext. Credentials, commands and file contents all travel unencrypted, so packet capture shows everything.
FTP uses two channels:
| Channel | Port | Carries |
|---|---|---|
| Control | 21 | Commands: USER, PASS, STOR, RETR |
| Data | 20 (active) or a random high port (passive / PASV) | The actual file contents |
Commands that matter
| Command | Meaning | Exfil relevance |
|---|---|---|
USER / PASS | Login, in cleartext | Which account was used, and the password itself |
STOR | Upload a file to the server | The exfil command. Data leaving your network |
RETR | Download a file from the server | Tool or payload coming in |
PASV | Server opens a random port for data | Precedes the actual transfer |
Direction: for exfiltration, look for
STORfrom your host to an external server.RETRfrom outside to your server can also be theft, if your server is the one being emptied.
Indicators
USER/PASSfrom internal hosts to unusual external IPs- Repeated or large
STOR/RETRtransfers - Large data connections, especially outside business hours
- PASV data channels on ephemeral ports paired with large payloads
Hunting it
Wireshark:
ftp control channel
ftp.request.command == "USER" logins
ftp.request.command == "STOR" uploads
ftp-data the file contents- Follow → TCP Stream on the control channel to read the whole session.
- File → Export Objects → FTP-DATA to recover the transferred files (in a lab only).
⚠️ Encrypted cousins
SFTP / SCP (over SSH, port 22) and FTPS (FTP over TLS) are encrypted. You can't read commands or files, only metadata: who connected to where, when, how long and how many bytes. That's why the course mentions "SSH session metadata": for SSH, flow volume and duration are your evidence.
7. HTTP / HTTPS Exfiltration
Why HTTP is the most common channel
- Blends with normal web traffic. Everyone browses all day.
- Gets through firewalls and proxies, since 80/443 are always open
- Easy to obfuscate: encoding, encryption, tunneling
Techniques
| Technique | How it works | What it looks like |
|---|---|---|
| POST uploads to external servers | Bulk data in the POST body to attacker hosts or cloud storage | Large request sizes |
| GET with encoded data | Small chunks hidden in query strings or URL paths | Long, random-looking URLs. Typical of low-and-slow |
| Common services / CDNs | Uploads disguised as traffic to popular services, or to attacker subdomains under reputable domains | "Trusted" destinations |
| Custom headers | Data in headers like X-Data: <base64> | Can bypass string-based DLP that only checks bodies |
| Chunked / multipart | Large payloads split across many requests | Stays under size thresholds |
| HTTPS / TLS tunneling | Encryption hides the payload | Needs TLS inspection, SNI analysis or metadata detection |
| Staging via cloud services | Upload to Dropbox / GitHub / Gist, fetch from outside later | Destination is a "legitimate" service |
Adversaries adapt: low-and-slow pacing, encryption or encoding, and legitimate services to evade detection.
Indicators
- Unusually large POST requests to external or unexpected hosts
- Requests to domains with low reputation or rarely seen in the baseline
- Frequent small requests (beaconing) to the same host, followed by large uploads
- Chunked/multipart transfers where many requests add up to one larger file
Hunting it
Wireshark:
http.request.method == "POST"
http.request.method == "POST" && frame.len > 1000
http.request.uri contains "=" data in query strings
tls.handshake.extensions_server_name SNI: the domain an HTTPS connection asks for- Follow → HTTP Stream to read what was posted.
- File → Export Objects → HTTP to recover uploaded content.
Splunk (field names vary):
index=* sourcetype=proxy http_method=POST
| stats sum(bytes_out) AS total_out count BY src_ip, dest_host
| where total_out > 10000000 | sort -total_outThis is total bytes out per host-and-destination pair. Summing catches chunked uploads that each look small.
Encrypted traffic: what you can still see
Even without decryption:
- SNI: the domain the client asked for
- Bytes out vs bytes in: browsing downloads much more than it uploads, so a high outbound ratio is suspicious
- Destination reputation, connection timing and frequency
- JA3/JA4 fingerprints of the TLS client, which identify specific malware or tools
8. ICMP Exfiltration & Tunneling
ICMP = network-layer protocol for diagnostics and control (ping, "TTL exceeded"). It's commonly allowed and inspected less strictly than TCP/UDP, which makes it a covert channel.
How it works
A ping packet has a payload field. Normally it's filler bytes. Attackers put encoded file chunks there instead, and a listener under their control collects and decodes them.
Techniques
| Technique | Detail |
|---|---|
| Echo tunneling | Data in echo request (type 8) / echo reply (type 0) payloads, encoded as Base64 or hex |
| Custom types/codes | Uncommon ICMP types or non-zero codes to dodge signature detection |
| Fragmentation | Large payloads split across multiple packets |
| Obfuscation | Payloads encoded or encrypted to look random |
⚠️ The course writes "Encrypting or encrypting payloads (base64 is common)". Base64 is encoding, not encryption. Anyone can decode it without a key. Encoding hides data from a casual glance; encryption hides it from everyone without the key.
What normal ping looks like (your baseline)
| OS | Default payload | Content |
|---|---|---|
| Windows | 32 bytes | abcdefghijklmnopqrstuvwabcdefghi |
| Linux | 56 bytes (64 with the ICMP header) | Timestamp + incrementing bytes |
Anything much bigger, or random-looking, is abnormal.
ICMP types to know
| Type | Meaning |
|---|---|
| 0 | Echo reply |
| 3 | Destination unreachable |
| 8 | Echo request (ping) |
| 11 | Time exceeded (TTL) |
| 13 / 14 | Timestamp request / reply. Rarely legitimate today |
Indicators
- Persistent ICMP sessions to an external host not used for monitoring
- Payloads larger than a normal ping, especially if frequent
- High-entropy or Base64/hex-looking payloads
- Bursts of ICMP with no other application traffic from the same host
Hunting in Wireshark
icmp all ICMP
icmp.type == 8 echo requests only
icmp.type == 8 && data.len > 64 oversized pings
icmp.type == 13 || icmp.type == 14 timestamp messages
ip.flags.mf == 1 && icmp fragmented ICMPLook for:
- Volume: one host sending many echo requests to one external IP (Statistics → Conversations)
- Size: large
frame.lenordata.len - Periodicity: evenly spaced packets with similar payload sizes
- Content: open the Packet Bytes pane. Normal pings show the alphabet pattern; tunnels show encoded text or random bytes
9. Channel Comparison
| DNS | FTP | HTTP/HTTPS | ICMP | |
|---|---|---|---|---|
| Port / protocol | UDP/TCP 53 | TCP 21 (+ data port) | TCP 80 / 443 | No ports (IP protocol 1) |
| Throughput | Low (tiny chunks) | High | High | Low–medium |
| Stealth | High | Low (cleartext, obvious) | High (blends in) | Medium |
| Main tell | Long random subdomains, TXT, volume to one domain | STOR to external IP, big transfers | Large/many POSTs, high bytes-out | Oversized/regular pings with odd payloads |
| Readable in PCAP? | Yes | Yes (plain FTP) | HTTP yes; HTTPS no | Yes |
| Primary log | DNS server logs | FTP server logs, firewall, flows | Proxy logs | Firewall, flows, PCAP |
10. SOC L1 Triage Checklist
For any suspected exfiltration, gather these and corroborate across sources:
| Question | Evidence |
|---|---|
| Source host / user | Who? Is this normal for them? |
| Destination | IP/domain, reputation, first-seen date, ASN, cloud provider |
| Volume | How much left? Compare against that host's baseline |
| Process / command line | Which program sent it? (Sysmon 1 + 3, EDR) |
| Timing | Business hours? Regular intervals? How long has it been going on? |
| Staging evidence | Archives created? Mass file reads beforehand? |
| Supporting logs | Proxy, DNS, NetFlow, host, cloud audit. One source is a lead; several are a case. |
Alert (volume spike / odd DNS / big POST)
→ identify host + user + process
→ check destination reputation + baseline
→ look backwards: file reads? archive created? (collection / staging)
→ look sideways: same destination from other hosts? (scope)
→ confirmed or unexplained → ESCALATE with the evidenceCore Rules
- Exfiltration hides in normal traffic. Detection is correlation, not one alert.
- Many file reads → archive → outbound connection is the strongest pattern.
- Catch it at staging if you can, before the data leaves.
- Legitimate tools are the norm. Judge context: who, where, when, what arguments.
- DNS: long, random subdomains plus high volume to one domain = tunneling.
- FTP:
STOR= upload. Cleartext means the PCAP shows everything. - HTTP: big or many POSTs and a high bytes-out ratio. HTTPS still leaks metadata.
- ICMP: pings should be small, boring and predictable. Anything else is suspicious.
- Base64 is encoding, not encryption.
- Ransomware usually means exfiltration too (double extortion).
Acronyms
| Acronym | Meaning |
|---|---|
| ADS | Alternate Data Streams: hidden data attached to NTFS files |
| APT | Advanced Persistent Threat (usually a nation-state group) |
| API | Application Programming Interface |
| ASN | Autonomous System Number: identifies who owns an IP block |
| C2 | Command and Control |
| CDN | Content Delivery Network |
| DLP | Data Loss Prevention |
| DNS | Domain Name System |
| EDR | Endpoint Detection and Response |
| FTP / FTPS | File Transfer Protocol / FTP over TLS |
| SFTP / SCP | SSH File Transfer Protocol / Secure Copy, both over SSH |
| HTTP / HTTPS | Hypertext Transfer Protocol / its TLS-encrypted version |
| ICMP | Internet Control Message Protocol |
| IoA | Indicator of Attack: behaviour showing an attack in progress |
| IoC | Indicator of Compromise: evidence an attack happened |
| JA3 / JA4 | TLS client fingerprinting methods |
| MSP | Managed Service Provider |
| NGFW | Next-Generation Firewall |
| NXDOMAIN | DNS response meaning "this domain doesn't exist" |
| PASV | FTP passive mode |
| S3 | Amazon Simple Storage Service |
| SNI | Server Name Indication: the domain sent in clear during the TLS handshake |
| SOC / L1 | Security Operations Center / Level-1 analyst |
| TLS | Transport Layer Security |
| TTL | Time To Live |
| TXT | DNS text record |
Man-in-the-Middle (MITM) Attacks — Detection Notes
The Big Picture
MITM = an attacker secretly sits between two parties (a user and a service), intercepting and possibly altering their communication without either side knowing.
Normal: VICTIM ─────────────────────────► SERVER
MITM: VICTIM ──► ATTACKER ──► SERVER
◄── ◄──
both sides think they're talking directly to each otherWhat the attacker gains:
- Eavesdropping: steal credentials, credit cards, session tokens
- Manipulation: inject malicious content, fake login forms, malware
Where it works best: wherever encryption or authentication is weak or missing.
The key idea: MITM attacks abuse trust built into old protocols. ARP and DNS were designed for cooperative networks and believe whatever answer arrives. Every attack in this room exploits that.
1. How MITM Works — Two Steps
| Step | What happens | Techniques |
|---|---|---|
| 1. Interception | The attacker inserts themselves into the traffic path | ARP spoofing, DNS spoofing, IP spoofing, rogue Wi-Fi |
| 2. Manipulation / Decryption | The attacker reads or changes the traffic | SSL stripping, decrypting weak encryption, injecting altered responses or fake login pages |
Step 1 gets them in the path. Step 2 makes being in the path worth something. Against properly encrypted, authenticated traffic, step 1 alone gives the attacker little.
2. Common Types of MITM
| Type | How it works | Needs |
|---|---|---|
| Packet sniffing | Capture unencrypted packets, often on open Wi-Fi | Access to the same network segment |
| Session hijacking | Steal session tokens/cookies and impersonate the logged-in user | Readable traffic (no TLS) or a stolen cookie |
| SSL stripping | Downgrade HTTPS to HTTP to read or alter traffic | Already in the path (ARP spoof / rogue AP) |
| DNS spoofing | Forge DNS replies to send victims to fake sites | Ability to answer DNS queries first |
| IP spoofing | Forge packets that appear to come from a trusted system | Usually blind: replies go to the real IP, not the attacker |
| Rogue Wi-Fi access point | Fake network (often an "evil twin" with a real network's name) that victims join | Physical proximity |
Note: IP spoofing on its own is rarely a full MITM. The attacker can send forged packets but doesn't receive the replies. It becomes MITM only when combined with something that reroutes traffic.
3. Real-World Examples — ⚠️ One Is Wrong
❌ Equifax 2017 was NOT a MITM attack
The course says Equifax was breached "due to an MITM attack". That's incorrect.
- Real cause: an unpatched Apache Struts vulnerability (CVE-2017-5638) in a public web application.
- Impact: about 147 million people's data (the course says "over 100 million").
- Real lesson: patch management, not MITM.
- Possible source of the confusion: in the same year, Equifax's mobile apps were found to have weak HTTPS handling that left them vulnerable to MITM. That was a separate finding, not the breach.
For the quiz, answer what the course expects. In real work, Equifax = unpatched Struts.
✅ Better real examples of MITM
| Case | What happened |
|---|---|
| DigiNotar (2011) | A hacked Dutch certificate authority issued fake Google certificates, used to intercept Gmail traffic of users in Iran. DigiNotar went bankrupt |
| ISP content injection | Some ISPs injected ads or tracking code into customers' unencrypted HTTP pages |
| Superfish (2015) | Pre-installed adware on Lenovo laptops installed its own root certificate to intercept HTTPS and inject ads |
The course's "state actors intercepting search traffic via SSL spoofing" fits the DigiNotar pattern: fake certificates let an attacker impersonate HTTPS sites.
4. MITM and the Cyber Kill Chain
TTPs = Tactics (the goal), Techniques (the method), Procedures (the exact steps). A single alert means more once you place it in the attacker's overall plan.
Lockheed Martin Cyber Kill Chain — 7 phases
| # | Phase | What the adversary does |
|---|---|---|
| 1 | Reconnaissance | Gathers intelligence and finds vulnerabilities |
| 2 | Weaponization | Pairs an exploit with a payload into a deliverable package |
| 3 | Delivery | Sends the package to the target (email, web, USB) |
| 4 | Exploitation | The code runs, exploiting a software, hardware or human weakness → initial access |
| 5 | Installation | Installs malware or a persistent backdoor |
| 6 | Command & Control (C2) | Opens a covert channel to control the compromised asset |
| 7 | Actions on Objectives | Exfiltration, destruction, lateral movement |
Where MITM fits (per the course)
| Phase | Role of MITM |
|---|---|
| Exploitation | Abuses the built-in trust of ARP and DNS to intercept a channel. This breaks network integrity and gives a position for eavesdropping or manipulation |
| Installation | Controls the data stream, so it can inject a browser exploit, malware dropper or RAT into legitimate unencrypted downloads → persistence |
⚠️ A contradiction worth noticing
The course says MITM "provides the adversary with their initial foothold". But ARP spoofing only works from inside the local network: the attacker must already have a device on your LAN (a compromised PC, a plugged-in device, or Wi-Fi access).
- So internal MITM (ARP/DNS on the LAN) = the attacker is already in. Treat it like internal scanning: high severity.
- Rogue Wi-Fi / open public Wi-Fi is the case where MITM really can be the first step.
How MITRE ATT&CK classifies it
T1557 — Adversary-in-the-Middle, listed under Credential Access and Collection, with sub-techniques:
- T1557.002 ARP Cache Poisoning
- T1557.001 LLMNR/NBT-NS Poisoning and SMB Relay (a very common Windows variant)
Why it matters to the SOC: a confirmed MITM means an adversary is active mid-intrusion. That's the moment to disrupt the chain before Actions on Objectives: isolate the attacker's device, reset exposed credentials.
5. ARP Spoofing (ARP Cache Poisoning)
ARP in one line
ARP maps IP addresses to MAC addresses on a local network.
Device: "Who has 192.168.1.1? Tell 192.168.1.50" (broadcast request)
Router: "192.168.1.1 is at aa:aa:aa:aa:aa:aa" (reply)
Device saves this in its ARP cache → sends future frames to that MACWhy spoofing works
ARP has no authentication. Any device can send an unsolicited "is-at" reply, and most devices accept and cache it, even if they never asked.
The attack
The attacker sends fake replies to both sides:
To the VICTIM: "192.168.1.1 (gateway) is at ATTACKER_MAC"
To the GATEWAY: "192.168.1.50 (victim) is at ATTACKER_MAC"Course example: 192.16.10.100 is at 02:fe:BB:cd:55:55. The attacker claims to be the gateway.
192.16.10.100is probably a typo for192.168.10.100.192.16.x.xisn't a private range.- A MAC starting with
02has the "locally administered" bit set, meaning it was set by software, not burned in by a manufacturer. That's common for VMs and spoofed MACs, so it's a small but useful clue.
Result:
- The victim's ARP cache is poisoned.
- All traffic meant for the gateway flows through the attacker first. The attacker forwards it on so nothing seems broken: a silent MITM.
Indicators
| Indicator | What it looks like |
|---|---|
| Duplicate MAC-to-IP mappings | Two different MACs claiming the same IP → impersonation. The strongest signal |
| One MAC claiming several IPs | Attacker's MAC answering as both the gateway and the victim |
| Unsolicited ARP replies | Many replies with no matching request |
| Abnormal ARP volume | Lots of ARP packets in short intervals (poisoning must be repeated to keep caches poisoned) |
| Unusual traffic routing | Traffic for the gateway going to the attacker's MAC |
| Gateway redirection | Several destination MACs for the same gateway IP over time |
| ARP probe / sweep loops | Many Who has 192.168.1.x? Tell 192.168.1.y requests across the subnet = the attacker mapping hosts before poisoning (ARP scanning) |
⚠️ "Gratuitous ARP" isn't automatically malicious
The course equates unsolicited replies with gratuitous ARP. Gratuitous ARP is a legitimate mechanism: a device announces its own IP-MAC pair after booting, changing IP, or in failover (e.g. two firewalls sharing a virtual IP). The red flag is a device announcing an IP that belongs to someone else, especially the gateway, and repeatedly.
Hunting in Wireshark
arp all ARP
arp.opcode == 1 requests ("who has")
arp.opcode == 2 replies ("is at")
arp.duplicate-address-detected Wireshark's own duplicate-IP flag
arp.src.proto_ipv4 == 192.168.1.1 everything claiming to be the gateway
eth.src == 02:fe:bb:cd:55:55 everything from the suspect MAC- Expert Info often shows "Duplicate IP address configured" warnings. That's a fast way in.
- Statistics → Endpoints → Ethernet: a MAC tied to more IPs than it should be stands out.
- Compare the gateway's real MAC (from the earliest replies, or from IT documentation) with what appears later.
Defenses
- Dynamic ARP Inspection (DAI) on switches, which checks ARP against DHCP snooping records
- Static ARP entries for critical devices such as the gateway
- Port security / 802.1X, so unknown devices can't plug in
- Encryption everywhere (TLS), so interception yields nothing readable
6. DNS Spoofing
DNS in one line
DNS is the network's contact list: you tap a name (www.google.com), it gives you the number (the IP address).
DNS spoofing = giving the victim the wrong number for a site.
The attack, step by step
- Victim looks up
my-real-bank.com. - Attacker, already on the local network (often via ARP spoofing), sees the query.
- The spoof: the attacker sends a fake DNS response first:
my-real-bank.com is at ATTACKER_IP. - Interception: the victim caches the fake answer and connects to the attacker's server, which hosts a replica of the bank site.
- The attacker captures everything typed: usernames, passwords.
Why it works: the victim accepts the first response that matches its query. The attacker wins by answering faster than the real resolver.
⚠️ Two terms the course merges
| DNS spoofing | DNS cache poisoning | |
|---|---|---|
| Target | One victim's query/response | A DNS resolver's cache |
| Scope | That victim | Everyone using that resolver |
| Course example | ✅ this one | (often used interchangeably) |
Both end the same way: wrong IP, victim lands on the attacker's server.
⚠️ What stops it on HTTPS sites
If the bank uses HTTPS, the fake server can't present a valid certificate for my-real-bank.com, so the browser shows a certificate warning. Attackers get around this by:
- hoping the user clicks through the warning, or
- combining it with SSL stripping so the victim never uses HTTPS at all (next section).
Indicators
| Indicator | Why it matters |
|---|---|
| Multiple DNS responses for the same query | The real resolver and the forger both answer. The single most reliable indicator |
| Response from an unexpected source | The reply comes from an IP that isn't a configured resolver (your DNS server, or e.g. 8.8.8.8) |
| Suspiciously short TTLs (1–30 s) | Keeps the poisoned entry short-lived so the attacker can keep reasserting it |
| Unsolicited DNS responses | A reply with no matching request from the victim |
| Answer IP doesn't match reality | A well-known domain resolving to an internal or unknown IP |
⚠️ Short TTL on its own is weak evidence. CDNs and cloud load balancers legitimately use TTLs of 20–60 seconds. Use it only alongside the other indicators.
Hunting in Wireshark
dns all DNS
dns.flags.response == 1 responses only
dns.qry.name == "my-real-bank.com" one domain
dns.resp.ttl < 30 short TTLs
dns.id == 0x1a2b all packets with one transaction IDSpotting duplicate responses: every DNS query has a transaction ID. Filter on one ID. A legitimate exchange shows one query and one response. Two responses with different IPs, or from different source IPs, means someone forged one.
Defenses
- DNSSEC: cryptographically signed DNS records
- Encrypted DNS (DNS over HTTPS / TLS)
- HTTPS + HSTS, so a fake server can't pass certificate checks
- Block clients from using any resolver except the approved ones
7. SSL Stripping
SSL stripping = the attacker removes or prevents TLS encryption between client and server, so the victim talks plain HTTP while the attacker keeps HTTPS with the real server.
VICTIM ◄──── HTTP (plaintext) ────► ATTACKER ◄──── HTTPS (encrypted) ────► SERVER
everything readable here server sees a normal secure sessionHow it works (per the course)
- Victim makes a request to a website.
- Attacker intercepts it, using ARP spoofing or a rogue access point.
- Attacker connects to the site over HTTPS but relays responses to the victim over HTTP.
- Victim interacts over HTTP, exposing data in plaintext.
⚠️ The important detail the course skips
SSL stripping works because users rarely type https://. They type mybank.com:
1. Browser sends http://mybank.com ← unencrypted first request
2. Real server replies 301 → https://mybank.com
3. ATTACKER intercepts that redirect and removes it,
rewriting every https:// link in the page to http://
4. Victim never reaches HTTPS. No certificate warning appears.- The attack hits the first unencrypted request and the HTTP → HTTPS redirect.
- If the victim really did start with HTTPS (as the course's step 1 says), stripping fails: the attacker would need a fake certificate, which triggers a warning. That's a different attack (TLS interception).
The defense that kills it: HSTS (HTTP Strict Transport Security). A site tells the browser "always use HTTPS for me". With HSTS preload, the browser knows this before the first visit. That's why classic SSL stripping fails against Google, banks and most major sites today.
Indicators
| Indicator | What to look for |
|---|---|
| Request vs response mismatch | Session starts toward HTTPS (443) but the following traffic for the same domain is HTTP (80) |
| Redirects / link rewriting | HTTP 301/302 redirects that keep pointing HTTPS requests to HTTP resources (the opposite of normal) |
| Certificate errors | A failed handshake or self-signed certificate, if the attacker uses a direct proxying technique (strictly, that's TLS interception rather than stripping) |
| Login forms over HTTP | POST with username=/password= in plaintext to a site that should be HTTPS |
| No HTTPS at all for a domain that normally uses it | Compare with the baseline |
Hunting in Wireshark
http.request && http.host == "mybank.com" plain-HTTP requests to a site that should be HTTPS
http.response.code == 301 || http.response.code == 302
http.location contains "http://" redirects pointing to plaintext
http.request.method == "POST" form submissions in cleartext
tls.handshake.type == 1 TLS Client Hello (who started HTTPS)
tls.handshake.extensions_server_name SNI: which domain the TLS session was for
tls.alert_message handshake failuresThen Follow → HTTP Stream on a suspicious POST. If you can read the password, the victim was stripped.
Tell-tale pairing in the capture: the attacker's IP has a TLS session with the real server at the same moment the victim has an HTTP session for the same domain.
8. How the Three Attacks Chain Together
ARP SPOOFING ──► attacker gets INTO THE PATH (all victim traffic flows through them)
│
├──► DNS SPOOFING ──► send the victim to a FAKE SITE
│
└──► SSL STRIPPING ──► keep the victim on HTTP so passwords are READABLE
(and no certificate warning appears)| Attack | Layer | Abuses | Strongest indicator |
|---|---|---|---|
| ARP spoofing | Link (L2) | ARP's lack of authentication | Two MACs for one IP (especially the gateway) |
| DNS spoofing | Application (L7) | DNS trusting the first answer | Two responses to one query |
| SSL stripping | Application (L7) | The first HTTP request / redirect | HTTPS expected, HTTP observed, plaintext credentials |
In an investigation, find ARP spoofing first. It's usually the enabler for the other two. Once you know the attacker's MAC/IP, filter on it to find the DNS and HTTP manipulation.
9. Response Checklist
- Identify the attacker's device: MAC, IP and switch port
- Isolate it: shut the switch port or block it on Wi-Fi
- Scope: which victims' ARP caches were poisoned? Which hosts got forged DNS answers?
- Assume credentials are compromised for any victim who logged in over HTTP during the window → reset passwords, revoke sessions
- Flush ARP and DNS caches on affected hosts (
arp -d *,ipconfig /flushdns) - Root cause: how did the attacker get on the LAN? (rogue device, compromised host, weak Wi-Fi)
- Harden: DAI, DHCP snooping, 802.1X, HSTS, DNSSEC
Core Rules
- MITM abuses trust. ARP and DNS believe the first answer they get.
- Interception gets them in the path; manipulation makes it pay.
- Internal ARP/DNS spoofing means the attacker is already on your LAN. High severity.
- Two MACs for one IP = ARP spoofing. Two answers for one DNS query = DNS spoofing.
- Gratuitous ARP and short TTLs aren't malicious by themselves. Look for the combination.
- SSL stripping hits the first HTTP request. HSTS defeats it.
- Encryption is the backstop. Correct TLS makes interception worthless.
- Equifax 2017 = unpatched Apache Struts, not MITM.
Acronyms
| Acronym | Meaning |
|---|---|
| MITM / AitM | Man-in-the-Middle / Adversary-in-the-Middle (MITRE's name) |
| ARP | Address Resolution Protocol |
| MAC | Media Access Control (hardware) address |
| DNS | Domain Name System |
| DNSSEC | DNS Security Extensions: signed DNS records |
| TTL | Time To Live: how long a DNS answer may be cached |
| SSL / TLS | Secure Sockets Layer (old) / Transport Layer Security (current) |
| HTTP / HTTPS | Hypertext Transfer Protocol / its TLS-encrypted version |
| HSTS | HTTP Strict Transport Security |
| SNI | Server Name Indication: the domain named in the TLS handshake |
| CA | Certificate Authority |
| RAT | Remote Access Trojan |
| TTPs | Tactics, Techniques and Procedures |
| C2 | Command and Control |
| DAI | Dynamic ARP Inspection |
| LLMNR / NBT-NS | Link-Local Multicast Name Resolution / NetBIOS Name Service (Windows name lookups, also poisonable) |
| AP | Access Point |
| CVE | Common Vulnerabilities and Exposures (vulnerability ID) |
| SOC | Security Operations Center |
Intrusion Detection Systems (IDS) & Snort
The Big Picture
A firewall decides whether a connection may happen. Once it's allowed through, the firewall's job is mostly done. But attackers often get in through legitimate-looking connections (a valid VPN login, a normal web request). Something has to watch what happens after they're in. That's the IDS.
Firewall = the guard at the gate (checks who enters and leaves). IDS = the CCTV cameras inside (watches what people do once they're in, and raises the alarm).
What an IDS does and doesn't do
| ✅ Does | ❌ Doesn't |
|---|---|
| Monitors traffic inside and in/out of the network | Block anything |
| Uses signature and anomaly detection | Decide what to do about it |
| Generates an alert for every detection | Fix the problem |
IDS only notifies; humans act. Its counterpart, the IPS (Intrusion Prevention System), sits inline and can drop malicious traffic automatically.
| IDS | IPS | |
|---|---|---|
| Position | Passive: gets a copy of traffic (SPAN/TAP) | Inline: traffic flows through it |
| Action | Alerts | Alerts + blocks |
| Risk if wrong | Missed attack / noisy alerts | Blocks legitimate traffic (false positive = outage) |
| Risk if it fails | Nothing stops; you lose visibility | Can cut the network unless it fails open |
1. Two Ways to Classify an IDS
Every IDS is described by two independent questions:
- Where is it deployed? → HIDS or NIDS
- How does it detect? → Signature, Anomaly or Hybrid
So "Snort" = a network IDS using mostly signature detection.
2. Deployment Modes — Where It Lives
| HIDS (Host-based) | NIDS (Network-based) | |
|---|---|---|
| Installed on | Each individual host | A point in the network that sees traffic (via SPAN/TAP) |
| Watches | That host only: processes, files, logs, registry | All hosts' network traffic |
| Visibility | Deep but narrow: very detailed for one machine | Broad but shallower: the whole network, from the outside of hosts |
| Sees encrypted traffic? | Yes: sees data before encryption / after decryption on the host | No: only metadata of encrypted traffic |
| Management | Hard at scale: resource-intensive, managed per host | Centralized: one sensor, one view of all detections |
| Examples | OSSEC, Wazuh, EDR agents | Snort, Suricata, Zeek (monitoring) |
HIDS = a camera inside each room. NIDS = cameras on the corridors. Real environments use both, because each covers the other's blind spots.
3. Detection Modes — How It Decides
Signature-based
- Every known attack has a unique pattern = its signature.
- The IDS stores signatures in a database and compares traffic against them.
- Strength: fast, accurate, few false positives for known threats. The bigger and better the database, the better the detection.
- Weakness: can't detect zero-days. No signature means no detection, so it only catches attacks seen before.
Anomaly-based
- First learns normal behaviour (the baseline), then alerts on deviations.
- Strength: can detect zero-day attacks, since it doesn't need a known pattern.
- Weakness: many false positives. Unusual ≠ malicious: a new backup job, a software update or a busy sales day all look "abnormal".
- Fix: tune it, by manually defining what normal looks like.
⚠️ The course explains the false positives as "the nature of most legitimate programs matches the malicious ones". The clearer reason: anomaly detection flags anything different, and plenty of legitimate activity is different.
⚠️ Hidden risk the course skips: if an attacker is already present while the IDS learns its baseline, the malicious activity becomes part of "normal" (baseline poisoning).
Hybrid
- Combines both: known threats → signature matching; new threats → anomaly detection.
- Gets the speed and accuracy of signatures plus the zero-day coverage of anomalies.
Comparison
| Signature | Anomaly | Hybrid | |
|---|---|---|---|
| Detects | Known attacks | Unknown / zero-day | Both |
| False positives | Low | High | Medium |
| Speed / overhead | Fast, low overhead | Higher processing overhead | Higher processing overhead |
| Needs | Updated signature database | A good baseline + tuning | Both |
| Best for | A small, well-known threat surface | Catching novel attacks | Modern enterprise environments |
Signature = a "wanted" poster. Catches only faces it already knows. Anomaly = a guard who knows everyone's routine. Notices strangers, but also stops the new employee.
4. Snort — Overview
| Fact | Detail |
|---|---|
| Type | Open-source NIDS / NIPS |
| Created | 1998, by Martin Roesch |
| Owned by | Cisco today (through its acquisition of Sourcefire); rules maintained by Cisco Talos |
| Detection | Rule (signature) based at its core |
| Rules | Built-in rule files for known attacks, plus custom rules you write |
| Flexibility | Disable built-in rules that don't fit your network, add your own |
⚠️ The course says Snort uses "signature-based and anomaly-based detections". Snort is fundamentally signature/rule-based. Its inspectors catch some protocol anomalies (malformed packets, protocol violations), but it doesn't learn a behavioural baseline. Don't call it an anomaly-based IDS in an interview.
5. Snort's Three Modes
| Mode | What it does | Analyses traffic? | Use case | Key flag |
|---|---|---|---|---|
| Packet sniffer | Reads and displays packets on the console (or to a file) | ❌ No | Network team diagnosing performance problems | -v |
| Packet logger | Logs traffic to disk as PCAP for later analysis | ❌ Logging only | Forensics / root cause analysis of past attacks | -l <dir> |
| NIDS | Applies rules to live traffic and alerts on matches | ✅ Yes | Proactive monitoring for threats: the main IDS function | -c <config> |
⚠️ The course's description of packet logging mode starts by describing detection and alerts, which is really NIDS mode. Keep it simple: sniffer = show, logger = save, NIDS = detect.
The NIDS mode is what makes Snort an IDS. The other two are utilities.
6. Promiscuous Mode — and Why It Isn't Enough
| Normal NIC | Promiscuous mode NIC |
|---|---|
| Accepts only frames addressed to this host | Accepts every frame it sees on the wire |
To monitor the whole network, the sensor's interface must be in promiscuous mode.
⚠️ What the course leaves out: on a modern switched network, the switch only sends a host its own traffic. Promiscuous mode lets the card accept everything, but it can't accept frames that never arrive. To really see the whole network, the sensor must be connected to a SPAN/mirror port or a network TAP (see network.md).
Promiscuous mode = willing to listen. SPAN/TAP = actually hearing everything. You need both.
7. Snort Files & Directories
| Path | Contents |
|---|---|
/etc/snort/ | Main directory on this machine (from a package install) |
/usr/local/etc/snort/ | Common location when built from source |
snort.lua | Snort 3 main configuration: which rules to load, $HOME_NET, settings |
snort.conf | Snort 2 configuration (the older format) |
rules/ | Rule files, including local.rules for your custom rules |
classification.config | Attack categories (classtype) and their priorities |
reference.config | Reference sources (CVE, URLs) for rules |
gen-msg.map, community-sid-msg.map | Map rule IDs to their messages |
threshold.conf | Rate-limits and suppresses noisy alerts |
- In Snort 3 the location isn't fixed: it's chosen at install time. Always load the config explicitly with
-c <path>. - The lab machine shows both
snort.confandsnort.lua.snort.luais the one Snort 3 actually uses. - In Snort 3, a rule file must be included in
snort.lua(in theipssection) to take effect. Writing tolocal.rulesdoes nothing unless it's referenced.
8. Rule Format
alert icmp any any -> $HOME_NET any (msg:"Ping Detected"; sid:10001; rev:1;)
└─┬─┘ └─┬┘ └┬┘ └┬┘ └┬┘ └───┬───┘ └┬┘ └──────────────────┬───────────────────┘
action proto src src dir dest dest rule options (metadata)
IP port IP portThe header (before the parentheses)
| Part | Example | Meaning |
|---|---|---|
| Action | alert | What to do on a match |
| Protocol | icmp | tcp, udp, icmp, ip (plus app protocols like http in Snort 3) |
| Source IP | any | Where traffic comes from |
| Source port | any | Port it comes from |
| Direction | -> | -> = one way (source to destination); <> = both directions |
| Destination IP | $HOME_NET | A variable for your network range, defined in the config |
| Destination port | any | Port it goes to |
Note: ICMP has no ports, but the rule syntax still requires the port fields, so they're written as any.
Rule actions
| Action | Effect | Needs inline (IPS) mode? |
|---|---|---|
alert | Generate an alert and log the packet | No |
log | Log the packet, no alert | No |
pass | Ignore the packet (whitelist) | No |
drop | Block and log | Yes |
reject | Block + send a TCP reset / ICMP unreachable | Yes |
Rule options (inside the parentheses)
| Option | Example | Meaning |
|---|---|---|
msg | msg:"Ping Detected"; | Text shown in the alert. Should describe the activity |
sid | sid:10001; | Signature ID: unique identifier of the rule |
rev | rev:1; | Revision: increase it every time you change the rule |
Other options you'll meet soon:
| Option | Use |
|---|---|
content:"text"; | Match a string or bytes in the payload |
nocase; | Make content case-insensitive |
classtype:...; | Category, which also sets the priority |
flow:to_server,established; | Match only established connections in one direction |
threshold / detection_filter | Alert only after N matches in T seconds (e.g. brute force) |
Syntax rules: options are separated by ;, the last option also ends with ;, and the whole block is in parentheses.
⚠️ SID ranges — the course breaks the convention
| SID range | Reserved for |
|---|---|
| < 100 | Reserved |
| 100 – 999,999 | Official rules (Snort / Talos) |
| ≥ 1,000,000 | Local / custom rules ← use these |
The course's examples use sid:10001 and sid:10003, which fall in the official range. They work in a lab, but in production they can clash with real rules. Use sid:1000001 and up.
9. Creating & Testing a Rule
Step 1 — Add the rule to local.rules
sudo nano /etc/snort/rules/local.rulesAdd after the existing rules:
alert icmp any any -> 127.0.0.1 any (msg:"Loopback Ping Detected"; sid:10003; rev:1;)Save: Ctrl+X → Y → Enter.
⚠️ Don't delete the existing rules. The next task needs them.
Step 2 — Run Snort on the live interface
sudo snort -q -l /var/log/snort -i lo -A alert_fast -c /etc/snort/snort.luaStep 3 — Trigger the rule
ping 127.0.0.1Step 4 — Read the alert
12.401504 [**] [1:1000001:1] "Loopback Ping Detected" [**] [Priority: 0] {ICMP} 127.0.0.1 -> 127.0.0.1| Part | Meaning |
|---|---|
12.401504 | Timestamp |
[1:1000001:1] | [GID : SID : REV]: generator ID (1 = rules engine), signature ID, revision |
"Loopback Ping Detected" | The msg from the rule |
[Priority: 0] | No classtype was set, so no priority was assigned |
{ICMP} | Protocol |
127.0.0.1 -> 127.0.0.1 | Source → destination |
⚠️ Mismatch in the course screenshot: the rule you added has sid:10003, but the alert shows SID 1000001. Either the screenshot came from a different version of the rule, or another rule with the same message already exists in local.rules. In your lab, the SID in the alert should match the SID you wrote. If it doesn't, check local.rules for duplicates.
Three alerts, one per second = one alert per ping packet. ping sends one request per second.
10. Running Snort on a PCAP (Forensics)
For historical traffic saved in a capture file, replace the live interface with a file:
sudo snort -q -l /var/log/snort -r Task.pcap -A alert_fast -c /etc/snort/snort.luaReplace Task.pcap with the path to your capture.
| Live monitoring | PCAP analysis |
|---|---|
-i lo / -i eth0 | -r file.pcap |
| Real-time detection | Forensic investigation of past traffic |
| Runs until stopped | Ends when the file is processed |
Useful trick: write a new rule, run it against an old PCAP, and you find out whether a newly discovered attack already happened in your network.
11. Command Flags Cheat Sheet
| Flag | Meaning |
|---|---|
-c <file> | Config file to load (snort.lua). Enables NIDS mode |
-i <iface> | Interface to listen on (lo, eth0, ens33) |
-r <file> | Read traffic from a PCAP instead of an interface |
-A <mode> | Alert output mode (alert_fast = one line per alert; alert_full, cmg, …) |
-l <dir> | Log directory (/var/log/snort) |
-q | Quiet: hide the startup banner and stats |
-v | Verbose: print packets (sniffer mode) |
-T | Test the configuration and exit. Run it after every rule change |
sudo | Needed to capture packets on an interface |
Reading the course command as a sentence:
sudo snort -q -l /var/log/snort -i lo -A alert_fast -c /etc/snort/snort.lua
run quietly, log here, on loopback, short alerts, with this configCore Rules
- Firewall = gate; IDS = cameras. The IDS watches what got through.
- IDS alerts; IPS blocks. IDS is passive, IPS is inline.
- HIDS = deep on one host; NIDS = broad across the network. Use both.
- Signature = known attacks, few false positives. Anomaly = zero-days, many false positives. Hybrid = both.
- Snort is rule-based, with modes sniffer (show), logger (save) and NIDS (detect).
- Promiscuous mode isn't enough on a switch. You need SPAN or a TAP.
- Rule = action, protocol, src, src port, direction, dst, dst port, (options).
- Custom SIDs start at 1,000,000. Bump
revon every change. -ifor live traffic,-rfor a PCAP. Always load the config with-c.- Test with
-T, then trigger the rule yourself to prove it works.
Acronyms
| Acronym | Meaning |
|---|---|
| IDS / IPS | Intrusion Detection / Prevention System |
| HIDS / NIDS | Host-based / Network-based IDS |
| NIPS | Network-based Intrusion Prevention System |
| EDR | Endpoint Detection and Response |
| SID / GID / REV | Signature ID / Generator ID / Revision |
| PCAP | Packet Capture file |
| NIC | Network Interface Card |
| SPAN | Switched Port Analyzer (port mirroring) |
| TAP | Test Access Point |
| ICMP | Internet Control Message Protocol |
| CVE | Common Vulnerabilities and Exposures |
| SOC | Security Operations Center |