Cybersecurity

Intrusion Detection and Prevention Systems

How IDS and IPS tools spot attacks, where to put them, what they miss, and how to run one without drowning in alerts.

Key takeaways

  • An IDS alerts on suspicious activity from the side, while an IPS sits in the traffic path and can block it.
  • Network sensors see traffic between machines, and host sensors see processes, files and logins on one machine.
  • Signature rules catch known attacks precisely, and anomaly detection catches unusual behavior at the cost of more false alarms.
  • Encryption hides most payloads from network sensors, so connection metadata and endpoint monitoring matter more than they used to.
  • A sensor is only useful if someone tunes its rules and reads its alerts.

An intrusion detection system (IDS) watches network traffic or computer activity and raises an alert when something looks like an attack. An intrusion prevention system (IPS) does the same inspection but sits where it can act, dropping packets or killing connections before they reach the target. Many products do both, and the difference is often a configuration setting.

Neither one replaces patching, a firewall or good passwords. What they add is visibility: a way to learn that something got through, or tried to, and enough detail to respond.

How it differs from a firewall

A firewall decides which connections are allowed, mostly by looking at addresses, ports, protocols and sometimes the application involved. It answers the question of whether this kind of traffic may pass at all. The article on how firewalls filter traffic covers that layer.

An IDS or IPS looks inside traffic that is already allowed. Your firewall may permit web requests to your server on port 443, and it should. An intrusion detection rule can notice that one of those requests contains a string that matches an attempt to exploit a known web flaw, or that one internal laptop has started connecting to hundreds of other machines in a few minutes.

In practice the lines blur. Many business firewalls include an IPS module, and many "next-generation" firewalls bundle both with web filtering and malware scanning. The useful question is what a given box actually inspects and what it can do when it finds something.

Where the sensor sits

Network-based sensors

A network IDS (often written NIDS) inspects packets crossing a network link. To watch without interfering, it receives a copy of the traffic, either from a mirror port on a managed switch (sometimes called a SPAN port) or from a network tap, a small device that duplicates what passes over a cable.

Because it only gets a copy, a passive sensor cannot slow your network down or break it if it fails. It also cannot stop the first packet of an attack. At most it can send a signal to another device, such as a firewall, asking for a block.

An IPS is placed inline, so traffic physically passes through it. That lets it drop a malicious packet before delivery. It also means a crash, an overload or a bad rule can interrupt legitimate service. Inline devices usually have a "fail open" or "fail closed" choice: keep passing traffic uninspected if the engine dies, or stop everything. Decide which your organization can live with before it happens.

Host-based sensors

A host IDS (HIDS) runs on the computer it protects. It can watch things the network never sees: a new scheduled task, a changed system file, a burst of failed logins, a document program that launches a command shell. Modern endpoint detection and response (EDR) products are the broader successors of this idea.

Host agents see activity after decryption, which is their great advantage. Their limits are coverage and trust. You cannot install an agent on every printer, camera or appliance, and an attacker who gains full control of a machine may try to disable the agent on it.

Detection from the side, prevention in the path
Passive IDS Receives a copy from a mirror port or tap Raises alerts and records evidence Cannot break traffic if it fails Cannot stop the first malicious packet Inline IPS All traffic passes through it Can drop packets or reset connections A bad rule can block real users Needs enough capacity for peak traffic Host agent Runs on the protected machine Sees processes, files and logins Sees data after decryption Cannot be installed on many appliances Passive IDS Receives a copy from a mirror port or tap Raises alerts and records evidence Cannot break traffic if it fails Cannot stop the first malicious packet Inline IPS All traffic passes through it Can drop packets or reset connections A bad rule can block real users Needs enough capacity for peak traffic Host agent Runs on the protected machine Sees processes, files and logins Sees data after decryption Cannot be installed on many appliances

How detection works

Signatures

Signature detection compares traffic or events against a library of rules that describe known bad things: a byte pattern in an exploit, a request path used against a specific flaw, a domain name tied to a malware family. Open-source engines such as Snort and Suricata work largely this way, and rule sets are published by both communities and commercial providers.

Signatures are precise and easy to explain. When one fires, you can read the rule and see why. Their weakness is that they describe the past. A new technique, or an old one altered enough to avoid the pattern, passes unnoticed until someone writes a rule for it.

Anomaly and behavior detection

Anomaly detection builds a picture of normal activity and flags departures from it. A file server that suddenly sends a large volume of data to an unfamiliar address at 3 a.m. is worth a look even if no signature matches. So is a workstation making DNS queries with long, random-looking names, a pattern associated with data smuggled through DNS lookups.

The trade-off is noise. Networks change constantly: new software, backups, video meetings, a new employee. Anything unusual is not necessarily malicious, and someone has to judge each case.

Protocol analysis

A third approach checks whether traffic behaves the way its protocol says it should. A sensor that understands HTTP, DNS or SMB can spot malformed messages or commands that make no sense in context. Tools such as Zeek go further in a different direction, turning traffic into structured logs of connections, DNS queries, certificates and files, which investigators can search later.

