Skip to content

Instantly share code, notes, and snippets.

@tiiime
Last active January 7, 2019 03:41
Show Gist options
  • Save tiiime/101d659f2161a9a9cf894492f289e6ec to your computer and use it in GitHub Desktop.
Save tiiime/101d659f2161a9a9cf894492f289e6ec to your computer and use it in GitHub Desktop.
android network security config bypass with frida
curl -O https://build.frida.re/frida/android/arm/bin/frida-server
adb push frida-server /data/local/tmp/
adb shell "chmod 755 /data/local/tmp/frida-server"
adb shell "/data/local/tmp/frida-server &"
// frida -U -l network-security-config-bypass.js --no-pause -f tv.danmaku.bili
Java.perform(function(){
NetworkSecurityConfig_Builder =Java.use("android.security.net.config.NetworkSecurityConfig$Builder")
CertificatesEntryRef = Java.use("android.security.net.config.CertificatesEntryRef")
CertificateSource = Java.use("android.security.net.config.CertificateSource")
UserCertificateSource = Java.use("android.security.net.config.UserCertificateSource")
NetworkSecurityConfig_Builder.getEffectiveCertificatesEntryRefs.implementation = function(){
origin = this.getEffectiveCertificatesEntryRefs()
source = UserCertificateSource.getInstance()
userCert = CertificatesEntryRef.$new(source,true)
origin.add(userCert)
return origin
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment