While IP Threat Monitor works perfectly fine since the last updates and gives me ease of mind and an almost bot-free forum I recognized over the last days that once more occasinally some bots from blocked countries and ASNs slipped through. Few and, as it seemed, somewhat randomly, but still unexpectedly and clearly against the ruleset.
I could not find a reason directly, however, today I found the cause and it turned out to be rather an edge case than a bug (the more as I caused it myself). But it could be worth hedging by
@Osman as the issue could pop up independently from my changes as well, even if only rarely.
What has happened?
In the latest versions of IP Threat Manager the generic 403-block-message has been replaced by various dedicated ones, depending if a block was based on a blacklist, an ASN, the proxycheck API or a country block. I had edited the phrase for the older version a while ago and included a link to the login-page tho avoid that logged out forum members that live in or travel to a blocked country or get caught in error get stuck but rather are able to log in and use the forum. This had worked flawlessly and helped those forum members.
For the latest version I had not yet done this for the new messages but finally did this week after a forum member from a blocked country contacted me as he was stuck in the error message. Worked again flawlessly. But shortly after the slipping through of blocked bots started.
I found a helpful error in the server error log (to be precise: hundreds of them) that were related to IP Threat Manager and told me (unexpectedly in German) I should use a value of 255 characters or less.
Code:
XF\PrintableException: IP Threat Monitor: Bitte gib einen Wert mit 255 Zeichen oder weniger ein. src/XF/Mvc/Entity/Entity.php:1276
Generated by: Unknown account Nov 19, 2026 at 4:19 PM
#0 src/addons/XENTR/IPThreatMonitor/Repository/IPThreatLog.php(331): XF\Mvc\Entity\Entity->save()
#1 src/addons/XENTR/IPThreatMonitor/Service/RateLimiter.php(445): XENTR\IPThreatMonitor\Repository\IPThreatLog->blockIP('150.228.135.24', 300, 'Guest access fr...')
#2 src/addons/XENTR/IPThreatMonitor/Listener.php(175): XENTR\IPThreatMonitor\Service\RateLimiter->checkRateLimit()
#3 src/XF/Extension.php(86): XENTR\IPThreatMonitor\Listener::appPubStartEnd(Object(XF\Pub\App))
#4 src/XF/App.php(3382): XF\Extension->fire('app_pub_start_e...', Array, NULL)
#5 src/XF/Pub/App.php(255): XF\App->fire('app_pub_start_e...', Array)
#6 src/XF/App.php(2836): XF\Pub\App->start(true)
#7 src/XF.php(850): XF\App->run()
#8 index.php(23): XF::runApp('XF\\Pub\\App')
#9 {main}
Unfortunately I did not tell me where.

But the stack trace pointed towards the 403 error messages of IP threat manager and luckily the IP related to the error was included.
Outcome
By adding the link to the login page I had extended the phrase a bit, using more characters than the original message had. All the errors I checked affected IPs that belonged to a blocked ASN. Yet still by far not all IPs blocked by ASN-blocks slipped through but only some. The error that I see seems to exclusively affect the ASN message. It turned out that the cause for that seems to lie in the Name of the ASN. It is displayed in the 403-error message and expanded through a variable. If the name of the ASN is very long the message gets longer than 255 characters and then IP Threat Manager gets into an error state and lets the IP pass. This happens independently from if the IP is from a blocked country or part of the existing blacklist already.
Example slipped through ASNs name despite ASN and country are blocked:
Example: Country is blocked, yet some requests pass:
Example: IP let pass despite being in the blacklist:
While the issue in this case seems to be caused by my phrase extension it could also affect the stock configuration if only the name of the ASN is long enough. Also, in theory, it could be affect other phrases as well in theory (even when unedited) if variables can be of unlimited length.
Recommendations
- If the 255 character limit for the phrases could be extended this would be good.
- Failure handling should be improved: Checking should not silently die when an error occurs and (as in my cases) the IP would have blocked by a country rule or the blacklist rule well. Skipping the rule where an error occurs may be fine, but checking through the ruleset should continue.
- Catching and handling this specific error would probably be a good idea: While I love the expansion of the ASN name in the error message possibly a check if the message with the expanded ASN-name is more than the character limit and if it is cutting the ASN name accordingly would possibly be a good idea.
- Also, a somewhat clearer error message in the log and/or a hint for existing errors in the IP Threat Manager Dashboard would be helpful.
Migitating the error
I had written the phrases a bit more detailed, not being aware of the 255 character limitation. I've now cut the lenght of the phrase drastically so the probablity for the error should now be massively lower. If anyone has edited the 403-phrases and especially the ASN phrases as well you probably should care to shorten it within reason.