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
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • 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, affected versions, and mitigations.

Updated: May 15, 2026

CVE-2023-39417 Overview

CVE-2023-39417 is a SQL injection vulnerability in PostgreSQL extension scripts that allows authenticated database users to execute arbitrary SQL as the bootstrap superuser. The flaw affects extension scripts using @extowner@, @extschema@, or @extschema:...@ placeholders inside quoting constructs such as dollar quoting, single quotes, or double quotes. An attacker with database-level CREATE privilege can exploit this issue when an administrator has installed a vulnerable, trusted, non-bundled extension. Successful exploitation results in code execution under the PostgreSQL bootstrap superuser context, breaking the security boundary between regular database users and the database administrator.

Critical Impact

Authenticated attackers with CREATE privilege can execute arbitrary code as the bootstrap superuser, leading to full database compromise.

Affected Products

  • PostgreSQL (multiple versions prior to 15.4, 14.9, 13.12, 12.16, and 11.21)
  • Red Hat Enterprise Linux 8 and 9, Red Hat Software Collections
  • Debian Linux 8, 11, and 12

Discovery Timeline

  • 2023-08-11 - CVE-2023-39417 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2023-39417

Vulnerability Analysis

The vulnerability is classified as SQL Injection [CWE-89] and resides in PostgreSQL's handling of extension installation scripts. PostgreSQL extensions are SQL script files installed by the server when a user runs CREATE EXTENSION. During processing, the server substitutes placeholder tokens including @extowner@, @extschema@, and @extschema:reqextname@ with their literal values. When these placeholders appear inside a quoting construct such as dollar quoting ($$...$$), single quotes, or double quotes, the substituted values are not properly escaped for the surrounding quoting context. An attacker who controls the value of one of these placeholders, typically the extension owner or schema name, can inject SQL that executes outside the intended quoting boundary.

The EPSS score of 0.659% places this issue in the 71st percentile for exploitation likelihood. Although no public exploit is currently catalogued, the conditions required for exploitation are well-documented in PostgreSQL's extension framework.

Root Cause

The root cause is improper escaping of placeholder substitution within quoted SQL contexts inside extension scripts. PostgreSQL substitutes placeholder text verbatim without quoting it appropriately for the enclosing literal. A schema or owner name containing quote-terminating sequences breaks out of the literal and is interpreted as SQL code at the privilege level of the script executor, the bootstrap superuser.

Attack Vector

Exploitation requires three preconditions: a vulnerable trusted non-bundled extension must be installed by an administrator, the extension script must reference one of the affected placeholders inside a quoting construct, and the attacker must hold database-level CREATE privilege. The attacker creates a schema or role whose name contains a payload designed to terminate the script's quoting construct. When the attacker invokes CREATE EXTENSION and PostgreSQL substitutes the malicious identifier into the script, the injected SQL executes as the bootstrap superuser. This yields full control of the database cluster, including the ability to read or modify any data and execute server-side functions.

No verified public exploit code is available. Refer to the PostgreSQL Security Advisory for CVE-2023-39417 for additional technical context.

Detection Methods for CVE-2023-39417

Indicators of Compromise

  • Unexpected CREATE EXTENSION statements in PostgreSQL logs, particularly from non-administrative accounts
  • Schema or role names containing unusual quote characters, dollar signs, or SQL keywords
  • New superuser-level objects, functions, or roles created shortly after extension installation events
  • Modifications to system catalogs (pg_proc, pg_authid, pg_namespace) without corresponding administrative activity

Detection Strategies

  • Audit PostgreSQL server logs for CREATE EXTENSION calls and correlate with the executing role's privileges
  • Review installed trusted extensions and compare against the upstream patched versions listed in vendor advisories
  • Inspect extension .sql script files in SHAREDIR/extension/ for use of @extowner@, @extschema@, or @extschema:...@ inside $$, ', or " quoting
  • Enable log_statement = 'ddl' to capture extension and schema operations for forensic review

Monitoring Recommendations

  • Forward PostgreSQL audit logs to a centralized SIEM and alert on extension installation by non-administrator roles
  • Monitor for creation of roles or schemas with non-standard characters in their identifiers
  • Track privilege changes and additions to membership in superuser roles
  • Baseline normal CREATE EXTENSION activity per environment and flag deviations

How to Mitigate CVE-2023-39417

Immediate Actions Required

  • Upgrade PostgreSQL to a patched minor release: 15.4, 14.9, 13.12, 12.16, or 11.21 or later
  • Apply distribution updates from Red Hat (RHSA-2023:7545 and related advisories) and Debian (DSA-5553, DSA-5554)
  • Audit and update any third-party trusted extensions that use the affected placeholders inside quoting constructs
  • Restrict database-level CREATE privilege to trusted roles only

Patch Information

The PostgreSQL Global Development Group released fixes on August 10, 2023 in versions 15.4, 14.9, 13.12, 12.16, and 11.21. Red Hat addressed the issue across multiple PostgreSQL streams; see the Red Hat CVE page for CVE-2023-39417. Debian released updates documented in the Debian LTS announcement. NetApp's response is tracked in NetApp Advisory ntap-20230915-0002.

Workarounds

  • Revoke the CREATE privilege on databases and schemas from untrusted roles using REVOKE CREATE ON DATABASE ... FROM PUBLIC
  • Avoid installing trusted, non-bundled extensions whose scripts have not been audited for unsafe placeholder usage
  • Restrict extension installation to administrators by ensuring only superusers can run CREATE EXTENSION for affected extensions
  • For custom extension authors, refactor scripts to use format() with %I identifier quoting rather than relying on raw placeholder substitution inside quoted literals
bash
# Revoke CREATE privilege from PUBLIC on a database
REVOKE CREATE ON DATABASE mydb FROM PUBLIC;

# Revoke CREATE on the public schema
REVOKE CREATE ON SCHEMA public FROM PUBLIC;

# Verify installed extensions and their versions
SELECT extname, extversion, extnamespace::regnamespace FROM pg_extension;

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.66%

  • 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 Details for CVE-2023-39417

  • Red Hat Bugzilla Report #2228111

  • Debian LTS Announcement 2023-10-03

  • NetApp Security Advisory ntap-20230915-0002

  • Debian Security DSA-5553

  • Debian Security DSA-5554
  • Vendor Resources
  • PostgreSQL Security CVE-2023-39417
  • Related CVEs
  • CVE-2025-1094: PostgreSQL libpq SQL Injection Vulnerability

  • CVE-2024-1597: PostgreSQL JDBC Driver SQLi Vulnerability

  • CVE-2021-23214: PostgreSQL SQL Injection Vulnerability

  • CVE-2020-25695: PostgreSQL SQL Injection Vulnerability
Default Legacy - Prefooter | 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