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

feat: accidental firewall disability prevention #3650

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

azurit
Copy link
Member

@azurit azurit commented Apr 6, 2024

This is only a proof-of-concept, probably not the best one.

Everyone of our users, who is new to rule exclusions and is trying to write his/her own exclusion rules, is disabling also one or both of the rules 949110 and 959100. What is worse, in most cases, users see that it helped to resolve the problem and doesn't know that the whole firewall was disabled. Such cases are discovered probably only by accident, because users are having more problems they are unable to resolve and are asking for help where they show us currently used exclusion rule. How many installations of CRS are there with rules 949110/959100 disabled?

This PR is showing how it is possible to partially prevent this and, at least, log a huge warning for a user.

Any ideas how to do this better are welcomed.

@azurit azurit added the ⚠️ do not merge Additional work is needed despite passing tests label Apr 6, 2024
@dune73
Copy link
Member

dune73 commented Apr 6, 2024

I see what you want to do here, but do you really think this is such a big deal?

I agree it can happen, but any functionality test of the WAF will fail afterwards anyways.

For the record: My modsec-rulereport.rb script used to generate rule exclusions refuses to do a rule exclusion for one of the evaluation rules but displays an explanation instead. The same is true for c-rex.netnea.com.

@azurit
Copy link
Member Author

azurit commented Apr 7, 2024

I agree it can happen, but any functionality test of the WAF will fail afterwards anyways.

It depends, most of the exclusion rules looks like this:

SecRule REQUEST_FILENAME "@streq /wp-admin/admin-ajax.php" \
    "...
    ctl:ruleRemoveTargetById=..."

If a user adds ctl:ruleRemoveById=949110 into such rule then firewall as a whole is working but is disabled only on a specific part(s) of the application.

@azurit
Copy link
Member Author

azurit commented Apr 7, 2024

See:
#1
#2

@azurit
Copy link
Member Author

azurit commented Apr 7, 2024

This one is real fun. :)
#3

@azurit
Copy link
Member Author

azurit commented Apr 7, 2024

Few are also here:
#4

@dune73
Copy link
Member

dune73 commented Apr 7, 2024

I agree it can happen, but any functionality test of the WAF will fail afterwards anyways.

It depends, most of the exclusion rules looks like this:

SecRule REQUEST_FILENAME "@streq /wp-admin/admin-ajax.php" \
    "...
    ctl:ruleRemoveTargetById=..."

If a user adds ctl:ruleRemoveById=949110 into such rule then firewall as a whole is working but is disabled only on a specific part(s) of the application.

You are right here, yes.

@dune73
Copy link
Member

dune73 commented Apr 7, 2024

I am not convinced this is needed, but the example with the path constraint is really very hard to spot any other way.

Let's discuss this at the next meeting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️ do not merge Additional work is needed despite passing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants