VAITP Dataset

← Back to the dataset

CVE-2025-24793

SQL injection vulnerability in Snowflake Python connector (2.2.5-3.13.0). Fixed in 3.13.1.

  • CVSS 7.0
  • CWE-89
  • Input Validation and Sanitization
  • Remote

The Snowflake Connector for Python provides an interface for developing Python applications that can connect to Snowflake and perform all standard operations. Snowflake discovered and remediated a vulnerability in the Snowflake Connector for Python. A function from the snowflake.connector.pandas_tools module is vulnerable to SQL injection. This vulnerability affects versions 2.2.5 through 3.13.0. Snowflake fixed the issue in version 3.13.1.

CVSS base score
7.0
Published
2025-01-29
OWASP
A03 Injection
Orthogonal defect classification
Interface
Code defect classification
Incorrect Functionality
Category
Input Validation and Sanitization
Subcategory
SQL Injection
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
Snowflake Co
Fixed by upgrading
Yes

Solution

Upgrade to version 3.13.1 or later.

Vulnerable code sample

import snowflake.connector
import pandas as pd
from snowflake.connector.pandas_tools import write_pandas

def write_to_snowflake(conn, table_name, df):
    
    escaped_table_name = table_name
    
    success, nchunks, nrows, _ = write_pandas(conn,
            df,
            escaped_table_name,
            auto_create_table=True,
            table_type=None,
            overwrite=False)


if __name__ == '__main__':

    conn = snowflake.connector.connect(
        user='your_user',
        password='your_password',
        account='your_account',
        warehouse='your_warehouse',
        database='your_database',
        schema='your_schema'
    )

    data = {'col1': [1, 2, 3], 'col2': ['a', 'b', 'c']}
    df = pd.DataFrame(data)

    table_name = "my_table; DROP TABLE my_table;"

    try:
       write_to_snowflake(conn, table_name, df)
    except Exception as e:
        print(f"Error writing to Snowflake: {e}")
    
    conn.close()

Patched code sample

import snowflake.connector
import pandas as pd
from snowflake.connector.pandas_tools import write_pandas
import re

def sanitize_table_name(name):
    if not re.fullmatch(r"[A-Za-z_][A-Za-z0-9_]*", name):
        raise ValueError("Invalid table name")
    return name.upper()

def write_to_snowflake(conn, table_name, df):
    sanitazed_table_name = sanitize_table_name(table_name)
    success, nchunks, nrows, _ = write_pandas(
        conn,
        df,
        sanitazed_table_name,
        auto_create_table=True,
        table_type=None,
        overwrite=False
    )

if __name__ == '__main__':
    conn = snowflake.connector.connect(
        user='your_user',
        password='your_password',
        account='your_account',
        warehouse='your_warehouse',
        database='your_database',
        schema='your_schema'
    )

    data = {'col1': [1, 2, 3], 'col2': ['a', 'b', 'c']}
    df = pd.DataFrame(data)

    table_name = "my_table; DROP TABLE my_table;"

    try:
        write_to_snowflake(conn, table_name, df)
    except Exception as e:
        print(f"Error writing to Snowflake: {e}")
    
    conn.close()

Payload

'); DROP TABLE users; --

Cite this entry

@misc{vaitp:cve202524793,
  title        = {{SQL injection vulnerability in Snowflake Python connector (2.2.5-3.13.0). Fixed in 3.13.1.
}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2025},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2025-24793},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2025-24793/}}
}
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 ::