VAITP Dataset

← Back to the dataset

CVE-2026-66053

Improper certificate host validation in Apache Thrift Python bindings.

  • CVSS 5.9
  • 297
  • Cryptographic
  • Remote

Improper Validation of Certificate with Host Mismatch vulnerability in Apache Thrift Python bindings. This issue affects Apache Thrift: before 0.24.0. Users are recommended to upgrade to version 0.24.0, which fixes the issue. This replaces CVE-2026-41603

CWE
297
CVSS base score
5.9
Published
2026-07-27
OWASP
A02 Cryptographic Failures
Orthogonal defect classification
Checking
Code defect classification
Incorrect Check
Category
Cryptographic
Subcategory
Improper SSL/TLS Certificate Validation
Accessibility scope
Remote
Impact
Information Disclosure
Affected component
Apache Thrif
Fixed by upgrading
Yes

Solution

Upgrade Apache Thrift to version 0.24.0 or later.

Vulnerable code sample

import ssl
import socket
from thrift.transport.TSocket import TSocket
from thrift.transport.TTransport import TTransportException


class TSSLSocket(TSocket):
    """
    SSL-wrapped TSocket. Simplified to demonstrate a specific vulnerability.
    Based on Apache Thrift Python library.
    """
    def __init__(self, host='localhost', port=9090, ca_certs=None):
        super().__init__(host, port)
        self.ca_certs = ca_certs
        self.handle = None

    def open(self):
        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock.connect((self.host, self.port))

            context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
            context.load_verify_locations(self.ca_certs)
            context.verify_mode = ssl.CERT_REQUIRED

            # VULNERABLE: Hostname checking is False by default for a manually created SSLContext.
            self.handle = context.wrap_socket(
                sock,
                server_hostname=self.host
            )
        except (socket.error, ssl.SSLError) as e:
            self.close()
            raise TTransportException(TTransportException.NOT_OPEN, str(e))

Patched code sample

import ssl
import socket
from thrift.transport.TSocket import TSocket
from thrift.transport.TTransport import TTransportException


class TSSLSocket(TSocket):
    """
    SSL-wrapped TSocket. Simplified to demonstrate a specific vulnerability.
    Based on Apache Thrift Python library.
    """
    def __init__(self, host='localhost', port=9090, ca_certs=None):
        super().__init__(host, port)
        self.ca_certs = ca_certs
        self.handle = None

    def open(self):
        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock.connect((self.host, self.port))

            context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
            context.load_verify_locations(self.ca_certs)
            context.verify_mode = ssl.CERT_REQUIRED

            # FIX: Hostname checking is explicitly enabled on the SSLContext.
            context.check_hostname = True

            self.handle = context.wrap_socket(
                sock,
                server_hostname=self.host
            )
        except (socket.error, ssl.SSLError) as e:
            self.close()
            raise TTransportException(TTransportException.NOT_OPEN, str(e))

Cite this entry

@misc{vaitp:cve202666053,
  title        = {{Improper certificate host validation in Apache Thrift Python bindings.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-66053},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-66053/}}
}
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 ::