6

I have followed the guide here: Configure Fiddler for Android / Google Nexus 7 in order to redirect outgoing traffic from my Android device to go through Fiddler acting as a proxy on my desktop machine on my local network.

While using the browser on my Android device I can see requests logged in Fiddler for the websites I am visiting, which verifies that I have set up the proxy correctly.

However, when using certain apps I can see no requests being logged, even though information in the app is being actively updated over the network.

I have ensured that mobile data is turned off.

The following question is related: Android apps not working with HTTP proxy but in their case the apps are not able to connect to the internet and are showing errors. In my case the app I am using is able to retrieve information over the network with no problems, but I cannot see the requests being made in Fiddler.

I want to be able to analyze the requests sent between an app on my phone which controls a wireless thermostat connected to my LAN via wifi.

  • Hi and welcome to Android.SE! It suggests that the configuration to make the Android device use Fiddler failed. Does it not? – 0xC0000022L Dec 12 '18 at 8:46
  • @0xC0000022L - well not entirely because some types of traffic were captured and some not. My question is why? – Karl Dec 13 '18 at 9:25
  • @Karl then you need to qualify your statement In my case the app I am using is able to retrieve information over the network with no problems, but I cannot see the requests being made in Fiddler. Because network is a superset of HTTP and the latter would typically be the only type of traffic Fiddler concerns itself with due to the way it's being configured. – 0xC0000022L Dec 13 '18 at 12:57
2
+100

I recently answered in detail to question: How to set Wi-Fi HTTPS proxy, not HTTP, via adb shell?, trying to clear some confusions many of us (including me) have regarding how proxy works.

DOES YOUR APP GENERATE HTTP TRAFFIC?

Proxy usually means http proxy, but not all traffic generated by every app is http - a Layer 7 protocol in OSI model. Email clients, for instance, use IMAP/POP3/SMTP (L6/7) protocols which won't work with http GET method, instead require http CONNECT proxies. Latter can only forward TCP traffic, for UDP at least SOCKS5 proxy is needed which operates at L5. DNS and mostly games and VoIP apps generate UDP traffic, so they won't work with http proxies at all. ping utility - for instance - uses ICMP (at L3) which can't be encapsulated in TCP or UDP, so it won't work with SOCKS too and requires VPN.

See more details in Why proxy set on Android does not work when used as hotspot?

DOES HTTP PROXY WORK WITH EVERY APP?

Proxy is not meant to be set system-wide, or in other words you cannot force all apps to use the same proxy you have configured in Settings. Instead apps are supposed to make proxied http connections if they want to. Operating systems provide proxy-aware libraries (for http connections) as part of the SDKs so the developers don't have to take care of proxy related stuff separately. Such Android apps honor proxy settings set system-wide (but may still fall back to no-proxy mode if proxy fails for some reason).

Other OSes also use similar approaches to provide system-wide proxy settings through some GUI settings menu or using environment variables on CLI. Browsers and some other apps like email clients usually have their own settings as well to set proxy. However if the app/program is not proxy-aware, it won't honor any of the proxy settings at all. That's why when setting Wi-Fi proxy it warns:

"The HTTP proxy is used by the browser but may not be used by the other apps."

Same holds true for proxy set through PAC file or in APNs (Mobile Data) or global proxy (meant for managed devices).

Coming to your questions...

While using the browser on my Android device I can see requests logged in Fiddler
...
However, when using certain apps I can see no requests being logged

The guide linked in the question suggests configuring Android WiFi settings to use proxy. As explained above, the browser would be proxy-aware, the "certain apps" aren't.

I want to be able to analyze the requests sent between an app on my phone which controls a wireless thermostat connected to my LAN via WiFi.

  • Make sure your concerned app is generating http traffic to be captured while sniffing on proxy. Otherwise use something at lower level - e.g. SOCKS proxy or VPN - for other protocols.
  • Make sure the app regards Android's global proxy settings when making http connections. In case of https the app should be using CONNECT method in place of GET.
  • If the app is not proxy-aware, you need to enforce proxy on phone and (in case of https) do forced / transparent SSL/TLS interception on proxy.

    Enforcing proxy is possible by different methods e.g. by using SOCKS tunnel instead, and/or redirecting traffic towards a proxy server using some Layer 2/3 approach like VPN (tun2socks/tun2http) app or iptables (DNAT). Xposed modules like Inspeckage can also enforce per-app proxy by hooking into APIs.

    Another approach is to use a local host (preferably Linux PC) as default gateway and set up proxy there to intercept traffic from any host on local network. In this way no proxy configuration is required on phone. It's also possible to setup packet analyzer tool like Wireshark in place of proxy on local network for traffic interception.

DOES YOUR APP USE SECURE HTTP (HTTPS)?

  • If the purpose of proxy is DPI, logging, anti-virus scanning, content blocking, filtering or adaptation, you need to do SSL bumping / MITM on proxy server.
  • MITM requires adding proxy's root SSL certificate to device's credential store (or the app should be able to ignore invalid certificate errors). But since Android 7, user-added CAs (as suggested in the linked guide) are no more trusted to establish secure connections. So you need to add the root certificate to /system/etc/security/cacerts (requires rooted phone). "But app developers can choose to let their apps work with manually added CA certificates." (1)
  • If the app is using its own trusted credential store instead of that provided by OS, you need to add proxy's root CA to the list of CAs maintained by the app (if that's possible at all).
  • If the app is using SSL pinning (as the Twitter app does), it won't trust any intermediate authority except its own self-signed root CA. You may try to disable SSL Pinning by taking control of related APIs. Xposed module SSLUnpinning can disable SSL pinning for JSSE, OkHttp and Apache http client libraries. But if the app uses some other libraries/APIs, you are again out of luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.