The VikiD Truth

Knowledge base / Computing / Security

Computing | Computer Security | Linux Security | Industrial Control Systems Security | Penetration Testing | Exploitation | Social Engineering | Metasploit | encryption | IDS/IPS | HoneyPots | Securing Web/Apps

IDS/IPS

Intrusion Detection System

Intrusion Prevetion System

                 _________
                 |SpanPort|
               x-----------
          |    |	             ________------
          |    |        _______      |vlan1  |HIDS| on host machine
          |    |public  |      |     |       ------
  isp --> | // |--------|Server|-----|
          |    |  ^     |______|     |
          |    |  |                  |       ---------
          |    | NIDS                |_______|Honeypot|
         firewall                     vlan2  ----------

Network Based IDS
Host Based IDS

Normally we only use NIDS which sits next to the firewall which is running in spanport mode. In the IDS software we create rules (signature) and if it matches rule or finds an anomaly then it will raise a log.

Tools

Snort

  1. Start snort service
  2. configure rules
  3. restart snort
  4. start snort console
  5. attack and detect
 sudo vi /etc/snort/snort.conf
 /etc/init.d/snort restart
 snort -q -A -i wlan0 -c /etc/snort/snort.conf
 nmap -sU 192.168.100.82

Updating the notes for 2026

The commands above are from my training-lab days and reflect Snort 2 on an old Ubuntu box with SysV init scripts. Today Snort 3 is the actively developed version (Snort 2 is legacy), its configuration is a Lua file (snort.lua) rather than snort.conf, and services are managed with systemctl rather than /etc/init.d. Suricata and Zeek have become the other two big open-source names. The ideas, though, have not changed at all.

The plain idea

An intrusion detection system (IDS) watches traffic or activity and raises an alarm when something looks like an attack. It is a burglar alarm: it notices and tells you (alert, log, email), but it does not stop anything. An intrusion prevention system (IPS) does everything an IDS does and can also act, by dropping the offending packets or resetting the connection, because it sits inline, in the path of the traffic, rather than off to the side.

There are two places to put one, as in my diagram:

Detection works in two broad ways. Signature detection matches known patterns (“this byte sequence is the EternalBlue exploit”). Anomaly detection learns what normal looks like and flags departures from it (“this server never talks to Russia at 3am, and now it does”).

Why it matters

Firewalls decide what is allowed in. They say nothing about whether allowed traffic is malicious. A web server must accept connections on port 443, and an attacker’s exploit arrives on port 443 too. IDS/IPS looks inside the allowed traffic. It is also often how you learn you have been breached at all: an alert from a sensor can be the difference between finding an intruder in a day or in a year.

An everyday analogy: the shop

The firewall is the shop’s locked door and opening hours. The IDS is the CCTV camera and the guard watching the monitors: they see the shoplifter and radio for help. The IPS is the guard standing at the door who can physically stop someone walking out with the goods. Stand the guard in the doorway and you also risk them stopping honest customers, which is why IPS rules are tuned more carefully than IDS rules.

A worked example: a Snort 3 rule

Here is a simple rule that alerts on an ICMP ping sweep reaching the network, the sort of thing my lab exercise triggered with nmap:

alert icmp any any -> $HOME_NET any (
    msg:"ICMP ping detected";
    itype:8;
    sid:1000001; rev:1;
)

Read it as a sentence: alert on ICMP traffic from any address and port to my home network, any port, when the ICMP type is 8 (echo request); label it with this message and a unique signature ID (local rules use IDs above 1,000,000).

On a modern system you would run something like:

sudo systemctl restart snort3            # service name varies by distro
snort -c /etc/snort/snort.lua -R local.rules -i eth0 -A alert_fast

and from another machine, nmap -sn 192.168.100.0/24 would light up the console. In IPS mode, change alert to drop and run Snort inline (for example with the afpacket DAQ in inline mode) and those packets never arrive.

Common misconceptions

How it connects

The truth revealed: detection is not about building a wall nobody can climb. It is about making sure that when someone does, you hear them.

Last edited · 7 revisions

Tags: #Computing