by the_mitsuhiko · 15y ago · 0 comments
For instance if you have website a and say the user profile "mitsuhiko" can only be edited when you are logged in as "mitsuhiko" on http://a.example.com/profile/edit/mitsuhiko you could use this code to see if the logged in user is "mitsuhiko":
<script type="text/javascript" src="http://a.example.com/profile/edit/mitsuhiko"
onload="user_is_logged_in()" onerror="user_is_logged_out()" async="async"></script>
Why does this work? Because onload is fired if the resource answers with 200 OK, not if it's a valid script. onerror is called for any other error code.So if you know what you are probing for: easy.
// Edit: Yes, this is most likely not what Facebook is doing if that's their only method of security. However see my reply to the first comment here about the security aspect for a possible way to solve this problem.
Also, for something like that you should use <img> instead so it's less of an XSS risk.
Yes. But depending on how gmail works it could me made reliable and secure. For instance if you can share images with gmail users you could generate a unique image for that user, do the same thing with an <img> tag, access the image data with JavaScript, send it back to the server and compare if the contents are the one you shared.
I do not have a gmail account so I don't know if this is possible, it it seems like it would be possible for Google+ from briefly looking at it.
https://grepular.com/Abusing_HTTP_Status_Codes_to_Expose_Pri...
GMail doesn't seem to be working any more though. But the concept is still useful to learn.