Skip to content

Built-in TLS Decryption #57

Description

@emanuele-f

At the current status, PCAPdroid requires an external proxy in order to decrypt TLS packets. On the other hand, a built-in solution would provide the following advantages:

  • No need to have a PC to decrypt TLS
  • PCAPdroid could show the decrypted payload directly into the app. This is related to Add basic payload information #38.
  • PCAPdroid could produce a decrypted decryptable PCAP

Requirements

  • Should support TLS 1.3
  • Should not impact the main PCAPdroid development. TLS decryption is a secondary topic in PCAPdroid, so this feature should be supported by an active third party
  • Should comply to the F-Droid policy (e.g. do not bundle any binary)
  • The solution should be light, primary in terms of device resources (cpu, memory) and possibly in terms of dependencies and APK size

Candidates

  • LittleProxy-mitm/LittleProxy is an HTTP proxy. It fits the purpose of a ready-to-use library, however depends on netty, which is big dependency.
  • nitmproxy is a self contained SOCKS/HTTP proxy also using netty. SOCKS offers the possibility to decrypt non-HTTPS traffic.

Other approaches:

  • NetBare: unmaintained, requires heavy modifications to only extract the proxy code, does not support TLS 1.3, it has the advantage of using java.nio for networking, which fits the minimal dependencies requirement
  • any native C/C++ library could be integrated

User Experience

Users will have an option to enable the built-in TLS decryption by a toggle. The old mitmproxy option will be replaced with a more generic ability to use socks5 proxy, which is independent from the TLS decryption. Once enabled, the TLS decryption will happen under the hoods; android proxy settings will be untouched. It will have the following effects:

  • In the connections view, the TLS connections data will be replaced by decrypted protocol data, e.g. HTTPS will be decrypted and the HTTP request/reply will be shown
  • The PCAP will also contain the decrypted payload data in place of the original TLS data The traffic could be dumped in the PCAPNG file format, which contains a "Decryption Secrets Block" to store the decryption keys.

In essence TLS will be decapsulated and its inner data shown.

Roadmap

The built-in decryption is now implemented via the PCAPdroid-mitm addon.

  • Implement socks5 client in PCAPdroid (Can you add a function to transfer all TCP data to the remote mitmproxy (or other proxy)? #44)
  • Build the mitm proxy addon
  • Verify that embedded mitm proxy properly proxies the packets received by the socks5 interface
  • Show the decrypted connection in PCAPdroid
  • Report rejected certificates warnings from mitmproxy in the app
  • There are some TLS connections which are not decrypted, possibly fix/report to the user why this happens
  • Provide certificate installation via Intent on Android < 11
  • Harden the proxy via the SOCKS5 authentication
  • Fix export of SSLKEYLOG
  • Improve matching of HTTP request/replies in the UI (e.g. highlight row when clicking "jump" icon, or sort connections)
  • Documentation, updates docs on methods to bypass untrusted user certs (on Android 7, e.g. magisk trust user certs, bromite chrome://flags), pinning (LSposed module sslunpinning) and Certificate transparency (avoid using a system cert or use magisk hide) - see the docs
  • Suggest users to disable Autostart or similar software which can prevent the mitm addon execution

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions