What Makes a Website Secure?

Discussing website security is much like discussing fluency in a foreign language: the terms do have meaning, but they're difficult to define, and most often used by people who don't know the subject very well. And yet security is a crucial component in the design of modern Web applications.

On the Web or otherwise, security isn't an all-or-nothing proposition. It's largely a matter of risk analysis: making an investment in measures that offer the highest return. A determined attacker with motivation and resources can probably find a way to compromise or at least damage almost any system, but the vast majority of attacks on the Web are not so specific. Thus the security measures that offer the highest ROI are those that protect against casual attacks and those that protect a system's most sensitive data.

Over the next few weeks, we'll discuss some of the most common security threats on the Web and the technologies that are used to mitigate them.

First Up: SQL Injection

One of the most prevalent attacks on websites is a technique known as SQL injection. Contemporary sites often have at least a few components that rely on information in a database, and SQL is the language used to query that data. Queries often contain information supplied by a user -- for example, a website user selects what month to display on a calendar, and this generates a query to display events for that month. A malicious user might manipulate the month parameter so that it contains his own SQL code instead of the name of the month. This code is then "injected" into the query and executed.

These kinds of attacks are often highly automated -- that is, a human attacker writes a script that roams the Internet just looking for likely targets and trying to manipulate them. Because it's so easy to perform, this attack is extremely common, and it can have very serious consequences. SQL injection is often used to:

  1. Give an attacker access to private data
  2. Add malicious code to legitimate websites for the purpose of exploiting their visitors
  3. Vandalize a website or destroy data

To prevent injection, developers must be careful to "sanitize" user-supplied information before placing it into a query. In the event that an attacker is able to circumvent these protections, it also makes sense to limit the potential damage. In the next article of the series, we'll discuss some of the technologies that help us do that.