cve.bz

CVE-2024-36039 SQL Injection

6.3 mediumEPSS 0.7%Fix available

Medium (6.3). EPSS 0.7% estimated probability of exploitation activity in the next 30 days. Fixed in pymysql 1.1.1.

On this page
PyMySQL through 1.1.0 allows SQL injection if used with untrusted JSON input because keys are not escaped by escape_dict.

Severity

CVSS 3.1

6.3 medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
EPSS
0.7% (unchanged from 0.7% a week ago; 0.7% 30 days ago) estimated probability of exploitation activity in the next 30 days; 54th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: no · Technical impact: partial, assessed 2024-06-12. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-89 Improper Neutralization of Special Elements used in an SQL Command (SQL Injection)
OWASP Top 10
A05:2025 Injection
Published
Modified
NVD analysis
Deferred: the NVD does not plan to analyze it
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2024-36039 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2024-36039?via=ask-ai-copy and https://cve.bz/cve/CVE-2024-36039?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2024-36039 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-v9hf-5j83-6xppPyPIpymysql<1.1.11.1.1
PYSEC-2026-502PyPIpymysql<1.1.11.1.1

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian10python-pymysql0.9.3-1+deb10u1DLA-3822-1
Debian11python-pymysql0.9.3-2+deb11u1DSA-5700-1
Debian12python-pymysql1.0.2-2+deb12u1DEBIAN-CVE-2024-36039 DSA-5700-1
Debian13, 14python-pymysql1.1.1-1DEBIAN-CVE-2024-36039
Ubuntu16.04:LTS, 18.04:LTSpython-pymysqlno fix listedUBUNTU-CVE-2024-36039
Ubuntu20.04:LTSpython-pymysql0.9.3-2ubuntu3.1UBUNTU-CVE-2024-36039 USN-6801-1
Ubuntu22.04:LTSpython-pymysql1.0.2-1ubuntu1.22.04.1UBUNTU-CVE-2024-36039 USN-6801-1
Ubuntu24.04:LTSpython-pymysql1.0.2-2ubuntu1.1UBUNTU-CVE-2024-36039 USN-6801-1
Red Hatenterprise_linux:8::appstreampython3.11-PyMySQL0:1.0.2-2.el8_10RHSA-2024:4244
Red Hatenterprise_linux:8::appstreampython3.12-PyMySQL0:1.1.0-3.el8_10RHSA-2024:4245
Red Hatenterprise_linux:9::appstreampython3.11-PyMySQL, python3.11-PyMySQL+rsa0:1.0.2-2.el9RHSA-2024:9194
Red Hatenterprise_linux:9::appstreampython3.12-PyMySQL, python3.12-PyMySQL+rsa0:1.1.0-3.el9RHSA-2024:9193
SUSELinux Enterprise Module for Package Hub 15 SP5, Linux Enterprise Module for Package Hub 15 SP6python-PyMySQL0.7.11-150000.3.3.1SUSE-SU-2024:1855-1
openSUSELeap 15.5python-PyMySQL0.7.11-150000.3.3.1SUSE-SU-2024:1855-1
openSUSELeap 15.6python-PyMySQL1.1.0-150600.3.3.1SUSE-SU-2024:1925-1
openSUSETumbleweedpython-PyMySQL1.2.0-1.2openSUSE-SU-2026:11995-1
AlmaLinux8python3.11-PyMySQL1.0.2-2.el8_10ALSA-2024:4244
AlmaLinux8python3.12-PyMySQL1.1.0-3.el8_10ALSA-2024:4245
AlmaLinux9python3.11-PyMySQL, python3.11-PyMySQL+rsa1.0.2-2.el9ALSA-2024:9194
AlmaLinux9python3.12-PyMySQL, python3.12-PyMySQL+rsa1.1.0-3.el9ALSA-2024:9193
Rocky Linux8python3.11-PyMySQL0:1.0.2-2.el8_10RLSA-2024:4244
Rocky Linux8python3.12-PyMySQL0:1.1.0-3.el8_10RLSA-2024:4245
Rocky Linux9python3.12-PyMySQL0:1.1.0-3.el9RLSA-2024:9193
Azure Linux2python-PyMySQLno fix listedAZL-43726
Azure Linux3python-PyMySQL1.1.1-3AZL-44457

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; Red Hat Security Data © Red Hat, Inc., CC BY 4.0; SUSE security data, CC BY 4.0; AlmaLinux's OSV database, MIT; Rocky Linux's errata, BSD-3-Clause; Microsoft's Azure Linux vulnerability data, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · Red Hat · SUSE · openSUSE.

