VAITP Dataset

← Back to the dataset

CVE-2026-123859

SQL injection via unescaped DataFrame column names in Snowflake Python connector.

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

When identifier escaping is disabled through a non-default configuration, the write_pandas() data-loading functionality in the Snowflake Connector for Python and the Snowflake Connector for Python (Universal Core) did not escape DataFrame column names before including them in generated SQL, which could allow SQL injection. In both products, a crafted column name could have been used to chain additional SQL statements onto the generated statement, potentially allowing an attacker to read, modify, or delete other data accessible to the application's Snowflake role. Exploitation required an application to pass attacker controlled column names into this functionality. The fix is available in Snowflake Connector for Python version 4.8.1 and Snowflake Connector for Python (Universal Core) version 5.2.0. Users must upgrade manually.

CVSS base score
8.1
Published
2026-11-06
OWASP
A03 Injection
Orthogonal defect classification
Interface
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
SQL Injection
Accessibility scope
Remote
Impact
Data Theft
Affected component
Snowflake Connector for Python
Fixed by upgrading
Yes

Solution

Upgrade to Snowflake Connector for Python v4.8.1 (or later) and Snowflake Connector for Python (Universal Core) v5.2.0 (or later).

Vulnerable code sample

import snowflake.connector
import pandas as pd

def load_dataframe(df: pd.DataFrame, conn: snowflake.connector.SnowflakeConnection, table: str):
    # VULNERABLE: column names are inserted into SQL without escaping
    cols = ", ".join(df.columns)
    placeholders = ", ".join(["%s"] * len(df.columns))
    insert_sql = f"INSERT INTO {table} ({cols}) VALUES ({placeholders})"
    cursor = conn.cursor()
    try:
        cursor.executemany(insert_sql, df.values.tolist())
    finally:
        cursor.close()

Patched code sample

import snowflake.connector
import pandas as pd

def load_dataframe(df: pd.DataFrame, conn: snowflake.connector.SnowflakeConnection, table: str):
    # FIX: column names are safely quoted to prevent injection
    def quote(col: str) -> str:
        return '"' + col.replace('"', '""') + '"'
    cols = ", ".join(quote(c) for c in df.columns)
    placeholders = ", ".join(["%s"] * len(df.columns))
    insert_sql = f"INSERT INTO {table} ({cols}) VALUES ({placeholders})"
    cursor = conn.cursor()
    try:
        cursor.executemany(insert_sql, df.values.tolist())
    finally:
        cursor.close()

Cite this entry

@misc{vaitp:cve2026123859,
  title        = {{SQL injection via unescaped DataFrame column names in Snowflake Python connector.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-123859},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-123859/}}
}

Download this entry as JSON Download the whole dataset

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 ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.