Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【每日一题】- 2019-12-13 - 本地劫持https请求的简单思路 #82

Open
azl397985856 opened this issue Dec 13, 2019 · 2 comments
Labels
Browser 浏览器 Daily Question 每日一题 Network 网络 Security 安全

Comments

@azl397985856
Copy link
Owner

azl397985856 commented Dec 13, 2019

现在我们有一个网页,或者app页面。 里面有https请求,我们如何劫持这个https请求,需要什么前提条件?如何操作?

@azl397985856 azl397985856 added Daily Question 每日一题 Network 网络 Browser 浏览器 Security 安全 labels Dec 13, 2019
@azl397985856 azl397985856 added this to 待认领 in 每日一题认领区 Dec 13, 2019
@wycyftk
Copy link

wycyftk commented Dec 17, 2019

前提条件:攻击DNS服务器、攻击CA机构的证书服务器、伪造一套SSL的密钥对和证书

流程如下:

  1. 攻击DNS服务器,修改网页的域名和ip的对应关系。ip地址改成攻击者想要引导的地址;
  2. 当用户访问网页的时候,在浏览器输入网页地址,会因为域名劫持访问到攻击者的地址。获取到用户的访问信息后,伪装成用户,向服务器发送相同数据的https请求。这个过程中服务器会返回公钥和证书给攻击者;
  3. 将自己生成的公钥和伪造的证书发给用户,用户去CA验证证书,然后生成随机加密串,使用伪造的公钥加密后又发给了攻击者;
  4. 攻击者用伪造的私钥解密数据,获得随机加密串,再使用网页的公钥加密发送给服务器;

这样下来,用户其实是和攻击者建立了SSL连接,而攻击者才是真正和网站建立连接的那方,所以用户和网站的数据都会经过攻击者。这个过程是中间人攻击,不过攻击CA证书服务器就过分了,尽管有人成功的攻击过CA机构。要是可以自己作死,可以把这步更换成上传信任的证书。把攻击者的伪造的证书上传一下,就能体验被攻击者骑在头上拉屎的乐趣了。

@ystarlongzi
Copy link

ystarlongzi commented Dec 19, 2019

charles/fiddler 的原理是什么?
https://www.jianshu.com/p/405f9d76f8c4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Browser 浏览器 Daily Question 每日一题 Network 网络 Security 安全
Projects
Development

No branches or pull requests

3 participants