CVE-2023-5868
Medium · 4.3CVSS
4.3
EPSS
2.8%
Published
Dec 10, 2023
CISA due date
—
Cloudanix analysis
A bug in the database software could let people who already have login access see small pieces of private information from the server's memory.
- Exploitation
- Remote Authenticated
- Attacker needs
- Low Privilege
- Complexity
- Low
- Impact
- Data Exposure
- Component
- Network Service
- Class
- Information Disclosure
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The flaw allows remote authenticated users to disclose portions of PostgreSQL server memory by calling aggregate functions with 'unknown' type arguments from string literals, resulting in excessive data output.
Why it matters to the business
Attackers with database access could leak sensitive information such as credentials or confidential data from server memory, raising the risk of further compromise or regulatory penalties.
How an attack unfolds
An attacker with valid database credentials connects to a PostgreSQL instance and issues queries using aggregate functions on string literals without explicit type designation, triggering the server to return additional memory bytes in the response.
How to fix it
Upgrade all PostgreSQL installations to a version containing commit fd851f9e4a13d81cccc4ac5d6059d732c7518111 or later to correct the excessive data output in aggregate function handling.
How to confirm the fix worked
Confirm the running PostgreSQL binary or source includes the referenced fix commit, then attempt reproduction queries with unknown-type arguments and verify that responses contain only expected data without memory leakage.
Typical attack path
- Obtain valid database credentials with login privileges
- Connect to the target PostgreSQL instance over the network
- Execute crafted queries invoking aggregate functions on untyped string literals
- Parse responses to extract and analyze disclosed memory contents
How to detect it
Review PostgreSQL query logs and audit trails for aggregate function calls involving string literals without type casts, and inspect result sets for unexpected binary or memory-like content.
What your security team should do
- Apply the patch commit to all PostgreSQL deployments without delay
- Restrict database user privileges to the minimum required for operations
- Enable detailed query logging and review for suspicious aggregate function usage
The record
A memory disclosure vulnerability was found in PostgreSQL that allows remote users to access sensitive information by exploiting certain aggregate function calls with 'unknown'-type arguments. Handling 'unknown'-type values from string literals without type designation can disclose bytes, potentially revealing notable and confidential information. This issue exists due to excessive data output in aggregate function calls, enabling remote users to read some portion of system memory.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| AlmaLinux:8 | pg_repack | 0 | 1.4.6-3.module_el8.6.0+2760+1746ec94 |
| AlmaLinux:8 | pg_repack | 0 | 1.4.6-3.module_el8.6.0+3095+ee60d910 |
| AlmaLinux:8 | pg_repack | 0 | 1.4.6-3.module_el8.6.0+2758+4f4474df |
| AlmaLinux:8 | pg_repack | 0 | 1.4.6-3.module_el8.6.0+3094+eb237fb8 |
| AlmaLinux:8 | pg_repack | 0 | 1.4.8-1.module_el8.8.0+3487+43ec1b9f |
| AlmaLinux:8 | pgaudit | 0 | 1.5.0-1.module_el8.6.0+2760+1746ec94 |
| AlmaLinux:8 | pgaudit | 0 | 1.5.0-1.module_el8.6.0+3095+ee60d910 |
| AlmaLinux:8 | pgaudit | 0 | 1.4.0-5.module_el8.6.0+2758+4f4474df |
| AlmaLinux:8 | pgaudit | 0 | 1.4.0-5.module_el8.6.0+3094+eb237fb8 |
| AlmaLinux:8 | pgaudit | 0 | 1.7.0-1.module_el8.8.0+3487+43ec1b9f |
| AlmaLinux:8 | postgres-decoderbufs | 0 | 0.10.0-2.module_el8.6.0+2760+1746ec94 |
| AlmaLinux:8 | postgres-decoderbufs | 0 | 0.10.0-2.module_el8.6.0+3095+ee60d910 |
| AlmaLinux:8 | postgres-decoderbufs | 0 | 0.10.0-2.module_el8.6.0+2758+4f4474df |
| AlmaLinux:8 | postgres-decoderbufs | 0 | 0.10.0-2.module_el8.6.0+3094+eb237fb8 |
| AlmaLinux:8 | postgres-decoderbufs | 0 | 1.9.7-1.Final.module_el8.8.0+3487+43ec1b9f |
| AlmaLinux:8 | postgresql | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-contrib | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-contrib | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-contrib | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-docs | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-docs | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-docs | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-plperl | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-plperl | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-plperl | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-plpython3 | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-plpython3 | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-plpython3 | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-pltcl | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-pltcl | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-pltcl | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-private-devel | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-private-libs | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-server | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-server | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-server | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-server-devel | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-server-devel | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-server-devel | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-static | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-static | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-static | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-test | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-test | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-test | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-test-rpm-macros | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-test-rpm-macros | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-test-rpm-macros | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-upgrade | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-upgrade | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-upgrade | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:8 | postgresql-upgrade-devel | 0 | 13.13-1.module_el8.9.0+3692+8714f643 |
| AlmaLinux:8 | postgresql-upgrade-devel | 0 | 12.17-1.module_el8.9.0+3704+f1f917ce |
| AlmaLinux:8 | postgresql-upgrade-devel | 0 | 15.5-1.module_el8.9.0+3706+885c732e |
| AlmaLinux:9 | pg_repack | 0 | 1.4.8-1.module_el9.2.0+22+09653793 |
| AlmaLinux:9 | pgaudit | 0 | 1.7.0-1.module_el9.2.0+22+09653793 |
| AlmaLinux:9 | postgres-decoderbufs | 0 | 1.9.7-1.Final.module_el9.2.0+22+09653793 |
| AlmaLinux:9 | postgresql | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-contrib | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-contrib | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-docs | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-docs | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-plperl | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-plperl | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-plpython3 | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-plpython3 | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-pltcl | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-pltcl | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-private-devel | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-private-devel | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-private-libs | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-private-libs | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-server | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-server | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-server-devel | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-server-devel | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-static | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-static | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-test | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-test | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-test-rpm-macros | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-upgrade | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-upgrade | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| AlmaLinux:9 | postgresql-upgrade-devel | 0 | 13.13-1.el9_3 |
| AlmaLinux:9 | postgresql-upgrade-devel | 0 | 15.5-1.module_el9.3.0+52+21733919 |
| Alpine:v3.15 | postgresql14 | 0 | 14.10-r0 |
| Alpine:v3.16 | postgresql14 | 0 | 14.10-r0 |
| Alpine:v3.17 | postgresql14 | 0 | 14.10-r0 |
| Alpine:v3.17 | postgresql15 | 0 | 15.5-r0 |
| Alpine:v3.18 | postgresql14 | 0 | 14.10-r0 |
| Alpine:v3.18 | postgresql15 | 0 | 15.5-r0 |
| Alpine:v3.19 | postgresql15 | 0 | 15.5-r0 |
| Alpine:v3.19 | postgresql16 | 0 | 16.1-r0 |
| Alpine:v3.20 | postgresql15 | 0 | 15.5-r0 |
| Alpine:v3.20 | postgresql16 | 0 | 16.1-r0 |
| Alpine:v3.21 | postgresql16 | 0 | 16.1-r0 |
| Alpine:v3.22 | postgresql16 | 0 | 16.1-r0 |
| Bitnami | postgresql | 11.0.0 | 11.22.0 |
| Chainguard | ecpg-13 | 0 | 13.13-r0 |
| Chainguard | ecpg-14 | 0 | 14.10-r0 |
| Chainguard | ecpg-15 | 0 | 15.5-r0 |
| Chainguard | ecpg-16 | 0 | 16.1-r0 |
| Chainguard | libecpg-12 | 0 | 12.17-r0 |
| Chainguard | libecpg-13 | 0 | 13.13-r0 |
| Chainguard | libecpg-13-dev | 0 | 13.13-r0 |
| Chainguard | libecpg-14 | 0 | 14.10-r0 |
| Chainguard | libecpg-14-dev | 0 | 14.10-r0 |
| Chainguard | libecpg-15 | 0 | 15.5-r0 |
| Chainguard | libecpg-15-dev | 0 | 15.5-r0 |
| Chainguard | libecpg-16 | 0 | 16.1-r0 |
| Chainguard | libecpg-16-dev | 0 | 16.1-r0 |
| Chainguard | libpq-11 | 0 | 11.22-r0 |
| Chainguard | libpq-12 | 0 | 12.17-r0 |
| Chainguard | libpq-13 | 0 | 13.13-r0 |
| Chainguard | libpq-14 | 0 | 14.10-r0 |
| Chainguard | libpq-15 | 0 | 15.5-r0 |
| Chainguard | libpq-16 | 0 | 16.1-r0 |
| Chainguard | postgresql-11 | 0 | 11.22-r0 |
| Chainguard | postgresql-11-bitnami-compat | 0 | 11.22-r0 |
| Chainguard | postgresql-11-client | 0 | 11.22-r0 |
| Chainguard | postgresql-11-contrib | 0 | 11.22-r0 |
| Chainguard | postgresql-11-dev | 0 | 11.22-r0 |
| Chainguard | postgresql-11-oci-entrypoint | 0 | 11.22-r0 |
| Chainguard | postgresql-12 | 0 | 12.17-r0 |
| Chainguard | postgresql-12-base | 0 | 12.17-r0 |
| Chainguard | postgresql-12-bitnami-compat | 0 | 12.17-r0 |
| Chainguard | postgresql-12-client | 0 | 12.17-r0 |
| Chainguard | postgresql-12-client-base | 0 | 12.17-r0 |
| Chainguard | postgresql-12-contrib | 0 | 12.17-r0 |
| Chainguard | postgresql-12-dev | 0 | 12.17-r0 |
| Chainguard | postgresql-12-oci-entrypoint | 0 | 12.17-r0 |
| Chainguard | postgresql-12-oci-entrypoint-base | 0 | 12.17-r0 |
| Chainguard | postgresql-12-pgadmin-compat | 0 | 12.17-r0 |
| Chainguard | postgresql-13 | 0 | 13.13-r0 |
| Chainguard | postgresql-13-base | 0 | 13.13-r0 |
| Chainguard | postgresql-13-bitnami-compat | 0 | 13.13-r0 |
| Chainguard | postgresql-13-client | 0 | 13.13-r0 |
| Chainguard | postgresql-13-client-base | 0 | 13.13-r0 |
| Chainguard | postgresql-13-contrib | 0 | 13.13-r0 |
| Chainguard | postgresql-13-dev | 0 | 13.13-r0 |
| Chainguard | postgresql-13-oci-entrypoint | 0 | 13.13-r0 |
| Chainguard | postgresql-13-oci-entrypoint-base | 0 | 13.13-r0 |
| Chainguard | postgresql-13-pgadmin-compat | 0 | 13.13-r0 |
| Chainguard | postgresql-14 | 0 | 14.10-r0 |
| Chainguard | postgresql-14-base | 0 | 14.10-r0 |
| Chainguard | postgresql-14-bitnami-compat | 0 | 14.10-r0 |
| Chainguard | postgresql-14-client | 0 | 14.10-r0 |
| Chainguard | postgresql-14-client-base | 0 | 14.10-r0 |
| Chainguard | postgresql-14-contrib | 0 | 14.10-r0 |
| Chainguard | postgresql-14-dev | 0 | 14.10-r0 |
| Chainguard | postgresql-14-oci-entrypoint | 0 | 14.10-r0 |
| Chainguard | postgresql-14-oci-entrypoint-base | 0 | 14.10-r0 |
| Chainguard | postgresql-14-pgadmin-compat | 0 | 14.10-r0 |
| Chainguard | postgresql-15 | 0 | 15.5-r0 |
| Chainguard | postgresql-15-base | 0 | 15.5-r0 |
| Chainguard | postgresql-15-bitnami-compat | 0 | 15.5-r0 |
| Chainguard | postgresql-15-client | 0 | 15.5-r0 |
| Chainguard | postgresql-15-client-base | 0 | 15.5-r0 |
| Chainguard | postgresql-15-contrib | 0 | 15.5-r0 |
| Chainguard | postgresql-15-dev | 0 | 15.5-r0 |
| Chainguard | postgresql-15-oci-entrypoint | 0 | 15.5-r0 |
| Chainguard | postgresql-15-oci-entrypoint-base | 0 | 15.5-r0 |
| Chainguard | postgresql-15-pgadmin-compat | 0 | 15.5-r0 |
| Chainguard | postgresql-16 | 0 | 16.1-r0 |
| Chainguard | postgresql-16-base | 0 | 16.1-r0 |
| Chainguard | postgresql-16-bitnami-compat | 0 | 16.1-r0 |
| Chainguard | postgresql-16-client | 0 | 16.1-r0 |
| Chainguard | postgresql-16-client-base | 0 | 16.1-r0 |
| Chainguard | postgresql-16-contrib | 0 | 16.1-r0 |
| Chainguard | postgresql-16-dev | 0 | 16.1-r0 |
| Chainguard | postgresql-16-oci-entrypoint | 0 | 16.1-r0 |
| Chainguard | postgresql-16-oci-entrypoint-base | 0 | 16.1-r0 |
| Chainguard | postgresql-16-pgadmin-compat | 0 | 16.1-r0 |
| Debian:10 | postgresql-11 | 0 | 11.22-0+deb10u1 |
| Debian:11 | postgresql-13 | 0 | 13.13-0+deb11u1 |
| Debian:12 | postgresql-15 | 0 | 15.5-0+deb12u1 |
| Debian:13 | postgresql-16 | 0 | 16.1-1 |
| Mageia:8 | postgresql11 | 0 | 11.22-1.mga8 |
| Mageia:8 | postgresql13 | 0 | 13.13-1.mga8 |
| Mageia:9 | postgresql13 | 0 | 13.13-1.mga9 |
| Mageia:9 | postgresql15 | 0 | 15.5-1.mga9 |
| Red Hat:enterprise_linux:8::appstream | pg_repack | 0 | 0:1.4.6-3.module+el8.9.0+20664+9c30cf7f |
| Red Hat:enterprise_linux:8::appstream | pg_repack | 0 | 0:1.4.6-3.module+el8.9.0+19330+c97ddbdf |
| Red Hat:enterprise_linux:8::appstream | pg_repack | 0 | 0:1.4.8-1.module+el8.9.0+19797+c4ce5969 |
| Red Hat:enterprise_linux:8::appstream | pg_repack-debuginfo | 0 | 0:1.4.6-3.module+el8.9.0+20664+9c30cf7f |
| Red Hat:enterprise_linux:8::appstream | pg_repack-debuginfo | 0 | 0:1.4.6-3.module+el8.9.0+19330+c97ddbdf |
| Red Hat:enterprise_linux:8::appstream | pg_repack-debuginfo | 0 | 0:1.4.8-1.module+el8.9.0+19797+c4ce5969 |
| Red Hat:enterprise_linux:8::appstream | pg_repack-debugsource | 0 | 0:1.4.6-3.module+el8.9.0+20664+9c30cf7f |
| Red Hat:enterprise_linux:8::appstream | pg_repack-debugsource | 0 | 0:1.4.6-3.module+el8.9.0+19330+c97ddbdf |
| Red Hat:enterprise_linux:8::appstream | pg_repack-debugsource | 0 | 0:1.4.8-1.module+el8.9.0+19797+c4ce5969 |
| Red Hat:enterprise_linux:8::appstream | pgaudit | 0 | 0:1.5.0-1.module+el8.9.0+20664+9c30cf7f |
| Red Hat:enterprise_linux:8::appstream | pgaudit | 0 | 0:1.4.0-5.module+el8.9.0+19330+c97ddbdf |
| Red Hat:enterprise_linux:8::appstream | pgaudit | 0 | 0:1.7.0-1.module+el8.9.0+19797+c4ce5969 |
| Red Hat:enterprise_linux:8::appstream | pgaudit-debuginfo | 0 | 0:1.5.0-1.module+el8.9.0+20664+9c30cf7f |
| Red Hat:enterprise_linux:8::appstream | pgaudit-debuginfo | 0 | 0:1.4.0-5.module+el8.9.0+19330+c97ddbdf |
| Red Hat:enterprise_linux:8::appstream | pgaudit-debuginfo | 0 | 0:1.7.0-1.module+el8.9.0+19797+c4ce5969 |
| Red Hat:enterprise_linux:8::appstream | pgaudit-debugsource | 0 | 0:1.5.0-1.module+el8.9.0+20664+9c30cf7f |
Related vulnerabilities
- CVE-2025-1094 Improper neutralization of quoting syntax in PostgreSQL libpq functions… Also affects pg_repack
- CVE-2024-10979 Incorrect control of environment variables in PostgreSQL PL/Perl allows an unprivileged… Also affects pg_repack
- CVE-2024-10978 Incorrect privilege assignment in PostgreSQL allows a less-privileged application user to… Also affects pg_repack
- CVE-2024-10976 Incomplete tracking in PostgreSQL of tables with row security allows a reused query to… Also affects pg_repack
- CVE-2024-4317 Missing authorization in PostgreSQL built-in views pg_stats_ext and pg_stats_ext_exprs… Also affects pg_repack
- CVE-2017-15098 Invalid json_populate_recordset or jsonb_populate_recordset function calls in PostgreSQL… Also affects postgresql14
- CVE-2017-7546 PostgreSQL versions before 9.2.22, 9.3.18, 9.4.13, 9.5.8 and 9.6.4 are vulnerable to… Also affects postgresql14
- CVE-2024-10977 Client use of server error message in PostgreSQL allows a server not trusted under… Also affects postgresql14