View Issue Details

IDProjectCategoryView StatusLast Update
0034433mantisbtsecuritypublic2024-05-12 12:34
Reporterrednaxela Assigned Todregad  
PrioritynormalSeveritymajorReproducibilitysometimes
Status closedResolutionfixed 
OSDebian GNU/LinuxOS Version12 (Bookworm) 
Product Version2.26.1 
Target Version2.26.2Fixed in Version2.26.2 
Summary0034433: CVE-2024-34077: Account Takeover in Password Reset and Account Registration Feature
Description

The password reset and account registration feature is vulnerable to broken access control, it's possible to send HTTP request to /account_update.php with verify_user_id that belongs to another user account. However, this exploit only works when the following criterial is met:

  1. For password reset, target username and email must be known.
  2. Link in the email must be clicked / opened, either by the user or "checked" automatically by some sort of security feature within the email. When the link is clicked / opened, data type 6 and value of 1 will be updated to the mantis_tokens_table.
  3. Target user have not sent request to the /account_update.php to change the password.
Steps To Reproduce
  1. Reset both user 1 (current user) and user 2 (target user) password or register two new users (e.g. user 1 and user 2).
  2. Click the reset password link that belongs to user 2 (target user). In a real scenario, attack with user interaction (for example by tempting the target user to click the link using "phising" email) or security feature within email that will automatically "check" the link will be needed.
  3. Open the reset password link received within email that belongs to user 1 (current user).
  4. Follow the link until the edit account page is being shown.
  5. Fill the form, submit it, intercept the request, tamper the value of verify_user_id parameter (e.g. from 2 to 3), and send the request.
  6. Login using to an account which identified by the verify_user_id.

===

Note:
If the user 2 (target) previously have used either the password reset or user registration feature, and somehow the link has been clicked without the user performing actual password change to the /account_update.php, then step 1 is not needed.

Since normal user won't be able to know which registration link has been clicked and which registration link belong to whom (don't have database access), brute force attack can be performed within the value of the verify_user_id parameter when sending request to the /account_update.php

Additional Information

https://github.com/mantisbt/mantisbt/security/advisories/GHSA-93x3-m7pw-ppqm

I would like to be credited for the finding.
Name: Alexander Christian
Company: Vantage Point Security Indonesia

TagsNo tags attached.
Attached Files
1 - user 1 reset password.png (189,464 bytes)   
1 - user 1 reset password.png (189,464 bytes)   
1.2 - user 2 reset password.png (186,691 bytes)   
1.2 - user 2 reset password.png (186,691 bytes)   
3 - reset password link.png (17,670 bytes)   
3 - reset password link.png (17,670 bytes)   
5.2 - original request.png (107,444 bytes)   
5.2 - original request.png (107,444 bytes)   
5.3 - tampered request.png (174,651 bytes)   
5.3 - tampered request.png (174,651 bytes)   
7 - login successful.png (31,719 bytes)   
7 - login successful.png (31,719 bytes)   
8.1 - brute force attempt.png (134,193 bytes)   
8.1 - brute force attempt.png (134,193 bytes)   
8.2 - brute force result.png (241,922 bytes)   
8.2 - brute force result.png (241,922 bytes)   

Activities

dregad

dregad

2024-05-05 05:39

developer   ~0068885

Many thanks for the detailed report, I'm looking into it.

dregad

dregad

2024-05-05 11:15

developer   ~0068886

Last edited: 2024-05-05 11:16

I had a look and can confirm the issue.

In fact it's even worse than you describe, because it is actually possible to reset the password of any user that has a pending TOKEN_ACCOUNT_VERIFY, without the attacker even owning an account, using a brute-force approach calling account_update.php with increasing user IDs with a simple request like so:

curl -X POST http://example.com/mantisbt/account_update.php --data 'verify_user_id=XXX&password=NEW_PWD&password_confirm= NEW_PWD'

For the record, even after this vulnerability is fixed, it will not be possible to be 100% bulletproof in a password reset/account creation scenario - if the attacker somehow obtains the confirmation hash, they will be able to reset the target user's password and there is nothing we can do about it (referring to point 2 of your steps to reproduce).

rednaxela

rednaxela

2024-05-05 12:36

reporter   ~0068887

I agree with you, if the attacker gains access to the confirmation_hash, then the account is highly likely to be compromised. What I'm concerned about in the 2nd step of step to reproduce is if the link got "accidentally opened" without changing the actual password, then the account will have the pending TOKEN_ACCOUNT_VERIFY.

However, I believe it should be sufficient to include the confirmation_hash or a similar validation during password reset / registration, it can help to determine whether the current request is authorized to perform password changes for the given user_id.

dregad

dregad

2024-05-05 12:59

developer   ~0068888

I believe it should be sufficient to include the confirmation_hash or a similar validation during password reset / registration

