VAITP Dataset

← Back to the dataset

CVE-2022-33684

TLS certificate issue in Apache Pulsar clients allows OAuth2.0 man-in-the-middle attacks

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

The Apache Pulsar C++ Client does not verify peer TLS certificates when making HTTPS calls for the OAuth2.0 Client Credential Flow, even when tlsAllowInsecureConnection is disabled via configuration. This vulnerability allows an attacker to perform a man in the middle attack and intercept and/or modify the GET request that is sent to the ClientCredentialFlow 'issuer url'. The intercepted credentials can be used to acquire authentication data from the OAuth2.0 server to then authenticate with an Apache Pulsar cluster. An attacker can only take advantage of this vulnerability by taking control of a machine 'between' the client and the server. The attacker must then actively manipulate traffic to perform the attack. The Apache Pulsar Python Client wraps the C++ client, so it is also vulnerable in the same way. This issue affects Apache Pulsar C++ Client and Python Client versions 2.7.0 to 2.7.4; 2.8.0 to 2.8.3; 2.9.0 to 2.9.2; 2.10.0 to 2.10.1; 2.6.4 and earlier. Any users running affected versions of the C++ Client or the Python Client should rotate vulnerable OAuth2.0 credentials, including client_id and client_secret. 2.7 C++ and Python Client users should upgrade to 2.7.5 and rotate vulnerable OAuth2.0 credentials. 2.8 C++ and Python Client users should upgrade to 2.8.4 and rotate vulnerable OAuth2.0 credentials. 2.9 C++ and Python Client users should upgrade to 2.9.3 and rotate vulnerable OAuth2.0 credentials. 2.10 C++ and Python Client users should upgrade to 2.10.2 and rotate vulnerable OAuth2.0 credentials. 3.0 C++ users are unaffected and 3.0 Python Client users will be unaffected when it is released. Any users running the C++ and Python Client for 2.6 or less should upgrade to one of the above patched versions.

CVSS base score
8.1
Published
2022-11-04
OWASP
A07 Identification and Authentication Failures
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Cryptographic
Subcategory
Improper SSL/TLS Certificate Validation
Accessibility scope
Remote
Impact
Unauthorized Access
Affected component
Apache Pulsar C++ Client
Fixed by upgrading
Yes

Solution

Python Client: Upgrade to the corresponding patched version.

Vulnerable code sample

import requests
from requests.auth import HTTPBasicAuth

# Configuration for OAuth2.0 Client Credential Flow
client_id = 'your_client_id'
client_secret = 'your_client_secret'
issuer_url = 'https://your-issuer-url.com/oauth/token'

# Insecure request without verifying TLS certificates
response = requests.post(
    issuer_url,
    auth=HTTPBasicAuth(client_id, client_secret),
    verify=False,  # This allows for the vulnerability by not verifying TLS certificates
    data={'grant_type': 'client_credentials'}
)

if response.status_code == 200:
    print("Access token retrieved successfully.")
    access_token = response.json().get('access_token')
    print("Access Token:", access_token)
else:
    print("Failed to retrieve access token:", response.status_code, response.text)

Patched code sample

import requests
from requests.auth import HTTPBasicAuth

# Configuration for OAuth2.0 Client Credential Flow
client_id = 'your_client_id'
client_secret = 'your_client_secret'
issuer_url = 'https://your-issuer-url.com/oauth/token'

# Use verify=True to ensure TLS certificates are verified
response = requests.post(
    issuer_url,
    auth=HTTPBasicAuth(client_id, client_secret),
    verify=True,  # This ensures that the TLS certificate is verified
    data={'grant_type': 'client_credentials'}
)

if response.status_code == 200:
    print("Access token retrieved successfully.")
    access_token = response.json().get('access_token')
    print("Access Token:", access_token)
else:
    print("Failed to retrieve access token:", response.status_code, response.text)

Cite this entry

@misc{vaitp:cve202233684,
  title        = {{TLS certificate issue in Apache Pulsar clients allows OAuth2.0 man-in-the-middle attacks}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2022},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2022-33684},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2022-33684/}}
}

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.