I was pretty excited to hear about Google trying to set a standard for social network applications. I wasn’t so happy to notice a serious omission in the way security is handled. Executive Summary: no user authentication! Any user can forge anybody else’s identity when interacting with any OpenSocial application. As it currently stands, it is not possible to write secure social applications on the platform. For example, with any messaging application, anybody could message another user’s friends and it will seem like the latter did it. Or they could post embarrassing material and it would look like someone else posted it. Or they could read any information that is supposed to be shown only to the application user, such as private notes. Details: in order for an application to securely handle user data, it must know who the user is. Also, it should not be possible to impersonate a user. For this to happen, it is not enough for the client-side (e.g. JavaScript) to pass the user-id to the application back-end. It must also pass some kind of token that authenticates the user and cannot be forged by third parties. For example, it’s not enough for a container name (e.g. “orkut”) and a user id (e.g. “123456789”) to be passed. You’d need another piece of information that could only be generated by Orkut, in order to prove that this really is their user and that it’s not a random third party claiming to be the same person. If you don’t do this, anybody can look at the JavaScript code in a debugger and substitute whatever user ID and container name they want. They will then be able to deface the application by taking any action as the original user and be able to read any private information stored in the application on behalf of that user. How FaceBook does user authentication: Facebook provides a secret key to the application developer. This key is stored on the server-side of the application and is never transmitted on the wire. Facebook signs the security sensitive headers of the request, including the user ID. The application can verify the signature using the shared secret key. This is a relatively standard way of performing authentication and Facebook gets it right. How this could be implemented in OpenSocial: A solution can be constructed by use of authentication namespaces, secret key exchange and signatures. A user ID would be a URL of the form: https://orkut.com/container/people/12345 where https://orkut.com/container/ is the namespace and 12345 is the user ID. The application XML descriptor would include a callback URL. The callback would happen in two stages: first the container hits the callback URL to inform the application that a new container-to-application binding is requested for the container https://orkut.com/container/ and provide a one-time key. The application would then hit https://orkut.com/container/bind and pass back the one-time key and the application URL. The container would return the shared secret. The application could also hit the bind URL without a one-time key in case the shared secret was lost to ask that the exchange be repeated. Now that we have a secret key, every time the application’s box is displayed, the container would pass a a user ID, a unique timestamp and a signature of these values to the client-side of the application (JavaScript). In PHP pseudocode: $sig = md5($userid . $stamp . $secret) . The JavaScript code would pass these along with the request. An impersonator would not be able to generate a valid signature on any user ID other than their own.
Comments
Ramon on
What google’s concept is saying: “Hey you are already in my secure container, you worry about the api and I worry about the container.” All of Google’s partners have stopped providing their own containers and will adopt the new SDK as soon as it’s release.
devrandom on
Mat on
Ramon if you could give me the url of your app, maybe a demo could be in order.
Mat
Ramon on
Well you can verify if the ID provided is the actual owner of the ID, that’s the first security ‘breach’ solution. Second: Don’t make your application authentication focused, make it owner to friends focused. Third: Implement Ajax calls to verify and/or block any feature you think can be hacked (hijacking, etc.).
Sorry, but I cannot give a url right now due to still on going development but once I get into a beta version I will send you the link. Best, Ramon
devrandom on
You’ll have to provide more details, your comment is not clear to me.
What do you mean by “you can verify the ID …”? There is no functionality in the API to verify IDs.
The second item needs clarification. What kind of application doesn’t care about ID spoofing?
The third item doesn’t make sense, because Ajax is just another way to connect to the back end. It does not provide any additional authentication means.
Thanks.
Tony Stubblebine on
Hopefully, I’d feel better about the security holes if someone on the Google side acknowledged that they rushed everything in order to get there press releases out and that they were in fact committed to working through these issues publicly.
devrandom on