Erinevus lehekülje "Itx8071-task2" redaktsioonide vahel

Allikas: Kursused
Mine navigeerimisribale Mine otsikasti
 
(ei näidata sama kasutaja 144 vahepealset redaktsiooni)
1. rida: 1. rida:
 
This homework assignment requires the knowledge from Modules 6 and 7.  
 
This homework assignment requires the knowledge from Modules 6 and 7.  
  
−
Create SEC rules that accomplish the following event correlation task:
+
=== Create SEC rules that accomplish the following event correlation task: ===
  
−
1) The rules must process netfilter firewall syslog events about blocked packets.
+
The rules must process netfilter firewall syslog events about blocked packets sent to local TCP and UDP ports. For example, the following two events represent accesses to local ports 23/tcp and 25/tcp which were blocked by the local firewall:
−
For example, the following two events represent two packets from host 192.168.1.67
 
−
which were blocked by the local firewall:
 
  
−
  Oct 25 01:13:02 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC='''192.168.1.67''' DST=192.168.1.107  
+
  Oct 25 01:13:02 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=192.168.1.67 DST=192.168.1.107 LEN=60 TOS=0x10 PREC=0x00 TTL=64 ID=20049 DF PROTO=TCP SPT=44963 DPT=23 WINDOW=49640 RES=0x00 SYN URGP=0  
−
  LEN=60 TOS=0x10 PREC=0x00 TTL=64 ID=20049 DF PROTO=TCP SPT=44963 DPT=23 WINDOW=49640 RES=0x00 SYN URGP=0  
+
  Oct 25 01:13:08 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=192.168.1.104 DST=192.168.1.107 LEN=60 TOS=0x10 PREC=0x00 TTL=64 ID=36362 DF PROTO=TCP SPT=56918 DPT=25 WINDOW=29200 RES=0x00 SYN URGP=0
−
  Oct 25 01:13:08 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=192.168.1.67 DST=192.168.1.107  
 
−
  LEN=60 TOS=0x10 PREC=0x00 TTL=64 ID=36362 DF PROTO=TCP SPT=56918 DPT=25 WINDOW=29200 RES=0x00 SYN URGP=0  
 
  
−
The rules must also process Apache web server syslog events with status codes
+
'''Subtask1''': if some port has been probed repeatedly during 15 minutes, so that time between two successive probes does not exceed 30 seconds, memorize that port
−
401 (Unauthorized), 403 (Forbidden), 404 (Not Found), and 405 (Method Not Allowed).
+
for the following 1 hour as a "noisy port". Note that ports should be distinguished not only by port number but also by transport protocol (in other words, ports 53/tcp and 53/udp must be considered different ports).
−
For example, the following event represents GET request from client 192.168.1.101 to
 
−
URL /banner.png that was not found (status code is 404):
 
  
−
Nov  6 19:05:37 localhost apache: 192.168.1.101 - - [06/Nov/2016:19:05:37 +0200] "GET /banner.png HTTP/1.1" 404 208 "-"
+
For example, if at 18:30:06 the local netfilter firewall starts to log events about blocked access attempts to port 21/tcp, and such events continue to appear once in 3-4 seconds until 18:45:06, then the port 21/tcp should be memorized as a noisy port for 1 hour. For that purpose, the context NOISY_PORT_TCP_21 with the lifetime of 3600 seconds should be created. On the other hand, if the following 5 events are seen in 15 minutes, the port 21/tcp must not be considered noisy, since the fourth and fifth event are separated by more than 30 seconds.
−
  "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36"
 
  
