View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0020359 | mantisbt | security | public | 2015-12-07 18:11 | 2026-11-22 16:08 |
| Reporter | atrol | Assigned To | dregad | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.3.0-rc.1 | ||||
| Target Version | 2.29.0 | Fixed in Version | 2.29.0 | ||
| Summary | 0020359: Running admin/check/index.php is possible without log in | ||||
| Description | Running admin/index.php is prevented for non administrative users by access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); However admin/check/index.php can be accessed by everyone without being logged in. and gives some output that just administrators should have access to. Of course, we recommend to remove the admin folder and there is a warning for it (as long as $g_admin_checks is not set to OFF) Anyway I think we should add at least access_ensure_global_level( config_get_global( 'admin_site_threshold' ) | ||||
| Tags | No tags attached. | ||||
I agree. With regards to our site being affected, @vboctor probably forgot to remove the admin folder after upgrading to rc1. I'll fix it. |
|
|
After initial research, we can't simply call access_ensure_global_level() because that requires access to the database (to retrieve the user's cookie in auth_get_current_user_id()). I can think of 2 ways to fix this
Since 0 !== null, auth_get_current_user_id() will return the "cached" value without trying to access the DB. The issue with this approach is that it does not display the "Access Denied" message, but redirects directly to the default page instead (because the user '0' is rightly not considered to be authenticated). Maybe not a big issue, but not consistent with the usual behavior of the system. This is a very small change, affecting only admin/check/index.php, but it's a bit of a hack.
This is probably a better implementation, but it requires modifying 2 API functions, one of which is quite central to MantisBT security so careful analysis / testing is required. Thoughts, comments or suggestions for alternative implementations welcome. |
|
|
What is the benefit for disabling admin_checks? Specially the one about whether the admin folder exists or not? We do the same check for 10 other files (custom_strings_inc.php, custom_constant_inc, ...etc). How above, we make this check only control the checks that access the database (e.g. administrator/root check), but not the directory exists check. |
|
|
@vboctor I'm confused, not sure what you are referring to. Can you please clarify ? This issue is not about disabling anything, the purpose is to prevent unauthorized users to access to the admin checks, to avoid disclosing sensitive system information. I wanted your opinion on the 2 approaches I'm proposing, or if you have a better idea to achieve that. |
|
|
Let me explain my point. I'm not a big fan of requiring login to access the administrator space. Also note a fan of a fully functioning MantisBT with no persistent warning on the screen when the admin filter exists. The reason I don't like requiring login is that we can have a cycle if we want to change the login approach / schema. You need to login to get to admin area, and you need the admin area to upgrade to get login to work. Given that I don't like the whole approach, I would be OK with the 1st approach you suggested, unless we think that forcing the warnings to always be visible when admin folder exists (independent of the admin checks flag) would be good enough. That warning can show on the login page as well as the top of any MantisBT screen as part of the header. That will only cost a check for the admin folder existence. My point was that we do N of such checks anyway for custom_strings_inc, custom_constants_inc, custom_functions_inc, etc. Hopefully that's clearer. |
|
I think this risk only exists for install/upgrade pages. Considering that the admin checks are only informational, unless I'm missing something it seems highly unlikely that restricting access to them would introduce any risk of a deadlock. I was not suggesting to block all admin pages, just the admin checks.
That may indeed be an increase in security, possibly a better approach based on the premise that admin/ remains accessible for the reasons explained before. @atrol what do you think ? |
|
|
Pinging @atrol since this is marked as 1.3 blocking. |
|
|
Have to check if this is also reproducible in 1.2.x. |
|
|
Lowered severity, 1.2.x does also allow to run some of the scripts without being logged in, e.g. admin/install.php or admin/check.php |
|
|
I believe I found a better way to achieve this compared to what I wrote in 0020359:0052099. Calling db_connect() early (at the beginning of admin/check/index.php allows a proper access check to be made in most usage scenarios, i.e. except when we cannot connect to the database. In this case we are not able to identify the user, so we have to assume they're a legit admin and continue executing the admin checks. |
|
|
MantisBT: master 0d765207 2026-09-26 19:14 Details Diff |
Prevent Admin Checks execution by non-admin users Adding an access_ensure_global_level() call at the start of the script, to deny access to non-admin users. This requires a valid DB connection to retrieve the user's cookie, so we call db_connect() first. Since it is possible that the DB is not available (e.g. running admin check to troubleshoot installation issues) we could be unable to identify the user, in which case we just continue assuming they are the admin. Since we already have a database connection, there is no need to call db_connect() again in check_database_inc.php, we can just check the status with db_is_connected(). Fixes 0020359 |
Affected Issues 0020359 |
|
| mod - admin/check/check_database_inc.php | Diff File | ||
| mod - admin/check/index.php | Diff File | ||