安卓app Anti-Tampering方案总结
参考:
【JISA20】A Large-Scale Study on the Adoption of Anti-Debugging and Anti-Tampering Protections in Android Apps
JISA是CCF-C类期刊
(1)Signature Checking
关于app证书及其校验,参见https://blog.csdn.net/qq_39441603/article/details/123767506
(2)Code Integrity Checking
计算文件(例如,资源文件或程序文件)hash值,并和预设的合法值进行比较
例如,app可以使用Zipentry库来计算文件CRC校验码。
(3)Installer Verification
安装渠道检查
app可以调用PackageManager.getInstallerPackageName API 来获取 安装了当前app 的app的包名
(4)SafetyNet Attestation
Google的经典远程证明框架:
- 由GMS中的SafetyNet相关服务,不断采集设备信息,发送给Google Server
- Google Server基于这些信息完成设备完整性判断
- app集成SafetyNet SDK,当需要检查设备完整性时,发送nonce给Google Server,获取JWS签名过的判断结果
- !!!注意,被签名的判断结果中,包含GMS获取到的app包证书摘要。所以SafetyNet除了用于设备完整性检测,也用于app客户端完整性检测
文中的一些数据性结论
-
Our analysis shows that 59% of these apps implement neither Anti-Debugging nor Anti-Tampering protections
41%的app使用了Anti-Debugging或Anti-Tampering protections -
half of the remaining apps deploy only one protection
41%中约一半的app只使用了Anti-Debugging或Anti-Tampering中的一项 -
We also observe that app developers prefer Java to Native protections by a ratio of 99 to 1