Building Cisco IDS 3.0(3) Custom Signatures

Date: Feb 15, 2002 By Earl Carter. Article is provided courtesy of Cisco Press.
When using a signature-based Intrusion Detection System (IDS), keeping signature definitions up to date is crucial to maintaining optimum protection of your network resources. Earl Carter discusses building Cisco IDS 3.0(3) custom signatures in this timely article.

Many intrusion-detection systems enable you to create custom signatures. Up through Cisco Secure Intrusion Detection System 2.5, the only customizable signatures available were string-based signatures. This forced customers to rely on signature updates to maintain current signature databases. Starting with version 3.0, the way in which signatures are defined and processed changed dramatically, by creating numerous signature engines. With these new engines, signatures are specified using a dynamic set of textual signature parameters. The system signatures are defined in a system configuration file. By specifying the correct parameters, however, you can also easily add new signatures to your own user configuration file, and thus create your own custom signatures. Furthermore, besides creating new signatures definitions, you can also tune existing system signatures so that they operate more effectively in your network configuration.

Understanding the custom signature capability with Cisco IDS requires understanding the following:

  • Signature engine types
  • Engine parameters

Signature Engine Types

To enable you to efficiently and effectively create custom signatures, signature processing is spread across five distinct categories of signature engines:

  • Atomic engines
  • Flood engines
  • Sweep engines
  • Service engines
  • String engines

Each of the categories is composed of multiple signature engines that are programmed to handle intrusive activity possessing specific characteristics, such as protocol decodes and database access. To make configuration easier, each signature engine is designed to support all signatures falling into a certain category (such as single packet TCP signatures). Furthermore, each engine has a parser to read in the text-based descriptions for all signatures that the engine is responsible for detecting, and an inspector that actually looks for the intrusive activity in the network traffic stream.

Atomic Engines

The ATOMIC signatures are handled by the following five engines:

  • ATOMIC.ICMP
  • ATOMIC.IPOPTIONS
  • ATOMIC.L3.IP
  • ATOMIC.TCP
  • ATOMIC.UDP

Each of these engines is designed to enable you to create simple single-packet signatures. Whenever a packet that matches a configured signature is detected, an alarm is triggered. The major difference between the different ATOMIC signature engines is that each engine has engine-specific parameters that are customized on protocol-specific characteristics. Some of the common engine specific parameters for the ATOMIC.TCP engine are the following:

  • Direction—Allows you to specify whether you are looking for traffic going to the specific TCP port (ToService) or from the specific TCP port (FromService).

  • ServicePorts—Allows you to specify a comma-delimited list of ports or port ranges in which a specific service may be found.

  • TcpFlags—Allows you to only examine packets with specific TCP flags set.

Flood Engines

There are four different FLOOD signature engines:

  • FLOOD.HOST.ICMP
  • FLOOD.HOST.UDP
  • FLOOD.NET
  • FLOOD.TCPSYN

All of the FLOOD engines are designed to enable you to create signatures that watch for one or more hosts sending packets to a single host. All these packets have similar characteristics (such as packets with the SYN flag set). Besides configuring the type of packets that you consider interesting, you also need to specify the rate (using the rate engine-specific parameter) at which the packets must arrive to trigger the alarm.

Sweep Engines

To process SWEEP signatures, Cisco IDS uses the following five signature engines:

  • SWEEP.HOST.ICMP
  • SWEEP.HOST.TCP
  • SWEEP.PORT.TCP
  • SWEEP.PORT.UDP
  • SWEEP.RPC

The SWEEP.HOST signature engines handle detecting connections from one host to many hosts, whereas the SWEEP.PORT signature engines are focused on detecting port connections between two hosts. These signatures typically enable you to locate an attacker probing for services on a specific host on your network. Similar to the port connections tracked by the SWEEP.PORT signature engines, the SWEEP.RPC signature engine processes signatures that count valid RPC requests made to a set of ports. When creating SWEEP signatures, you will probably want to specify the number of unique connections that must be detected before triggering the alarm (Unique engine specific parameter). Another useful engine specific parameter is ResetAfterIdle. It enables you to specify the length of idle time that must pass before resetting the connection count.

Service Engines

The SERVICE engines are customized to analyze specific service characteristics above the transport layer (layers 5 and above) in the stack. There are currently four different SERVICE signature engines:

  • SERVICE.DNS.TCP
  • SERVICE.DNS.UDP
  • SERVICE.PORTMAP
  • SERVICE.RPC

The DNS signature engines analyze compressed DNS messages. You can use these signatures to alarm on specific characteristics such as request/reply conditions and overflow attempts. The RPC and PORTMAP engines are specifically designed to detect problems with RPC and Portmapper requests.

String Engines

