Skip to content

Fix CA pinning bypass in Python path - #71

Open
cisco-annikiti wants to merge 2 commits into
masterfrom
CA-pinning-bypass
Open

Fix CA pinning bypass in Python path#71
cisco-annikiti wants to merge 2 commits into
masterfrom
CA-pinning-bypass

Conversation

@cisco-annikiti

Copy link
Copy Markdown
Contributor

Description

Replace ssl.create_default_context() with ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) in CertValidatingHTTPSConnection.connect() to prevent OS system CAs from being loaded alongside the bundled ca_certs.pem. Explicitly set check_hostname = True, verify_mode = CERT_REQUIRED, and disable SSLv2/SSLv3.

Motivation and Context

ssl.create_default_context() calls load_default_certs() internally, which loads the OS system trust store. The subsequent load_verify_locations(cafile=ca_certs) only ADDS bundled CAs on top - it does not replace the system CAs. This makes CA pinning a no-op: any certificate trusted by the OS is accepted even with pinning enabled. The fix ensures that when CA pinning is ON, only the bundled ca_certs.pem is used as the trust store

How Has This Been Tested?

python3 -m unittest test_duo_openvpn -v — 42 tests pass

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@cisco-annikiti
cisco-annikiti marked this pull request as ready for review July 28, 2026 15:16
Comment thread https_wrapper.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants