Intrusion Detection Systems (IDS): Types, Detection Methods and a Worked Metrics Example

Understand where an IDS collects evidence, how it detects suspicious activity, and why recall, precision and false-positive rate matter more than accuracy alone.

KnowledgeGate Team

Exam prep & CS education

Updated 2 Nov 20266 min read
Intrusion Detection Systems (IDS): Types, Detection Methods and a Worked Metrics Example

A firewall, an IDS and an IPS can all sit near the same traffic, yet they observe, decide and act differently. Placement and detection logic are separate. One alert can be traced through a small network, and recall, precision, false-positive rate and accuracy can be calculated from 10,000 events. The same reasoning shapes the security questions you meet across GATE CS preparation courses and test series.

What an intrusion detection system actually does

An intrusion detection system collects and analyses network or host events for malicious or policy-violating activity. Its flow is collect -> analyse -> classify -> alert. A passive IDS raises an alert for investigation and normally does not block the traffic.

Reuse one event. Client 198.51.100.24 sends HTTPS traffic to web server 10.0.0.20 on TCP port 443. The edge firewall permits it because the destination and port are allowed. Network sensor S1 sees connection metadata, while host agent H1 records 5 failed application logins in 20 seconds. The IDS correlates them and emits Alert A-104, severity high.

An event is an observation; an alert is a classification needing attention. A true positive is an attack correctly alerted, and a false positive is benign activity incorrectly alerted. A true negative is benign activity left unalerted, while a false negative is a missed attack. Unusual evidence is not proof of intrusion.

IDS types use two independent classification axes

The first axis asks where evidence is collected.

Type

Evidence

Best at

Blind spot

NIDS

Repeated connections to 10.0.0.20:443

Seeing traffic patterns across network segments

Host-only activity and encrypted request contents

HIDS

/var/www/app/config.php changes after login failures

Seeing processes, files and application events on one host

Activity on systems without an agent

A NIDS observes from a network tap or SPAN port. A HIDS runs on an endpoint. The second axis asks how evidence is judged. Signature-based detection matches a known pattern but can miss variants. Anomaly-based detection compares behaviour with a baseline, exposing new behaviour but sometimes adding noise. Stateful protocol analysis checks whether an exchange follows valid states and sequences.

These axes are independent. A NIDS or HIDS can use signatures, anomalies, stateful analysis or a combination. A NIDS placed before HTTPS decryption can still observe addresses, ports, timing, packet sizes and connection patterns, but it cannot be assumed to read the request body. A host or application agent can observe relevant events after decryption.

Client 198.51.100.24 reaches server 10.0.0.20:443 past the firewall while NIDS sensor S1 and host agent H1 feed the IDS raising Alert A-104.

Worked example: calculate whether IDS alerts are useful

Suppose the IDS examines 10,000 events. Of these, 100 are real attacks and 9,900 are benign. At alert threshold 70, it alerts on 120 events: 80 attacks and 40 benign events. It does not alert on 9,880 events: 20 missed attacks and 9,860 benign events.

The confusion-matrix cells are:

  • TP = 80

  • FP = 40

  • FN = 20

  • TN = 9,860

First verify the total: 80 + 40 + 20 + 9,860 = 10,000.

  • Recall or true-positive rate: TP / (TP + FN) = 80 / (80 + 20) = 80 / 100 = 80%

  • False-positive rate: FP / (FP + TN) = 40 / (40 + 9,860) = 40 / 9,900 = 0.404%

  • Precision: TP / (TP + FP) = 80 / (80 + 40) = 80 / 120 = 66.7%

  • Accuracy: (TP + TN) / 10,000 = (80 + 9,860) / 10,000 = 9,940 / 10,000 = 99.4%

Read the counts before praising the percentages. The system misses 20 of 100 real attacks. It also sends analysts 40 false alerts among 120 alerts. Accuracy looks high because benign events dominate, so it cannot replace the matrix, recall and precision.

Confusion matrix for 10,000 events: TP 80, FP 40, FN 20, TN 9,860, giving recall 80%, precision 66.7%, FPR 0.404%, accuracy 99.4%.

Detection thresholds trade recall for alert load