The STRING engines are designed to enable you to easily search for REGEX strings in several different types of traffic streams. Presently, these signatures are divided into the following four different STRING engines:

  • STRING.HTTP
  • STRING.ICMP
  • STRING.TCP
  • STRING.UDP

Some useful STRING engine-specific parameters are MinMatchLength and MultipleHits. The MinMatchLength parameter enables you to specify a minimum string length that is valid. Any matches shorter than this length are ignored. The MultipleHits parameter allows you to create signatures that look for multiple occurrences of the same string in a single packet.

Engine Parameters

All of the Cisco IDS signatures are specified in textual form in two different configuration files. One configuration file contains the definition for all the system-defined signatures. This configuration file is shipped with Cisco IDS. There is also another user configuration file. This file contains the definitions for all the custom user-defined signatures, as well as any tuning changes that you have applied to the system signatures.

The valid parameters for a signature are divided into parameters that are valid for all signatures (known as Master Parameters) and other parameters that are valid only for specific signature engines (known as Engine Specific Parameters). Several engine-specific parameters have been covered in the descriptions for the different types of signature engines (for a complete listing of the engine specific parameters refer to "Cisco Intrusion Detection System Signature Engines Version 3.0"). The Master Parameters will be covered in the following section.

Master Parameters

Each signature for every signature engine shares the following master parameters:

  • AlarmThrottle
  • ChokeThreshold
  • LimitSummary
  • AlarmInterval
  • FlipAddr
  • MinHits
  • SigComment
  • SIGID and SubSig
  • SigStringInfo
  • ThrottleInterval
  • WantFrag

When creating any custom signatures, you need to know how to configure these parameters so that your signatures will operate correctly and reduce their overall impact on the operation of your Cisco IDS.

AlarmThrottle

The AlarmThrottle is actually composed of four different values that affect that number of alarms generated by a specific signature. By correctly configuring this parameter, you can reduce the ability of an attacker to consume the resources of your IDS by flooding it with attacks. The values that you can specify for the AlarmThrottle parameter are as follows:

  • FireOnce
  • FireAll
  • Summarize
  • GlobalSummarize

AlarmThrottle FireOnce enables you to create signatures that will only trigger one time for a specific set of addresses. After firing once, the signature will not fire on that same set of addresses until a preset period of time has expired.

Configuring a signature with the AlarmThrottle FireAll causes the Cisco IDS to trigger an alarm for all activity that matches the signature's characteristics. This is effectively the opposite of configuring a signature to fire only once using the AlarmThrottle FireOnce parameter.

You also have two summarization options. Whenever you specify a summarization option, you will receive one normal alarm at the beginning of the summarization period and one SUMMARY alarm per ThrottleInterval for as long as the summarization remains valid. The summarization remains valid until a defined quiescent period has elapsed. Furthermore, the purpose of summarization options is to reduce the processing impact on the IDS by reducing the number of alarms that it needs to manage, thereby making it more difficult for an attacker to perform a DoS attack with multiple alarms.

When using alarm summarization, the first instance of the intrusive activity triggers a normal alarm. Then, other instances of the same alarm (between the same address combination) are counted up until the end of the signature's ThrottleInterval. At the end of the signature's ThrottleInterval a SUMMARY alarm is sent, indicating the count of alarms that occurred during the ThrottleInterval. The difference between the two different summarization modes is that AlarmThrottle GlobalSummarize consolidates all address combinations instead of consolidating only a single address pair. As long as the summary mode remains active, Cisco IDS generates only one SUMMARY alarm per ThrottleInterval for the specific signature.

In conjunction with the basic alarm processing modes, you can also specify signatures to operate in one of the following three modes of operation:

  • Variable summary mode
  • Limited summary mode
  • Sliding window interval mode

ChokeThreshold

The variable summary modes are controlled by the ChokeThreshold parameter. This parameter enables you to configure a signature to automatically switch between AlarmThrottle modes, based on the number of alarms detected per throttle interval for a specific signature.

To use the ChokeThreshold, you start by configuring a value for the ChokeThreshold (a value of ANY disables variable summary mode). Then you assign to the signature one of the AlarmThrottle modes (FireAll, Summarize, or GlobalSummarize). When the rate of alarms generated exceeds the ChokeThreshold rate, the signature automatically switches to the next higher summarization mode. If you start with AlarmThrottle FireAll, then after ChokeThreshold alarms are detected in one throttle interval, the mode switches to AlarmThrottle Summarize. If the number of alarms detected exceeds twice the ChokeThreshold rate, the mode switches to AlarmThrottle GlobalSummarize. Summarization remains in effect until the end of the throttle interval, at which time the signature reverts back to its original summarization technique (normally FireAll).

LimitSummary

