Lesson 2 of 4 Network Security Appliances

IDS and IPS

Intrusion detection and prevention systems look for signs of attack in traffic and activity. This lesson explains network IDS and IPS, detection methods, alert accuracy and tuning, and the limits of network inspection.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish IDS and IPS.
  • Compare detection methods.
  • Classify alert outcomes and explain tuning.
  • Describe the limits of network inspection.

IDS and IPS

An intrusion detection system (IDS) monitors network traffic or host activity and alerts when it detects suspicious or malicious behaviour. A network IDS is usually deployed passively, receiving copies of traffic from taps or SPAN ports, so it cannot affect traffic. An intrusion prevention system (IPS) is deployed inline and can also block traffic it identifies as malicious, by dropping packets, resetting connections or blocking source addresses. Many next-generation firewalls include IPS functions. Host-based versions (HIDS and HIPS) are covered in the endpoint security module.

Common open-source tools include Snort and Suricata, which use signature rules, and Zeek, which records detailed network activity logs for analysis.

Detection methods

IDS and IPS use several detection methods, often in combination.

Signature-based Knowledge-based
Matches traffic against patterns of known attacks, such as a specific exploit string. Accurate for known attacks with few false positives, but cannot detect new attacks and needs constant signature updates.
Anomaly-based Behaviour-based or statistical
Builds a baseline of normal traffic and alerts on deviations, such as unusual volumes or protocols. Can detect new attacks, but produces more false positives and needs a clean baseline.
Stateful protocol analysis Specification-based
Compares protocol behaviour with expected standards and flags violations, such as malformed commands.
Reputation and threat intelligence
Flags traffic to or from known malicious addresses and domains.

A Suricata or Snort rule describes what to match and what to do. The following rule alerts on an HTTP request whose URI contains a string associated with a known web shell.

alert http any any -> $HOME_NET any (msg:"Possible web shell access"; content:"cmd.php"; http_uri; sid:1000001; rev:1;)

The rule's header gives the action, protocol, source, direction and destination; the options give the message, the content to match and where, and a unique signature ID. The lab for this module writes and tests Suricata rules against a packet capture.

Sort into groups

Signature or anomaly?

Exam skills 6.5.2

Decide which detection method each statement describes.

Log in to try this activity Interactive activities are free with an account.

Accuracy and tuning

Every alert is either correct or not. A true positive is an alert on a real attack; a false positive is an alert on benign traffic; a true negative is correctly no alert; a false negative is a missed attack, the most dangerous outcome. Tuning reduces false positives by disabling irrelevant signatures (for example, rules for software the organisation does not use), adjusting thresholds and adding exceptions for known benign activity, while taking care not to create false negatives. An IPS needs especially careful tuning, because false positives block legitimate traffic.

New IPS rules are often deployed first in detect-only mode, observed for false positives, then switched to blocking. Signature updates are applied regularly, and alerts feed the SIEM for correlation.

The following diagram places two intrusion detection outcomes in the alert matrix.

Placing two IDS outcomes in the alert matrix. The nightly SQL injection alerts from the authorised scanner are technically true positives but benign, so they are suppressed for the scanner's address and window, documented. The encrypted exfiltration that raised no alert is a false negative, which needs better detection.
The scenario is illustrative.

Limits of network inspection

Most traffic is now encrypted, so a network sensor sees only metadata (addresses, ports, TLS handshake details, certificate names) unless traffic is decrypted, for example at a TLS-inspecting proxy or with server keys for inbound traffic. Attackers also evade detection by fragmenting packets, obfuscating payloads, using encryption and moving slowly below thresholds. These limits are why network detection is combined with endpoint detection (EDR), log analysis and behaviour analytics. The following comparison summarises IDS and IPS.

IDS
DeploymentPassive (tap or SPAN)
ResponseAlerts
Effect of false positiveWasted analyst time
Effect of device failureLoss of visibility only
IPS
DeploymentInline
ResponseAlerts and blocks
Effect of false positiveLegitimate traffic blocked
Effect of device failureFail open or fail closed
Worked example

Classify the alert

An IDS alerts on a "SQL injection attempt" each night when the organisation's authorised vulnerability scanner runs. Separately, a real attacker exfiltrated data over an encrypted connection and no alert fired. Classify both and suggest improvements.

The scanner alerts are true positives in a technical sense but benign (authorised) activity; they can be suppressed for the scanner's source address during its scan window, documented. The exfiltration is a false negative; detecting it needs visibility of encrypted traffic (TLS inspection at the proxy), anomaly detection on outbound volumes and EDR on the source host.

Worked example

Introducing blocking

A team wants to switch its new IPS from detect-only to blocking mode for all signatures on day one. What is the risk and what is the better approach?

Untuned signatures produce false positives, which in blocking mode would interrupt legitimate business traffic. The better approach is to run in detect-only mode, analyse alerts, tune or disable irrelevant signatures, then enable blocking for high-confidence signatures first and expand gradually, with change management.

Check yourself

Which alert outcome is most dangerous, and why?

Show answer

A false negative, because a real attack occurs without any alert, so no one responds.

Exam Tips

Remember for the exam

  • IDS is passive and alerts; IPS is inline and blocks.
  • Signature-based misses new attacks; anomaly-based produces more false positives.
  • False negatives are the most dangerous outcome; tune before enabling blocking.