What encryption changes

Most web, mail and application traffic now travels inside TLS. A network sensor in the middle sees who is talking to whom, when, how much, and often the server name sent at the start of the connection. It usually cannot read the content.

You have a few options:

  • Use the metadata. Connection timing, volume, destination, certificate details and TLS handshake characteristics still reveal a lot.
  • Inspect where traffic is decrypted. A sensor behind your load balancer or reverse proxy sees plain requests to your own services.
  • Decrypt and re-encrypt in transit. Some organizations intercept TLS on managed devices. It adds real risk and privacy obligations, breaks some applications, and needs a clear written policy.
  • Move detection to endpoints. The host sees data before encryption and after decryption.

For a small organization, the first, second and fourth are usually enough.

Reading alerts without drowning

A freshly installed sensor with every rule switched on can produce thousands of alerts a day. Most will be harmless: scanners probing the internet at large, software with odd habits, rules that do not apply to anything you run. If nobody can read them, the sensor is decoration.

Alerts fall into four outcomes, and tuning is the work of shifting the balance.

The four outcomes of any detection rule
True positive An attack happened and the sensor flagged it. This is what you act on. False positive Harmless activity was flagged. Too many of these and people stop reading. False negative An attack happened and nothing fired. You find out some other way. True negative Normal activity passed quietly. This should be almost everything. True positive An attack happened and the sensor flagged it. This is what you act on. False positive Harmless activity was flagged. Too many of these and people stop reading. False negative An attack happened and nothing fired. You find out some other way. True negative Normal activity passed quietly. This should be almost everything.

A practical tuning routine:

  1. Start in detection-only mode, even on an inline device, and collect alerts for a couple of weeks.
  2. Disable rule categories for software and protocols you do not use.
  3. For each noisy rule, decide whether it is wrong for your environment, or right and pointing at something you should fix.
  4. Suppress narrowly, for one source or destination, instead of turning a rule off everywhere.
  5. Move rules to blocking only after you trust them, beginning with high-confidence ones.
  6. Review again after major changes such as a new application or office.

Send alerts to a central place with the other logs, so you can line up a network alert with a login record or a firewall entry. The guide to logs, metrics and traces explains how that data fits together, and reading server logs helps when you need to confirm whether an attempt succeeded.

When an alert fires

An alert is a question. Before reacting, check whether the target is actually running the software the rule is about, and whether the response shows success or an error. An exploit aimed at a server type you do not operate is background noise.

Then look for follow-on behavior from the targeted machine: new outbound connections, new accounts, unexpected processes. If those show up, treat it as an incident, isolate the host and follow your incident response plan. Deciding in advance who may unplug a production system saves painful minutes.

Triage for a single alert
Is the targeted software or service absent from that machine? YES Log it and consider disabling or narrowing the rule. 1 NO Is the source a known scanner or an approved test you scheduled? YES Confirm the timing matches, then document and close. 2 NO Does the target show new connections, accounts or processes afterward? YES Treat as an incident: isolate the host and start your plan. 3 NO Keep watching Record the finding, patch the target if relevant, and check for repeats from the same source. Is the targeted software or service absent from that machine? 1 IF YES Log it and consider disabling or narrowing the rule. NO Is the source a known scanner or an approved test you scheduled? 2 IF YES Confirm the timing matches, then document and close. NO Does the target show new connections, accounts or processes afterward? 3 IF YES Treat as an incident: isolate the host and start your plan. NO Keep watching Record the finding, patch the target if relevant, and check for repeats from the same source.

Do you need one?

For a home network, a dedicated IDS is mostly a learning project. Some consumer and open-source routers offer it, and it can be instructive, but updates, strong passwords and keeping untrusted gadgets separate buy more safety.

For a small business, endpoint protection with detection and response features on every computer is usually the first step, followed by the IPS feature that may already be included in your firewall license. Check that it is turned on, updating its rules and sending alerts to a person. If nobody can monitor alerts, a managed detection service may be a better purchase than another box.

Larger networks, and anyone running public services or handling regulated data, benefit from sensors at the internet edge and between important internal zones. Segmentation makes this far easier, because traffic between zones passes through a few points you can watch.

What can go wrong

Stale rules are the most common failure. A subscription lapses, an update job breaks, and the sensor keeps reporting calm. Monitor the age of your rules and test that alerts still arrive, using the harmless test signatures many vendors provide.

Blind spots come next. A mirror port that covers only internet traffic misses an attacker moving between internal machines. An oversubscribed mirror port or an undersized sensor silently drops packets. And the sensor itself is a target, so keep its management interface off the public internet and patch it like any other server.

The reference worth reading for planning is NIST Special Publication 800-94, a guide to intrusion detection and prevention systems. Its product details have aged, but its explanation of sensor placement and tuning still holds up. The standard companion advice applies too: decide what you want to detect first, then choose the tool that can see it.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in Cybersecurity →

Latest news on this topic