CVE-2025–1094: PostgreSQL Injection Vulnerability Exploit
PostgreSQL's escaping functions mishandle certain character encodings, allowing crafted input to break out of quoted strings and inject SQL. An attacker with access to an affected instance could execute arbitrary SQL commands.
medium.com
Published on medium.com
CVE-2025–1094 is a high-severity SQL injection vulnerability affecting multiple versions of PostgreSQL. This flaw is caused by improper neutralization of quoting syntax within PostgreSQL’s escaping functions, which can be leveraged by attackers to execute arbitrary SQL commands.
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 the escaping functions do not correctly account for multibyte character encodings, so a crafted byte sequence can terminate a quoted string early.
Impact
An attacker could execute arbitrary SQL commands, potentially gaining shell access or extracting database contents, but only when the server is configured with the specific client and server encodings named.
What the attacker needed
Access to an affected PostgreSQL instance; client_encoding set to BIG5; server_encoding EUC_TW or MULE_INTERNAL; crafted input to escaping functions
The fix
The vulnerability was fixed in the listed patched PostgreSQL releases, and users should also avoid the affected encoding combination and use parameterised queries.
How it was found
- Clone the Metasploit Framework repository.
- Load Metasploit and select the exploit module.
- Set the target, remote host and port, then run the exploit.
- If the target is vulnerable, gain shell access or extract database contents.
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.
PostgreSQL is a database. When programs build database queries, they use helper functions to safely wrap user text in quotes so it cannot change the query. Here those helpers can be tricked when the database uses unusual text encodings, letting an attacker slip extra database commands into what should be plain 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.