Home > Ask the Information Security Experts > Secure software development and application/platform security Questions & Answers > How to find and prevent SQL injection attack vulnerabilities
Ask The Security UK Expert: Questions & Answers
EMAIL THIS

How to find and prevent SQL injection attack vulnerabilities

Richard Brain EXPERT RESPONSE FROM: Richard Brain

Pose a Question
Other Security UK Categories
Meet all Security UK Experts
Become an Expert for this site


Enterprise IT tips and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 11 March 2009
How do I know if my site is open to SQL injection attacks?

>
If your site uses a SQL server, then it is probably vulnerable to some form of SQL injection.

In the late 1990s, when Web-connected sites were starting to be tied into corporate databases, implementations were enacted with little regard to security, and managers were probably more than happy if the system just worked. Basic security mistakes were made: A site's input data was often not checked for unexpected characters, and verbose (and occasionally revealing) error messages were displayed to end users.

This allowed the classic error page-based SQL injection attack, which consists of injecting apostrophes (') or double minus (--) characters to insert additional SQL code, modify existing SQL queries within the code and possibly gain access to data and resources.

Modern SQL-based Web-connected sites are more securely designed (though you do come across some evolutionary throwbacks), and they filter for dangerous characters like apostrophes and no longer display error messages that confirm a successful attack. However, as the security of websites has improved over time, so have the attack techniques.

There are various "blind" SQL attack methods, which no longer rely on error page responses to work. Instead, they try to delay the processing of certain SQL statements. Some logical SQL commands, when processed, create perceptible delays. There is for instance a "waitfor delay x" command which will delay the response by x seconds. If xp_cmdshell is enabled, then delays can be created many different ways -- for instance pinging a remote host a number of times.

The attackers' approach is to keep trying until they succeed. If the "waitfor delay 10" command is used, for example, and the injection is unsuccessful, the error page (if used) is immediately displayed. If successful, the error page is displayed after a 10 second wait, showing the attack worked.

It is even possible to get responses from servers using 'out of band' SQL injections, where a database server connects with a client using HTTP or other network function. The response is, for instance, sent to an external DNS server by getting the SQL server to perform a host lookup.

SQL injection attacks can be prevented by not displaying error pages; redirect to the home page instead. Also, only accept certain characters in input areas, and limit the length of those fields. So for the username and password, for example, only accept letters for the alphabet and numbers, and limit the field to 15 characters if possible.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Secure software development and application/platform security
Pwn2Own results: The most secure Internet browser for enterprises
Google cloud applications: Secure enough for the enterprise?
Windows 2003 DNS configuration tips
How to protect a laptop from spam, viruses
What is the best choice for an enterprise Web browser?
How to detect and remove Sinowal and repair a master boot record
How does search engine malware spread?
How effective are password hack tools?
How do attackers use Google to hack?
Why can Google block virus-infected websites; how do you stop a ban?

Database Security Tools and Techniques
NuBridges update enables simultaneous data center tokenisation
Database activity monitoring technology vs. SIEM tools
Oracle buys database firewall vendor Secerno
Considerations for buying and implementing DLP solutions
Multifunction security device safeguards SOA, streamlines company's infrastructure
Safend expands data leakage prevention product to plug more gaps
How to prevent memory dump attacks
Database activity monitoring lacks security lift
Report: Firms avoid encrypting backup tapes, databases
Cryptography for the rest of us

Web Application Security
Social networking: Workplace productivity, security no match for Facebook
Adobe vulnerability: Pen test firm finds ColdFusion admin page flaw
Survey: Web 2.0 security issues cause concern
Twitter settles with FTC over security issues, careless policies
Report: Google to phase out Windows, cites security issues
New tool enables botnet command and control via Twitter
Pwn2Own results: The most secure Internet browser for enterprises
Google cloud applications: Secure enough for the enterprise?
Symantec Internet threat report highlights botnet, malware trends
Researchers aim to smarten Web application security scanners

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Serious Organized Crime Agency  (SearchSecurityUK.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary







Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Access Management: Authentication, Biometrics, Password Security
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2008 - 2010, TechTarget | Terms of Use | Read our Privacy Policy
  TechTarget