Yep, this is precisely how I was planning to address this issue.

We use Github advisories to handle CVE requests and code review for security fixes. Please let me know your Github user id, so I can grant you access to a private fork for you to review and test the patch.

rednaxela

rednaxela

2024-05-05 21:47

reporter   ~0068892

Last edited: 2024-05-06 01:51

Sure, my Github user id is 54769255 (https://github.com/redna-xela)

dregad

dregad

2024-05-06 04:07

developer   ~0068893

my Github user id is 54769255

Thanks, I actually meant username, not id, sorry ;-)

I added you to the Github Advisory GHSA-93x3-m7pw-ppqm. You will also find a proposed patch there. Please review, feedback is welcome.

rednaxela

rednaxela

2024-05-06 05:20

reporter   ~0068894

Last edited: 2024-05-06 05:22

Thank you, I'll look into this and get back to you as soon as possible.

rednaxela

rednaxela

2024-05-06 06:10

reporter   ~0068895

Thanks for waiting! I've reviewed the patches, and everything looks good. I've also confirmed that the previous vulnerability is no longer exploitable.

dregad

dregad

2024-05-06 06:26

developer   ~0068897

Thanks for the feedback, that was quick :-)
Are you also happy with the advisory's wording, CVSS evaluation and selected CWE ?

I'm now waiting for a CVE ID to be assigned.

rednaxela

rednaxela

2024-05-06 07:55

reporter   ~0068898

Thanks for asking. The advisory's wording, CVSS evaluation and selected CWE already looks good to me, but I would like to suggest the following if possible:

  • Impact: "A successful attack could grant the attacker full access to the compromised account, including sensitive information or functionalities associated with the account" or something similar.
  • CVSS Scoring: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:L
  • Workarounds: I think it's better if we provide the workaround according to what has been done, which is by adding additional validation to the /account_update.php

For the CVSS scoring, I believe the impact could be worse depending on who uses it and what kind of data is being stored, hence the C:H and I:H. Attack Complexity changed to High because successful attack cannot be accomplished at will, but rather need some perquisites to be fulfilled.

I appreciate any feedback you may have.

dregad

dregad

2024-05-06 08:31

developer   ~0068899

Last edited: 2024-05-06 08:36

Impact: "A successful attack could grant the attacker full access to the compromised account, including sensitive information or functionalities associated with the account"

OK sounds good.

C:H and I:H

This is somewhat subjective, and as you say depends on external factors, in particular the access level of the account that gets hijacked.
I did not want to paint things too black considering that the probability of a successful attack is quite low

Attack Complexity changed to High because successful attack cannot be accomplished at will, but rather need some perquisites to be fulfilled.

I set it to low initially, because a brute-force attack can be launched at will and very easily, as explained in 0034433:0068886, even if the probability of success would be very low without some preparation work (e.g. social engineering to trick users so there are actual requests pending). Someone could just get lucky...

provide the workaround according to what has been done, which is by adding additional validation

The idea was to have a quick and simple to implement option to reduce the risk, until a patch was available.

I guess the point is kind of moot, as I would make the Advisory public together with the patch and 2.26.2 release, so anyone could either a) upgrade or b) apply the patch.

rednaxela

rednaxela

2024-05-06 09:34

reporter   ~0068900

Thanks for your input! I'm on board with you regarding the CVSS Scoring, I guess it would be better to use the previous score you've provided to avoid inflating the perceived risk. I also see your point about the workaround section, we can leave it as is.

I think that's all, no further feedback from me based on what we've discussed :)

dregad

dregad

2024-05-06 10:16

developer   ~0068901

Great, thanks for your collaboration.
I reverted the CVSS change, now back to 7.3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L

dregad

dregad

2024-05-06 10:37

developer   ~0068902

CVE-2024-34077 assigned

Related Changesets

MantisBT: master-2.26 92d11a01

2024-05-05 20:09

dregad


Details Diff
Validate confirm hash when updating account

This prevents an attacker from resetting another user's password if they
have an incomplete account validation or password reset request pending.

Fixes 0034433, CVE-2024-xxxxx
Affected Issues
0034433
mod - account_update.php Diff File
mod - verify.php Diff File

MantisBT: master-2.26 b12b1f8b

2024-05-05 20:18

dregad


Details Diff
Use g_reauthentication_expiry to set token timeout

The timeout of the account verification token (TOKEN_ACCOUNT_VERIFY) is
now set based on the $g_reauthentication_expiry config, instead of the
TOKEN_EXPIRY_AUTHENTICATED constant.

With default settings this does not change the system's behavior, but
ensures there is a consistent timeout with other "secure" pages that
require reauthentication and allows the admin to change the timeout,
which was not possible before.

The timeout is applied regardless of whether reauthentication is
enabled or not.
Affected Issues
0034433
mod - verify.php Diff File