-
Notifications
You must be signed in to change notification settings - Fork 16
/
template_frida_hook.js
37 lines (34 loc) · 1.37 KB
/
template_frida_hook.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function hook_ssl_crypto_x509_session_verify_cert_chain(address) {
Interceptor.attach(address, {
onEnter: function(args) {
console.log('Disabling SSL validation...');
},
onLeave: function(retval) {
console.log(`ssl_crypto_x509_session_verify_cert_chain: ${retval} -> 0x1`);
retval.replace(0x1);
}
});
}
Java.perform(function() {
// Early loading
const System = Java.use('java.lang.System');
const Runtime = Java.use('java.lang.Runtime');
const System_loadLibrary = System.loadLibrary.overload('java.lang.String');
const VMStack = Java.use('dalvik.system.VMStack');
System_loadLibrary.implementation = function(library) {
try {
const loaded = Runtime.getRuntime().loadLibrary0(VMStack.getCallingClassLoader(), library);
if(library.includes('flutter')) { // libflutter.so
var libflutter = Module.findBaseAddress('libflutter.so');
console.log(`libflutter.so found @ ${libflutter}`);
var offset = 0x00000000;
var addr = libflutter.add(offset);
console.log(`ssl_crypto_x509_session_verify_cert_chain @ ${addr}`);
hook_ssl_crypto_x509_session_verify_cert_chain(addr);
}
return loaded;
} catch(ex) {
console.log(ex);
}
};
});