# CVE-2025-8713: PostgreSQL optimizer statistics can expose sampled data within a view, partition, or child table

> Attackers can read sampled data from views or tables they cannot access by exploiting optimizer statistics, bypassing access controls.

- **Severity:** Low 3.1 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 14 Aug 2025
- **Updated:** 14 Aug 2025
- **Also known as:** ALPINE-CVE-2025-8713, AZL-66300, AZL-66321, BELL-CVE-2025-8713, BIT-postgresql-2025-8713, CLEANSTART-2026-LW24877, DEBIAN-CVE-2025-8713, ECHO-0871-700e-e8a8, GHSA-cqj3-wjpm-fjvp, MINI-483w-m8cx-4r5m, MINI-6ffx-2269-xgww, MINI-9f3v-5h8j-xcm2, MINI-px2x-xcg2-pcwg, MINI-wggq-2fh5-98hr, UBUNTU-CVE-2025-8713

## What is CVE-2025-8713?

CVE-2025-8713 is a low-severity vulnerability in PostgreSQL, published on 14 Aug 2025. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

PostgreSQL optimizer statistics allow a user to read sampled data within a view that the user cannot access.  Separately, statistics allow a user to read sampled data that a row security policy intended to hide.  PostgreSQL maintains statistics for tables by sampling data available in columns; this data is consulted during the query planning process.  Prior to this release, a user could craft a leaky operator that bypassed view access control lists (ACLs) and bypassed row security policies in partitioning or table inheritance hierarchies.  Reachable statistics data notably included histograms and most-common-values lists.  CVE-2017-7484 and CVE-2019-10130 intended to close this class of vulnerability, but this gap remained.  Versions before PostgreSQL 17.6, 16.10, 15.14, 14.19, and 13.22 are affected.

Weakness: CWE-1230 (Exposure of Sensitive Information Through Metadata)

## Which versions are affected by CVE-2025-8713?

1 open source package ship an affected version, including postgresql.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `postgresql` | Bitnami | All versions | 13.22.0, 14.19.0, 15.14.0, 16.10.0, 17.6.0 |

## How do I fix CVE-2025-8713?

Upgrade postgresql to a fixed version for your release line: 13.22.0, 14.19.0, 15.14.0 or 16.10.0.

## Is CVE-2025-8713 being exploited?

There is no known exploitation of CVE-2025-8713 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-8713 and fix it if it is affected.

What it is: CVE-2025-8713 is a low-severity vulnerability in PostgreSQL, published on 14 Aug 2025. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-8713 in the wild and no public exploit code.

Affected packages and fixed versions:
- postgresql (Bitnami): affected all versions; fixed in 13.22.0, 14.19.0, 15.14.0, 16.10.0, 17.6.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-8713/ (Markdown: https://insights.sbomify.com/CVE-2025-8713/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-8713
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-8713
- OSV: https://osv.dev/vulnerability/CVE-2025-8713

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-8713/
Summaries are generated and may contain mistakes; the official description above is the record.
