August 12th, 2024

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

Paul Gerste's presentation at DEF CON 32 emphasized SQL injection threats, particularly in PostgreSQL and MongoDB, highlighting vulnerabilities from message size overflows and the need for effective size limits to enhance security.

Read original articleLink Icon
SQL Injection Isn't Dead: Smuggling Queries at the Protocol Level

A recent presentation by Paul Gerste at DEF CON 32 highlighted the ongoing threat of SQL injection attacks, particularly through vulnerabilities in database binary protocols. Gerste demonstrated how certain databases, including PostgreSQL and MongoDB, can be exploited using specially crafted SQL queries. One method involves a message size overflow in PostgreSQL, where an attacker can embed a string exceeding 4GB, surpassing the protocol's maximum string length and allowing data manipulation. Similar vulnerabilities were noted in MongoDB. To mitigate these risks, it is essential to enforce size limits on incoming requests. However, this can be challenging, as alternative communication methods like WebSockets may circumvent existing limits, and some servers might impose restrictions before decompressing data, enabling attackers to send oversized compressed payloads.

- SQL injection attacks continue to pose significant risks, particularly at the protocol level.

- Vulnerabilities in PostgreSQL and MongoDB can be exploited through message size overflows.

- Implementing size limits on incoming requests is crucial for protection but can be complex.

- Alternative communication methods may bypass traditional security measures.

- Awareness of these vulnerabilities is essential for database security management.

Link Icon 8 comments
By @poincaredisk - 5 months
>Topic

SQL injection isn't dead, because I stumble upon a sql injection vulnerability every other day as a part of my job.

By @29athrowaway - 5 months
I do not like the term SQL injection nowadays. I think it must be generalized to query injection. It makes people believe that NoSQL somehow is exempt from such problems.
By @simonw - 5 months
The full slides for the presentation (PDF) are here: https://media.defcon.org/DEF%20CON%2032/DEF%20CON%2032%20pre...

Anyone know if DEF CON publish videos of this kind of session?

By @seeknotfind - 5 months
Well this is a buffer overflow attack, not injection, but hey, it's in a SQL program!

Though SQL injection and other injection attacks are definitely not dead. All it takes is one programmer mistake and poof! Lots of XSS rely on accidentally injection of some value. Also hey lots of LLM based attacks are injection. Injection is not dead... oh no oh no

By @Ekaros - 5 months
Also I get the feeling lot of instruction on topic like SQL Injection is just incorrect or not even best practise anymore. And it keeps being parroted. Like recommending input sanitization. It can be part of solution and probably should consider what to accept on any input. But it is not full or even efficient solution, specially when often it is implemented incorrectly or imperfectly...

So it is complex field and there is always more vectors like this.

By @TedDallas - 5 months
I’m seriously thinking about getting a custom made bumper sticker with the following text: ‘; select 1/0;
By @boltzmann_ - 5 months
Very smart!
By @CodeWriter23 - 5 months
> The current way to protect against these attacks is to ensure a size limit on incoming requests. This can be more difficult than you may expect - Paul points out that alternative paths such as WebSockets might bypass limits that are in place for regular HTTP requests, plus some servers may apply limits before decompression, allowing an attacker to send a compressed payload that is larger than the configured limit.

Interesting...a security researcher that thinks it's ok to trust the client.