Decrypt HTTPS connections Android Mobile App - android

We have an important research project regarding mobile dating apps. One of the research points is also data being transferred to 3rd parties.
So, we had to decrypt HTTPS connections by doing a man-in-the-middle approach.
We used Fiddler as well as Mitmproxy. We also used Android emulator Bluestacks (rooted) as well as regular cell phones (Android < 6 (5.1) and Android v8 and v9). Installing root certificates worked fine.
However, we encountered a problem with one app "Grindr" (the world’s leading gay dating app).
We received "Grindr insecure connection" when starting the app. Deactivating the proxy, starting/using the app and then re-activated the proxy again,
we could capture HTTPS for just a short amount of time until this message has been displayed again. We assume that's an inner app code issue?
We downloaded different versions of app via apkmirror.com and used APK Tool to decompile the re-build the app and signed the app afterwards (e.g. APK signer, play store) and included some changes due to:
*Four Ways to Bypass Android SSL Verification and Certificate Pinning
https://blog.netspi.com/four-ways-bypass-android-ssl-verification-certificate-pinning/*
A wired thing: The original downloaded/mirrored APK could not be installed most of the time and if, after Grindr restarts, the app stopped. We tried different versions. (the lower versions worked better)
When there is no internet connection, the app opens properly and points to the login screen. I guess there must be a background check or URL callback (config.safedk.com?). However bypassing specific IP addresses didn't help.
Does anybody have experiences with this issue or any solution to overcome the "Grindr insecure connection" pop up?

Related

How to add self-signed certificate on Android 10 (MIUI 12) for local development and debugging

Could you suggest how to add a self-signed certificate on Android (MIUI 12, Android 10).
There is a mobile app for Android, and a backend written in symfony. We have a bug that is very difficult to catch, and it is not clear whether it is a bug in the app or a problem in the backend. Currently, it is not known which endpoints in which order the mobile app calls. When I test my local backend through postman, everything works as expected (there is no bug). When I test on Android (which is directed to the stage), I can see a bug. Hence, it was decided to build the application directed to local backend by replacing the api-url with the hostname of my laptop. Then the requests would go over the local network to the local backend, where it would be possible to debug what exactly is happening. But once we've built the app, it turned out that it's not that simple to send requests to the local backend since a self-signed certificate is used. I tried to add this certificate to the android config, but nothing changed. Though, certificate shows up in the list. Maybe I made some mistakes when converting that certificate (because xiaomi doesn't allow to import a .crt file), or maybe it's backend that is configured incorrectly.
Can anyone who has encountered such a problem tell me how to set the environment up correctly. Maybe there is some guide on this topic.
PS. It is not an option to use Ngrok, because it will be necessary to distract the mobile team every time in order to build the application with the new url.

Charles Proxy certificate is installed on device but calls are blocked Android

So I am trying to use Charles to test the analytics on this app. I've followed many tutorials but I can't seem to get it to work.
I've set up Charles properly, connected my Android phone (Google Pixel, Android 8) through the proxy, downloaded and installed the certificate. When I run the app I can see the tracking server, Charles filters the rest of them away, but the calls are blocked and instead I see a red "x" and this message:
"SS Handshake Received fatal alert:certificate_unknown"
The certificate is installed to the device and trusted I don't know what I'm doing wrong.
It's also important to note that the security config file has been added to the app, but I am still getting this result.
Error example:
It's also important to note that the security config file has been added to the app, but I am still getting this result.
Can you share your security config file? If that's configured to trust user-installed certificates then you shouldn't have this problem, so there may be something wrong there. Compare it with this example.
Alternatively, this might be traffic from a different app on the device. Changing the proxy settings will redirect all traffic from the device, and other unmodified apps won't trust your certificate, so will cause these exact errors.

Load a PWA on a local network as a homescreen app on Android

I am making a simple progressive web app that lets me make requests to a server on my local network. I have a webserver on a domain server-main.lan and it uses a self signed certificate.
Everything works, but when I install it on my Android phone as an app (Add to Home screen), the address bar and the error message about the untrusted cert is always visible at the top. If I use http only, then whenever I have any input field (even one used for JS filtering only), a warning appears stating that the site is not secured and blah blah.
This "app" will never be distributed anywhere, its only usable on my local network. Is there a way to get rid of all the warnings and have it load nicely?
You have two options:
Figure out how to install the certificate on your phone.
Install a valid certificate on your web server; https://letsencrypt.org is free.
The advantage of the second option is it’ll work on every device.

Android: Connecting to Squid proxy with SSL bumping not working

I have a Squid proxy installed with HTTPS/SSL. When I install the generated certificate in Firefox and set the proxy, everything looks good -- that is, I can see all the HTTPS requests the Squid log files.
However, when I install the same certificate in my Android phone (and change the proxy setting), it seems to work only in the browser. I first change the proxy setting and pages didn't load, then I installed the certificate and all was good.
All other app I've tried yield in errors due to connection problems. I can see the CONNECT request in the Squid logs but no other requests (e.g., GET, POST). I know that some app completely ignore the system proxy settings, but many use them.
The odd thing is that everything was working on an old Android 6.0 phone. Here the same apps where working perfectly fine using the proxy and relying on HTTPS requests. Now I have a newer Android 9.0 phone and all apps so far fail. The apps obviously use the proxy (seeing the CONNECT entries in the logs) but do not use/acknowledge the installed certificate.
I currently see the new phone or the new Android version as cause for the problem since it worked before with an older phone and Android version. How can I best track this issue down?
"Since Android 7, apps ignore user provided certificates, unless they are configured to use them. As most applications do not explicitly opt in to use user certificates [...] we need to place our CA certificate in the system certificate store"
https://docs.mitmproxy.org/stable/howto-install-system-trusted-ca-android/
However, this seems not to be easily done...
Android connects to specific domains to verify the connection.
Add this bit to the the squid.conf:
# Mobile
acl google-servers dstdom_regex "/etc/squid/google.txt"
always_direct allow google-servers
next, create this file /etc/squid/google.txt with the following content:
(^|\.)android\.clients\.google\.com$
(^|\.)ggpht\.com$
(^|\.)google\.com$
(^|\.)www\.googleapis\.com$
(^|\.)gstatic\.com$
(^|\.)gvt1\.com$
(^|\.)1e100\.net$
(^|\.)google\.co\.uk$
to activate, run:
./squid -k reconfigure

Install Trust Bundle Certificate on Android without Root or Warnings

I am having the most difficult time figuring out how to get a cell phone that will trust my local domain certificates without being very difficult or expensive.
Android devices tested up to 8.0 give a warning like: "Certificate authority installed by an unknown third party" or "Network May Be Monitored" on boot.
Is it possible to remove this message without rooting the phone? I need to set up always on VPN and SIP calling for the local pbx along with internal web sites. Android is the only offering with a native SIP client. But the warning causes too much trouble =/
The following worked for me in Android 8.
First transfer copy of the cert file to phone.
If using mkcert, the file location is found via CLI: mkcert -CAROOT
Then install the cert file in Android settings, the location of which varies per device and Android version.
In my phone it was in: Android Settings / General / Lock screen & security / Encryption & credentials / Install from storage
You might have to restart the phone. Also might have to click TRUST on the cert in Android settings.
Then enable Firefox secret settings by tapping multiple times on the Firefox logo in the About page, then in secret settings enable "Use third party CA certificates".
Voila!

Categories

Resources