Skip to content
OpenAdvisories
Medium · 6.3 Public exploit CVE-2024-36039 EUVD-2024-1798GHSA-v9hf-5j83-6xppPYSEC-2026-502

PyMySQL SQL Injection vulnerability

Published May 21, 2024 · Updated Nov 21, 2024 · Assigned by mitre

Description

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

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 python-pymysql 1.1.1-1 —
Debian 13 python-pymysql 1.1.1-1 —
Debian 12 python-pymysql 1.0.2-2+deb12u1 DSA-5700-1
Debian 11 python-pymysql 0.9.3-2+deb11u1 DSA-5700-1
Debian 10 python-pymysql 0.9.3-1+deb10u1 DLA-3822-1
ReleasePackageFixed inAdvisory
Ubuntu 24.04 LTS python-pymysql 1.0.2-2ubuntu1.1 USN-6801-1
Ubuntu 22.04 LTS python-pymysql 1.0.2-1ubuntu1.22.04.1 USN-6801-1
Ubuntu 20.04 LTS python-pymysql 0.9.3-2ubuntu3.1 USN-6801-1
Ubuntu 18.04 LTS python-pymysql No fix yet —
Ubuntu 16.04 LTS python-pymysql No fix yet —
ReleasePackageFixed inAdvisory
RHEL 9 python3.11-PyMySQL +1 1.0.2-2.el9 RHSA-2024:9194
RHEL 9 python3.12-PyMySQL +1 1.1.0-3.el9 RHSA-2024:9193
RHEL 8 python3.11-PyMySQL 1.0.2-2.el8_10 RHSA-2024:4244
RHEL 8 python3.12-PyMySQL 1.1.0-3.el8_10 RHSA-2024:4245

AlmaLinux

Errata ↗
ReleasePackageFixed inAdvisory
AlmaLinux 9 python3.11-PyMySQL +1 1.0.2-2.el9 ALSA-2024:9194
AlmaLinux 9 python3.12-PyMySQL +1 1.1.0-3.el9 ALSA-2024:9193
AlmaLinux 8 python3.11-PyMySQL 1.0.2-2.el8_10 ALSA-2024:4244
AlmaLinux 8 python3.12-PyMySQL 1.1.0-3.el8_10 ALSA-2024:4245

Rocky Linux

Errata ↗
ReleasePackageFixed inAdvisory
Rocky Linux 9 python3.12-PyMySQL 1.1.0-3.el9 RLSA-2024:9193
Rocky Linux 8 python3.11-PyMySQL 1.0.2-2.el8_10 RLSA-2024:4244
Rocky Linux 8 python3.12-PyMySQL 1.1.0-3.el8_10 RLSA-2024:4245
ReleasePackageFixed inAdvisory
SLES 15 SP6 python-PyMySQL 0.7.11-150000.3.3.1 SUSE-SU-2024:1855-1
SLES 15 SP5 python-PyMySQL 0.7.11-150000.3.3.1 SUSE-SU-2024:1855-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed python-PyMySQL 1.2.0-1.2 openSUSE-SU-2026:11995-1
openSUSE Leap 15.6 python-PyMySQL 1.1.0-150600.3.3.1 SUSE-SU-2024:1925-1
openSUSE Leap 15.5 python-PyMySQL 0.7.11-150000.3.3.1 SUSE-SU-2024:1855-1

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 3 python-PyMySQL 1.1.1-3 —
Azure Linux 2 (CBL-Mariner) python-PyMySQL No fix yet —

Oracle Linux

ReleasePackageFixed inAdvisory
Oracle Linux 9 python3.11-PyMySQL +1 1.0.2-2.el9 ELSA-2024-9194
Oracle Linux 9 python3.12-PyMySQL +1 1.1.0-3.el9 ELSA-2024-9193
Oracle Linux 8 python3.11-PyMySQL 1.0.2-2.el8_10 ELSA-2024-4244
Oracle Linux 8 python3.12-PyMySQL 1.1.0-3.el8_10 ELSA-2024-4245

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling py3-pymysql 1.1.1-r0 —

Public exploits

Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.

Third-party code, not reviewed by us. Public PoCs are sometimes fake or contain malware. Read the code first and run it only in an isolated lab, against systems you are authorised to test.

GitHub 1 repository

Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI pymysql < 1.1.1 1.1.1 GHSA-v9hf-5j83-6xpp

Advisories 22

References