−
2) if netfilter firewall blocked packet events and/or Apache events with 401 status codes
+
Oct 25 18:30:06 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=1881 DF PROTO=TCP SPT=16333 DPT=21 WINDOW=5840 RES=0x00 SYN URGP=0
−
have been seen from the same host repeatedly during 5 minutes, so that time between two
+
Oct 25 18:30:27 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.2 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=23421 DF PROTO=TCP SPT=34342 DPT=21 WINDOW=29200 RES=0x00 SYN URGP=0
−
successive events does not exceed 60 seconds, memorize that host for the following 1 hour
+
Oct 25 18:30:52 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.29 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=31442 DF PROTO=TCP SPT=47846 DPT=21 WINDOW=49640 RES=0x00 SYN URGP=0
−
as suspicious host (the time between the last event and the end of the 5-minute window
+
Oct 25 18:31:04 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.93 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=17209 DF PROTO=TCP SPT=11652 DPT=21 WINDOW=7290 RES=0x00 SYN URGP=0
−
must also not exceed 60 seconds).
+
Oct 25 18:44:46 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.84 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=7439 DF PROTO=TCP SPT=31959 DPT=21 WINDOW=6280 RES=0x00 SYN URGP=0
  
−
For example, if the following events appear for host 10.1.1.7, this host should be
+
'''Subtask2''': if some host probes 5 different ports within 60 seconds, so that none of the probed ports has been memorized as noisy within the last 1 hour, send an e-mail about the offending host to root@localhost. Note that ports should be distinguished not only by port number but also by transport protocol (in other words, ports 53/tcp and 53/udp must be considered different ports).
−
memorized as suspicious, since in 5-minute window from 12:30:06 to 12:35:06 six events
 
−
have been seen which are separated from each other by no more than 60 seconds
 
−
(time gaps between events are 59, 55, 52, 58, and 51 seconds, while the gap between
 
−
the last event and the end of the 5-minute window is 25 seconds).
 
  
−
Nov 15 12:30:06 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59
+
In addition, the detection should be done with a sliding window approach -- if the counting operation for some host has not seen enough events during 60 seconds, the 60 second detection window should be moved forward.
−
  LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=1881 DF PROTO=TCP SPT=16333 DPT=21 WINDOW=5840 RES=0x00 SYN URGP=0
 
−
Nov 15 12:31:05 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59
 
−
  LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=23421 DF PROTO=TCP SPT=34342 DPT=23 WINDOW=29200 RES=0x00 SYN URGP=0
 
−
Nov 15 12:32:00 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59
 
−
  LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=31442 DF PROTO=TCP SPT=47846 DPT=25 WINDOW=49640 RES=0x00 SYN URGP=0
 
−
Nov 15 12:32:52 localhost apache: 10.1.1.7 - - [15/Nov/2017:12:32:52 +0200] "GET / HTTP/1.1" 401 489
 
−
Nov 15 12:33:50 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59
 
−
  LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=17209 DF PROTO=TCP SPT=11652 DPT=143 WINDOW=7290 RES=0x00 SYN URGP=0
 
−
Nov 15 12:34:41 localhost apache: 10.1.1.7 - - [15/Nov/2017:12:34:41 +0200] "GET / HTTP/1.1" 401 489
 
  
−
3) if some host has been previously memorized as suspicious, and 3 Apache events with
+
After an e-mail alert has been issued about the host, disable further alerts for this host for 4 hours.
−
status codes 403, 404 and/or 405 are observed from this host within 60 seconds, so that
 
−
HTTP method is different for all events, send an e-mail about the offending host to
 
−
root@localhost.  
 
  
−
Note that the detection should be done with a sliding window approach --
+
For example, suppose the following events are observed and the port 21/tcp has been previously memorized as noisy (that is, the context NOISY_PORT_TCP_21 exists):
−
if the counting operation for some host has not seen enough events
 
−
during 60 seconds, the 60 second detection window should be moved forward.
 
  
−
After an e-mail alert has been issued about the host, disable further alerts
+
Oct 25 18:51:01 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=1881 DF PROTO=TCP SPT=16333 DPT=25 WINDOW=5840 RES=0x00 SYN URGP=0
−
for this host for 3 hours.
+
Oct 25 18:51:07 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC='''10.1.1.7''' DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=23421 DF PROTO='''TCP''' SPT=34342 DPT='''80''' WINDOW=29200 RES=0x00 SYN URGP=0
 +
Oct 25 18:51:08 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC='''10.1.1.7''' DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=23421 DF PROTO='''TCP''' SPT=34342 DPT='''80''' WINDOW=29200 RES=0x00 SYN URGP=0
 +
