Authentication Bypass: OpenSSL CTX Object Modified after SSL Objects are Created

Draft Variant
Structure: Simple
Description

This vulnerability occurs when an application modifies an OpenSSL context object after it has already been used to create active SSL/TLS connections.

Extended Description

In OpenSSL, the SSL_CTX object acts as a template for creating individual SSL connection objects. When you change settings in the SSL_CTX after SSL objects have already been instantiated from it, those existing connections may unexpectedly inherit the new configuration. This can lead to inconsistent security states across your application's connections. For developers, this means that security-critical modifications—like changing authentication modes, cipher suites, or certificate settings—should be applied to the SSL_CTX before creating any SSL objects. Once connections are established, altering the parent context introduces unpredictable behavior and can potentially weaken or bypass authentication controls for previously created sessions.

Common Consequences 2
Scope: Access Control

Impact: Bypass Protection Mechanism

No authentication takes place in this process, bypassing an assumed protection of encryption.

Scope: Confidentiality

Impact: Read Application Data

The encrypted communication between a user and a trusted host may be subject to a sniffing attack.

Potential Mitigations 3
Phase: Architecture and Design
Use a language or a library that provides a cryptography framework at a higher level of abstraction.
Phase: Implementation
Most SSL_CTX functions have SSL counterparts that act on SSL-type objects.
Phase: Implementation
Applications should set up an SSL_CTX completely, before creating SSL objects from it.
Demonstrative Examples 1
The following example demonstrates the weakness.

Code Example:

Bad
C
c
Modes of Introduction
Implementation