microsoftconnect / ms-intune-tunnel-sdk-ios

The Microsoft Tunnel for MAM iOS SDK is a set of libraries that can be compiled into an LOB app to enable the app to connect to VPN protected corporate resources on unenrolled devices.
8 stars 2 forks source link

Crash with EXC_BAD_ACCESS in MCPCore / curl_strnequal #34

Open hendrik-dev opened 3 weeks ago

hendrik-dev commented 3 weeks ago

We are currently in the process of adding the library to our existing iOS application. We have successfully integrated version 1.1.10 of the lib into our project and set up the tunnel configuration so that the SDK status shows "Connected" and we can reach our internal Exchange server through the tunnel.

However, the app repeatedly crashes in MCPCore when internally calling curl_strnequal, while one or multiple NSURLSession connections are running. We haven't been able to find a specific trigger for the crash, but if the app is running for several minutes and new network calls are performed, eventually at some point it will crash.

This is the information we get from Xcode: Thread 126: EXC_BAD_ACCESS (code=1, address=0xd9d58bf5bec0)

Thread 126 Queue : HTTP/Proxmetheus Internal Queue (serial)

0 0x0000000104648f64 in curl_strnequal ()

17 0x0000000204d76964 in _pthread_wqthread ()

Show Library Info: MCPCore

We are experiencing this issue on an iPhone 14 device, previously with iOS 17 and now with iOS 18.

Is there something we can do to prevent such crashes or is this a known bug that will get fixed?

lexi-msft commented 3 weeks ago

We are taking a look now. I'll update this thread with any discoveries.

lexi-msft commented 3 weeks ago

Does this reproduce with 1.1.11?

hendrik-dev commented 3 weeks ago

Yes, we can also reproduce it with 1.1.11, although [MicrosoftTunnel getVersionString] returns 1.1.9 for the 1.1.11 version.

The crash is not happening all the time however. Sometimes we can use the app for 15 or 20 minutes before a crash happens, sometimes it occurs shortly after starting and connecting the tunnel.

I am not sure if the crash only happens in this situation, but we have observed it multiple times after an authentication challenge in didReceiveChallenge of NSURLSessionTaskDelegate. We receive a challenge there from the server for an authentication certificate which we reject in order to authenticate using username/password by calling: completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil);

On multiple occasions the HTTP/Prometheus Internal Queue thread crashed right afterwards at curl_strnequal.

lexi-msft commented 3 weeks ago

We've re-released 1.1.11. Please try again with the new 1.1.11 release. Can you please gather logs from the application and submit them? You can open a support ticket and we'll be able to take a look there.

hendrik-dev commented 3 weeks ago

Thank you, the re-release now reports 1.1.11 as version string. The crash still occurs as described above.

Of course I can create a ticket for this issue. Where do I open a support ticket for the SDK? Can you provide me with a link?

hendrik-dev commented 3 weeks ago

Today we have tested our app on another device in a different scenario: with no tunnel configured.

In this scenario we never call [MicrosoftTunnelDelegate.sharedDelegate setVpnConfiguration:vpnConfig] or [MicrosoftTunnelDelegate.sharedDelegate configureSDK]. We just try to use the app with Intune, but without a tunnel.

However we get a crash at another location of our code. In didReceiveChallenge of NSURLSessionDelegate we make a call to SecTrustEvaluateWithError(trustRef, &error). Here we get another EXC_BAD_ACCESS crash, according to the trace log in MAP_SecTrustEvaluateWithError.

This doesn't happen on our main branch which just uses the MSIntuneSDK without the MSIntuneTunnelSDK.

hendrik-dev commented 2 weeks ago

Is there any update on this issue or information on where to open a support ticket/upload logs?

lexi-msft commented 1 week ago

To open a support ticket, please go to the "Troubleshooting + Support" tab in the Intune portal. Then go to "Help and Support" and select "Intune". Type your problem in the search bar and search results will pop up. Near the bottom of these results, you will see "Contact Support" From there you will be guided to fill out a support ticket.

hendrik-dev commented 1 week ago

Thank you for your help! We have just created a support ticket with a detailed description, logs and screenshots.

The ticket id is #‎2410081420003077‎. Could you please take a look at it?

hendrik-dev commented 1 week ago

A quick update. The MS Intune Support team from the Intune portal let us know about the following:

After contacting the backend team, we found the issue related to Service Hub support and you need to open a ticket with MS Devolper Support Contact Us - Developer Support (microsoft.com)

On that link the email address premdevinfo@microsoft.com is listed as the only contact option. We have now sent our detailed description, logs and screenshots there and are waiting for a response.

I hope you will be able to access the logs and screenshots one way or the other. I kindly ask to let us know if there are any updates or if there is anything else we can do to proceed with the issue.