Giter Club home page Giter Club logo

camille's Introduction

Camille

Android App隐私合规检测辅助工具

简介

现如今APP隐私合规十分重要,各监管部门不断开展APP专项治理工作及核查通报,不合规的APP通知整改或直接下架。camille可以hook住Android敏感接口,检测是否第三方SDK调用。根据隐私合规的场景,辅助检查是否符合隐私合规标准。

隐私合规资料及政策

隐私资料政策wiki

安装

环境:

python3、frida 、一台已root手机(我测试机为Redmi 3s,刷机成魔趣Android 8.1,感觉问题挺多的),并在手机上运行frida-server

测试了Android 8.1(还测试了魔趣Android 10),其他版本安卓可能会有bug。

更新日志:

2023-03-14:新增敏感接口

2022-12-12:修复android 13有兼容性问题

2022-11-25:修复截图bug、优化hook方法支持传参数过滤

2022-11-21:新增可指定frida-server用于对抗frida检测,参数-H、修复模拟器没有sdcard目录报错问题

2022-11-16:感谢@ysrfeng 添加wiki,添加隐私合规相关资料和政策文档。

2022-11-15:合并@RebornQ PR,新增多设备可指定设备功能

2022-11-11:修复Android7报错、Frida12报错、优化异常处理便于排查

2022-11-10: 合并@RebornQ PR、修复部分问题、优化初始化异常提示

2022-11-03: 添加同意隐私合规状态(需人工确认)、第三方SDK识别、可hook构造函数,`methodName`传`'$init'`。方便大家交流,创建交流群。 新增文件接口,感谢@LiuXinzhi94提供。 新增敏感接口,感谢群里师傅@WYY提供

2022-10-26:新增支持加载外部脚本文件,填相对路径或绝对路径均可(用于 pyinstaller 打包二进制执行文件后使用)感谢@RebornQ pr

2022-09-07:添加讨论群,新增敏感接口,感谢群里师傅@410提供。

2022-07-08: 默认不开启绕过TracerPid,添加attach hook,避免有些加固包不能hook问题。

2022-06-22:修复程序异常退出、冗余度高、hook接口不全有遗落、新增多个Android版本接口;封装hook方法,新增用户自定义hook方法。

2022-01-14:删除hook短信接口。新增:可指定模块hook或不hook哪些模块。默认不传,全扫描。

下载:

git clone https://github.com/zhengjim/camille.git
cd camille
pip install -r requirements.txt
python camille.py -h

img.png

用法

使用说明文档

后记

本来想使用uiautomator2或appium来模拟点击制定场景,但后续调研发现纯自动化的检测是不全的,最多也就检测20-30%,还是得结合人工来检测。索性就删除了模拟点击这块。(其实就是懒,不定期更新)

场景

百度史宾格的检测场景

参考链接

讨论群

感谢@ysrfeng 提供的App合规检测交流群,有需要的可以加群交流~

为方便大家交流,创建交流群有需要的加群。App隐私合规交流群满200,需要的加V,备注github。就会拉进群。

404星链计划

camille项目 现已加入 404星链计划

Stargazers over time

Top Langs

Stargazers over time

camille's People

Contributors

rebornq avatar ysrfeng avatar zhengjim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

camille's Issues

app 闪退

设备: 红米k40
版本: 安卓12/MIUI13.0.7
frida: 16.0.7
问题: 使用依附进程的方式进行 hook, 在2秒钟左右 app 会闪退, 同时没有任何报错
命令: python camille.py 同程旅行 --isattach

最新版本无法正常hook

ff
如图,使用最新的frida16.0.8不行,又降到之前用的15.2.2了也不行
1.小米6,安卓8.0,已root(关闭selinux),使用包名和ia方式均不行,
2.三星盖世Note20 Ultra,安卓12,已root(无法关闭selinux),操作如此,也无法正常hook

均能正常弹出隐私提醒,点了后就直接中止了

启动一会报错

{'type': 'error', 'description': "Error: can't decode byte 0x85 in position 1", 'stack': "Error: can't decode byte 0x85 in position 1\n at (/script1.js:7)", 'fileName': '/script1.js', 'lineNumber': 7, 'columnNumber': 1}

TypeError: cannot read property 'overloads' of undefined

[] 2022-11-25 10:59:46 检测到安卓版本:6.0.1
[
] 2022-12-25 10:59:46 已加载模块permission,phone,system,app,location,network,camera,bluetooth,file,media,custom
TypeError: cannot read property 'overloads' of undefined
[*] hook(getPackageInfoAsUser)方法失败,请检查该方法是否存在!!!

