PostgreSQL SQL Injection Vulnerability (CVE-2025–1094): Hackers
PostgreSQL's libpq escaping functions fail to properly escape special characters when given invalid UTF-8 input, so an attacker could inject SQL commands. If psql is used in a vulnerable way, the attacker might also run system commands.
PostgreSQL just got hit with a nasty SQL injection vulnerability — CVE-2025–1094. If you’re running psql or using certain libpq functions to escape input, you might be handing attackers the keys to your database.
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 routines do not correctly handle invalid UTF-8 byte sequences, so special characters are not escaped as intended.
Impact
An attacker could read, change or delete database data, and if psql is used improperly they might gain shell access to the host.
What the attacker needed
Ability to supply input to a vulnerable escaping call; application uses libpq escaping functions; invalid UTF-8 input reaches the function
The fix
It was fixed in PostgreSQL 17.3, 16.7, 15.11, 14.16 and 13.19; where patching is not possible, validate input as UTF-8, use parameterised queries and restrict psql access.
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 popular database. Some helper functions are meant to make user input safe before it is placed into a database command, but they mishandle text that is not valid UTF-8 (a standard way of encoding characters). Because of that, a crafted input can break out of the intended text and add its own database commands.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.