Intrusion prevention: switching it on and reading the detections

John Smith Ltd wants the headquarters appliance not just to filter ports and addresses but to look inside the traffic: to spot an office PC talking to a malware command server, a browser led to a…

Situation

John Smith Ltd wants the headquarters appliance not just to filter ports and addresses but to look inside the traffic: to spot an office PC talking to a malware command server, a browser led to a page with an exploit kit, a miner in the guest network — and to stop the clear-cut cases.

In Argos this is the Inspector (Protection → Inspector): an inline intrusion prevention engine, with the Emerging Threats Open ruleset, plus the behavioural analysis, which bans the addresses that attack. You read them in Events and diagnostics → Detections and Events and diagnostics → Behavioural analysis.

Encrypted content stays encrypted: the Inspector does not intercept TLS and does not ask you to install certificates on the clients. The signatures work on what travels in clear (DNS queries, unencrypted HTTP, protocol headers) and on the metadata of encrypted connections, such as the server name asked for in the client hello (SNI); the JA4 fingerprint of the TLS clients of the inspected zones ends up in Events and diagnostics → TLS clients. So the Inspector recognises a PC that contacts a known command server, not the content of an HTTPS page.

The headquarters appliance has 4 cores, 8 GiB of memory and a 120 GB disk.

What you need

  • The resources for the level you choose. The console disables the levels the appliance cannot handle and says why:

    Level What it does Needs at least
    “None” no inspection —
    “Standard” the intrusion prevention engine, inline, on the chosen zones 2 cores, 2 GiB of memory, 8 GB of disk
    “Advanced” as Standard, plus passive traffic analysis (Zeek) on the interfaces of the chosen zones 4 cores, 4 GiB of memory, 16 GB of disk and the Zeek package installed

    The memory is what is installed: a 4 GB appliance is fine for “Advanced” even if the system sees a little less. The disk is the space where the engines write their logs: the volume the ISO installation creates for them is enough.

    With the full ruleset the engine alone uses about half a GiB of memory; the “Advanced” level adds one analysis process per observed interface. On a 2 GiB appliance choose “Standard”.

  • The appliance must download the ruleset from the internet: it does so on its own, every day.

  • For blocking, the program that builds the ruleset (suricata-update): without it the console refuses “Block what it detects”.

Warning The Inspector looks at every connection the chosen zones accept, from the first packet to the last, in both directions: it uses CPU in proportion to the traffic. Switch it on first on the client zones, watch the Status page for a few days, then widen it. SSH and the console never go through the engine: a slow or stopped engine does not lock you out.

Steps

Switching inspection on

  1. Open Protection → Inspector. The “DPI protection” panel holds, from the top, the “Behavioural analysis” switch, the “Inspection level”, “Block what it detects” and the “Inspected zones”.
  2. Switch on “Behavioural analysis”. After saving, the state of the service appears under the switch: “Running · rules installed” when the engine’s alerts can become bans.
  3. In “Inspection level” choose “Standard”.
  4. Leave “Block what it detects” off for now: for the first few days the engine only reports, and you see what it would find.
  5. In “Inspected zones” switch on LAN and GUESTS (the guests’ zone), the zones of the clients that go out to the internet. Leave WAN off: you add it only to inspect the traffic to the published servers too (see Protection). No zone chosen means no inspection: the console refuses an active level without zones with “Choose at least one zone to inspect, or switch inspection off”.
  6. Press “Save”. The console writes the engine’s configuration and starts it: “DPI configuration applied, with warnings — the inspected zones follow the change once the firewall is applied (header)” appears.
  7. Handing the traffic to the engine is part of the firewall rules: open the firewall button in the header (“Unapplied changes”), choose “Apply” and, in the “Keep the new ruleset?” window, press “Confirm” within 60 seconds.

The ruleset

  1. Below, the “Ruleset” panel appears (Emerging Threats Open): “Signatures” (the rules loaded), “Blocking” (those that stop traffic), “Last update” and “Schedule” (“daily, between 04:20 and 06:20”). On the first start the download begins on its own; until it is over the panel warns “No signature loaded: the engine inspects the traffic but matches nothing…”.

  2. To update now, press the button on the right of the panel’s header (“Update now”): “Ruleset update started — it takes a few minutes” appears. The page refreshes itself every 10 seconds and shows the new count as soon as the engine has loaded the rules.

    The Ruleset panel after the first updateThe Ruleset panel after the first update
    The Ruleset panel after the first update

The engine takes the new rules without stopping: during an update the traffic keeps flowing, inspected.

Switching blocking on

