Skip to content
Visual explainer 2h 30m to learn 5 steps

IDS/IPS & common network attacks

Recognise common network attacks and explain how IDS and IPS detect or block them.

By Invicly Tech, , in Computer Networking. About 12 minutes to read.

Topic 42 of 51

In short

Common network attacks include reconnaissance scans, spoofing to intercept traffic, and floods that exhaust resources. An intrusion detection system watches traffic and alerts on suspicious patterns, while an intrusion prevention system sits inline and can block them. Detection uses known signatures or deviations from normal behaviour.

Explained simply

Attackers use a small set of classic tricks again and again. They look around first (scanning), then try to sit in the middle of conversations (spoofing), or simply flood a target until it falls over (denial of service). Knowing how each one works on the wire is the first step to stopping it.

An IDS (intrusion detection system) is like a security camera. It watches copies of network traffic and raises an alert when something looks like an attack. An IPS (intrusion prevention system) is like a guard at the door. It sits in the path of the traffic and can block bad packets before they arrive.

These systems find attacks in two main ways. Signature detection looks for known patterns, like a fingerprint database. Anomaly detection learns what normal traffic looks like and warns when something is unusual. Signatures are precise but miss new attacks; anomalies can catch new things but cause more false alarms.

No single tool stops everything. Real networks layer defences: switches that block ARP and DHCP tricks, firewalls that limit exposure, IDS sensors that watch, and TLS encryption that keeps intercepted traffic unreadable.

Press Play on a diagram to walk through it one step at a time.

MapAttacks and defences
Network threats
  • Reconnaissance
    • Port scans
    • Defence: IDS alerts, minimal exposure
  • ARP spoofing / MITM
    • Fake gateway MAC
    • Defence: dynamic ARP inspection, TLS
  • SYN flood / DDoS
    • Exhaust connections or bandwidth
    • Defence: SYN cookies, scrubbing, CDN
  • DNS spoofing
    • Forged answers
    • Defence: DNSSEC, trusted resolvers
  • Rogue DHCP / AP
    • Hijack clients
    • Defence: DHCP snooping, WIDS
FlowLife of an alert in an IDS
  1. 1
    Traffic copied

    SPAN port or TAP sends frames to the sensor

  2. 2
    Decode and reassemble

    Engine rebuilds TCP streams and protocols

  3. 3
    Match rules

    Signatures and thresholds are checked

  4. 4
    Alert

    Event with sid, IPs and ports goes to the log

  5. 5
    Triage

    Analyst or SIEM checks if it is real

  6. 6
    Respond

    Block, isolate the host or tune the rule

In depth

ARP spoofing and man-in-the-middle

ARP has no authentication. Any host on a LAN can send an ARP reply saying "IP 192.168.1.1 is at my MAC address", and most devices simply update their ARP cache, even if they never asked (a gratuitous ARP). An attacker sends such replies to a victim (claiming to be the gateway) and to the gateway (claiming to be the victim). Now both send their traffic to the attacker, who forwards it on, so nothing seems broken. That is a man-in-the-middle (MITM).

Signs: the gateway's MAC in ip neigh suddenly changes or matches another host's MAC, and ARP traffic rises. Defences: Dynamic ARP Inspection on managed switches drops ARP replies that do not match the DHCP snooping table of known IP-to-MAC pairs; port security limits MACs per port; and TLS everywhere means intercepted traffic stays encrypted, and fake certificates trigger browser warnings.

SequenceARP spoofing puts the attacker in the middle
Victim
Attacker
Gateway
  1. 1Fake ARP: gateway IP is at attacker MAC
    Attacker to Victim: Fake ARP: gateway IP is at attacker MAC
  2. 2Fake ARP: victim IP is at attacker MAC
    Attacker to Gateway: Fake ARP: victim IP is at attacker MAC
  3. 3Victim's traffic goes to attacker
    Victim to Attacker: Victim's traffic goes to attacker
  4. 4Attacker reads it, forwards it
    Attacker to Gateway: Attacker reads it, forwards it
  5. 5Replies also pass the attacker
    Gateway to Attacker: Replies also pass the attacker
  6. 6Forwarded on, victim notices nothing
    Attacker to Victim: Forwarded on, victim notices nothing

SYN floods and DDoS

A SYN flood abuses the TCP handshake. The attacker sends huge numbers of SYN packets, often with fake source IPs, and never completes the handshake. Each one used to reserve a slot in the server's backlog of half-open connections, so real clients were refused. SYN cookies solve this: when the backlog is full, the server encodes the connection details in the sequence number of its SYN-ACK and stores nothing; only a real client's final ACK rebuilds the state. On Linux, net.ipv4.tcp_syncookies = 1 is the default.

