使用证书进行SSL身份验证:证书是否应具有主机名?

six*_*ude 6 security authentication ssl certificate ssl-certificate

问题的快速版本

Gmail,TD(加拿大银行),皇家银行(加拿大银行)都使用ssl.当你检查他们的证书时,他们都有

Common Name (CN)   mail.google.com
Run Code Online (Sandbox Code Playgroud)

或者更一般地说:

Common Name (CN)   <url>
Run Code Online (Sandbox Code Playgroud)

这是否需要防止中间人攻击?

摘要

JBoss允许客户端和服务器使用证书和ssl进行身份验证.有一件事似乎很奇怪,你不需要在证书上提供你的主机名.

我认为这意味着如果服务器B在您的信任库中,则服务器B可以伪装成他们想要的任何服务器.

(同样地:如果客户B在您的信托商店......)

我在这里错过了什么吗?

验证步骤

(Wikipeida页面摘要)

Client                                                  Server
=================================================================================================
1) Client sends Client Hello
        ENCRIPTION: None
        - highest TLS protocol supported
        - random number
        - list of cipher suites
        - compression methods

                                                        2) Sever Hello
                                                                ENCRIPTION: None
                                                                - highest TLS protocol supported
                                                                - random number
                                                                - choosen cipher suite
                                                                - choosen compression method

                                                        3) Certificate Message
                                                                ENCRIPTION: None
                                                                -

                                                        4) ServerHelloDone
                                                                ENCRIPTION: None

5) Certificate Message
        ENCRIPTION: None

6) ClientKeyExchange Message
        ENCRIPTION: server's public key => only server can read
                => if sever can read this he must own the certificate
        - may contain a PreMasterSecerate, public key or nothing (depends on cipher)

7) CertificateVerify Message
        ENCRIPTION: clients private key
        - purpose is to prove to the server that client owns the cert


                        8) BOTH CLIENT AND SERVER:
                                - use random numbers and PreMasterSecret to compute a common secerate


9) Finished message
        - contains a has and MAC over previous handshakes
                (to ensure that those unincripted messages did not get broken)


                                                        10) Finished message
                                                                - samething
Run Code Online (Sandbox Code Playgroud)

谢弗知道

  • 客户端具有发送证书的公钥(步骤7)

  • 客户的证书有效,因为:

    • 它已由CA(verisign)签署
    • 它已经自签名但它位于服务器的信任库中
  • 它不是重放攻击,因为可能随机编号(步骤1或2)与每条消息一起发送

客户知道

  • 服务器具有发送的证书的公钥(步骤6和步骤8)

  • 服务器的证书有效,因为:

    • 它已由CA(verisign)签署
    • 它已经自签名但它在客户的信任库中
  • 它不是重放攻击,因为可能随机编号(步骤1或2)与每条消息一起发送

潜在问题

  • 假设客户端的信任库中有证书:

    • 服务器A.
    • 服务器B(恶毒的)
  • 服务器A的主机名为www.A.com

  • 服务器B的主机名为www.B.com

  • 假设:客户端尝试连接到服务器A,但服务器B启动中间人攻击.

  • 自服务器B:

    • 具有将发送给客户端的证书的公钥
    • 有一个"有效证书"(信任库中的证书)
  • 从那以后:
    • 证书中没有主机名

看起来服务器B可以轻易地伪装成服务器A.

有什么东西我错过了吗?

Mic*_*SFT 2

您能否指出一些文字,说明 JBoss 不需要证书中的主机名,或者这只是您的观察?我假设“主机名”是指通用名称(CN)或专有名称(DN)?

通常,应用程序应检查 X.509 证书:

有效日期范围
用途(例如,服务器身份验证)
链接到受信任的根
CN == 目标主机的 DNS 名称(可能是另一个名称,而不仅仅是 DNS)
未撤销(使用 CRL 或 OCSP)

从技术上讲,应用程序可以选择忽略其中任何一个,只是表明证书一切正常......但这很糟糕:)