簡體   English   中英

在OSX上使用透明的mitmproxy測試iOS應用的SSL / TLS證書驗證

[英]Testing an iOS app's SSL/TLS certificate validation using a transparent mitmproxy on OSX

作為我正在開發的iOS應用程序的安全測試的一部分,我想驗證其在連接到各種API時是否正確驗證了SSL / TLS證書。 我在Mac上安裝了mitmproxy並將其配置為透明代理 ,然后根據此透明代理iOS WiFi屏幕截圖配置了WiFi。 iPhone需要很長時間才能顯示它已連接到WiFi,並且連接之后無法訪問網絡。 mitmproxy完全不顯示任何內容,包括其事件日志中: mitmproxy什么也沒顯示

mitmproxy配置的詳細信息

我在系統python中安裝了mitmproxy 0.11.3(並將其重命名為OSX附帶的過時的pyOpenSSL,以便它使用pyOpenSSL 0.14並通過pip與mitmproxy一起安裝)。

我正在使用以下腳本來配置和啟動pf和mitmproxy:

#!/bin/bash -x
sudo sysctl -w net.inet.ip.forwarding=1

# sudo sysctl -w net.inet.ip.scopedroute=0
## OSX can't change the net.inet.ip.scopedroute kernel flag in user space so I used:
## sudo defaults write "/Library/Preferences/SystemConfiguration/com.apple.Boot" "Kernel     Flags" "net.inet.ip.scopedroute=0
## and then rebooted
sudo defaults read /Library/Preferences/SystemConfiguration/com.apple.Boot

cat > pf.conf << _EOF_
rdr on en0 inet proto tcp to any port 80 -> 127.0.0.1 port 8080
rdr on en0 inet proto tcp to any port 443 -> 127.0.0.1 port 8080
_EOF_
cat pf.conf

sudo pfctl -d
sudo pfctl -f pf.conf
sudo pfctl -e

mitmproxy -T --host

en0接口是Mac的WiFi連接。

該腳本的輸出(在用control-C停止mitmproxy后可見):

$ ./transparent.sh 
+ sudo sysctl -w net.inet.ip.forwarding=1
net.inet.ip.forwarding: 1 -> 1
+ sudo defaults read /Library/Preferences/SystemConfiguration/com.apple.Boot
{
    "Kernel Flags" = "net.inet.ip.scopedroute=0";
}
+ cat
+ cat pf.conf
rdr on en0 inet proto tcp to any port 80 -> 127.0.0.1 port 8080
rdr on en0 inet proto tcp to any port 443 -> 127.0.0.1 port 8080
+ sudo pfctl -d
No ALTQ support in kernel
ALTQ related functions disabled
pf disabled
+ sudo pfctl -f pf.conf
pfctl: Use of -f option, could result in flushing of rules
present in the main ruleset added by the system at startup.
See /etc/pf.conf for further details.

No ALTQ support in kernel
ALTQ related functions disabled
+ sudo pfctl -e
No ALTQ support in kernel
ALTQ related functions disabled
pf enabled
+ mitmproxy -T --host

iOS配置的詳細信息

我在iOS 8.1上使用物理iPhone5,並連接到與Mac相同的WiFi網絡。 我的WiFi配置如下所示: iPhone上的透明代理wifi配置

我使用了192.168.20.118,因為這是我的Mac在同一WiFi網絡上的IP地址,該地址是使用ifconfig找到的:

$ ifconfig
[...]
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether xx:xx:xx:xx:xx:xx 
    inet6 fe80::22c9:d0ff:fe84:983b%en0 prefixlen 64 scopeid 0x4 
    inet 192.168.20.118 netmask 0xffffff00 broadcast 192.168.20.255
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: active
[...]

我遇到了同樣的問題。 就我而言,我在“設置”面板中關閉了Mac OS防火牆。 它可以工作,我可以使用mitmproxy作為透明代理。

我今天也遇到同樣的問題。我只解決了dns問題。我認為mitmproxy不提供dns

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM