Bots/Web Scrappers in 2025
#21
Just read a fewpages, the only intelligent thing is "use cloudflare" (or any system like it).

Nothing in forum core can really stop bots, because they must be stopped before they access the front page. And the php can only react to a front load. So the answer is before the server or before the page is loaded.
Tchat en français
Do not ask me help through PM or Discord

Reply
#22
(2025-10-18, 02:54 PM)xxcorrosionxx Wrote: Im sure if mybb started to make you pay for there developments the spam bots would dissapear. Until then, since its source is public, its predictable.

I am looking into this code for the htaccess file.  What do you think?  It was posted here:  .htaccess - Blocking bots with apache htaccess - Server Fault


Quote:<IfModule mod_rewrite.c>                                                                             
RewriteEngine on                                                                                     
RewriteBase /                                                                                                                                                                                           
# block “AI” bots                                                                                                                                                                                                 
RewriteCond %{HTTP_USER_AGENT} ^.*(AdsBot-Google|Amazonbot|anthropic-ai|Applebot|Applebot-Extended|AwarioRssBot|AwarioSmartBot|Bytespider|CCBot|ChatGPT|ChatGPT-User|Claude-Web|ClaudeBot|cohere-ai|DataForSeoBot|Diffbot|FacebookBot|facebookexternalhit|Google-Extended|GPTBot|ImagesiftBot|magpie-rawler|omgili|Omgilibot|peer39_crawler|PerplexityBot|YouBot|AhrefsBot|Barkrowler|SemrushBot|DotBot).*$ [NC]                                                                                                       
RewriteRule .* - [F,L]                                                                                 
</IfModule> 

(2025-10-18, 10:22 PM)Crazycat Wrote: Just read a fewpages, the only intelligent thing is "use cloudflare" (or any system like it).

Nothing in forum core can really stop bots, because they must be stopped before they access the front page. And the php can only react to a front load. So the answer is before the server or before the page is loaded.

Thanks..

That explains why all of the changes do squat to these SQL draining attacks.



Edit to add:  I used the rule for the htacess file above.  It took my SQL from 98% down to 62% average.  I now have spikes in SQL usage but not a constant 98% and forum slowing.  Some bots still get by but we are finding the range of IP's they are coming from and blocking.  Its much better but there has to be a better way to stop these things.
Reply
#23
(2025-10-18, 10:47 PM)Billy_Bob Wrote:
(2025-10-18, 02:54 PM)xxcorrosionxx Wrote: Im sure if mybb started to make you pay for there developments the spam bots would dissapear. Until then, since its source is public, its predictable.

I am looking into this code for the htaccess file.  What do you think?  It was posted here:  .htaccess - Blocking bots with apache htaccess - Server Fault


Quote:<IfModule mod_rewrite.c>                                                                             
RewriteEngine on                                                                                     
RewriteBase /                                                                                                                                                                                           
# block “AI” bots                                                                                                                                                                                                 
RewriteCond %{HTTP_USER_AGENT} ^.*(AdsBot-Google|Amazonbot|anthropic-ai|Applebot|Applebot-Extended|AwarioRssBot|AwarioSmartBot|Bytespider|CCBot|ChatGPT|ChatGPT-User|Claude-Web|ClaudeBot|cohere-ai|DataForSeoBot|Diffbot|FacebookBot|facebookexternalhit|Google-Extended|GPTBot|ImagesiftBot|magpie-rawler|omgili|Omgilibot|peer39_crawler|PerplexityBot|YouBot|AhrefsBot|Barkrowler|SemrushBot|DotBot).*$ [NC]                                                                                                       
RewriteRule .* - [F,L]                                                                                 
</IfModule> 

(2025-10-18, 10:22 PM)Crazycat Wrote: Just read a fewpages, the only intelligent thing is "use cloudflare" (or any system like it).

Nothing in forum core can really stop bots, because they must be stopped before they access the front page. And the php can only react to a front load. So the answer is before the server or before the page is loaded.

Thanks..

That explains why all of the changes do squat to these SQL draining attacks.



Edit to add:  I used the rule for the htacess file above.  It took my SQL from 98% down to 62% average.  I now have spikes in SQL usage but not a constant 98% and forum slowing.  Some bots still get by but we are finding the range of IP's they are coming from and blocking.  Its much better but there has to be a better way to stop these things.

