Skip to content
SQL injection Write-up Advanced

CVE-2025–1094: PostgreSQL SQL Injection Vulnerability

PostgreSQL's libpq escaping functions fail to neutralise quoting syntax in certain encoding scenarios, allowing SQL injection. An attacker could use this to execute arbitrary SQL and, via psql meta-commands, run operating system commands.

medium.com

Published on medium.com

CVE-2025–1094 is a high-severity SQL injection vulnerability affecting PostgreSQL, discovered by Rapid7 researcher Stephen Fewer and patched on February 13, 2025. Here’s a detailed breakdown:

Ajay Monga, on medium.com

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

Impact

Attackers could execute arbitrary SQL and, through psql meta-commands, run operating system commands, though exploitation requires specific conditions such as escaped input being passed to psql or mismatched encodings.

What the attacker needed

Escaped input passed to psql; or mismatched client/server encodings

The fix

PostgreSQL was fixed by upgrading to the patched versions (17.3, 16.7, 15.11, 14.16, 13.19).

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. Its helper functions are meant to make user input safe before it is used in database commands, but in some encoding setups they do not. That lets an attacker slip extra commands into the database, and if those commands are run through the psql tool, they can even run operating system 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.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.