Description
Buffer overflow in gram.y for PostgreSQL 8.0.0 and earlier may allow attackers to execute arbitrary code via a large number of arguments to a refcursor function (gram.y), which leads to a heap-based buffer overflow, a different vulnerability than CVE-2005-0247.
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 3.0 | postgresql | 7.2.1-2woody8 | DSA-683-1 |
Red Hat
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| RHEL 4 | postgresql +10 | 7.4.7-2.RHEL4.1 | RHSA-2005:138 |
| RHEL 3 | rh-postgresql +10 | 7.3.9-2 | RHSA-2005:141 |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
Exploit-DB 1
- PostgreSQL 7.x - Multiple Vulnerabilities EDB-25076 · dos · Feb 1, 2005 · verified
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Advisories 3
- RHSA-2005:141 Red Hat Security Advisory: rh-postgresql security update Red Hat Security Advisories (RHSA) · Jun 26, 2026
- RHSA-2005:138 Red Hat Security Advisory: postgresql security update Red Hat Security Advisories (RHSA) · Jun 26, 2026
- DSA-683-1 postgresql - buffer overflows Debian Security (DSA / DLA) · Mar 9, 2026
References
- postgresql-cursor-bo(19188) vdb-entry
- [pgsql-committers] 20050207 pgsql: Prevent 4 more buffer overruns in the PL/PgSQL parser. mailing-list
- MDKSA-2005:040 vendor-advisory
- 20050210 [USN-79-1] PostgreSQL vulnerabilities mailing-list
- oval:org.mitre.oval:def:10175 vdb-entry signature
- [pgsql-patches] 20050120 Re: WIP: pl/pgsql cleanup mailing-list
- RHSA-2005:138 vendor-advisory
- 12948 third-party-advisory
- RHSA-2005:150 vendor-advisory
- [pgsql-committers] 20050121 pgsql: Prevent overrunning a heap-allocated buffer is more than 1024 mailing-list
- 12417 vdb-entry
- DSA-683 vendor-advisory
- SUSE-SA:2005:036 vendor-advisory