Invisible Arbitrary CSRF Profile Picture Upload in Facebook
The profile picture upload endpoint did not properly validate anti-CSRF tokens, allowing an attacker to force a logged-in user to upload an arbitrary image as their profile picture. The attacker could do this invisibly via JavaScript or with a simple form, provided they knew the victim's profile identifier.
Meta
Published on sneaked.net
Profile picture upload form in facebook.com was vulnerable to CSRF. The vulnerability resided in http://upload.facebook.com/picupload.php and allowed an attacker to force a user to change its profile picture.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the server did not validate the anti-CSRF tokens (post_form_id and fb_dtsg) on the profile picture upload endpoint, accepting requests without them.
Impact
An attacker could change a victim's profile picture to an arbitrary image without their consent, but only if the victim was logged in over HTTP (not HTTPS) and the attacker knew the victim's profile identifier.
What the attacker needed
Victim logged into Facebook; victim uses HTTP, not HTTPS; attacker knows victim's profile ID; victim visits malicious page
The fix
Facebook fixed the vulnerability by properly validating the anti-CSRF tokens.
How it was found
- The attacker creates a malicious web page containing a form or JavaScript that sends a POST request to the upload endpoint with the victim's profile ID, type=profile, and an image file.
- The attacker tricks the victim into visiting the malicious page while the victim is logged into Facebook over HTTP (not HTTPS).
- The victim's browser automatically includes Facebook cookies in the request, and the server accepts the upload without validating CSRF tokens.
- The attacker's chosen image is set as the victim's profile picture without the victim's knowledge.
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 write-up has not been written yet. The Original tab links to the source.
A CSRF (Cross-Site Request Forgery) attack tricks a logged-in user's browser into sending a request to a website they are already logged into, without their knowledge. Here, the profile picture upload form did not check secret tokens properly, so an attacker could make the victim's browser upload a picture chosen by the attacker. The victim only had to visit a malicious page while logged into Facebook.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.