1.) Turn on Bot Fight Mode (or Super Bot Fight on Pro).
2.) Add rate limiting (or WAF rules) for hot endpoints:
xmlhttp.php, search.php, member.php?action=profile, showthread.php with long querystrings.
3.) Managed Challenge for “AI/SEO bots” UAs you listed (don’t outright block or you’ll chase UA changes forever).
4.) Cache Everything for guests on index/forum display pages (bypass cache on cookies mybbuser/sid).
5.) mod_security (OWASP CRS): enable; add a custom rule to challenge traffic that hits xmlhttp.php/search.php at high frequency.
6.) fail2ban: create an Apache/Nginx jail that bans IPs doing, e.g., > 300 req/5m or > 30 /search.php in 1m.
https://www.youtube.com/watch?v=kgdoVeyoO2E
7.) mod_evasive (Apache) or nginx limit_req (Nginx) for simple burst control.

8.) Smarter .htaccess (keep it simple & safe)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# 3.1 Block empty or obviously scripted UAs
RewriteCond %{HTTP_USER_AGENT} ^\s*$ [OR]
RewriteCond %{HTTP_USER_AGENT} (curl|wget|python-requests|java|okhttp|libwww|httpclient) [NC]
RewriteRule ^ - [F,L]

# 3.2 Your “AI/SEO” bot list -> 403 (can move these to CF WAF as a Challenge instead)
RewriteCond %{HTTP_USER_AGENT} (AdsBot-Google|Amazonbot|anthropic-ai|Applebot|Awario|Bytespider|CCBot|ChatGPT|Claude|cohere-ai|DataForSeoBot|Diffbot|facebookexternalhit|Google-Extended|GPTBot|ImagesiftBot|magpie|omgili|Omgilibot|peer39|PerplexityBot|YouBot|AhrefsBot|Barkrowler|SemrushBot|DotBot) [NC]
RewriteRule ^ - [F,L]

# 3.3 Overly long querystrings (cheap SQL drains)
RewriteCond %{THE_REQUEST} \?
RewriteCond %{QUERY_STRING} .{1024,}
RewriteRule ^ - [F,L]

# 3.4 Disallow uncommon/abused methods
RewriteCond %{REQUEST_METHOD} !^(GET|POST|HEAD)$
RewriteRule ^ - [F,L]
</IfModule>

# 3.5 Deny access to obvious garbage
<FilesMatch "(\.env|composer\.(json|lock)|package\.json|yarn\.lock|phpunit|\.git|\.hg|\.svn)">
  Require all denied
</FilesMatch>


MyBB knobs that actually reduce DB work
10.) Guests: disable “Who’s Online” & member list for guests; add a search cooldown and require login for search.
11.) Flood control: set post flood & search flood (ACP → Configuration).
12.) CAPTCHA/Turnstile/hCaptcha on register & any guest actions; add StopForumSpam integration (plugin).
13.) Limit AJAX for guests: many scrapers hammer xmlhttp.php; challenge that path in WAF for non-cookie’d users.
14.) Hide heavy widgets from guests (stats blocks, top posters, big counters).

SQL dropped from 98% → 62%: UA blocking removed the “polite” crawlers; spoofers and distributed hosts kept going. Moving those checks to the edge with challenges + rate limits is what will cut it further (usually into the teens), and caching guest pages drops the remaining read load.

Rule A – Challenge hot endpoints for non-logged-in users (guests):
(if
  (http.request.uri.path in {"/xmlhttp.php" "/search.php" "/private.php" "/member.php" "/misc.php"})
  and not http.cookie contains "mybbuser="
)
then Managed Challenge


Rule B – Nuke junk user-agents (keep this tight):
(if
  http.user_agent eq "" or
  http.user_agent ~ "(curl|wget|python-requests|java|okhttp|libwww|httpclient|masscan|nmap)"
)
then Block


Rule C – Rate abuse to showthread/forumdisplay (query floods):
(if
  (http.request.uri.path in {"/showthread.php" "/forumdisplay.php"})
  and not http.cookie contains "mybbuser="
  and http.request.method in {"GET" "HEAD"}
  and (len(http.request.uri.query) > 1024 or contains(http.request.uri.query, "sid="))
)
then Managed Challenge
Looking for great MyBB plugins & themes?
Join MyBBForge — The Forge is growing, check out our collection!
👉 Come forge something awesome with us.
Reply
#24
(2025-10-19, 01:53 AM)xxcorrosionxx Wrote:
(2025-10-18, 10:47 PM)Billy_Bob Wrote:
(2025-10-18, 02:54 PM)xxcorrosionxx Wrote: Im sure if mybb started to make you pay for there developments the spam bots would dissapear. Until then, since its source is public, its predictable.

I am looking into this code for the htaccess file.  What do you think?  It was posted here:  .htaccess - Blocking bots with apache htaccess - Server Fault


