![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9klQdKPEjTvHPbrPnWqyw2zWdQVtWC6H0SotFli0aRTRBBbszf08eXbjLVGKcm59zcxeMzk0SF-mmwDLFY8DcZtoQoY9corsA5BDK2EInqlhZzUk66JzECkNYT7mQ6kHmLQ4hLCWDFwA/s200/Untitled-1.png)
Here we examine an attack directed solely against the web site and its database: SQL injection. A single SQL injection attack can extract the records for every user of the web site, regardless of whether that user is logged in, currently using the site, or has a secure browser.
For all the negative impact of a SQL injection vulnerability the countermeasures are surprisingly simple to enact. The irst rule, which applies to all web development, is to validate user-supplied data. SQL injection payloads require a limited set of characters in order to fully exploit a vulnerability. Web sites should match the data received from a user against the type (e.g. integer, string, date) and content (e.g.e-mail address, irst name, telephone number) expected. The best countermeasure against SQL injection is to target its fundamental issue: using data to rewrite the grammar of a SQL statement. Piecing together raw SQL statements via string concatenation and variable substitutions is the path to insecurity. Use prepared statements (synonymous with parameterized statements or bound parameters) to ensure that the grammar of a statement remains ixed regardless of what user-supplied data are received.
This type of vulnerability is overdue for retirement—the countermeasure is so simple that the vulnerability’s continued existence is distressing to the security community. And a playground and job security for the hacking community. The vulnerability will dwindle as developers learn to rely on prepared statements. It will also diminish as developers turn to “NoSQL” or non-SQL based datastores, or even turn to HTML5’s Web Storage APIs. However, those trends still require developers to prevent grammar injection-style attacks against queries built with JavaScript instead of SQL. And developers must be more careful about the amount and kind of data placed into the browser. As applications become more dependent on the browser for computing, hackers will become as equally focused on browser attacks as they are on web site attacks .
Comments
Post a Comment