View Issue Details

IDProjectCategoryView StatusLast Update
0036831mantisbtldappublic2026-01-21 11:55
Reporterspiditt Assigned To 
PriorityhighSeverityblockReproducibilityhave not tried
Status feedbackResolutionopen 
Product Version2.28.0 
Summary0036831: Administrative lockout risk: Lack of local database fallback when LDAP authentication is enabled
Description

Problem: In the current version of MantisBT, the authentication method is globally defined via $g_login_method. When set to LDAP, the system strictly enforces LDAP authentication. This creates major issues. If the LDAP server is down or misconfigured, local administrator accounts (stored in the Mantis DB) cannot be used to fix the settings without manually editing config_inc.php on the filesystem to disable LDAP.

Proposed change: I propose modernizing the authentication flow by introducing a "Fallback to Local" mechanism. If a user is not found in the LDAP directory, MantisBT should attempt to authenticate the user as the local user. This approach would allow for a coexistence of LDAP-managed users and local emergency accounts, providing a seamless and secure experience just like in Zabbix, etc. Alternatively, MantisBT should allow defining a "Primary" (LDAP) and "Secondary" (Internal - MD5, BASIC_AUTH or HTTP_AUTH) authentication backend.

Proposed technical implementation: It appears that this could be resolved by a relatively minor modification of the auth_attempt_login() function within: core/authentication_api.php. Currently, the function checks the global $g_login_method and proceeds with only one method. The function should be updated to handle a fallback scenario. If LDAP authentication fails (e.g., user not found in directory or server connection error), the function should not return false immediately. Instead, it should proceed to verify the credentials against the local database as a secondary check.

TagsNo tags attached.

Activities

dregad

dregad

2026-01-21 11:55

developer   ~0070723

I agree this could be convenient, however please consider

If the LDAP server is down

This is a somewhat theoretical and unlikely scenario, in my opinion... In every company I've worked for, the LDAP / Active Directory is a critical infrastructure and therefore measures are taken to avoid any downtime (high-availablity).

or misconfigured

In that case you'd have to update your config file to restore access to Mantis, so if you really need to login, you can simply change the login method temporarily.

this could be resolved by a relatively minor modification of the auth_attempt_login() function

I did not look at the code, but you need to make sure that this plays nice with authentication plugins.

Speaking of which, I'm pretty sure it would be possible to achieve such a fallback feature easily with an Auth plugin, without touching the core.
Please have a look at https://github.com/mantisbt-plugins/SampleAuth.