• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue ModSecurity Rule in custom directives ignored

Abed

New Pleskian
Hello,
I have Mod security enabled on the server. Recently, we've been getting daily bots from cortex/1.0 bot (faceboook). WAF is on and set to comdo Free, and predefined to FAST. I have added some custom rules in the custom directives to limit that user-agent, from a solution I saw online used in Apache.p Site is using Apache-FPM, serve static files by Nginx and nginx caching are not enabled. Only proxy mode and static file processing are enabled.

# Limit client hits by user agent
SecRule REQUEST_HEADERS:User-Agent "@pm cortex/1.0" \
"id:400009,phase:2,nolog,pass,setvar:global.ratelimit_cortex=+1,expirevar:global.ratelimit_cortex=3"
SecRule GLOBAL:RATELIMIT_CORTEX "@gt 2" \
"chain,id:4000010,phase:2,deny,status:429,setenv:RATELIMITED,log,msg:'RATELIMITED BOT'"
SecRule REQUEST_HEADERS:User-Agent "@pm cortex/1.0"
Header always set Retry-After "3" env=RATELIMITED
ErrorDocument 429 "Too Many Requests"

if I test with curl -A "cortex/1.0" example.com & curl -A "cortex/1.0" example.com & curl -A "cortex/1.0" example.com
it returns the proper result and I see in the logs that there is a Modsecurity deny for the 3rd request. I also tested from python selenium with success and from multiple ips at the same time as well.

However, when the actual bot comes in, its just makes the requests and they are served without any denying. I checked on Cloudflare and I can see the bot making the requests thousands of times with that exact user-agent in the header.... I also can see it in apache logs, that its clearly the same agent making multiple requests in the span of 3 seconds and nothing gets denied at all.

From the apache access log segment below (there are actually thousands of similar requests in the span of seconds/1 minute), Modsecurity should have started denying the requests. I'm wondering if there is a setting I should be aware off because it doesn't make sense to me. Any help is appreciated
Line 100: 2a03:2880:30ff:12::face:b00c - - [09/Dec/2021:11:05:01 -0500] "GET /url-here HTTP/1.0" 200 1048 "-" "cortex/1.0"
Line 101: 2a03:2880:20ff:11::face:b00c - - [09/Dec/2021:11:05:01 -0500] "/url-here HTTP/1.0" 200 1048 "-" "cortex/1.0"
Line 108: 2a03:2880:21ff:15::face:b00c - - [09/Dec/2021:11:05:01 -0500] "GET /url-here HTTP/1.0" 200 1038 "-" "cortex/1.0"
Line 114: 2a03:2880:30ff:14::face:b00c - - [09/Dec/2021:11:05:01 -0500] "GET /url-here HTTP/1.0" 200 1048 "-" "cortex/1.0"
Line 115: 2a03:2880:31ff:7::face:b00c - - [09/Dec/2021:11:05:01 -0500] "GET /url-here HTTP/1.0" 200 1038 "-" "cortex/1.0"
Line 116: 2a03:2880:23ff:c::face:b00c - - [09/Dec/2021:11:05:01 -0500] "GET url-here HTTP/1.0" 200 1048 "-" "cortex/1.0"
Line 118: 2a03:2880:12ff:a::face:b00c - - [09/Dec/2021:11:05:01 -0500] "GET url-here HTTP/1.0" 200 1048 "-" "cortex/1.0"
Line 121: 2a03:2880:31ff:20::face:b00c - - [09/Dec/2021:11:05:01 -0500] "GET url-here HTTP/1.0" 200 1048 "-" "cortex/1.0"
Line 123: 2a03:2880:31ff:8::face:b00c - - [09/Dec/2021:11:05:01 -0500] "GET /url-here HTTP/1.0" 200 1038 "-" "cortex/1.0"
 
Back
Top