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-2024-36039

CVE-2024-36039: PyMySQL SQL Injection Vulnerability

CVE-2024-36039 is a SQL injection vulnerability in PyMySQL through version 1.1.0 that allows attackers to inject malicious SQL via untrusted JSON input. This article covers the technical details, affected versions, and mitigation.

Updated: January 22, 2026

CVE-2024-36039 Overview

CVE-2024-36039 is a SQL injection vulnerability affecting PyMySQL through version 1.1.0. The vulnerability exists because the escape_dict function does not properly escape dictionary keys when processing untrusted JSON input. This allows attackers to inject malicious SQL code through crafted dictionary keys, potentially leading to unauthorized data access, modification, or deletion.

Critical Impact

Applications using PyMySQL with untrusted JSON input are vulnerable to SQL injection attacks that could compromise database integrity and confidentiality.

Affected Products

  • PyMySQL versions through 1.1.0
  • Applications using PyMySQL with untrusted JSON input
  • Python applications utilizing escape_dict for query parameterization

Discovery Timeline

  • 2024-05-21 - CVE CVE-2024-36039 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2024-36039

Vulnerability Analysis

This SQL injection vulnerability (CWE-89) stems from improper input validation in PyMySQL's escape_dict function. When applications process JSON data from untrusted sources and pass it to database queries, the dictionary values are properly escaped, but the dictionary keys are not. This oversight allows attackers to craft malicious JSON payloads where the keys themselves contain SQL injection payloads.

The vulnerability is exploitable over the network and requires low privileges to exploit. An attacker can achieve unauthorized read and write access to database contents, potentially leading to data exfiltration, data manipulation, or denial of service conditions depending on the application's database permissions.

Root Cause

The root cause of CVE-2024-36039 lies in the incomplete implementation of the escape_dict function within PyMySQL. While the function properly sanitizes dictionary values to prevent SQL injection, it assumes that dictionary keys are trusted and safe. This assumption breaks down when applications accept JSON input from external sources, as JSON object property names become dictionary keys that can contain arbitrary strings, including SQL injection payloads.

Attack Vector

The attack vector for this vulnerability involves sending specially crafted JSON data to an application that uses PyMySQL. When the application converts this JSON to a Python dictionary and passes it to escape_dict for query parameterization, the malicious key names are incorporated directly into SQL queries without proper escaping.

An attacker could exploit this by providing JSON input where object keys contain SQL syntax such as comment sequences, UNION statements, or other injection payloads. When these keys are interpolated into SQL queries, the injected code executes in the context of the database connection.

Detection Methods for CVE-2024-36039

Indicators of Compromise

  • Unusual database queries containing SQL syntax in parameter names
  • Error logs showing SQL syntax errors with unexpected characters in column or field names
  • Database audit logs revealing queries with malformed parameter structures
  • Application logs indicating JSON parsing followed by database errors

Detection Strategies

  • Monitor application logs for SQL syntax errors that reference dictionary keys or JSON field names
  • Implement database query auditing to detect queries with unusual parameter patterns
  • Deploy web application firewalls (WAF) configured to detect SQL injection patterns in JSON payloads
  • Review code for instances where untrusted JSON data is passed to PyMySQL queries

Monitoring Recommendations

  • Enable detailed SQL query logging on database servers to capture parameterized query patterns
  • Set up alerts for SQL errors indicating injection attempts in key/field positions
  • Monitor network traffic for JSON payloads containing SQL-specific characters in object keys
  • Implement runtime application self-protection (RASP) to detect exploitation attempts

How to Mitigate CVE-2024-36039

Immediate Actions Required

  • Upgrade PyMySQL to version 1.1.1 or later immediately
  • Audit all code paths where JSON input is processed and passed to database queries
  • Implement input validation to whitelist allowed dictionary keys before database operations
  • Consider using parameterized queries with explicit column specifications rather than dynamic key interpolation

Patch Information

The vulnerability has been addressed in PyMySQL version 1.1.1. The fix ensures that dictionary keys are properly escaped when using the escape_dict function. Organizations should upgrade to the patched version as soon as possible.

For more information, see the GitHub PyMySQL Release v1.1.1. Linux distribution users should also check the Debian LTS Advisory and Fedora package announcements for distribution-specific patches.

Workarounds

  • Validate and sanitize all JSON input keys against an allowlist before processing
  • Avoid passing untrusted JSON directly to database query functions
  • Implement a layer of abstraction that explicitly maps expected keys to database parameters
  • Use ORM frameworks that handle parameterization independently of user input structure

If upgrading is not immediately possible, applications should implement strict validation on all dictionary keys derived from external JSON input before passing them to PyMySQL functions. This can be accomplished by comparing keys against an explicit allowlist of expected parameter names.

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

  • Vulnerability Details
  • TypeSQLI

  • Vendor/TechPymysql

  • SeverityMEDIUM

  • CVSS Score6.3

  • EPSS Probability0.10%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityLow
  • CWE References
  • CWE-89
  • Technical References
  • GitHub PyMySQL Release v1.1.1

  • Debian LTS Advisory May 2024

  • Fedora Package Announcement

  • Fedora Package Announcement
  • Latest CVEs
  • CVE-2025-70797: LimeSurvey XSS Vulnerability

  • CVE-2025-30650: Juniper Junos OS Auth Bypass Vulnerability

  • CVE-2026-35471: Goshs Path Traversal Vulnerability

  • CVE-2026-35393: Goshs Path Traversal 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