Limited summary mode is controlled by the LimitSummary parameter. To enable this parameter, you specify a value of TRUE. Basically, this parameter disables the FireOnce and Summarize AlarmThottle modes, which forces the signature to use either FireAll or GlobalSummarize. You normally configure the LimitSummary option on signatures that do not store state information, such as Atomic signatures. You can still use the variable summary with these alarms, but they will only cycle between FireAll and GlobalSummarize.

AlarmInterval

The final signature mode that you can utilize uses a Sliding Window Mode. All the other modes are based on a fixed window (ThrottleInterval) for determining alarm counts. This window counts only the alarms detected in each throttle interval time slot, and each new interval starts at the end of the previous interval (there is no overlap). For some signatures, you may want a higher degree of fidelity. You may want to know if a certain number of alarms occur within a defined window, regardless of where the window starts in the alarm stream. To determine this information, the window for counting alarms needs to move or slide as time progresses.

To define an alarm to use a sliding window interval, you need to use the AlarmInterval parameter to define your window size and the MinHits parameter to set the minimum number of alarms that must occur within the window to trigger the alarm. When using the Sliding Window Mode, Cisco IDS essentially creates another new window each time it sees an alarm. If any of these windows exceeds the MinHits value before its AlarmInterval has expired, then an alarm is triggered. Additionally, to use the AlarmInterval parameter, your signature definition is constrained by the following requirements:

  • You must specify a MinHits value greater than or equal to 2.
  • You must set your ChokeThreshold to ANY.
  • Your AlarmThrottle must be set to FireAll.

FlipAddr

When an alarm is fired, the destination address is usually the victim, and the source address is usually the attacker. This information is stored into an alarm record. The source address of the alarm record is treated as the attacker. In some instances, however, the situation is actually reversed, and the destination of the packet is actually the attacker. This occurs when the Cisco IDS is triggering on return traffic from the host being attacked. In these cases, you can use the FlipAddr parameter to reverse the addresses so that the source address of the alarm becomes the actual attacker, instead of the host being attacked.

MinHits

Sometimes, you do not want a specific signature to generate an alarm unless the signature fires multiple times. You can use the MinHits parameter to define the minimum number of occurrences of a signature that must be detected before an alarm is generated. This can be especially useful when you are looking for specific string signatures, such as Login incorrect. By placing a minimum threshold, you can reduce your number of false positives significantly.

SigComment

The SigComment parameter simply enables you to supply descriptive information about the signature. The information, however, is not included in the actual alarm message, but it can be used to document the signatures in the user configuration file.

SIGID and SubSig

For each signature, the combination of the SignatureID and the SubSignatureID must be unique. You use the SIGID and SubSig parameters to identify your custom signatures (system signatures are also identified with these parameters). SIGID parameters in the range of 20,000—50,000 are reserved for your custom alarm signatures. It is recommended, however, that you do not use the SubSig parameter in your custom signatures.

SigStringInfo

The SigStringInfo parameter enables you define textual information that appears in the actual alarm message. Using this field, you can provide some descriptive information to the alarms generated. This descriptive information is easier to understand than remembering what SIGID XXXX means.

ThrottleInterval

The ThrottleInterval parameter is used in conjunction with the AlarmThrottle parameters. It defines the length of time, in seconds, over which certain events must occur.

WantFrag

You use the WantFrag parameter to specify whether a signature examines fragmented packets when checking for traffic that matches the signature's characteristics. You control how a signature treats fragmented packets via three different keywords: TRUE, FALSE, and ANY. TRUE is used to inspect only fragmented IP packets or packets that were reassembled when determining whether a specific signature needs to fire. The FALSE option causes the signature to only inspect packets that are not fragmented when determining whether the signature should fire. Finally, the ANY option informs the signature engine to examine all packets for the given signature when determining whether it should fire.

Sample Signatures

Understanding how to create custom signatures is probably best covered through some actual examples. Once you create a couple of your own signatures, adding other custom signatures becomes easier and easier.

The first sample signature that we will examine is based on the ATOMIC.ICMP signature engine:

Engine ATOMIC.ICMP 30000 IcmpType 0 IcmpSeq 11 AlarmThrottle 
_____GlobalSummarize ThrottleInterval 5

This signature generates a regular alarm when an ICMP packet with an ICMP header sequence value of 11 is detected on the network. Then, at the end of the ThrottleInterval (five seconds for this example), a SUMMARY alarm is generated, indicating the total number of times that the signature fired during this interval period. Summary alarms continue to be generated (one every five seconds) as long as summarization is active. Summarization remains active until no traffic matching this signature is seen for five seconds (the length of the ThrottleInterval).

Our next example is a slightly more complicated example based on the ATOMIC.L3.IP signature engine:

Engine ATOMIC.L3.IP SIGID 40000 IpProto 6
_____RecordOfInternalAddress 192.70.81.0 255.255.255.0
_____RecordOfExcludedPattern 40000 * * *
_____RecordOfIncludedPattern 40000 * 10.2.1/24 IN

