Adding Used Primary Email Address to attacker account and Account takeover
The application checked whether an email address already existed before adding it to an account, but a trailing space in the submitted address bypassed that check. An attacker could then add a victim's primary email to their own account, receive the victim's payment emails and use password reset to take over the account.
Originally disclosed on HackerOne
- Disclosed after 4 days
Summary by the researcher
tl;dr: This bug is informational and has low severity.
The report
Summary
I just found that the Gratipay is vulnerable for adding used Primary Email Address to attacker account and Account takeover of the Gratipay.
Description
I was looking at the source code of the application and I found that, "If the email address [email protected] is already added in the X Gratipay account as primary email address, then the attacker can also add the [email protected] in the Y Gratipay account".
The above attack can be achieved by using the add-email action and updating the address parameter with payload once you login to the account.
Steps To Reproduce
As you can see the line number 123 which is looking for the email address if it exists in the database.
Normal behavior - When user will use the [email protected] it is exists in the database it will not allow you add the email address in the different account, according the Line number 123.
Attack - When the attacker try to add the [email protected] which is already added into the other user's Gratipay account, however he can still add the other account's primary email into the attacker's Gratipay account as primary email.
Payload: action=add-email&[email protected]%20 all you need to append the %20 (%20 is treated as the space but below line 123 is considering as new email address)
https://github.com/gratipay/gratipay.com/blob/04b85c20c681eab433e021fb9ce7d7a4258c7202/gratipay/models/participant/email.py#L123
Once the above line executed then line number 131 and the application will send verification link to the email address.
If the Victim's email address is stolen or the attacker have temporary access to the email, then attacker can create new account on the Gratipay and add the Victim's email address into this Gratipay account. The attacker will receive all the Payment related emails and using forgot my password attacker can takeover the account.
PoC
Kindly find the attached screen shot.
Patch
On the line number 314 the application updating the table without verifying that, "the requested email address is already exists in the database and assigned to other account".
The simple patch would be verifying the space encoding characters and also verifying the account is already exists in the database and assigned to the other account.
If you have any question or you need video PoC then let me know I'll prepare it separately.
Cheers.
Attachments


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
Root cause
Likely the duplicate-email check compared the raw submitted string, so a trailing space made an existing address look new, and the later database update did not re-verify uniqueness.
Impact
If the attacker has temporary access to the victim's email, they could receive the victim's payment emails and use password reset to take over the account; the researcher rates this as low severity and informational.
What the attacker needed
A Gratipay account; temporary access to the victim's email; victim's email already registered
The fix
The application should normalise the submitted address and verify that it does not already exist and belong to another account before updating the table.
How it was found
- Log in to a Gratipay account.
- Submit the add-email action with an address that already belongs to another account, followed by an encoded space.
- The duplicate check treats the value as a new address and a verification link is sent.
- A verification link is sent to the 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 sign up, a site usually checks that an email address is not already used by someone else. Here that check could be fooled by adding a space at the end of the address, so the same email was accepted twice. The attacker then controls an account tied to the victim's email, which can lead to taking over the victim's account through password reset.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.