DDoS (distributed denial of service) uses thousands of machines. Volumetric attacks fill the link, often by amplification: small spoofed UDP queries to open DNS, NTP or memcached (UDP 11211) servers produce much larger replies aimed at the victim. Protocol attacks like SYN floods exhaust state. Application attacks send expensive HTTP requests. Big floods must be stopped upstream by the ISP, a scrubbing service or a CDN; a single server cannot out-filter a full pipe.

MapTypes of denial-of-service attack
DDoS
  • Volumetric
    • UDP floods
    • DNS, NTP, memcached amplification
    • Measured in Gbps
  • Protocol
    • SYN floods
    • Fragment attacks
    • Exhaust state tables
  • Application
    • HTTP floods on slow pages
    • Slowloris holding connections
    • Measured in requests per second

Scanning and reconnaissance

Before attacking, intruders map the target. Passive recon uses public data: DNS records, certificate transparency logs (which list every certificate issued for a domain), search engines and leaked documents. Active recon touches your systems: ping sweeps to find live hosts, port scans to find open services, and banner grabbing or version detection to find out what software runs there.

On the wire, a SYN scan looks like one source sending SYNs to many ports, getting SYN-ACKs from open ones and resets from closed ones, and then sending its own reset instead of completing the handshake. A horizontal scan hits one port across many hosts, typical of worms looking for one bug. Scans are cheap and constant on the internet, so alerting on every one creates noise; the useful defence is to expose little, keep exposed software patched, and alert on scans from inside your network, which are far more suspicious.

  • Vertical scan: many ports on one host
  • Horizontal scan: one port on many hosts
  • Internal scans are a strong compromise signal
  • Certificate transparency reveals your hostnames

Signature and anomaly detection

Signature engines such as Suricata and Snort match traffic against rules. A rule has an action (alert, drop), a header (protocol, source, destination, ports) and options in parentheses: content matches bytes in the payload, flags matches TCP flags, threshold or detection_filter counts events over time, and sid gives each rule a unique ID. Rule sets like Emerging Threats are updated daily. Signatures produce few false positives for known threats but miss new or disguised ones.

Anomaly detection builds a baseline of normal behaviour, such as usual traffic volumes, which hosts talk to which, typical DNS lengths, and flags deviations: a workstation suddenly uploading 20 GB at night, or sending DNS queries with very long random names (a sign of DNS tunnelling). Zeek is popular here: it writes rich logs (conn.log, dns.log, http.log, ssl.log) that analysts and machine learning tools search. Anomaly methods catch new attacks but need tuning, because normal also changes.

CompareSignature versus anomaly detection
Signature
  • Matches known patterns
  • Few false positives
  • Misses new attacks
  • Needs rule updates
Anomaly
  • Compares with a baseline
  • Can catch new attacks
  • More false positives
  • Needs learning and tuning

Where to place an IDS or IPS

An IDS needs a copy of traffic. It gets one from a switch mirror port (SPAN) or a network TAP, a small device that copies every frame. Because it is out of band, a crash or overload of the IDS never stops traffic, but by the time it alerts, the packet has already arrived. An IPS sits inline, like a bump in the wire, so it can drop bad packets, but it adds a little latency and becomes a failure point; inline devices often have fail-open bypass so traffic keeps flowing if they die.

Place sensors where they see the traffic you care about: just inside the internet firewall (attacks that got past it), in front of the DMZ, and between internal zones to catch movement from one compromised host to another. Encryption limits inspection: with TLS, sensors see IPs, ports, the server name and certificate data, but not content, unless TLS is terminated on a proxy that hands decrypted traffic to the IPS.

  • IDS: out of band via SPAN or TAP, alerts only
  • IPS: inline, can drop, adds a failure point
  • Sensors between zones catch lateral movement
  • TLS hides content from both

Learn it in 5 short steps

About 30m each. Track them with a timer in your plan.

  1. 1
    Describe ARP spoofing and MITM~30m
  2. 2
    Describe DDoS and SYN floods~30m
  3. 3
    Describe port scanning and reconnaissance~30m
  4. 4
    Compare signature and anomaly detection~30m
  5. 5
    Compare IDS and IPS placement~30m

Key points

  • An IDS is passive and alerts; an IPS is inline and can drop traffic.
  • Signature detection catches known attacks; anomaly detection finds unusual behaviour with more false positives.
  • Suricata, Snort and Zeek are widely used open-source tools.
  • Encryption limits what network sensors can inspect.

