The quiter you become,the more you are able to hear!

suricata 规则之 Meta Keywords

Author: geneblue

Blog: https://geneblue.github.io/

Meta Keywords 可以理解为是 suricata 的基本关键字,不与任何协议绑定,在任何规则中都可以使用

Meta Keywords

msg(message)

msg 关键字用来记录当规则匹配到时,对数据包的文本描述信息,然后记录在日志中

比如:

1
msg: "ATTACK-RESPONSES 403 Forbidden";

注意,按照惯例,msg 消息都是以大写字母开头,这样在日志记录中,从视觉上比较容易识别;msg 一般是规则的第一个关键字

sid(signature ID)

sid 签名标识符,数值类型,为每个规则定义一个 id 号,不能重复  比如:

1
sid: 123;
一般,sid位于最后关键字(如果有 rev 关键字,则位于倒数第二个),这也是为了书写上的规范吧

rev (revision)

用于表示规则的版本号

比如:

1
rev:123;

gid(group ID)

gid 关键字不是很常用,默认是 1

classtype

classtype 指定该规则触发时,属于哪种报警分类信息,当前的攻击属于什么威胁。具体的警报分类查看文件 /etc/suricata/classification.config,比如:

1
2
3
config classification: rpc-portmap-decode,Decode of an RPC Query,2
config classification: shellcode-detect,Executable code was detected,1
config classification: string-detect,A suspicious string was detected,3

每一条报警分类信息,包含 短名,具体描述和警报优先级,严重事件优先级为1,在规则中,指定短名即可:

1
classtype:rpc-portmap-decode;

我们也可以在 classification.config 中增加自己的警报信息。

reference

reference 引用,给出规则触发时的额外参考信息,参考信息一般是 url,方便起见,也可以给一个 cve 号,suricata 会自动生成该 cve 在 mitre 站点的 cve 链接。

形式:

1
reference: type, reference

比如:

1
2
reference: url, www.info.com;
reference: cve, CVE-2014-1234;

/etc/suricata/reference.config 中记录了各种 type

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ cat /etc/suricata/reference.config
# config reference: system URL

config reference: bugtraq http://www.securityfocus.com/bid/
config reference: bid http://www.securityfocus.com/bid/
config reference: cve http://cve.mitre.org/cgi-bin/cvename.cgi?name=
#config reference: cve http://cvedetails.com/cve/
config reference: secunia http://www.secunia.com/advisories/

#whitehats is unfortunately gone
config reference: arachNIDS http://www.whitehats.com/info/IDS

config reference: McAfee http://vil.nai.com/vil/content/v_
config reference: nessus http://cgi.nessus.org/plugins/dump.php3?id=
config reference: url http://
config reference: et http://doc.emergingthreats.net/
config reference: etpro http://doc.emergingthreatspro.com/
config reference: telus http://
config reference: osvdb http://osvdb.org/show/osvdb/
config reference: threatexpert http://www.threatexpert.com/report.aspx?md5=
config reference: md5 http://www.threatexpert.com/report.aspx?md5=
config reference: exploitdb http://www.exploit-db.com/exploits/
config reference: openpacket https://www.openpacket.org/capture/grab/
config reference: securitytracker http://securitytracker.com/id?
config reference: secunia http://secunia.com/advisories/
config reference: xforce http://xforce.iss.net/xforce/xfdb/
config reference: msft http://technet.microsoft.com/security/bulletin/

priority

priority 优先级关键字是个数字,范围 1 到 255,1 到 4 使用比较频繁,1 为最高优先级,注意如果特意把该规则的 priority 设置为 1,则会覆盖 classtype 中的低优先级

1
priority:1;

metadata

记录非功能信息

target

target 关键字指定警报的哪一侧是攻击的目标。

参考