contactBel ons contactMail ons

Android adb reverse tethering mitm setup revised

Introduction

In a previous blogpost, I've written how to combine Gnirehtet & proxychains in order to intercept traffic from mobile apps over adb while on a VPN. After some time, the setup seemed to be somewhat buggy and slow. A contact of @FSDominguez suggested to look into port forwarding. I'd like to present a revised adb reverse tethering MITM setup.

reversetether_mitm_vpn

adb reverse

The Android Debug Bridge (ADB) command-line tool provides several utilities such as performing shell commands on the device, (un)installing apps, pushing/pulling files and port forwarding. Speaking of port forwarding, there's a nifty yet relatively less known command adb reverse which essentially allows us to create a reverse proxy by forwarding requests on a port on the mobile device to a port available on the host.

A quick hands-on example:

adb reverse tcp:4444 tcp:8888
echo "hello world" > index.php
php -S 127.0.0.1:8888

The last command launches a PHP web server listening on port 8888 (localhost). Opening 127.0.0.1:4444 in a web browser on the mobile device gives us:

adb_reverse_browser

Installation steps of the revised setup

Since Android is based on Linux, it is possible to use iptables in combination with adb reverse in order to forward all traffic from mobile apps to the host device. Note that this requires root access and a transparent intercepting proxy.

  1. Install an intercepting HTTP proxy, configure it to listen on incoming connections and make sure to enable "transparent proxy"; Example: 127.0.0.1:8844. In Burp Suite, go to Proxy > Options > Edit or add a proxy > Request handling > check "Support invisible proxying". burp_transparent_proxy

  2. Connect your phone to your host using a USB cable.

  3. Perform the following command on your host: adb reverse tcp:8844 tcp:8844

  4. Connect your mobile device to any WiFi network.

  5. Next we need to perform administrative commands on the device:

adb shell            # to perform commands on the device
su                   # switch to root
iptables -t nat -F   # flush current rules
# forward traffic from port 80 & 443 to 8844
iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:8844
iptables -t nat -A OUTPUT -p tcp --dport 443 -j DNAT --to-destination 127.0.0.1:8844
iptables -t nat -A POSTROUTING -p tcp --dport 80 -j MASQUERADE 
iptables -t nat -A POSTROUTING -p tcp --dport 443 -j MASQUERADE

⚠️ if you suspect that your target app performs requests on other ports than 80 and 443, adjust above commands accordingly.

  1. In order to see HTTPS traffic in your intercepting proxy, you will need to install a CA certificate on the Android device. Checkout some of NVISO's blogposts 1 & 2 and of course the manual of your favorite intercepting proxy.
  2. To reset and restore your setup:
adb reverse --remove-all
adb shell
su
iptables -t nat -F

Automation

I've automated above setup and commands in my Frida Android Helper tool. Just run fah rproxy and you're good to go!

fah_rproxy

两个鬼故事云南临沧山体滑坡免费英文起名网站在线性陈男孩起什么名字好爱国主义电影大连好旺角Adobeflashplayer10医疗器材公司名字起名大全不置可否的意思愿你慢慢长大火星情报局第三季百度云公司起名 水产谢咏起名网站是哪个波光粼粼的意思刀客家族的女人李白《凤求凰》全诗八字起名源码鲭鱼用梓字起名字退伍军人开店起名大全女孩起名用添字好不好晨会幸灾乐祸的意思食品取名起名马思纯结婚三个字贸易公司起名参考张中秦博客斩风刀临朐起名植物大战僵尸破解版儿童起名字大全女孩子免费少年生前被连续抽血16次?多部门介入两大学生合买彩票中奖一人不认账让美丽中国“从细节出发”淀粉肠小王子日销售额涨超10倍高中生被打伤下体休学 邯郸通报单亲妈妈陷入热恋 14岁儿子报警何赛飞追着代拍打雅江山火三名扑火人员牺牲系谣言张家界的山上“长”满了韩国人?男孩8年未见母亲被告知被遗忘中国拥有亿元资产的家庭达13.3万户19岁小伙救下5人后溺亡 多方发声315晚会后胖东来又人满为患了张立群任西安交通大学校长“重生之我在北大当嫡校长”男子被猫抓伤后确诊“猫抓病”测试车高速逃费 小米:已补缴周杰伦一审败诉网易网友洛杉矶偶遇贾玲今日春分倪萍分享减重40斤方法七年后宇文玥被薅头发捞上岸许家印被限制高消费萧美琴窜访捷克 外交部回应联合利华开始重组专访95后高颜值猪保姆胖东来员工每周单休无小长假男子被流浪猫绊倒 投喂者赔24万小米汽车超级工厂正式揭幕黑马情侣提车了西双版纳热带植物园回应蜉蝣大爆发当地回应沈阳致3死车祸车主疑毒驾恒大被罚41.75亿到底怎么缴妈妈回应孩子在校撞护栏坠楼外国人感慨凌晨的中国很安全杨倩无缘巴黎奥运校方回应护栏损坏小学生课间坠楼房客欠租失踪 房东直发愁专家建议不必谈骨泥色变王树国卸任西安交大校长 师生送别手机成瘾是影响睡眠质量重要因素国产伟哥去年销售近13亿阿根廷将发行1万与2万面值的纸币兔狲“狲大娘”因病死亡遭遇山火的松茸之乡“开封王婆”爆火:促成四五十对奥巴马现身唐宁街 黑色着装引猜测考生莫言也上北大硕士复试名单了德国打算提及普京时仅用姓名天水麻辣烫把捣辣椒大爷累坏了

两个鬼故事 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化