移动端应用常通过 SSL Pinning(证书绑定) 校验服务端的公钥 Hash,导致 Burp Suite 等抓包代理抛出 TLS 握手异常。安全研究员通过 Frida 注入 JavaScript 脚本直接对 TrustManagerImpl 进行运行时 Hook,从而绕过校验。
一、Frida Hook TrustManager 典型脚本
javascript
Java.perform(function () {
var TrustManagerImpl = Java.use('com.android.org.conscrypt.TrustManagerImpl');
var ArrayList = Java.use('java.util.ArrayList');
// 劫持 checkTrustedRecursive 方法,直接返回空验证链
TrustManagerImpl.checkTrustedRecursive.implementation = function (certs, host, clientAuth, untrustedChain, trustAnchorChain, used) {
console.log("[+] Bypassing SSL Pinning for host: " + host);
return ArrayList.$new();
};
});