【问题标题】:how to decrypt the TLS/SSL package content in wireshark pcapng log file?如何解密wireshark pcapng日志文件中的TLS/SSL包内容?
【发布时间】:2020-06-08 08:27:10
【问题描述】:

我手头有 PEM 密钥和 RSA 密钥,当我试图分析登录到我的网络节点的 wireshark pcapng 文件时,tls 加密的 tls/ssl 包内容无法解密,如下所示:

openssl(x509)打印出来的pem key信息如下图:

Certificate:
Data:
    Version: 3 (0x2)
    Serial Number:
        17:.......................:5d
Signature Algorithm: sha256WithRSAEncryption
    Issuer: C=US, ST=Washington, L=Seattle, O=changeme changeme Company, OU=IT, CN=changeme Corporate Issuing CA 01
    Validity
        Not Before: Sep  9 09:27:27 2019 GMT
        Not After : Sep  8 09:27:27 2020 GMT
    Subject: C=US, ST=DC, L=ST, O=changeme changeme Company, OU=IT, CN=cmeptgapp.changeme.net
    Subject Public Key Info:
        Public Key Algorithm: rsaEncryption
            Public-Key: (2048 bit)
            Modulus:
                00..........................................d4:
                ..............
                eb..........................................af:
                44:6f
            Exponent: 65537 (0x10001)
    X509v3 extensions:
        X509v3 Subject Key Identifier: 
            FA:58:...................3C:88
        X509v3 Authority Key Identifier: 
            keyid:AB:1......................................:21

        X509v3 CRL Distribution Points: 

            Full Name:
              URI:http://crl.changeme.com/pki/tdtd

        Authority Information Access: 
            CA Issuers - URI:http://crl.changeme.com/pki/dtfh.crt
            OCSP - URI:http://whoknows.changeme.com/whoknows
        X509v3 Key Usage: critical
            Digital Signature, Key Encipherment
        1.3............d...
        X509v3 Extended Key Usage: 
            TLS Web Server Authentication
        1............10: 
           .
        X509v3 Certificate Policies: 
            Policy: 1.3.6.1.4.1.45807.509.1.2
              CPS: http://nobody.changeme.com/policies/nobodykonows.html

        X509v3 Subject Alternative Name: 
            DNS:cmeptgapp.changeme.net
Signature Algorithm: sha256WithRSAEncryption
     05................................................:e4:
     ......................................................................
     ...................................................:7b

我尝试通过以下方式解密包内容:

1.编辑wireshark/preference/protocol/ssl/RSA密钥

2. editcap 命令

但不幸的是没有人工作,可能是我使用了错误的命令。如何解决这个问题?

【问题讨论】:

    标签: networking certificate ssl-certificate wireshark wireshark-dissector


    【解决方案1】:

    客户端和服务器可能使用完美前向保密(例如 ECDH、DHE-RSA、ECDHE-RSA 或 ECDHE-ECDSA)交换密钥。检查 TLS 会话中的前两个数据包。

    在使用 Diffie-Hellman 密钥交换时,如果您只有 RSA 私钥,则无法解密 TLS 流量。您将需要使用 SSLKEYLOGFILE 记录每个会话的机密,如 Wireshark wiki TLS page 中所述。

    另一种选择是使用 TLS 代理解密 TLS 流量,例如 PolarProxySSLsplit

    【讨论】:

    • 感谢您的回复。但似乎 SSLKEYLOGFILE 仅适用于客户端生成的客户端?这里有没有一种方法我们也可以在服务器端生成 SSLKEYLOGFILE 文件来解密传递给 https 服务器的每个包?
    • @Tony:服务器端的 SSLKEYLOGFILE 支持仍然很少见,但情况正在发生变化。 OpenSSL 1.1.1 包括对 SSLKEYLOGFILE 的支持。另外,请参阅Extracting openssl pre-master secret from apache2 上的这个 SE 线程。然而,更常见的解决方案是使用外部 TLS 终止代理来执行解密。然后,您将能够在 TLS 代理和 Web 服务器之间捕获/检查明文 HTTP。
    猜你喜欢
    • 2020-11-01
    • 2020-12-06
    • 2018-12-31
    • 2019-12-09
    • 2018-05-08
    • 1970-01-01
    • 2016-11-03
    • 2014-02-07
    • 1970-01-01
    相关资源
    最近更新 更多