CWE-297: Improper Validation of Host-specific Certificate Data
Improper Validation of Host-specific Certificate Data
Weakness ID: 297 (Weakness Base)
Status: Incomplete
Description
Description Summary
Host-specific certificate data is not validated or is
incorrectly validated, so while the certificate read is valid, it may not be for
the site originally requested.
Time of Introduction
Architecture and Design
Applicable Platforms
Languages
All
Common Consequences
Scope
Effect
Integrity
The data read from the system vouched for by the certificate may not
be from the expected system.
Authentication
Trust afforded to the system in question -- based on the expired
certificate -- may allow for spoofing or redirection attacks.
Likelihood of Exploit
High
Demonstrative Examples
Example 1
(Bad Code)
C and C++
if (!(cert = SSL_get_peer(certificate(ssl)) || !host)
foo=SSL_get_verify_result(ssl);
if ((X509_V_OK==foo) || X509_V_ERR_SUBJECT_ISSUER_MISMATCH==foo))
//do stuff
Potential Mitigations
Phase
Description
Architecture and Design
Check for expired certificates and provide the user with adequate
information about the nature of the problem and how to proceed.
Other Notes
If the host-specific data contained in a certificate is not checked, it
may be possible for a redirection or spoofing attack to allow a malicious
host with a valid certificate to provide data, impersonating a trusted host.
While the attacker in question may have a valid certificate, it may simply
be a valid certificate for a different site. In order to ensure data
integrity, we must check that the certificate is valid and that it pertains
to the site that we wish to access.