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

Adds test for negated content and absent buffer #1516

Closed
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
Adds test for negated content and absent buffer
Ticket: 2224
catenacyber committed Dec 6, 2023
commit 10df3c0745cc30836a1224bfacd41a81b9a81878
11 changes: 11 additions & 0 deletions tests/detect-negated-content-absent-buffer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Test Description

Test rules with negated content on buffers that are absent

## PCAP

From the issue https://redmine.openinfosecfoundation.org/issues/2224

## Related issues

https://redmine.openinfosecfoundation.org/issues/2224
Binary file not shown.
9 changes: 9 additions & 0 deletions tests/detect-negated-content-absent-buffer/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Test to ensure it works without a negated content
# This signature should alert with _any_ pcap
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"TP test for URI"; flow:established,to_server; http.uri; bsize:1; content:"/"; sid:1;)

# Test to prove FN when Referer is not included
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"FN test for Referer"; flow:established,to_server; http.uri; bsize:1; content:"/"; http.referer; content:!"example"; sid:6;)
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"FN test for Referer"; flow:established,to_server; http.uri; bsize:1; content:"/"; http.referer; pcre:!"/example/"; sid:7;)
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"FN test for Referer"; flow:established,to_server; http.uri; bsize:1; content:"/"; http.referer; isdataat:!0; sid:8;)
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"FN test for Referer"; flow:established,to_server; http.uri; bsize:1; content:"/"; http.referer; byte_test:2,!=,1,0; sid:9;)
32 changes: 32 additions & 0 deletions tests/detect-negated-content-absent-buffer/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
requires:
min-version: 8

args:
- -k none

checks:
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 1
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 6
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 7
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 8
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 9