flawopen.com/安全事件/PostgreSQL CVE-2025-1094

CVE-2025-1094:当用于防范注入的转义函数,亲手撕开了任意命令执行的缺口

High Severity CWE-89: SQL Injection Disclosed February 2025
通俗解释 (ELI5)

想象一位翻译官,唯一任务就是把你说的一切话都死死封在双引号里,确保长官绝不会把你说的话误当成命令。有人发现:如果你故意对他说一个极其罕见的外来特殊字符,翻译官在数单双字节时会陷入困惑,漏掉后面的闭合双引号。结果你说的话直接冲破束缚,被长官当成了至高无上的军令来执行。

The lessons that actually transfer

FAQ

Does this mean escaping functions can't be trusted?

It means they are ordinary software with ordinary bugs, and that relying on them puts a correctness burden in a place where a single mistake is exploitable. Parameterised queries avoid the burden entirely, which is why they remain the primary recommendation.

Was my application vulnerable if I use an ORM?

Most ORMs and modern drivers use the extended query protocol with bound parameters rather than libpq's escaping helpers, which sidesteps the flaw. The exposure was concentrated in code that explicitly called the escape functions or shelled out to psql. Patching the client library is still the correct action.

Which versions fixed it?

PostgreSQL 17.3, 16.7, 15.11, 14.16 and 13.19, released on 13 February 2025.

Related reading

参考资料与权威通告