Skip to content

SSL Certificate with Wrong Hostname

Fabien edited this page May 22, 2024 · 1 revision

Overview

An SSL certificate with the wrong hostname indicates a mismatch between the domain name listed on the SSL certificate and the domain name that the certificate is being used for. This discrepancy can lead to browser warnings, erode trust, and potentially expose users to man-in-the-middle attacks.

  • Severity: Medium

Impact

The consequences of using an SSL certificate with the wrong hostname include:

  • Browser Warnings: Users may see security warnings, deterring them from accessing the site, which can negatively impact traffic and trust.
  • Security Risks: Increases vulnerability to phishing attacks as users may become accustomed to ignoring security warnings.
  • Compliance Issues: Non-compliance with security standards and regulations that mandate proper certificate usage.

Cause

This issue may arise from several scenarios:

  • Configuration Errors: Incorrect details entered during the certificate request process.
  • Migration Oversights: Not updating the SSL certificate after changing the domain name or server.
  • Administrative Mistakes: Using a certificate intended for a different domain.

Solution

To resolve hostname mismatches and restore security assurances provided by SSL/TLS certificates:

  1. Verify Certificate and Domain Match:
    • Use SSL verification tools to check that the domain name in the certificate matches the domain name of the site:
      openssl s_client -connect yourdomain.com:443 -servername yourdomain.com | openssl x509 -noout -text | grep -A 1 "Subject Alternative Name"
  2. Obtain a New Certificate:
    • If discrepancies are found, request a new SSL certificate with the correct hostname from your certificate authority (CA).
    • Consider obtaining a wildcard certificate if multiple subdomains require coverage.
  3. Update Server Configuration:
    • Replace the old certificate with the new one on your server. For servers like Apache or Nginx, update the SSL certificate paths in the configuration files.

Examples

Updating Apache SSL Configuration:

Update your Apache configuration to reference the correct SSL certificate files:

<VirtualHost *:443>
    ServerName yourdomain.com
    SSLEngine on
    SSLCertificateFile /path/to/your_domain_name.crt
    SSLCertificateKeyFile /path/to/your_private.key
    SSLCertificateChainFile /path/to/CA_bundle.crt
</VirtualHost>

Restart Apache to apply changes:

sudo systemctl restart apache2

References

Additional Resources

Microsoft Related Vulnerabilities

SSL/TLS Related

OpenSSL Related Vulnerabilities

Apache Related Vulnerabilities

Java/Oracle Related Vulnerabilities

Miscellaneous Vulnerabilities

Miscellaneous

  • Template -> Use this template for new vulnerabilities
Clone this wiki locally