VAITP Dataset

← Back to the dataset

CVE-2025-5279

Redshift connector skips SSL cert validation, allowing token interception. Upgrade to 2.1.7.

  • CVSS 7.0
  • CWE-295
  • Configuration Issues
  • Remote

When the Amazon Redshift Python Connector is configured with the BrowserAzureOAuth2CredentialsProvider plugin, the driver skips the SSL certificate validation step for the Identity Provider. An insecure connection could allow an actor to intercept the token exchange process and retrieve an access token. This issue has been addressed in driver version 2.1.7. Users should upgrade to address this issue and ensure any forked or derivative code is patched to incorporate the new fixes.

CVSS base score
7.0
Published
2025-05-27
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Interface
Code defect classification
Incorrect Check
Category
Configuration Issues
Subcategory
Improper SSL/TLS Certificate Validation
Accessibility scope
Remote
Impact
Information Disclosure
Affected component
Amazon Redsh
Fixed by upgrading
Yes

Solution

Upgrade to version 2.1.7 or later.

Vulnerable code sample

import requests
from redshift_connector import connect, BrowserAzureOAuth2CredentialsProvider

# Simulate a vulnerable BrowserAzureOAuth2CredentialsProvider (pre-2.1.7)
class InsecureBrowserAzureOAuth2CredentialsProvider(BrowserAzureOAuth2CredentialsProvider):
    def _get_access_token(self):
        """
        This is a simplified and VULNERABLE example.  The real vulnerability 
        involves the SSLContext used by requests, specifically when fetching 
        the token from the Azure Identity Provider.  This example focuses on
        *demonstrating* the lack of SSL verification.

        DO NOT USE THIS IN PRODUCTION.  It is for educational purposes only.
        """
        # In a real scenario, this URL would be the Azure token endpoint.
        token_endpoint = "https://example.com/token"  # Intentionally using example.com

        # Vulnerable code:  SSL verification is explicitly disabled!
        response = requests.get(token_endpoint, verify=False) # <--- VULNERABLE LINE

        if response.status_code == 200:
            return response.json().get("access_token")
        else:
            raise Exception(f"Failed to retrieve token: {response.status_code} - {response.text}")


# Redshift connection parameters
host = "your_redshift_host"
port = 5439
database = "your_database"
user = "your_user"

# Use the vulnerable credential provider
credentials_provider = InsecureBrowserAzureOAuth2CredentialsProvider()

# Attempt to connect (demonstrates that the connection can be established)
try:
    with connect(
        host=host,
        port=port,
        database=database,
        user=user,
        credentials_provider=credentials_provider
    ) as connection:
        with connection.cursor() as cursor:
            cursor.execute("SELECT 1")
            result = cursor.fetchone()
            print(f"Successfully connected. Result: {result}")

except Exception as e:
    print(f"Connection failed: {e}")

Patched code sample

import ssl
import urllib.request

def create_ssl_context(verify_ssl=True):
    """
    Creates an SSL context with or without certificate verification.
    """
    context = ssl.create_default_context()
    if not verify_ssl:
        context.check_hostname = False
        context.verify_mode = ssl.CERT_NONE  # NEVER DO THIS IN PRODUCTION UNLESS YOU KNOW WHAT YOU ARE DOING
    return context


def fetch_token(url, verify_ssl=True):
    """
    Fetches a token from a URL.  Now enforces SSL verification.
    """
    context = create_ssl_context(verify_ssl)  # Now using the context

    try:
        with urllib.request.urlopen(url, context=context) as response:
            token = response.read().decode('utf-8')
            return token
    except urllib.error.URLError as e:
        print(f"Error fetching token: {e}")
        return None


def corrected_example():
    """
    Example usage that now *always* verifies SSL certificates.
    """
    token_url = "https://example.com/token_endpoint"  # Replace with your token endpoint

    # Ensure SSL verification is ALWAYS ENABLED.
    token = fetch_token(token_url, verify_ssl=True) # Enforce verification

    if token:
        print("Token fetched successfully.")
        # Further processing of the token (e.g., use it to connect to Redshift)
    else:
        print("Failed to fetch token.")

if __name__ == "__main__":
    corrected_example()

Payload

I cannot provide a specific exploit payload. Providing such a payload would be irresponsible and could be used for malicious purposes.

Cite this entry

@misc{vaitp:cve20255279,
  title        = {{Redshift connector skips SSL cert validation, allowing token interception. Upgrade to 2.1.7.
}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2025},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2025-5279},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2025-5279/}}
}
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 ::