The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2023-39417

CVE-2023-39417: PostgreSQL SQL Injection Vulnerability

CVE-2023-39417 is a SQL injection vulnerability in PostgreSQL extension scripts that allows attackers with CREATE privilege to execute arbitrary code as superuser. This article covers technical details, impact, and mitigation.

Published: January 28, 2026

CVE-2023-39417 Overview

A SQL Injection vulnerability was identified in PostgreSQL affecting extension scripts that utilize @extowner@, @extschema@, or @extschema:...@ substitution parameters inside quoting constructs such as dollar quoting, single quotes (''), or double quotes (""). This vulnerability enables an attacker with database-level CREATE privilege to inject malicious SQL code through vulnerable, trusted, non-bundled extensions that have been installed by an administrator, potentially leading to arbitrary code execution with bootstrap superuser privileges.

Critical Impact

Attackers with CREATE privilege on a PostgreSQL database can escalate to full superuser access by exploiting SQL injection in vulnerable extension scripts, enabling complete database compromise and arbitrary code execution.

Affected Products

  • PostgreSQL (multiple versions)
  • Red Hat Software Collections
  • Red Hat Enterprise Linux 8.0 and 9.0
  • Debian Linux 8.0, 11.0, and 12.0

Discovery Timeline

  • August 11, 2023 - CVE-2023-39417 published to NVD
  • November 21, 2024 - Last updated in NVD database

Technical Details for CVE-2023-39417

Vulnerability Analysis

This SQL Injection vulnerability (CWE-89) exists within PostgreSQL's extension installation mechanism. PostgreSQL extensions use substitution parameters like @extowner@, @extschema@, and @extschema:...@ within their installation scripts to dynamically reference the extension owner and schema at installation time. When these parameters are used within quoting constructs (dollar quoting, single quotes, or double quotes), insufficient sanitization allows attackers to break out of the intended quoting context and inject arbitrary SQL statements.

The vulnerability specifically affects third-party trusted extensions that are not bundled with PostgreSQL's core distribution. When an administrator installs such a vulnerable extension, any user with CREATE privilege on the database can craft malicious inputs that, when processed by the extension's installation script, result in SQL injection. Since extension installation runs with superuser privileges, successful exploitation grants the attacker bootstrap superuser access to the PostgreSQL instance.

Root Cause

The root cause lies in PostgreSQL's handling of substitution parameter expansion within extension scripts. When @extowner@, @extschema@, or @extschema:...@ values are substituted into SQL statements that are already within quoting constructs, the substituted values are not properly escaped or validated. This allows carefully crafted schema names or owner specifications to include characters that terminate the quoting construct and append arbitrary SQL commands. The trust model assumes extension scripts are safe, but this assumption breaks when user-controllable data flows into these substitution parameters without adequate sanitization.

Attack Vector

The attack is network-accessible and requires only low-privileged database access with CREATE permission. An attacker must identify a PostgreSQL instance where an administrator has installed a vulnerable third-party trusted extension. The attacker can then exploit the vulnerability by manipulating the extension installation process or by crafting inputs that trigger the vulnerable code path during extension operations.

The attack does not require user interaction beyond the initial conditions (a vulnerable extension being installed). Once these conditions are met, the attacker can execute arbitrary SQL as the bootstrap superuser, potentially:

  • Creating new superuser accounts
  • Reading, modifying, or deleting any data in the database
  • Executing operating system commands via PostgreSQL's copy program or other mechanisms
  • Installing persistent backdoors within the database
sql
-- Conceptual illustration of vulnerable pattern in extension scripts
-- A vulnerable extension might contain patterns like:
CREATE FUNCTION @extschema@.vulnerable_function()
  RETURNS void AS $$
  -- SQL code here referencing @extowner@ or @extschema@
  $$ LANGUAGE sql;

-- When @extschema@ is not properly sanitized and contains
-- malicious input, the quoting construct can be escaped,
-- allowing arbitrary SQL injection with superuser privileges.

Detection Methods for CVE-2023-39417

Indicators of Compromise

  • Unusual extension installation or modification activities in PostgreSQL logs
  • Unexpected superuser account creation or privilege escalation events
  • Database audit logs showing CREATE EXTENSION commands with unusual schema or owner values
  • Modifications to system catalogs or extension-related tables from non-administrative users

