ios11-12-ssl-bypass

by
4 views c2c3f403...

Description

Adaption, hopefully bypass iOS 12 SSL

How to Use

Download the script and run it with Frida CLI:

Download Script

Then run with Frida:

frida -U -f YOUR_PACKAGE_NAME -l ios11-12-ssl-bypass.js

Replace YOUR_PACKAGE_NAME with the target app's package name.

Source Code

JavaScript
// translation of https://github.com/nabla-c0d3/ssl-kill-switch2/blob/master/SSLKillSwitch/SSLKillSwitch.m for iOS 10/11

var tls_helper_create_peer_trust;
var version = ObjC.classes.UIDevice.currentDevice().systemVersion().toString();

if (version.startsWith("11.") || version.startsWith("12.")) { // iOS 11 or 12
    /* OSStatus nw_tls_create_peer_trust(tls_handshake_t hdsk, bool server, SecTrustRef *trustRef); */
    tls_helper_create_peer_trust = new NativeFunction(
        Module.findExportByName(null, "nw_tls_create_peer_trust"),
        'int', ['pointer', 'bool', 'pointer']
    );
} else if (version.startsWith("10.")) { // iOS 10
    /* OSStatus tls_helper_create_peer_trust(tls_handshake_t hdsk, bool server, SecTrustRef *trustRef); */
    tls_helper_create_peer_trust = new NativeFunction(
        Module.findExportByName(null, "tls_helper_create_peer_trust"),
        'int', ['pointer', 'bool', 'pointer']
    );
} else {
    console.log("Unsupported OS version!");
}

var errSecSuccess = 0;

function bypassSSL() {
    Interceptor.replace(tls_helper_create_peer_trust, new NativeCallback(function(hdsk, server, trustRef) {
        return errSecSuccess;
    }, 'int', ['pointer', 'bool', 'pointer']));
    console.log("SSL certificate validation bypass active");
}

function revertSSL() {
    Interceptor.revert(tls_helper_create_peer_trust);
    console.log("SSL certificate validation bypass disabled");
}
Share this script:
Twitter LinkedIn

Comments

Login or Sign up to leave a comment.
Loading comments...