Project

General

Profile

Writing Definitions » History » Version 4

Luke Murphey, 04/02/2010 07:53 PM

1 4 Luke Murphey
h1. Definitions
2 1 Luke Murphey
3 1 Luke Murphey
h2. Definition Types
4 1 Luke Murphey
5 1 Luke Murphey
NSIA supports two types of definitions:
6 1 Luke Murphey
7 1 Luke Murphey
 * ThreatPattern
8 1 Luke Murphey
 * ThreatScript
9 2 Luke Murphey
10 3 Luke Murphey
|*ThreatScript*                                                       |*ThreatPattern*|
11 2 Luke Murphey
|Written in ECMAScript / JavaScript                                   |Written in a format similar to Snort|
12 2 Luke Murphey
|Somewhat complex to create                                           |Simple and easy to create|
13 4 Luke Murphey
|Can auto-baseline tune itself                                        |Must be ignored completely when it triggers as a false positive|
14 2 Luke Murphey
|Is stateful (remember things from previous scans)                    |Is stateless (cannot remember things from previous scans)|
15 2 Luke Murphey
|Are slower than ThreatSignatures                                     |Are faster than ThreatScripts|
16 1 Luke Murphey
|Very flexible detection logic; can be used to detect nearly anything |Functionality limited to what regular expressions|
17 2 Luke Murphey
18 4 Luke Murphey
h2. Definition IDs
19 1 Luke Murphey
20 2 Luke Murphey
Custom definitions must have an ID of 1000000 or more; only official definitions can have IDs of less than 1000000.
21 1 Luke Murphey
22 4 Luke Murphey
h2. Identifying Definition Errors
23 1 Luke Murphey
24 1 Luke Murphey
NSIA will parse definitions before they are saved in order to identify syntax and some semantic errors. Errors that are discovered during runtime are noted on the definition errors page (e.g. http://127.0.0.1:8080/Definitions/Errors) and in the event logs (e.g. http://127.0.0.1:8080/System/Eventlog).
25 1 Luke Murphey
26 4 Luke Murphey
Note that ThreatScript definitions will be flagged as having an error if they fail to complete within 10 seconds (see ScriptDefinition.MAX_SCRIPT_RUNTIME).
27 1 Luke Murphey
28 4 Luke Murphey
h2. Creating a ThreatPattern
29 1 Luke Murphey
30 4 Luke Murphey
<pre>
31 4 Luke Murphey
Alert("Abuse.DataHiding.Rar_File_In_Jpeg"){
32 4 Luke Murphey
        Message="A JPEG file with a RAR file appended was observed";
33 4 Luke Murphey
        Severity="Low";
34 4 Luke Murphey
        ID=194;
35 4 Luke Murphey
        Version=1;
36 4 Luke Murphey
        BasicEncoding;
37 4 Luke Murphey
        Byte="FF D9";
38 4 Luke Murphey
        String="Rar!"; Offset=0;
39 4 Luke Murphey
        ContentType="image/jpeg";
40 4 Luke Murphey
        Reference=url,lifehacker.com/software/encryption/hide-files-in-jpeg-images-207905.php;
41 4 Luke Murphey
        Reference=url,schmidt.devlib.org/file-formats/rar-archive-file-format.html;
42 4 Luke Murphey
}
43 4 Luke Murphey
</pre>
44 2 Luke Murphey
45 4 Luke Murphey
|*Verb*|*Operation*                                                |*Notes*|
46 4 Luke Murphey
|Eval  |Causes the rule to be evaluated but no action taken.       |Only valid when an Set option is used. Used to set a flag that may be used in another signature (allows the rules to maintain state).|
47 4 Luke Murphey
|Alert |Causes the rule to indicate that a match has been found.   |Used only to determine if the site may be compromised.|
48 4 Luke Murphey
|Block |Causes the resource to be blocked (end user cannot access) |Useful when using a proxy to control access to the servers.|
49 2 Luke Murphey
50 2 Luke Murphey
51 2 Luke Murphey
52 4 Luke Murphey
h2. Creating a ThreatScript