Red Hat

Red Hat rates this Moderate.

Red Hat's statement

Applications not exposed to untrusted JSON input are not vulnerable to this issue. Additionally, exploitation of this vulnerability depends on the permissions granted to the database user, limiting the security impact. For this reason, this flaw was rated with a Moderate severity.

Red Hat's mitigation

Make sure the permissions are set correctly for each user, database, table, operation, etc. Do not expose the PyMySQL library to untrusted JSON input.

ProductPackageStateAdvisory
Red Hat Enterprise Linux 8python3.11-PyMySQL-0:1.0.2-2.el8_10Fixed 2024-07-02RHSA-2024:4244
Red Hat Enterprise Linux 8python3.12-PyMySQL-0:1.1.0-3.el8_10Fixed 2024-07-02RHSA-2024:4245
Red Hat Enterprise Linux 9python3.12-PyMySQL-0:1.1.0-3.el9Fixed 2024-11-12RHSA-2024:9193
Red Hat Enterprise Linux 9python3.11-PyMySQL-0:1.0.2-2.el9Fixed 2024-11-12RHSA-2024:9194
Red Hat Quay 3quay/clair-rhel8:v3.12.1-1Fixed 2024-08-19RHBA-2024:5039
Red Hat Quay 3quay/quay-bridge-operator-bundle:v3.12.1-3Fixed 2024-08-19RHBA-2024:5039
Red Hat Quay 3quay/quay-bridge-operator-rhel8:v3.12.1-3Fixed 2024-08-19RHBA-2024:5039
Red Hat Quay 3quay/quay-builder-qemu-rhcos-rhel8:v3.12.1-1Fixed 2024-08-19RHBA-2024:5039
Red Hat Quay 3quay/quay-builder-rhel8:v3.12.1-1Fixed 2024-08-19RHBA-2024:5039
Red Hat Quay 3quay/quay-container-security-operator-bundle:v3.12.1-3Fixed 2024-08-19RHBA-2024:5039
Red Hat Quay 3quay/quay-container-security-operator-rhel8:v3.12.1-3Fixed 2024-08-19RHBA-2024:5039
Red Hat Quay 3quay/quay-operator-bundle:v3.12.1-13Fixed 2024-08-19RHBA-2024:5039
Red Hat Quay 3quay/quay-operator-rhel8:v3.12.1-3Fixed 2024-08-19RHBA-2024:5039
Red Hat Quay 3quay/quay-rhel8:v3.12.1-11Fixed 2024-08-19RHBA-2024:5039
Red Hat Enterprise Linux 10python-PyMySQLNot affected
Red Hat Enterprise Linux 8python27:2.7/python-PyMySQLWill not fix
Red Hat Enterprise Linux 8python36:3.6/python-PyMySQLWill not fix
Red Hat Enterprise Linux 8python39:3.9/python-PyMySQLWill not fix
Red Hat Enterprise Linux 9python-PyMySQLWill not fix
Red Hat Software Collectionsrh-python38-python-PyMySQLWill not fix

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2024-36039.

GitHub PoC

Repositories on GitHub named after this CVE or listed for it by the PoC-in-GitHub index. For those marked Harbor Check: matches CVE, Flawharbor read the code and found it implements this CVE's exploitation technique: read, not run, and its dependencies only checked for warning signs, so a pointer and no guarantee. The rest are unverified: some hold a working proof of concept, some nothing useful, and some malware made to look like one. Read the code before you run any of it. How Harbor Check reads them, and what it found.

  • zenniskayy2k4/CVE-2024-36039_PoC Harbor Check: matches CVE 1 star, Python, created
    PoC for CVE-2024-36039: Demonstrating SQL Injection via PyMySQL Object-to-String serialization flaw

Attack patterns (CAPEC)

  • CAPEC-7 Blind SQL Injection Likelihood: High · Severity: High
  • CAPEC-66 SQL Injection Likelihood: High · Severity: High
  • CAPEC-108 Command Line Execution through SQL Injection Likelihood: Low · Severity: Very High
  • CAPEC-109 Object Relational Mapping Injection Likelihood: Low · Severity: High
  • CAPEC-110 SQL Injection through SOAP Parameter Tampering Likelihood: High · Severity: Very High
  • CAPEC-470 Expanding Control over the Operating System from the Database Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON