X.509 peer certificate not checked
Description
The defect occurs when you do not properly check the X.509 certificate used to authenticate the TLS/SSL connection when handling the connection. To properly check the certificate, you must call these two functions together to obtain and verify the certificate.
SSL_get_peer_certificate
: Obtains a certificate from the client or server you are trying to authenticate. The function returns NULL if no certificate is present. Even if the function returns a certificate, the certificate must still be checked.SSL_get_verify_result
: Verifies the certificate presented by the client or server. If you do not obtain a certificate before calling this function, there are no verification errors and the function returns successfully.
The checker raises a defect on the functions SSL_read
or
SSL_write
when you attempt to read from or write to the TLS/SSL
connection.
The checker raises no defect if:
You declare the SSL context outside the scope of the function handling the connection.
You use anonymous cypher suites.
Risk
If you do not properly check the validity of the certificate of the peer you are attempting to authenticate, your connection is vulnerable to man-in-the-middle attacks.
Fix
To properly check the validity of the certificate, call both
SSL_get_peer_certificate
and
SSL_get_verify_result
.
Examples
Result Information
Group: Cryptography |
Language: C | C++ |
Default: Off |
Command-Line Syntax:
CRYPTO_SSL_CERT_NOT_CHECKED |
Impact: Medium |
Version History
Introduced in R2020a
See Also
Find defects
(-checkers)
| Missing certification authority
list
| Missing X.509
certificate
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)