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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
#FULLNAME: Netfilter
#VERSION: 1.0
#DESCRIPTION: Netfilter offers various functions and operations for packet filtering, network address translation, and port translation.
#Packet Matching with improved pattern research
#
#Owing to a specific way of writing iptables rules, you can improve
#the pattern matching of prelude-lml in your logs by specifying few things
#like : was the packet dropped or accepted ?
#
#In order to benefit from this improvement, you have to pay attention
#for netfilter rules that you will create.
#If you want to log packet using the LOG target with iptables,
#just respect this proposition
#(that you can change if you master all of that) :
#
#If you use a LOG target for a packet that you Accept
#then add a prefix containing the word "Accept" to your rules:
# -j LOG --log-prefix "Accept "
#
#If you use a LOG target for a packet that you Drop
#then add a prefix containing the word "Drop" to your rules:
# -j LOG --log-prefix "Drop "
#####
#
# Copyright (C) 2005-2020 CS GROUP - France <support.prelude@csgroup.eu>
# Author: Yoann Vandoorselaere <yoann.v@prelude-siem.com>
# All Rights Reserved.
#
# Based on original implementation from Laurent Oudot, John Green <j.green@ukerna.ac.uk>
#
# This file is part of the Prelude-LML program.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#####
#DESCRIPTION:Netfilter dropped a packet
#CATEGORY:Packet Filtering
#LOG:Oct 16 11:16:51 blah kernel: Drop IN=eth0 OUT= MAC=00:00:00:00:00:00:00:00:00:00:00:00:00:00 SRC=1.1.1.1 DST=2.2.2.2 LEN=48 TOS=0x00 PREC=0x00 TTL=113 ID=12776 DF PROTO=TCP SPT=3979 DPT=139 WINDOW=65535 RES=0x00 SYN URGP=0
regex=[Dd][Rr][Oo][Pp].*PROTO=(UDP|TCP|ICMP|AH|ESP); \
id=1310; \
classification.text = $1 packet dropped; \
assessment.impact.completion = failed; \
assessment.impact.type = other; \
assessment.impact.severity = medium; \
chained; silent
#DESCRIPTION:Netfilter accepted a packet
#CATEGORY:Packet Filtering
#LOG:Oct 16 11:16:51 blah kernel: Drop IN=eth0 OUT= MAC=00:00:00:00:00:00:00:00:00:00:00:00:00:00 SRC=1.1.1.1 DST=2.2.2.2 LEN=48 TOS=0x00 PREC=0x00 TTL=113 ID=12776 DF PROTO=TCP SPT=3979 DPT=139 WINDOW=65535 RES=0x00 SYN URGP=0
regex=[Aa][Cc][Cc][Ee][Pp][Tt].*PROTO=(UDP|TCP|ICMP|AH|ESP); \
id=1311; \
classification.text = $1 packet accepted; \
assessment.impact.completion = succeeded; \
assessment.impact.type = other; \
assessment.impact.severity = low; \
chained; silent
#DESCRIPTION:Netfilter matched a TCP packet
#CATEGORY:Packet Filtering
#LOG:Oct 16 11:16:51 blah kernel: Drop IN=eth0 OUT= MAC=00:00:00:00:00:00:00:00:00:00:00:00:00:00 SRC=1.1.1.1 DST=2.2.2.2 LEN=48 TOS=0x00 PREC=0x00 TTL=113 ID=12776 DF PROTO=TCP SPT=3979 DPT=139 WINDOW=65535 RES=0x00 SYN URGP=0
#LOG:Oct 16 11:16:51 blah kernel: Drop IN=eth0 OUT= MAC=00:00:00:00:00:00:00:00:00:00:00:00:00:00 SRC=1.1.1.1 DST=2.2.2.2 LEN=48 TOS=0x00 PREC=0x00 TTL=113 ID=12776 DF PROTO=TCP SPT=3979 DPT=139 WINDOW=65535 SYN URGP=0
#LOG:Oct 16 11:16:51 blah kernel: IN=eth0 OUT= MAC=00:00:00:00:00:00:00:00:00:00:00:00:00:00 SRC=1.1.1.1 DST=2.2.2.2 LEN=48 TOS=0x00 PREC=0x00 TTL=113 ID=12776 DF PROTO=TCP SPT=3979 DPT=139 WINDOW=65535 RES=0x00 SYN URGP=0
optgoto=1310-1311; \
regex=IN=(\w*) OUT=(\w*)( MAC=)?([\w:]+)?\s+SRC=([\d\.]+) DST=([\d\.]+) LEN=(\d+) TOS=(\w+) PREC=(\w+) TTL=(\d+) ID=(\d+) (CE )?(DF )?(MF )?(FRAG:\d+ )?(OPT \(\w+\) )?PROTO=TCP (INCOMPLETE \[\d+ bytes\] )?SPT=(\d+) DPT=(\d+) (SEQ=\d+ ACK=\d+ )?WINDOW=(\d+) (RES=(\w+) )?(CWR )?(ECE )?(URG )?(ACK )?(PSH )?(RST )?(SYN )?(FIN )?URGP=(\d+); \
classification.text=TCP packet matched; \
id=1300; \
revision=1; \
analyzer(0).name=netfilter; \
analyzer(0).manufacturer=www.netfilter.org; \
analyzer(0).class=Firewall; \
assessment.impact.type=other; \
assessment.impact.description=Netfilter matched a TCP packet $5:$18 -> $6:$19 [$26 $27 $28 $29 $30 $31] on interface $1$2 [ TTL=$10 ]; \
source(0).node.address(0).category=ipv4-addr; \
source(0).node.address(0).address=$5; \
source(0).service.port=$18; \
source(0).service.iana_protocol_name=TCP; \
source(0).service.iana_protocol_number=6; \
target(0).interface=$1; \
target(0).node.address(0).category=ipv4-addr; \
target(0).node.address(0).address=$6; \
target(0).service.port=$19; \
target(0).service.iana_protocol_name=TCP; \
target(0).service.iana_protocol_number=6; \
last
#DESCRIPTION:Netfilter matched an UDP packet
#CATEGORY:Packet Filtering
#LOG:Oct 16 07:53:44 blah kernel: Drop IN=eth0 OUT= MAC=00:00:00:00:00:00:00:00:00:00:00:00:00:00 SRC=1.1.1.1 DST=2.2.2.2 LEN=78 TOS=0x00 PREC=0x00 TTL=128 ID=59110 PROTO=UDP SPT=137 DPT=137 LEN=58
#LOG:Oct 16 07:53:44 blah kernel: IN=eth0 OUT= MAC=00:00:00:00:00:00:00:00:00:00:00:00:00:00 SRC=1.1.1.1 DST=2.2.2.2 LEN=78 TOS=0x00 PREC=0x00 TTL=128 ID=59110 PROTO=UDP SPT=137 DPT=137 LEN=58
optgoto=1310-1311; \
regex=IN=(\w*) OUT=(\w*)( MAC=)?([\w:]+)?\s+SRC=([\d\.]+) DST=([\d\.]+) LEN=(\d+) TOS=(\w+) PREC=(\w+) TTL=(\d+) ID=(\d+) (CE )?(DF )?(MF )?(FRAG:\d+ )?(OPT \(\w+\) )?PROTO=UDP (INCOMPLETE \[\d+ bytes\] )?SPT=(\d+) DPT=(\d+) LEN=(\d+); \
classification.text=UDP packet matched; \
id=1301; \
revision=1; \
analyzer(0).name=netfilter; \
analyzer(0).manufacturer=www.netfilter.org; \
analyzer(0).class=Firewall; \
assessment.impact.type=other; \
assessment.impact.description=Netfilter matched an UDP packet $5:$18 -> $6:$19 on interface $1$2 [TTL=$10]; \
source(0).node.address(0).category=ipv4-addr; \
source(0).node.address(0).address=$5; \
source(0).service.port=$18; \
source(0).service.iana_protocol_name=UDP; \
source(0).service.iana_protocol_number=17; \
target(0).interface=$1; \
target(0).node.address(0).category=ipv4-addr; \
target(0).node.address(0).address=$6; \
target(0).service.port=$19; \
target(0).service.iana_protocol_name=UDP; \
target(0).service.iana_protocol_number=17; \
last
#DESCRIPTION:Netfilter matched an ICMP packet
#CATEGORY:Packet Filtering
#LOG:Oct 20 23:59:41 blah kernel: Drop IN=eth0 OUT= MAC=00:00:00:00:00:00:00:00:00:00:00:00:00:00 SRC=1.1.1.1 DST=2.2.2.2 LEN=84 TOS=0x00 PREC=0x00 TTL=58 ID=9 DF PROTO=ICMP TYPE=8 CODE=0 ID=51318 SEQ=10
#LOG:Oct 20 23:59:41 blah kernel: IN=eth0 OUT= MAC=00:00:00:00:00:00:00:00:00:00:00:00:00:00 SRC=1.1.1.1 DST=2.2.2.2 LEN=84 TOS=0x00 PREC=0x00 TTL=58 ID=9 DF PROTO=ICMP TYPE=8 CODE=0 ID=51318 SEQ=10
optgoto=1310-1311; \
regex=IN=(\w*) OUT=(\w*)( MAC=)?([\w:]+)?\s+SRC=([\d\.]+) DST=([\d\.]+) LEN=(\d+) TOS=(\w+) PREC=(\w+) TTL=(\d+) ID=(\d+) (CE )?(DF )?(MF )?(FRAG:\d+ )?(OPT \(\w+\) )?PROTO=ICMP (INCOMPLETE \[\d+ bytes\] )?TYPE=(\d+) CODE=(\d+) (INCOMPLETE \[\d+ bytes\] )?(ID=\d+ SEQ=\d+ )?(PARAMETER=\d+ )?(GATEWAY=[\d\.]+ )?(\[\w+\])?(MTU=\d+ )?; \
classification.text=ICMP packet matched; \
id=1302; \
revision=1; \
analyzer(0).name=netfilter; \
analyzer(0).manufacturer=www.netfilter.org; \
analyzer(0).class=Firewall; \
assessment.impact.type=other; \
assessment.impact.description=Netfilter matched an ICMP packet $5 -> $6 type=$18 code=$19 on interface $1$2 [TTL=$10]; \
source(0).node.address(0).category=ipv4-addr; \
source(0).node.address(0).address=$5; \
source(0).service.iana_protocol_name=ICMP; \
source(0).service.iana_protocol_number=1; \
target(0).interface=$1; \
target(0).node.address(0).category=ipv4-addr; \
target(0).node.address(0).address=$6; \
target(0).service.iana_protocol_name=ICMP; \
target(0).service.iana_protocol_number=1; \
last
#DESCRIPTION:Netfilter matched a packet
#CATEGORY:Packet Filtering
#LOG:Oct 20 17:13:25 blah kernel: Drop IN=ppp0 OUT= MAC= SRC=1.1.1.1 DST=2.2.2.2 LEN=128 TOS=0x00 PREC=0x00 TTL=234 ID=15586 PROTO=ESP SPI=0xa7d839
#LOG:Oct 20 17:13:25 blah kernel: IN=ppp0 OUT= MAC= SRC=1.1.1.1 DST=2.2.2.2 LEN=128 TOS=0x00 PREC=0x00 TTL=234 ID=15586 PROTO=ESP SPI=0xa7d839
optgoto=1310-1311; \
regex=IN=(\w*) OUT=(\w*)( MAC=)?([\w:]+)?\s+SRC=([\d\.]+) DST=([\d\.]+) LEN=(\d+) TOS=(\w+) PREC=(\w+) TTL=(\d+) ID=(\d+) (CE )?(DF )?(MF )?(FRAG:\d+ )?(OPT \(\w+\) )?PROTO=(AH|ESP) (INCOMPLETE \[\d+ bytes\] )?SPI=(\w+); \
classification.text=$17 packet matched; \
id=1303; \
revision=1; \
analyzer(0).name=netfilter; \
analyzer(0).manufacturer=www.netfilter.org; \
analyzer(0).class=Firewall; \
assessment.impact.completion=failed; \
assessment.impact.type=other; \
assessment.impact.description=Netfilter matched $17 packet $5 -> $6 SPI=$19 on interface $1$2 [TTL=$10]; \
source(0).node.address(0).category=ipv4-addr; \
source(0).node.address(0).address=$5; \
source(0).service.iana_protocol_name=$17; \
target(0).interface=$1; \
target(0).node.address(0).category=ipv4-addr; \
target(0).node.address(0).address=$6; \
target(0).service.iana_protocol_name=$17; \
last
#DESCRIPTION:Netfilter matched a packet
#CATEGORY:Packet Filtering
#LOG:Oct 29 13:10:04 localhost kernel: [71575.889092] dropped by firewall (OUTPUT)IN= OUT=eth0 SRC=1.1.1.1 DST=2.2.2.2 LEN=116 TOS=0x00 PREC=0x00 TTL=255 ID=7628 DF PROTO=41
optgoto=1310-1311; \
regex=IN=(\w*) OUT=(\w*)( MAC=)?([\w:]+)?\s+SRC=([\d\.]+) DST=([\d\.]+) LEN=(\d+) TOS=(\w+) PREC=(\w+) TTL=(\d+) ID=(\d+) (CE )?(DF )?(MF )?(FRAG:\d+ )?(OPT \(\w+\) )?PROTO=(\d+); \
classification.text=$17 packet matched; \
id=1304; \
revision=1; \
analyzer(0).name=netfilter; \
analyzer(0).manufacturer=www.netfilter.org; \
analyzer(0).class=Firewall; \
assessment.impact.completion=failed; \
assessment.impact.type=other; \
assessment.impact.severity=medium; \
assessment.impact.description=Netfilter matched packet with protocol $17 : $5 -> $6 on interface $1$2 [TTL=$10]; \
source(0).node.address(0).category=ipv4-addr; \
source(0).node.address(0).address=$5; \
source(0).service.iana_protocol_name=$17; \
target(0).interface=$1; \
target(0).node.address(0).category=ipv4-addr; \
target(0).node.address(0).address=$6; \
target(0).service.iana_protocol_name=$17; \
last
|