After a few days of reporting only, if in Events and diagnostics → Detections you see no high-severity alerts on legitimate traffic:

  1. Go back to Protection → Inspector, switch on “Block what it detects” and press “Save”.

    The Inspector at the Standard level on LAN and GUESTS, with blocking onThe Inspector at the Standard level on LAN and GUESTS, with blocking on
    The Inspector at the Standard level on LAN and GUESTS, with blocking on
  2. The ruleset is rebuilt on its own with the new filter (a few minutes): the “Blocking” value goes from 0 to a few tens of thousands.

Blocking does not turn everything into a ban. Only the high-confidence groups become blocking rules: malware command and control, exploit kits, mobile malware, responses from a compromised host, coin miners, worms, botnet and Cobalt Strike server lists, Spamhaus DROP. Scans, informational rules, phishing pages (the DNS filter stops those) and Tor stay report-only.

For the technician For each chosen zone, the zone’s accept verdicts (services, forward matrix, policies) become queue num 0 bypass with a connection mark; in the base chains the marked established connections are queued before the accept, and an output chain queues the appliance’s replies: the engine sees whole flows, both ways. The drop and reject rules stay with the firewall. The management baseline (SSH, console) comes before any hand-off and is never marked. bypass means that with the engine stopped the traffic passes uninspected instead of stopping. The ruleset is downloaded by argos-suricata-update.service (daily timer), tested with the engine and loaded with SIGUSR2, without a restart. HOME_NET is the appliance’s configured networks; of the wan, only its address.

Verification and reading

The Status page

In System status → Status:

  • the services card shows “Intrusion detection and prevention”, “Ruleset updates”, “Behavioural protection” and “Ban enforcement”, “Running”;
  • the “Threat detection” card sums up the last 24 hours: for the behavioural protection “Active bans”, “Alerts 24h” and the “Top scenarios”; for the engine (“Intrusion prevention” with blocking on, “Intrusion detection” without) the counts per severity, the “Inspected” and “Blocked” packets, the events per hour and the “Top signatures”;
  • “Latest events”, at the bottom of the same card (it scrolls inside), groups what repeats: one row per engine, severity and message, with “×N” when there are several events; hovering over it you read “N identical events, from M address pairs”;
  • the “Attention” strip reports, for example, “3 high-severity intrusion attempts in the last 24 hours”.
The Threat detection card on the Status pageThe Threat detection card on the Status page
The Threat detection card on the Status page

The “Status” panel at the bottom of Protection → Inspector also shows the level and the high, medium and low severity detections of the last 24 hours: each number opens the log at that severity.

Events and diagnostics → Detections

  1. Open Events and diagnostics → Detections. At the top choose the “Period” (1 hour, 24 hours, 7 days) and the “Severity” (“All”, “Medium+”, “High”).
  2. The figures at the top give “Events”, “Last event”, “High severity” and “Sources”. Below, “Most frequent detections” and “Sources with the most events”.
  3. The “Events” table lists each event: “Time”, “Severity”, “Source”, “Destination”, “Event”. The event is the signature’s name in readable form, as on the “Threat detection” card of the Status page (for example “Malware: …” for ET MALWARE …), with the category below; the name as the engine writes it shows when you hover over it (“Show only …”).
  4. Clicking a value (a signature, an address) filters the page on it; the “Signature, address or engine” field filters by hand.
Detections filtered on high severityDetections filtered on high severity
Detections filtered on high severity

Example: a high-severity event with source 192.168.10.57 (an office PC) and as destination an external address, with a command and control name. With blocking on, the connection has already been stopped; the PC still needs checking.

The address inspector

Next to every address in the logs there is an icon (“Details of …”) that opens a window on the address:

  • for a public address: the “Reverse DNS” and the “Registry” (holder, network, block, country, abuse contact, registration date); with a Shodan key of the customer’s own (Events and diagnostics → Shodan), the “Ask Shodan” button shows the “Open ports”, “Host names”, “Operating system” and “Known CVEs” Shodan knows. The appliance never scans the internet;
  • for a local address: “On this appliance” says which interface and zone it is on, by which route it is reached, the known names, the DHCP lease and the MAC; the “Scan (MAC, OS, ports)” button scans it with nmap (up to two minutes) and gives the operating system and the open ports.
The address inspector on a LAN PCThe address inspector on a LAN PC
The address inspector on a LAN PC

For the PC 192.168.10.57: the DHCP lease gives its name, the MAC identifies it for certain, the scan shows what it exposes.

Events and diagnostics → Behavioural analysis

Here are the behavioural analysis’s alerts and the decisions it is enforcing: “Alerts”, “Last alert”, “Sources”, “Active decisions”, then “Most frequent scenarios”, “Sources with the most alerts” and the table with “Scenario”, “Source”, “Country”, “Events” and “Decision” (the ban and its duration, or “none”).