Quote:<IfModule mod_rewrite.c>                                                                             
RewriteEngine on                                                                                     
RewriteBase /                                                                                                                                                                                           
# block “AI” bots                                                                                                                                                                                                 
RewriteCond %{HTTP_USER_AGENT} ^.*(AdsBot-Google|Amazonbot|anthropic-ai|Applebot|Applebot-Extended|AwarioRssBot|AwarioSmartBot|Bytespider|CCBot|ChatGPT|ChatGPT-User|Claude-Web|ClaudeBot|cohere-ai|DataForSeoBot|Diffbot|FacebookBot|facebookexternalhit|Google-Extended|GPTBot|ImagesiftBot|magpie-rawler|omgili|Omgilibot|peer39_crawler|PerplexityBot|YouBot|AhrefsBot|Barkrowler|SemrushBot|DotBot).*$ [NC]                                                                                                       
RewriteRule .* - [F,L]                                                                                 
</IfModule> 

(2025-10-18, 10:22 PM)Crazycat Wrote: Just read a fewpages, the only intelligent thing is "use cloudflare" (or any system like it).

Nothing in forum core can really stop bots, because they must be stopped before they access the front page. And the php can only react to a front load. So the answer is before the server or before the page is loaded.

Thanks..

That explains why all of the changes do squat to these SQL draining attacks.



Edit to add:  I used the rule for the htacess file above.  It took my SQL from 98% down to 62% average.  I now have spikes in SQL usage but not a constant 98% and forum slowing.  Some bots still get by but we are finding the range of IP's they are coming from and blocking.  Its much better but there has to be a better way to stop these things.

1.) Turn on Bot Fight Mode (or Super Bot Fight on Pro).
2.) Add rate limiting (or WAF rules) for hot endpoints:
xmlhttp.php, search.php, member.php?action=profile, showthread.php with long querystrings.
3.) Managed Challenge for “AI/SEO bots” UAs you listed (don’t outright block or you’ll chase UA changes forever).
4.) Cache Everything for guests on index/forum display pages (bypass cache on cookies mybbuser/sid).
5.) mod_security (OWASP CRS): enable; add a custom rule to challenge traffic that hits xmlhttp.php/search.php at high frequency.
6.) fail2ban: create an Apache/Nginx jail that bans IPs doing, e.g., > 300 req/5m or > 30 /search.php in 1m.
https://www.youtube.com/watch?v=kgdoVeyoO2E
7.) mod_evasive (Apache) or nginx limit_req (Nginx) for simple burst control.

8.) Smarter .htaccess (keep it simple & safe)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# 3.1 Block empty or obviously scripted UAs
RewriteCond %{HTTP_USER_AGENT} ^\s*$ [OR]
RewriteCond %{HTTP_USER_AGENT} (curl|wget|python-requests|java|okhttp|libwww|httpclient) [NC]
RewriteRule ^ - [F,L]

# 3.2 Your “AI/SEO” bot list -> 403 (can move these to CF WAF as a Challenge instead)
RewriteCond %{HTTP_USER_AGENT} (AdsBot-Google|Amazonbot|anthropic-ai|Applebot|Awario|Bytespider|CCBot|ChatGPT|Claude|cohere-ai|DataForSeoBot|Diffbot|facebookexternalhit|Google-Extended|GPTBot|ImagesiftBot|magpie|omgili|Omgilibot|peer39|PerplexityBot|YouBot|AhrefsBot|Barkrowler|SemrushBot|DotBot) [NC]
RewriteRule ^ - [F,L]

# 3.3 Overly long querystrings (cheap SQL drains)
RewriteCond %{THE_REQUEST} \?
RewriteCond %{QUERY_STRING} .{1024,}
RewriteRule ^ - [F,L]

# 3.4 Disallow uncommon/abused methods
RewriteCond %{REQUEST_METHOD} !^(GET|POST|HEAD)$
RewriteRule ^ - [F,L]
</IfModule>

# 3.5 Deny access to obvious garbage
<FilesMatch "(\.env|composer\.(json|lock)|package\.json|yarn\.lock|phpunit|\.git|\.hg|\.svn)">
  Require all denied
</FilesMatch>


MyBB knobs that actually reduce DB work
10.) Guests: disable “Who’s Online” & member list for guests; add a search cooldown and require login for search.
11.) Flood control: set post flood & search flood (ACP → Configuration).
12.) CAPTCHA/Turnstile/hCaptcha on register & any guest actions; add StopForumSpam integration (plugin).
13.) Limit AJAX for guests: many scrapers hammer xmlhttp.php; challenge that path in WAF for non-cookie’d users.
14.) Hide heavy widgets from guests (stats blocks, top posters, big counters).

SQL dropped from 98% → 62%: UA blocking removed the “polite” crawlers; spoofers and distributed hosts kept going. Moving those checks to the edge with challenges + rate limits is what will cut it further (usually into the teens), and caching guest pages drops the remaining read load.

