Frida / frida-tools / Objection 版本对齐 + 32 位 Python 的坑

CTF / 授权渗透 / 自己应用的安全测试里 Frida 是常用工具。装的时候版本三个(fridafrida-toolsobjection)加设备端 frida-server 要对得上,不然经常 unable to communicate with remote frida-server

目前最稳的组合

写在最前面——如果你不追新,直接抄这套:

pip install frida==16.7.19 frida-tools==13.7.1 objection

设备端 frida-server-16.7.19(对应 Android 架构)。这套是当前社区教程覆盖最广、踩坑最少的组合。

用最新 Frida 17 呢

装最新版:

pip install frida frida-tools objection

frida-tools 会跟着 Frida 版本自动装匹配的(一般是 13.x)。Objection 最新版也已经跟上了 Frida 17,但 iOS 场景仍有已知问题,比如:

  • ObjC is not defined
  • 部分 explore 命令异常
  • SSL Pinning 相关脚本行为变化

Android 场景 Frida 17 已经比较稳。iOS 建议留在 16.7.x。

frida-ps -U 报”unable to handle 64-bit”

一装完想连手机测:

frida-ps -U

崩:

Failed to enumerate processes:
unable to handle 64-bit processes due to build configuration

几乎 100% 是你装了 32 位 Python,而设备上 frida-server 是 64 位。Frida 的 Python 绑定的位数必须和目标进程匹配。

先确认 Python 位数:

python -c "import struct;print(struct.calcsize('P')*8)"

输出 32 就是罪魁祸首。

解法:

  1. 从 python.org 下 64-bit 安装包(找 “Windows installer (64-bit)” 或者 “Windows embeddable package (64-bit)”)
  2. 卸载 32 位 Python
  3. 新建虚拟环境:
python -m venv frida_env
frida_env\Scripts\activate
pip install frida==16.7.19 frida-tools==13.7.1 objection

主机 Frida vs 设备 frida-server 必须版本一致

主机 Python 侧和手机上的 frida-server 必须严格同版本号,包括小版本。混版本症状:

frida.core.RPCException: unable to communicate with remote frida-server

对齐流程:

# 1. 主机装什么版本
frida --version           # 假设 16.7.19

# 2. 下对应设备端
# github.com/frida/frida/releases → frida-server-16.7.19-android-arm64.xz

# 3. 手机架构
adb shell getprop ro.product.cpu.abi
# arm64-v8a → 用 android-arm64
# armeabi-v7a → 用 android-arm

# 4. 推送 + 启动
adb push frida-server-16.7.19-android-arm64 /data/local/tmp/frida-server
adb shell "chmod +x /data/local/tmp/frida-server"
adb shell "/data/local/tmp/frida-server &"

# 5. 主机验证
frida-ps -U | head

环境里有多个 frida.exe

pip show frida 显示当前 venv 装了,但 frida-ps -U 还是老版本行为——大概率是 PATH 上另一个 Python 里也有 frida.exe

where frida
where frida-ps

看到两条以上路径,把不想用的从 PATH 里挪走,或者用 venv 里的绝对路径调:

D:\project\frida_env\Scripts\frida-ps.exe -U

一张速查表

症状常见原因
unable to handle 64-bit32 位 Python
unable to communicate with remote frida-server版本不一致 / server 没起 / SELinux
ObjC is not defined(iOS)Objection + Frida 17 兼容问题
Failed to attach: process not foundroot 权限 / SELinux / SEAndroid
frida-server 起来立刻退出架构下错、缺可执行权限

一句话总结

64 位 Python + frida==16.7.19 frida-tools==13.7.1 + 同版本 frida-server 是当前最稳的组合。Frida 17 追新可以,iOS 用户等它再稳一稳。