Skip to content
Fencer Vulns
medium 6.3

CVE-2024-36039 json

PyMySQL SQL Injection vulnerability

published 2024-05-21 2 y ago modified 2026-09-10 1 mo ago also GHSA-v9hf-5j83-6xpp , PYSEC-2026-502 , EUVD-2024-1798

cvss
6.3
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
0.7%
EPSS 0.7% chance of exploitation in 30 days, percentile 53%
public exploits
0
none known

Summary

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

Patch / fix

  • pypi pymysql 1.1.1
  • python-pymysql Debian 12 1.0.2-2+deb12u1
  • python-pymysql Debian 14, Debian 13 1.1.1-1

debian advisories DEBIAN-CVE-2024-36039

  • python-pymysql Ubuntu 20.04 LTS 0.9.3-2ubuntu3.1
  • python-pymysql Ubuntu 22.04 LTS 1.0.2-1ubuntu1.22.04.1
  • python-pymysql Ubuntu 24.04 LTS 1.0.2-2ubuntu1.1

ubuntu advisories UBUNTU-CVE-2024-36039

Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

  • python3.11-PyMySQL RHEL 9 1.0.2-2.el9
  • python3.11-PyMySQL+rsa RHEL 9 1.0.2-2.el9
  • python3.12-PyMySQL RHEL 9 1.1.0-3.el9
  • python3.12-PyMySQL+rsa RHEL 9 1.1.0-3.el9
  • python3.12-PyMySQL RHEL 8 1.1.0-3.el8_10
  • python3.11-PyMySQL RHEL 8 1.0.2-2.el8_10

red hat advisories RHSA-2024:9194RHSA-2024:9193RHSA-2024:4245RHSA-2024:4244

  • python-PyMySQL openSUSE Leap 15.6 1.1.0-150600.3.3.1
  • python-PyMySQL SLE Module for Package Hub 15 SP6, SLE Module for Package Hub 15 SP5, openSUSE Leap 15.5 0.7.11-150000.3.3.1

suse advisories SUSE-SU-2024:1925-1SUSE-SU-2024:1855-1

  • python-PyMySQL openSUSE Tumbleweed 1.2.0-1.2

opensuse advisories openSUSE-SU-2026:11995-1

  • python3.12-PyMySQL AlmaLinux 9 1.1.0-3.el9
  • python3.12-PyMySQL+rsa AlmaLinux 9 1.1.0-3.el9
  • python3.11-PyMySQL AlmaLinux 9 1.0.2-2.el9
  • python3.11-PyMySQL+rsa AlmaLinux 9 1.0.2-2.el9
  • python3.11-PyMySQL AlmaLinux 8 1.0.2-2.el8_10
  • python3.12-PyMySQL AlmaLinux 8 1.1.0-3.el8_10

almalinux advisories ALSA-2024:9193ALSA-2024:9194ALSA-2024:4244ALSA-2024:4245

  • python3.11-PyMySQL Rocky Linux 8 1.0.2-2.el8_10
  • python3.12-PyMySQL Rocky Linux 8 1.1.0-3.el8_10
  • python3.12-PyMySQL Rocky Linux 9 1.1.0-3.el9
  • python3.11-PyMySQL Rocky Linux 9 1.0.2-2.el9

rocky linux advisories RLSA-2024:4244RLSA-2024:4245RLSA-2024:9193RLSA-2024:9194

  • python-PyMySQL Azure Linux 3.0 1.1.1-3

azure linux advisories AZL-44457

Azure Linux vulnerability data, Copyright (c) Microsoft Corporation, from https://github.com/microsoft/AzureLinuxVulnerabilityData via OSV, under the MIT licence; changed: normalised to fixed package versions per release. MIT

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2024-36039 updated cvss 6.3

python-pymysql: SQL injection if used with untrusted JSON input

  • Red Hat Enterprise Linux 8 python-PyMySQL, python2-PyMySQL, python3-PyMySQL, python38-PyMySQL, python39-PyMySQL Red Hat Enterprise Linux 9 python3-PyMySQL Red Hat Software Collections rh-python38-python-PyMySQL
    affected: workaround, no fix planned “Make sure the permissions are set correctly for each user, database, table, operation, etc. Do not expose the PyMySQL library to untrusted JSON input.”
  • Red Hat Quay v3 quay/clair-rhel8 v3.12.1-1, quay/quay-rhel8 v3.12.1-11, quay/quay-builder-rhel8 v3.12.1-1, quay/quay-operator-rhel8 v3.12.1-3, quay/quay-operator-bundle v3.12.1-13, quay/quay-bridge-operator-rhel8 v3.12.1-3, +4 more
    fixed: vendor fix “Make sure the permissions are set correctly for each user, database, table, operation, etc. Do not expose the PyMySQL library to untrusted JSON input.” RHBA-2024:5039
  • Red Hat Enterprise Linux AppStream (v. 8) python3.11-PyMySQL 1.0.2-2.el8_10, python3.12-PyMySQL 1.1.0-3.el8_10
    fixed: vendor fix “Make sure the permissions are set correctly for each user, database, table, operation, etc. Do not expose the PyMySQL library to untrusted JSON input.” RHSA-2024:4244
  • Red Hat Enterprise Linux AppStream (v. 9) python3.11-PyMySQL 1.0.2-2.el9, python3.12-PyMySQL 1.1.0-3.el9, python3.11-PyMySQL+rsa 1.0.2-2.el9, python3.12-PyMySQL+rsa 1.1.0-3.el9
    fixed: vendor fix “Make sure the permissions are set correctly for each user, database, table, operation, etc. Do not expose the PyMySQL library to untrusted JSON input.” RHSA-2024:9194
  • Red Hat Enterprise Linux 10 python-PyMySQL
    not affected: vulnerable code not present

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

CISA SSVC

Exploitation
none
Automatable
no
Technical impact
partial
Assessed
2 y ago

Exploit prediction

0.69% chance of exploitation in the next 30 days, higher than 53% of all scored CVEs (FIRST EPSS, 2026-11-08).

CVSS scores

assigned by version score vector
CISA ADP 3.1 6.3 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
CNA 3.1 6.3 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
OSV 3.1 9.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
GitHub 3.1 9.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Affected packages

ecosystem package affected fixed in
pypi pymysql
<1.1.1
1.1.1

Classification

Weakness
  • CWE-89 Improper Neutralization of Special Elements used in an SQL Command

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.