Crazy amount of guests

Anubis is what I use, so I am a bit biased towards it.

I am also leaning towards it. Here is my wishlist and I will try to accomplish it with Anubis:

Members that chose "remain always logged in" should never be bothered with a challenge. Members that are logging in can receive a challenge, no problem. Guests also can receive a challenge, no problem.

If these can be accomplished with Anubis, I think it is a complete and sufficient solution.
 
I am also leaning towards it. Here is my wishlist and I will try to accomplish it with Anubis:

Members that chose "remain always logged in" should never be bothered with a challenge. Members that are logging in can receive a challenge, no problem. Guests also can receive a challenge, no problem.

If these can be accomplished with Anubis, I think it is a complete and sufficient solution.
This should accomplish the user logged in check. Anubis, like others, does checks against client cookies. If the cookie exists, it is validated for the name and then permits the client, bypassing the challenge:

YAML:
  - name: XenForoUserLoggedIn
    action: ALLOW
    expression:
      all:
        - '"Cookie" in headers'
        - 'headers["Cookie"].contains("xf_user=")'

Here's a config file that can be used as a starting point:

YAML:
bots:
  - name: PermitIndexAndCore
    action: ALLOW
    expression:
      any:
        - path == "/"
        - path.startsWith("/js/")
        - path == "/css.php"
        - path.startsWith("/admin.php")
        - path.startsWith("/styles/")
        - path.startsWith("/data/")
        - path.startsWith("/api/")
  - name: XenForoUserLoggedIn
    action: ALLOW
    expression:
      all:
        - '"Cookie" in headers'
        - 'headers["Cookie"].contains("xf_user=")'
  - import: /etc/anubis/data/clients/discord-embed.yaml
  - import: /etc/anubis/data/crawlers/_allow-good.yaml
  - import: /etc/anubis/data/crawlers/alibaba-cloud.yaml
  - import: /etc/anubis/data/crawlers/tencent-cloud.yaml
  - import: /etc/anubis/data/bots/aggressive-brazilian-scrapers.yaml
  - import: /etc/anubis/data/bots/ai-catchall.yaml
  - import: /etc/anubis/data/bots/headless-browsers.yaml
  - import: /etc/anubis/data/common/keep-internet-working.yaml
  - import: /etc/anubis/data/common/allow-private-addresses.yaml
  - import: /etc/anubis/data/common/rfc-violations.yaml
  - name: challenge-all
    action: CHALLENGE
    path_regex: .*
    challenge:
      algorithm: fast
      difficulty: 4
store:
  backend: valkey
  parameters:
    url: "redis://10.48.0.10:6379/6"

What the above does:

1. Allows all clients to view the index without a challenge.
1a. If the client goes to view something that isn't the index or XF2's core components (JS/CSS), challenge.
2. If the client has an xf_user cookie set, bypass challenge.
3. If client is a 'good bot', no challenge, bypass/allow.
4. If the client is a 'bad bot' (or otherwise configured), explicit deny or harshly challenge.
5. Anything not caught by the rules set, auto-challenge at a level of 4.

In my case, all sessions for the challenge system, are stored to redis/valkey - no memory storage on Anubis itself. Which in turn means you can also spin up additional Anubis instances for the same domain if ever required/desired.

There is also the weights system, but it's fairly advanced when it comes to "finding that sweet spot". It's a careful balance between pissing off legitimate users and harshly blocking bots. No one likes challenges/walled gardens, but we're all unfortunately at a point where abusive bots need to be curbed.
 