Oct 25 18:51:12 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=31442 DF PROTO=TCP SPT=47846 DPT=21 WINDOW=49640 RES=0x00 SYN URGP=0
 +
Oct 25 18:51:14 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.93 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=17209 DF PROTO=TCP SPT=11652 DPT=23 WINDOW=7290 RES=0x00 SYN URGP=0
 +
Oct 25 18:51:52 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC='''10.1.1.7''' DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=31442 DF PROTO='''TCP''' SPT=47846 DPT='''445''' WINDOW=49640 RES=0x00 SYN URGP=0
 +
Oct 25 18:52:02 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC='''10.1.1.7''' DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=7439 DF PROTO='''TCP''' SPT=31959 DPT='''6000''' WINDOW=6280 RES=0x00 SYN URGP=0
 +
Oct 25 18:52:03 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC='''10.1.1.7''' DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=7439 DF PROTO='''TCP''' SPT=31959 DPT='''6001''' WINDOW=6280 RES=0x00 SYN URGP=0
 +
Oct 25 18:52:05 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC='''10.1.1.7''' DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=7439 DF PROTO='''TCP''' SPT=31959 DPT='''6002''' WINDOW=6280 RES=0x00 SYN URGP=0
 +
Oct 25 18:52:14 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.93 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=17209 DF PROTO=TCP SPT=11652 DPT=23 WINDOW=7290 RES=0x00 SYN URGP=0
  
−
For example, suppose the following events are observed and the host 192.168.56.1
+
The event correlation rules must produce an alarm at Oct 25 18:52:05 about offending host 10.1.1.7, since this host has accessed five distinct ports 80/tcp, 445/tcp, 6000/tcp, 6001/tcp and 6002/tcp between Oct 25 18:51:07 and Oct 25 18:52:05 (access attempt to noisy port 21/tcp at Oct 25 18:51:12 must be ignored, while access attempt to port 25/tcp at Oct 25 18:51:01 does not fit into the 60 second window).
−
has been previously memorized as suspicious:
 
  
−
Nov 15 13:46:12 localhost apache: 192.168.56.1 - - [15/Nov/2017:13:46:12 +0200] "GET / HTTP/1.1" 200 4897 "-"
+
==== Some hints for accomplishing this assignment:====
−
  "curl/7.29.0"
 
−
Nov 15 13:46:31 localhost apache: 192.168.56.1 - - [15/Nov/2017:13:46:31 +0200] "GET /test.html HTTP/1.1" 404 207 "-"
 
−
  "curl/7.29.0"
 
−
Nov 15 13:46:33 localhost apache: 192.168.56.1 - - [15/Nov/2017:13:46:33 +0200] "GET /test.html HTTP/1.1" 404 207 "-"
 
−
  "curl/7.29.0"
 
−
Nov 15 13:46:41 localhost apache: 192.168.56.1 - - [15/Nov/2017:13:46:41 +0200] "PUT /test.html HTTP/1.1" 405 230 "-"
 
−
  "curl/7.29.0"
 
−
Nov 15 13:46:42 localhost apache: 10.1.17.3 - - [15/Nov/2017:13:46:42 +0200] "GET / HTTP/1.1" 200 4897 "-"
 
−
  "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
 
−
Nov 15 13:46:47 localhost apache: 192.168.56.1 - - [15/Nov/2017:13:46:47 +0200] "DELETE /index.html HTTP/1.1" 405 234 "-"
 
−
  "curl/7.29.0"
 
  
