【问题标题】:mitmproxy headers stripped with tls_passthrough script?用 tls_passthrough 脚本剥离的 mitmproxy 标头?
【发布时间】:2020-12-03 18:03:36
【问题描述】:
mitmdump -p 8080 --rawtcp --modify-headers :~q:User-Agent:@~/useragent.txt -s tls_passthrough.py

使用上述命令(带和不带 --rawtcp)会导致标题修改不起作用。删除 tls_passthrough 脚本和标题修改就好了。有解决方法吗?不完全确定如何使用以下方法处理此问题:

--certs *=ca.pem

我是使用 OpenSSL 生成它还是从 ~/.local/mitmproxy 拉取它?

请寻求指导。

【问题讨论】:

  • 如果你通过 TLS 连接,它们不会被 Mitmproxy 解密,因此它们不能被修改。
  • 谢谢罗伯特。我将跟进有关如何在 Slack 或 IRC 上解决此问题的问题。再次感谢罗伯特。

标签: linux proxy sysadmin mitmproxy


【解决方案1】:

通常这是无法做到的,一旦通过 TLS 建立连接,你就不能“查看它”,否则它会非常不安全。

您可以做的是成为中间人,同时与客户端建立 TLS 连接

client <- TLS -> MITM <- TLS -> server

然后客户端将使用您知道的密钥加密所有内容,您可以对服务器执行相同操作。

它可能不起作用

  1. 客户必须接受您的证书
  2. 客户端可能会检查您公开的证书是否是他已经知道的证书(以前的连接、硬编码的 id 等)

如果您有一个有效的证书并且客户端接受了它并且它确实与您的代理连接,那么您可以使用 MITM 技术更改标头。

如果您查看tls_passthrough script you mention 的来源,您可以看到 根据您可以运行的 HTTP/HTTPS 组合,简要说明它将执行的操作。

    > mitmdump -s tls_passthrough.py
    1. curl --proxy http://localhost:8080 https://example.com --insecure
    // works - we'll also see the contents in mitmproxy
    2. curl --proxy http://localhost:8080 https://example.com --insecure
    // still works - we'll also see the contents in mitmproxy
    3. curl --proxy http://localhost:8080 https://example.com
    // fails with a certificate error, which we will also see in mitmproxy
    4. curl --proxy http://localhost:8080 https://example.com
    // works again, but mitmproxy does not intercept and we do *not* see the contents

在此示例中,curl 是发出请求的客户端,您可以看到有时必须使用 --insecure 调用它才能允许连接通过不安全代理。 p>

【讨论】:

猜你喜欢
  • 2010-09-26
  • 2012-11-04
  • 2014-12-20
  • 1970-01-01
  • 2012-01-22
  • 2023-04-04
  • 2015-02-02
  • 2020-12-13
  • 2017-03-04
相关资源
最近更新 更多