From 17f6211784e53aa80e9d7129a909c1a57abe4689 Mon Sep 17 00:00:00 2001 From: Evgenii Devisok Date: Thu, 28 Mar 2024 16:12:07 +0300 Subject: [PATCH] add instagram app support --- native-tls-hook.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/native-tls-hook.js b/native-tls-hook.js index 598d1f1..4f90987 100644 --- a/native-tls-hook.js +++ b/native-tls-hook.js @@ -37,11 +37,16 @@ const TARGET_LIBS = [ { name: 'libsscronet.so', hooked: false }, // Cronet on Android { name: 'boringssl', hooked: false }, // Bundled by some apps e.g. TikTok on iOS { name: 'libssl.so', hooked: false }, // Native OpenSSL in Android + { name: 'libliger.so', hooked: false }, // Facebook proxygen ]; TARGET_LIBS.forEach((targetLib) => { waitForModule(targetLib.name, (moduleName) => { - patchTargetLib(moduleName); + if(moduleName === 'libliger.so'){ + hook_proxygen_SSLVerification(moduleName); + }else{ + patchTargetLib(moduleName); + } targetLib.hooked = true; }); @@ -56,6 +61,23 @@ TARGET_LIBS.forEach((targetLib) => { } }); +function hook_proxygen_SSLVerification(library) { + const functionName = "_ZN8proxygen15SSLVerification17verifyWithMetricsEbP17x509_store_ctx_stRKNSt6__ndk112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEPNS0_31SSLFailureVerificationCallbacksEPNS0_31SSLSuccessVerificationCallbacksERKNS_15TimeUtilGenericINS3_6chrono12steady_clockEEERNS_10TraceEventE"; + + try { + const f = Module.getExportByName(library, functionName); + + Interceptor.attach(f, { + onLeave: function (retvalue) { + retvalue.replace(1); + } + }); + console.log(`[+] Hooked function: ${functionName}`); + } catch (err) { + console.log(`[-] Failed to hook function: ${functionName}: ${err.toString()}`); + } +} + function patchTargetLib(targetLib) { // Get the peer certificates from an SSL pointer. Returns a pointer to a STACK_OF(CRYPTO_BUFFER) // which requires use of the next few methods below to actually access. @@ -190,5 +212,4 @@ function patchTargetLib(targetLib) { } else if (customVerifyAddrs.length) { console.log(`Patched ${customVerifyAddrs.length} custom_verify methods, but couldn't find get_psk_identity`); } -} - +} \ No newline at end of file