Dark Reading is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them.Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Risk

9/2/2010
03:06 PM
100%
0%

Five Ways To Stop Mass SQL Injection Attacks

The best practices for mitigating this popular form of attack often are not being deployed

A new wave of mass SQL injection attacks seen in mid-August to hit over half a million websites, including parts of Apple's site serves as a weighty reminder of the growing prevalence of mass injections and of SQL injections in general as a favorite means of hackers to tap into organizations' infrastructure and data resources.

In light of these attacks, security researchers believe now is as good of a time as any to revisit some best practices necessary to prevent mass SQL injections and mitigate the risks associated with injection attacks. These practices are hardly revolutionary, but it is clear that they aren't being implemented as widely as they need to be.

"You keep seeing the same issues come up over and over again for many years now," says Alex Rothacker, manager of Team SHATTER, Application Security Inc.'s research arm. "Even with this Apple attack, they used a little bit more advanced attacks, but still it's stuff that's been talked about at Black Hat for two years now."

1. Never trust input.

This should be one of the mantras of developers as they write Web application code. According to Jacob West, security research director for Fortify Security, organizations should "create and enforce secure coding guidelines for software developed in-house that requires SQL be constructed using parameterized queries, which prevent SQL injection attacks by differentiating code from data."

Developers should work to ensure that inputs are sanitized before querying the database, Rothacker says. "Make sure that the data that people input into your website is exactly the data you're looking for, so if you're asking for a social security number, you want to make sure it is actually a social security number and there are no letters in there," he says.

2. Implement filtering and monitoring tools.

Filtering and monitoring tools at the Web application and database levels will help block attacks and detect attack behavior in order to mitigate risk of exposure to mass SQL injection attacks.

At the application level, West says that organizations should "wear suspenders," by implementing runtime security monitoring to defend against SQL injection attacks and vulnerabilities in production systems. Similarly, Web application firewalls can help organizations put certain behavior-based rule sets in place to block attacks before they do damage.

On the database, database activity monitoring can also filter attacks from the back end, Rothacker says. "Database activity monitoring is a really great tool against SQL injections," he explains. "For known injection attacks, there's always filters out there that will help alert the DBAs that something bad is going on and there's also some pretty generic filters that look for things that are very typical in SQL injections -- things like an uneven number of quotes that break up the SQL code and stuff like that."

3. Craft error messages carefully.

Hackers can and will use your own error messages against you to better dial in future attacks. That's why both the development team and DBAs need to think about the error messages they're returning when users input something unexpected.

"[Organizations should] configure the Web and database servers to not output error or warning messages," warns Neil Daswani, co-founder and CTO of Dasient. "Attackers can use such messages to learn about your database schema using techniques such as 'blind SQL injection.'"

4. Patch and harden databases.

The risks associated with SQL injections are escalated when the databases tied to the Web applications under attack are weak due to poor patching and configuration.

"Keep your databases patched, and also your Web applications and Web services while you're at it," says Rothacker. "I think that should be a no-brainer."

Additionally, don't forget about how your databases are configured. "Harden the database and the operating system of the machine it is running on by disabling unnecessary services and functionality," says Dasient's Daswani.

5. Limit database privileges.

Finally, organizations need to do a better job at managing how accounts associated with Web applications are interacting with back-end databases. Many problems arise due to DBAs giving carte blanche to these accounts in order to make developers' lives easier. But these super accounts are very vulnerable to attack and greatly broaden the risks to databases posed by SQL injection and other Web app-based attacks.

"You definitely want to run all of these accounts that serve as a Web account that have access to the back-end database at really low privileges so that they can really only access the data that they're supposed to access," Rothacker says. "You want to make sure they don't have any rights to make changes on the database."

Have a comment on this story? Please click "Discuss" below. If you'd like to contact Dark Reading's editors directly, send us a message.

Comment  | 
Print  | 
More Insights
Comments
Newest First  |  Oldest First  |  Threaded View
JoePorter
50%
50%
JoePorter,
User Rank: Apprentice
2/8/2013 | 12:11:36 AM
re: Five Ways To Stop Mass SQL Injection Attacks
Fantastic post!

Another one I found quite simply explained is here:

http://www.programmerinterview...
COVID-19: Latest Security News & Commentary
Dark Reading Staff 6/4/2020
Abandoned Apps May Pose Security Risk to Mobile Devices
Robert Lemos, Contributing Writer,  5/29/2020
How AI and Automation Can Help Bridge the Cybersecurity Talent Gap
Peter Barker, Chief Product Officer at ForgeRock,  6/1/2020
Register for Dark Reading Newsletters
White Papers
Video
Cartoon Contest
Write a Caption, Win a Starbucks Card! Click Here
Latest Comment: What? IT said I needed virus protection!
Current Issue
How Cybersecurity Incident Response Programs Work (and Why Some Don't)
This Tech Digest takes a look at the vital role cybersecurity incident response (IR) plays in managing cyber-risk within organizations. Download the Tech Digest today to find out how well-planned IR programs can detect intrusions, contain breaches, and help an organization restore normal operations.
Flash Poll
Twitter Feed
Dark Reading - Bug Report
Bug Report
Enterprise Vulnerabilities
From DHS/US-CERT's National Vulnerability Database
CVE-2020-13768
PUBLISHED: 2020-06-04
In MiniShare before 1.4.2, there is a stack-based buffer overflow via an HTTP PUT request, which allows an attacker to achieve arbitrary code execution, a similar issue to CVE-2018-19861, CVE-2018-19862, and CVE-2019-17601. NOTE: this product is discontinued.
CVE-2020-13849
PUBLISHED: 2020-06-04
The MQTT protocol 3.1.1 requires a server to set a timeout value of 1.5 times the Keep-Alive value specified by a client, which allows remote attackers to cause a denial of service (loss of the ability to establish new connections), as demonstrated by SlowITe.
CVE-2020-13848
PUBLISHED: 2020-06-04
Portable UPnP SDK (aka libupnp) 1.12.1 and earlier allows remote attackers to cause a denial of service (crash) via a crafted SSDP message due to a NULL pointer dereference in the functions FindServiceControlURLPath and FindServiceEventURLPath in genlib/service_table/service_table.c.
CVE-2020-11682
PUBLISHED: 2020-06-04
Castel NextGen DVR v1.0.0 is vulnerable to CSRF in all state-changing request. A __RequestVerificationToken is set by the web interface, and included in requests sent by web interface. However, this token is not verified by the application: the token can be removed from all requests and the request ...
CVE-2020-12847
PUBLISHED: 2020-06-04
Pydio Cells 2.0.4 web application offers an administrative console named “Cells Console� that is available to users with an administrator role. This console provides an administrator user with the possibility of changing several settings, including the applicat...