- Java锁的逻辑(结合对象头和ObjectMonitor)
- 还在用饼状图?来瞧瞧这些炫酷的百分比可视化新图形(附代码实现)⛵
- 自动注册实体类到EntityFrameworkCore上下文,并适配ABP及ABPVNext
- 基于Sklearn机器学习代码实战
日常听说 HTTPS 是加密协议,那现实中的 HTTPS 流量,是真的完全加密吗?
——答案是,不一定。原因嘛,抓个包就知道了.
我们用 curl 命令触发一下:
curl -v 'https://s-api.37.com.cn/api/xxx'
* Trying 106.53.109.63:443...
* Connected to s-api.37.com.cn (106.53.109.63) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
* CAfile: /etc/ssl/cert.pem
* CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN: server accepted h2
* Server certificate:
* subject: CN=*.37.com.cn
* start date: Aug 24 00:00:00 2022 GMT
* expire date: Sep 11 23:59:59 2023 GMT
* subjectAltName: host "s-api.37.com.cn" matched cert's "*.37.com.cn"
* issuer: C=US; O=DigiCert, Inc.; CN=RapidSSL Global TLS RSA4096 SHA256 2022 CA1
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* h2h3 [:method: GET]
* h2h3 [:path: /api/xxx]
* h2h3 [:scheme: https]
* h2h3 [:authority: s-api.37.com.cn]
* h2h3 [user-agent: curl/7.85.0]
* h2h3 [accept: */*]
* Using Stream ID: 1 (easy handle 0x159813400)
> GET /api/xxx HTTP/2
> Host: s-api.37.com.cn
> user-agent: curl/7.85.0
> accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 404
< date: Wed, 18 Jan 2023 09:57:12 GMT
< content-type: text/html
< content-length: 150
<
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>openresty</center>
</body>
</html>
* Connection #0 to host s-api.37.com.cn left intact
Wireshark 使用过滤条件 ip.addr == 106.53.109.63 ,截图如下:
可以看到,HTTPS 并没有完全加密我的访问请求,因为 Server Name 依然是明文传输的。它发生在 HTTPS 传输过程中的 Client Hello 握手阶段,在 TCP 三次握手之后.
如果不知道什么是 Client Hello ,可以参考网上的一张流程图:
这也解答了我之前用 curl 请求接口的疑惑——正常来说,我们用 http 协议,以下命令是可以访问的:
curl -v -H 'Host: s-api.37.com.cn' 'http://10.43.2.9/api/xxx'
但是你用了 https 协议,会报告证书校验失败.
curl -v -H 'Host: s-api.37.com.cn' 'https://10.43.2.9/api/xxx'
* Trying 10.43.2.9:443...
* Connected to 10.43.2.9 (10.43.2.9) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
* CAfile: /etc/ssl/cert.pem
* CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS alert, unknown CA (560):
* SSL certificate problem: self signed certificate
* Closing connection 0
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS alert, unknown CA (560):
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
意思是证书校验失败!因为 -H 参数指定了 HTTP 头部 Host 字段,作用于 7 层.
而 HTTPS 的握手阶段,只是完成了 TCP 的三次握手,抓包分析也可以发现,看不到域名,只有一个 IP 地址.
可以使用 -k 参数跳过证书校验的过程.
有没有更好的办法呢?
curl -vs --resolve 's-api.37.com.cn:443:10.43.2.9' 'https://s-api.37.com.cn/api/xxx'
可以使用 --resolve 参数,手工指定域名解析的 IP,就不会报证书校验失败了.
但是为什么要明文传输呢?那就得说到 SNI 了! 。
引用维基百科的描述,它用于服务端复用 IP 地址,提供不同域名的网站服务.
服务器名称指示(英语:Server Name Indication,缩写:SNI)是TLS的一个扩展协议[1],在该协议下,在握手过程开始时客户端告诉它正在连接的服务器要连接的主机名称。这允许服务器在相同的IP地址和TCP端口号上呈现多个证书,并且因此允许在相同的IP地址上提供多个安全(HTTPS)网站(或其他任何基于TLS的服务),而不需要所有这些站点使用相同的证书。它与HTTP/1.1基于名称的虚拟主机的概念相同,但是用于HTTPS.
而 TLS 1.3,也将 SNI 信息加密了.
文章来源于本人博客,发布于 2022-07-24,原文链接: https://imlht.com/archives/394/ 。
最后此篇关于记一次HTTPS抓包分析和SNI的思考的文章就讲到这里了,如果你想了解更多关于记一次HTTPS抓包分析和SNI的思考的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
发起 HTTPS 对话时,会生成一个随机数来为交换创建 key (或类似的东西)。我不明白这是如何防止重放攻击的。 为什么攻击者不能重复真实客户端发出的所有请求? This answer claims
要使这个简单的 HTTP header 与支持 HTTPS 的服务器通信,还需要进行哪些其他更改。 GET /index.php HTTP/1.1 Host: localhost [CR] [CR]
我想弄清楚 HTTPS 是有状态还是无状态?这是关于我构建的 RESTful API。我们最初使用 HTTP。由于 HTTP 本质上是在无状态的 TCP/IP 上工作的,因此 HTTP 是无状态的,但
我从各种来源了解到,HTTPS 握手是使用 HTTPS 中最重要的部分。我在服务器之间内部使用 POST 来传达信息,并希望为此使用 HTTPS。我想知道实际的 HTTPS 握手持续多长时间/“保持打
我想知道HTTPS是如何实现的。是数据加密还是路径加密(数据通过哪个路径)。如果有人向我提供实现细节,我将不胜感激。 最佳答案 很简单,HTTPS 使用安全套接字层来加密客户端和服务器之间传输的数据。
我是 HTTPS 技术的初学者:(。我对 HTTPS 的实现有一些疑问。 假设我有一张注册表 http://www.sitename.com/register.php 如果我想在 HTTPS 中使用它
在带有 Devise 1.51 的 Rails 3.1.1 应用程序中,我希望确认消息中使用的确认链接是 https 而不是 http。因此,在电子邮件中,“确认链接”会指向如下内容: https:/
我对 HTTPS 有疑问。我的一位前辈告诉我,Https 实际上并不使用 SSL/TLS,而只是使用它们的加密算法。他说,证书的握手过程是在传输层完成的,但实际有效负载的安全 key 加密是在应用层完
我建立了一个使用 PHP mail() 的网站。如果我在 http://上点击脚本,我可以让它成功运行,但如果我切换到 https://它就不起作用了!我使用 Godaddy 进行托管,并通过他们购买
我最近更改了域并设置了来自 https://sadlergatestoyou.co.uk 的重定向至https://www.sadlergates.co.uk但是,www.sadlergatestoy
我正在制作一个依赖于设置 http.proxyPort 和 http.proxyHost 的 Java 应用程序。有两个进程:一个是正则程序,一个是代理程序。我有一个在 http.proxyPort(
我正在开发一个 RESTful 应用程序,为此我需要将从 http 地址传入的请求重定向到它的 https 等效项。我似乎无法使用 ring/compojure 启用 https。 有人有一些有用的教
我看过很多关于重写的文章。都好。但没有一个涵盖这种具体情况。所以这是我的问题:希望你能帮忙。因为我无法让它发挥作用。 我们在domain.com(非www)上运行网站 我们已设置 ssl(因此仅限 h
我需要将大量请求自动提交到基于云的数据库接口(interface) (Intelex)。没有任何方法可以批量提交某些操作,但是提交单个请求所必需的只是让经过身份验证的用户尝试打开 Web 链接。因此,
我正在使用 https 设置一个独立的(非嵌入式) jetty 9.2.1。 我在本地机器上使用自签名证书玩了一会儿,一切顺利。 现在我正在设置一个 uat 服务器(类似于我将在生产中获得的服务器),
我对 Web 开发(从今年 1 月开始)和 Web 安全(在不到一周前开始!)都是新手,所以如果我的问题完全没有受过教育、误导或简单愚蠢,请原谅我。 我工作的公司的主要产品是一个很好的老式客户端/服务
HTTPS头是否加密到什么程度(如果有的话)? 最佳答案 它们在通过SSL传输时被加密。没有专门用于 header 的特殊加密,HTTPS对整个消息进行加密。 关于https - HTTPS head
在 HTTPS 安全模型中,最薄弱的部分是浏览器中的可信 CA 列表。有人可以通过多种方式将额外的 CA 添加到用户信任错误的人的列表中。 例如,您公司的公用计算机或 PC。管理员可能会强制您信任自己
我们最近切换到 HTTPS,当提交我们的一个表单时,Firefox 会弹出: Although this page is encrypted, the information you have ent
我知道没有愚蠢的问题,但这是:您能否在完全支持 https 的网站上通过 AdSense 或其他方式转换基于上下文的广告? 最佳答案 更新: We’ve updated the AdSense ad
我是一名优秀的程序员,十分优秀!