Foundation Topics
Network IPS Traffic Analysis Methods
There are a number of different aspects a network IPS sensor analyzes network traffic. Some of the most common methods of network analysis are listed below:
- Stateful Content Matching.
- Protocol Decoding.
- Traffic Correlation.
- Rate Analysis
- Packet Header Matching
- Packet Content Matching
- Statistical Modeling
- Event Correlation
Stateful Content Matching
The Cisco IPS sensor will fully reassemble a transport-layer session between network endpoints to extract a stream of bytes exchanged through an application session. Using this stream of bytes, the sensor can perform more reliable matching when searching for payload data across the entire session, even if the content is split across many packets.
The sensor reassembles different pieces of data depending on the OSI Layer:
- OSI Layer 3, the sensor reassembles the fragmented IP packets.
- OSI Layer 4, the sensor reassembles the TCP session in the correct manner relying on sequence numbers to correctly sequence data; UDP session reassembly may relay on some application-layer UDP sequencing to extract the correct byte stream.
Stateful content matching improves quality of detection and doesn't allow attackers to easily evade the sensor using packet fragmentation and segmentation. This method is more demanding of the sensor, as the sensor must perform real-time in-memory buffering of application data. The sensor can be instructed to only look into one portion of the byte stream (for example, only the first 100 bytes) to increase performance. This can lead to false negatives if the attacker is able to send malicious data later in the session, outside the inspection window. The sensor still does not fully understand the application-layer protocol and content, thus administrators may see false positives as the content the sensor is looking for may appear in many different contexts in the application stream (for example, a user may be visiting a web page that contains certain malicious sequences inside a textual description, where they pose no harm), possibly causing the sensor to act on legitimate or non-harmful traffic.
Protocol Decoding
The most granular method of analysis is protocol decoding, where the sensor takes an extra step, and parses the application-layer protocol from a reassembled byte stream provided by the stateful transport-layer reassembly routines. The quality of detection is improved by this method in the following three ways:
- It improves performance, as the sensor needs to examine less traffic after it has decoded it.
- The sensor can perform protocol verification, and reject protocol messages that do not conform to the standard behavior of the protocol. The sensor can detect or prevent both known and yet-unknown attacks which violate protocol standards (for example, buffer overflows which send too much data to a host, violating maximum lengths set forth in protocol standards).
- It lowers false positives by providing context in which the sensor needs to look for suspicious or malicious patterns. For example, instead of searching through the entire TCP session's byte stream the sensor can now search for malicious HTTP URLs exactly in the part of the HTTP request where the URL is located. This increases the accuracy of the sensor ensuring it won't make a wrong decision by finding offending content in the wrong context.
Traffic Correlation
A network IPS sensor sees a large amount of flows from different network endpoints, thus they have the advantage of being able to correlate packets of multiple network conversations. Suspicious or malicious activity can be identified via the network IPS sensors correlating different packets and determining their common properties.
IPS sensors use these real-time correlation abilities mainly to detect network reconnaissance attacks, where attackers send many packets to few or many other hosts in order to determine their reachability, the presence of specific applications, or to enumerate all exposed network services offered by an endpoint. Worms use similar scanning techniques to find other systems to spread to, and can be detected and stopped using the same correlation mechanisms on the network IPS sensors.
One fundamental limitation of packet correlation is that it takes a while before the sensor classifies and correlates packets to determine if these packets constitute an interesting event. Until this threshold is met, all previous packets will already be on the way to their destination, thus cannot be dropped or captured.
A good example of such correlation would be a network sensor detecting more than 10 different connection request packets from a single host, to multiple other hosts, on the same TCP destination ports, within 60 second. This may indicate that a host is performing a service scan of the network.
Rate Analysis
A network IPS has the ability to analyze network traffic to monitor the rate of packets of a particular protocol, the rate of packets between host pairs, the connection rates, or the rate of application-layer requests and messages. This capability is referred to as rate analysis. These rate monitors work using a set of thresholds that determine maximum expected for normal network operation. The thresholds can be set manually by the administrator, or pre-configured using the IPS vendor. Denial-of-service attacks often use flooding at various levels of the OSI model, thus they can be detected using these mechanisms.
An example of rate analysis is an IPS sensor configured to monitor UDP traffic rate between the attacker and the target host. The threshold for traffic rate is at 150 packets per second. Once this threshold is met or exceeded, the sensor will then alarm and act according (results may vary depending on what actions or alarming threshold are configured).
Packet Header Matching
The simplest method of traffic analysis of individual packets' headers to address suspicious or malicious activity can be determined by only analyzing a packet's header. For example, an anomalous combination of TCP flags in a TCP segment.
This method of analysis is used to:
- Provide basic identification of network connections made by malware, or accepted by malware-infested PCs. A Trojan horse program that allows remote control of a system. The sensor can identify these connections based on the well-known transport-layer ports these malware applications use. Identification of this nature is prone to errors as there are some applications that may be legitimately using these ports.
- Detect malformed packets of OSI Layers 2-4 by performing low-level protocol verification of these protocols. Attackers can and often do use these malformed packets to crash protected systems or network devices by exploiting bugs in their TCP-IP stacks or packet forwarding functions.
Packet Content Matching
Another method of analysis uses basic examination of packet payloads for each individual packet. The sensor uses this to:
- Improve its identification of malware connections, if these connections use some well-known payload data patterns that can be identified in individual packets.
- Detect unwanted applications in the network, such as messaging or gaming applications that use ports of standard applications.
- Detect known application-layer attacks that are embedded in the packet payloads, by looking for a specific sequence of payload bytes.
Attackers often evade this method of analysis simply by spreading the characteristic or "signature" of suspicious or malicious traffic over two or more packets, thus bypassing this analysis since the sensor or examining each packet individually.
This method of analysis often causes false positives as legitimate traffic may contain the same traffic pattern, so given the sensor doesn't understand the context in which the payload will appear it will trigger an event or act in error.
Statistical Modeling
A network IPS sensor may be able to use an analysis technique and supervised learning to build a statistical model that describes certain traffic properties. Some examples may be traffic patterns, traffic rates, traffic composition, traffic intervals, etc. This method typically aligns to the anomaly-based approach, which allows the sensor to detect any known or yet-unknown attacks that violate the learned "normal" behavior. Denial-of-service and similar flooding-based attacks are often detected by sensors using this approach. This approach is prone to higher rates of false positives in networks that cannot be adequately described with a statistical model. If an administrator is trying to address specific issues similar to reconnaissance detection problems this method of analysis can work well with almost no false positives.
Typically management stations and tools scan the network legitimately opening up several sessions a minute to different hosts, but often work-infected servers or PCs try to open a much larger number of sessions. An IPS sensor would detect such anomalies and identify a worm attack.
Event Correlation
Finally, in addition to packet correlation the last method of analysis allows the sensor to provide event correlation where it correlates multiple detected events to present higher-level, consolidated information to the administrator, and possibly automatically act on such higher-level information using preventive actions.
Event correlation on the sensor is beneficial in detecting composite attacks more reliably. A composite attack usually consists of multiple individual events or attacks. The sensor is required to see multiple components of the attack in order to recognize it as an attack. This increases the reliability and confidence required to deploy preventive aggressive actions, and provides more information about the network activity to the administrator.
Unlike other methods, the limitation isn't with false reporting but performance degradation. The sensor isn't able to use very long time windows in which to correlate events, thus an attacker may be able to evade detection if the attacker performed an attack in a slow sequence, at the expense of attack efficiency. While this may be the case individual components of the attack are still likely to be detected or prevented.