CVE-2026-47156: Two ways to compare a MantisBT username
MantisBT 2.28.4 shipped a fix for CVE-2026-47156, an authentication bypass in its SOAP API. I found that on PostgreSQL the fix could still be bypassed with an account whose name differs from the target's only by case. MantisBT fixed it in 2.29.0, released on 2026-11-22, and added it to the original advisory, GHSA-c2xg-qjqw-2v98, which is rated Critical, 9.3. My variant needs PostgreSQL or a case-sensitive MySQL collation, so it reaches fewer installs than the original. The MantisBT team had a patch ready within a week of my report and credited it in the advisory.
The original bug
The SOAP API lets a client send a user's cookie_string, the value in the
MANTIS_STRING_COOKIE browser cookie, in place of a password. Up to 2.28.3,
mci_check_login() only checked that the cookie belonged to some user, then logged
in as whatever username the request named:
// api/soap/mc_api.php, mci_check_login(), 2.28.3
$t_user_id = auth_user_id_from_cookie( $p_password );
if( $t_user_id !== false ) {
# Cookie is valid
if( auth_attempt_script_login( $p_username ) === false ) {
return false;
}
}
Anyone with an account, and self-registration is on by default, could send their own
cookie with the name administrator. McCaulay Hudson of watchTowr reported it first,
and four more researchers found it independently while the fix was in progress. The
MantisBT team handled all of those reports, shipped the fix in 2.28.4, and credited
every finder by name.
The first fix
2.28.4 added an ownership check before the login:
// 2.28.4
$t_user_id = auth_user_id_from_cookie( $p_password );
if( $t_user_id !== false ) {
# Cookie is valid - does it belong to the user trying to log in ?
if( 0 != strcasecmp( user_get_username( $t_user_id ), $p_username ) ) {
return false;
}
if( auth_attempt_script_login( $p_username ) === false ) {
return false;
}
}
The check compares names with strcasecmp(), which ignores case. The login still uses
the name from the request, and auth_attempt_script_login() resolves it through
user_get_id_by_name():
$t_query = 'SELECT * FROM {user} WHERE username=' . db_param();
Binding the cookie to the requested user is the right idea, and ignoring case is a
sensible choice, since that is how usernames compare on the default MySQL setup. There
the two comparisons agree and the fix holds. On PostgreSQL, which MantisBT also
supports, = on text is case-sensitive, and the two disagree.
Two accounts, one name
For the disagreement to matter, ADMINISTRATOR and administrator have to exist as
separate accounts. user_is_name_unique() checks uniqueness with the same
user_get_id_by_name() lookup, so on PostgreSQL it finds no ADMINISTRATOR and allows
it. The default username rule, /^([a-z\d\-.+_ ]+...)$/i, accepts upper case.
The attacker registers ADMINISTRATOR, logs in normally, and reads their own
MANTIS_STRING_COOKIE. They call mc_login with the name administrator and that
cookie. strcasecmp("ADMINISTRATOR", "administrator") returns 0, so the ownership check
passes. The login then looks up administrator exactly, finds the real administrator,
and opens a SOAP session for that account. The attacker never sees the administrator's
password or cookie.
The lab
The lab installs MantisBT 2.28.4 and 2.29.0 from their tags on PostgreSQL 16 with
default settings. administrator gets a random password. ADMINISTRATOR is created
through user_create(), the function self-registration ends in, so the uniqueness check
runs as it would for a signup. A script cannot pass the signup CAPTCHA, which is the only
reason it skips the signup page. The exploit logs in to the web UI as ADMINISTRATOR,
takes the cookie, and calls SOAP:

On 2.28.4 the session comes back as id 1, administrator, access level 90. On 2.29.0
the same request returns the attacker's own account, id 2, access level 25. The PoC is
on GitHub.
The second fix
Damien Regad's follow-up commit keeps the case-insensitive check and logs in with the name read from the cookie's own account:
// 2.29.0
$t_username_from_cookie = user_get_username( $t_user_id );
if( 0 != strcasecmp( $t_username_from_cookie, $p_username ) ) {
return false;
}
if( auth_attempt_script_login( $t_username_from_cookie ) === false ) {
return false;
}
Now the login always lands on the account that owns the cookie, whatever the database does with case. It is a small, precise change that closes the gap without touching how existing clients log in. The commit landed on master on 2026-09-04, about a week after my report, and shipped with 2.29.0. Upgrading is the whole fix.
Sources: advisory GHSA-c2xg-qjqw-2v98 · first fix e3571c3 · second fix c494f76 · PoC.
Takeaway
When a check proves that a credential belongs to someone, act on the identity the credential resolved to, not on the name the caller supplied. Comparing the two names is only as strong as the weakest comparison in the path, and here one ran in PHP and the other in the database. This kind of gap is easy to miss, because on the most common setup both comparisons agree. Testing a fix on a second database backend is a cheap way to catch it.
Coordinated disclosure. Reported privately to the MantisBT team on 2026-08-28. Damien Regad worked through the patch with me and landed it on 2026-09-04, a week later. It shipped in 2.29.0 on 2026-11-22, when the advisory was updated and credited the report. Thanks to Damien and the MantisBT team for a fast, open and careful process. The lab only ran on 127.0.0.1.