1.环境

  • root安卓手机一部(模拟器无法hook so文件)
  • firda-server
  • frida-client

2.实现

2.1定位

quic协议必须满足下面条件

  • 安卓10+
  • quic基于udp协议,必须支持udp。client hello包里包含密钥,可用wireshark抓包解包。

一般使用开源的chrome实现的quic协议 ,在openssl 中以 SSL_CTX_set_custom_verify函数来返回是否支持quic ,其中第三个参数为回调函数,返回为0即表示不支持
在这里插入图片描述

2.2 hookjs

function hook_dlopen_ext(module) {
    var android_dlopen_ext = Module.findExportByName(null, "android_dlopen_ext");
    if (android_dlopen_ext) {
        Interceptor.attach(android_dlopen_ext, {
            onEnter: function (args) {
                var pathptr = args[0];
                if (pathptr) {
                    this.path = (pathptr).readCString();
                    if (this.path.indexOf(module) >= 0) {
                        this.canhook = true;
                    }
                }
            },
            onLeave: function (retval) {
                if (this.canhook) {
                    let verifyadd = Module.getExportByName(module,"SSL_CTX_set_custom_verify");
                    Interceptor.attach(verifyadd,{
                        onEnter(args){
                            Interceptor.attach(args[2],{
                                onLeave(retval){
                                    retval.replace(0x0);
                                }
                            })
                        }
                    })
                }
            }
        });
    }
}
hook_dlopen_ext("libsscronet.so")

执行附加

frida -H 127.0.0.1:2199 -f pacakge  -l hookQuic.js

pacakge为包名

到此quic即可降级

3.notice

有一些应用会在启动时判断一次是否支持quic,然后将结果保存在内存里,所以在实时hook的时候根本hook不成功,此时必须使用spawn应用,让其重启时就开始hook。

如遇到双向证书验证,直接无脑xposed/lsp + justtrustme即可。或者直接frida脚本有很多hook双向证书的,直接搜。

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