环境

  • os:android10

  • 手机:一加5 A5000

  • 系统版本:氢os 10.0.3

报错

{"type":"error","description":"Error: invalid address","stack":"Error: 
invalid address\n    at Object.value [as patchCode] (frida/runtime/
core.js:207:1)\n    at ln (frida/node_modules/frida-java-bridge/lib/android.js:1209:1)\n    at pn.activate (frida/node_modules/frida-java-
bridge/lib/android.js:1275:1)\n    at mn.replace (frida/node_modules/frida-java-bridge/lib/android.js:1323:1)\n    at Function.set [as 
implementation] (frida/node_modules/frida-java-bridge/lib/class-
factory.js:1185:1)\n    at Function.set [as implementation] (frida/
node_modules/frida-java-bridge/lib/class-factory.js:1099:1)\n    at 
installLaunchTimeoutRemovalInstrumentation (/internal-
agent.js:435:37)\n    at init (/internal-agent.js:51:3)\n    at
c.perform (frida/node_modules/frida-java-bridge/lib/vm.js:12:1)\n    at
_performPendingVmOps (frida/node_modules/frida-java-bridge/
index.js:250:1)","fileName":"frida/runtime/
core.js","lineNumber":207,"columnNumber":1}

我换了14,15,16三个版本的frida都报这个错误,我意识到不是frida版本问题

原因

SELinux(Security-Enhanced Linux)是 Android 中用来强制访问控制的安全机制。自 Android 8.0 (Oreo) 之后,Google 增强了 SELinux 策略,使得第三方工具(如 Frida)在 Android 10 或更高版本上进行内存注入或代码修改变得更加困难。

  • 1.严格的 SELinux 策略:
    • Android 10 的 SELinux 策略比之前的版本更严格,这可能会阻止 Frida 等工具访问系统进程的内存或动态修改代码,从而导致 invalid address 错误。
  • 2.地址空间布局随机化 (ASLR):
    • Android 采用了 ASLR 技术,使得每次应用运行时,其内存地址都会变化。这也可能导致 Frida 在尝试访问某些内存地址时,产生无效地址的错误。
  • 3.Frida 的兼容性:
    • Frida 版本可能不完全支持 Android 10 或更新的 SELinux 政策,需要使用更新的 Frida 版本或修改 SELinux 设置以绕过这些限制。

解决

注意运行下面代码需要有adb root权限,在运行后会重启手机

adb shell setenforce 0

# adb shell里执行  setenforce 0也可以

记录

OnePlus5:/ $ getenforce
Enforcing
OnePlus5:/ $ setenforce 0
OnePlus5:/ $ getenforce
Permissive
OnePlus5:/ $

frida版本依赖关系

frida-tools==1.0.0 ------ 12.0.0<=frida<13.0.0 
frida-tools==1.1.0 ------ 12.0.0<=frida<13.0.0 
frida-tools==1.2.0 ------ 12.1.0<=frida<13.0.0 
frida-tools==1.2.1 ------ 12.1.0<=frida<13.0.0 
frida-tools==1.2.2 ------ 12.1.0<=frida<13.0.0 
frida-tools==1.2.3 ------ 12.1.0<=frida<13.0.0 
frida-tools==1.3.0 ------ 12.3.0<=frida<13.0.0 
frida-tools==1.3.1 ------ 12.3.0<=frida<13.0.0 
frida-tools==1.3.2 ------ 12.4.0<=frida<13.0.0 
frida-tools==2.0.0 ------ 12.5.3<=frida<13.0.0 
frida-tools==2.0.1 ------ 12.5.9<=frida<13.0.0 
frida-tools==2.0.2 ------ 12.5.9<=frida<13.0.0 
frida-tools==2.1.0 ------ 12.5.9<=frida<13.0.0 
frida-tools==2.1.1 ------ 12.5.9<=frida<13.0.0 
frida-tools==2.2.0 ------ 12.5.9<=frida<13.0.0 
frida-tools==3.0.0 ------ 12.6.17<=frida<13.0.0 
frida-tools==3.0.1 ------ 12.6.17<=frida<13.0.0 
frida-tools==4.0.0 ------ 12.6.21<=frida<13.0.0 
frida-tools==4.0.1 ------ 12.6.21<=frida<13.0.0 
frida-tools==4.0.2 ------ 12.6.21<=frida<13.0.0 
frida-tools==4.1.0 ------ 12.6.21<=frida<13.0.0 
frida-tools==5.0.0 ------ 12.6.21<=frida<13.0.0 
frida-tools==5.0.1 ------ 12.7.3<=frida<13.0.0 
frida-tools==5.1.0 ------ 12.7.3<=frida<13.0.0 
frida-tools==5.2.0 ------ 12.7.3<=frida<13.0.0 
frida-tools==5.3.0 ------ 12.7.3<=frida<13.0.0 
frida-tools==5.4.0 ------ 12.7.3<=frida<13.0.0 
frida-tools==6.0.0 ------ 12.8.5<=frida<13.0.0 
frida-tools==6.0.1 ------ 12.8.5<=frida<13.0.0 
frida-tools==7.0.0 ------ 12.8.12<=frida<13.0.0 
frida-tools==7.0.1 ------ 12.8.12<=frida<13.0.0 
frida-tools==7.0.2 ------ 12.8.12<=frida<13.0.0 
frida-tools==7.1.0 ------ 12.8.12<=frida<13.0.0 
frida-tools==7.2.0 ------ 12.8.12<=frida<13.0.0 
frida-tools==7.2.1 ------ 12.8.12<=frida<13.0.0 
frida-tools==7.2.2 ------ 12.8.12<=frida<13.0.0 
frida-tools==8.0.0 ------ 12.10.4<=frida<13.0.0 
frida-tools==8.0.1 ------ 12.10.4<=frida<13.0.0 
frida-tools==8.1.0 ------ 12.10.4<=frida<13.0.0 
frida-tools==8.1.1 ------ 12.10.4<=frida<13.0.0 
frida-tools==8.1.2 ------ 12.10.4<=frida<13.0.0 
frida-tools==8.1.3 ------ 12.10.4<=frida<13.0.0 
frida-tools==8.2.0 ------ 12.10.4<=frida<13.0.0 
frida-tools==9.0.0 ------ 14.0.0<=frida<15.0.0 
frida-tools==9.0.1 ------ 14.0.0<=frida<15.0.0 
frida-tools==9.1.0 ------ 14.2.0<=frida<15.0.0 
frida-tools==9.2.0 ------ 14.2.9<=frida<15.0.0 
frida-tools==9.2.1 ------ 14.2.9<=frida<15.0.0 
frida-tools==9.2.2 ------ 14.2.9<=frida<15.0.0 
frida-tools==9.2.3 ------ 14.2.9<=frida<15.0.0 
frida-tools==9.2.4 ------ 14.2.9<=frida<15.0.0 
frida-tools==9.2.5 ------ 14.2.9<=frida<15.0.0 
frida-tools==10.0.0 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.1.0 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.1.1 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.2.0 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.2.1 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.2.2 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.3.0 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.4.0 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.4.1 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.5.0 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.5.1 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.5.2 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.5.3 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.5.4 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.6.0 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.6.1 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.6.2 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.7.0 ------ 15.0.0<=frida<16.0.0 
frida-tools==10.8.0 ------ 15.0.0<=frida<16.0.0 
frida-tools==11.0.0 ------ 15.2.0<=frida<16.0.0 
frida-tools==12.0.0 ------ 16.0.0<=frida<17.0.0 
frida-tools==12.0.1 ------ 16.0.0<=frida<17.0.0 
frida-tools==12.0.2 ------ 16.0.0<=frida<17.0.0 
frida-tools==12.0.3 ------ 16.0.0<=frida<17.0.0 
frida-tools==12.0.4 ------ 16.0.0<=frida<17.0.0 
frida-tools==12.1.0 ------ 16.0.0<=frida<17.0.0 
frida-tools==12.1.1 ------ 16.0.9<=frida<17.0.0 
frida-tools==12.1.2 ------ 16.0.9<=frida<17.0.0 
frida-tools==12.1.3 ------ 16.0.9<=frida<17.0.0 
frida-tools==12.2.0 ------ 16.0.9<=frida<17.0.0 
frida-tools==12.2.1 ------ 16.0.9<=frida<17.0.0 
frida-tools==12.3.0 ------ 16.0.9<=frida<17.0.0

分类: app逆向

站点统计

  • 文章总数:315 篇
  • 分类总数:20 个
  • 标签总数:193 个
  • 运行天数:1147 天
  • 访问总数:26731 人次

浙公网安备33011302000604

辽ICP备20003309号