There are over 2.32 billion monthly active users on Facebook, and It gets scary when someone can hack your account just by sharing a constructed link. A recent Facebook hack can do the very same, just one click by the victim and the hacker could gain access to complete Facebook user account.
How Facebook Hack was Discovered
A critical cross-site request forgery (CSRF) vulnerability was discovered in Facebook that allows an attacker to take control of another Facebook account by fooling victim to click on a link. The fooling of victim and making them click the link is known as Social Engineering , when you just have to get a click it is the most easiest of things to do.
Although, the attacker must trick the victim into clicking a special link for the attack to be successful. An attacker could have been gaining full access to a Facebook account or posting anything on their timeline, changing or deleting their profile picture, and even trick users into deleting their entire Facebook accounts.
Proof of Concept
A vulnerable Facebook endpoint along with parameters and a POST request to that endpoint and adding the fb_dtsg parameter exploit to gain access to victim’s account. As endpoint resides on Facbook.com domain, it is easier to trick the victim to click on the link.
The vulnerable endpoint
where XXXX is the endpoint with parameters where the POST request is going to be made (the CSRF token fb_dtsg is added automatically to the request body). The same attack vector can be further modified to perform a number of other actions on victim’s Facebook profile, which will be explained below.
Making a post on the timeline
When the victim clicks on the link , a post defined by the hacker will be made on victims Facebook Wall
Deleting Profile Picture
This is self explanatory , this link once executed will simply delete the profile picture set by victim on Facebook.
Hacker can also delete complete Facebook profile by using this URL, “locale” parameter could have been used to change language.
A password confirmation will be required; if the victim enters his password, then his account will be deleted.
Gaining full access of Facebook account
Full access of Facebook account could have been obtained by adding an email address or phone to victim’s account. It requires two separate links to be sent to the victim, one to add email or phone and one to confirm it to redirect the user after a successful request. You might think that 2 links seems alot , but keep in mind that these 2 links will be having www.facebook.com as domain , thus the chances of success are really high and this time they are not punycode domains but actual domain.
However, Samm0uda managed to create a single link by using the endpoints which have “next” parameter. He shared four steps to create a unique link for hacking into a Facebook account.
Authorizing an app on behalf of victims to obtaining Facebook access token
This step use the endpoint /v3.2/dialog/oauth to bypass Facebook redirect protection in the “next” parameter which blocks redirecting attempts to external websites even if they are made using Link Shim.
Second to identify each victim using the token received which will help later to extract the confirmation code for that specific user.
The attacker website receives the access token of the user , creates an email for him under that domain and redirect the user to :
It links an email to the user account using the endpoint /add_contactpoint/dialog/submit/ (no password confirmation is required).
After the linking, it redirects to the selected endpoint in “next” parameter:
which will redirect to the “ATTACKER_DOMAIN” again with the user access_token.
The attacker website receives the “access_token”, extract the user ID then search for the email received for that user and gets the confirmation link then redirects again to :
(CODE and HASH are in the email received from Facebook)
This method is simpler for the attacker but after the linking the endpoint redirects the victim to https://www.facebook.com/settings?section=email which expose the newly added email so the confirmation could be done using the /confirm_code/dialog/submit/ endpoint which have a “next” parameter that could redirect the victim to the home page after the confirmation is made.
The email is now added to the victim account, the attacker could reset the password and takeover the account. The attack seems long but it’s done in a blink of an eye and it’s dangerous because it doesn’t target a specific user but anyone who visits the link in step 1
Two-factor authentication can prevent from full account takeover because it requires verification of passcode sent to users mobile but some actions such as posting something on the timeline, deleting and changing profile picture or deleting Facebook account cannot be prevented.
Facebook has fixed the vulnerability on 31st January 2019 and paid out $25,000 to the researcher for reporting this particular bug bounty, which is still not the highest bounty paid by Facebook but a great find indeed.