运行提示错误-且APP自动打开后秒退。

camille # python3 camille.py com.youloft.calendar

合规检测敏感接口开始监控...
Error: java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.ActivityCompat" on path: DexPathList[[zip file "/data/app/com.youloft.calendar-1/base.apk"],nativeLibraryDirectories=[/data/app/com.youloft.calendar-1/lib/arm, /data/app/com.youloft.calendar-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
Error: query(): specified argument types do not match any of:
.overload('android.net.Uri', '[Ljava.lang.String;', 'java.lang.String', '[Ljava.lang.String;', 'java.lang.String')
.overload('android.net.Uri', '[Ljava.lang.String;', 'java.lang.String', '[Ljava.lang.String;', 'java.lang.String', 'android.os.CancellationSignal')
^C[*] You have stoped hook.

环境:本地PC-macbook pro 、OS版本12.2.1
安卓:魅族MX6 、android版本7.1.1、frida为最新版。
1312

运行提示设备找不到?

$ python camille.py com.tencent.mm -t 3


.o88b. .d8b. .88b d88. d888888b db db d88888b
d8P Y8 d8' 8b 88'YbdP88 88' 88 88 88' 8P 88ooo88 88 88 88 88 88 88 88ooooo 8b 88~~~88 88 88 88 88 88 88 88~~~~~ Y8b d8 88 88 88 88 88 .88. 88booo. 88booo. 88. Y88P' YP YP YP YP YP Y888888P Y88888P Y88888P Y88888P

        https://github.com/zhengjim/camille

[*] hook error
device not found

但是执行frida-ps -U 是可以查看进程的
设备是pixel 安卓8.1.0的版本

运行camille模拟器就崩掉重启

如题,运行camille ,模拟器就崩掉然后重启,试了主流的几个模拟器都这样。返回如下报错
[] 2023-06-05 16:46:03 Frida bindings 版本: 16.0.19
[
] 2023-06-05 16:46:11 'gbk' codec can't decode byte 0xa7 in position 84: illegal multibyte sequence
[] 2023-06-05 16:46:11 关闭同意隐私状态,状态均为同意前,不影响hook!
[
] 2023-06-05 16:46:12 hook fail, try delaying hook, adjusting delay time__

检测某个应用时候不出日志

你好,这边在检测某个应用时候不出日志,能否帮看下,或者加个功能:把result打印出来
Dingtalk_20220628105803

可否请大神进群里交流一下

IMG_8396

[error] opencv-python Error

run python camille.py -h
AttributeError: partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline

fixed by reinstall with 4.5.2.52
pip uninstall opencv-python
pip install opencv-python==4.5.2.52

点击同意后无更多输出日志了

image

*] 2023-02-16 18:37:05 使用 127.0.0.1:62001 设备 [*] 2023-02-16 18:37:05 设备架构: x86 [*] 2023-02-16 18:37:05 Frida bindings 版本: 16.0.9 [*] 2023-1-16 18:37:8 隐私合规检测敏感接口开始监控... [*] 2023-1-16 18:37:8 检测到安卓版本:7.1.2 [*] 2023-02-16 18:37:08 已加载模块permission,phone,system,app,location,network,camera,bluetooth,file,media,custom

代码优化建议,减少设备检测数量

在脚本“device.py”文件,第43行如下
devices = list(filter(lambda d: not d.name.lower().startswith("local"), frida.enumerate_devices()))
会检测处其他无用设备,建议优化如下
devices = list(filter(lambda d: (not d.name.lower().startswith("local")) and (d.type=="usb"), frida.enumerate_devices()))
增肌一个type的usb判定,但未测试adb无线连接是否可行等问题,暂还不熟悉frida使用方法,感觉该脚本非常naisi

Error: sendTextMessageInternal(): has more than one overload

