Pinterest runs a public bug bounty program on Bugcrowd. The Pinterest security team has fixed the vulnerability and has allowed me to publish this blog.
This was a simple CSRF vulnerability that could modify any user’s email id and username thereby leading to account takeover, this vulnerability was severe because there are 250 million monthly active users on Pinterest.
Note: All accounts used to demonstrate the vulnerability are test accounts
What was the bug?
While browsing through “https://www.pinterest.com”, I observed that the CSRF tokens are passed through the http header “X-CSRFToken”,so to validate the implementation of the CSRF token I used the below request, this request is used to modify the user settings
POST /_ngjs/resource/UserSettingsResource/update/ HTTP/1.1
X-CSRFToken: <CSRF Token>
1)Firstly, I removed the “X-CSRFToken” header from the above POST request and forwarded it, this gave an error in the response saying “/resource/UserSettingsResource/update/ didn’t finish after 8 seconds”,which meant that the CSRF token was being validated.
2)Then I changed the POST request to a GET and forwarded the request(without the”X-CSRFToken” header) this time I got “200 ok” as the response.
The CSRF token was not getting validated when the POST request was converted to a GET
Note: This was an application wide CSRF, as most of the endpoints in the application were vulnerable to this
As this is a GET based CSRF , all we need to do is to craft a link as shown below(this link can be crafted using the “change request method” option in burp suite):
when a user clicks on the above link his username and email id changes to “dummyuser” and “email@example.com” respectively(the email id “firstname.lastname@example.org” is under my control and has been used in the crafted link) .
After the successful CSRF attack, I browsed to the following link to reset the password:
I entered the email id as “email@example.com” ,I then received an email from Pinterest along with a password reset link (“firstname.lastname@example.org” is currently the email id of the user who clicked on the crafted link, as the email id was modified due the CSRF vulnerability)I used this password reset link to reset the password and login to the user’s account
I would like to thank the Pinterest Security Team for fixing the vulnerability quickly and allowing me to disclose this submission and the Bugcrowd team for properly handling and coordinating the report.
1st December 2018: Vulnerability Reported
7th December 2018: Triaged
7th December 2018: Pinterest rewarded a bounty of $2400
7th December 2018: Vulnerability Fixed