Powered By InformationWeek Business Technology Network
 
Welcome Guest. | Log In| Register | Membership Benefits
  • Email this page E-mail this page
  • |  Print Print this page
  • |   Bookmark and Share

Tech Insight: SQL Injection Demystified

Attackers are using the old standby SQL injection en masse -- a look at the attack and how to protect your applications from it

Aug 21, 2009 | 12:55 PM

By John Sawyer
DarkReading

A Special Analysis For Dark Reading

Several high-profile hacks over the past year including those at Heartland, Hannaford Bros., and 7-11, all have had one thing in common: they were launched with a SQL injection attack.

Cross-site scripting (XSS) had been the king of Web attack techniques for some time, and for good reason -- the ability to steal user credentials, hijack active Web sessions and take action on behalf of a user without their knowledge is particularly nasty. But the classic SQL injection attack has regained the lead as the most popular of Web attacks. Most of all reported Web breaches the first half of this year, according to the new Web Hacking Incidents Database (WHID) report, were conducted via SQL injection. And SQL injection is one of the most common vulnerabilities in Web applications today.

SQL injection attacks take advantage of an application not validating input (like on Twitter and Facebook), or input into a form, such as a site search. The user's input is then incorrectly executed by the backend database server and can have a myriad of results. The simplest example is entering a single quote (') into a search field or login form, and receiving an error message that the SQL query failed.

The attack basically lets the bad guy take an ordinary input field and abuse it in ways that allows him to bypass authentication into the Website, manipulate the database to disclose large amounts of data, or access and control the database server itself.

SQL injection has grown in popularity over the last several years, thanks to not just the powerful results, but also the ease in which attacks can be carried out -- like the single quote example. All it takes to successfully exploit a SQL injection flaw is a Web browser. However, many tools have been created to make it easier to scan Websites for SQL injection vulnerabilities and attack them. Some examples are sqlmap (recently updated), sqlninja, Absinthe, and BSQL Hacker.

Not all SQL injection tools are designed for scanning and carrying out attacks. At DEFCON 17, Kevin Johnson and Justin Searle from InGuardians, along with Frank DiMaggio, announced a new project called Laudanum that takes a slightly different approach to SQL injection attack tools. Instead of releasing another scanning and exploit tool, they are publishing files that can be used as the payload to a SQL injection attack. They include functionality such as Web-based shells, DNS querying, LDAP retrieval, and more.

Successful SQL injection attacks don't always lead to compromise of the actual database server: often, the attacks instead result in complete exposure of the database contents, which could be anything from a simple listing of all users and their passwords, or much worse, all customer data including credit card information.

Depending on the rights of the database user account for the Web application, data manipulation within the database is also a possibility. The Asprox botnet is a good example of this: it inserted malicious links and iFrames into the source code of vulnerable Websites via SQL injection. The resulting changes caused visitors of the affected Website to be redirected to sites hosting malicious JavaScript that attempted to exploit and infect the user's Web browser.

The prevalence of SQL injection vulnerabilities and the ease in which they can be exploited begs the question of why aren't more companies finding the vulnerabilities and securing their systems accordingly. The tools exist for scanning and detecting the flaws -- and many of them are free and quite effective -- but for some reason, they just aren't being used proactively for detection before an attacker has the chance to exploit them.

Of course, detection with scanning tools is only one side of the problem. The key issue is how to prevent SQL injection vulnerabilities and thwart attacks. OWASP (Open Web Application Security Project) has an excellent document titled the "SQL Injection Prevention Cheat Sheet" that includes primary defense options like parametrized queries, stored procedures, and escaping all user input. Additional defenses included in the OWASP document are least privilege and whitelist input validation.

Page 2: 
1 | 2 Next Page »


Subscribe to RSS



Database Security Reports

report Database Activity Monitoring: Emerging Technology Keeps Tabs on Assets
You can read about the consequences of not protecting critical data in the daily headlines. In response, security-conscious organizations are tackling the complexities involved in effectively monitoring their databases for potential leaks and compromises. Fortunately, an emerging class of software is stepping up to help. Here’s what enterprises need to know about selecting, deploying, and managing DAM technology.

report SQL Injection: A Major Threat to Data Security
Of all the attacks taking place on Web sites across the Internet today, SQL injection is the most popular for cybercriminals trying to hack their way into corporate data stores. But for such a pervasive threat, there is still little understanding within the development and database communities about what constitutes a SQL injection vulnerability, how attacks against a SQL injection bug work, and how to mitigate the risk. We examine how these exploits work and what you can do to stop them.

report Protecting Your Databases From Careless End Users
While much attention is paid to outside attackers' efforts to crack enterprise databases, IT organizations often overlook an even greater threat: end users. Ignorance and disregard of company security policies may lead employees to expose their organizations' databases to compromise, often without even knowing that they’re doing so. In this report, we offer advice on how to educate users on database security, and some common-sense recommendations on how to limit the damage.

report A Database Administrator's Guide to Security
While most security pros have become painfully aware of the threats posed to their organizations' databases, many of those who create and maintain the databases still don't fully understand the danger.  This "security primer" is designed to open the eyes of the DBA to the risks posed by poor database security – and to current "best practices" that can help prevent those risks from becoming reality.

report Why Your Databases Are Vulnerable To Attack - And What You Can Do About It
Most of an enterprise’s most sensitive and valuable information resides in databases. Yet, in many organizations, database security is often neglected, misunderstood, or even ignored. In this report, we discover why databases have become one of the most popular targets for hackers - and how everyday mistakes in database administration contribute to these attacks. We also offer some advice on what your organization can do to protect your most critical data - and to stop hackers in their tracks.

Related Content

HOWTO Secure and Audit Oracle 10g and 11g
Read the "Hardening Your Database" chapter from the 454-page book "HOWTO Secure and Audit Oracle 10g and 11g" and learn how to navigate the many security options within Oracle (authored by database security expert and Guardium CTO, Ron Ben Natan, Ph.D.)

HOWTO Monitor Database Activity
Read the "Database Activity Monitoring (DAM)" chapter from "HOWTO Secure and Audit Oracle 10g and 11g" (CRC Press, 2009) and learn how to leverage DAM to prevent cyberattacks, monitor privileged users and track access to sensitive data.

8 Steps to Holistic Database Security
Get the 8 essential best practices for a holistic approach to both safeguarding databases and achieving compliance with key regulations such as SOX, PCI-DSS, NIST 800-53 and data protection laws.

Essential Steps to Implementing Database Security and Auditing
Learn best practices and specific tips for effectively securing Oracle, SQL Server, DB2, MySQL and Sybase environments, including tracking security vulnerabilities, the anatomy of buffer overflow vulnerabilities and database auditing.

Databases at Risk: Current State of Database Security (ESG Research)
This recently published ESG report analyzes the current state of database security -- concluding it depends upon too many manual processes -- and also offers concrete steps to improve database security across the enterprise.