Open MHBdev2 opened 8 months ago
More precisely Even if you use your application (http toolkit), and use full monitoring mode by injecting certificates into the system, When trying to connect to the network via wifi, a crash similar to the above occurs
!@*** FATAL EXCEPTION IN SYSTEM PROCESS: Thread-48
java.lang.AssertionError
at com.android.okhttp.OkHttpClient.getDefaultSSLSocketFactory(OkHttpClient.java:649)
at com.android.okhttp.OkHttpClient.copyWithDefaults(OkHttpClient.java:605)
at com.android.okhttp.OkUrlFactory.open(OkUrlFactory.java:63)
at com.android.okhttp.OkUrlFactories.open(OkUrlFactories.java:39)
at com.android.okhttp.internalandroidapi.HttpURLConnectionFactory.internalOpenConnection(HttpURLConnectionFactory.java:154)
at com.android.okhttp.internalandroidapi.HttpURLConnectionFactory.openConnection(HttpURLConnectionFactory.java:123)
at libcore.net.http.HttpURLConnectionFactory.openConnection(HttpURLConnectionFactory.java:101)
at android.net.Network.openConnection(Network.java:372)
at android.net.Network.openConnection(Network.java:332)
at com.samsung.android.server.wifi.routerinfo.WifiRouterInfoCollector.runHttpGet(WifiRouterInfoCollector.java:143)
at com.samsung.android.server.wifi.routerinfo.WifiRouterInfoCollector.checkRouterInfoFromHttp(WifiRouterInfoCollector.java:50)
at com.samsung.android.server.wifi.routerinfo.WifiRouterInfoCollector.-$$Nest$mcheckRouterInfoFromHttp(WifiRouterInfoCollector.java:1)
at com.samsung.android.server.wifi.routerinfo.WifiRouterInfoCollector$ConnectedState.lambda$processMessage$0(WifiRouterInfoCollector.java:13)
at com.samsung.android.server.wifi.routerinfo.WifiRouterInfoCollector$ConnectedState.$r8$lambda$MVjnii19NWrcUKHWZqtUZ7NOc2o(WifiRouterInfoCollector.java:1)
The failing code is here: https://android.googlesource.com/platform/external/okhttp/+/refs/heads/main/okhttp/src/main/java/com/squareup/okhttp/OkHttpClient.java#635
It's not clear why, but it seems like on your device this results in a setup where TLS becomes completely unavailable - and so any attempt to use it fails.
That error isn't really the problem. The issue here is why TLS has become unavailable. I suspect for some reason, the changes here are effectively hiding all certificates (or the directory entirely) from the TLS loading on your device, so TLS initialization fails completely.
This definitely isn't the normal behaviour of those hooks on an Android device, so there must be something unique to your setup.
Can you reboot the device, and then run (via ADB, as root):
ls -Zl /apex/com.android.conscrypt/cacerts
ls -Zl /system/etc/security/cacerts/
then run HTTP Toolkit's ADB setup, and then run the same commands again?
You should see one new certificate appear (in both locations) but otherwise no changes - everything else should look exactly the same before & after, and the new certificate should exactly match all the other certs here.
If that doesn't come up with any clues, you're going to need to do some in-depth debugging. It would be useful to know the full details of the GeneralSecurityException
that must be being thrown in the code linked above, and which that code just ignores (rethrowing an AssertionError with no more details instead). To find that, you might be able to attach a debugger to something somehow (not sure) or build a demo app that calls the same code but exposes the actual exception directly.
It would also be useful to have a really detailed understanding of your device setup, to be able to reproduce this or match it to other issues/solutions. Can you please share:
I'm using Android 14 and want to inject a custom CA certificate The device is rooted using magisk, so for a smooth operation that will be performed every restart, I put the following code in service.sh
It really seems that the personalized certificates enter the system but after a few seconds the device crashes (restarts) This is the log at the moment of the crash