This example demonstrates a signature that triggers when a TCP packet (IP Protocol 6) is sent from the 10.2.1.0 network to your protected network (192.70.81.0). This signature uses the RecordOfExcludedPattern, the RecordOfIncludedPattern, and the RecordOfInternalAddress parameters to define the appropriate addresses that this signature should apply to. The RecordOfInternalAddress parameter defines your internal network address space. The RecordOfExcludedPattern and RecordOfIncludedPattern parameters both accept four fields: SIGID, SubsigID, Source Address, and Destination Address. The RecordOfExcludedPattern line excludes all address combinations from firing on SIGID 40000 (with any SubsigID). Then, the RecordOfIncludedPattern includes the following address combinations for SIGID 40000 (with any SubsigID):

  • Source Address—Any address on class C network 10.2.1.0.
  • Destination Address—The IN keyword specifies any internal address.

Our last sample signature demonstrates how you can configure a custom signature to watch for a flood of specific packets on your network. To create a signature to detect a flood of traffic on your network first requires you to determine the amount of traffic that occurs during routine network operations. Normally, it is difficult to obtain this information because it varies from network to network. Therefore, you can run a FLOOD signature in diagnostic mode to actually monitor the amount of traffic on your network, and report this information in alarm messages.

Suppose you want to determine the normal amount of ICMP traffic on your network. You could use the following custom signature:

Engine FLOOD.NET SIGID 35000 IcmpType 0 Rate 0 Peaks 5 Gap 5

Using a rate of 0 places the signature in diagnostic mode. It monitors the network, and provides you with one alarm per ThrottleInterval, indicating the maximum packets-per-second during that interval. This information is presented in the alarm's details string.

After examining the alarms over a period of time, you can determine what the normal level of traffic is on your network. Then you can change the signature into an actual working signature by specifying a rate that indicates abnormal activity. Suppose your analysis indicates that your network normally has 10 ICMP packets/second. You can then create the following signature:

Engine FLOOD.NET SIGID 35000 IcmpType 0 Rate 50 Peaks 2 Gap 5

This signature fires if the number of ICMP packets on your network exceeds 50 ICMP packets/second for more than two seconds (the Peaks parameter) without a gap of five seconds (the Gap parameter).

Creating Custom Signatures

Creating your custom signatures varies, depending on your Director Platform. If you use the Unix Director, then you can use the standard nrConfigure tool to create your custom signatures. If you're using Cisco Secure Policy Manager (CSPM), however, you need to run a command line application called SigWizMenu. This program enables you to easily create custom signatures by taking you through a series of textual menus that enable you to specify the parameters needed for tuning existing signatures and creating new custom signatures.

Recently, another new worm spread across the Internet. This worm, W32.Goner.a@mm, was an email attachment that was written in Visual Basic. To create a custom signature to detect this worm, you first need to determine some unique characteristic of the worm. In this case, the attachment is named gone.scr. Next, we need to determine which ports this traffic is headed to (limiting the ports reduces the potential for false positives). Because this was a mail worm, it can potentially be seen going to port 25 (SMTP) or from ports 109 (POP2), 110 (POP3), 143 (IMAP2), and 220 (IMAP3). Therefore, this signature will actually become two separate signatures that handle the following two cases:

  • Look for worm going to port 25
  • Look for worm coming from ports 109,110,143, &220

To create a custom signature to check for the worm on the SMTP port, you need to define the following parameters:

  • AlarmThrottle—FireOnce
  • Direction—ToService
  • MinHits—1
  • RegexString—[Ff][Ii][Ll][Ee][Nn][Aa][Mm][Ee] [^\r\n]*[Gg][Oo][Nn][Ee][.][Ss][Cc][Rr]
  • ResetAfterIdle—15
  • ServicePorts—25
  • SigName—Goner.A Worm

Creating a custom signature to check for the worm on the POP and IMAP ports is very similar to the signature for SMTP, except that the ports change and the traffic is actually coming from the service ports. Therefore, you need to define the following parameters:

  • AlarmThrottle—FireOnce
  • Direction—FromService
  • MinHits—1
  • RegexString—[Ff][Ii][Ll][Ee][Nn][Aa][Mm][Ee] [^\r\n]*[Gg][Oo][Nn][Ee][.][Ss][Cc][Rr]
  • ResetAfterIdle—15
  • ServicePorts—109,110,143,220
  • SigName—Goner.A Worm

Summary

Cisco IDS 3.0 provides a very robust custom signature creation capability. You can very easily create new signatures to enhance the protection of your network against new threats. You can also use this capability to tune existing signatures so that your Cisco IDS operates more effectively considering your unique network configuration. Furthermore, since all of your custom signatures and tuning parameters are incorporated into a user configuration file, this information remains in effect even after software updates to the Cisco IDS.