Living Without Sessions
peej.co.uk
peej.co.uk
I'll bet this guy's not fun to be in design meetings with.
The classic (and best) method for foiling these attacks is to store a special/randomized token in a server-side session, and require that token to be submitted from the client via a standard form, essentially making forged attacks impossible. Take away the ability to store these tokens in some sort of server-side session, and you open your site to attack?
Basically it’s done like this:
1. The server passes a random string to the client
2. The client performs a calculation on the password and the random string
3. The client passes the username (in plain text) and the result of the calculation to the server
4. The server performs the same calculation as the client did and compares the output to the output of the client.
5. If it’s a match, the client is authentic.
In the case of tickets, the one signing is "this server then" and the one checking is "this server now", with a period of amnesia (about the data, not about the password) in between.
A forged request can't guess the HMAC key, and a forged request with an invalid key is refused. A replay is disallowed after the timeout. The server can also keep track of "spent" tickets until they would have timed out, preventing a replay even during the timeout period.
Seriously, if you want security, use SSL.
Problem 1: protection from session hijack across a series of requests. Solution: tickets.
Problem 2: protection from interception and alteration of the commands within one request. Solution: SSL.
SSL (even in its most powerful form as a password-protected client-side CA-signed cert!) provides no protection against problem 1.
SSL, on the other hand does nothing to prevent a cross-site attack. Anything that can run code in the client browser can in principle cause it to send a fraudulent shopping cart "securely" to the server.
His client example is riddled with security and integrity issues. People don't like accidentally closing a tab and losing everything.
His server example is just another way of doing sessions.
http://www.jgc.org/blog/2006/04/stateless-web-pages-with-has...
When I wrote that Matt Sergeant posted that this idea had been around since at least 1999.
For instance let them add things to their cart and only require registraton/login once they buy.
What if you want more than one basket?
What if baskets are shared among users.
Replace "basket" with "state" for above.
How is http://example.org/shop/users/johndoe/basket different/better than http://example.org/shop/users/johndoe/?sessionkey=123456 or http://example.org/shop/baskets/123456/
"differ from storing the cart in a user session" I never store anything but sessions in user sessions, carts go in the cart table/whatever. Carts may have a session_id they are associated with, but they are probably keyed to user instead(depends). Probably stored in a cookie(state on the client).
Not saying author is wrong, I just don't get it.
And how come rest folks don't end their resources with a '/'. like http://example.com/users/bob/ The "root" resource ends in a slash. http://example.com/ Having that be inconsistent with other resources always bugs me. I tend to have verbs not end in slash. http://example.com/users/bob/delete Very consistent and orderly to my obcom mind.
The cart on client scares me when it has to do with data that isn't trivial. (ie, personal data etc) I don't have these concerns with the "cart on the server" idea, but it does create some interesting issues where devs need to be explicitly aware of who is accessing this data at any given time.
There is an article here, http://www.lightbluetouchpaper.org/2008/05/16/hardened-state... but the PDF link seems dead.
At least, that's what I saw on the intranet site I built, switched to authenticating with a login page and cookies instead because of it.