3. If client is a 'good bot', no challenge, bypass/allow.
How does Anubis identify a good bot? I'd like Google to be able to index, but want to be sure it's coming directly from Google and not a bot spoofing Google. (I'd like to think it checks the ASN or IPs to determine that.)

BTW, posting configs for Anubis is very helpful for someone like me. I absolutely refuse to use or trust AI (why contribute to our bot issues and increase the harm on our environment?), so if anyone has proven, battle-tested configs, that is the most helpful.

Somewhat related to that idea: I wish we had a way to use more of the headers in XF. I am starting to think that if a thread is locked, or we move it to an "archive" forum, we would be able to let Google and others we allow to index those threads, yet guests would have to sign up to read them. (The permission could be to let guests see thread titles and maybe a few posts as a teaser, but require joining to view the entire thread.) And the bots would have very little to chew on and not drag down the server. We could use the CF "verified bots" header to help with that, as an example.
 
Going off of my analytics this morning...

Is there any reason we should allow wowrack.com to visit our forums? My single concern is that they might operate a VPN service for end users. If not, I'm blocking them outright. They regularly appear as unmitigated traffic.
 
I would never use Country blocking.
I'm very glad we can! Zero reason for us to have anyone on our websites from many countries responsible for nefarious activities. Zero reward, all risk.
Country, IP, and ASN blocking does nothing for the residential proxies, which in many (most?) cases is the bulk of bot traffic we are seeing on our sites these days during attacks.
Even if true, that doesn't mean you shouldn't block traffic from them as a good practice..

From our recent http error report/log on residential proxies.
Scraper bursts: Several bursts of 10–20 distinct IPs hit /whats-new/posts/<id>/page-2..5, /members/.../trophies, and /posts/.../reactions within seconds (e.g., 11:21:57–11:22:09 in httperr3408.log) and were all Request_Cancelled. This is typical of distributed residential-proxy scrapers hitting uncached XenForo endpoints; your abort/rate-limiting rules are successfully cutting them off

Is there any reason we should allow wowrack.com to visit our forums?
I block all this kind of nonsense traffic on the server firewall. All risk, no reward. Extremely slim chance a small business is running an email server there and it will block emails from that network.
 
I have started working on a reverse proxy, similar to Anubis. But mine will only have the functionality I will need.

  • It will have access to the xenforo user database and will be able to positively identify logged in members and will never challenge them.
  • It will challenge logged out members and guests with a turnstile challenge (so yes, I am flirting with cloudflare again :) )

The most important difference with my own implementation is that it will positively identify search engines as well, using their reverse DNS records and their published IP lists (for DuckDuckGo). So it will be resistant to fake headers or URL parameters. The only unknown is whether its CPU requirements will be low enough. Otherwise I would be trading tens of thousands of visitors with a bogged down CPU.

Will update when I have results ...
 
