Firewalls and intrusion detection (Firewall & IDS)
The firewall decides who gets through, and the IDS watches what is inside the traffic. A SOC analyst has to read both and link them together.
The firewall decides who gets through, and the IDS watches what is inside the traffic. A SOC analyst has to read both and link them together.
Ashur Digital Bank (fictional) opened an RDP port "temporarily" for a maintenance vendor two months ago and nobody closed it. Tonight Suricata raised alerts on that same server.
0 of 15 · 0 of 250 points
Linux terminal
Try this room's commands on real Linux running in your browser, with the files you need.
Task 1: Introduction
Scenario: Ashur Digital Bank (fictional) opened an RDP port "temporarily" for a maintenance vendor two months ago and nobody closed it. Tonight Suricata raised alerts on that same server.
What you'll learn in this room
- Read firewall rules and understand why their order matters
- Tell IDS and IPS apart
- Analyse Suricata alerts in eve.json format
Each task has an explanation and questions you answer by typing. At the end there is a hands-on lab where you hunt for flags, then the quiz.
1.1Let's start
Task 2: Firewall rules
The firewall: who gets through and who doesn't
A firewall compares every connection with a list of rules: source, destination, protocol and port, then allow or deny.
- Order matters: the first rule that matches is the one applied, and the rest are ignored.
- Default deny: the last rule blocks everything not clearly allowed.
- Shadowed rule: a rule that never matches because an earlier rule catches the same traffic.
- The most dangerous thing: "temporary" rules that open a management service (RDP 3389 or SSH 22) to the whole internet,
any.
cd jobready/firewall
cat rules.txt
2.1In rules.txt, which rule number opens RDP (port 3389) to the whole internet?
102.2What is the number of the default deny rule?
52.3Which rule number will never match because an earlier rule blocks the same network?
10Task 3: IDS and IPS
IDS and IPS: the guard that reads the content
- IDS (intrusion detection system): watches a copy of the traffic and raises an alert, but does not block.
- IPS (intrusion prevention system): sits in the path and can drop the packet.
- They work with signatures, like the Emerging Threats rules, or by spotting unusual behaviour.
- The best known open source tool: Suricata (and Snort before it).
grep -c '"event_type":"alert"' eve.json
grep '"blocked"' eve.json
3.1How many alerts are in eve.json?
53.2How many of them were actually blocked (action = blocked)?
5Task 4: Reading Suricata alerts
Reading Suricata alerts
Suricata writes events to eve.json, one event per line. The key fields:
event_type: the kind of event (alert,flow,dns...).src_ip,dest_ipanddest_port: who attacked whom and on which port.alert.signatureandalert.signature_id: the rule's name and number.alert.action:allowedmeans the packet got through,blockedmeans the IPS dropped it.alert.severity: 1 is the most serious.
In the SOC you group alerts by source, and match the target against the firewall rules to learn why the attack reached it at all.
grep alert eve.json | grep -o '"src_ip":"[^"]*"' | sort | uniq -c | sort -rn
grep BlueKeep eve.json
4.1Which external IP caused the most alerts?
104.2What is the signature_id of the Nmap scan alert?
54.3Which internal host (IP) did the BlueKeep exploitation attempt target?
10Task 5: Lab: The night of the open RDP
The night of the open RDP
Link the alerts to the rules: why did the attack reach the server at all? And which alert shows an infected machine on the inside?
grep 3389 rules.txt
grep '"severity":1' eve.json
5.1Which rule number must be removed at once to close this attack path?
105.2Which internal host (IP) has the Cobalt Strike Beacon alert?
105.3Find the flag inside the payload of the BlueKeep alert.
20Task 6: Quiz
Quiz
Answer the questions to complete the room. Go back to the tasks if you need to.
6.1If rule 3 allows and rule 9 denies the same connection, what happens?
506.2What is the main difference between IDS and IPS?
506.3In a Suricata alert, what does action = allowed mean?
50