SQL Injection Isn't Dead: Smuggling Queries at the Protocol Level
Some databases have vulnerabilities in their binary protocols that can be exploited by carefully crafted SQL queries. An attacker could use a message size overflow to write data to subsequent values.
simonwillison.net
Published on simonwillison.net
Paul demonstrates an attack against PostgreSQL (which works in some but not all of the PostgreSQL client libraries) which uses a message size overflow, by embedding a string longer than 4GB (232 bytes) which overflows the maximum length of a string in the underlying protocol and writes data to the subsequent value. He…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a message size overflow in the database's binary protocol, where a string longer than 4GB overflows the maximum length and writes data to the subsequent value.
Impact
An attacker could exploit this to write data to subsequent values, potentially corrupting or altering data, though the attack works only in some PostgreSQL client libraries.
What the attacker needed
Ability to send crafted SQL queries; vulnerable database client library
The fix
The current way to protect against these attacks is to ensure a size limit on incoming requests, but this can be difficult because alternative paths such as WebSockets might bypass limits and some servers may apply limits before decompression.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This is about a security flaw in how some databases talk to applications. A database is a program that stores and retrieves data. The flaw lets an attacker send a specially crafted request that overflows a size limit and writes data where it shouldn't, potentially altering other data.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.