Detection Strategies

  • Monitor PostgreSQL server logs for extension-related operations, particularly CREATE EXTENSION statements with unusual parameters
  • Implement database activity monitoring to detect privilege escalation patterns or unexpected superuser operations
  • Review installed extensions using \dx or querying pg_extension to identify non-bundled third-party extensions that may be vulnerable
  • Deploy SentinelOne Singularity Platform for real-time monitoring of PostgreSQL process behavior and anomalous database activities

Monitoring Recommendations

  • Enable detailed PostgreSQL logging including log_statement = 'all' and log_min_messages = 'info' during security audits
  • Configure alerting for any superuser-level operations performed by non-administrative database roles
  • Regularly audit the list of installed PostgreSQL extensions and their sources
  • Implement network segmentation to restrict database access to authorized application servers only

How to Mitigate CVE-2023-39417

Immediate Actions Required

  • Apply the latest PostgreSQL security updates from your distribution vendor immediately
  • Audit all installed PostgreSQL extensions and identify any non-bundled third-party extensions
  • Review and restrict database-level CREATE privileges to only essential accounts
  • Consider temporarily disabling or removing untrusted third-party extensions until patches are applied

Patch Information

PostgreSQL and major Linux distributions have released patches addressing this vulnerability. Administrators should apply updates from their respective vendors:

  • PostgreSQL: Security patches available via the PostgreSQL Security Advisory
  • Red Hat: Multiple security advisories including RHSA-2023:7545, RHSA-2023:7579, and additional updates for Enterprise Linux 8 and 9
  • Debian: Security advisories DSA-5553 and DSA-5554 provide patched packages
  • NetApp: Advisory NTAP-20230915-0002 covers affected NetApp products

Workarounds

  • Restrict CREATE privilege on databases to only trusted administrative accounts until patches can be applied
  • Remove or disable non-essential third-party PostgreSQL extensions, particularly those from untrusted sources
  • Implement strict network access controls to limit database connectivity to authorized hosts only
  • Use PostgreSQL's row-level security and role-based access control to minimize the impact of potential privilege escalation
bash
# Review installed extensions and their trust status
psql -c "SELECT extname, extversion, extowner::regrole FROM pg_extension;"

# Revoke CREATE privilege from non-administrative roles
psql -c "REVOKE CREATE ON DATABASE your_database FROM public;"
psql -c "REVOKE CREATE ON DATABASE your_database FROM untrusted_role;"

# List users with superuser privileges for audit
psql -c "SELECT usename, usesuperuser FROM pg_user WHERE usesuperuser = true;"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeSQLI

  • Vendor/TechPostgresql

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability0.61%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-89
  • Technical References
  • Red Hat Security Advisory RHSA-2023:7545

  • Red Hat Security Advisory RHSA-2023:7579

  • Red Hat Security Advisory RHSA-2023:7580

  • Red Hat Security Advisory RHSA-2023:7581

  • Red Hat Security Advisory RHSA-2023:7616

  • Red Hat Security Advisory RHSA-2023:7656

  • Red Hat Security Advisory RHSA-2023:7666

  • Red Hat Security Advisory RHSA-2023:7667

  • Red Hat Security Advisory RHSA-2023:7694

  • Red Hat Security Advisory RHSA-2023:7695

  • Red Hat Security Advisory RHSA-2023:7714

  • Red Hat Security Advisory RHSA-2023:7770

  • Red Hat Security Advisory RHSA-2023:7772

  • Red Hat Security Advisory RHSA-2023:7784

  • Red Hat Security Advisory RHSA-2023:7785

  • Red Hat Security Advisory RHSA-2023:7883

  • Red Hat Security Advisory RHSA-2023:7884

  • Red Hat Security Advisory RHSA-2023:7885

  • Red Hat Security Advisory RHSA-2024:0304

  • Red Hat Security Advisory RHSA-2024:0332

  • Red Hat Security Advisory RHSA-2024:0337

  • Red Hat CVE Report CVE-2023-39417

  • Red Hat Bugzilla Report #2228111

  • Debian LTS Announcement October 2023

  • NetApp Security Advisory NTAP-20230915-0002

  • Debian Security Advisory DSA-5553

  • Debian Security Advisory DSA-5554
  • Vendor Resources
  • PostgreSQL Security Report CVE-2023-39417
  • Related CVEs
  • CVE-2024-1597: PostgreSQL JDBC Driver SQLi Vulnerability

  • CVE-2025-1094: PostgreSQL libpq SQL Injection Vulnerability

  • CVE-2021-23214: PostgreSQL SQLI Vulnerability

  • CVE-2020-25695: PostgreSQL SQL Injection Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English