PyPI: mysql-connector-python

CVE-2024-21272

Safety vulnerability ID: SFTY-20241015-30374

Safety legacy ID: pyup.io-78798

Affected versions of the mysql-connector-python package are vulnerable to SQL Injection due to improper neutralization of special elements in SQL commands. The connector’s SQL-handling logic in the Connector/Python module fails to sanitize user-controlled input passed to internal SQL execution routines, allowing injection of malicious SQL syntax. An attacker with network access and low privileges can exploit this by crafting input that alters connector-issued queries, potentially enabling takeover of MySQL Connector/Python processes with full confidentiality, integrity, and availability impact.

Created at: Nov 5, 2025Updated at: Nov 5, 2025

Overview

MySQL Connector/Python connector takeover vulnerability

Advisory

Affected versions of the mysql-connector-python package are vulnerable to SQL Injection due to improper neutralization of special elements in SQL commands. The connector’s SQL-handling logic in the Connector/Python module fails to sanitize user-controlled input passed to internal SQL execution routines, allowing injection of malicious SQL syntax. An attacker with network access and low privileges can exploit this by crafting input that alters connector-issued queries, potentially enabling takeover of MySQL Connector/Python processes with full confidentiality, integrity, and availability impact.

Affected Package

Affecting mysql-connector-python package, versions
<9.1.0

Also affects

---

How to Fix

Upgrade
mysql-connector-python
to
9.1.0
or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

Verified by Safety

Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.

Learn more