# CVE-2022-2625: Privilege escalation in postgresql

> An attacker with schema creation rights can escalate privileges to superuser by manipulating extension creation if an administrator updates the extension.

- **Severity:** High 8.0 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 18 Aug 2022
- **Updated:** 3 Aug 2024
- **Also known as:** ALPINE-CVE-2022-2625, ALSA-2022:7128, ALSA-2023:0113, AZL-10595, BIT-postgresql-2022-2625, CLEANSTART-2026-TH17193, DEBIAN-CVE-2022-2625, DLA-3072-1, ECHO-03c5-b6e9-23cb, GHSA-m7mv-m566-78j6, JLSEC-2026-38, RHSA-2022:7128, RHSA-2023:0113, RHSA-2023:0160, RLSA-2022:7128, RLSA-2023:0113, SUSE-SU-2022:2912-1, SUSE-SU-2022:2914-1, SUSE-SU-2022:2946-1, SUSE-SU-2022:2987-1, SUSE-SU-2022:2988-1, SUSE-SU-2022:2989-1, SUSE-SU-2022:2989-2, SUSE-SU-2022:3193-1, SUSE-SU-2022:3269-1, UBUNTU-CVE-2022-2625, USN-5571-1, openSUSE-SU-2024:12264-1, openSUSE-SU-2024:12265-1, openSUSE-SU-2024:12266-1, openSUSE-SU-2024:12267-1, openSUSE-SU-2024:12268-1

## What is CVE-2022-2625?

CVE-2022-2625 is a high-severity vulnerability in Fedoraproject Fedora, published on 18 Aug 2022. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

A vulnerability was found in PostgreSQL. This attack requires permission to create non-temporary objects in at least one schema, the ability to lure or wait for an administrator to create or update an affected extension in that schema, and the ability to lure or wait for a victim to use the object targeted in CREATE OR REPLACE or CREATE IF NOT EXISTS. Given all three prerequisites, this flaw allows an attacker to run arbitrary code as the victim role, which may be a superuser.

Weakness: CWE-1321 (Improperly Controlled Modification of Object Prototype Attributes), CWE-915 (Improperly Controlled Modification of Dynamically-Determined Object Attributes)

## Which versions are affected by CVE-2022-2625?

1 open source package ship an affected version, including postgresql. It affects 3 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `postgresql` | Bitnami | From 10.0.0 | 10.22.0, 11.17.0, 12.12.0, 13.8.0, 14.5.0 |
| `pg_repack` | AlmaLinux:8 | All versions | 1.4.6-3.module_el8.6.0+2760+1746ec94 |
| `pg_repack` | AlmaLinux:8 | All versions | 1.4.6-3.module_el8.6.0+3095+ee60d910 |
| `pgaudit` | AlmaLinux:8 | All versions | 1.4.0-5.module_el8.6.0+2758+4f4474df |
| `pgaudit` | AlmaLinux:8 | All versions | 1.4.0-5.module_el8.6.0+3094+eb237fb8 |
| `postgres-decoderbufs` | AlmaLinux:8 | All versions | 0.10.0-2.module_el8.6.0+2760+1746ec94 |
| `postgres-decoderbufs` | AlmaLinux:8 | All versions | 0.10.0-2.module_el8.6.0+3095+ee60d910 |
| `postgresql` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-contrib` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-contrib` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-docs` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-docs` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-plperl` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-plperl` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-plpython3` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-plpython3` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-pltcl` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-pltcl` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-server` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-server` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-server-devel` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-server-devel` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-static` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-static` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-test` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-test` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-test-rpm-macros` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-test-rpm-macros` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-upgrade` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-upgrade` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `postgresql-upgrade-devel` | AlmaLinux:8 | All versions | 10.23-1.module_el8.7.0+3379+54d21c26 |
| `postgresql-upgrade-devel` | AlmaLinux:8 | All versions | 12.12-1.module_el8.6.0+3336+e779e518 |
| `pg_repack` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.6-3.module+el8.5.0+11354+78b3c9c5 |
| `pg_repack-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.6-3.module+el8.5.0+11354+78b3c9c5 |
| `pg_repack-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.6-3.module+el8.5.0+11354+78b3c9c5 |
| `pgaudit` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.0-5.module+el8.5.0+11354+78b3c9c5 |
| `pgaudit-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.0-5.module+el8.5.0+11354+78b3c9c5 |
| `pgaudit-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.0-5.module+el8.5.0+11354+78b3c9c5 |
| `postgres-decoderbufs` | Red Hat:enterprise_linux:8::appstream | All versions | 0:0.10.0-2.module+el8.5.0+11354+78b3c9c5 |

Products: Fedoraproject Fedora, Postgresql Postgresql, Redhat Enterprise Linux.

## How do I fix CVE-2022-2625?

Upgrade postgresql to a fixed version for your release line: 10.22.0, 11.17.0, 12.12.0 or 13.8.0.

## Is CVE-2022-2625 being exploited?

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

## Other vulnerabilities in Fedoraproject Fedora

- [CVE-2024-4577](https://insights.sbomify.com/CVE-2024-4577/): PHP-CGI OS Command Injection (critical 9.8, exploited in the wild)
- [CVE-2021-39226](https://insights.sbomify.com/CVE-2021-39226/): Grafana Authentication Bypass (critical 9.8, exploited in the wild)
- [CVE-2019-5544](https://insights.sbomify.com/CVE-2019-5544/): VMware ESXi and Horizon DaaS OpenSLP Heap-Based Buffer Overflow (critical 9.8, exploited in the wild)
- [CVE-2024-4947](https://insights.sbomify.com/CVE-2024-4947/): Google Chromium V8 Type Confusion (critical 9.6, exploited in the wild)
- [CVE-2024-4671](https://insights.sbomify.com/CVE-2024-4671/): Google Chromium Visuals Use-After-Free (critical 9.6, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-2625 and fix it if it is affected.

What it is: CVE-2022-2625 is a high-severity vulnerability in Fedoraproject Fedora, published on 18 Aug 2022. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2022-2625 in the wild and no public exploit code.

Affected packages and fixed versions:
- postgresql (Bitnami): affected from 10.0.0; fixed in 10.22.0, 11.17.0, 12.12.0, 13.8.0, 14.5.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-2022-2625/ (Markdown: https://insights.sbomify.com/CVE-2022-2625/index.md)
```

## Sources

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

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