The behavioural analysis log with two active bansThe behavioural analysis log with two active bans
The behavioural analysis log with two active bans

In the example the table has 198.51.100.77 banned for crowdsecurity/suricata-major-severity (“Serious intrusion prevention alert” on the Status page): an external server that triggered a high-severity signature in a connection of an office PC. The other ban is 198.51.100.23, for repeated SSH login attempts (crowdsecurity/ssh-bf).

The typical scenarios are repeated SSH login attempts, port scans, searches for panels and sensitive files on the published web services. Two scenarios come from the Inspector: crowdsecurity/suricata-major-severity (“Serious intrusion prevention alert”) and crowdsecurity/suricata-high-medium-severity (“Repeated intrusion prevention alerts”): the behavioural analysis bans the source of the Inspector’s high and medium severity alerts.

What to do with a false positive

An alert on legitimate traffic, without blocking. It is just noise in the log: note the signature and the address pair. The console has no list of signatures to exclude; if the signature is in the groups that become blocks, leave “Block what it detects” off until you have cleared it up.

Blocking stops a legitimate service. In Detections filter on the service’s address, find the signature and check with the address inspector who the source and destination are. To restore the service at once:

  1. in Protection → Inspector switch off “Block what it detects” and press “Save”: the ruleset goes back to report-only in a few minutes;
  2. or remove the service’s zone from the “Inspected zones”, “Save” and apply the firewall.

A host that always produces false positives. If it is always the same host — the NAS 192.168.10.20 with its nightly backups to the cloud, for example — there is no need to switch blocking off or remove the zone: exempt just that host in Protection → Exemptions with “Inspection” on, then apply the firewall. Its connections, in both directions, no longer go to Suricata or Zeek: no detections and no prevention for it, while the rest of the zone stays inspected and the blocklist, CrowdSec and the zone rules still apply (see Protection).

A banned address that should not have been. The behavioural analysis can also ban an internal address, if it is the source of serious alerts (an infected PC, but also a false positive), or a partner’s public address, for example the partner’s office (198.51.100.25) after a series of failed SSH logins. The ban lasts as long as the “Decision” column says. To lift it earlier, from System → Shell:

cscli decisions list
cscli decisions delete --ip 198.51.100.25

Before lifting the ban on an internal PC, make sure it is clean: if the scenario is a serious Inspector alert, the ban is exactly what isolated it.

Impact on performance

  • The engine works on every connection the chosen zones accept: more zones and more traffic mean more CPU. Watch the “Hardware” card of the Status page; the “Attention” strip reports “CPU saturated for the last 5 minutes”.
  • The engine’s memory depends on the ruleset (about half a GiB with the full ET Open), not on the traffic.
  • The disk is for the engines’ logs, which rotate on their own.
  • Leave out the zones you do not need (for example a cameras-only zone that does not go out to the internet).
  • If the CPU is not enough, first remove a zone, then consider stepping down from “Advanced” to “Standard”.

If something goes wrong

What you see What it means What to do
The “Standard” or “Advanced” options are disabled, with “This host lacks the resources for DPI…” The appliance does not have enough cores, memory or disk for that level. Choose the level it can handle, or upgrade the appliance.
“Traffic analysis is not installed on this host (package zeek-core): install it, or pick the standard level” The “Advanced” level needs traffic analysis. Install Zeek from the EDON repository, or use “Standard”.
“Ruleset updates are not installed…” The program that downloads and builds the ruleset is missing. Install the suricata-update package.
Ruleset: “The last update failed: the reason is in Events and diagnostics → System.” Downloading or testing the ruleset failed; the engine keeps the rules it has. Check the internet uplink; read the reason in Events and diagnostics → System.
“Signatures” stays at 0 The first download is not over yet or failed. Press “Update now” and wait a few minutes.
Detections: “Inspection is off: the engines write nothing.” The level is “None”. Switch a level on.
Empty Detections with the engine active The zones have not been applied in the firewall, or there is no traffic in the chosen zones. Apply the firewall from the header.
Status: “The behavioural protection has no ban enforcement: its bans are not applied” The component that enforces the bans in the firewall is missing. Install and start the CrowdSec bouncer.
“rules missing: intrusion prevention alerts become no bans” The behavioural analysis does not read the engine’s alerts. Install CrowdSec’s Suricata collection.
“Behavioural analysis is not installed on this host (package crowdsec): the switch takes effect once it is.” The package is missing. Install the crowdsec package.
LET’S TALK INFRASTRUCTURE

Control starts with a conversation.

Tell us about your infrastructure. Let’s start with what you actually need.

Talk to an engineer