Risk
10/1/2013
06:28 AM
Brian Prince
Brian Prince
Quick Hits
Connect Directly
RSS
E-Mail
50%
50%

Anatomy Of A SQL Injection Attack

SQL injection has plagued databases for years. Here's a look at how the attacks work -- and what you can do about them

[The following is excerpted from "Anatomy Of A SQL Injection Attack," a new report posted this week on Dark Reading's Database Security Tech Center.]

It started with a vulnerability on a password reminder page and ended with a compromise of Nasdaq's computer network. Such is the life of a SQL injection vulnerability, one of the most prevalent and well-known classes of security flaws affecting organizations today.

A seemingly permanent fixture on the Open Web Application Security Project's list of top 10 Web application vulnerabilities, SQL injection has a long history as a weapon for the world's black hats to blast their way into corporate databases. In July, the U.S. Justice Department announced an indictment against five men accused of stealing more than 160 million credit card numbers and causing hundreds of millions of dollars in losses in attacks on more than a dozen organizations, including the one on Nasdaq.

The stakes cannot get much higher. According to Trustwave's "2013 Global Security Report," SQL injections accounted for 26 percent of the infiltration methods used by hackers in the data breaches it analyzed in 2012.

Fighting these attacks means more than just understanding where flaws lie in the code. It also means understanding the cyber kill chain -- the life cycle of the attacks targeting the corporate network. Armed with that knowledge, organizations can begin totake a smarter approach to defending their databases and making sure the Web applications that access them don't serve as unguarded gateways for attackers.

Put simply, SQL injection is a technique in which the attacker uses a vulnerability in the code to send malicious SQL statements to a database. This happens when user input that's not properly filtered and validated is utilized in SQL queries to databases accessible by vulnerable applications. There are multiple types of SQL injection attacks, with these two types being the most common categories:

In error-based SQL injection, the attacker forces the database to perform an operation that will result in an error, and then examines the error message for information that can be used to build a working exploit with the correct syntax. Organizations often seek to mitigate this by limiting the amount of information contained in error messages.

Blind SQL injection attacks are used when vulnerable applications are configured to show generic error messages. In this approach, the attacker asks the database a true or false question and examines the application's response. If the response is different, the attacker can determine whether or not the database has been successfully accessed.

Attackers have a number of different exploit methodologies at their disposal. For example, attackers sometimes use a method known as time-based blind SQL injection, which involves getting the database to pause for a specific period of time, and then comparing the response times between normal requests and injected requests to determine if a SQL statement was successfully executed.

To learn more about SQL injection attacks -- and how to prevent them -- download the free report.

Have a comment on this story? Please click "Add a Comment" below. If you'd like to contact Dark Reading's editors directly, send us a message. Brian Prince is a freelance writer for a number of IT security-focused publications. Prior to becoming a freelance reporter, he worked at eWEEK for five years covering not only security, but also a variety of other subjects in the tech industry. Before that, he worked as a ... View Full Bio

Comment  | 
Print  | 
More Insights
Comments
Newest First  |  Oldest First  |  Threaded View
Peter Fretty
50%
50%
Peter Fretty,
User Rank: Apprentice
10/15/2013 | 2:49:06 PM
re: Anatomy Of A SQL Injection Attack
Great post Brian. SQL injections are one of the key components of development and security that IT leaders need to understand. There is a desperate need today for highly security software development practices that would help eliminate the problem at the core. Of course that would not change all the existing applications businesses rely on everyday. This is where Web App Firewalls (i.e. Sophos UTM can make a difference in protecting the enterprise.

Peter Fretty
MROBINSON000
50%
50%
MROBINSON000,
User Rank: Apprentice
10/4/2013 | 10:56:06 AM
re: Anatomy Of A SQL Injection Attack
Great article Brian, and I am also looking forward to check out the full report. We also discussed about SQL injection attacks and bugs in a blog series on our company blog. I do hope that you and other readers interested in this topic will find the articles useful. Here is part 1 of the article: http://blog.securityinnovation...
Register for Dark Reading Newsletters
White Papers
Cartoon
Current Issue
Dark Reading Must Reads - September 25, 2014
Dark Reading's new Must Reads is a compendium of our best recent coverage of identity and access management. Learn about access control in the age of HTML5, how to improve authentication, why Active Directory is dead, and more.
Flash Poll
Video
Slideshows
Twitter Feed
Dark Reading - Bug Report
Bug Report
Enterprise Vulnerabilities
From DHS/US-CERT's National Vulnerability Database
CVE-2012-5485
Published: 2014-09-30
registerConfiglet.py in Plone before 4.2.3 and 4.3 before beta 1 allows remote attackers to execute Python code via unspecified vectors, related to the admin interface.

CVE-2012-5486
Published: 2014-09-30
ZPublisher.HTTPRequest._scrubHeader in Zope 2 before 2.13.19, as used in Plone before 4.3 beta 1, allows remote attackers to inject arbitrary HTTP headers via a linefeed (LF) character.

CVE-2012-5487
Published: 2014-09-30
The sandbox whitelisting function (allowmodule.py) in Plone before 4.2.3 and 4.3 before beta 1 allows remote authenticated users with certain privileges to bypass the Python sandbox restriction and execute arbitrary Python code via vectors related to importing.

CVE-2012-5488
Published: 2014-09-30
python_scripts.py in Plone before 4.2.3 and 4.3 before beta 1 allows remote attackers to execute Python code via a crafted URL, related to createObject.

CVE-2012-5489
Published: 2014-09-30
The App.Undo.UndoSupport.get_request_var_or_attr function in Zope before 2.12.21 and 3.13.x before 2.13.11, as used in Plone before 4.2.3 and 4.3 before beta 1, allows remote authenticated users to gain access to restricted attributes via unspecified vectors.

Best of the Web
Dark Reading Radio
Archived Dark Reading Radio
In our next Dark Reading Radio broadcast, we’ll take a close look at some of the latest research and practices in application security.