New attack technique threatens databases

Lateral thinking about SQL injection

triangular warning sign featuring exclamation mark

Database security expert David Litchfield has published details of a new type of database attack technique. Lateral SQL injection creates a means for hackers to access database data or inject hostile code onto vulnerable systems.

Exploitation is difficult and only possible in limited circumstances, Litchfield notes. Nonetheless, the discovery of the approach - a variant on earlier attack methods - means that database admins can no longer consider DATE or NUMBER data types safe from attack. Lateral SQL injection is a variant of SQL injection attacks, one of the most common methods for attacking database systems.

Litchfield first outlined the new approach during a presentation at the Black Hat security conference in Washington in late February. He published details of the approach in a paper (pdf) last week.

SQL injection attacks involve attempts by hackers to trick database servers into running SQL commands, typically after crackers use vulnerabilities to inject character strings onto databases. Lateral SQL injections are a variant of the theme that use other forms of data - DATE and NUMBER data types - to much the same effect. The new attack relates to the Procedural Language/SQL programming language used by Oracle developers, and involves the possible development of exploits that involve hostile DATE or even NUMBER data types instead of user input, the fodder for conventional SQL injection attacks.

"In the past this has not been possible but as this paper will demonstrate, with a little bit of trickery, you can in the Oracle RDBMS [Relational database management system]," Litchfield explains, adding that the attack approach would probably only work in limited cases. "Whether this becomes 'exploitable' in the 'normal' sense, I doubt. But in very specific and limited scenarios there may be scope for abuse, for example in cursor snarfing attacks [pdf]," he adds.

A noted database security expert, Litchfield is perhaps best known for uncovering a bug in Microsoft SQL Server database server that was subsequently used by the SQL Slammer worm. Litchfield has long criticised Oracle for the time it takes to fix vulnerabilities in its database software.

The latest attack vector ought to spur developers into a more careful review of code, particularly where external developers have been used. "Even those functions and procedures that don’t take user input can be exploited if SYSDATE is used," Litchfield concludes. "The lesson here is always, always validate and don’t let this type of vulnerability get into your code. The second lesson is that no longer should DATE or NUMBER data types be considered as safe and not useful as injection vectors." ®

Sponsored: Designing and building an open ITOA architecture