Lesson 2 of 3 Logging and Monitoring

Intrusion Detection and Prevention

Intrusion detection and prevention systems watch for attacks on networks and hosts. This lesson covers their types, detection methods and the outcomes of detection.

Learning outcomes

After completing this lesson, you will be able to:

  • Compare network-based and host-based, and detection and prevention, systems.
  • Distinguish signature-based from anomaly-based detection and the four detection outcomes.
  • Distinguish an IPS from a firewall and a web application firewall.

Types of IDPS

A network-based system (NIDS or NIPS) monitors traffic on a network segment; a host-based system (HIDS or HIPS) monitors activity on a single system, including file changes, processes and log entries, and can see traffic after it is decrypted. An intrusion detection system is passive: it analyses a copy of traffic and alerts. An intrusion prevention system is placed inline and can drop malicious traffic, reset connections or block sources.

Placement decides what each system can see. A network sensor receives traffic from a switch port that mirrors a segment, or from a network tap, so it sees all traffic on that segment but cannot read the content of encrypted sessions and misses traffic that never crosses the monitored link, such as communication between two virtual machines on the same host. A host-based agent sees what happens on that one system, including decrypted traffic, commands executed and files changed, but must be installed and maintained on every host and can be disabled by an attacker who gains administrator rights. Organisations therefore combine both.

Inline placement brings an operational risk that passive monitoring does not. Because all traffic flows through an IPS, a failure or overload of the IPS can interrupt service, and a false positive blocks legitimate users. IPS devices are therefore deployed with redundancy and a defined failure behaviour: fail closed for high-security segments, or a bypass mode that keeps traffic flowing where availability is the priority, a decision documented as an accepted risk.

The following diagram shows how prevention is introduced without blocking legitimate users.

Deploying prevention without blocking legitimate users. Blocking needs an IPS inline, or a WAF for web attacks; an IDS only alerts. A new IPS runs first in detection mode to tune rules and remove false positives, then blocks high-confidence signatures, with blocked events monitored.
WAF is web application firewall.
Scenario questions

Placing the sensor

Exam skills 7.2.1

Choose the IDPS type and placement that fits each requirement.

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

Detection methods and outcomes

Signature-based (knowledge-based) detection matches known attack patterns. It is accurate for known attacks but misses new ones and needs constant updates. Anomaly-based (behaviour-based) detection learns normal behaviour and flags deviations, which can find new attacks but produces more false positives. Stateful protocol analysis compares traffic with expected protocol behaviour.

Every detection decision has four possible outcomes, depending on whether an attack was present and whether the system raised an alert. The two errors carry different costs. A false positive costs analyst time, and when there are many, analysts begin to dismiss alerts without investigating, which eventually causes them to miss a real one. A false negative costs far more, because the attack continues unnoticed. Tuning a system to eliminate all false positives usually increases false negatives, so the goal is a level of alerts the team can actually investigate. The following table summarises the outcomes.

OutcomeMeaningImpact
True positiveAttack correctly detectedDesired
False positiveBenign activity flagged as an attackWastes analyst time; alert fatigue
False negativeAttack missedMost dangerous: the attack proceeds unnoticed
True negativeBenign activity correctly ignoredDesired
Sort into groups

Name the outcome

Exam skills 7.2.1

Classify each detection result.

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

IDPS compared with firewalls and WAFs

An IPS, a firewall and a web application firewall all sit in the traffic path, which makes them easy to confuse. A traditional firewall decides whether traffic is allowed at all, based mainly on addresses, ports and protocols: it permits HTTPS to the web server and blocks everything else. An IPS examines the traffic that the firewall allowed and looks for attacks within it, such as an exploit for a known server vulnerability hidden in a permitted connection. A web application firewall specialises in HTTP and understands web application attacks such as SQL injection and cross-site scripting in form fields and parameters.

Signature and anomaly detection also complement each other in practice. A signature reliably catches a known exploit the day its signature is published. An anomaly rule notices that a database server, which normally talks only to the application tier, has started connecting to the internet, even though no signature exists for whatever malware is causing it. Many products combine both, and analysts need to know which method produced an alert, because an anomaly alert usually requires more investigation to confirm.

Scenario questions

Firewall, IPS or WAF?

Exam skills 7.2.1

Choose the control that addresses each threat.

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

IDS or IPS

A company wants to block known exploit attempts against its public web servers automatically, but also worries about blocking legitimate customers. What should it deploy and how?

Blocking requires an IPS inline in front of the web servers (or a WAF for web attacks). To limit the risk of blocking legitimate traffic, the IPS is first run in detection mode to tune rules and remove false positives, then blocking is enabled for high-confidence signatures, with monitoring of blocked events. An IDS alone would only alert.

Check yourself

Which detection outcome is most dangerous?

Show answer

A false negative, because an attack proceeds unnoticed.

Exam Tips

Remember for the exam

  • An IPS must be inline to block.
  • Signatures miss new attacks; anomaly detection has more false positives.
  • False negatives are more dangerous than false positives.