• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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