The vulnerability lies in a missing authorization check within MantisBT, allowing authenticated users to access attachments on private bug notes that they should not have permission to view. The analysis of the provided patch (029d9d203d9e4ae96b3e59d552fa7395cc1e5071) reveals the exact locations of this flaw.
The root cause is that the functions responsible for checking file download permissions did not properly consider the privacy status of the bugnote associated with the attachment. This was addressed by modifying the core permission-checking functions to include the bugnote's context in the authorization decision.
The investigation of the patch identified two key vulnerable functions:
-
mci_file_get in api/soap/mc_file_api.php: This function, part of the SOAP API, had a weak permission check that was replaced with a more robust one. The patch removes the flawed mci_file_can_download_bug_attachments function and instead calls the patched file_can_download_bugnote_attachments function, ensuring that bugnote privacy is respected.
-
file_can_download_bugnote_attachments in core/file_api.php: This is a core function used for checking download permissions for bugnote attachments. The original implementation was flawed as it did not use the bug's context to determine if the bugnote was private. The patch rectifies this by adding the bug ID to the function's parameters and incorporating it into the permission check.
While the vulnerability description also mentions a REST API endpoint, the provided patch primarily shows changes related to the SOAP API and core functions. It is highly probable that the REST API also relies on the vulnerable file_can_download_bugnote_attachments function, and thus the patch to this core function remediates the vulnerability in both APIs.