PostgreSQL Vulnerability: Arbitrary Code Execution Risk in Extensions

postgresql Updated 02 Oct 2025

Summary

18/08/2022
N/A
Yes i
High
8.0

ALPINE-CVE-2022-2625: A vulnerability was found in PostgreSQL. Affects postgresql versions < 13.8-r0. Fixed in 13.8-r0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

PostgreSQL is a powerful, open-source relational database system that uses and extends the SQL language. It is known for its robustness, extensibility, and support for advanced data types. However, a vulnerability has been identified that allows attackers with specific permissions to execute arbitrary code through malicious extensions, posing a significant security risk.

Vulnerability Detail

A vulnerability was found in PostgreSQL that allows an attacker to run arbitrary code as the victim role, which may be a superuser. 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. The CVSS score for this vulnerability is 8.0, indicating a high severity level.

How To Fix

Minimum fixed version

13.8-r0

This is the first release that contains the fix.

sudo apk add --upgrade postgresql

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, restrict permissions for users who can create non-temporary objects in schemas where extensions are used. This can help mitigate the risk until the package is updated.

Conclusion

The identified vulnerability in PostgreSQL poses a significant risk, allowing arbitrary code execution under certain conditions. It is crucial for users to update their installations to the patched versions to mitigate this risk. Additionally, implementing temporary workarounds can help secure systems until updates are applied.

See every vulnerability recorded for postgresql →

Share this vulnerability

FAQ

The vulnerability allows an attacker to execute arbitrary code as the victim role, potentially compromising the database.

Any PostgreSQL installation that allows users to create non-temporary objects in schemas with vulnerable extensions is at risk.

You can use Vulert, which monitors open-source vulnerabilities in your software using just a manifest file. Check your application at Vulert Scanner.

Implement the suggested workaround by restricting permissions for users who can create non-temporary objects in vulnerable schemas.

The CVSS score of this vulnerability is 8.0, indicating a high severity level.

Related vulnerabilities

Recent vulnerabilities recorded for postgresql.

How To Fix

Minimum fixed version

13.8-r0

This is the first release that contains the fix.

sudo apk add --upgrade postgresql

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback