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

detect/filestore: fix options handling and impact #12312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

regit
Copy link
Contributor

@regit regit commented Dec 20, 2024

Update of #12176

The filestore keyword had an influence on the signature matching when it should not. For example, if Suricata is analysing a traffic with a GET http request to uri /example and have the 2 following signatures loaded:

alert http any any -> any any (msg:"ex"; http.uri; content:"/example"; sid:1; rev:1;) alert http any any -> any any (msg:"ex"; http.uri; content:"/example"; filestore; sid:2; rev:1;)

then the first signature will match and the second one will not.

Also the options of filestore were not honored correctly. A signature like:

alert http any any -> any any (msg:"ex"; http.uri; content:"/example"; filestore:to_client,tx; sid:2; rev:1;)

was not storing the file in the answer to the request.

This patch updates the logic in filestore keyword handling to fix the problems.

The patch first makes sure that a signature with filestore will hit even if there is no file in the current application layer context. Then the patch makes sure that postmatch handles the different options correctly.

As filestore keyword is not anymore preventing a match, we need to update some unit tests that were using this "feature".

Tickets: 7356 7357

Contribution style:

Our Contribution agreements:

Changes (if applicable):

Link to ticket: https://redmine.openinfosecfoundation.org/issues/7357

Describe changes:

  • rebase code
  • don't filestore before tx triggering the alert
  • put everything in one commit
  • rework the commit message

SV_BRANCH=OISF/suricata-verify#2202

@regit regit requested a review from victorjulien as a code owner December 20, 2024 07:40
@victorjulien
Copy link
Member

In the commit, use

Ticket: 7356
Ticket: 7357

so our tracking can work (and the leaderboard counts them)

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 24034

@victorjulien
Copy link
Member

SV_REPO=OISF/suricata-verify#2202

Should be using SV_BRANCH

The filestore keyword had an influence on the signature matching
when it should not. For example, if Suricata is analysing a traffic
with a GET http request to uri /example and have the 2 following
signatures loaded:

alert http any any -> any any (msg:"ex"; http.uri; content:"/example"; sid:1; rev:1;)
alert http any any -> any any (msg:"ex"; http.uri; content:"/example"; filestore; sid:2; rev:1;)

then the first signature will match and the second one will not.

Also the options of filestore were not honored correctly. A signature
like:

alert http any any -> any any (msg:"ex"; http.uri; content:"/example"; filestore:to_client,tx; sid:2; rev:1;)

was not storing the file in the answer to the request.

This patch updates the logic in filestore keyword handling to
fix the problems.

The patch first makes sure that a signature with filestore will hit
even if there is no file in the current application layer context.
Then the patch makes sure that postmatch handles the different options
correctly.

As filestore keyword is not anymore preventing a match, we need
to update some unit tests that were using this "feature".

Ticket: 7356
Ticket: 7357
@regit regit force-pushed the 7357-filestore-keyword-v3.0 branch from 162dafb to e1a4441 Compare December 20, 2024 15:10
@regit
Copy link
Contributor Author

regit commented Dec 20, 2024

In the commit, use

Ticket: 7356
Ticket: 7357

so our tracking can work (and the leaderboard counts them)

Done, thanks for the check.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 24041

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants