Vulnerabilities in pkg:pypi/mysql-connector-python

PACKAGE
Advisory Identifier: GHSA-hgjp-83m4-h4fj
Advisory Summary

CVE-2024-21272 is a HIGH (CVSS 7.5) mysql connector/python connector takeover vulnerability vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Mysql connector python libraries in the PyPI ecosystem. The issue involves mysql connector/python connector takeover vulnerability. Remediation is available by upgrading affected packages to version 9.1.0.

3 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/mysql-connector-python

3 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/mysql-connector-python. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-hgjp-83m4-h4fj CVE-2024-21272 HIGH MySQL Connector/Python connector takeover vulnerability
GHSA-2cf3-g243-hhfx CVE-2017-3590 LOW MySQL Connectors Privilege Escalation
GHSA-v5rq-w2xm-7g5f CVE-2019-2435 HIGH Improper Access Control in MySQL Connector Python

CVE-2024-21272 at a Glance

CVE Identifier CVE-2024-21272
GHSA Identifier GHSA-hgjp-83m4-h4fj
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Mysql connector python
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-21272

To remediate this vulnerability, upgrade all affected Mysql connector python dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mysql-connector-python fixed: 9.1.0
pip install mysql-connector-python>=9.1.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show mysql-connector-python

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2024-21272, inspect your installed packages using pip:

pip show mysql-connector-python

Analyze the terminal output to locate any version of Mysql connector python in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 9.1.0), your application is affected.

Note: The pip show mysql-connector-python command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Mysql connector python, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Vulnerability in the MySQL Connectors product of Oracle MySQL (component: Connector/Python). Supported versions that are affected are 9.0.0 and prior. Difficult to exploit vulnerability allows low privileged attacker with network access via multiple protocols to compromise MySQL Connectors. Successful attacks of this vulnerability can result in takeover of MySQL Connectors. CVSS 3.1 Base Score 7.5 (Confidentiality, Integrity and Availability impacts). CVSS Vector: (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).

CVE-2024-21272 Affected Mysql connector python Versions

1 component(s)
Fixed Versions:
9.1.0
Product / Package Ecosystem Affected Versions Fixed Version
mysql-connector-python
PyPI
< 9.1.0
9.1.0

References

Frequently Asked Questions

What is CVE-2024-21272?
CVE-2024-21272 is a security vulnerability in Mysql connector python involving MySQL Connector/Python connector takeover vulnerability under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Mysql connector python versions are affected?
Affected versions include releases prior to 9.1.0 across affected packages: mysql-connector-python.
What version fixes CVE-2024-21272?
Upgrading to 9.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mysql-connector-python affected?
Yes, mysql-connector-python is affected in releases prior to 9.1.0. Upgrade your dependency to 9.1.0 or later.
What is the CVSS score of CVE-2024-21272?
CVE-2024-21272 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-21272?
CVE-2024-21272 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check PyPI dependencies for CVE-2024-21272?
Run the dependency tree command: 'pip show mysql-connector-python'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hgjp-83m4-h4fj",
  "modified" : "2024-10-24T16:45:37Z",
  "published" : "2024-10-15T21:30:39Z",
  "aliases" : [ "CVE-2024-21272" ],
  "summary" : "MySQL Connector/Python connector takeover vulnerability",
  "details" : "Vulnerability in the MySQL Connectors product of Oracle MySQL (component: Connector/Python).  Supported versions that are affected are 9.0.0 and prior. Difficult to exploit vulnerability allows low privileged attacker with network access via multiple protocols to compromise MySQL Connectors.  Successful attacks of this vulnerability can result in takeover of MySQL Connectors. CVSS 3.1 Base Score 7.5 (Confidentiality, Integrity and Availability impacts).  CVSS Vector: (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "mysql-connector-python"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "9.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-21272"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mysql/mysql-connector-python/commit/e6b927af06e8a85bd3754f602df96a5592b4558c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mysql/mysql-connector-python"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuoct2024.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-10-24T16:45:37Z",
    "nvd_published_at" : "2024-10-15T20:15:18Z"
  }
}