如何调试 ssl 连接?

发布于 2024-11-15 15:00:29 字数 229 浏览 5 评论 0原文

我有一个通过 https 连接到 Web 服务的客户端应用程序。我需要“嗅探”Web 服务和客户端之间的所有网络流量,以检查一切是否正常,即我必须调试连接。

我尝试过 Wireshark,但由于我没有服务器私钥,wireshark 屏幕上显示的数据当然是加密的。

当我无法访问服务器本身并因此无法访问私钥和其他相关内容时,有没有办法观察客户端和 Web 服务之间的 ssl 网络流量?

提前致谢。

I have a client application that connects to a web service over https. I need to "sniff" all the network traffic between web service and my client to check if everything is okay, i.e, i have to debug the connection.

I have tried Wireshark but since I do not have server private key, data shown on wireshark screen is, of course, encrypted.

Is there a way to observe ssl network traffic between my client and web service when I do not have access to server itself and therefore private keys and other related stuff?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

蓝咒 2024-11-22 15:00:29

请参阅:调试 SSL 通信

我知道理论上这是可以做到的 - 您可以设置一个与目标 Web 服务通信的代理,让您的应用程序通过该代理进行连接。这是一个已知的限制 - Https 假定您信任计算机上安装的所有代理和证书。它是一种中间人攻击的形式。

看看 Fiddler 是否有用。

人中-中间攻击

在一个
中间人攻击,攻击者
拦截用户流量进行捕获
凭据和其他相关
信息。然后攻击者使用
此信息可访问实际的
目的地网络。期间
过程中,攻击者通常服务
作为代理/网关,提供
向用户提供虚假 SSL VPN 站点;这
代理/网关可以传递任何内容
用户输入的身份验证
真正的目标站点。

See this: Debugging SSL communications.

I know theoretically it can be done - you can setup a proxy that communicates with the target web-service, point your application to connect via this proxy. Its a known limitation - Https assumes you trust all proxy and certificates installed on your machine. Its a form of Man-in-the-middle attack.

See if Fiddler would be of some use.

Man-in-the-middle attacks

In a
man-in-the-middle attack, the attacker
intercepts user traffic to capture
credentials and other relevant
information. The attacker then uses
this information to access the actual
destination network. During the
process, the attacker typically serves
as a proxy/gateway that presents a
false SSL VPN site to the user; this
proxy/gateway passes whatever
authentication the user enters on to
the real destination site.

归属感 2024-11-22 15:00:29

你安装了python吗?

pip install mitmproxy

mitmproxy -p 1234

甚至一个 video 给你

(顺便说一句,我必须在 debian 上 apt-get install python-lxml apt-get 更新后挤压)

do you have python installed?

pip install mitmproxy

mitmproxy -p 1234

even a video for you

(by the way, i had to apt-get install python-lxml on debian squeeze after an apt-get update)

熊抱啵儿 2024-11-22 15:00:29

Burp Suite(甚至免费版)允许您设置 SSL“代理”,它将呈现一个与您的应用程序不同的证书,它将为您解密(并显示)流量。如果你也想在 localhost 中测试服务器,它也允许你设置代理(我在 Windows 中使用 Wireshark 和 Fiddler 无法做到这一点)。

Burp Suite (even Free Edition) allows you to set a SSL "proxy", it will present a different certificate to your application and it will decrypt (and display) the traffic for you. And if you want to test with the server in localhost too it allow you to set the proxy too (something I have been unable to do with Wireshark in Windows, and Fiddler).

無心 2024-11-22 15:00:29

如果您无权访问服务器的私钥,则无法执行太多操作来查看受 SSL/TLS 保护的内容。 (至少您会看到初始握手。)

如果您对客户端拥有完全控制权,您可以编写一个假服务器,该服务器将具有您控制的私钥和证书,并且将中继客户端发送的所有内容到实际的服务器。为此,您需要让客户端信任您自己的证书,因此您需要控制客户端。调整客户端上相应的 hosts 文件来执行 DNS 欺骗可能会更容易,从而使到正确主机名的连接转至您的假服务器。

If you don't have access to the server's private key, there isn't much you can do to see what's being protected by SSL/TLS. (You'll get to see the initial handshake at least.)

If you have entire control on the client, you could write a fake server that would have a private key and certificate that you control, and that would relay everything sent by the client to the actual server. For this, you'd need to make the client trust your own certificate, hence you need control of the client. It might be easier to tweak the corresponding hosts file on the client to perform the DNS spoofing too, to make connections to the right host name go to your fake server instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文