Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next/sv/660/20241205/v1 #2165

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/bug-7414-decoder-event-01/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PCAP
====

Pcap from https://redmine.openinfosecfoundation.org/issues/7414

1 change: 1 addition & 0 deletions tests/bug-7414-decoder-event-01/decoder-event.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
drop pkthdr any any -> any any (msg:"SURICATA IPv4 invalid option length"; decode-event:ipv4.opt_invalid_len; classtype:protocol-command-decode; sid:2200005; rev:2;)
Binary file added tests/bug-7414-decoder-event-01/ip_secopt.pcap
Binary file not shown.
41 changes: 41 additions & 0 deletions tests/bug-7414-decoder-event-01/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
%YAML 1.1
---

# Global stats configuration
stats:
enabled: yes
# The interval field (in seconds) controls the interval at
# which stats are updated in the log.
interval: 8
# Add decode events to stats.
#decoder-events: true
# Decoder event prefix in stats. Has been 'decoder' before, but that leads
# to missing events in the eve.stats records. See issue #2225.
#decoder-events-prefix: "decoder.event"
# Add stream events as stats.
#stream-events: false
exception-policy:
#per-app-proto-errors: false # default: false. True will log errors for
# each app-proto. Warning: VERY verbose

# Configure the type of alert (and other) logging you would like.
outputs:
- eve-log:
enabled: yes
filetype: regular #regular|syslog|unix_dgram|unix_stream|redis
filename: eve.json
ethernet: true
pcap-file: true

types:
- alert:
packet: yes # enable dumping of packet (without stream segments)
verdict: yes
- anomaly:
enabled: yes
types:
decode: true
- stats:
totals: yes # stats for all threads merged together
threads: no # per thread stats
deltas: no # include delta values
45 changes: 45 additions & 0 deletions tests/bug-7414-decoder-event-01/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
requires:
min-version: 8

checks:
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 2200005
pcap_cnt: 3
pkt_src: "wire/pcap"
ether.src_mac: "f6:3a:04:28:26:77"
ether.dest_mac: "fe:2d:cf:ad:28:54"
alert.action: "allowed"
packet: "/i3PrShU9joEKCZ3CABIAABoAAEAAEARWEoeHh4eFBQUFIIC8TUAAN6tvu+qABPEE8QASB76g3Jy/3MMn6/gl+2PaHNYfvkOoBoRYsUb5ZV3mCocwk9Xbm1VI6ZMlgQ+xZbugYD/RB0xtXrOiZQ43SvBfdo36g=="
verdict.action: "alert"
pcap_filename.__endswith: "ip_secopt.pcap"
- filter:
count: 1
match:
event_type: stats
stats.decoder.invalid: 1

- filter:
count: 1
match:
pcap_cnt: 3
event_type: "anomaly"
pkt_src: "wire/pcap"
ether.src_mac: "f6:3a:04:28:26:77"
ether.dest_mac: "fe:2d:cf:ad:28:54"
anomaly.type: "decode"
anomaly.event: "decoder.ipv4.opt_pad_required"
pcap_filename.__endswith: "ip_secopt.pcap"
- filter:
count: 2
match:
pcap_cnt: 3
event_type: "anomaly"
pkt_src: "wire/pcap"
ether.src_mac: "f6:3a:04:28:26:77"
ether.dest_mac: "fe:2d:cf:ad:28:54"
anomaly.type: "decode"
anomaly.event: "decoder.ipv4.opt_invalid_len"
pcap_filename.__endswith: "ip_secopt.pcap"
5 changes: 5 additions & 0 deletions tests/bug-7414-decoder-event-02-ips/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PCAP
====

Pcap from https://redmine.openinfosecfoundation.org/issues/7414

1 change: 1 addition & 0 deletions tests/bug-7414-decoder-event-02-ips/decoder-event.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
drop pkthdr any any -> any any (msg:"SURICATA IPv4 invalid option length"; decode-event:ipv4.opt_invalid_len; classtype:protocol-command-decode; sid:2200005; rev:2;)
43 changes: 43 additions & 0 deletions tests/bug-7414-decoder-event-02-ips/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
%YAML 1.1
---

