Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2024-12745

CVE-2024-12745: Amazon Redshift Connector SQLi Vulnerability

CVE-2024-12745 is a SQL injection vulnerability in Amazon Redshift Python Connector v2.1.4 that enables privilege escalation through metadata APIs. This article covers technical details, affected versions, and mitigation.

Published:

CVE-2024-12745 Overview

CVE-2024-12745 is a SQL injection vulnerability in the Amazon Redshift Python Connector version 2.1.4. The flaw exists in the get_schemas, get_tables, and get_columns Metadata APIs, which fail to properly sanitize input parameters before including them in SQL statements. An authenticated user can inject SQL through these APIs to escalate privileges within the Redshift database.

Amazon assigned this issue as [CWE-89] (Improper Neutralization of Special Elements used in an SQL Command). The vulnerability requires low privileges and user interaction, but the attack vector is network-based against a widely deployed data-warehouse client library.

Critical Impact

Authenticated attackers can execute arbitrary SQL through Metadata APIs to gain escalated privileges on Amazon Redshift clusters accessed via the vulnerable Python driver.

Affected Products

  • Amazon Redshift Python Connector 2.1.4
  • Applications embedding amazon-redshift-python-driver version 2.1.4
  • Downstream tooling (ORMs, ETL jobs, notebooks) that pin the affected driver release

Discovery Timeline

  • 2024-12-24 - CVE-2024-12745 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-12745

Vulnerability Analysis

The Amazon Redshift Python Connector exposes Metadata APIs that return schema, table, and column information from a Redshift cluster. In version 2.1.4, the get_schemas, get_tables, and get_columns methods concatenate caller-supplied filter arguments (such as schema patterns and table patterns) directly into the generated SQL query.

Because these arguments are not parameterized or escaped, an attacker who controls the input to these methods can break out of the intended string literal and append additional SQL statements. The injected SQL executes with the privileges of the Redshift session, which in many deployments is a higher-privileged service or ETL role.

The root issue is classified as [CWE-89] SQL Injection. Metadata retrieval paths are typically reached from application code that passes user-controlled filters, such as an admin console listing schemas by name pattern, which broadens the attack surface beyond direct database users.

Root Cause

The Metadata APIs build catalog queries against Redshift system tables (for example, pg_catalog.svv_tables) using Python string formatting rather than bound parameters. Special characters, quotes, and statement terminators in caller input are passed through to the server unchanged, allowing statement injection into privileged metadata lookups.

Attack Vector

An attacker with low-privilege access to an application that consumes the Redshift Python driver supplies a crafted schema, table, or column filter. The application invokes get_schemas, get_tables, or get_columns with that value, producing a malicious SQL statement executed under the Redshift session role. Successful exploitation can read restricted tables, modify data, or grant new roles inside the cluster.

No public proof-of-concept, CISA KEV listing, or evidence of exploitation in the wild has been reported for CVE-2024-12745.

For technical detail, see the GitHub Security Advisory GHSA-8gc2-vq6m-rwjw and the AWS Security Bulletin 2024-015.

Detection Methods for CVE-2024-12745

Indicators of Compromise

  • Redshift audit log entries showing unexpected GRANT, ALTER ROLE, or CREATE USER statements originating from application service accounts.
  • Metadata catalog queries against pg_catalog or svv_* views containing SQL keywords, comment markers (--, /*), or stacked statements in filter parameters.
  • Sessions from application hosts issuing DDL or privilege-changing SQL outside normal ETL workflows.

Detection Strategies

  • Inventory Python environments for redshift_connector==2.1.4 using dependency scanners and software composition analysis tools.
  • Review application code that calls get_schemas, get_tables, or get_columns and confirm whether filter arguments are derived from untrusted input.
  • Enable Redshift audit logging and hunt for anomalous SQL patterns issued through the driver's metadata code paths.

Monitoring Recommendations

  • Forward Redshift useractivitylog and connectionlog events to a centralized SIEM for correlation against application access logs.
  • Alert on privilege changes (GRANT, REVOKE, role creation) initiated by service accounts that should only perform read operations.
  • Track outbound queries from analytics hosts for spikes in metadata query volume, which can indicate reconnaissance preceding injection.

How to Mitigate CVE-2024-12745

Immediate Actions Required

  • Upgrade amazon-redshift-python-driver to version 2.1.5 or later, or revert to 2.1.3 if upgrade is not immediately possible.
  • Audit application code paths that pass user input into get_schemas, get_tables, or get_columns and add server-side input validation.
  • Rotate credentials for Redshift users associated with applications that used the vulnerable driver, especially high-privilege ETL roles.

Patch Information

Amazon released the fix in Amazon Redshift Python Driver v2.1.5. The patched release sanitizes input passed to the affected Metadata APIs. Version 2.1.3 is not affected and can be used as a rollback target per the vendor advisory.

Workarounds

  • Restrict Redshift database roles used by applications to the minimum privileges required, avoiding superuser or broad GRANT capabilities.
  • Filter or reject SQL metacharacters (single quotes, semicolons, comment sequences) in application input before invoking Metadata APIs.
  • Isolate applications that cannot be patched immediately behind network controls that limit their ability to reach production Redshift clusters.
bash
# Upgrade the affected driver with pip
pip install --upgrade "redshift_connector>=2.1.5"

# Verify installed version
python -c "import redshift_connector; print(redshift_connector.__version__)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.