ios-reverse-engineering-skill iOS Reverse & Tweak Engineering Suite

Detect Certificate Pinning in an iOS App

Certificate pinning decides which certificates the app accepts. A pinned app blocks an intercepting proxy. This page describes how to detect the pinning from the binary file alone, without a jailbroken device and without a man in the middle.

Get the skill Extract the APIs

Run the scan


bash scripts/find-api-calls.sh app.ipa --pins

The pinning APIs

PatternMeaning
SecTrustEvaluateA custom trust evaluation
SecTrustSetAnchorCertificatesA custom anchor list
SecCertificateCopyDataA certificate comparison in the code
ServerTrustPolicyThe Alamofire server trust manager
AFSecurityPolicyThe Alamofire security policy
TrustKitThe TrustKit library
pinnedCertificatA custom pinning implementation
sha256/A public key pin
NSURLAuthenticationChallengeA delegate that receives a challenge
didReceive.*challengeA delegate method for a challenge

The pinned host list

A list of pinned hosts is a strong signal. The list names the first-party hosts of the app. The list also shows the environments, for example api.example.com and staging-api.example.com.

Read the string dump of the teardown and look for the host names next to the pin markers.


grep -rn 'sha256/\|pinned\|TrustKit' app-teardown/report/18-strings-main.txt

The absence of the evidence

The absence of a pattern does not prove the absence of the pinning. The pinning can live in a static framework. The app can use the system trust policy. The app can pin at the network layer with a custom URLProtocol.

Always report the posture honestly. Report what the binary shows, and report the limit of the method.

The App Transport Security posture

Pinning and the TLS policy are two different controls. Read both.


bash scripts/find-api-calls.sh app.ipa --ats
ValueMeaning
The key is absentThe app uses the standard TLS policy
NSAllowsArbitraryLoads is trueThe app can use plain HTTP. This is a finding.
NSExceptionDomainsThe app allows plain HTTP for the listed domains

The findings to report