PCAPdroid icon indicating copy to clipboard operation
PCAPdroid copied to clipboard

TLS decryption exits with error

Open emanuele-f opened this issue 2 years ago • 4 comments

A user reported that sometimes the TLS decryption stops immediately after starts. When this happens, it will keep stopping on subsequent runs, only a reboot solves it. Android 10.

logcat_07-04-2022_02-37-18.txt

emanuele-f avatar Jul 04 '22 20:07 emanuele-f

I will post logs, if I know what is needed.

kaylar19 avatar Jul 24 '22 19:07 kaylar19

You can install the Logcat Reader app, you need to give it a permission via adb to read the logs. Then search for "mitm" to find relevant logs

emanuele-f avatar Jul 24 '22 20:07 emanuele-f

I cant seem to grant the permissions I getNeither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.

Claude Garlick 180 Loret Ln Christiansburg, Va 24073 (540)808-8331 @.***

On Sunday, July 24, 2022 at 04:55:05 PM EDT, Emanuele Faranda ***@***.***> wrote:  

You can install the Logcat Reader app, you need to give it a permission via adb to read the logs. Then search for "mitm" to find relevant logs

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

kaylar19 avatar Jul 24 '22 22:07 kaylar19

I cant seem to grant the permissions I get Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.

Check out the answers to this: https://stackoverflow.com/questions/52079343/how-can-i-use-adb-to-grant-permission-without-root

In my case I would need to be on a network(WiFi) and logged in to Xiaomi account(which I don't yet have and which I think requires a SIM card) in order to be able to enable USB debugging (Security settings) in Developer Options. Needless to say I cannot do so.

correabuscar avatar Jul 30 '22 11:07 correabuscar

I do face the same issue with our app. Here is the logcat log filtered with mitmproxy Device info: Android 13, Pixel 6A Let me know If you need other information that I can provide.

13:58:59.925  I  mitmdump -q --set onboarding=false --listen-host 127.0.0.1 -p 7780 --mode socks5 --proxyauth cFjHOi5V:vhaOTzeR --ssl-insecure
13:58:59.930  I  Running mitmdump...
13:58:59.940  D  Proxy server listening at http://127.0.0.1:7780
13:59:00.581  D  127.0.0.1:53988: client connect
13:59:00.651  D  127.0.0.1:53988: server connect 34.248.116.97:5222
13:59:00.932  D  127.0.0.1:53992: client connect
13:59:02.124  D  127.0.0.1:53998: client connect
13:59:02.202  D  127.0.0.1:53998: server connect 54.154.215.43:443
13:59:02.382  I  [Errno 9] Bad file descriptor
13:59:02.383  E    File "/data/data/com.pcapdroid.mitm/files/chaquopy/AssetFinder/app/mitm.py", line 119, in run
13:59:02.384  E    File "stdlib/asyncio/runners.py", line 44, in run
13:59:02.384  E    File "stdlib/asyncio/base_events.py", line 603, in run_until_complete
13:59:02.384  E    File "stdlib/asyncio/base_events.py", line 570, in run_forever
13:59:02.384  E    File "stdlib/asyncio/base_events.py", line 1859, in _run_once
13:59:02.385  E    File "stdlib/asyncio/events.py", line 81, in _run
13:59:02.385  E    File "/data/data/com.pcapdroid.mitm/files/chaquopy/AssetFinder/requirements/mitmproxy/addonmanager.py", line 302, in trigger
13:59:02.385  E    File "/data/data/com.pcapdroid.mitm/files/chaquopy/AssetFinder/requirements/mitmproxy/addonmanager.py", line 279, in invoke_addon_sync
13:59:02.385  E    File "/data/data/com.pcapdroid.mitm/files/chaquopy/AssetFinder/app/pcapdroid.py", line 235, in add_log
13:59:02.385  E  [Errno 9] Bad file descriptor
13:59:02.387  I  Stopping proxyserver...
13:59:02.388  D  Stopping server...
13:59:02.396  D  127.0.0.1:53992: error establishing server connection: connection cancelled
13:59:02.396  D  127.0.0.1:53988: half-closing Client(127.0.0.1:53988, state=open)
13:59:02.397  W  127.0.0.1:53998: Server TLS handshake failed. connection closed
13:59:02.399  D  127.0.0.1:53998: Unable to establish TLS connection with server (connection closed). Trying to establish TLS with client anyway.
13:59:02.407  I  mitmdump stopped
13:59:02.408  D  Done

mehmetaltiparmak avatar Jan 17 '23 11:01 mehmetaltiparmak

@mehmetaltiparmak thanks for providing this information. This error happens inside mitmproxy, so it may be fixed once mitmproxy is updated (#280). As a temporary workaround, you can use an external mitmproxy running on a pc

emanuele-f avatar Jan 23 '23 08:01 emanuele-f

Same issue here

TxMat avatar Feb 08 '23 16:02 TxMat

@mehmetaltiparmak @kaylar19 @correabuscar I've upgraded the mitm addon to use mitmproxy 9.0.1. You can use this apk https://pcapdroid.org/fdroid/repo/PCAPdroid_1.6.1-951234f.apk to test it. Can you check if this issue is now solved with this new version?

emanuele-f avatar Mar 26 '23 13:03 emanuele-f

Did not experience this anymore with the new version. Closing

emanuele-f avatar Jan 01 '24 16:01 emanuele-f