Skip to content

Conversation

jlucovsky
Copy link
Contributor

@jlucovsky jlucovsky commented Jan 4, 2025

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

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.
@jlucovsky jlucovsky added the requires suricata fix This PR requires an issue in Suricata to be fixed first label Jan 4, 2025
@catenacyber catenacyber added requires suricata pr Depends on a PR in Suricata and removed requires suricata fix This PR requires an issue in Suricata to be fixed first labels Jan 24, 2025
count: 1
match:
event_type: alert
alert.signature_id: 6
Copy link
Collaborator

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;)
Copy link
Collaborator

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
Copy link
Collaborator

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;)
Copy link
Collaborator

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...

@catenacyber catenacyber added the needs rebase PR looks fine but needs a rebase label Aug 26, 2025
Copy link
Collaborator

@catenacyber catenacyber left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs rebase PR looks fine but needs a rebase requires suricata pr Depends on a PR in Suricata
Development

Successfully merging this pull request may close these issues.

2 participants