in reply to Is your web application really secure? ("CSRF")
A lot of websites do this already; create a token (that expires like a session-id), and that must be a parameter in the form:
I do agree that embedding the session id or a token into the HTML code is currently the most secure and portable way to avoid XSRF attacks. However I regret that this takes much of the coolness and simplicity out of the concept of session cookies because they get kind of useless for POST requests. Moreover the expiration of the token or session id would render old browser windows useless.
<input type="hidden" name="t" value="123abc...">
So every action of the script that changes data should require such a token. That makes your script pretty safe.
Other ways to avoid the problem are
- Using Java script to embed the session cookie into a hidden field just before submitting
- Using the referer
However not every browser has Java script or referers turned on.
Update: If you too think that browsers should do something about the issue, please consider taking part in the discussion on Bugzilla, which you will find referenced in tinita's original posting.