Rule A – Challenge hot endpoints for non-logged-in users (guests):
(if
  (http.request.uri.path in {"/xmlhttp.php" "/search.php" "/private.php" "/member.php" "/misc.php"})
  and not http.cookie contains "mybbuser="
)
then Managed Challenge


Rule B – Nuke junk user-agents (keep this tight):
(if
  http.user_agent eq "" or
  http.user_agent ~ "(curl|wget|python-requests|java|okhttp|libwww|httpclient|masscan|nmap)"
)
then Block


Rule C – Rate abuse to showthread/forumdisplay (query floods):
(if
  (http.request.uri.path in {"/showthread.php" "/forumdisplay.php"})
  and not http.cookie contains "mybbuser="
  and http.request.method in {"GET" "HEAD"}
  and (len(http.request.uri.query) > 1024 or contains(http.request.uri.query, "sid="))
)
then Managed Challenge

In what file do I place the Rules listed above to challenge?  I got the Htaccess file rewritten, but where do I need to place the challenges?
Reply
#25
The challenges go in your Cloudflare WAF (or domain->security -> rules in the free Cloudflare account).
Reply
#26
(2025-10-29, 06:58 PM)Dave H Wrote: The challenges go in your Cloudflare WAF (or domain->security -> rules in the free Cloudflare account).

Our hosting services do not include this program. 

Thank you for the answer.  I will ne looking for other alternatives.
Reply
#27
My hosting service doesn't include cloudflare either but I can still use it.

Cloudflare does its work prior to your hosting service. At your registrar, you point your domain at cloudflare's name servers and they give out IP addresses for their own servers that can analyze, possibly block and possibly cache accesses to your host.
Reply
#28
A strange thing some months ago, when I was forced to dig into all this stuff, was that I simply couldn't understand how this whole "business" was not regulated to a level much higher than it already is.(?)

But government entities in a supposedly democratic nation are always slow to new stuff. There was a time you could build and fly your own fixed wing. Could drive an automobile without a license.

Now, in some nations where there is one-party rule (one-family rule) they have that bot stuff under control. So much so, they write codes for their own bots and have schools under that government's control that instructs folks how to use bots. Well, I guess even the "free" nations have government agencies that run bots and steal information from us. But they have a "judge" give them permission. Maybe "privacy" is an illusion.

As this web scrapping business gets bigger and bigger and more sophisticated it will eventually become dangerous and governments are going to have to step in and declare *enough-is-enough*. I mean, there are some smaller online communities that have been hit very hard by this bot/web scrapper stuff. AND there are folks getting mighty rich selling ways to stop those bots and web scrappers.

It's kind of like a weird game of chess and the pieces on the board are *us* - the white pieces / and *them" the black pieces - - - and *them* are the ones that have the most money.

Eventually, some government representative that gets that job through an election process is going to have to make a stand and put a stop to all this scrapping of information from all that we do on the Net.

One example is when I log into some sites now I see I am asked to either use an email address or a phone number. Imagine what sort of trouble that leads to; my little Star Trek phone starts getting message after message of folks (or automated systems) trying to sell me all sorts of stuff. Five/Ten/Twenty incoming calls an hour because some web scrapper was able to grab that phone number off some site. To some degree that is already happening. What's worse, is younger folks don't know what it was like way back when all one needed was a cool User ID and a password to gain entry to anything on the Net. Some younger folks seem to think that Star Trek phone number should be free for all to see, like they did with the first phone books back when that telephone got all important for folks to have. UNLESS you ordered the phone company NOT to put your phone number in that book.

Funny, too, I think I am now remembering that some security system run by Google --- that ID a bus/bicycle/signal thingy --- that is not going to be free soon. You might have been relying on that for a long time and now you have to pay for it.

How long before CloudFlare goes that route? Over on phpBB some member came right out in a post and asked that staff if they were getting paid to push CloudFlare so much like they are doing.

The Net is really getting weird. And not a 'good' weird. My belief is the whole Net needs control by an international governing body. Or we do it ourselves. We, on the Net, become our own "nation" and declare independence and "we" control who walks our streets and taps into our private lives.

Of course, "streets" not of concrete or bricks or stones or wood.
Reply
#29
(2025-10-30, 02:18 PM)Dave H Wrote: My hosting service doesn't include cloudflare either but I can still use it.

Cloudflare does its work prior to your hosting service.  At your registrar, you point your domain at cloudflare's name servers and they give out IP addresses for their own servers that can analyze, possibly block and possibly cache accesses to your host.

I am looking into Cloud Flare. I am waiting for a return call from their rep. I hope to get this fixed soon.
Reply
#30
I must admit that I didn't even know that calling was an option.  (Maybe because I currently only use the free plan.)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)