datatheorem / datatheorem/TrustKit
TrustKit is not working
Nobody has claimed this yet.
- Dominant language
- Objective-C
- Stars
- 2.1k
- Forks
- 381
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
Below is the code we have written
`
public override func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
// Call into TrustKit here to do pinning validation
if NetworkUtil.isTrustKitInitialized {
if TrustKit.sharedInstance().pinningValidator.handle(challenge, completionHandler: completionHandler) == false {
// TrustKit did not handle this challenge: perhaps it was not for server trust
// or the domain was not pinned. Fall back to the default behavior
completionHandler(.performDefaultHandling, nil)
} else {
// TrustKit did successfully handled this challenge and took decision based on trust chain
DDLogDebug("SSL Pinning handled successfully")
}
} else {
completionHandler(.performDefaultHandling, nil)
}
}
//FILE: NetworkUtil.swift
static func initializeTrustKit(urlStr: String) {
//urlStr is passed here as an argument based on the user's selection of environment
if let sslKeys = Constants.SSLKeys(),
let url = URL(string: urlStr),
let domain = url.host {
let trustKitConfig = [
kTSKSwizzleNetworkDelegates: false,
kTSKPinnedDomains: [
domain: [
kTSKEnforcePinning: true,
kTSKIncludeSubdomains: true,
kTSKPublicKeyHashes: sslKeys
]
]
] as [String: Any]
TrustKit.initSharedInstance(withConfiguration: trustKitConfig)
isTrustKitInitialized = true
}
}
`
We are using BurpSuite to trace the network (setting up a proxy server and routing iPhone to use a proxy) and we can read all communication in plaintext.
This code was working but looks like on the latest iOS it is not working. I request help here.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the URLSession challenge handler and NetworkUtil.swift's initializeTrustKit function, then reproduce the report using the BurpSuite proxy setup described. Check whether the configured domain and SSL key hashes are used during challenge handling; done means intercepted traffic is rejected rather than readable in plaintext.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- mobile-dev, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100