The 19-year-old hacker Joe Balhis has discovered the way to delete any comment on Facebook by leveraging a session validation flaw and a cross-site request forgery (CSRF) vulnerability. The expert highlighted that the attacker did not require access to the victim’s Facebook profile and the attack was effective even against users who were not friends with the attacker, and users with private profiles.
The Lebanese expert has published an advisory on Vulnerability Lab explaining that an attacker could have deleted any comment simply by replacing the values of the comment_id and legacy_id parameters in a web request.
“Th vulnerability is located in the comment id and legacy id of the comments function. Remote attackers with low privileged user accounts are able to delete postings of other users without auth. The attacker can intercept the session and exchanged the comment and legacy id to delete or add for example comments.” states the advisory.
The expert discovered the flaw by capturing the header data related to a delete request, the hacker posted a random comment on Facebook, deleted it and analyzed the header information.
At this point, the attacker can delete every comment by knowing its comment_id and legacy_id, to discover them he just needs to “Like” them and sniff the request that include both data.
Finally, the attacker sends a delete request to Facebook containing the values of the comment_id and legacy_id parameters related to the targeted comment.
Manual steps to reproduce the vulnerability are
01. Login to your facebook account 02. Put a comment anywhere to a random post 03. Remove your comment by usage of the standard function in facebook 04. Capture the headers information on requesting to delete 05. Go to the victim account (any account not friend or there friends) because the issue works to both 06. Like his comment and capture the request by intercepting the values 07. Change your comment id with the victim comment id that you and change the legacy id 08. Replay the tampered request with the manipulated values 09. Now the comment will be unauthorized removed 10. Successful reproduce of the security vulnerability that allows to delete any comment of other users. thanks!
The attack could be easily automated to delete a large number of comments by guessing comment_id values.
“If I entered a random id and it was the id of an existing comment, it would be deleted permanently,” the expert said to securityweek.com. “The victim (target) user account can’t do anything. He can’t protect his comments. I need his comment id and it is easy to get [from] the source of Facebook,” the researcher explained via email. “Ever when you visit a Facebook post you can see in the source of the site the user specific comment ids.”
Balhis reported the flaw to Facebook that patched it 2014, but the researcher disclosed the details of the attack only now after that Facebook awarded him a $12,500 bounty. The expert also published a video PoC of the attack.
The disclosure of the vulnerability arrives a few days after the researcher Laxman Muthiyah reported a serious vulnerability in the Facebook Graph API that could have been exploited to delete users’ photo albums.
(Security Affairs – Facebook, hacking)