Free readiness test
Home / Tool labs / Suricata

Suricata hands-on lab Catch the beacon with your own rule

Detect attacks in network traffic with signatures, and write your own.

NetworkIntermediatePro live lab5 objectives
analyst@ids-lab:~/suricata$
$ cat logs/fast.log
11/08/2026-10:11:59 [**] [1:2027863:4] ET INFO Observed DNS Query to newly registered domain [**] [Priority: 2] {UDP} 10.10.30.77:55012 -> 10.10.0.53:53
11/08/2026-10:12:04 [**] [1:2018358:9] ET POLICY HTTP Request with Ancient MSIE 6 User-Agent [**] [Priority: 1] {TCP} 10.10.30.77:51544 -> 185.243.115.84:80
11/08/2026-10:14:41 [**] [1:2013028:7] ET POLICY curl User-Agent Outbound [**] [Priority: 2] {TCP} 10.10.30.77:51790 -> 140.82.112.21:443
11/08/2026-10:20:19 [**] [1:2210045:2] SURICATA STREAM Packet with invalid ack [**] [Priority: 3] {TCP} 52.97.146.162:443 -> 10.10.30.77:50211
Generic rules hint at the problem but don't name this C2. A custom rule will catch every beacon precisely.

What is Suricata?

Suricata is a high-performance IDS/IPS and network security monitor. It matches traffic against rules such as the free ET Open ruleset and writes alerts and protocol metadata to eve.json.

1 Rules

A rule says: action, protocol, direction, and what to look for (content, headers, TLS SNI…), plus a unique sid.

2 IDS vs IPS

IDS mode alerts; IPS mode sits inline and can drop matching traffic.

3 eve.json

Structured JSON output (alerts, DNS, HTTP, TLS, flows) that ships easily to a SIEM.

The scenario: Catch the beacon with your own rule

The capture from WS-077 is in capture.pcap. Run Suricata with the ET Open rules, review the alerts, then write a custom rule that reliably detects the /api/v2/beacon C2 traffic and prove it fires.

Run this lab live in the platform

A simulated terminal with 5 objectives, hints and scenario questions. Included with NERvE Pro.

Open the Suricata lab

Step-by-step: Suricata commands used in this lab

1Run Suricata on the capture with the default rules

-r reads a pcap, -l sets the log folder.

suricata -r capture.pcap -l logs/

2Read the quick alert log

fast.log has one line per alert.

cat logs/fast.log

3Count alerts by signature from eve.json

jq: select alerts, print the signature, count.

jq -r 'select(.event_type=="alert") | .alert.signature' logs/eve.json | sort | uniq -c

4Write a custom rule for the beacon

Append an http rule matching the URI to local.rules.

echo 'alert http any any -> any any (msg:"NERvE C2 beacon"; http.uri; content:"/api/v2/beacon"; sid:1000001; rev:1;)' >> local.rules

5Re-run with your rule and confirm it fires

-S loads your rules file.

suricata -r capture.pcap -S local.rules -l logs/

Key takeaways

Install Suricata and practise for real

sudo add-apt-repository ppa:oisf/suricata-stable && sudo apt install suricata && sudo suricata-update

suricata-update downloads the free ET Open rules. Run with -r on sample pcaps first. Only scan or test systems you own or are explicitly authorised to assess. Official site: suricata.io · Licence: GPLv2.

Scenario questions

Why use sid 1000001 or higher for your own rules?

Answer: IDs below 1,000,000 are reserved for official/distributed rulesets. Local rules use sids from 1,000,000 upward to avoid clashing with published rulesets.

What would make Suricata block the beacon instead of alerting?

Answer: Run inline in IPS mode and use the drop action. In IPS (inline) mode, 'drop' rules block matching traffic.

Why is a precise custom rule better than generic alerts here?

Answer: It detects every beacon from this C2 family with fewer false positives. Specific detections give high-fidelity alerts you can act on automatically.

More open-source tool labs