Form input in terms of information system security constitutes an "allowed path," that is, the data is not blocked. It is allowed into the server. Because users can save, edit and then submit HTML pages from their machine, it is possible to pass bogus and unexpected values to the server via these "hidden" form fields. Forms that use HIDDEN fields to send authentication information, for example, could provide an attacker with a way to gain unauthorized entry. The same is true when cookies are used to store information as they are equally vulnerable to client-side modification. Using HIDDEN form fields to maintain state is risky too, because the session information
One way around the problem of HIDDEN form fields is to encrypt the hidden values in a form and decrypt them when required by a script or database operation. However, the best way to temporarily store information required by different forms is by using a session cookie that is used to access either server-side maintained session values or a database that stores the temporary values during the user's visit to your site.
Whether you use HIDDEN form fields or not, if your site uses input from a form to build SQL statements to send to a database or as variables within a CGI script, you must not assume that the input is valid or non-malicious. There are a number of attacks where user input can be used to gain access to a Web server if the input data is not validated before being processed either on receipt or on publication. This means that all user input data needs to be checked before being sent on to another process. If any input data is used in building a Web page or retrieved from a database or any other source, it must be checked before it is published on the Web page. Sanity checks and filters on all such data will ensure that any erroneous data is removed and attacks such as SQL injection can be thwarted.
About the Author
Michael Cobb, CISSP-ISSAP is the founder and managing director of Cobweb Applications Ltd., a consultancy that offers IT training and support in data security and analysis. He co-authored the book IIS Security and has written numerous technical articles for leading IT publications. Mike is the guest instructor for SearchSecurity's Web Security School and, as a SearchSecurity.com site expert, answers user questions on application and platform security.
This was first published in December 2005