Now lower the anomaly threshold from 70 to 60 for the same dataset. The new cells are TP = 90, FN = 10, FP = 140 and TN = 9,760. They still total 10,000: 90 + 10 + 140 + 9,760 = 10,000.

  • Recall: 90 / (90 + 10) = 90 / 100 = 90%

  • Precision: 90 / (90 + 140) = 90 / 230 = 39.1%

  • False-positive rate: 140 / (140 + 9,760) = 140 / 9,900 = 1.414%

  • Accuracy: (90 + 9,760) / 10,000 = 9,850 / 10,000 = 98.5%

Threshold 60 catches 10 additional attacks, but it produces 100 additional false alerts. The useful setting depends on the cost of a missed attack, analyst capacity and whether another control can confirm or contain an event. In general, lowering a threshold increases sensitivity and false positives. Raising it reduces alert volume and increases false negatives. Neither threshold is universally optimal.

IDS versus IPS versus firewall on one allowed request

Return to traffic for 10.0.0.20:443. The firewall asks whether policy allows the connection and permits it. The IDS asks whether the observed behaviour looks malicious and raises A-104. An inline IPS can prevent activity by dropping or resetting a matching connection. Later, HIDS agent H1 can report a change to /var/www/app/config.php.

Control

Typical position

Primary decision

Typical action

Failure concern

Boundary firewall

Network boundary, inline

Is this connection allowed by policy?

Allow or deny

A wrong rule can expose or block services

Out-of-band NIDS

Tap or SPAN-port branch

Does observed traffic look suspicious?

Report an alert

It cannot directly stop what it observes

Inline IPS

In the traffic path

Should this matching flow continue?

Drop or reset

Failure or incorrect blocking can affect availability

Host HIDS

On the endpoint

Does host activity look suspicious?

Report endpoint changes

Missing agents create visibility gaps

Do not mix the axes. Signature-based and anomaly-based describe detection logic. NIDS and HIDS describe evidence location. Either IDS placement can use signatures, anomalies or both.

Use Cyber Safety and Security: Information Security and Cyber Law with Worked Examples for the broader CIA, cryptography and cyber-law context. Sensor placement, alert metrics and threshold trade-offs are the IDS-specific layer.

How GATE-style questions and interviews test IDS

Common questions ask you to classify NIDS versus HIDS, separate signature from anomaly detection, choose IDS, IPS or firewall for a stated action, identify a false positive or false negative, or calculate a metric from a matrix.

Try four rapid checks:

  1. A benign login is alerted: false positive.

  2. An attack receives no alert: false negative.

  3. A sensor detects a known byte pattern: signature-based detection.

  4. An inline control drops a malicious flow: IPS, not a passive IDS.

KnowledgeGate has 15+ IDS questions available for practice. Before choosing an option, label the control, its placement and its detection method. For a numerical, write all four confusion-matrix cells before calculating any metric. That prevents a common mistake such as putting false positives in the denominator for recall.

Common IDS traps and the precise correction

Four statements need immediate correction:

  • An IDS blocks attacks. A passive IDS detects and alerts, while an IPS is designed for inline prevention.

  • The firewall allowed it, so it is safe. Permitted traffic can still contain malicious behaviour.

  • Anomaly detection is always better. It may find new behaviour, but it depends on a useful baseline and can raise more false positives.

  • A NIDS can always read HTTPS payloads. Visibility depends on sensor placement relative to decryption.

A fifth trap says 99.4% accuracy proves the detector is excellent. That is incomplete because the same detector misses 20 attacks and raises 40 false alerts. This is the base-rate effect: when benign events greatly outnumber attacks, correct benign classifications dominate accuracy and hide weaknesses that matter operationally.

If packet flow, ports or network placement feel unclear, use Computer Networks MCQs as a foundation and practice route. It is broader than IDS, but that network reasoning makes sensor-placement questions much easier.

Intrusion detection systems: the short version and next step

NIDS versus HIDS is the placement axis. Signature, anomaly and stateful analysis are detection methods. An IDS alerts, while an inline IPS can prevent. When attacks are rare, confusion-matrix counts matter more than accuracy alone.

Redraw TP 80, FP 40, FN 20, TN 9,860, calculate all four metrics, then explain why threshold 60 finds 10 more attacks but creates 100 more false alerts than threshold 70. Use GATE Guidance by Sanchit Sir for organised concept coverage and the GATE Test Series for timed mixed practice.