# 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
attacker_repPASS
5
original text
10
```
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
attacker_repPASS
29
EDITED - REPORTER level, should be denied at threshold 55
```
Expected:
```xml
Client
Access Denied
```
Actual:
```xml
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
true
```
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
29
EDITED - REPORTER level, should be denied at threshold 55
50
```
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 );
}
```