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

350001 rule blocks the Facebook Sharing Debugger bot #3179

Open
MariuszMilka opened this issue Jul 6, 2024 · 1 comment
Open

350001 rule blocks the Facebook Sharing Debugger bot #3179

MariuszMilka opened this issue Jul 6, 2024 · 1 comment
Labels
3.x Related to ModSecurity version 3.x

Comments

@MariuszMilka
Copy link

MariuszMilka commented Jul 6, 2024

I have ModSecurity installed and configure by my hosting provider. Today I tried to refresh blank preview image of a link I posted on facebook. But Facebook Sharing Debugger kept giving me 403 response code. Then I found Modsecurity log telling me the request was blocked by the 350001. I temporarily switched off the rule and everything works. But I guess the same rule blocks many other boths that are actually bad, so please fix it, so I can re-activate it.

  "accept": "*/*",
        "user-agent": "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)"
      }
    },
    "response": {
      "http_code": 403
    },
    "messages": [
      {
        "message": "BAD BOT - Detected and Blocked. ",
        "details": {
          "match": "Matched Operator '@pmFromFile /etc/modsecurity.d/badbots.txt' against variable 'REQUEST_HEADERS:User-Agent'",
          "ruleId": 350001,
          "file": "/etc/modsecurity.d/badbots.conf",
          "lineNumber": 1,
          "data": "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)",
          "rev": 1,
          "msg": "BAD BOT - Detected and Blocked. ",
          "severity": "CRITICAL"
@MariuszMilka MariuszMilka added the 3.x Related to ModSecurity version 3.x label Jul 6, 2024
@airween
Copy link
Member

airween commented Jul 6, 2024

Hi @MariuszMilka,

I think that's a normal behavior.

ModSecurity is a WAF engine: it splits the request into several parts. The decision is in hand of rule set.

The expected action in this case to create an exclusion against the rule, something like this:

SecRule REQUEST_URI "@beginsWith /your/uri/which/not/seems/here" \
    "id:10000,\
    phase:1,\
    t:none,\
    pass,
    ctl:ruleRemoveTargetById=35001;REQUEST_HEADERS:User-Agent"

Put this rule before your ruleset, I hope this will solve your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Related to ModSecurity version 3.x
Projects
None yet
Development

No branches or pull requests

2 participants