VAITP Dataset

← Back to the dataset

CVE-2020-24715

Scalyr Agent < 2.1.10: SSL cert validation lacking hostname comparison

  • CVSS 9.8
  • CWE-295 Improper Certificate Validation
  • Cryptographic
  • Remote

The Scalyr Agent before 2.1.10 has Missing SSL Certificate Validation because, in some circumstances, native Python code is used that lacks a comparison of the hostname to commonName and subjectAltName.

CVSS base score
9.8
Published
2020-08-27
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Cryptographic
Subcategory
Improper SSL/TLS Certificate Validation
Accessibility scope
Remote
Impact
Unauthorized Access
Affected component
Python
Fixed by upgrading
Yes

Solution

Update Scalyr Agent to version 2.1.10 or higher.

Vulnerable code sample

import ssl
import socket

def connect_to_server(host, port):
    # Create an SSL context without hostname verification
    context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
    context.verify_mode = ssl.CERT_NONE  # Disable certificate verification

    with socket.create_connection((host, port)) as sock:
        with context.wrap_socket(sock) as ssock:
            print(ssock.version())

# Example usage
connect_to_server('example.com', 443)

Patched code sample

import ssl
import socket

def create_ssl_context():
    # Create an SSL context with proper hostname verification
    context = ssl.create_default_context()
    context.check_hostname = True  # Enable hostname checking
    context.verify_mode = ssl.CERT_REQUIRED  # Require a valid certificate
    return context

def connect_to_server(host, port):
    context = create_ssl_context()
    with socket.create_connection((host, port)) as sock:
        with context.wrap_socket(sock, server_hostname=host) as ssock:
            print(ssock.version())

# Example usage
connect_to_server('example.com', 443)

Cite this entry

@misc{vaitp:cve202024715,
  title        = {{Scalyr Agent < 2.1.10: SSL cert validation lacking hostname comparison}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2020},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2020-24715},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2020-24715/}}
}

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.