对于刚刚进入移动安全领域的安全研究人员或者安全爱好者,在对手机APP进行渗透测试的时候会发现一个很大的问题,就是无法抓取https的流量数据包,导致渗透测试无法继续进行下去。
这次给大家介绍一些手机端如何抓取https流量的技巧。
下面将主要通过两个层次篇章来逐步向大家进行介绍:
第一篇章-初级篇:浅层次抓包。对于非root设备(Android)或非越狱设备(iOS)如何抓取https流量;
第二篇章-进阶篇:深层次抓包。对于root设备或者越狱设备如何抓取https流量。
对于非root Android设备或者未越狱的iOS设备,由于用户可获取设备控制权限不足,所以只能进行浅层次的https抓包,就是通过在移动设备中安装抓包工具的证书来使移动设备信任抓包工具以此来抓取https流量,但是此方法只适用于一些对于证书校验不太严格的应用,如存在信任任意SSL证书漏洞的应用等等。以下就以Burp Suite抓包工具为例,分别介绍如何在不同平台(Android & iOS)设备上进行证书的安装以此来抓取https流量数据包。
Android平台
Android设备需要在pc上将Burp Suite的证书导出,然后传到手机上进行安装。
首先打开Burp Suite,设置一个本地代理。




打开Firefox浏览器,设置本地代理:IP:127.0.0.1 端口:8080。


打开任意一个https网站,如:https://www.baidu.com 。


此时Firefox会提示连接不安全,接下来点击高级,选择添加例外。


此时弹出一条警告。


点击证书状态下的查看选项,会展示证书的信息。


点击详细信息,并选中证书机构中的PortSwigger CA。


点击下方导出按钮,将证书文件导出到本地。


之后通过USB数据线或者adb push命令将证书文件发送到手机SD卡目录。


打开手机设置,选择安全,并选择从SD卡安装证书。




打开SD卡选择我们刚刚上传到手机的证书文件,点击文件并设置一个名字进行安装。




安装完成,点击信任的凭证中用户项查看安装的证书信息。




部分系统或机型可能直接通过在SD卡目录下点击证书文件即可安装。可能有部分系统或机型安装证书文件的位置不同,这里就不在一一区分了。
iOS平台
iOS设备安装burpsuite证书就方便多了。
首先需要使iOS设备和安装Burp Suite电脑处于同一网段(1、iOS设备和电脑连接同一无线网;2、电脑开热点供iOS设备连接)并设置代理,即正常抓取http流量的操作。
iOS设备直接打开burpsuite监听的IP及端口。


点击CA Certificate,提示安装描述文件即证书文件。


点击安装,提示输入手机密码。


输入手机密码之后会有警告提示。


直接点击安装,继续完成安装,即可安装成功。


然后到手机设置-通用-描述文件,即可查看证书信息。


测试
证书安装完成之后,用手机访问一个https的网站,这时就发现https的数据包可以抓取到了。


如写的有不当的地方,欢迎指正,第二篇章-进阶篇 即将发布,欢迎持续关注。