8000 Bug in how the variables `tx.inbound_anomaly_score` is used? · Issue #1896 · coreruleset/coreruleset · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Bug in how the variables tx.inbound_anomaly_score is used? #1896

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

Closed
studersi opened this issue Oct 6, 2020 · 9 comments
Closed

Bug in how the variables tx.inbound_anomaly_score is used? #1896

studersi opened this issue Oct 6, 2020 · 9 comments
Assignees

Comments

@studersi
Copy link
Contributor
studersi commented Oct 6, 2020

Describe the bug

It seems to me there is a bug in how the variables tx.inbound_anomaly_score is used.

The variable tx.inbound_anomaly_score is only set if the condition TX:ANOMALY_SCORE "@ge %{tx.inbound_anomaly_score_threshold}" is fulfilled (see Rule 949110) or in case of reputation blocking but this is not relevant here as this might be disabled.

IMO this basically breaks Rule 980120. There, the condition is TX:INBOUND_ANOMALY_SCORE "@lt %{tx.inbound_anomaly_score_threshold}".

The condition of Rule 949110 requires TX:ANOMALY_SCORE to be larger than tx.inbound_anomaly_score_threshold for TX:INBOUND_ANOMALY_SCORE to be set. Rule 980120 requires TX:INBOUND_ANOMALY_SCORE to be smaller than tx.inbound_anomaly_score_threshold. But if TX:INBOUND_ANOMALY_SCORE is smaller than tx.inbound_anomaly_score_threshold it is likely unset.

The same is not the case for tx.outbound_anomaly_score as it is calculated differently.

  • CRS version (e.g., v3.2.0): v3.3.0
@dune73
Copy link
Member
dune73 commented Oct 7, 2020

This is all a bit hairy. Thank you for trying to clear things up.

I'm making a proposal for radical simplifiction in #1898. Would that be a solution for this problem here too?

@studersi
Copy link
Contributor Author
studersi commented Oct 7, 2020

No I do not think this would be a good solution. If I understand correctly, you would either have no log entry or an entry on every request. We have tried this and it lead to logs that became very large.

I think there is a problem with how tx.inbound_anomaly_score is used as stated above. Instead of creating a workaround for that specific problem, the problem should be solved at the root.

The way tx.outbound_anomaly_score is used for example seems much more sensible and more intuitive to me. I think this could be implemented analogously for tx.inbound_anomaly_score.

And maybe a small correction: With the fix in #1898 the Rule 980120 is not broken anymore by this here issue. It works as intended, though the actual reason it works is not intuitive and not what you would expect.

@dune73
Copy link
Member
dune73 commented Oct 7, 2020

I see 3 types of requests / scores:

  • no alert, no score
  • alerts and a score below the anomaly limit
  • alerts and a score meeting or exceeding the anomaly limit

All this combined with inbound and outbound score and possibly execution paranoia level.

Do you see other requests?

949/959 address the 3rd category. 980 addresses the 2nd category. On nginx I see an additional need for the first category. Ideally, we find a solution that addresses all needs and can be configured in a granular way.

@studersi
Copy link
Contributor Author
studersi commented Oct 7, 2020

Actually, this relates to #1083 (which was originally SpiderLabs/owasp-modsecurity-crs#1083) which points out that tx.anomaly_score is reused for different purposes. It appears that this in fact contributes to the unintended side-effects here; the two issues overlap.

I agree with your list of request types. And I also acknowledge the need for nginx to log scores on every request. However, I am sceptical about adding too much complexity.

How would you implement this?

@github-actions
Copy link
Contributor
github-actions bot commented Feb 5, 2021

This issue has been open 120 days with no activity. Remove the stale label or comment, or this will be closed in 14 days

8000

@github-actions github-actions bot added the ⌛ Stale issue This issue has been open 120 days with no activity. label Feb 5, 2021
@dune73 dune73 removed the ⌛ Stale issue This issue has been open 120 days with no activity. label Feb 5, 2021
@dune73 dune73 self-assigned this Feb 5, 2021
@dune73
Copy link
Member
dune73 commented Feb 5, 2021

I'll try to come up with a PR before 3.4. I've been pondering over this too long. We need to support NGINX in a better way than we do now.

@github-actions
Copy link
Contributor

This issue has been open 120 days with no activity. Remove the stale label or comment, or this will be closed in 14 days

@github-actions github-actions bot added the ⌛ Stale issue This issue has been open 120 days with no activity. label Oct 10, 2021
@dune73 dune73 reopened this Oct 24, 2021
@github-actions github-actions bot closed this as completed Nov 8, 2021
@dune73 dune73 reopened this Nov 8, 2021
@dune73 dune73 reopened this Nov 23, 2021
@fzipi fzipi added 🔖 Meeting Agenda and removed ⌛ Stale issue This issue has been open 120 days with no activity. labels Nov 29, 2021
@fzipi
Copy link
Member
fzipi commented Nov 29, 2021

Probably it is a good idea to talk about this in the next meeting.

@dune73
Copy link
Member
dune73 commented Feb 21, 2022

Closing this in favor of #2319

@dune73 dune73 closed this as completed Feb 21, 2022
@studersi studersi mentioned this issue Mar 3, 2022
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0