-
Notifications
You must be signed in to change notification settings - Fork 100
transform/test: from_base64 tests using set_error #2212
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
base: master
Are you sure you want to change the base?
Conversation
These tests use the set_error transform option to signal buffers that cannot be base64-decoded. The absent keyword detects the signaling on a buffer that can't be decoded; absent with the or_else option is used when a buffer can be decoded.
count: 1 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this test change ?
# input pcap contains a query to http://home.regit.org/?arg=dGhpc2lzYXRlc3QK | ||
# "dGhpc2lzYXRlc3QK" is "thisisatest\n" | ||
alert tcp any any -> any any (msg:"from_base64: no-decode [mode rfc4648]"; flow:to_server,established; http.uri; content:"/?arg="; from_base64: set_error; absent; sid:1; rev:1;) | ||
alert tcp any any -> any any (msg:"from_base64: no-decode with or_else [mode rfc4648]"; flow:to_server,established; http.uri; content:"/?arg="; from_base64: set_error; absent: or_else; content: "foobar"; sid:2; rev:1;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absent: or_else; content: "foobar";
looks strange to me, what did you mean ?
Did you mean absent: or_else; content: !"foobar";
?
event_type: alert | ||
alert.signature_id: 1 | ||
- filter: | ||
count: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why sid 1 matches and not sid 2 ?
I would expect sid 2 to match as well
# "dGhpc2lzYXRlc3QK" is "thisisatest\n" | ||
alert tcp any any -> any any (msg:"from_base64: no-decode [mode rfc4648]"; flow:to_server,established; http.uri; content:"/?arg="; from_base64: set_error; absent; sid:1; rev:1;) | ||
alert tcp any any -> any any (msg:"from_base64: no-decode with or_else [mode rfc4648]"; flow:to_server,established; http.uri; content:"/?arg="; from_base64: set_error; absent: or_else; content: "foobar"; sid:2; rev:1;) | ||
alert http any any -> any any (msg:"from_base64: decode with or_else [mode rfc4648]"; http.uri; content:"/?arg=dGhpc2lzYXRlc3QK"; from_base64: offset 10; absent: or_else; content:"sisatest"; sid:3; rev:1;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could from_base64
without set_error
match absent
?
This rule should be rejected as invalid...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs rebase + see comments/questions inline
These tests use the set_error transform option to signal buffers that cannot be base64-decoded.
The absent keyword detects the signaling on a buffer that can't be decoded; absent with the or_else option is used when a buffer can be decoded.
Ticket
If your pull request is related to a Suricata ticket, please provide
the full URL to the ticket here so this pull request can monitor
changes to the ticket status:
Redmine ticket: https://redmine.openinfosecfoundation.org/issues/7114