Page Tokens
As I have already explained in my last writing, HTTP is stateless so we need a session id (JSESSIONID) send either by cookie or within the url in each session-related request. By including such an id, a user can usually access all resources, no matter whether he has been given a specific link to it or not. This fact allows attacks such as Cross-site Request Forgery (CSRF) to be carried out. An attacker can send a link like http://application/?action=delete to an user authenticated to execute a certain command within the user's session and without ones noticing it. Of course this kind of attack would only be possible when the victim uses cookies for transmitting his session, because otherwise the URL wouldn't be generic any more and not foreseeable by the attacker, respectively. What we have to do here to prevent this attack is to include some session-related token into the URL in addition to the session cookie. This technique is known as session tokens.
We can improve this by using tokens which are not only related to the session but also to a certain page the user has received. This token can then be evaluated to only allow the user to access those pages he has provided a link to from the application itself. With this technique we can not only harden our applications session management but also the whole authorization system since the user can't access restricted pages such as http://application/admin when he never has provided a link to it.
The
The HDIV state is basically an implementation of the page-token idea I talked above. Well, it can actually do even more then that. It distinguishes between two sets of HTTP parameters: those which are editable by the user such as input fields, text fields and so on and those which should normally never been manipulated by the user such as hidden fields. The later (non-editable parameters) are automatically included within the HDIV state object and validated on discrepancies on each client request. For being able to provide this feature in a transparent and automatic fashion, HDIV facilitates two techniques: First, it implements a servlet filter to check the correctness of the parameters provided.
Second, it extends various taglib libraries (Struts, Spring MVC and JSTL) to automatically insert the HDIV state as an additional parameter in all kind of link elements such as
HDIV comes with a nice validator functionality allowing you to check all ingoing parameter values for suspicious characters (such as
More Features
HDIV also supplied several additional features I haven't talk about yet. One example is Cookie protection, which works roughly in the same way as with non-editable parameters. The other is parameter obfuscation, where all parameter names and non-editable parameter values, are obfuscated by HDIV so that an attacker can get no clue about the function of this as he might would get when seeing parameters such as "id" (database object id) or "file=/test.jsp" (possible filename injection). Instead he will only see a query string like "1=1&2=2" which HDIV will map transparently to its real values stored in the state object before they are send to the application. HDIV has even more that it can do, just have a look at its decent documentation.
No comments:
Post a Comment