The code sample sets tlsMinimumSupportedProtocolVersion on a URLSessionConfiguration to .TLSv10, which requests that URLSession connections accept TLS 1.0. Even though ATS would block such a connection at runtime unless an explicit Info.plist exception is also present, using this API with a deprecated TLS version is itself a bad practice and should be flagged.
importFoundationimportNetworkstructMastgTest{//SUMMARY:ThissampledemonstratesanattempttouseTLS1.0endpointsiniOSapps.//However,theconnectionwillfailbecauseAppTransportSecurity(ATS)requiresTLS1.2orlaterbydefault.//ThistestshowsthatURLSession's TLS settings do not override ATS requirements, and that explicit exceptions in Info.plist are needed to allow older TLS versions.staticlettls10Endpoint="https://tls-v1-0.badssl.com:1010/"staticfuncmastgTest(completion:@escaping(String)->Void){varresult="Testing TLS 1.0 URL connections:\n\n"guardleturl=URL(string:tls10Endpoint)else{completion(result+"Invalid URL: \(tls10Endpoint)\n")return}letconfiguration=URLSessionConfiguration.ephemeralconfiguration.tlsMinimumSupportedProtocolVersion=.TLSv10letsession=URLSession(configuration:configuration)lettask=session.dataTask(with:url){_,response,errorinifleterror=errorasNSError?{result+="HTTP request to \(tls10Endpoint) failed:\n"result+="Domain: \(error.domain)\n"result+="Code: \(error.code)\n"result+="Description: \(error.localizedDescription)\n\n"result+="This is expected if ATS is not relaxed in Info.plist.\n"result+="URLSession TLS settings do not replace ATS exceptions.\n"}elseiflethttpResponse=responseas?HTTPURLResponse{result+="HTTP request to \(tls10Endpoint) returned status: \(httpResponse.statusCode)\n"}else{result+="HTTP request to \(tls10Endpoint) completed without HTTP response.\n"}DispatchQueue.main.async{completion(result)}}task.resume()}}
First, it looks up the symbol name and cross-references for setTLSMinimumSupportedProtocolVersion: to confirm the setter is present and to find the stub function used to dispatch it.
Second, it disassembles the stub (fcn.1000091a0) to show the Objective-C message dispatch pattern.
Third, it searches the binary for ARM64 mov w2 instructions that load each of the known TLS protocol constants immediately before the setter call. On ARM64, w2 carries the first argument in an Objective-C message send. The TLS constants are 0x0301 (TLS 1.0), 0x0302 (TLS 1.1), 0x0303 (TLS 1.2), and 0x0304 (TLS 1.3). Because each constant produces a fixed 4-byte instruction encoding (for example, mov w2, 0x301 encodes as 22 60 80 52 in little-endian), the script searches for those byte sequences directly and then disassembles the surrounding instructions.
On ARM64, Objective-C message sends follow the convention x0 = receiver, x1 = selector, x2 = first argument. fcn.1000091a0 loads the setTLSMinimumSupportedProtocolVersion: selector into x1 and jumps to objc_msgSend. The instruction at 0x100004194 loads w2 with 0x301 immediately before that call, making this equivalent to:
The subsequent call at 0x1000041ac passes the configured NSURLSessionConfiguration object to a NSURLSession factory method, confirming the session is created with this TLS setting.
Although ATS would block the connection at runtime unless a matching Info.plist exception is also present, explicitly setting tlsMinimumSupportedProtocolVersion to a deprecated TLS version is a bad practice and must be flagged regardless of whether the connection would succeed.