−
The event correlation rules must produce an alarm at Nov 15 13:46:47 about offending
+
* Don't try to solve the whole assignment with just one rule, but rather write several rules which interact.
−
host 192.168.56.1, since this host has used three different HTTP methods (GET, PUT,
+
* For subtask 1, use Single rules that set up contexts with appropriate actions-on-expire. To detect a noisy port, you could create a context for the tracked port with the lifetime of 900 seconds whose action-on-expire creates the context NOISY_PORT_<port_description>. In addition, you could create the second context for the tracked port with the lifetime of 30 seconds, extending its lifetime on each firewall event for the tracked port. If the second context expires, its action-on-expire should delete the first context, not allowing its expiration and the creation of the NOISY_PORT_<port_description> context. See lecture slides 12-14 of Module 7, which illustrate the use of this two-context technique for a different task.
−
and DELETE) within 60 seconds, so that HTTP status codes are either 403, 404, or 405.
+
* For subtask 2, see lecture slides 16-17 of Module 7 for a suitable technique. For a more advanced alternative, consider the technique from Section 6.4 of the SEC tutorial (https://simple-evcorr.github.io/SEC-tutorial.pdf). Note that the solution for subtask 2 should check for the presence of NOISY_PORT_* contexts to receive input from the solution of subtask 1.
−
 
+
* Solutions for subtasks 1 and 2 must remain fully functional when port probing is conducted from several hosts simultaneously. In particular, contexts maintained by different counting operations must not interfere with one another.
−
Some hints for accomplishing this assignment:
 
−
* don't try to solve the whole assignment with just one rule, but rather write several rules which interact,
 
−
* in order to accomplish subtask 2 (detection of 5 minute event sequence with max 60 second intervals), use Single rules that set up contexts with specific actions-on-expire.
 
−
 
 
−
Apart from studying the examples from the course slides, have a look at the SEC
 
−
man page (installed at the virtual machines or found at
 
−
http://simple-evcorr.github.io/man.html).
 

Viimane redaktsioon: 1. november 2026, kell 22:52

This homework assignment requires the knowledge from Modules 6 and 7.

Create SEC rules that accomplish the following event correlation task:

The rules must process netfilter firewall syslog events about blocked packets sent to local TCP and UDP ports. For example, the following two events represent accesses to local ports 23/tcp and 25/tcp which were blocked by the local firewall:

Oct 25 01:13:02 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=192.168.1.67 DST=192.168.1.107 LEN=60 TOS=0x10 PREC=0x00 TTL=64 ID=20049 DF PROTO=TCP SPT=44963 DPT=23 WINDOW=49640 RES=0x00 SYN URGP=0 
Oct 25 01:13:08 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=192.168.1.104 DST=192.168.1.107 LEN=60 TOS=0x10 PREC=0x00 TTL=64 ID=36362 DF PROTO=TCP SPT=56918 DPT=25 WINDOW=29200 RES=0x00 SYN URGP=0

Subtask1: if some port has been probed repeatedly during 15 minutes, so that time between two successive probes does not exceed 30 seconds, memorize that port for the following 1 hour as a "noisy port". Note that ports should be distinguished not only by port number but also by transport protocol (in other words, ports 53/tcp and 53/udp must be considered different ports).

For example, if at 18:30:06 the local netfilter firewall starts to log events about blocked access attempts to port 21/tcp, and such events continue to appear once in 3-4 seconds until 18:45:06, then the port 21/tcp should be memorized as a noisy port for 1 hour. For that purpose, the context NOISY_PORT_TCP_21 with the lifetime of 3600 seconds should be created. On the other hand, if the following 5 events are seen in 15 minutes, the port 21/tcp must not be considered noisy, since the fourth and fifth event are separated by more than 30 seconds.

Oct 25 18:30:06 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=1881 DF PROTO=TCP SPT=16333 DPT=21 WINDOW=5840 RES=0x00 SYN URGP=0
Oct 25 18:30:27 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.2 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=23421 DF PROTO=TCP SPT=34342 DPT=21 WINDOW=29200 RES=0x00 SYN URGP=0
Oct 25 18:30:52 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.29 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=31442 DF PROTO=TCP SPT=47846 DPT=21 WINDOW=49640 RES=0x00 SYN URGP=0
Oct 25 18:31:04 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.93 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=17209 DF PROTO=TCP SPT=11652 DPT=21 WINDOW=7290 RES=0x00 SYN URGP=0
Oct 25 18:44:46 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.84 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=7439 DF PROTO=TCP SPT=31959 DPT=21 WINDOW=6280 RES=0x00 SYN URGP=0

Subtask2: if some host probes 5 different ports within 60 seconds, so that none of the probed ports has been memorized as noisy within the last 1 hour, send an e-mail about the offending host to root@localhost. Note that ports should be distinguished not only by port number but also by transport protocol (in other words, ports 53/tcp and 53/udp must be considered different ports).

In addition, the detection should be done with a sliding window approach -- if the counting operation for some host has not seen enough events during 60 seconds, the 60 second detection window should be moved forward.

After an e-mail alert has been issued about the host, disable further alerts for this host for 4 hours.

For example, suppose the following events are observed and the port 21/tcp has been previously memorized as noisy (that is, the context NOISY_PORT_TCP_21 exists):

Oct 25 18:51:01 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=1881 DF PROTO=TCP SPT=16333 DPT=25 WINDOW=5840 RES=0x00 SYN URGP=0
Oct 25 18:51:07 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=23421 DF PROTO=TCP SPT=34342 DPT=80 WINDOW=29200 RES=0x00 SYN URGP=0
Oct 25 18:51:08 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=23421 DF PROTO=TCP SPT=34342 DPT=80 WINDOW=29200 RES=0x00 SYN URGP=0
Oct 25 18:51:12 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=31442 DF PROTO=TCP SPT=47846 DPT=21 WINDOW=49640 RES=0x00 SYN URGP=0
Oct 25 18:51:14 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.93 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=17209 DF PROTO=TCP SPT=11652 DPT=23 WINDOW=7290 RES=0x00 SYN URGP=0
Oct 25 18:51:52 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=31442 DF PROTO=TCP SPT=47846 DPT=445 WINDOW=49640 RES=0x00 SYN URGP=0
Oct 25 18:52:02 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=7439 DF PROTO=TCP SPT=31959 DPT=6000 WINDOW=6280 RES=0x00 SYN URGP=0
Oct 25 18:52:03 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=7439 DF PROTO=TCP SPT=31959 DPT=6001 WINDOW=6280 RES=0x00 SYN URGP=0
Oct 25 18:52:05 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.7 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=7439 DF PROTO=TCP SPT=31959 DPT=6002 WINDOW=6280 RES=0x00 SYN URGP=0
Oct 25 18:52:14 localhost kernel: iptables: IN=eth0 OUT= MAC=X SRC=10.1.1.93 DST=10.13.25.59 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=17209 DF PROTO=TCP SPT=11652 DPT=23 WINDOW=7290 RES=0x00 SYN URGP=0

The event correlation rules must produce an alarm at Oct 25 18:52:05 about offending host 10.1.1.7, since this host has accessed five distinct ports 80/tcp, 445/tcp, 6000/tcp, 6001/tcp and 6002/tcp between Oct 25 18:51:07 and Oct 25 18:52:05 (access attempt to noisy port 21/tcp at Oct 25 18:51:12 must be ignored, while access attempt to port 25/tcp at Oct 25 18:51:01 does not fit into the 60 second window).

Some hints for accomplishing this assignment:

  • Don't try to solve the whole assignment with just one rule, but rather write several rules which interact.
  • For subtask 1, use Single rules that set up contexts with appropriate actions-on-expire. To detect a noisy port, you could create a context for the tracked port with the lifetime of 900 seconds whose action-on-expire creates the context NOISY_PORT_<port_description>. In addition, you could create the second context for the tracked port with the lifetime of 30 seconds, extending its lifetime on each firewall event for the tracked port. If the second context expires, its action-on-expire should delete the first context, not allowing its expiration and the creation of the NOISY_PORT_<port_description> context. See lecture slides 12-14 of Module 7, which illustrate the use of this two-context technique for a different task.
  • For subtask 2, see lecture slides 16-17 of Module 7 for a suitable technique. For a more advanced alternative, consider the technique from Section 6.4 of the SEC tutorial (https://simple-evcorr.github.io/SEC-tutorial.pdf). Note that the solution for subtask 2 should check for the presence of NOISY_PORT_* contexts to receive input from the solution of subtask 1.
  • Solutions for subtasks 1 and 2 must remain fully functional when port probing is conducted from several hosts simultaneously. In particular, contexts maintained by different counting operations must not interfere with one another.