使用Arm版本模拟器
错误信息:
% python3 camille.py com.xx.xx -t 3
合规检测敏感接口开始监控... {'type': 'error', 'description': "Error: sendTextMessageInternal(): has more than one overload, use .overload(<signature>) to choose from:\n\t.overload('java.lang.String', 'java.lang.String', 'java.lang.String', 'android.app.PendingIntent', 'android.app.PendingIntent', 'boolean', 'int', 'boolean', 'int')\n\t.overload('java.lang.String', 'java.lang.String', 'java.lang.String', 'android.app.PendingIntent', 'android.app.PendingIntent', 'boolean', 'java.lang.String', 'java.lang.String', 'long')", 'stack': "Error: sendTextMessageInternal(): has more than one overload, use .overload(<signature>) to choose from:\n\t.overload('java.lang.String', 'java.lang.String', 'java.lang.String', 'android.app.PendingIntent', 'android.app.PendingIntent', 'boolean', 'int', 'boolean', 'int')\n\t.overload('java.lang.String', 'java.lang.String', 'java.lang.String', 'android.app.PendingIntent', 'android.app.PendingIntent', 'boolean', 'java.lang.String', 'java.lang.String', 'long')\n at X (frida/node_modules/frida-java-bridge/lib/class-factory.js:563)\n at K (frida/node_modules/frida-java-bridge/lib/class-factory.js:558)\n at set (frida/node_modules/frida-java-bridge/lib/class-factory.js:925)\n at getSMSManager (/script1.js:454)\n at <anonymous> (/script1.js:503)\n at <anonymous> (frida/node_modules/frida-java-bridge/lib/vm.js:11)\n at _performPendingVmOps (frida/node_modules/frida-java-bridge/index.js:238)\n at <anonymous> (frida/node_modules/frida-java-bridge/index.js:213)\n at <anonymous> (frida/node_modules/frida-java-bridge/lib/vm.js:11)\n at _performPendingVmOpsWhenReady (frida/node_modules/frida-java-bridge/index.js:232)\n at perform (frida/node_modules/frida-java-bridge/index.js:192)\n at main (/script1.js:504)\n at apply (native)\n at <anonymous> (frida/runtime/core.js:45)", 'fileName': 'frida/node_modules/frida-java-bridge/lib/class-factory.js', 'lineNumber': 563, 'columnNumber': 1}

启动报错,大佬帮忙看看

环境:PC python3.8 雷神模拟器(Android7.0)
步骤:直接在pycharm终端输入命令时,发现运行报错
结果:
image
尝试了重启adb等各种方法,均无效,已下载最新camille
前一段时间可以用来测试,有1-2周未使用出现的该状况,麻烦帮忙看看

小米Miui 9 (开发内测版本,已经获取了root权限)

参考连接教程

使用frida版本为15.1.17,15.2.2,多个版本都试了,没有效果.

已经在手机的/data/local/tmp中运行frida-server服务,正常启动

企业微信截图_5322a303-7482-4ab3-a8f7-01824e9c9265

在mac端运行检测程序正常,但没有日志出现,如果加上-t 参数,会出现失败情况

企业微信截图_495b651c-9574-4e72-b6c5-13b80f21e2ab
企业微信截图_83e45a50-06d1-4671-9414-b520127edced

如果使用-ia方式,则会出现应用程序打开后,马上自动退出

系统版本如下:

企业微信截图_91f623e6-daf8-44e6-b8b2-84dd6227de14
企业微信截图_9ca4ceed-d3f2-44d1-8563-08e4a350b222

希望能得到您帮助,感谢.

检测不到iccid调用

1,目标: 检测极验sdk调用iccid行为
2, 场景: 魅族root真机+sim卡,4g网络把wifi关了
3, 参考其他检测工具的堆栈结果:

android.content.ContentResolver.query(ContentResolver.java:753)\n\n
at android.content.ContentResolver.query(ContentResolver.java:711)\n\n
at java.lang.reflect.Method.invoke(Method.java:-2)\n\n
at com.geetest.onelogin.p.p.d(null:189)\n\nat com.geetest.onelogin.p.p.c(null:156)\n\n
at com.geetest.onelogin.j.d.b(null:152)\n\nat com.geetest.onelogin.j.d.a(null:63)\n\n
at com.geetest.onelogin.m.c.v(null:166)\n\nat com.geetest.onelogin.m.c.b(null:39)\n\n
at com.geetest.onelogin.m.c$2.run(null:139)\n\n
at android.os.Handler.handleCallback(Handler.java:873)\n\n
at android.os.Handler.dispatchMessage(Handler.java:99)\n\n
at android.os.Looper.loop(Looper.java:193)\n\n
at android.app.ActivityThread.main(ActivityThread.java:6718)\n\n
at java.lang.reflect.Method.invoke(Method.java:-2)\n\n'}}

Android 10 的spawn模式不设置settimeout hook失败,设置后存在漏检情况,麻烦可以兼容下吗

实际检测时,兼容的系统版本高一点会更具有实用价值,比如10.0不再允许后台获取剪切板,获取imei的api也会报错,如果集成了腾讯x5,sdk集成时会判断当前系统如果大于9.0,会针对性处理。实际运行中代码或者第三方sdk 中或多或少存在判断版本系统才去执行某些敏感api的情况,所以用来hook的机子,最好也得兼容到高一点版本的系统,否则会存在漏检。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.