# Global stats configuration
stats:
enabled: yes
# The interval field (in seconds) controls the interval at
# which stats are updated in the log.
interval: 8
# Add decode events to stats.
#decoder-events: true
# Decoder event prefix in stats. Has been 'decoder' before, but that leads
# to missing events in the eve.stats records. See issue #2225.
#decoder-events-prefix: "decoder.event"
# Add stream events as stats.
#stream-events: false
exception-policy:
#per-app-proto-errors: false # default: false. True will log errors for
# each app-proto. Warning: VERY verbose

# Configure the type of alert (and other) logging you would like.
outputs:
- eve-log:
enabled: yes
filetype: regular #regular|syslog|unix_dgram|unix_stream|redis
filename: eve.json
ethernet: true
pcap-file: true

types:
- alert:
packet: yes # enable dumping of packet (without stream segments)
verdict: yes
- anomaly:
enabled: yes
types:
decode: true
- stats:
totals: yes # stats for all threads merged together
threads: no # per thread stats
deltas: no # include delta values
- drop:
alerts: yes # log alerts that caused drops
61 changes: 61 additions & 0 deletions tests/bug-7414-decoder-event-02-ips/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
pcap: ../bug-7414-decoder-event-01/ip_secopt.pcap

requires:
min-version: 8

checks:
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 2200005
pcap_cnt: 3
pkt_src: "wire/pcap"
ether.src_mac: "f6:3a:04:28:26:77"
ether.dest_mac: "fe:2d:cf:ad:28:54"
alert.action: "blocked"
packet: "/i3PrShU9joEKCZ3CABIAABoAAEAAEARWEoeHh4eFBQUFIIC8TUAAN6tvu+qABPEE8QASB76g3Jy/3MMn6/gl+2PaHNYfvkOoBoRYsUb5ZV3mCocwk9Xbm1VI6ZMlgQ+xZbugYD/RB0xtXrOiZQ43SvBfdo36g=="
verdict.action: "drop"
pcap_filename.__endswith: "ip_secopt.pcap"
- filter:
count: 1
match:
event_type: stats
stats.decoder.invalid: 1
stats.ips.accepted: 2
stats.ips.blocked: 1
stats.ips.drop_reason.rules: 1
- filter:
count: 1
match:
pcap_cnt: 3
event_type: "anomaly"
pkt_src: "wire/pcap"
ether.src_mac: "f6:3a:04:28:26:77"
ether.dest_mac: "fe:2d:cf:ad:28:54"
anomaly.type: "decode"
anomaly.event: "decoder.ipv4.opt_pad_required"
pcap_filename.__endswith: "ip_secopt.pcap"
- filter:
count: 2
match:
pcap_cnt: 3
event_type: "anomaly"
pkt_src: "wire/pcap"
ether.src_mac: "f6:3a:04:28:26:77"
ether.dest_mac: "fe:2d:cf:ad:28:54"
anomaly.type: "decode"
anomaly.event: "decoder.ipv4.opt_invalid_len"
pcap_filename.__endswith: "ip_secopt.pcap"
- filter:
count: 1
match:
event_type: drop
alert.signature_id: 2200005
pcap_cnt: 3
pkt_src: "wire/pcap"
ether.src_mac: "f6:3a:04:28:26:77"
ether.dest_mac: "fe:2d:cf:ad:28:54"
alert.action: "blocked"
pcap_filename.__endswith: "ip_secopt.pcap"
drop.reason: "rules"
15 changes: 15 additions & 0 deletions tests/flowint-isnotset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Test
----

Simple test to check that the keyword ``flowint`` accepts both ``notset``
and ``isnotset``.

Pcap
----

From test tls-subjectaltname

Redmine Ticket
--------------

https://redmine.openinfosecfoundation.org/issues/7426
2 changes: 2 additions & 0 deletions tests/flowint-isnotset/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alert tls any any -> any any (msg:"test flowint isnotset"; flowint:flowtls1,isnotset; flowint:flowtls1,+,1; noalert; sid:1;)
alert tls any any -> any any (msg:"test flowint notset"; flowint:flowtls2,notset; flowint:flowtls2,+,1; sid:2;)
19 changes: 19 additions & 0 deletions tests/flowint-isnotset/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
requires:
min-version: 8

pcap: ../tls/tls-subjectaltname/input.pcap

args:
- -k none

checks:
- filter:
count: 0
match:
alert.signature_id: 1
event_type: alert
- filter:
count: 40
match:
alert.signature_id: 2
event_type: alert
Loading