hacktricks/src/mobile-pentesting/ios-pentesting/burp-configuration-for-ios.md

89 lines
4.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# iOS Burp Suite 配置
{{#include ../../banners/hacktricks-training.md}}
## 在 iOS 设备上安装 Burp 证书
为了对 iOS 设备上的安全网络流量进行分析和 SSL 钉扎,可以通过 **Burp Mobile Assistant** 或手动配置来使用 Burp Suite。以下是两种方法的简要指南
### 使用 Burp Mobile Assistant 的自动安装
**Burp Mobile Assistant** 简化了 Burp 证书、代理配置和 SSL 钉扎的安装过程。详细指导可以在 [PortSwigger 的官方文档](https://portswigger.net/burp/documentation/desktop/tools/mobile-assistant/installing) 中找到。
### 手动安装步骤
1. **代理配置:** 首先在 iPhone 的 Wi-Fi 设置中将 Burp 设置为代理。
2. **证书下载:** 在设备的浏览器中导航到 `http://burp` 下载证书。
3. **证书安装:** 通过 **设置** > **通用** > **VPN 和设备管理** 安装下载的配置文件,然后在 **证书信任设置** 中启用对 PortSwigger CA 的信任。
### 配置拦截代理
该设置允许通过 Burp 对 iOS 设备和互联网之间的流量进行分析,需要支持客户端到客户端流量的 Wi-Fi 网络。如果不可用,可以通过 usbmuxd 的 USB 连接作为替代。PortSwigger 的教程提供了关于 [设备配置](https://support.portswigger.net/customer/portal/articles/1841108-configuring-an-ios-device-to-work-with-burp) 和 [证书安装](https://support.portswigger.net/customer/portal/articles/1841109-installing-burp-s-ca-certificate-in-an-ios-device) 的详细说明。
### 针对越狱设备的高级配置
对于越狱设备的用户SSH 通过 USB通过 **iproxy**)提供了一种直接通过 Burp 路由流量的方法:
1. **建立 SSH 连接:** 使用 iproxy 将 SSH 转发到 localhost允许 iOS 设备连接到运行 Burp 的计算机。
```bash
iproxy 2222 22
```
2. **远程端口转发:** 将 iOS 设备的 8080 端口转发到计算机的 localhost以便直接访问 Burp 的界面。
```bash
ssh -R 8080:localhost:8080 root@localhost -p 2222
```
3. **全局代理设置:** 最后,配置 iOS 设备的 Wi-Fi 设置以使用手动代理,将所有网络流量通过 Burp 导向。
### 完整网络监控/嗅探
可以使用 **Wireshark** 有效监控非 HTTP 设备流量,该工具能够捕获所有形式的数据流量。对于 iOS 设备,通过创建远程虚拟接口来实现实时流量监控,具体过程详见 [这篇 Stack Overflow 帖子](https://stackoverflow.com/questions/9555403/capturing-mobile-phone-traffic-on-wireshark/33175819#33175819)。在开始之前,必须在 macOS 系统上安装 **Wireshark**
该过程涉及几个关键步骤:
1. 通过 USB 在 iOS 设备和 macOS 主机之间建立连接。
2. 确定 iOS 设备的 **UDID**,这是流量监控的必要步骤。可以通过在 macOS 终端中执行命令来完成:
```bash
$ rvictl -s <UDID>
Starting device <UDID> [SUCCEEDED] with interface rvi0
```
3. 在识别 UDID 后,**Wireshark** 应该被打开,并选择 "rvi0" 接口进行数据捕获。
4. 对于目标监控,例如捕获与特定 IP 地址相关的 HTTP 流量,可以使用 Wireshark 的捕获过滤器:
## 在模拟器中安装 Burp 证书
- **导出 Burp 证书**
_Proxy_ --> _Options_ --> _Export CA certificate_ --> _Certificate in DER format_
![](<../../images/image (534).png>)
- **拖放**证书到模拟器内
- **在模拟器内**前往 _Settings_ --> _General_ --> _Profile_ --> _PortSwigger CA_,并 **验证证书**
- **在模拟器内**前往 _Settings_ --> _General_ --> _About_ --> _Certificate Trust Settings_,并 **启用 PortSwigger CA**
![](<../../images/image (1048).png>)
**恭喜,您已成功在 iOS 模拟器中配置 Burp CA 证书**
> [!NOTE]
> **iOS 模拟器将使用 MacOS 的代理配置。**
### MacOS 代理配置
配置 Burp 作为代理的步骤:
- 前往 _System Preferences_ --> _Network_ --> _Advanced_
-_Proxies_ 标签中标记 _Web Proxy (HTTP)__Secure Web Proxy (HTTPS)_
- 在这两个选项中配置 _127.0.0.1:8080_
![](<../../images/image (431).png>)
- 点击 _**Ok**_ 然后在 _**Apply**_
{{#include ../../banners/hacktricks-training.md}}