I am trying to simulate MITM attack over signal's android messaging application. It's open source, so I put the mitmproxy-ca-cert.pem
in android application for pinning and in the mobile trusted certificates too. I am still not getting any query to the server.
Error at the client end is
NonSuccessfulResponseCodeException: Bad response: 502 Bad Gateway
If i understood well you are trying to attack a mobile that uses certificate pinning to connect with the API server.
If so then adding the
mitmproxy-ca-cert.pem
to the mobile trusted store is not enough, you need to configure the network security fileres/xml/network_security_config.xml
as per google docs.If you still fill lost try to follow the article Hands on Mobile Api Security Pinning to see if it helps you to get back on track.
EDIT
The following instructions are valid for the Android API level 24 and above.
Bash script to generate the hash from the certificate public key:
Save the above bash script somewhere in your bin path and then use it like:
Now copy paste the hash and add it into this file src/main/res/xml/network_security_config.xml:
And now include it in the AndroidManifest.xml:
If not done already add the mitmproxy certificate to the user trusted store in your Android device, then recompile the app, and now you should be able to intercept the requests.