Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
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-2024-27304

CVE-2024-27304: Pgproto3 SQL Injection Vulnerability

CVE-2024-27304 is a SQL injection flaw in Pgproto3 PostgreSQL driver for Go caused by integer overflow in message size calculations. This article covers technical details, affected versions, impact, and mitigation.

Updated: January 22, 2026

CVE-2024-27304 Overview

CVE-2024-27304 is a critical SQL injection vulnerability affecting pgx, a popular PostgreSQL driver and toolkit for Go. The vulnerability stems from an integer overflow condition that occurs when processing messages exceeding 4 GB in size. When an attacker can cause a single query or bind message to exceed this threshold, an integer overflow in the calculated message size allows one large message to be sent as multiple messages under the attacker's control, enabling SQL injection attacks.

Critical Impact

This vulnerability allows remote attackers to perform SQL injection attacks without authentication, potentially leading to complete database compromise, data exfiltration, and unauthorized data manipulation.

Affected Products

  • pgx PostgreSQL Driver for Go (versions prior to v4.18.2 and v5.5.4)
  • pgproto3 PostgreSQL Protocol Library for Go
  • Applications using vulnerable versions of pgx or pgproto3 for PostgreSQL connectivity

Discovery Timeline

  • 2024-03-06 - CVE-2024-27304 published to NVD
  • 2025-12-04 - Last updated in NVD database

Technical Details for CVE-2024-27304

Vulnerability Analysis

This vulnerability exploits a fundamental flaw in how pgx handles message size calculations. When processing PostgreSQL protocol messages, the library uses integer arithmetic to calculate the total message size. When this calculation involves data that causes the result to exceed the maximum value representable by the integer type (approximately 4 GB), an integer overflow occurs. This overflow causes the size value to wrap around, resulting in a much smaller calculated size than the actual data being processed.

The consequence of this overflow is particularly severe because it allows an attacker to manipulate how the PostgreSQL protocol messages are segmented. Instead of the library recognizing and handling a single large message appropriately, the overflowed size calculation causes the data to be split and interpreted as multiple separate messages. An attacker who can control portions of this data can craft malicious SQL commands that execute within the context of these artificially separated messages.

Root Cause

The root cause is an integer overflow vulnerability (CWE-89: SQL Injection) in the message size calculation logic within the pgx and pgproto3 libraries. The code responsible for computing message sizes does not properly validate or handle cases where the total size exceeds the 4 GB boundary, allowing arithmetic overflow to corrupt the size value and subsequently enable SQL injection through message fragmentation.

Attack Vector

The attack requires an adversary to be able to supply input data to a pgx-based application that results in a query or bind message exceeding 4 GB in total size. This is a network-based attack vector that does not require authentication or user interaction. Once the attacker can trigger the integer overflow condition, they gain control over how subsequent protocol messages are interpreted by the PostgreSQL server.

The attack flow involves:

  1. The attacker identifies an application using a vulnerable version of pgx
  2. Large input data is crafted to cause a query or bind message to exceed 4 GB
  3. The integer overflow causes the message to be fragmented
  4. Attacker-controlled SQL commands within the fragmented messages execute on the database

The vulnerability mechanism centers on the integer overflow in message size calculation. When the calculated message size exceeds approximately 4 billion bytes, the value wraps around due to integer overflow. This causes the pgx library to incorrectly determine message boundaries, allowing attacker-controlled data to be interpreted as separate SQL statements. For detailed technical analysis, refer to the pgx Security Advisory and the pgproto3 Security Advisory.

Detection Methods for CVE-2024-27304

Indicators of Compromise

  • Unusually large database queries or bind operations exceeding several gigabytes in size
  • Unexpected SQL execution patterns in PostgreSQL logs that don't match application behavior
  • Database connection anomalies where single operations appear as multiple fragmented commands
  • Evidence of data exfiltration or unauthorized database modifications following large query operations

Detection Strategies

  • Monitor PostgreSQL server logs for unusually large queries or abnormal query patterns that may indicate exploitation attempts
  • Implement application-level logging to track the size of data being passed to database operations
  • Use network monitoring to detect abnormally large PostgreSQL protocol messages (approaching or exceeding 4 GB)
  • Deploy database activity monitoring solutions to identify SQL injection patterns following legitimate query operations

Monitoring Recommendations

  • Configure alerts for database queries with input parameters exceeding configurable size thresholds
  • Enable PostgreSQL statement logging to capture all executed SQL for forensic analysis
  • Implement network traffic analysis on database connections to identify oversized protocol messages
  • Review application logs regularly for errors related to message size handling or database connectivity issues

How to Mitigate CVE-2024-27304

Immediate Actions Required

  • Upgrade pgx to version v4.18.2 or v5.5.4 immediately to resolve the vulnerability
  • Audit all Go applications for pgx and pgproto3 dependencies and schedule updates
  • Implement input validation to reject user input large enough to cause single queries or bind messages to exceed 4 GB
  • Review database access logs for any signs of exploitation prior to patching

Patch Information

The vulnerability has been resolved in pgx versions v4.18.2 and v5.5.4. The patches address the integer overflow condition by implementing proper size validation and bounds checking before message size calculations. Security patches are available through the following commits:

  • pgproto3 patch commit
  • pgx patch commit (v4 branch)
  • pgx patch commit (v5 branch)
  • pgx additional fix

Workarounds

  • Implement application-level validation to reject any user input that could cause a single query or bind message to exceed 4 GB in size
  • Configure web application firewalls or API gateways to limit request body sizes to prevent oversized payloads from reaching vulnerable applications
  • Use database connection proxies that can inspect and limit PostgreSQL protocol message sizes
  • Consider implementing query parameterization limits and data chunking for operations that handle large datasets
bash
# Go module update commands for remediation
# Update pgx to patched version (v5.x)
go get github.com/jackc/pgx/v5@v5.5.4

# Update pgx to patched version (v4.x)
go get github.com/jackc/pgx/v4@v4.18.2

# Verify the updated version
go list -m github.com/jackc/pgx/v5
go list -m github.com/jackc/pgx/v4

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

  • Vulnerability Details
  • TypeSQLI

  • Vendor/TechPgproto3

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability2.17%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-89
  • Technical References
  • YouTube Security Video
  • Vendor Resources
  • GitHub Commit Update

  • GitHub Security Advisory

  • GitHub Commit Update

  • GitHub Commit Update

  • GitHub Commit Update

  • GitHub Security Advisory
  • Latest CVEs
  • CVE-2025-49454: TinySalt Path Traversal Vulnerability

  • CVE-2025-48261: MultiVendorX Information Disclosure Flaw

  • CVE-2025-32119: CardGate WooCommerce SQL Injection Flaw

  • CVE-2025-26879: s2Member Plugin Reflected XSS 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