Using Charles Proxy To Debug Android SSL Tra C: Hack Upstate
Using Charles Proxy To Debug Android SSL Tra C: Hack Upstate
I’ve been a longtime user of Charles for checking requests and responses
from the web applications I write.
First o , this setup will not work on an emulator without an additional step
(see below). I admittedly haven’t needed to do any proxy debugging
without a test device, though.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Setting Up Your Project
If your test device is running Android 7.0 or newer, there are a few extra
steps to ensure that you are able to trust the Charles CA Certi cate. To
ensure Android trusts the certi cate, you’ll need to specify a Network
Security Con guration for your application. There are a few di erent ways
of adding your certi cate to the application’s trusted con guration, but I
found that the easiest was not to include Charles’ certi cate within my
application code, but to simply trust the user-installed CA certi cates (like
previous versions of Android used to do).
<application android:allowBackup=”true”
android:icon=”@mipmap/ic_launcher”
android:label=”@string/app_name”
android:roundIcon=”@mipmap/ic_launcher_round”
android:supportsRtl=”true” android:theme=”@style/AppTheme”
android:networkSecurityCon g=”@xml/network_security_con g”>
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
view rawAndroidManifest.xml hosted with ❤ by GitHub
Setting Up Charles
Open up Charles on your Mac and then open Proxy > Proxy Settings from
the toolbar. You’ll need to make note of the HTTP Proxy Port that is
speci ed.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Then open up Proxy > SSL Proxying Settings from the toolbar and add the
appropriate Locations (host/port) for the requests you wish to debug. I
usually just add a wildcard route like *.myapidomain.com but speci c
domains like whatever-app.herokuapp.com work ne as well.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Setting Up Your Android device
First, make note of your Mac’s IP address within your local network. You’ll
need it in the next step.
Also make sure Charles is open and that the Mac is on the same wi
network as the Android device you’ll be setting up.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Go to your device’s settings and wi con guration.
Press and hold on the network you’re going to use and select Modify
Then check Advanced Options and scroll until you see Proxy .
For the Proxy hostname input your Mac’s IP address that you noted above.
Then for the Proxy port use the HTTP Proxy Port that you noted from
Charles’ Proxy Settings from above.
Tap Save .
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
After saving, you may notice a pop-up on your mac like this:
You should now click Allow to let your Android device connect to Charles
via the proxy it has set up.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
If you don’t see this prompt, you can ensure that your device can use the
proxy from within Charles by going to Proxy > Access Control Settings
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Now on your Android device, open up the browser and go to the following
URL chls.pro/ssl . You can also see these instructions from within the
Charles app - go to Help > SSL Proxying > Install Charles Root
The browser should download the cert and once nished, tap to open the
le. Then Android should prompt you to install the le.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
After you’ve named the certi cate and tapped “OK”, you will either be
prompted to input your device’s pin/password or prompted to set up your
device’s pin/password. Once that process is complete, you should be ready
to debug some requests.
Note Until you remove the manual proxy from this device’s wi
con guration, whenever you use this network again you will need to have
Charles open and running on the same IP address. You can always set the
network con guration back to “Proxy: None” once you’re done debugging.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Using An Emulator
According to Charles’ site you can start the emulator with a ag in order to
use the proxy.
EDIT: Thanks to Brandon Davis for pointing out that the full command would
be
In addition, Android Studio 3.0 will now allow managing proxy settings for
your emulator images. Read all about the new features here and if you can’t
wait for a stable release, 3.0 is currently available in the dev channel.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Debugging requests
Now that you’re set up, you should see Charles recording tra c from your
device. As long as you’re con gured properly, you should see those SSL
request details from the domains you speci ed in Charles’ SSL Proxying
Settings.
Feel free to discuss your results and let me know if I missed anything
obvious.
1.2K 13
WRITTEN BY
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
More From Medium
The Encyclopedia of Smart Contract Attacks and Understanding End User Security Decisions
Vulnerabilities
Jacob Davis
Kaden Zipfel in Better Programming
Facebook Meeting Audio Leaked: The Week in Data News What is SQL Injection and how to x it
BIGtoken Team in BIGtoken Bootsity
Here Are the Biggest Online Privacy Threats Facing Your Digital Privacy Matters: Here Are Some Basic Steps
Companies and Consumers (and Covering Your… You Can Take to Protect It
inc. magazine in Inc Magazine Shayan Shokrgozar in Predict
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
About Help Legal
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD