iOS SSL Pinning Bypass Code

2026. 6. 3. 17:56·iOS
// SSL Pinning Bypass iOS - Frida Script
// Cobertura: SecTrustEvaluate, NSURLSession, BoringSSL
console.log("[*] Iniciando SSL Bypass para iOS...");

const SSL_VERIFY_NONE = 0;

// --- SecTrustEvaluate ---
const trustEvaluate = Module.findExportByName(null, "SecTrustEvaluate");
if (trustEvaluate) {
    Interceptor.replace(trustEvaluate, new NativeCallback(function (trustRef, resultPtr) {
        console.log("[*] SecTrustEvaluate interceptado");
        if (!resultPtr.isNull()) {
            Memory.writeU32(resultPtr, 1); // kSecTrustResultProceed
        }
        return 0; // errSecSuccess
    }, 'int', ['pointer', 'pointer']));
}

const trustEvaluateWithError = Module.findExportByName(null, "SecTrustEvaluateWithError");
if (trustEvaluateWithError) {
    Interceptor.replace(trustEvaluateWithError, new NativeCallback(function (trust, error) {
        console.log("[*] SecTrustEvaluateWithError interceptado");
        return 1; // true
    }, 'bool', ['pointer', 'pointer']));
}

// --- CFNetwork (opcional) ---
const cfSetAllowsAny = Module.findExportByName(null, "CFURLConnectionSetAllowsAnyHTTPSCertificate");
if (cfSetAllowsAny) {
    Interceptor.replace(cfSetAllowsAny, new NativeCallback(function (conn, host) {
        console.log("[*] CFURLConnectionSetAllowsAnyHTTPSCertificate interceptado");
    }, 'void', ['pointer', 'pointer']));
}

// --- BoringSSL (solo si está presente) ---
try {
    const boring = Process.getModuleByName("libboringssl.dylib");
    const setVerifyPtr = boring.findExportByName("SSL_set_custom_verify");
    const getPskPtr = boring.findExportByName("SSL_get_psk_identity");

    if (setVerifyPtr) {
        const SSL_set_custom_verify = new NativeFunction(setVerifyPtr, 'void', ['pointer', 'int', 'pointer']);
        const verifyCallback = new NativeCallback(function (ssl, alert) {
            console.log("[*] SSL verify callback ejecutado");
            return SSL_VERIFY_NONE;
        }, 'int', ['pointer', 'pointer']);

        Interceptor.replace(setVerifyPtr, new NativeCallback(function (ssl, mode, cb) {
            console.log("[*] Reemplazando SSL_set_custom_verify");
            SSL_set_custom_verify(ssl, mode, verifyCallback);
        }, 'void', ['pointer', 'int', 'pointer']));
    }

    if (getPskPtr) {
        Interceptor.replace(getPskPtr, new NativeCallback(function (ssl) {
            console.log("[*] SSL_get_psk_identity interceptado");
            return Memory.allocUtf8String("notarealPSKidentity");
        }, 'pointer', ['pointer']));
    }
} catch (e) {
    console.log("[-] libboringssl.dylib no presente o no cargado");
}

console.log("[+] SSL Bypass cargado correctamente.");

 
 
 
 
https://codeshare.frida.re/@Andr3sM12/ssl-ios-jun25/

Frida CodeShare

codeshare.frida.re

 
 
https://www.redfoxsec.com/blog/bypassing-ssl-pinning-on-ios-applications

Bypassing SSL Pinning on iOS Applications: A Complete Pentesting Guide

Learn how to bypass SSL pinning on iOS applications using tools like Frida, Objection, and SSL Kill Switch 2. A practical, command-driven guide for penetration testers and security researchers.

www.redfoxsec.com

 

반응형
저작자표시 (새창열림)

'iOS' 카테고리의 다른 글

iOS frida 설치  (1) 2026.04.04
iOS 탈옥  (2) 2026.03.13
frida iOS dump IPA 추출  (0) 2026.03.06
iOS Class method / Instance method  (0) 2025.07.17
iOS DFU 모드  (0) 2025.07.03
'iOS' 카테고리의 다른 글
  • iOS frida 설치
  • iOS 탈옥
  • frida iOS dump IPA 추출
  • iOS Class method / Instance method
JNU
JNU
JNU의 보안공부
  • JNU
    JNU diary
    JNU
  • 전체
    오늘
    어제
  • 인기 글

    • 분류 전체보기 (105)
      • 네트워크 보안 (15)
      • 시스템 보안 (18)
      • 웹 보안 (16)
      • Frida (4)
      • Android (4)
      • 정보보안기사_산업기사 (1)
      • iOS (6)
      • Network (7)
      • 악성코드 분석 (10)
      • 침투테스트 (5)
      • Bandit 원정대 (4)
      • 대학원 (3)
      • AWS Cloud (3)
      • CVE (2)
      • Python (0)
      • Dreamhack (1)
      • 취약점 진단 (5)
      • 레드라쿤 CTI (1)
  • 06-09 01:58
  • hELLO· Designed By정상우.v4.10.5
JNU
iOS SSL Pinning Bypass Code
상단으로

티스토리툴바