How does Anubis identify a good bot? I'd like Google to be able to index, but want to be sure it's coming directly from Google and not a bot spoofing Google. (I'd like to think it checks the ASN or IPs to determine that.)

BTW, posting configs for Anubis is very helpful for someone like me. I absolutely refuse to use or trust AI (why contribute to our bot issues and increase the harm on our environment?), so if anyone has proven, battle-tested configs, that is the most helpful.

Somewhat related to that idea: I wish we had a way to use more of the headers in XF. I am starting to think that if a thread is locked, or we move it to an "archive" forum, we would be able to let Google and others we allow to index those threads, yet guests would have to sign up to read them. (The permission could be to let guests see thread titles and maybe a few posts as a teaser, but require joining to view the entire thread.) And the bots would have very little to chew on and not drag down the server. We could use the CF "verified bots" header to help with that, as an example.
Breaking down your quote a little bit here...

How does Anubis identify a good bot?
Premade rules, you can see most of them here: https://github.com/TecharoHQ/anubis/tree/main/data and googlebot is located at: https://github.com/TecharoHQ/anubis/blob/main/data/crawlers/googlebot.yaml

It validates a partial UA regex match on top of a rDNS lookup of the connecting IP.

BTW, posting configs for Anubis is very helpful for someone like me.
Feel free to ask away with Anubis stuff with XenForo configurations. The one i posted above is fairly bog-standard when it comes to a XF2 config.

For example, you can always restrict an unauthed client further by monitoring for certain URL paths, e.g., ./threads/, ./posts/. For example, if you have a ton of old, archaic threads (effectively in an 'archive like' state), let's say from 1 to 100000... you could add a rule after the xf_user cookie check that significantly (challenge levels i feel are a bit on an exponential curve) increases a challenge level from 4 to 5 or 6 when a regex match to a thread ID from 1 to 100000 is satisfied:

YAML:
  - name: challenge-old-threads
    action: CHALLENGE
    path_regex: ^/threads/(?:[^/]*\.)?(?:[1-9][0-9]{0,4}|100000)(?:/|$)
    challenge:
      algorithm: fast
      difficulty: 6
Granted, this particular regex is only good when you enforce URL rewriting with the XF2 pretty-URLs. I personally wouldn't use the example above though, as it would be blanket challenging all guests to very old threads, at a level of 6 - that will take a while to complete.


Now, a more useful item could be something like this:

YAML:
  - name: challenge-search-whatsnew
    action: CHALLENGE
    path_regex: ^/(search|whats-new)(/.*)?$
    challenge:
      algorithm: fast
      difficulty: 5
This will forcefully challenge anything (depending on where you place it in the bots: ruleset list (it's FIFO)) hitting the search or whats-new URL segments.

I wish we had a way to use more of the headers in XF.
Oh, now there's an addon idea!

Insert a browser header prefixed with X-XF-DiscussionState to denote a threads 'openness': open, closed, archived. Where archived would be a special state as an override to closed depicting the thread is exceptionally old (an addon would need to be aware of a threads last post date versus the configured limit set in the addon).

Then another for X-XF-LastModified that could use Linux epoch time to depict when a thread was last posted to. Those two headers in itself could help Anubis (and other WAF's) be a bit more dynamic. At that point, weights (thresholds) could be utilized via Anubis to dynamically set a challenge level - or a challenge at all.
 
Last edited:
This should accomplish the user logged in check. Anubis, like others, does checks against client cookies. If the cookie exists, it is validated for the name and then permits the client, bypassing the challenge:

YAML:
  - name: XenForoUserLoggedIn
    action: ALLOW
    expression:
      all:
        - '"Cookie" in headers'
        - 'headers["Cookie"].contains("xf_user=")'
This would be defeated instantly by any bot who becomes aware of the practice by simply sending a fake xf_user header.
 
This would be defeated instantly by any bot who becomes aware of the practice by simply sending a fake xf_user header.
Indeed, you're not wrong with that at all. With me posting such an Anubis rule in public, it would now be a matter of time for any knowledgeable bot-runner to update their scrapers/bots to also include some forgery mechanisms, then continue onwards with their annoyances.

Anubis can do a cookie content check via CEL operations, but it's very limited in that regard. Something like this could work:

YAML:
expression:
  all:
    - '"Cookie" in headers'
    - 'headers["Cookie"].matches("xf_user=[1-9][0-9]{0,5},")'

However, this is where using weights via the thresholds section over a basic if-this-then-that check can be taken advantaged of.
 
Going off of my analytics this morning...

Is there any reason we should allow wowrack.com to visit our forums? My single concern is that they might operate a VPN service for end users. If not, I'm blocking them outright. They regularly appear as unmitigated traffic.
It's been a single IP address, and it's an unusually high number of accesses based on all other cached traffic.

216.244.66.194

Naming and shaming here. I'm reluctant to block wowrack.com due to possibly being a VPN that our members use. They're already being challenged as an ASN so I may block the IP and see if anyone complains.

A quick check showed that no members have used this IP address. So it's garbage traffic.

Over the past seven days...

1795800842037.webp

The 2nd and 3rd IPs are Googlebot.
 
Last edited:
This would be defeated instantly by any bot who becomes aware of the practice by simply sending a fake xf_user header.
I wonder if there is a better way to do this--Cloudflare does offer "starts with" as a rule, but I've worried about fakes. Don't know if there's a better way to check for the cookie and verify the cookie came from our site.
 
It's been a single IP address, and it's an unusually high number of accesses based on all other cached traffic.

216.244.66.194

Naming and shaming here. I'm reluctant to block wowrack.com due to possibly being a VPN that our members use. They're already being challenged as an ASN so I may block the IP and see if anyone complains.

A quick check showed that no members have used this IP address. So it's garbage traffic.

Over the past seven days...

View attachment 351420

The 2nd and 3rd IPs are Googlebot.
Looking at the rdap (new-generation whois) for that IP address, and judging by it being a single IP from that provider, I'm going with a compromised machine. No normal user would be consuming up that much traffic/requests in such a short amount of time.

Code:
IP Network:
  Handle: NET-216-244-64-0-1
  Start Address: 216.244.64.0
  End Address: 216.244.95.255
  IP Version: v4
  Name: WOW-IPV4-NET3
  Type: DIRECT ALLOCATION
  ParentHandle: NET-216-0-0-0-0
  Status: active
[...]
  Event:
    Action: last changed
    Date: 2012-03-02T08:03:18-05:00
  Event:
    Action: registration
    Date: 1999-09-29T00:00:00-04:00
  cidr0_cidrs:
    v4prefix: 216.244.64.0
    length: 19

AbuseIPDB is also red-hot on that particular IP: https://www.abuseipdb.com/check/216.244.66.194

Total reports 3,068 from 121 distinct reporters
First reported December 1st 2020
Most recent report 8 hours ago
 
I wonder if there is a better way to do this--Cloudflare does offer "starts with" as a rule, but I've worried about fakes. Don't know if there's a better way to check for the cookie and verify the cookie came from our site.
This goes back to the "never trust the client, only trust the server" mindset. It's also why @Chris D made the mention above as well. Cookies from the client can always be spoofed/forged - even if your server running XenForo is aware that the cookie is spoofed/forged. XF is aware the cookie isn't "good" - thus an invalid session. The middle-man / intermediate processes remain ignorant/dumb to that issue, and blindly accept the cookie when doing a validation against it.

It would require some form of custom code between a WAF and the backend machine to efficiently communicate session legitimacy when it comes to cookie validation. Most reverse proxy configurations, with a WAF sitting in front or in the middle (be it POWBlock, Anubis, Cloudflare, whatever it may be) are absolutely ignorant to the issue of session truthfulness.

In the realm of nginx front-to-back configuration, the option of using the subrequest authentication (auth_request) does exist. However, I've not gone to the extent of implementing that... yet. Might be a good weekend project.

It could just switch IP if it's blocked, but could be worth a try.
It's a compromised machine, so not out of the question the attacks/flooding/request-hammering will temporarily cease and jump to another end point. :)
 
It's been a single IP address, and it's an unusually high number of accesses based on all other cached traffic.

216.244.66.194

Naming and shaming here. I'm reluctant to block wowrack.com due to possibly being a VPN that our members use. They're already being challenged as an ASN so I may block the IP and see if anyone complains.

A quick check showed that no members have used this IP address. So it's garbage traffic.

Over the past seven days...

View attachment 351420

The 2nd and 3rd IPs are Googlebot.
Are you on Cloudflare pro? If so you could have a separate block rule for that IP with a custom block page that's more friendly to vpn users - eg sorry this network isn't available to you right now - you're welcome to access the site from another network. Or something like that. Although I guess it could give a hint to a botmaster if anyone looks into the block.
 
This goes back to the "never trust the client, only trust the server" mindset. It's also why @Chris D made the mention above as well. Cookies from the client can always be spoofed/forged - even if your server running XenForo is aware that the cookie is spoofed/forged. XF is aware the cookie isn't "good" - thus an invalid session. The middle-man / intermediate processes remain ignorant/dumb to that issue, and blindly accept the cookie when doing a validation against it.
I have an idea, but I'm not repeating it here. Not perfect, but would be random enough that bots couldn't guess it.

I wish this thread was in a private area that the public could not view. We're openly giving away our strategies.
 
Cookies from the client can always be spoofed/forged - even if your server running XenForo is aware that the cookie is spoofed/forged. XF is aware the cookie isn't "good" - thus an invalid session. The middle-man / intermediate processes remain ignorant/dumb to that issue, and blindly accept the cookie when doing a validation against it.

It would require some form of custom code between a WAF and the backend machine to efficiently communicate session legitimacy when it comes to cookie validation.

I've been saying that for month and proposed that it would be great if XF could provide some way to support external tools with the knowledge that is exclusively in the application. I got badly bashed for that idea, by @Chris D as well as by some forum members. So you should better not expect to get applause for it.

The behavioural data you're talking about, once again, and I wish I didn't have to labour the point, isn't needed to solve the problem. We've proved that here, and I'm proving it across XenForo Cloud sites too.

As I said, most of the guests will likely be legitimate, the numbers aren't considerably higher than they ever were.

XenForo isn't going to help you protect your content. The web being crawlable and searchable and indexable is part of the normal state of affairs. Most customers want their content to reach as many people as possible, and privacy isn't really something that is relevant to this discussion. It might be for you, but that's just another example of the need for you to implement your own solutions and to stop expecting the software to do it for you.
And this was that. Now it has become even more obvious that w/o information from and connection to the application you lack information for filtering that could be helpful.
 
It would require some form of custom code between a WAF and the backend machine to efficiently communicate session legitimacy when it comes to cookie validation. Most reverse proxy configurations, with a WAF sitting in front or in the middle (be it POWBlock, Anubis, Cloudflare, whatever it may be) are absolutely ignorant to the issue of session truthfulness.
That's exactly what an authentication (and possibly authorization) layer moved upfront would do. Like in a corporate network - the default network Access Control List applied to you blocks everything except for the authentication protocol, and you don't get to do any other kind of network traffic until you get approved by a trusted authentication server. Then the ACL gets updated for you and only temporarily.

This goes against the open, anonymous foundation of the internet, where many web services are expected to respond without any authentication first. Blindly taking a cookie reported by the client without validating it is a stupid shortcut from the days of trustworthiness in the good nature of the internet, not an effective control. We are well past that stage, and I fear that in a few years we'll be getting online only with government issued certificates in hardware keys, and upfront authentication everywhere. Then the battle against bots will move from the network layer to identity faking layer...
 
Back
Top Bottom