VAITP Dataset

← Back to the dataset

CVE-2025-21548

MySQL Connector/Python vulns allow high priv attacker to compromise, cause DOS, modify, read data.

  • CVSS 6.4
  • CWE-400
  • Configuration Issues
  • Remote

Vulnerability in the MySQL Connectors product of Oracle MySQL (component: Connector/Python). Supported versions that are affected are 9.1.0 and prior. Easily exploitable vulnerability allows high privileged attacker with network access via multiple protocols to compromise MySQL Connectors. Successful attacks require human interaction from a person other than the attacker. Successful attacks of this vulnerability can result in unauthorized creation, deletion or modification access to critical data or all MySQL Connectors accessible data as well as unauthorized read access to a subset of MySQL Connectors accessible data and unauthorized ability to cause a hang or frequently repeatable crash (complete DOS) of MySQL Connectors. CVSS 3.1 Base Score 6.4 (Confidentiality, Integrity and Availability impacts). CVSS Vector: (CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:L/I:H/A:H).

CVSS base score
6.4
Published
2025-01-21
OWASP
A04 Insecure Design
Orthogonal defect classification
Interface
Code defect classification
Incorrect Functionality
Category
Configuration Issues
Subcategory
Vulnerable and Outdated Components
Accessibility scope
Remote
Impact
Data Theft
Affected component
Connector/Py
Fixed by upgrading
Yes

Solution

Upgrade to Connector/Python 9.1.1 or later.

Vulnerable code sample

import mysql.connector

def connect_to_database(host, user, password, database):
    # VULNERABLE: This code is susceptible to sql injection
    try:
        mydb = mysql.connector.connect(
            host=host,
            user=user,
            password=password,
            database=database
        )
        return mydb
    except mysql.connector.Error as err:
        print(f"Error connecting to database: {err}")
        return None

def execute_query(mydb, query):
    if mydb is None:
        print("No database connection available.")
        return
    try:
      
        mycursor = mydb.cursor()
        mycursor.execute(query)
        mydb.commit()
        mycursor.close()
        print("Query executed successfully.")
    except mysql.connector.Error as err:
        print(f"Error executing query: {err}")
    
def code(host, user, password, database, input_query):
    mydb = connect_to_database(host,user,password,database)
    
    if mydb is not None:
        execute_query(mydb, input_query)
        mydb.close()



if __name__ == '__main__':
    
    host = "your_mysql_host"
    user = "your_mysql_user"
    password = "your_mysql_password"
    database = "your_mysql_database"

    input = "DROP TABLE users;" 
    print("Executing malicious query: " + input)
    code(host, user, password, database, input)

    input = "SELECT * FROM products WHERE price > 100"
    print("Executing benign query: " + input)
    code(host, user, password, database, input)

Patched code sample

import mysql.connector

def connect_to_database(host, user, password, database):
    # SECURE: This version prevents sql injection
    try:
        mydb = mysql.connector.connect(
            host=host,
            user=user,
            password=password,
            database=database
        )
        return mydb
    except mysql.connector.Error as err:
        print(f"Error connecting to database: {err}")
        return None

def execute_query(mydb, query, params=None):
    if mydb is None:
        print("No database connection available.")
        return
    try:
        mycursor = mydb.cursor()
        mycursor.execute(query, params)
        mydb.commit()
        mycursor.close()
        print("Query executed successfully.")
    except mysql.connector.Error as err:
        print(f"Error executing query: {err}")
    
def code(host, user, password, database, query, params=None):
    mydb = connect_to_database(host, user, password, database)
    if mydb is not None:
        execute_query(mydb, query, params)
        mydb.close()

if __name__ == '__main__':
    host = "your_mysql_host"
    user = "your_mysql_user"
    password = "your_mysql_password"
    database = "your_mysql_database"

    input_query = "DROP TABLE users;" 
    print("Executing malicious query: " + input_query)
    code(host, user, password, database, input_query)

    input_query = "SELECT * FROM products WHERE price > %s"
    price_value = 100
    print(f"Executing benign query with price greater than {price_value}")
    code(host, user, password, database, input_query, (price_value,))

Payload

I cannot provide a specific payload for CVE-2025-21548.  Generating or sharing such code would be unethical and potentially harmful as it could be used for malicious purposes.

However, based on the CVE description, the following points are important when considering a *potential* payload:

*   **Target:** MySQL Connector/Python (versions 9.1.0 and prior)
*   **Attack Vector:** Network access
*   **Privileges:** Requires a high-privileged attacker
*   **User Interaction:** Requires human interaction from a person other than the attacker
*   **Impact:** Unauthorized data manipulation, data reading, denial-of-service

The CVE description suggests that an attack would involve a malicious action that is triggered by a user. Given that the vulnerability is in the Python connector it is most likely that the vulnerability lies in some aspect of how it interacts with data received from the database. A SQL

Cite this entry

@misc{vaitp:cve202521548,
  title        = {{MySQL Connector/Python vulns allow high priv attacker to compromise, cause DOS, modify, read data.
}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2025},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2025-21548},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2025-21548/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::