Skip to content

SQL Injection Isn't Dead: Smuggling Queries at the Protocol Level

Paul Gerste

Technique for bypassing prepared statements and database query validation by smuggling queries across database wire protocols.

Summary

Prepared Statements and Protocol Smuggling

SQL injections seem to be a solved problem; databases even have built-in support for prepared statements, leaving no room for injections. In this session, we will go a level deeper: instead of attacking the query syntax, we will explore smuggling attacks against database wire protocols, through which remote, unauthenticated attackers can inject entire (No)SQL statements into an application's database connection.

Attacking Database Wire Protocols

Using vulnerable database driver libraries as case studies, we will bring the concept of HTTP request smuggling to binary protocols. By corrupting the boundaries between protocol messages, we desynchronize an application and its database, allowing the insertion of malicious messages that lead to authentication bypasses, data leakage, and remote code execution.

Practical Exploitation and Defense

To put our findings into context, we will explore the real-world applicability of this new concept by comparing how robust various languages and frameworks are against these attacks. We will also discuss how smuggling attacks are not specific to database wire protocols but affect all kinds of binary protocols, from databases over message queues to caching. We will end the session with inspirations for future research to explore the topic further.

Related talks

Main Stage·20 min

  • DEF CON
  • AppSec
  • Date: Aug 2020
  • Location: Online

Joshua Maddux

Joshua Maddux weaponizes TLS protocol features—including session resumption and SNI parsing—to execute advanced Server-Side Request Forgery (SSRF) attacks.

tlsssrfprotocol-smuggling+2

Main Stage·44 min

  • DEF CON
  • AppSec
  • Date: Jul 2009
  • Location: Las Vegas

Joseph McCray

Joseph McCray explores advanced sql injection at DEF CON 17, examining sql-injection and practical defenses.

sql-injectioninjection-attacksweb-application-security+1