SSL connection (i.e. connection via https, instead of http) should be the default for transmitting customer's information. However, it is often not the default protocol on many commercial web sites. The reason why many businesses don't use SSL as default is because SSL connection is slower than a regular http connection (due to encryption and decryption). eBay has been criticized recently for transmitting passwords in the clear rather than encrypted (click here for details).
How reliable is SSL itself? In 1998 a Bell Labs researcher Daniel Bleichenbacher has discovered a problem with a version of SSL used at that time: it turned out that a long sequence of specifically designed messages allows to figure out the key used by a server in a session by studying error messages returned by the server. Since then SSL has been patched so that no information about the key can be gathered from error messages. The problem, however, was more theoretical than practical, because figuring out the key required around a million messages sent over a designated connection. SSL is considered a secure way of transmitting private information.
SELECT ProductName FROM Products WHERE Size =If the user enters 6, then the string becomes:
SELECT ProductName FROM Products WHERE Size = 6This string is sent to the database as a query and returns the list of products of size 6. However, a malicious user can enter the following into the form:
6; DELETE FROM ProductsWhen the string is appended to the initial string, it becomes:
SELECT ProductName FROM Products WHERE Size = 6; DELETE FROM ProductsWhen this string is passed to the database, in many systems it will cause both queries to be executed, and in addition to selecting the list of products, the query will delete all information from the table Products. The query "TRUNCATE Products" will cause even more damage, because it empties the table without entering the changes into the log, so the changes are not easily traceable.
Similar things can be done, in addition to online forms, with URL rewriting and cookies. Note that the user can easily type in any URL into the browser window, including a URL which contains an extra query. The user can also easily alter a cookie which resides on the user's computer.
To avoid these vulnerabilities, one has to check the data entered by the user, as well as URLs and cookies, to make sure that they are of the correct format. One can also restrict privileges of the process running search queries so that it is not allowed to remove data from the database. One also has to be careful not to expose table names in the text of online forms, since this attack requires the hacker to know the table name in order to delete the information from it.
To avoid the problem, the price should be looked up in the database, rather than taken from the form. Servlets also prevent the problem, because the product information is passed in the Session object on the server. The client's machine sends the cookie to the server to identify the session, but the cookie itself does not contain any information about products or prices.