# SSL unpinning iOS and macOS applications

## SSL unpinning iOS and macOS applications

<https://github.com/nabla-c0d3/ssl-kill-switch2>

## [SSL Kill Switch 2](https://github.com/nabla-c0d3/ssl-kill-switch2#ssl-kill-switch-2)

Blackbox tool to disable SSL/TLS certificate validation - including certificate pinning - within iOS and macOS applications. Second iteration of <https://github.com/iSECPartners/ios-ssl-kill-switch> .

### [Description](https://github.com/nabla-c0d3/ssl-kill-switch2#description)

Once loaded into an iOS or macOS application, SSL Kill Switch 2 will patch low-level functions responsible for handling SSL/TLS connections in order to override and disable the system's default certificate validation, as well as any kind of custom certificate validation (such as certificate pinning).

It was successfully tested against various applications implementing certificate pinning including the Apple App Store. The first version of SSL Kill Switch was released at Black Hat Vegas 2012.

The most recent version iOS that is known to be supported is 14.2.

### [iOS Instructions](https://github.com/nabla-c0d3/ssl-kill-switch2#ios-instructions)

On iOS, SSL Kill Switch 2 can be installed as a Cydia Subtrate tweak on a jailbroken device.

#### [WARNING: THIS TWEAK WILL MAKE YOUR DEVICE INSECURE](https://github.com/nabla-c0d3/ssl-kill-switch2#warning-this-tweak-will-make-your-device-insecure)

Installing SSL Kill Switch 2 allows anyone on the same network as the device to easily perform man-in-the-middle attacks against *any* SSL or HTTPS connection. This means that it is trivial to get access to emails, websites viewed in Safari and any other data downloaded by any App running on the device.

#### [Installation](https://github.com/nabla-c0d3/ssl-kill-switch2#installation)

The following dependencies should be installed using Cydia:

* Debian Packager
* Cydia Substrate
* PreferenceLoader

Then, download the latest pre-compiled package available in the release tab of the SSL Kill Switch 2's GitHub page. Copy it to the device, install it and respring the device:

```
dpkg -i <package>.deb
killall -HUP SpringBoard

```

There should be a new menu in the device's Settings where you can enable the extension. Finally, kill and restart the App you want to test.

The tweak can later be uninstalled using:

```
dpkg -r com.nablac0d3.SSLKillSwitch2

```

#### [Intercepting the App Store's traffic](https://github.com/nabla-c0d3/ssl-kill-switch2#intercepting-the-app-stores-traffic)

Lots of people have asked about how to intercept the App Store's traffic using SSL Kill Switch 2. I wrote down some instructions here but there are now outdated: <http://nabla-c0d3.github.io/blog/2013/08/20/intercepting-the-app-stores-traffic-on-ios/>

#### [Intercepting with Charles Proxy](https://github.com/nabla-c0d3/ssl-kill-switch2#intercepting-with-charles-proxy)

By default, SSL Kill Switch will disrupt the Charles Proxy iOS app and you will not be able to proxy any network traffic with it. To fix this, add the Charles Proxy app (com.xk72.Charles) to the list of excluded bundle IDs in the SSL Kill Switch config:

![](/files/8sssXqBh4nGnTQGPymGK)

#### [Build](https://github.com/nabla-c0d3/ssl-kill-switch2#build)

The build requires the Theos suite to be installed available at <http://www.iphonedevwiki.net/index.php/Theos/Getting_Started> .

Then, within SSL Kill Switch 2's root foler, create a symlink to your theos installation:

```
ln -s /<path_to_your_theos_folder> theos

```

Make sure dpkg is installed. If you have Homebrew, use:

```
brew install dpkg

```

Then, the SSL Kill Switch 2 Debian package can be built using:

```
make package

```

### [macOS Instructions](https://github.com/nabla-c0d3/ssl-kill-switch2#macos-instructions)

SSL Kill Switch 2 can be used in macOS applications as a dynamic library to be injected into processes.

#### [WARNING: THIS HAS NOT BEEN TESTED ON RECENT VERSIONS OF MACOS](https://github.com/nabla-c0d3/ssl-kill-switch2#warning-this-has-not-been-tested-on-recent-versions-of-macos)

#### [Usage](https://github.com/nabla-c0d3/ssl-kill-switch2#usage)

On macOS, the SSLKillSwitch library needs to be manually injected into the process where SSL pinning needs to be disabled. Once injected, it will automatically override and disable SSL validation.

There are several ways to do this including:

*

```
Starting the process with LLDB or in Xcode Debug->Attach to process then pause, and load SSLKillSwitch using `dlopen()`:
```

````
```
  (lldb) expr (void*)dlopen("/path/to/build/SSLKillSwitch.framework/Versions/A/SSLKillSwitch", 1)

```

Expected result is a non-zero pointer:

```
  (void *) $1 = 0x00007f92e74d10c0

```

If you receive a zero pointer then you may need to enable code-signing and build for profiling then use the binary in the release folder, and even may have to copy the binary to the app's resources folder. In which case you would have seen a sandbox read violation output to console. To test a new version of the binary you need to kill the app and load it in again.
````

\-

```
Using DYLD_INSERT_LIBRARIES to inject SSLKillSwitch and start the process.
```

#### [Restricted Apps](https://github.com/nabla-c0d3/ssl-kill-switch2#restricted-apps)

TBD

#### [Build](https://github.com/nabla-c0d3/ssl-kill-switch2#build-1)

Use the Xcode project to build SSL Kill Switch 2 for macOS. The compiled library will then be available in *Products/SSLKillSwitch.framework/Versions/A/SSLKillSwitch*. This is the binary that you need to inject in the process where you want to disable SSL pinning.

### [Changelog](https://github.com/nabla-c0d3/ssl-kill-switch2#changelog)

* v0.14: Added support for iOS 13.
* v0.13: Added support for iOS 12.
* v0.12: Added support for iOS 11.
* v0.11: Added support for iOS 10.
* v0.10: Added support for proxy-ing [CocoaSPDY](https://github.com/twitter/CocoaSPDY) Apps (ie. Twitter iOS).
* v0.9: Extended the MobileLoader filter to simplify the proxy-ing of the Apple App Store application.
* V0.8: Added support for iOS 9.
* v0.7: Renamed tool to SSL Kill Switch 2; added support for macOS applications and TrustKit.
* v0.6: Added support for iOS 7.
* v0.5: Complete rewrite in order to add support for proxy-ing Apple's App Store application.
* v0.4: Added hooks for SecTrustEvaluate().
* v0.3: Bug fixes and support for iOS 6.
* v0.2: Initial release.

### [License](https://github.com/nabla-c0d3/ssl-kill-switch2#license)

MIT - See ./LICENSE.

### [Author](https://github.com/nabla-c0d3/ssl-kill-switch2#author)

Alban Diquet - @nabla\_c0d3


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.konstantinsecurity.com/readme/pentest/ios/ssl-unpinning-ios-and-macos-applications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
