-
Notifications
You must be signed in to change notification settings - Fork 73
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
ModSecurity Variables Automatically Expire After 1 Minute Without ExpireVar Setting #299
Comments
@theseion Do you have a clue on why this might be happening? |
@takumi-ricoh Are you sure you are using the right syntax? 🤔 What I'm seeing in CRS is that we use
|
@fzipi Thank you for the advice. I tried it but it still didn't work. I believe I'm in a situation where the application I want to use has no login lockout feature, and I have to implement it through WAF, so I'd like to solve this using ModSecurity somehow. ※ Given that there's documentation like this, implementing these (brute-force) measures using ModSecurity isn't strange, right? Current CodeWhen using the following code, if accessed within 1 minute, the count increases and in the logs, "Current number of failures" incrementally goes up like 1⇒2⇒..., but after 1 minute passes, it resets back to 1. print SecRule REQUEST_URI "@beginsWith /console/api/login" \
"id:100098,phase:1,pass,\
chain"
SecRule &IP:failed_attempts "@eq 0" \
"setvar:'IP.failed_attempts=0',\
setvar:'IP.is_locked=0',\
msg:'Initialization - Failed attempts: %{IP.failed_attempts}'"
SecRule REQUEST_URI "@beginsWith /console/api/login" \
"id:100102,phase:5,pass,\
chain"
SecRule RESPONSE_STATUS "@rx ^4\d{2}$" \
"setvar:'IP.failed_attempts=+1',\
log,\
msg:'Login failure count - Current number of failures: %{IP.failed_attempts}'" docker log※
|
Describe the bug
Variables created using
setvar
in ModSecurity rules are being automatically deleted after 1 minute, even without explicitly settingexpirevar
. This occurs when trying to implement custom rules for login attempt tracking without using CRS.Steps to reproduce
/etc/nginx/templates/modsecurity.d/setup.conf.template
with custom configuration:Expected behaviour
IP.failed_attempts
andIP.is_locked
variables should persist indefinitely until explicitly clearedActual behaviour
expirevar
is explicitly set in the rulesAdditional context
Your Environment
The text was updated successfully, but these errors were encountered: