View Issue Details

IDProjectCategoryView StatusLast Update
0037201mantisbtsecuritypublic2026-11-22 16:08
Reporterbyteoverride Assigned Todregad  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Target Version2.29.0Fixed in Version2.29.0 
Summary0037201: Authorization bypass in mc_issue_note_update due to boolean coercion of Integer threshold
Description

The mc_issue_note_update() function in the SOAP API has a broken authorization check that allows any authenticated user to edit their own bugnotes regardless of the bugnote_user_edit_threshold setting. The code retrieves the threshold using config_get() which returns the integer value as a string (e.g., "55"), then uses it in a boolean context with !$t_user_can_update_own_bugnote. In PHP, !"55" evaluates to false, so the access denial condition never triggers. A REPORTER-level user (access_level 25) can edit their own notes even when bugnote_user_edit_threshold is set to DEVELOPER (55).

This is the same bug class as CVE-2026-42070 (GHSA-pq86-j2c2-47f6), which was fixed in mc_issue_update() by commit 6e58fae using the correct access_has_bugnote_level() function. That fix was not applied to mc_issue_note_update(), which still uses the broken boolean coercion pattern.

Vulnerability Details

Type: Incorrect Authorization (CWE-863)
CVSS 3.1: 7.1 High -- AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N
Related: CVE-2026-42070, GHSA-pq86-j2c2-47f6, MantisBT issue 0037089

Affected File: api/soap/mc_issue_api.php

Broken code at lines 1508-1512:

$t_user_owns_the_bugnote = bugnote_is_user_reporter( $t_issue_note_id, $t_user_id );
$t_user_can_update_own_bugnote = config_get( 'bugnote_user_edit_threshold', null, $t_user_id, $t_project_id );
if( $t_user_owns_the_bugnote && !$t_user_can_update_own_bugnote ) {
    return mci_fault_access_denied( $t_user_id );
}

Why it fails:

  1. config_get('bugnote_user_edit_threshold') returns "55" (string, because the default is linked via '%update_bugnote_threshold%')
  2. !"55" evaluates to false in PHP (any non-empty string is truthy)
  3. true && false = false
  4. The mci_fault_access_denied() call is never reached

Fixed code in mc_issue_update (commit 6e58fae, lines 1191-1196):

$t_user_owns_note = $t_bugnote->reporter_id == $t_user_id;
$t_edit_threshold = $t_user_owns_note ? $t_bugnote_user_edit_threshold : $t_update_bugnote_threshold;
if( !access_has_bugnote_level( $t_edit_threshold, $t_bugnote_id, $t_user_id ) ) {
    return mci_fault_access_denied( $t_user_id , "Not allowed to update note $t_bugnote_id" );
}

This correctly uses access_has_bugnote_level() which compares the user's access level against the threshold numerically, instead of treating the threshold as a boolean.

PHP Proof of Boolean Coercion Bug

require_once 'core.php';

$val = config_get('bugnote_user_edit_threshold');
var_dump($val);      // string(2) "55"
var_dump(!$val);     // bool(false) <-- ALWAYS false for any non-empty/non-zero config value
var_dump(!DEVELOPER); // bool(false)

// The denial condition:
$t_user_owns = true;  // user owns the note
$t_threshold = $val;   // "55"
var_dump($t_user_owns && !$t_threshold); // bool(false) <-- NEVER denies
Steps To Reproduce

Steps to Reproduce

Environment: MantisBT 2.29.0-dev, PHP 8.3, MariaDB 11.8

Accounts used:

  • testuser (user_id=2, access_level=25/REPORTER), owns bugnote 0000002

Step 1: Verify testuser is REPORTER and owns note 0000002

SELECT id, username, access_level FROM mantis_user_table WHERE id=2;
-- Result: id=2, username='testuser', access_level=25

SELECT id, reporter_id, bug_id FROM mantis_bugnote_table WHERE id=2;
-- Result: id=2, reporter_id=2, bug_id=1

Step 2: Verify bugnote_user_edit_threshold is DEVELOPER (55)

echo config_get('bugnote_user_edit_threshold');
// Output: 55

testuser (25) is below the threshold (55). They should NOT be able to edit notes.

Step 3: Edit own note via mc_issue_note_update

curl -s -H "Content-Type: text/xml" http://TARGET/api/soap/mantisconnect.php -d '<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect">
  <soap:Body>
    <man:mc_issue_note_update>
      <man:username>testuser</man:username>
      <man:password>password123</man:password>
      <man:note>
        <man:id>2</man:id>
        <man:text>EDITED BY REPORTER bypassing bugnote_user_edit_threshold=DEVELOPER</man:text>
      </man:note>
    </man:mc_issue_note_update>
  </soap:Body>
</soap:Envelope>'

Expected behavior: SOAP fault "Access denied" because REPORTER (25) is below DEVELOPER (55) threshold.

Actual behavior: Returns mc_issue_note_updateResponse with no fault. Note text changed.

Step 4: Verify note was modified

SELECT bn.id, bnt.note FROM mantis_bugnote_table bn
JOIN mantis_bugnote_text_table bnt ON bn.bugnote_text_id=bnt.id WHERE bn.id=2;
-- Result: "EDITED BY REPORTER bypassing bugnote_user_edit_threshold=DEVELOPER"
Additional Information

Impact

Any authenticated user can edit their own bugnotes through the SOAP API regardless of the bugnote_user_edit_threshold configuration. This is especially impactful in organizations that:

  1. Set bugnote_user_edit_threshold to DEVELOPER or higher to prevent reporters from modifying their notes after submission (for audit compliance, legal holds, or process integrity)
  2. Use bugnotes as evidence in code review, QA signoff, or compliance workflows
  3. Rely on note immutability for regulatory or contractual requirements

The fix for CVE-2026-42070 (commit 6e58fae) addressed the identical bug class in mc_issue_update() using access_has_bugnote_level(). Applying the same pattern to mc_issue_note_update() would fix this vulnerability.

Recommended Fix

Replace lines 1508-1512 with the same pattern used in the CVE-2026-42070 fix:

$t_user_owns_the_bugnote = bugnote_is_user_reporter( $t_issue_note_id, $t_user_id );
$t_bugnote_user_edit_threshold = config_get( 'bugnote_user_edit_threshold', null, $t_user_id, $t_project_id );
$t_update_bugnote_threshold = config_get( 'update_bugnote_threshold', null, $t_user_id, $t_project_id );
$t_edit_threshold = $t_user_owns_the_bugnote ? $t_bugnote_user_edit_threshold : $t_update_bugnote_threshold;
if( !access_has_bugnote_level( $t_edit_threshold, $t_issue_note_id, $t_user_id ) ) {
    return mci_fault_access_denied( $t_user_id, 'Not allowed to update this bugnote' );
}

This replaces the boolean coercion check (!$threshold) with the proper access_has_bugnote_level() comparison.

Affected Versions

MantisBT 2.29.0-dev (current develop branch). The broken boolean coercion has been present in mc_issue_note_update() since the function was introduced, so stable 2.x releases are affected. The CVE-2026-42070 fix (commit 6e58fae) was only applied to mc_issue_update().

TagsNo tags attached.

Relationships

related to 0037089 closeddregad CVE-2026-42070: REST/SOAP mc_issue_update Embedded Note Update Bypasses Note-Level Authorization 
has duplicate 0037350 closeddregad MantisBT SOAP mc_issue_note_update() own-note edit-threshold check is fail-open (boolean coercion) 
has duplicate 0036980 closeddregad SOAP Note Update Bypasses bugnote_user_edit_threshold for Note Authors 
has duplicate 0037493 closeddregad SOAP mc_issue_note_update: note-owner edit threshold bypassed and view_state change unchecked 

Activities

dregad

dregad

2026-05-30 06:20

developer   ~0071189

Thanks for the report, I'll look into it.

dregad

dregad

2026-08-22 13:23

developer   ~0071366

Advisory https://github.com/mantisbt/mantisbt/security/advisories/GHSA-6x7h-hm8p-xch9 created and CVE request sent.

Related Changesets

MantisBT: master b7cd66ce

2026-08-22 13:06

dregad


Details Diff
Prevent bugnote edit auth bypass via SOAP API

Due to boolean coercion of integer threhsold, any authenticated user
could edit their own bugnotes regardless of bugnote_user_edit_threshold
with mc_issue_note_update endpoint.

Calling access_has_bugnote_level() fixes the problem.

Amending similar access check in mc_issue_update() to cover the
(unlikely) scenario where configuration sets bugnote_user_edit_threshold
higher than update_bugnote_threshold, which would prevent a user allowed
to update any bugnote from editing their own (see Issue 0037089).

Fixes 0037201, GHSA-6x7h-hm8p-xch9
Affected Issues
0037089, 0037201
mod - api/soap/mc_issue_api.php Diff File