--- /dev/null
+FTP active download tests for firewall.
--- /dev/null
+# Allow all TCP handshakes.
+accept:hook tcp:all any any -> any any (flow:not_established; sid:1000;)
+accept:hook tcp:all any any <> any any (flow:established; sid:1001;)
+
+accept:hook ftp:request_started any any -> any any (sid:2000;)
+accept:hook ftp:request_complete any any -> any any (sid:2010;)
+
+accept:hook ftp:response_started any any -> any any (sid:3000;)
+accept:hook ftp:response_complete any any -> any any (sid:3010;)
+
+accept:flow,alert ftp-data:request_started any any -> any any (sid:4000; \
+ ftpdata_command: retr;)
+accept:flow,alert ftp-data:request_started any any -> any any (sid:4002; \
+ ftpdata_command: nlst;)
--- /dev/null
+%YAML 1.1
+---
+
+stats:
+ enabled: yes
+ interval: 8
+
+outputs:
+ - eve-log:
+ enabled: yes
+ filetype: regular
+ filename: eve.json
+ types:
+ - flow
+ - alert
+ - ftp
+ - files
+ - drop:
+ alerts: yes
+ flows: all
--- /dev/null
+requires:
+ min-version: 9
+
+pcap: ../../ftp/ftp-download-active/input.pcap
+
+args:
+ - --simulate-ips
+ - --runmode=single
+ - -k none
+
+checks:
+
+ - filter:
+ count: 1
+ match:
+ event_type: fileinfo
+
+ - filter:
+ count: 3
+ match:
+ event_type: ftp_data
+
+ # We expect no drops.
+ - filter:
+ count: 0
+ match:
+ event_type: drop
+
+ # There are 2 NLST data channels.
+ - filter:
+ count: 2
+ match:
+ alert.signature_id: 4002
+
+ # We don't expect any drops.
+ - filter:
+ count: 0
+ match:
+ event_type: drop
--- /dev/null
+FTP passive download tests for firewall.
--- /dev/null
+# Allow all TCP handshakes.
+accept:hook tcp:all any any -> any any (flow:not_established; sid:1000;)
+accept:hook tcp:all any any <> any any (flow:established; sid:1001;)
+
+accept:hook ftp:request_started any any -> any any (sid:2000;)
+accept:hook ftp:request_complete any any -> any any (sid:2010;)
+
+accept:hook ftp:response_started any any -> any any (sid:3000;)
+accept:hook ftp:response_complete any any -> any any (sid:3010;)
+
+# For passive FTP, the request is never started.
+accept:hook,alert ftp-data:request_started any any -> any any (sid:4000;)
+accept:hook,alert ftp-data:request_complete any any -> any any (sid:4010;)
+
+accept:flow,alert ftp-data:response_started any any -> any any (sid:5000; \
+ ftpdata_command: retr;)
+accept:flow,alert ftp-data:response_started any any -> any any (sid:5001; \
+ ftpdata_command: nlst;)
--- /dev/null
+%YAML 1.1
+---
+
+stats:
+ enabled: yes
+ interval: 8
+
+outputs:
+ - eve-log:
+ enabled: yes
+ filetype: regular
+ filename: eve.json
+ types:
+ - stats
+ - flow
+ - alert
+ - ftp
+ - files
+ - drop:
+ alerts: yes
+ flows: all
--- /dev/null
+requires:
+ min-version: 9
+
+pcap: ../../ftp/ftp-download-passive/input.pcap
+
+args:
+ - --simulate-ips
+ - --runmode=single
+ - -k none
+
+checks:
+
+ # ftp-data:request_started never reach in passive mode
+ - filter:
+ count: 0
+ match:
+ alert.signature_id: 4000
+
+ # ftp-data:request_complete never reach in passive mode
+ - filter:
+ count: 0
+ match:
+ alert.signature_id: 4010
+
+ - filter:
+ count: 1
+ match:
+ event_type: ftp_data
+ ftp_data.command: RETR
+
+ - filter:
+ count: 2
+ match:
+ event_type: ftp_data
+ ftp_data.command: NLST
+
+ # ftpdata_command: retr matches in ftp-data:response_started
+ - filter:
+ count: 1
+ match:
+ alert.signature_id: 5000
+
+ # Should see no drops.
+ - filter:
+ count: 0
+ match:
+ event_type: drop
--- /dev/null
+FTP active upload tests for firewall.
--- /dev/null
+# Allow all TCP handshakes.
+accept:hook tcp:all any any -> any any (flow:not_established; sid:1000;)
+accept:hook tcp:all any any <> any any (flow:established; sid:1001;)
+
+accept:hook ftp:request_started any any -> any any (sid:2000;)
+accept:hook ftp:request_complete any any -> any any (sid:2010;)
+
+accept:hook ftp:response_started any any -> any any (sid:3000;)
+accept:hook ftp:response_complete any any -> any any (sid:3010;)
+
+# Only allow NLST as a data request.
+accept:flow,alert ftp-data:request_started any any -> any any (sid:4002; \
+ ftpdata_command: nlst;)
+
+accept:flow,alert ftp-data:response_started any any -> any any (sid:5000; \
+ ftpdata_command: stor;)
--- /dev/null
+%YAML 1.1
+---
+
+stats:
+ enabled: yes
+ interval: 8
+
+outputs:
+ - eve-log:
+ enabled: yes
+ filetype: regular
+ filename: eve.json
+ types:
+ - flow
+ - alert
+ - ftp
+ - files
+ - drop:
+ alerts: yes
+ flows: all
--- /dev/null
+requires:
+ min-version: 9
+
+pcap: ../../ftp/ftp-upload-active/input.pcap
+
+args:
+ - --simulate-ips
+ - --runmode=single
+
+checks:
+
+ - filter:
+ count: 1
+ match:
+ event_type: ftp_data
+ ftp_data.command: STOR
+
+ # This pcap has 2 NLST commands.
+ - filter:
+ count: 2
+ match:
+ event_type: ftp_data
+ ftp_data.command: NLST
+
+ # ftpdata_command: stor matches in ftp-data:response_started
+ - filter:
+ count: 1
+ match:
+ alert.signature_id: 5000
+
+ - filter:
+ count: 1
+ match:
+ event_type: fileinfo
+
+ - filter:
+ count: 2
+ match:
+ alert.signature_id: 4002
+
+ # There should be no drops.
+ - filter:
+ count: 0
+ match:
+ event_type: drop
--- /dev/null
+FTP passive upload tests for firewall.
--- /dev/null
+# Allow all TCP handshakes.
+accept:hook tcp:all any any -> any any (flow:not_established; sid:1000;)
+accept:hook tcp:all any any <> any any (flow:established; sid:1001;)
+
+accept:hook ftp:request_started any any -> any any (sid:2000;)
+accept:hook ftp:request_complete any any -> any any (sid:2010;)
+
+accept:hook ftp:response_started any any -> any any (sid:3000;)
+accept:hook ftp:response_complete any any -> any any (sid:3010;)
+
+# Accept STOR on the request data channel.
+accept:flow,alert ftp-data:request_started any any -> any any (sid:4000; \
+ ftpdata_command: stor;)
+
+# Accept NLST on the response data channel.
+accept:flow,alert ftp-data:response_started any any -> any any (sid: 4010; \
+ ftpdata_command: nlst;)
--- /dev/null
+%YAML 1.1
+---
+
+stats:
+ enabled: yes
+ interval: 8
+
+outputs:
+ - eve-log:
+ enabled: yes
+ filetype: regular
+ filename: eve.json
+ types:
+ - flow
+ - alert
+ - ftp
+ - files
+ - drop:
+ alerts: yes
+ flows: all
--- /dev/null
+requires:
+ min-version: 9
+
+pcap: ../../ftp/ftp-upload-passive/input.pcap
+
+args:
+ - --simulate-ips
+ - --runmode=single
+
+checks:
+
+ - filter:
+ count: 1
+ match:
+ event_type: ftp_data
+ ftp_data.command: STOR
+
+ # ftpdata_command: stor matches in ftp-data:request_started
+ - filter:
+ count: 1
+ match:
+ alert.signature_id: 4000
+
+ # ftpdata_command: nlst matches in ftp-data:response_started
+ - filter:
+ count: 2
+ match:
+ alert.signature_id: 4010
+
+ - filter:
+ count: 1
+ match:
+ event_type: fileinfo
+
+ # There should be no drops.
+ - filter:
+ count: 0
+ match:
+ event_type: drop