Repository navigation
Fix Login Only bypass at the backend login; prune lifted .htaccess blocks on unblock; bound DNS cache - #263
Merged
Merged
Conversation
Joomla's backend runs com_login for every request of a guest (or of a user without core.login.admin), whatever component the request names, except com_login and com_ajax: AdministratorApplication::findOption(), which is called when the request is dispatched, after onAfterRoute. isLoginAttemptRequest() only went by the "option" parameter, so in "Login Only" block mode a blocked address could keep trying passwords at the backend login by leaving out option=com_login, or naming any other component (e.g. POST /administrator/index.php with task=login). The checks now go by the component Joomla actually runs (requestedOption()). The exemptions for password recovery and for the unblock page use it too (the unblock pass is limited to the site), so neither lets a blocked address through to the backend's login form. The request fixture can now simulate backend requests (--admin, as a guest or as a given user) for the tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMPv7CSqgJJ93QJvYfL
…fixes With blocking through .htaccess, unblocking an address in the component's block list or with an emailed unblock link only recorded the unblock in the database. The line in .htaccess stayed until the plugin blocked the next address or ran its daily maintenance, so the web server kept rejecting the address for up to a day. The removal of lifted blocks moves from the plugin class into HtaccessHelper::removeLiftedBlocks(), so com_bfstop can call it right after it unblocked something (see the com_bfstop branch of the same name). ComponentTest gets tests for that and for the other com_bfstop fixes: unblocking several blocks at once no longer stops at one which was lifted already, every sortable column header is one the list model accepts, and block durations (a week, 30 days, progressive ones) are shown as text instead of language keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMPv7CSqgJJ93QJvYfL
#__bfstop_dnscache was only cleaned up by purgeOldEntries(), which doesn't run with a purge age of 0, and had no row limit. With the reverse-DNS risk signal on, every failed login from a new address adds a row, and an IPv6 client can use a new address for every attempt. The daily maintenance now deletes expired entries (nothing reads them any more) and keeps the table to 10000 rows, oldest first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMPv7CSqgJJ93QJvYfL
…omponent fixes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMPv7CSqgJJ93QJvYfL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plugin half of a bug/security review of plugin and component. The component changes are in codeling/com_bfstop#31 (same branch name), which CI picks up automatically.
Changes
Security: "Login Only" block mode could be bypassed at the backend login (
9965e72)Joomla's backend runs com_login for every request from a guest, or from a user without
core.login.admin, whatever component the request names (com_login and com_ajax are the only exceptions). This happens inAdministratorApplication::findOption(), which runs at dispatch, afteronAfterRoute.isLoginAttemptRequest()only checked theoptionparameter. So in Login Only mode, a blocked address could keep trying passwords withPOST /administrator/index.phpandtask=login, either leavingoptionout or naming any other component (option=com_cpanel&task=login, …).requestedOption()returns the component Joomla will actually run, and the login check uses it.tests/Integration/fixtures/request.phpcan now simulate backend requests (--admin, as a guest or as a named user). The new tests inBlockedRequestTestfail onmain(request 'task=login' should be blocked) and pass here.Lifted blocks are taken out of
.htaccessright away (e770bbb)Unblocking in the component, from the block list or with an unblock link, only recorded the unblock in the database. The web server kept rejecting the address until the next block or the daily maintenance. The removal logic moves from
Bfstop::removeLiftedHtaccessBlocks()intoHtaccessHelper::removeLiftedBlocks()so the component can call it. This commit also adds the ComponentTest tests for all the component fixes in com_bfstop#31.The reverse-DNS cache is pruned daily, whatever the purge age (
6feadd4)#__bfstop_dnscachewas only cleaned up inpurgeOldEntries(), which never runs with a purge age of 0, and it had no row limit. With the reverse-DNS risk signal on, every failed login from a new address adds a row, and an IPv6 client can use a new address for every attempt. The newpruneDnsCache()runs in the daily maintenance: it deletes expired rows and keeps at most 10000, oldest first.CHANGELOG (
21d05fd)None of these affect the released 1.5.x. Login Only mode, removing lifted .htaccess blocks and the reverse-DNS signal are all new in 2.0.0.
Checked and not changed
Form::filter()only outputs posted fields, soparamsstays as stored.Uri::base(), so it follows the request's Host header unlesslive_siteis set. This is the same as Joomla's own reset mails. In "any address" mode, a forged Host can put a foreign domain into the unblock mail.enabledForOrigin, so failed logins through API basic auth aren't counted.#__bfstop_failedloginhas no index onipaddress, so the per-IP counts scan the table (it is capped at 200000 rows).Testing
Run locally against Joomla 5.4.10 on PostgreSQL 16, with the package built from both branches and installed by
tests/ci/install-joomla.sh:phpunit --testsuite unit,integration: 388 tests OK (381 onmainplus 7 new), 3 skipped for environment reasons (running as root; MySQL-only checks).UnblockPageHttpTestwas also run after deploying the changed code into the site.check-versions,check-language,check-workflows,check-joomla-checksums,check-zip,composer validate --strict,php -land xmllint all pass.Generated by Claude Code