Key terms

Tap a card to flip it. 0/5 known

Examples

text
# Suricata-style rule: alert on many SYNs to SSH from one source
alert tcp any any -> $HOME_NET 22 (msg:"Possible SSH scan"; flags:S; \
  threshold: type both, track by_src, count 20, seconds 60; sid:1000001; rev:1;)

Spotting ARP spoofing on a LAN

Users say pages load slowly and one browser showed a certificate warning. Step 1: on a client, look at the gateway's ARP entry; its MAC is the same as another LAN host's MAC. Step 2: capture ARP traffic and see that host sending unsolicited ARP replies for 192.168.1.1 every second. Step 3: find that MAC in the switch's MAC table to locate the port, and shut it down. Step 4: enable DHCP snooping and Dynamic ARP Inspection on the access VLANs so it cannot happen again.

bash
ip neigh show 192.168.1.1
# 192.168.1.1 dev eth0 lladdr 3c:52:82:aa:bb:cc REACHABLE
ip neigh | grep 3c:52:82:aa:bb:cc     # a second IP has the same MAC
sudo tcpdump -i eth0 -nn -e arp
# 3c:52:82:aa:bb:cc > ...: ARP, Reply 192.168.1.1 is-at 3c:52:82:aa:bb:cc
# On a Cisco switch: show mac address-table address 3c52.82aa.bbcc

A SYN flood against a web server

The site becomes unreachable. Step 1: ss shows thousands of sockets in SYN-RECV state, while ESTAB is normal. Step 2: tcpdump shows SYNs from thousands of random source IPs with no final ACKs. Step 3: confirm SYN cookies are on, so the server keeps accepting real clients even with a full backlog. Step 4: if the link itself is full, ask the ISP or move the site behind a CDN or DDoS protection service, because filtering at the server cannot help a saturated pipe.

bash
ss -s
ss -tn state syn-recv | wc -l          # thousands = flood
sudo tcpdump -i eth0 -nn -c 20 'tcp[tcpflags] == tcp-syn and dst port 443'
sysctl net.ipv4.tcp_syncookies          # should be 1
sysctl net.ipv4.tcp_max_syn_backlog

Quick reference

  • IDS watches a copy (SPAN or TAP) and alerts; IPS sits inline and can drop
  • ARP spoofing defence: DHCP snooping plus Dynamic ARP Inspection, and TLS
  • SYN flood sign: many SYN-RECV sockets; defence: net.ipv4.tcp_syncookies = 1
  • Amplification abuses open UDP services: DNS 53, NTP 123, memcached 11211
  • Suricata and Snort use signatures; Zeek writes protocol logs for analysis
  • Rule parts: action, header (proto src port -> dst port), options with sid
  • Scans from inside your own network are much more alarming than internet scans
  • Test rules with suricata -T -c /etc/suricata/suricata.yaml before reloading

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1What does Dynamic ARP Inspection check ARP packets against?

Question 2

2How do SYN cookies protect a server?

Question 3

3Which is the main trade-off of an IPS compared with an IDS?

Question 4

4An attacker sends small spoofed queries to open DNS resolvers, which send large replies to the victim. What is this?

Question 5

5Which detection method is most likely to catch a brand-new attack, at the cost of more false alarms?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    On a Linux server, check whether SYN cookies are enabled and how many half-open connections exist right now.

  2. Exercise 2medium

    Write a Suricata rule that alerts when any host sends an HTTP request whose URI contains /wp-login.php to your web servers, and test the config.

  3. Exercise 3hard

    In a lab, run an nmap SYN scan against a VM you own while capturing on the VM. Use the capture to show how open and closed ports respond differently.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

What is the difference between an IDS and a firewall?
A firewall allows or blocks traffic based on rules about addresses, ports and state. An IDS inspects traffic content and behaviour to spot attacks, even inside traffic the firewall allowed.
Is Snort or Suricata better?
Both are mature open-source engines with compatible rule formats. Suricata has been multi-threaded for longer and adds rich protocol logging; Snort 3 is also multi-threaded. Choose based on your team's tooling.
Can HTTPS stop a man-in-the-middle attack?
Mostly, yes. The attacker cannot read or change encrypted traffic without a certificate your device trusts, so browsers show a warning. Users clicking through warnings, or plain HTTP pages, remain at risk.
Can I stop a DDoS attack myself?
Small attacks, yes, with SYN cookies, rate limits and filtering. Large volumetric attacks fill your internet link, so they must be filtered upstream by your ISP, a scrubbing service or a CDN.
ShareXLinkedInWhatsApp