[CRACKED] Facebook's phstamp

StellaArtois

BANNED
Joined
Jun 13, 2011
Messages
104
Reaction score
357
Anyone who has a toolbar and noticed it's stopped working, or anyone wanting to write a bot, or software, that makes requests to Facebook will find this interesting.

Recently Facebook added a new parameter to their query strings when making post requests. Such as inviting to events, sharing content etc. At the end of the URL you will notice: &phstamp=00000000000

Some would be fooled into thinking phstamp is some sort of timestamp. It's not. It's a hash that's generated per request to verify the request. I managed to crack it ...

Code:
function generatePhstamp(qs, dtsg) {
    var input_len = qs.length;
    numeric_csrf_value='';

    for(var ii=0;ii<dtsg.length;ii++) {
        numeric_csrf_value+=dtsg.charCodeAt(ii);
    }
    return '1' + numeric_csrf_value + input_len;
}

Usage:
- qs = Query string. (Monitor headers with LiveHTTPHeaders to get the query string of a post request on Facebook). Example:

profileChooserItems=%7B%22100001541993045%22%3A1%7D&checkableitems[0]=100001541993045&eid=277408643980689&message=&submit=Submit&nctr[_mod]=pagelet_event_header&__d=1&post_form_id=499dd7c2c44195206f9782df391dc858&fb_dtsg=AgHtQHVb&lsd&post_form_id_source=AsyncRequest&__user=100009910333869&phstamp=165816710081728698224

(exclude '&phstamp=165816710081728698224' when passing in the query string).

- dtsg = This if the fb_dtsg value.

And that's how you generate a phstamp hash :D

Hint ... this relates to the recent spurt of events popping up with millions of invites. Do you're own research on that, I won't be leaking that at this point (don't PM me for the exploit either please).
 
Last edited:
I don't what how i can deal with it, but anyway a big thank you :)

If anyone one know how to exploit it, shot me a PM asap i work with traffic outside US/UK :)

PS: StellaArtois, i've sent you a PM some days ago but without a reply back :) if you can give me just one minute of your time i'll be very happy :)
 
Thanks man, I was looking for this... You saved me!
 
No worries. If anyone needs any help using it feel free to ask questions.
 
phstamp parameter is added to requests for adding/removing admins from pages, but I found it was basically ignored and requests worked fine with random numbers. Also, I noticed it increases a bit with every new request, so it does look like a timestamp anyway.

What kind of requests fail if phstamp is not set correctly?
 
Im pretty sure phstamp is for their own logging, and not in any way required for proper authentication. Although it wouldnt hurt to post the correct data.
 
Im pretty sure phstamp is for their own logging, and not in any way required for proper authentication. Although it wouldnt hurt to post the correct data.

I had issues with a few things that wouldn't work without the correct phstamp. But, as others have said in some cases it can work without it, or with a random number.

To the poster above phatzilla, it's defiantly not a timestamp :p You can see what the function does.
 
Thanks a lot this was useful. Not sure if I need this for the action I'm trying to recreate but just incase I'm going to add it. Great threads, keep it up StellaArtois :)
 
thanks! this helped me a lot!

for the record: removing applications from an account works with a random phstamp...

where is this phstamp generated? i have been looking through the java scripts and could always find every post param (e.g in __e("AsyncRequest")). however, i did not find the phstamp, where is it generated and added to the request?
 
My doubt is:

is this that people have used to steal Fan Pages ?

I received a warning from a person who ADD me in Facebook.


THE MESSAGE I RECEIVED IN MY PROFILE IN FACEBOOK:


Thank you for your friendship, its great to meet you...
first and foremost stay out of Female Fitness Models page...
It was taken up by this internet terrorist and you might be in danger
[...]
I can help you promote it (your page) if you want but I need to check stats first to see what is the problem...
[...]
I run a business and that guy just steals pages and gets people more fans by sharing it on other pages...he then steals your page...if you are friends, he can hack into your personal account and steal your page (if he really wants to) without having to be admin...

you have been doing something very long for a very long time...Fitness #### went up by 200 fans since last night and yours basically moved...

I need to see what is the problem to help you out, I will not trash and/or spam your page...I am offering my help for FREE as part of promoting my new fitness portal....


if you are friends, he can steal your password and then access your page...I am not begging you for admin access I just really need to know what's going on...

What I intend to do is share your page on all of my pages one at a time and then check page insights to see where my fans are coming from...once I see bad traffic (kids under 17, old people, and people from Malasya, Indonesia, and other Arab Countries)...I stop and share on other pages


Since you don't believe me, check page insights on the left...
If you think I will steal, trash, spam your page, then we have no business together...this is based on trust and you must trust me to do this...I have over 120 pages on my faceurbiz portal (look up faceurbiz) and about 100 more that I didn't add cause of Mazen...
 
Hi, I'm working on some Facebook reverse engineering. Do you have any info about the __e("AsyncRequest") or similar stuff?

thanks! this helped me a lot!

for the record: removing applications from an account works with a random phstamp...

where is this phstamp generated? i have been looking through the java scripts and could always find every post param (e.g in __e("AsyncRequest")). however, i did not find the phstamp, where is it generated and added to the request?
 
Is there any way to use this to speed up the fb event invite process?? Right now fb only lets me send 300 at a time
 
Really priceless information. You saved me a lot of headaches
 
I'm just convert your code to C# : :D

/// <summary> /// Generate phpstamp on facebook
/// </summary>
/// <param name="qs"></param>
/// <param name="dtsg"></param>
/// <returns></returns>
public static string generatePhstamp(string qs, string dtsg) {
var input_len = qs.Length;
string numeric_csrf_value = String.Empty;


for(var ii=0; ii<dtsg.Length; ii++) {
numeric_csrf_value += Strings.AscW(dtsg[ii]);
}
return '1' + numeric_csrf_value + input_len;
}

Work like charm for me :D
 
is there anyone who can teach me how to get my phstamp code for my facebook profile...i really need this and its very urgent.:(
i will be realy thankful if someone can do it for me :(
 
is there anyone who can teach me how to get my phstamp code for my facebook profile...i really need this and its very urgent.:(
i will be realy thankful if someone can do it for me :(

Me too, somebody help me, pls. Thanks
 
Back
Top