SQL Injection vulnerability in PostgreSQL

postgresql Updated 02 Oct 2025

Summary

11/08/2023
N/A
Yes i
High
8.8

CVE-2023-39417: IN THE EXTENSION SCRIPT, a SQL Injection vulnerability was found in PostgreSQL if it uses @extowner@, @extschema@, or @extschema:...@ inside a quoting construct (dollar quoting, '', or ""). Affects postgresql versions < 13.12-r0. Fixed in 13.12-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 an open-source relational database management system known for its robustness, extensibility, and adherence to SQL standards. It is widely used in various applications and provides advanced features for data storage and retrieval. However, a SQL Injection vulnerability has been discovered in PostgreSQL that can be exploited by an attacker with certain privileges.

Vulnerability Detail

The SQL Injection vulnerability in PostgreSQL arises when the extension script uses @extowner@, @extschema@, or @extschema:...@ inside a quoting construct (dollar quoting, '', or ""). If an administrator has installed files of a vulnerable, trusted, non-bundled extension, an attacker with database-level CREATE privilege can execute arbitrary code as the bootstrap superuser. This can lead to unauthorized access, data manipulation, or even complete compromise of the database.

How To Fix

Minimum fixed version

13.12-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, administrators can review and remove any vulnerable, trusted, non-bundled extensions from the PostgreSQL installation. Additionally, they should ensure that only trusted extensions are installed and regularly monitor for any suspicious activities or unauthorized access attempts.

Conclusion

The SQL Injection vulnerability in PostgreSQL can have severe consequences if exploited. It is crucial to update PostgreSQL to the latest version and review the installed extensions to ensure they are trusted and not vulnerable. Regular monitoring and security measures should be implemented to detect and prevent any unauthorized access or data manipulation. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for postgresql →

Share this vulnerability

FAQ

PostgreSQL is an open-source relational database management system known for its robustness, extensibility, and adherence to SQL standards.

SQL Injection is a type of vulnerability that allows an attacker to manipulate SQL queries by injecting malicious input. In the case of PostgreSQL, it can lead to unauthorized access, data manipulation, or compromise of the database.

Any system or application that uses PostgreSQL and has installed vulnerable, trusted, non-bundled extensions can be affected by this vulnerability.

An attacker with database-level CREATE privilege is required to exploit this vulnerability.

Updating PostgreSQL to the latest version that includes the fix is the most effective way to mitigate the risk of exploitation. Regularly monitoring for suspicious activities and unauthorized access attempts is also recommended.

Related vulnerabilities

Recent vulnerabilities recorded for postgresql.

How To Fix

Minimum fixed version

13.12-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