Snort Manual
User Manual:
Open the PDF directly: View PDF .
Page Count: 178
Download | |
Open PDF In Browser | View PDF |
SNORT R Users Manual 2.8.5 The Snort Project October 19, 2009 Copyright c 1998-2003 Martin Roesch Copyright c 2001-2003 Chris Green Copyright c 2003-2009 Sourcefire, Inc. 1 Contents 1 Snort Overview 8 1.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.2 Sniffer Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.3 Packet Logger Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4 Network Intrusion Detection System Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.1 NIDS Mode Output Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.2 Understanding Standard Alert Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4.3 High Performance Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4.4 Changing Alert Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Inline Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.5.1 Snort Inline Rule Application Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.5.2 Replacing Packets with Snort Inline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.5.3 Installing Snort Inline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.5.4 Running Snort Inline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.5.5 Using the Honeynet Snort Inline Toolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.5.6 Troubleshooting Snort Inline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.6.1 Running Snort as a Daemon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.6.2 Running in Rule Stub Creation Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.6.3 Obfuscating IP Address Printouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.6.4 Specifying Multiple-Instance Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Reading Pcaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.7.1 Command line arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.7.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Tunneling Protocol Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.8.1 Multiple Encapsulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.8.2 Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 More Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 1.5 1.6 1.7 1.8 1.9 2 2 Configuring Snort 20 2.1 Includes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.1.1 Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.1.2 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.1.3 Config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Preprocessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.2.1 Frag3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.2.2 Stream5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 2.2.3 sfPortscan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 2.2.4 RPC Decode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 2.2.5 Performance Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 2.2.6 HTTP Inspect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 2.2.7 SMTP Preprocessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 2.2.8 FTP/Telnet Preprocessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 2.2.9 SSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 2.2.10 DCE/RPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 2.2.11 DNS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 2.2.12 SSL/TLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 2.2.13 ARP Spoof Preprocessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 2.2.14 DCE/RPC 2 Preprocessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Decoder and Preprocessor Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 2.3.1 Configuring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 2.3.2 Reverting to original behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Event Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 2.4.1 Rate Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 2.4.2 Event Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 2.4.3 Event Suppression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 2.4.4 Event Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Performance Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 2.5.1 Rule Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 2.5.2 Preprocessor Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 2.5.3 Packet Performance Monitoring (PPM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Output Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 2.6.1 alert syslog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 2.6.2 alert fast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 2.6.3 alert full . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 2.6.4 alert unixsock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 2.6.5 log tcpdump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 2.6.6 database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 2.2 2.3 2.4 2.5 2.6 3 2.6.7 csv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 2.6.8 unified . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 2.6.9 unified 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 2.6.10 alert prelude . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 2.6.11 log null . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 2.6.12 alert aruba action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 2.6.13 Log Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 2.7 2.8 2.9 Host Attribute Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 2.7.1 Configuration Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 2.7.2 Attribute Table File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Dynamic Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 2.8.1 Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 2.8.2 Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Reloading a Snort Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 2.9.1 Enabling support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 2.9.2 Reloading a configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 2.9.3 Non-reloadable configuration options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 2.10 Multiple Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 2.10.1 Creating Multiple Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 2.10.2 Configuration Specific Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 2.10.3 How Configuration is applied? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 3 Writing Snort Rules 113 3.1 The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 3.2 Rules Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 3.2.1 Rule Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 3.2.2 Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 3.2.3 IP Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 3.2.4 Port Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 3.2.5 The Direction Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 3.2.6 Activate/Dynamic Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 3.3 Rule Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 3.4 General Rule Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 3.4.1 msg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 3.4.2 reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 3.4.3 gid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 3.4.4 sid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 3.4.5 rev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 3.4.6 classtype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 4 3.5 3.4.7 priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 3.4.8 metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 3.4.9 General Rule Quick Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Payload Detection Rule Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 3.5.1 content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 3.5.2 nocase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 3.5.3 rawbytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 3.5.4 depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 3.5.5 offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 3.5.6 distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 3.5.7 within . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 3.5.8 http client body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 3.5.9 http cookie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 3.5.10 http header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 3.5.11 http method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 3.5.12 http uri . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 3.5.13 fast pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 3.5.14 uricontent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 3.5.15 urilen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 3.5.16 isdataat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 3.5.17 pcre . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 3.5.18 byte test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 3.5.19 byte jump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 3.5.20 ftpbounce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 3.5.21 asn1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 3.5.22 cvs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 3.5.23 dce iface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 3.5.24 dce opnum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 3.5.25 dce stub data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 3.5.26 Payload Detection Quick Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 3.6 Non-Payload Detection Rule Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 3.6.1 fragoffset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 3.6.2 ttl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 3.6.3 tos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 3.6.4 id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 3.6.5 ipopts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 3.6.6 fragbits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 3.6.7 dsize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 3.6.8 flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 5 3.6.9 flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 3.6.10 flowbits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 3.6.11 seq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 3.6.12 ack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 3.6.13 window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 3.6.14 itype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 3.6.15 icode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 3.6.16 icmp id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 3.6.17 icmp seq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 3.6.18 rpc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 3.6.19 ip proto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 3.6.20 sameip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 3.6.21 stream size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 3.6.22 Non-Payload Detection Quick Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 3.7 Post-Detection Rule Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 3.7.1 logto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 3.7.2 session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 3.7.3 resp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 3.7.4 react . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 3.7.5 tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 3.7.6 activates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 3.7.7 activated by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 3.7.8 count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 3.7.9 replace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 3.7.10 detection filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 3.7.11 Post-Detection Quick Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 4 3.8 Rule Thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 3.9 Writing Good Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Content Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 3.9.2 Catch the Vulnerability, Not the Exploit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 3.9.3 Catch the Oddities of the Protocol in the Rule . . . . . . . . . . . . . . . . . . . . . . . . . . 152 3.9.4 Optimizing Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 3.9.5 Testing Numerical Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Making Snort Faster 4.1 5 3.9.1 157 MMAPed pcap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Dynamic Modules 5.1 158 Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 5.1.1 DynamicPluginMeta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 6 5.2 5.3 6 5.1.2 DynamicPreprocessorData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 5.1.3 DynamicEngineData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 5.1.4 SFSnortPacket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 5.1.5 Dynamic Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Required Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 5.2.1 Preprocessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 5.2.2 Detection Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 5.2.3 Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 5.3.1 Preprocessor Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 5.3.2 Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Snort Development 174 6.1 Submitting Patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 6.2 Snort Data Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 6.3 6.2.1 Preprocessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 6.2.2 Detection Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 6.2.3 Output Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 The Snort Team . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 7 Chapter 1 Snort Overview This manual is based on Writing Snort Rules by Martin Roesch and further work from Chris Green. It was then maintained by Brian Caswell and now is maintained by the Snort Team. If you have a better way to say something or find that something in the documentation is outdated, drop us a line and we will update it. If you would like to submit patches for this document, you can find the latest version of the documentation in LATEX format in the Snort CVS repository at /doc/snort_manual.tex. Small documentation updates are the easiest way to help out the Snort Project. 1.1 Getting Started Snort really isn’t very hard to use, but there are a lot of command line options to play with, and it’s not always obvious which ones go together well. This file aims to make using Snort easier for new users. Before we proceed, there are a few basic concepts you should understand about Snort. Snort can be configured to run in three modes: • Sniffer mode, which simply reads the packets off of the network and displays them for you in a continuous stream on the console (screen). • Packet Logger mode, which logs the packets to disk. • Network Intrusion Detection System (NIDS) mode, the most complex and configurable configuration, which allows Snort to analyze network traffic for matches against a user-defined rule set and performs several actions based upon what it sees. • Inline mode, which obtains packets from iptables instead of from libpcap and then causes iptables to drop or pass packets based on Snort rules that use inline-specific rule types. 1.2 Sniffer Mode First, let’s start with the basics. If you just want to print out the TCP/IP packet headers to the screen (i.e. sniffer mode), try this: ./snort -v This command will run Snort and just show the IP and TCP/UDP/ICMP headers, nothing else. If you want to see the application data in transit, try the following: ./snort -vd 8 This instructs Snort to display the packet data as well as the headers. If you want an even more descriptive display, showing the data link layer headers, do this: ./snort -vde (As an aside, these switches may be divided up or smashed together in any combination. The last command could also be typed out as: ./snort -d -v -e and it would do the same thing.) 1.3 Packet Logger Mode OK, all of these commands are pretty cool, but if you want to record the packets to the disk, you need to specify a logging directory and Snort will automatically know to go into packet logger mode: ./snort -dev -l ./log Of course, this assumes you have a directory named log in the current directory. If you don’t, Snort will exit with an error message. When Snort runs in this mode, it collects every packet it sees and places it in a directory hierarchy based upon the IP address of one of the hosts in the datagram. If you just specify a plain -l switch, you may notice that Snort sometimes uses the address of the remote computer as the directory in which it places packets and sometimes it uses the local host address. In order to log relative to the home network, you need to tell Snort which network is the home network: ./snort -dev -l ./log -h 192.168.1.0/24 This rule tells Snort that you want to print out the data link and TCP/IP headers as well as application data into the directory ./log, and you want to log the packets relative to the 192.168.1.0 class C network. All incoming packets will be recorded into subdirectories of the log directory, with the directory names being based on the address of the remote (non-192.168.1) host. ! NOTE △ Note that if both the source and destination hosts are on the home network, they are logged to a directory with a name based on the higher of the two port numbers or, in the case of a tie, the source address. If you’re on a high speed network or you want to log the packets into a more compact form for later analysis, you should consider logging in binary mode. Binary mode logs the packets in tcpdump format to a single binary file in the logging directory: ./snort -l ./log -b Note the command line changes here. We don’t need to specify a home network any longer because binary mode logs everything into a single file, which eliminates the need to tell it how to format the output directory structure. Additionally, you don’t need to run in verbose mode or specify the -d or -e switches because in binary mode the entire packet is logged, not just sections of it. All you really need to do to place Snort into logger mode is to specify a logging directory at the command line using the -l switch—the -b binary logging switch merely provides a modifier that tells Snort to log the packets in something other than the default output format of plain ASCII text. Once the packets have been logged to the binary file, you can read the packets back out of the file with any sniffer that supports the tcpdump binary format (such as tcpdump or Ethereal). Snort can also read the packets back by using the 9 -r switch, which puts it into playback mode. Packets from any tcpdump formatted file can be processed through Snort in any of its run modes. For example, if you wanted to run a binary log file through Snort in sniffer mode to dump the packets to the screen, you can try something like this: ./snort -dv -r packet.log You can manipulate the data in the file in a number of ways through Snort’s packet logging and intrusion detection modes, as well as with the BPF interface that’s available from the command line. For example, if you only wanted to see the ICMP packets from the log file, simply specify a BPF filter at the command line and Snort will only see the ICMP packets in the file: ./snort -dvr packet.log icmp For more info on how to use the BPF interface, read the Snort and tcpdump man pages. 1.4 Network Intrusion Detection System Mode To enable Network Intrusion Detection System (NIDS) mode so that you don’t record every single packet sent down the wire, try this: ./snort -dev -l ./log -h 192.168.1.0/24 -c snort.conf where snort.conf is the name of your rules file. This will apply the rules configured in the snort.conf file to each packet to decide if an action based upon the rule type in the file should be taken. If you don’t specify an output directory for the program, it will default to /var/log/snort. One thing to note about the last command line is that if Snort is going to be used in a long term way as an IDS, the -v switch should be left off the command line for the sake of speed. The screen is a slow place to write data to, and packets can be dropped while writing to the display. It’s also not necessary to record the data link headers for most applications, so you can usually omit the -e switch, too. ./snort -d -h 192.168.1.0/24 -l ./log -c snort.conf This will configure Snort to run in its most basic NIDS form, logging packets that trigger rules specified in the snort.conf in plain ASCII to disk using a hierarchical directory structure (just like packet logger mode). 1.4.1 NIDS Mode Output Options There are a number of ways to configure the output of Snort in NIDS mode. The default logging and alerting mechanisms are to log in decoded ASCII format and use full alerts. The full alert mechanism prints out the alert message in addition to the full packet headers. There are several other alert output modes available at the command line, as well as two logging facilities. Alert modes are somewhat more complex. There are seven alert modes available at the command line: full, fast, socket, syslog, console, cmg, and none. Six of these modes are accessed with the -A command line switch. These options are: Option -A fast -A full -A -A -A -A unsock none console cmg Description Fast alert mode. Writes the alert in a simple format with a timestamp, alert message, source and destination IPs/ports. Full alert mode. This is the default alert mode and will be used automatically if you do not specify a mode. Sends alerts to a UNIX socket that another program can listen on. Turns off alerting. Sends “fast-style” alerts to the console (screen). Generates “cmg style” alerts. 10 Packets can be logged to their default decoded ASCII format or to a binary log file via the -b command line switch. To disable packet logging altogether, use the -N command line switch. For output modes available through the configuration file, see Section 2.6. ! NOTE △ Command line logging options override any output options specified in the configuration file. This allows debugging of configuration issues quickly via the command line. To send alerts to syslog, use the -s switch. The default facilities for the syslog alerting mechanism are LOG AUTHPRIV and LOG ALERT. If you want to configure other facilities for syslog output, use the output plugin directives in the rules files. See Section 2.6.1 for more details on configuring syslog output. For example, use the following command line to log to default (decoded ASCII) facility and send alerts to syslog: ./snort -c snort.conf -l ./log -h 192.168.1.0/24 -s As another example, use the following command line to log to the default facility in /var/log/snort and send alerts to a fast alert file: ./snort -c snort.conf -A fast -h 192.168.1.0/24 1.4.2 Understanding Standard Alert Output When Snort generates an alert message, it will usually look like the following: [**] [116:56:1] (snort_decoder): T/TCP Detected [**] The first number is the Generator ID, this tells the user what component of Snort generated this alert. For a list of GIDs, please read etc/generators in the Snort source. In this case, we know that this event came from the “decode” (116) component of Snort. The second number is the Snort ID (sometimes referred to as Signature ID). For a list of preprocessor SIDs, please see etc/gen-msg.map. Rule-based SIDs are written directly into the rules with the sid option. In this case, 56 represents a T/TCP event. The third number is the revision ID. This number is primarily used when writing signatures, as each rendition of the rule should increment this number with the rev option. 1.4.3 High Performance Configuration If you want Snort to go fast (like keep up with a 1000 Mbps connection), you need to use unified logging and a unified log reader such as barnyard. This allows Snort to log alerts in a binary form as fast as possible while another program performs the slow actions, such as writing to a database. If you want a text file that’s easily parsable, but still somewhat fast, try using binary logging with the “fast” output mechanism. This will log packets in tcpdump format and produce minimal alerts. For example: ./snort -b -A fast -c snort.conf 11 1.4.4 Changing Alert Order The default way in which Snort applies its rules to packets may not be appropriate for all installations. The Pass rules are applied first, then the Drop rules, then the Alert rules and finally, Log rules are applied. ! NOTE △ Sometimes an errant pass rule could cause alerts to not show up, in which case you can change the default ordering to allow Alert rules to be applied before Pass rules. For more information, please refer to the --alert-before-pass option. Several command line options are available to change the order in which rule actions are taken. • --alert-before-pass option forces alert rules to take affect in favor of a pass rule. • --treat-drop-as-alert causes drop, sdrop, and reject rules and any associated alerts to be logged as alerts, rather then the normal action. This allows use of an inline policy with passive/IDS mode. • --process-all-events option causes Snort to process every event associated with a packet, while taking the actions based on the rules ordering. Without this option (default case), only the events for the first action based on rules ordering are processed. ! NOTE △ Pass rules are special cases here, in that the event processing is terminated when a pass rule is encountered, regardless of the use of --process-all-events. 1.5 Inline Mode Snort 2.3.0 RC1 integrated the intrusion prevention system (IPS) capability of Snort Inline into the official Snort project. Snort Inline obtains packets from iptables instead of libpcap and then uses new rule types to help iptables pass or drop packets based on Snort rules. In order for Snort Inline to work properly, you must download and compile the iptables code to include “make install-devel” (http://www.iptables.org). This will install the libipq library that allows Snort Inline to interface with iptables. Also, you must build and install LibNet, which is available from http://www.packetfactory.net. There are three rule types you can use when running Snort with Snort Inline: • drop - The drop rule type will tell iptables to drop the packet and log it via usual Snort means. • reject - The reject rule type will tell iptables to drop the packet, log it via usual Snort means, and send a TCP reset if the protocol is TCP or an icmp port unreachable if the protocol is UDP. • sdrop - The sdrop rule type will tell iptables to drop the packet. Nothing is logged. ! NOTE △ You can also replace sections of the packet payload when using Snort Inline. See Section 1.5.2 for more information. When using a reject rule, there are two options you can use to send TCP resets: • You can use a RAW socket (the default behavior for Snort Inline), in which case you must have an interface that has an IP address assigned to it. If there is not an interface with an IP address assigned with access to the source of the packet, the packet will be logged and the reset packet will never make it onto the network. 12 • You can also now perform resets via a physical device when using iptables. We take the indev name from ip queue and use this as the interface on which to send resets. We no longer need an IP loaded on the bridge, and can remain pretty stealthy as the config layer2 resets in snort.conf takes a source MAC address which we substitue for the MAC of the bridge. For example: config layer2resets tells Snort Inline to use layer2 resets and uses the MAC address of the bridge as the source MAC in the packet, and: config layer2resets: 00:06:76:DD:5F:E3 will tell Snort Inline to use layer2 resets and uses the source MAC of 00:06:76:DD:5F:E3 in the reset packet. • The command-line option --disable-inline-initialization can be used to not initialize IPTables when in inline mode. It should be used with command-line option -T to test for a valid configuration without requiring opening inline devices and adversely affecting traffic flow. 1.5.1 Snort Inline Rule Application Order The current rule application order is: ->activation->dynamic->pass->drop->sdrop->reject->alert->log This will ensure that a drop rule has precedence over an alert or log rule. 1.5.2 Replacing Packets with Snort Inline Additionally, Jed Haile’s content replace code allows you to modify packets before they leave the network. For example: alert tcp any any <> any 80 ( \ msg: "tcp replace"; content:"GET"; replace:"BET";) alert udp any any <> any 53 ( \ msg: "udp replace"; content: "yahoo"; replace: "xxxxx";) These rules will comb TCP port 80 traffic looking for GET, and UDP port 53 traffic looking for yahoo. Once they are found, they are replaced with BET and xxxxx, respectively. The only catch is that the replace must be the same length as the content. 1.5.3 Installing Snort Inline To install Snort inline, use the following command: ./configure --enable-inline make make install 13 1.5.4 Running Snort Inline First, you need to ensure that the ip queue module is loaded. Then, you need to send traffic to Snort Inline using the QUEUE target. For example: iptables -A OUTPUT -p tcp --dport 80 -j QUEUE sends all TCP traffic leaving the firewall going to port 80 to the QUEUE target. This is what sends the packet from kernel space to user space (Snort Inline). A quick way to get all outbound traffic going to the QUEUE is to use the rc.firewall script created and maintained by the Honeynet Project (http://www.honeynet.org/papers/honeynet/tools/) This script is well-documented and allows you to direct packets to Snort Inline by simply changing the QUEUE variable to yes. Finally, start Snort Inline: snort -QDc ../etc/drop.conf -l /var/log/snort You can use the following command line options: • -Q - Gets packets from iptables. • -D - Runs Snort Inline in daemon mode. The process ID is stored at /var/run/snort.pid • -c - Reads the following configuration file. • -l - Logs to the following directory. Ideally, Snort Inline will be run using only its own drop.rules. If you want to use Snort for just alerting, a separate process should be running with its own rule set. 1.5.5 Using the Honeynet Snort Inline Toolkit The Honeynet Snort Inline Toolkit is a statically compiled Snort Inline binary put together by the Honeynet Project for the Linux operating system. It comes with a set of drop.rules, the Snort Inline binary, a snort-inline rotation shell script, and a good README. It can be found at: http://www.honeynet.org/papers/honeynet/tools/ 1.5.6 Troubleshooting Snort Inline If you run Snort Inline and see something like this: Initializing Output Plugins! Reading from iptables Log directory = /var/log/snort Initializing Inline mode InlineInit: : Failed to send netlink message: Connection refused More than likely, the ip queue module is not loaded or ip queue support is not compiled into your kernel. Either recompile your kernel to support ip queue, or load the module. The ip queue module is loaded by executing: insmod ip_queue Also, if you want to ensure Snort Inline is getting packets, you can start it in the following manner: snort -Qvc This will display the header of every packet that Snort Inline sees. 14 1.6 Miscellaneous 1.6.1 Running Snort as a Daemon If you want to run Snort as a daemon, you can the add -D switch to any combination described in the previous sections. Please notice that if you want to be able to restart Snort by sending a SIGHUP signal to the daemon, you must specify the full path to the Snort binary when you start it, for example: /usr/local/bin/snort -d -h 192.168.1.0/24 \ -l /var/log/snortlogs -c /usr/local/etc/snort.conf -s -D Relative paths are not supported due to security concerns. Snort PID File When Snort is run as a daemon , the daemon creates a PID file in the log directory. In Snort 2.6, the --pid-path command line switch causes Snort to write the PID file in the directory specified. Additionally, the --create-pidfile switch can be used to force creation of a PID file even when not running in daemon mode. The PID file will be locked so that other snort processes cannot start. Use the --nolock-pidfile switch to not lock the PID file. 1.6.2 Running in Rule Stub Creation Mode If you need to dump the shared object rules stub to a directory, you might need to use the –dump-dynamic-rules option. These rule stub files are used in conjunction with the shared object rules. The path can be relative or absolute. /usr/local/bin/snort -c /usr/local/etc/snort.conf \ --dump-dynamic-rules=/tmp This path can also be configured in the snort.conf using the config option dump-dynamic-rules-path as follows: config dump-dynamic-rules-path: /tmp/sorules The path configured by command line has precedence over the one configured using dump-dynamic-rules-path. /usr/local/bin/snort -c /usr/local/etc/snort.conf \ --dump-dynamic-rules snort.conf: config dump-dynamic-rules-path: /tmp/sorules In the above mentioned scenario the dump path is set to /tmp/sorules. 1.6.3 Obfuscating IP Address Printouts If you need to post packet logs to public mailing lists, you might want to use the -O switch. This switch obfuscates your IP addresses in packet printouts. This is handy if you don’t want people on the mailing list to know the IP addresses involved. You can also combine the -O switch with the -h switch to only obfuscate the IP addresses of hosts on the home network. This is useful if you don’t care who sees the address of the attacking host. For example, you could use the following command to read the packets from a log file and dump them to the screen, obfuscating only the addresses from the 192.168.1.0/24 class C network: ./snort -d -v -r snort.log -O -h 192.168.1.0/24 15 1.6.4 Specifying Multiple-Instance Identifiers In Snort v2.4, the -G command line option was added that specifies an instance identifier for the event logs. This option can be used when running multiple instances of snort, either on different CPUs, or on the same CPU but a different interface. Each Snort instance will use the value specified to generate unique event IDs. Users can specify either a decimal value (-G 1) or hex value preceded by 0x (-G 0x11). This is also supported via a long option --logid. 1.7 Reading Pcaps Instead of having Snort listen on an interface, you can give it a packet capture to read. Snort will read and analyze the packets as if they came off the wire. This can be useful for testing and debugging Snort. 1.7.1 Command line arguments Any of the below can be specified multiple times on the command line (-r included) and in addition to other Snort command line options. Note, however, that specifying --pcap-reset and --pcap-show multiple times has the same effect as specifying them once. Option -r --pcap-single= --pcap-file= --pcap-list=" " --pcap-dir=
--pcap-filter= --pcap-no-filter --pcap-reset --pcap-show Description Read a single pcap. Same as -r. Added for completeness. File that contains a list of pcaps to read. Can specifiy path to pcap or directory to recurse to get pcaps. A space separated list of pcaps to read. A directory to recurse to look for pcaps. Sorted in ascii order. Shell style filter to apply when getting pcaps from file or directory. This filter will apply to any --pcap-file or --pcap-dir arguments following. Use --pcap-no-filter to delete filter for following --pcap-file or --pcap-dir arguments or specifiy --pcap-filter again to forget previous filter and to apply to following --pcap-file or --pcap-dir arguments. Reset to use no filter when getting pcaps from file or directory. If reading multiple pcaps, reset snort to post-configuration state before reading next pcap. The default, i.e. without this option, is not to reset state. Print a line saying what pcap is currently being read. 1.7.2 Examples Read a single pcap $ snort -r foo.pcap $ snort --pcap-single=foo.pcap Read pcaps from a file $ cat foo.txt foo1.pcap foo2.pcap /home/foo/pcaps $ snort --pcap-file=foo.txt This will read foo1.pcap, foo2.pcap and all files under /home/foo/pcaps. Note that Snort will not try to determine whether the files under that directory are really pcap files or not. 16 Read pcaps from a command line list $ snort --pcap-list="foo1.pcap foo2.pcap foo3.pcap" This will read foo1.pcap, foo2.pcap and foo3.pcap. Read pcaps under a directory $ snort --pcap-dir="/home/foo/pcaps" This will include all of the files under /home/foo/pcaps. Using filters $ cat foo.txt foo1.pcap foo2.pcap /home/foo/pcaps $ snort --pcap-filter="*.pcap" --pcap-file=foo.txt $ snort --pcap-filter="*.pcap" --pcap-dir=/home/foo/pcaps The above will only include files that match the shell pattern ”*.pcap”, in other words, any file ending in ”.pcap”. $ snort --pcap-filter="*.pcap --pcap-file=foo.txt \ > --pcap-filter="*.cap" --pcap-dir=/home/foo/pcaps In the above, the first filter ”*.pcap” will only be applied to the pcaps in the file ”foo.txt” (and any directories that are recursed in that file). The addition of the second filter ”*.cap” will cause the first filter to be forgotten and then applied to the directory /home/foo/pcaps, so only files ending in ”.cap” will be included from that directory. $ snort --pcap-filter="*.pcap --pcap-file=foo.txt \ > --pcap-no-filter --pcap-dir=/home/foo/pcaps In this example, the first filter will be applied to foo.txt, then no filter will be applied to the files found under /home/foo/pcaps, so all files found under /home/foo/pcaps will be included. $ snort --pcap-filter="*.pcap --pcap-file=foo.txt \ > --pcap-no-filter --pcap-dir=/home/foo/pcaps \ > --pcap-filter="*.cap" --pcap-dir=/home/foo/pcaps2 In this example, the first filter will be applied to foo.txt, then no filter will be applied to the files found under /home/foo/pcaps, so all files found under /home/foo/pcaps will be included, then the filter ”*.cap” will be applied to files found under /home/foo/pcaps2. Resetting state $ snort --pcap-dir=/home/foo/pcaps --pcap-reset The above example will read all of the files under /home/foo/pcaps, but after each pcap is read, Snort will be reset to a post-configuration state, meaning all buffers will be flushed, statistics reset, etc. For each pcap, it will be like Snort is seeing traffic for the first time. 17 Printing the pcap $ snort --pcap-dir=/home/foo/pcaps --pcap-show The above example will read all of the files under /home/foo/pcaps and will print a line indicating which pcap is currently being read. 1.8 Tunneling Protocol Support Snort supports decoding of GRE, IP in IP and PPTP. To enable support, an extra configuration option is necessary: $ ./configure --enable-gre To enable IPv6 support, one still needs to use the configuration option: $ ./configure --enable-ipv6 1.8.1 Multiple Encapsulations Snort will not decode more than one encapsulation. Scenarios such as Eth IPv4 GRE IPv4 GRE IPv4 TCP Payload or Eth IPv4 IPv6 IPv4 TCP Payload will not be handled and will generate a decoder alert. 1.8.2 Logging Currently, only the encapsulated part of the packet is logged, e.g. Eth IP1 GRE IP2 TCP Payload gets logged as Eth IP2 TCP Payload and Eth IP1 IP2 TCP Payload gets logged as Eth IP2 TCP Payload ! NOTE △ Decoding of PPTP, which utilizes GRE and PPP, is not currently supported on architectures that require word alignment such as SPARC. 18 1.9 More Information Chapter 2 contains much information about many configuration options available in the configuration file. The Snort manual page and the output of snort -? or snort --help contain information that can help you get Snort running in several different modes. ! NOTE △ In many shells, a backslash (\) is needed to escape the ?, so you may have to type snort -\? instead of snort -? for a list of Snort command line options. The Snort web page (http://www.snort.org) and the Snort Users mailing list: http://marc.theaimsgroup.com/?l=snort-users at snort-users@lists.sourceforge.net provide informative announcements as well as a venue for community discussion and support. There’s a lot to Snort, so sit back with a beverage of your choosing and read the documentation and mailing list archives. 19 Chapter 2 Configuring Snort 2.1 Includes The include keyword allows other rules files to be included within the rules file indicated on the Snort command line. It works much like an #include from the C programming language, reading the contents of the named file and adding the contents in the place where the include statement appears in the file. 2.1.1 Format include ! NOTE △ Note that there is no semicolon at the end of this line. Included files will substitute any predefined variable values into their own variable references. See Section 2.1.2 for more information on defining and using variables in Snort rules files. 2.1.2 Variables Three types of variables may be defined in Snort: • var • portvar • ipvar ! NOTE △ Note: ’ipvar’s are only enabled with IPv6 support. Without IPv6 support, use a regular ’var’. These are simple substitution variables set with the var, ipvar, or portvar keywords as follows: var RULES_PATH rules/ portvar MY_PORTS [22,80,1024:1050] ipvar MY_NET [192.168.1.0/24,10.1.1.0/24] alert tcp any any -> $MY_NET $MY_PORTS (flags:S; msg:"SYN packet";) include $RULE_PATH/example.rule 20 IP Variables and IP Lists IPs may be specified individually, in a list, as a CIDR block, or any combination of the three. If IPv6 support is enabled, IP variables should be specified using ’ipvar’ instead of ’var’. Using ’var’ for an IP variable is still allowed for backward compatibility, but it will be deprecated in a future release. IPs, IP lists, and CIDR blocks may be negated with ’!’. Negation is handled differently compared with Snort versions 2.7.x and earlier. Previously, each element in a list was logically OR’ed together. IP lists now OR non-negated elements and AND the result with the OR’ed negated elements. The following example list will match the IP 1.1.1.1 and IP from 2.2.2.0 to 2.2.2.255, with the exception of IPs 2.2.2.2 and 2.2.2.3. [1.1.1.1,2.2.2.0/24,![2.2.2.2,2.2.2.3]] The order of the elements in the list does not matter. The element ’any’ can be used to match all IPs, although ’!any’ is not allowed. Also, negated IP ranges that are more general than non-negated IP ranges are not allowed. See below for some valid examples if IP variables and IP lists. ipvar EXAMPLE [1.1.1.1,2.2.2.0/24,![2.2.2.2,2.2.2.3]] alert tcp $EXAMPLE any -> any any (msg:"Example"; sid:1;) alert tcp [1.0.0.0/8,!1.1.1.0/24] any -> any any (msg:"Example";sid:2;) The following examples demonstrate some invalid uses of IP variables and IP lists. Use of !any: ipvar EXAMPLE any alert tcp !$EXAMPLE any -> any any (msg:"Example";sid:3;) Different use of !any: ipvar EXAMPLE !any alert tcp $EXAMPLE any -> any any (msg:"Example";sid:3;) Logical contradictions: ipvar EXAMPLE [1.1.1.1,!1.1.1.1] Nonsensical negations: ipvar EXAMPLE [1.1.1.0/24,!1.1.0.0/16] Port Variables and Port Lists Portlists supports the declaration and lookup of ports and the representation of lists and ranges of ports. Variables, ranges, or lists may all be negated with ’!’. Also, ’any’ will specify any ports, but ’!any’ is not allowed. Valid port ranges are from 0 to 65535. Lists of ports must be enclosed in brackets and port ranges may be specified with a ’:’, such as in: [10:50,888:900] 21 Port variables should be specified using ’portvar’. The use of ’var’ to declare a port variable will be deprecated in a future release. For backwards compatibility, a ’var’ can still be used to declare a port variable, provided the variable name either ends with ’ PORT’ or begins with ’PORT ’. The following examples demonstrate several valid usages of both port variables and port lists. portvar EXAMPLE1 80 var EXAMPLE2_PORT [80:90] var PORT_EXAMPLE2 [1] portvar EXAMPLE3 any portvar EXAMPLE4 [!70:90] portvar EXAMPLE5 [80,91:95,100:200] alert tcp any $EXAMPLE1 -> any $EXAMPLE2_PORT (msg:"Example"; sid:1;) alert tcp any $PORT_EXAMPLE2 -> any any (msg:"Example"; sid:2;) alert tcp any 90 -> any [100:1000,9999:20000] (msg:"Example"; sid:3;) Several invalid examples of port variables and port lists are demonstrated below: Use of !any: portvar EXAMPLE5 !any var EXAMPLE5 !any Logical contradictions: portvar EXAMPLE6 [80,!80] Ports out of range: portvar EXAMPLE7 [65536] Incorrect declaration and use of a port variable: var EXAMPLE8 80 alert tcp any $EXAMPLE8 -> any any (msg:"Example"; sid:4;) Port variable used as an IP: alert tcp $EXAMPLE1 any -> any any (msg:"Example"; sid:5;) Variable Modifiers Rule variable names can be modified in several ways. You can define meta-variables using the $ operator. These can be used with the variable modifier operators ? and -, as described in the following table: 22 Variable Syntax var $(var) or $var $(var:-default) $(var:?message) Description Defines a meta-variable. Replaces with the contents of variable var. Replaces the contents of the variable var with “default” if var is undefined. Replaces with the contents of variable var or prints out the error message and exits. Here is an example of advanced variable usage in action: ipvar MY_NET 192.168.1.0/24 log tcp any any -> $(MY_NET:?MY_NET is undefined!) 23 Limitations When embedding variables, types can not be mixed. For instance, port variables can be defined in terms of other port variables, but old-style variables (with the ’var’ keyword) can not be embedded inside a ’portvar’. Valid embedded variable: portvar pvar1 80 portvar pvar2 [$pvar1,90] Invalid embedded variable: var pvar1 80 portvar pvar2 [$pvar1,90] Likewise, variables can not be redefined if they were previously defined as a different type. They should be renamed instead: Invalid redefinition: var pvar 80 portvar pvar 90 2.1.3 Config Many configuration and command line options of Snort can be specified in the configuration file. Format config [: ] 23 Config Directive config alert with interface name config alertfile: config asn1: config autogenerate preprocessor decoder rules config bpf file: config checksum drop: config checksum mode: config config config config config chroot: classification: daemon decode data link default rule state: config detection: [lowmem] [no stream inserts] [max queue events ] Description Appends interface name to alert (snort -I). Sets the alerts output file. Specifies the maximum number of nodes to track when doing ASN1 decoding. See Section 3.5.21 for more information and examples. If Snort was configured to enable decoder and preprocessor rules, this option will cause Snort to revert back to it’s original behavior of alerting if the decoder or preprocessor generates an event. Specifies BPF filters (snort -F). Types of packets to drop if invalid checksums. Values: none, noip, notcp, noicmp, noudp, ip, tcp, udp, icmp or all (only applicable in inline mode and for packets checked per checksum mode config option). Types of packets to calculate checksums. Values: none, noip, notcp, noicmp, noudp, ip, tcp, udp, icmp or all. Chroots to specified dir (snort -t). See Table 3.2 for a list of classifications. Forks as a daemon (snort -D). Decodes Layer2 headers (snort -e). Global configuration directive to enable or disable the loading of rules into the detection engine. Default (with or without directive) is enabled. Specify disabled to disable loading rules. Makes changes to the detection engine. The following options can be used: • search-method – ac Aho-Corasick Full (high memory, best performance) – ac-std Aho-Corasick Standard (moderate memory, high performance) – ac-bnfa Aho-Corasick NFA (low memory, high performance) – acs Aho-Corasick Sparse (small memory, moderate performance) – ac-banded Aho-Corasick Banded (small memory, moderate performance) – ac-sparsebands Aho-Corasick Sparse-Banded (small memory, high performance) – lowmem Low Memory Keyword Trie (small memory, low performance) • no stream inserts • max queue events config disable decode alerts config disable inline init failopen config disable ipopt alerts Turns off the alerts generated by the decode phase of Snort. Disables failopen thread that allows inline traffic to pass while Snort is starting up. Only useful if Snort was configured with –enable-inline-init-failopen. (snort --disable-inline-init-failopen) Disables IP option length validation alerts. 24 config disable tcpopt alerts config disable tcpopt experimental alerts config disable tcpopt obsolete alerts config disable tcpopt ttcp alerts config disable ttcp alerts config dump chars only config dump payload config dump payload verbose config enable decode drops Disables option length validation alerts. Turns off alerts generated by experimental TCP options. Turns off alerts generated by obsolete TCP options. Turns off alerts generated by T/TCP options. Turns off alerts generated by T/TCP options. Turns on character dumps (snort -C). Dumps application layer (snort -d). Dumps raw packet starting at link layer (snort -X). Enables the dropping of bad packets identified by decoder (only applicable in inline mode). config enable decode oversized alerts Enable alerting on packets that have headers containing length fields for which the value is greater than the length of the packet. config enable decode oversized drops Enable dropping packets that have headers containing length fields for which the value is greater than the length of the packet. enable decode oversized alerts must also be enabled for this to be effective (only applicable in inline mode). config enable ipopt drops Enables the dropping of bad packets with bad/truncated IP options (only applicable in inline mode). config enable mpls multicast Enables support for MPLS multicast. This option is needed when the network allows MPLS multicast traffic. When this option is off and MPLS multicast traffic is detected, Snort will generate an alert. By default, it is off. config enable mpls overlapping ip Enables support for overlapping IP addresses in an MPLS network. In a normal situation, where there are no overlapping IP addresses, this configuration option should not be turned on. However, there could be situations where two private networks share the same IP space and different MPLS labels are used to differentiate traffic from the two VPNs. In such a situation, this configuration option should be turned on. By default, it is off. config enable tcpopt drops Enables the dropping of bad packets with bad/truncated TCP option (only applicable in inline mode). config Enables the dropping of bad packets with experimental TCP openable tcpopt experimental drops tion. (only applicable in inline mode). config enable tcpopt obsolete drops Enables the dropping of bad packets with obsolete TCP option. (only applicable in inline mode). enable tcpopt ttcp drops Enables the dropping of bad packets with T/TCP option. (only applicable in inline mode). enable ttcp drops Enables the dropping of bad packets with T/TCP option. (only applicable in inline mode). config event filter: memcap Set global memcap in bytes for thresholding. Default is 1048576 bytes (1 megabyte). config event queue: [max queue Specifies conditions about Snort’s event queue. You can use the ] [log ] [order events following options: ] • max queue (max events supported) • log (number of events to log) • order events [priority|content length] (how to order events within the queue) See Section 2.4.4 for more information and examples. 25 config flexresp2 attempts: config flexresp2 interface: config flexresp2 memcap: config flexresp2 rows: config flowbits size: config ignore ports: config interface: config ipv6 frag: [bsd icmp frag alert on|off] [, bad ipv6 frag alert on|off] [, frag timeout ] [, max frag sessions ] Specify the number of TCP reset packets to send to the source of the attack. Valid values are 0 to 20, however values less than 4 will default to 4. The default value without this option is 4. (Snort must be compiled with –enable-flexresp2) Specify the response interface to use. In Windows this can also be the interface number. (Snort must be compiled with –enableflexresp2) Specify the memcap for the hash table used to track the time of responses. The times (hashed on a socket pair plus protocol) are used to limit sending a response to the same half of a socket pair every couple of seconds. Default is 1048576 bytes. (Snort must be compiled with –enable-flexresp2) Specify the number of rows for the hash table used to track the time of responses. Default is 1024 rows. (Snort must be compiled with –enable-flexresp2) Specifies the maximum number of flowbit tags that can be used within a rule set. Specifies ports to ignore (useful for ignoring noisy NFS traffic). Specify the protocol (TCP, UDP, IP, or ICMP), followed by a list of ports. Port ranges are supported. Sets the network interface (snort -i). The following options can be used: • bsd icmp frag alert on|off (Specify whether or not to alert. Default is on) • bad ipv6 frag alert on|off (Specify whether or not to alert. Default is on) • frag timeout (Specify amount of time in seconds to timeout first frag in hash table) • max frag sessions (Specify the number of fragments to track in the hash table) config layer2resets: config logdir: config max attribute hosts: config max mpls labelchain len: config min ttl: config mpls payload type: ipv4|ipv6|ethernet config config config config no promisc nolog nopcre obfuscate This option is only available when running in inline mode. See Section 1.5. Sets the logdir (snort -l). Sets a limit on the maximum number of hosts to read from the attribute table. Minimum value is 32 and the maximum is 524288 (512k). The default is 10000. If the number of hosts in the attribute table exceeds this value, an error is logged and the remainder of the hosts are ignored. This option is only supported with a Host Attribute Table (see section 2.7). Sets a Snort-wide limit on the number of MPLS headers a packet can have. Its default value is -1, which means that there is no limit on label chain length. Sets a Snort-wide minimum ttl to ignore all traffic. Sets a Snort-wide MPLS payload type. In addition to ipv4, ipv6 and ethernet are also valid options. The default MPLS payload type is ipv4 Disables promiscuous mode (snort -p). Disables logging. Note: Alerts will still occur. (snort -N). Disables pcre pattern matching. Obfuscates IP Addresses (snort -O). 26 config order: config pcre match limit: config pcre match limit recursion: config pkt count: config policy version: [ ] config profile preprocs config profile rules config quiet config read bin file: config reference: config reference net config set gid: set uid: config show year config snaplen: config stateful config tagged packet limit: config threshold: memcap config timestats interval: config umask: Changes the order that rules are evaluated, eg: pass alert log activation. Restricts the amount of backtracking a given PCRE option. For example, it will limit the number of nested repeats within a pattern. A value of -1 allows for unlimited PCRE, up to the PCRE library compiled limit (around 10 million). A value of 0 results in no PCRE evaluation. The snort default value is 1500. Restricts the amount of stack used by a given PCRE option. A value of -1 allows for unlimited PCRE, up to the PCRE library compiled limit (around 10 million). A value of 0 results in no PCRE evaluation. The snort default value is 1500. This option is only useful if the value is less than the pcre match limit Exits after N packets (snort -n). Supply versioning information to configuration files. Base version should be a string in all configuration files including included ones. In addition, binding version must be in any file configured with config binding. This option is used to avoid race conditions when modifying and loading a configuration within a short time span - before Snort has had a chance to load a previous configuration. Print statistics on preprocessor performance. See Section 2.5.2 for more details. Print statistics on rule performance. See Section 2.5.1 for more details. Disables banner and status reports (snort -q). Specifies a pcap file to use (instead of reading from network), same effect as -r option. Adds a new reference system to Snort, eg: myref http://myurl.com/?id= For IP obfuscation, the obfuscated net will be used if the packet contains an IP address in the reference net. Also used to determine how to set up the logging directory structure for the session post detection rule option and ascii output plugin - an attempt is made to name the log directories after the IP address that is not in the reference net. Changes GID to specified GID (snort -g). Sets UID to (snort -u). Shows year in timestamps (snort -y). Set the snaplength of packet, same effect as -P or --snaplen options. Sets assurance mode for stream (stream is established). When a metric other than packets is used in a tag option in a rule, this option sets the maximum number of packets to be tagged regardless of the amount defined by the other metric. See Section 3.7.5 on using the tag option when writing rules for more details. The default value when this option is not configured is 256 packets. Setting this option to a value of 0 will disable the packet limit. Set global memcap in bytes for thresholding. Default is 1048576 bytes (1 megabyte). (This is deprecated. Use config event filter instead.) Set the amount of time in seconds between logging time stats. Default is 3600 (1 hour). Note this option is only available if Snort was built to use time stats with --enable-timestats. Sets umask when running (snort -m). 27 config utc config verbose Uses UTC instead of local time for timestamps (snort -U). Uses verbose logging to STDOUT (snort -v). 2.2 Preprocessors Preprocessors were introduced in version 1.5 of Snort. They allow the functionality of Snort to be extended by allowing users and programmers to drop modular plugins into Snort fairly easily. Preprocessor code is run before the detection engine is called, but after the packet has been decoded. The packet can be modified or analyzed in an out-of-band manner using this mechanism. Preprocessors are loaded and configured using the preprocessor keyword. The format of the preprocessor directive in the Snort rules file is: preprocessor : 2.2.1 Frag3 The frag3 preprocessor is a target-based IP defragmentation module for Snort. Frag3 is intended as a replacement for the frag2 defragmentation module and was designed with the following goals: 1. Faster execution than frag2 with less complex data management. 2. Target-based host modeling anti-evasion techniques. The frag2 preprocessor used splay trees extensively for managing the data structures associated with defragmenting packets. Splay trees are excellent data structures to use when you have some assurance of locality of reference for the data that you are handling but in high speed, heavily fragmented environments the nature of the splay trees worked against the system and actually hindered performance. Frag3 uses the sfxhash data structure and linked lists for data handling internally which allows it to have much more predictable and deterministic performance in any environment which should aid us in managing heavily fragmented environments. Target-based analysis is a relatively new concept in network-based intrusion detection. The idea of a target-based system is to model the actual targets on the network instead of merely modeling the protocols and looking for attacks within them. When IP stacks are written for different operating systems, they are usually implemented by people who read the RFCs and then write their interpretation of what the RFC outlines into code. Unfortunately, there are ambiguities in the way that the RFCs define some of the edge conditions that may occurr and when this happens different people implement certain aspects of their IP stacks differently. For an IDS this is a big problem. In an environment where the attacker can determine what style of IP defragmentation is being used on a particular target, the attacker can try to fragment packets such that the target will put them back together in a specific manner while any passive systems trying to model the host traffic have to guess which way the target OS is going to handle the overlaps and retransmits. As I like to say, if the attacker has more information about the targets on a network than the IDS does, it is possible to evade the IDS. This is where the idea for “target-based IDS” came from. For more detail on this issue and how it affects IDS, check out the famous Ptacek & Newsham paper at http://www.snort.org/docs/idspaper/. The basic idea behind target-based IDS is that we tell the IDS information about hosts on the network so that it can avoid Ptacek & Newsham style evasion attacks based on information about how an individual target IP stack operates. Vern Paxson and Umesh Shankar did a great paper on this very topic in 2003 that detailed mapping the hosts on a network and determining how their various IP stack implementations handled the types of problems seen in IP defragmentation and TCP stream reassembly. Check it out at http://www.icir.org/vern/papers/activemap-oak03.pdf. We can also present the IDS with topology information to avoid TTL-based evasions and a variety of other issues, but that’s a topic for another day. Once we have this information we can start to really change the game for these complex modeling problems. Frag3 was implemented to showcase and prototype a target-based module within Snort to test this idea. 28 Frag 3 Configuration Frag3 configuration is somewhat more complex than frag2. There are at least two preprocessor directives required to activate frag3, a global configuration directive and an engine instantiation. There can be an arbitrary number of engines defined at startup with their own configuration, but only one global configuration. Global Configuration • Preprocessor name: frag3 global • Available options: NOTE: Global configuration options are comma separated. – max frags - Maximum simultaneous fragments to track. Default is 8192. – memcap - Memory cap for self preservation. Default is 4MB. – prealloc frags - Alternate memory management mode. Use preallocated fragment nodes (faster in some situations). Engine Configuration • Preprocessor name: frag3 engine • Available options: NOTE: Engine configuration options are space separated. – timeout - Timeout for fragments. Fragments in the engine for longer than this period will be automatically dropped. Default is 60 seconds. – min ttl - Minimum acceptable TTL value for a fragment packet. Default is 1. – detect anomalies - Detect fragment anomalies. – bind to - IP List to bind this engine to. This engine will only run for packets with destination addresses contained within the IP List. Default value is all. – overlap limit - Limits the number of overlapping fragments per packet. The default is ”0” (unlimited), the minimum is ”0”, and the maximum is ”255”. This is an optional parameter. detect anomalies option must be configured for this option to take effect. – min fragment length - Defines smallest fragment size (payload size) that should be considered valid. Fragments smaller than or equal to this limit are considered malicious and an event is raised, if detect anomalies is also configured. The default is ”0” (unlimited), the minimum is ”0”, and the maximum is ”255”. This is an optional parameter. detect anomalies option must be configured for this option to take effect. – policy - Select a target-based defragmentation mode. Available types are first, last, bsd, bsdright, linux. Default type is bsd. The Paxson Active Mapping paper introduced the terminology frag3 is using to describe policy types. The known mappings are as follows. Anyone who develops more mappings and would like to add to this list please feel free to send us an email! 29 Platform AIX 2 AIX 4.3 8.9.3 Cisco IOS FreeBSD HP JetDirect (printer) HP-UX B.10.20 HP-UX 11.00 IRIX 4.0.5F IRIX 6.2 IRIX 6.3 IRIX64 6.4 Linux 2.2.10 Linux 2.2.14-5.0 Linux 2.2.16-3 Linux 2.2.19-6.2.10smp Linux 2.4.7-10 Linux 2.4.9-31SGI 1.0.2smp Linux 2.4 (RedHat 7.1-7.3) MacOS (version unknown) NCD Thin Clients OpenBSD (version unknown) OpenBSD (version unknown) OpenVMS 7.1 OS/2 (version unknown) OSF1 V3.0 OSF1 V3.2 OSF1 V4.0,5.0,5.1 SunOS 4.1.4 SunOS 5.5.1,5.6,5.7,5.8 Tru64 Unix V5.0A,V5.1 Vax/VMS Windows (95/98/NT4/W2K/XP) Type BSD BSD Last BSD BSD-right BSD First BSD BSD BSD BSD linux linux linux linux linux linux linux First BSD linux linux BSD BSD BSD BSD BSD BSD First BSD BSD First Format Note in the advanced configuration below that there are three engines specified running with Linux, first and last policies assigned. The first two engines are bound to specific IP address ranges and the last one applies to all other traffic. Packets that don’t fall within the address requirements of the first two engines automatically fall through to the third one. Basic Configuration preprocessor frag3_global preprocessor frag3_engine Advanced Configuration preprocessor preprocessor preprocessor preprocessor frag3_global: frag3_engine: frag3_engine: frag3_engine: prealloc_nodes 8192 policy linux, bind_to 192.168.1.0/24 policy first, bind_to [10.1.47.0/24,172.16.8.0/24] policy last, detect_anomalies 30 Frag 3 Alert Output Frag3 is capable of detecting eight different types of anomalies. Its event output is packet-based so it will work with all output modes of Snort. Read the documentation in the doc/signatures directory with filenames that begin with “123-” for information on the different event types. 2.2.2 Stream5 The Stream5 preprocessor is a target-based TCP reassembly module for Snort. It is capable of tracking sessions for both TCP and UDP. With Stream5, the rule ’flow’ and ’flowbits’ keywords are usable with TCP as well as UDP traffic. Transport Protocols TCP sessions are identified via the classic TCP ”connection”. UDP sessions are established as the result of a series of UDP packets from two end points via the same set of ports. ICMP messages are tracked for the purposes of checking for unreachable and service unavailable messages, which effectively terminate a TCP or UDP session. Target-Based Stream5, like Frag3, introduces target-based actions for handling of overlapping data and other TCP anomalies. The methods for handling overlapping data, TCP Timestamps, Data on SYN, FIN and Reset sequence numbers, etc. and the policies supported by Stream5 are the results of extensive research with many target operating systems. Stream API Stream5 fully supports the Stream API, other protocol normalizers/preprocessors to dynamically configure reassembly behavior as required by the application layer protocol, identify sessions that may be ignored (large data transfers, etc), and update the identifying information about the session (application protocol, direction, etc) that can later be used by rules. Anomaly Detection TCP protocol anomalies, such as data on SYN packets, data received outside the TCP window, etc are configured via the detect anomalies option to the TCP configuration. Some of these anomalies are detected on a per-target basis. For example, a few operating systems allow data in TCP SYN packets, while others do not. Stream5 Global Configuration Global settings for the Stream5 preprocessor. preprocessor stream5_global: \ [track_tcp ], [max_tcp ], \ [memcap ], \ [track_udp ], [max_udp ], \ [track_icmp ], [max_icmp ], \ [flush_on_alert], [show_rebuilt_packets], \ [prune_log_max ] 31 Option track tcp max tcp memcap track udp max udp track icmp max icmp flush on alert show rebuilt packets prune log max Description Track sessions for TCP. The default is ”yes”. Maximum simultaneous TCP sessions tracked. The default is ”256000”, maximum is ”1052672”, minimum is ”1”. Memcap for TCP packet storage. The default is ”8388608” (8MB), maximum is ”1073741824” (1GB), minimum is ”32768” (32KB). Track sessions for UDP. The default is ”yes”. Maximum simultaneous UDP sessions tracked. The default is ”128000”, maximum is ”1052672”, minimum is ”1”. Track sessions for ICMP. The default is ”yes”. Maximum simultaneous ICMP sessions tracked. The default is ”64000”, maximum is ”1052672”, minimum is ”1”. Backwards compatibilty. Flush a TCP stream when an alert is generated on that stream. The default is set to off. Print/display packet after rebuilt (for debugging). The default is set to off. Print a message when a session terminates that was consuming more than the specified number of bytes. The default is ”1048576” (1MB), minimum is ”0” (unlimited), maximum is not bounded, other than by the memcap. Stream5 TCP Configuration Provides a means on a per IP address target to configure TCP policy. This can have multiple occurances, per policy that is bound to an IP address or network. One default policy must be specified, and that policy is not bound to an IP address or network. preprocessor stream5_tcp: \ [bind_to ], [timeout ], \ [policy ], [min_ttl ], \ [overlap_limit ], [max_window ], \ [require_3whs [ ]], [detect_anomalies], \ [check_session_hijacking], [use_static_footprint_sizes], \ [dont_store_large_packets], [dont_reassemble_async], \ [max_queued_bytes ], [max_queued_segs ], \ [ports ], \ [ignore_any_rules] Option bind to timeout Description IP address or network for this policy. The default is set to any. Session timeout. The default is ”30”, the minimum is ”1”, and the maximum is ”86400” (approximately 1 day). 32 policy min ttl overlap limit max window require 3whs [ ] detect anomalies check session hijacking use static footprint sizes dont store large packets dont reassemble async max queued bytes The Operating System policy for the target OS. The policy id can be one of the following: Policy Name Operating Systems. first Favor first overlapped segment. last Favor first overlapped segment. bsd FresBSD 4.x and newer, NetBSD 2.x and newer, OpenBSD 3.x and newer linux Linux 2.4 and newer old-linux Linux 2.2 and earlier windows Windows 2000, Windows XP, Windows 95/98/ME win2003 Windows 2003 Server vista Windows Vista solaris Solaris 9.x and newer hpux HPUX 11 and newer hpux10 HPUX 10 irix IRIX 6 and newer macos MacOS 10.3 and newer Minimum TTL. The default is ”1”, the minimum is ”1” and the maximum is ”255”. Limits the number of overlapping packets per session. The default is ”0” (unlimited), the minimum is ”0”, and the maximum is ”255”. Maximum TCP window allowed. The default is ”0” (unlimited), the minimum is ”0”, and the maximum is ”1073725440” (65535 left shift 14). That is the highest possible TCP window per RFCs. This option is intended to prevent a DoS against Stream5 by an attacker using an abnormally large window, so using a value near the maximum is discouraged. Establish sessions only on completion of a SYN/SYN-ACK/ACK handshake. The default is set to off. The optional number of seconds specifies a startup timeout. This allows a grace period for existing sessions to be considered established during that interval immediately after Snort is started. The default is ”0” (don’t consider existing sessions established), the minimum is ”0”, and the maximum is ”86400” (approximately 1 day). Detect and alert on TCP protocol anomalies. The default is set to off. Check for TCP session hijacking. This check validates the hardware (MAC) address from both sides of the connect – as established on the 3-way handshake against subsequent packets received on the session. If an ethernet layer is not part of the protocol stack received by Snort, there are no checks performed. Alerts are generated (per ’detect anomalies’ option) for either the client or server when the MAC address for one side or the other does not match. The default is set to off. Use static values for determining when to build a reassembled packet to allow for repeatable tests. This option should not be used production environments. The default is set to off. Performance improvement to not queue large packets in reassembly buffer. The default is set to off. Using this option may result in missed attacks. Don’t queue packets for reassembly if traffic has not been seen in both directions. The default is set to queue packets. Limit the number of bytes queued for reassembly on a given TCP session to bytes. Default is ”1048576” (1MB). A value of ”0” means unlimited, with a non-zero minimum of ”1024”, and a maximum of ”1073741824” (1GB). A message is written to console/syslog when this limit is enforced. 33 max queued segs ports ignore any rules Limit the number of segments queued for reassembly on a given TCP session. The default is ”2621”, derived based on an average size of 400 bytes. A value of ”0” means unlimited, with a non-zero minimum of ”2”, and a maximum of ”1073741824” (1GB). A message is written to console/syslog when this limit is enforced. Specify the client, server, or both and list of ports in which to perform reassembly. This can appear more than once in a given config. The default settings are ports client 21 23 25 42 53 80 110 111 135 136 137 139 143 445 513 514 1433 1521 2401 3306. The minimum port allowed is ”1” and the maximum allowed is ”65535”. Don’t process any -> any (ports) rules for TCP that attempt to match payload if there are no port specific rules for the src or destination port. Rules that have flow or flowbits will never be ignored. This is a performance improvement and may result in missed attacks. Using this does not affect rules that look at protocol headers, only those with content, PCRE, or byte test options. The default is ”off”. This option can be used only in default policy. ! NOTE △ If no options are specified for a given TCP policy, that is the default TCP policy. If only a bind to option is used with no other options that TCP policy uses all of the default values. Stream5 UDP Configuration Configuration for UDP session tracking. Since there is no target based binding, there should be only one occurance of the UDP configuration. preprocessor stream5_udp: [timeout ], [ignore_any_rules] Option timeout ignore any rules Description Session timeout. The default is ”30”, the minimum is ”1”, and the maximum is ”86400” (approximately 1 day). Don’t process any -> any (ports) rules for UDP that attempt to match payload if there are no port specific rules for the src or destination port. Rules that have flow or flowbits will never be ignored. This is a performance improvement and may result in missed attacks. Using this does not affect rules that look at protocol headers, only those with content, PCRE, or byte test options. The default is ”off”. ! NOTE △ With the ignore any rules option, a UDP rule will be ignored except when there is another port specific rule that may be applied to the traffic. For example, if a UDP rule specifies destination port 53, the ’ignored’ any -> any rule will be applied to traffic to/from port 53, but NOT to any other source or destination port. A list of rule SIDs affected by this option are printed at Snort’s startup. ! NOTE △ With the ignore any rules option, if a UDP rule that uses any -> any ports includes either flow or flowbits, the ignore any rules option is effectively pointless. Because of the potential impact of disabling a flowbits rule, the ignore any rules option will be disabled in this case. 34 Stream5 ICMP Configuration Configuration for ICMP session tracking. Since there is no target based binding, there should be only one occurance of the ICMP configuration. ! NOTE △ ICMP is currently untested, in minimal code form and is NOT ready for use in production networks. It is not turned on by default. preprocessor stream5_icmp: [timeout ] Option timeout Description Session timeout. The default is ”30”, the minimum is ”1”, and the maximum is ”86400” (approximately 1 day). Example Configurations 1. This example configuration is the default configuration in snort.conf and can be used for repeatable tests of stream reassembly in readback mode. preprocessor stream5_global: \ max_tcp 8192, track_tcp yes, track_udp yes, track_icmp no preprocessor stream5_tcp: \ policy first, use_static_footprint_sizes preprocessor stream5_udp: \ ignore_any_rules 2. This configuration maps two network segments to different OS policies, one for Windows and one for Linux, with all other traffic going to the default policy of Solaris. preprocessor preprocessor preprocessor preprocessor stream5_global: track_tcp yes stream5_tcp: bind_to 192.168.1.0/24, policy windows stream5_tcp: bind_to 10.1.1.0/24, policy linux stream5_tcp: policy solaris Alerts Stream5 uses generator ID 129. It is capable of alerting on 8 (eight) anomalies, all of which relate to TCP anomalies. There are no anomalies detected relating to UDP or ICMP. The list of SIDs is as follows: 1. SYN on established session 2. Data on SYN packet 3. Data sent on stream not accepting data 4. TCP Timestamp is outside of PAWS window 5. Bad segment, overlap adjusted size less than/equal 0 6. Window size (after scaling) larger than policy allows 7. Limit on number of overlapping TCP packets reached 8. Data after Reset packet 35 2.2.3 sfPortscan The sfPortscan module, developed by Sourcefire, is designed to detect the first phase in a network attack: Reconnaissance. In the Reconnaissance phase, an attacker determines what types of network protocols or services a host supports. This is the traditional place where a portscan takes place. This phase assumes the attacking host has no prior knowledge of what protocols or services are supported by the target; otherwise, this phase would not be necessary. As the attacker has no beforehand knowledge of its intended target, most queries sent by the attacker will be negative (meaning that the service ports are closed). In the nature of legitimate network communications, negative responses from hosts are rare, and rarer still are multiple negative responses within a given amount of time. Our primary objective in detecting portscans is to detect and track these negative responses. One of the most common portscanning tools in use today is Nmap. Nmap encompasses many, if not all, of the current portscanning techniques. sfPortscan was designed to be able to detect the different types of scans Nmap can produce. sfPortscan will currently alert for the following types of Nmap scans: • TCP Portscan • UDP Portscan • IP Portscan These alerts are for one→one portscans, which are the traditional types of scans; one host scans multiple ports on another host. Most of the port queries will be negative, since most hosts have relatively few services available. sfPortscan also alerts for the following types of decoy portscans: • TCP Decoy Portscan • UDP Decoy Portscan • IP Decoy Portscan Decoy portscans are much like the Nmap portscans described above, only the attacker has a spoofed source address inter-mixed with the real scanning address. This tactic helps hide the true identity of the attacker. sfPortscan alerts for the following types of distributed portscans: • TCP Distributed Portscan • UDP Distributed Portscan • IP Distributed Portscan These are many→one portscans. Distributed portscans occur when multiple hosts query one host for open services. This is used to evade an IDS and obfuscate command and control hosts. ! NOTE △ Negative queries will be distributed among scanning hosts, so we track this type of scan through the scanned host. sfPortscan alerts for the following types of portsweeps: • TCP Portsweep • UDP Portsweep • IP Portsweep 36 • ICMP Portsweep These alerts are for one→many portsweeps. One host scans a single port on multiple hosts. This usually occurs when a new exploit comes out and the attacker is looking for a specific service. ! NOTE △ The characteristics of a portsweep scan may not result in many negative responses. For example, if an attacker portsweeps a web farm for port 80, we will most likely not see many negative responses. sfPortscan alerts on the following filtered portscans and portsweeps: • TCP Filtered Portscan • UDP Filtered Portscan • IP Filtered Portscan • TCP Filtered Decoy Portscan • UDP Filtered Decoy Portscan • IP Filtered Decoy Portscan • TCP Filtered Portsweep • UDP Filtered Portsweep • IP Filtered Portsweep • ICMP Filtered Portsweep • TCP Filtered Distributed Portscan • UDP Filtered Distributed Portscan • IP Filtered Distributed Portscan “Filtered” alerts indicate that there were no network errors (ICMP unreachables or TCP RSTs) or responses on closed ports have been suppressed. It’s also a good indicator of whether the alert is just a very active legitimate host. Active hosts, such as NATs, can trigger these alerts because they can send out many connection attempts within a very small amount of time. A filtered alert may go off before responses from the remote hosts are received. sfPortscan only generates one alert for each host pair in question during the time window (more on windows below). On TCP scan alerts, sfPortscan will also display any open ports that were scanned. On TCP sweep alerts however, sfPortscan will only track open ports after the alert has been triggered. Open port events are not individual alerts, but tags based on the orginal scan alert. sfPortscan Configuration Use of the Stream5 preprocessor is required for sfPortscan. Stream gives portscan direction in the case of connectionless protocols like ICMP and UDP. You should enable the Stream preprocessor in your snort.conf, as described in Section 2.2.2. The parameters you can use to configure the portscan module are: 1. proto Available options: • TCP 37 • UDP • IGMP • ip proto • all 2. scan type Available options: • portscan • portsweep • decoy portscan • distributed portscan • all 3. sense level Available options: • low - “Low” alerts are only generated on error packets sent from the target host, and because of the nature of error responses, this setting should see very few false postives. However, this setting will never trigger a Filtered Scan alert because of a lack of error responses. This setting is based on a static time window of 60 seconds, afterwhich this window is reset. • medium - “Medium” alerts track connection counts, and so will generate filtered scan alerts. This setting may false positive on active hosts (NATs, proxies, DNS caches, etc), so the user may need to deploy the use of Ignore directives to properly tune this directive. • high - “High” alerts continuously track hosts on a network using a time window to evaluate portscan statistics for that host. A ”High” setting will catch some slow scans because of the continuous monitoring, but is very sensitive to active hosts. This most definitely will require the user to tune sfPortscan. 4. watch ip Defines which IPs, networks, and specific ports on those hosts to watch. The list is a comma separated list of IP addresses, IP address using CIDR notation. Optionally, ports are specified after the IP address/CIDR using a space and can be either a single port or a range denoted by a dash. IPs or networks not falling into this range are ignored if this option is used. 5. ignore scanners Ignores the source of scan alerts. The parameter is the same format as that of watch ip. 6. ignore scanned Ignores the destination of scan alerts. The parameter is the same format as that of watch ip. 7. logfile This option will output portscan events to the file specified. If file does not contain a leading slash, this file will be placed in the Snort config dir. 8. include midstream This option will include sessions picked up in midstream by Stream5. This can lead to false alerts, especially under heavy load with dropped packets; which is why the option is off by default. 9. detect ack scans This option will include sessions picked up in midstream by the stream module, which is necessary to detect ACK scans. However, this can lead to false alerts, especially under heavy load with dropped packets; which is why the option is off by default. 38 Format preprocessor sfportscan: proto \ scan_type \ sense_level \ watch_ip \ ignore_scanners \ ignore_scanned \ logfile Example preprocessor flow: stats_interval 0 hash 2 preprocessor sfportscan:\ proto { all } \ scan_type { all } \ sense_level { low } sfPortscan Alert Output Unified Output In order to get all the portscan information logged with the alert, snort generates a pseudo-packet and uses the payload portion to store the additional portscan information of priority count, connection count, IP count, port count, IP range, and port range. The characteristics of the packet are: Src/Dst MAC Addr == MACDAD IP Protocol == 255 IP TTL == 0 Other than that, the packet looks like the IP portion of the packet that caused the portscan alert to be generated. This includes any IP options, etc. The payload and payload size of the packet are equal to the length of the additional portscan information that is logged. The size tends to be around 100 - 200 bytes. Open port alerts differ from the other portscan alerts, because open port alerts utilize the tagged packet output system. This means that if an output system that doesn’t print tagged packets is used, then the user won’t see open port alerts. The open port information is stored in the IP payload and contains the port that is open. The sfPortscan alert output was designed to work with unified packet logging, so it is possible to extend favorite Snort GUIs to display portscan alerts and the additional information in the IP payload using the above packet characteristics. Log File Output Log file output is displayed in the following format, and explained further below: Time: 09/08-15:07:31.603880 event_id: 2 192.168.169.3 -> 192.168.169.5 (portscan) TCP Filtered Portscan Priority Count: 0 Connection Count: 200 IP Count: 2 Scanner IP Range: 192.168.169.3:192.168.169.4 Port/Proto Count: 200 Port/Proto Range: 20:47557 If there are open ports on the target, one or more additional tagged packet(s) will be appended: Time: 09/08-15:07:31.603881 event_ref: 2 39 192.168.169.3 -> 192.168.169.5 (portscan) Open Port Open Port: 38458 1. Event id/Event ref These fields are used to link an alert with the corresponding Open Port tagged packet 2. Priority Count Priority Count keeps track of bad responses (resets, unreachables). The higher the priority count, the more bad responses have been received. 3. Connection Count Connection Count lists how many connections are active on the hosts (src or dst). This is accurate for connection-based protocols, and is more of an estimate for others. Whether or not a portscan was filtered is determined here. High connection count and low priority count would indicate filtered (no response received from target). 4. IP Count IP Count keeps track of the last IP to contact a host, and increments the count if the next IP is different. For one-to-one scans, this is a low number. For active hosts this number will be high regardless, and one-to-one scans may appear as a distributed scan. 5. Scanned/Scanner IP Range This field changes depending on the type of alert. Portsweep (one-to-many) scans display the scanned IP range; Portscans (one-to-one) display the scanner IP. 6. Port Count Port Count keeps track of the last port contacted and increments this number when that changes. We use this count (along with IP Count) to determine the difference between one-to-one portscans and one-to-one decoys. Tuning sfPortscan The most important aspect in detecting portscans is tuning the detection engine for your network(s). Here are some tuning tips: 1. Use the watch ip, ignore scanners, and ignore scanned options. It’s important to correctly set these options. The watch ip option is easy to understand. The analyst should set this option to the list of Cidr blocks and IPs that they want to watch. If no watch ip is defined, sfPortscan will watch all network traffic. The ignore scanners and ignore scanned options come into play in weeding out legitimate hosts that are very active on your network. Some of the most common examples are NAT IPs, DNS cache servers, syslog servers, and nfs servers. sfPortscan may not generate false positives for these types of hosts, but be aware when first tuning sfPortscan for these IPs. Depending on the type of alert that the host generates, the analyst will know which to ignore it as. If the host is generating portsweep events, then add it to the ignore scanners option. If the host is generating portscan alerts (and is the host that is being scanned), add it to the ignore scanned option. 2. Filtered scan alerts are much more prone to false positives. When determining false positives, the alert type is very important. Most of the false positives that sfPortscan may generate are of the filtered scan alert type. So be much more suspicious of filtered portscans. Many times this just indicates that a host was very active during the time period in question. If the host continually generates these types of alerts, add it to the ignore scanners list or use a lower sensitivity level. 3. Make use of the Priority Count, Connection Count, IP Count, Port Count, IP Range, and Port Range to determine false positives. 40 The portscan alert details are vital in determining the scope of a portscan and also the confidence of the portscan. In the future, we hope to automate much of this analysis in assigning a scope level and confidence level, but for now the user must manually do this. The easiest way to determine false positives is through simple ratio estimations. The following is a list of ratios to estimate and the associated values that indicate a legimite scan and not a false positive. Connection Count / IP Count: This ratio indicates an estimated average of connections per IP. For portscans, this ratio should be high, the higher the better. For portsweeps, this ratio should be low. Port Count / IP Count: This ratio indicates an estimated average of ports connected to per IP. For portscans, this ratio should be high and indicates that the scanned host’s ports were connected to by fewer IPs. For portsweeps, this ratio should be low, indicating that the scanning host connected to few ports but on many hosts. Connection Count / Port Count: This ratio indicates an estimated average of connections per port. For portscans, this ratio should be low. This indicates that each connection was to a different port. For portsweeps, this ratio should be high. This indicates that there were many connections to the same port. The reason that Priority Count is not included, is because the priority count is included in the connection count and the above comparisons take that into consideration. The Priority Count play an important role in tuning because the higher the priority count the more likely it is a real portscan or portsweep (unless the host is firewalled). 4. If all else fails, lower the sensitivity level. If none of these other tuning techniques work or the analyst doesn’t have the time for tuning, lower the sensitivity level. You get the best protection the higher the sensitivity level, but it’s also important that the portscan detection engine generate alerts that the analyst will find informative. The low sensitivity level only generates alerts based on error responses. These responses indicate a portscan and the alerts generated by the low sensitivity level are highly accurate and require the least tuning. The low sensitivity level does not catch filtered scans; since these are more prone to false positives. 2.2.4 RPC Decode The rpc decode preprocessor normalizes RPC multiple fragmented records into a single un-fragmented record. It does this by normalizing the packet into the packet buffer. If stream5 is enabled, it will only process client-side traffic. By default, it runs against traffic on ports 111 and 32771. Format preprocessor rpc_decode: \ [ alert_fragments ] \ [no_alert_multiple_requests] \ [no_alert_large_fragments] \ [no_alert_incomplete] Option alert fragments no alert multiple requests no alert large fragments no alert incomplete Description Alert on any fragmented RPC record. Don’t alert when there are multiple records in one packet. Don’t alert when the sum of fragmented records exceeds one packet. Don’t alert when a single fragment record exceeds the size of one packet. 2.2.5 Performance Monitor This preprocessor measures Snort’s real-time and theoretical maximum performance. Whenever this preprocessor is turned on, it should have an output mode enabled, either “console” which prints statistics to the console window or “file” with a file name, where statistics get printed to the specified file name. By default, Snort’s real-time statistics are processed. This includes: 41 • Time Stamp • Drop Rate • Mbits/Sec (wire) [duplicated below for easy comparison with other rates] • Alerts/Sec • K-Pkts/Sec (wire) [duplicated below for easy comparison with other rates] • Avg Bytes/Pkt (wire) [duplicated below for easy comparison with other rates] • Pat-Matched [percent of data received that Snort processes in pattern matching] • Syns/Sec • SynAcks/Sec • New Sessions Cached/Sec • Sessions Del fr Cache/Sec • Current Cached Sessions • Max Cached Sessions • Stream Flushes/Sec • Stream Session Cache Faults • Stream Session Cache Timeouts • New Frag Trackers/Sec • Frag-Completes/Sec • Frag-Inserts/Sec • Frag-Deletes/Sec • Frag-Auto Deletes/Sec [memory DoS protection] • Frag-Flushes/Sec • Frag-Current [number of current Frag Trackers] • Frag-Max [max number of Frag Trackers at any time] • Frag-Timeouts • Frag-Faults • Number of CPUs [*** Only if compiled with LINUX SMP ***, the next three appear for each CPU] • CPU usage (user) • CPU usage (sys) • CPU usage (Idle) • Mbits/Sec (wire) [average mbits of total traffic] • Mbits/Sec (ipfrag) [average mbits of IP fragmented traffic] • Mbits/Sec (ipreass) [average mbits Snort injects after IP reassembly] • Mbits/Sec (tcprebuilt) [average mbits Snort injects after TCP reassembly] • Mbits/Sec (applayer) [average mbits seen by rules and protocol decoders] 42 • Avg Bytes/Pkt (wire) • Avg Bytes/Pkt (ipfrag) • Avg Bytes/Pkt (ipreass) • Avg Bytes/Pkt (tcprebuilt) • Avg Bytes/Pkt (applayer) • K-Pkts/Sec (wire) • K-Pkts/Sec (ipfrag) • K-Pkts/Sec (ipreass) • K-Pkts/Sec (tcprebuilt) • K-Pkts/Sec (applayer) • Total Packets Received • Total Packets Dropped (not processed) • Total Packets Blocked (inline) • Percentage of Packets Dropped • Total Filtered TCP Packets • Total Filtered UDP Packets • Midstream TCP Sessions/Sec • Closed TCP Sessions/Sec • Pruned TCP Sessions/Sec • TimedOut TCP Sessions/Sec • Dropped Async TCP Sessions/Sec • TCP Sessions Initializing • TCP Sessions Established • TCP Sessions Closing • Max TCP Sessions (interval) • New Cached UDP Sessions/Sec • Cached UDP Ssns Del/Sec • Current Cached UDP Sessions • Max Cached UDP Sessions • Current Attribute Table Hosts (Target Based) • Attribute Table Reloads (Target Based) • Mbits/Sec (Snort) • Mbits/Sec (sniffing) • Mbits/Sec (combined) • uSeconds/Pkt (Snort) 43 • uSeconds/Pkt (sniffing) • uSeconds/Pkt (combined) • KPkts/Sec (Snort) • KPkts/Sec (sniffing) • KPkts/Sec (combined) The following options can be used with the performance monitor: • flow - Prints out statistics about the type of traffic and protocol distributions that Snort is seeing. This option can produce large amounts of output. • events - Turns on event reporting. This prints out statistics as to the number of signatures that were matched by the setwise pattern matcher (non-qualified events) and the number of those matches that were verified with the signature flags (qualified events). This shows the user if there is a problem with the rule set that they are running. • max - Turns on the theoretical maximum performance that Snort calculates given the processor speed and current performance. This is only valid for uniprocessor machines, since many operating systems don’t keep accurate kernel statistics for multiple CPUs. • console - Prints statistics at the console. • file - Prints statistics in a comma-delimited format to the file that is specified. Not all statistics are output to this file. You may also use snortfile which will output into your defined Snort log directory. Both of these directives can be overridden on the command line with the -Z or --perfmon-file options. • pktcnt - Adjusts the number of packets to process before checking for the time sample. This boosts performance, since checking the time sample reduces Snort’s performance. By default, this is 10000. • time - Represents the number of seconds between intervals. • accumulate or reset - Defines which type of drop statistics are kept by the operating system. By default, reset is used. • atexitonly - Dump stats for entire life of Snort. • max file size - Defines the maximum size of the comma-delimited file. Before the file exceeds this size, it will be rolled into a new date stamped file of the format YYYY-MM-DD, followed by YYYY-MM-DD.x, where x will be incremented each time the comma delimiated file is rolled over. The minimum is 4096 bytes and the maximum is 2147483648 bytes (2GB). The default is the same as the maximum. Examples preprocessor perfmonitor: \ time 30 events flow file stats.profile max console pktcnt 10000 preprocessor perfmonitor: \ time 300 file /var/tmp/snortstat pktcnt 10000 2.2.6 HTTP Inspect HTTP Inspect is a generic HTTP decoder for user applications. Given a data buffer, HTTP Inspect will decode the buffer, find HTTP fields, and normalize the fields. HTTP Inspect works on both client requests and server responses. The current version of HTTP Inspect only handles stateless processing. This means that HTTP Inspect looks for HTTP fields on a packet-by-packet basis, and will be fooled if packets are not reassembled. This works fine when there is 44 another module handling the reassembly, but there are limitations in analyzing the protocol. Future versions will have a stateful processing mode which will hook into various reassembly modules. HTTP Inspect has a very “rich” user configuration. Users can configure individual HTTP servers with a variety of options, which should allow the user to emulate any type of web server. Within HTTP Inspect, there are two areas of configuration: global and server. Global Configuration The global configuration deals with configuration options that determine the global functioning of HTTP Inspect. The following example gives the generic global configuration format: Format preprocessor http_inspect: \ global \ iis_unicode_map \ codemap \ [detect_anomalous_servers] \ [proxy_alert] You can only have a single global configuration, you’ll get an error if you try otherwise. Configuration 1. iis unicode map