How to Check SSL Pinning in Android Apps?

Android applications frequently communicate with backend servers to exchange sensitive information, including authentication tokens, personal data, and transaction details. Transport Layer Security (TLS) encrypts this communication and validates server certificates to help protect data against interception. However, a device with a user-installed certificate authority or a compromised trust configuration may allow certain interception scenarios.
SSL pinning, also called as certificate pinning or public-key pinning depending on the implementation, adds another layer of validation by restricting which server certificates or public keys an application trusts. Checking SSL pinning in Android apps helps security testers determine whether the application rejects untrusted certificates and prevents unauthorised interception of network traffic.
What is SSL Pinning in Android?
SSL pinning binds an application’s server connection to an expected certificate or public key rather than relying exclusively on the device’s general certificate trust store. When the app connects to its backend, it checks whether the server’s certificate or public key matches the configured pin.
If the connection does not satisfy the pinning policy, the application should reject the connection. This can make it more difficult for an attacker to intercept traffic using a proxy certificate, even when the device has been configured to trust that certificate.
Android applications may implement pinning through libraries such as OkHttp, custom X509TrustManager implementations, or network security configurations. The exact testing approach depends on the implementation.
How to check SSL pinning in Android Apps?
To check SSL pinning in Android apps, a combination of static and dynamic testing because finding pinning-related code does not prove that the application enforces it correctly.
1. Intercept HTTPS traffic using a proxy
Tools such as Burp Suite or OWASP ZAP can help testers inspect an application’s network communication.
Steps:
- Install the Android app on a test device or emulator.
- Configure the device to route traffic through an interception proxy.
- Install the proxy’s CA certificate in the appropriate test environment.
- Open the application and perform actions that trigger requests to its backend.
- Observe whether HTTPS requests can be intercepted and read.
Expected result: If certificate pinning is correctly enforced for a relevant backed endpoint, the application should reject the proxy’s certificate and prevent the affected TLS connection from being established.
If traffic is intercepted successfully, pinning may be missing, incorrectly implemented, or not applied to that endpoint. A failed connection alone is not conclusive, as other TLS or connectivity issues can produce similar behaviour.
2. Inspect the APK for pinning configuration
Static analysis helps identify how certificate pinning may be implemented in an Android application. Tools such as JADX and APKTool can help inspect decompiled code and application resources.
Check the following areas:
- AndroidManifest.xml: Look for the android:networkSecurityConfig attribute.
- Network security configuration: Inspect XML files for domain-specific pin-set configurations and SHA-256 public-key hashes.
- Application code: Search for classes or methods related to CertificatePinner, X509TrustManager, and certificate validation.
- Third-party libraries: Identify networking libraries that may implement certificate pinning.
Android supports certificate pinning through Network Security Configuration, while applications may also use custom code, third party libraries, or native implementations. Therefore, the absence of an XML pin set does not necessarily mean pinning is missing.
3. Check pinning coverage and configuration
A pinning implementation can exist without protecting every relevant network connection. Test all important endpoints and networking paths, including API requests initiated through different libraries.
Review whether the application has configured backup pins and a suitable certificate-rotation strategy. Missing backup pins can cause legitimate connections to fail when certificates or keys change. Also check whether pin expiration settings disable pinning after a configured date.
4. Verify pinning at runtime
Static analysis identifies potential implementations, but runtime testing determines whether pinning is actually enforced during network communication.
Test the application’s primary backend endpoint using an interception proxy. Monitor application behaviour, connection failures, and relevant system logs.
Verify that:
- Connections to be legitimate servers work normally.
- Connections presenting an unauthorised certificate are rejected.
- Security-sensitive functionally does not silently fall back to insecure communication.
- Pinning is applied consistently across relevant application-controlled endpoints.
If traffic remains readable through the proxy, investigate whether the endpoint is excluded from pinning, a different networking stack is being used, or certificate validation is incorrectly configured.
How Bugsmirror Defender Strengthens SSL Pinning
Bugsmirror Defender strengthens SSL pinning by adding runtime protection against attempts to bypass certificate validation. It helps protect the application against runtime manipulation techniques that attackers may use to interfere with SSL pinning checks, making unauthorised HTTPS traffic interception more difficult. SSL pinning should still be implemented correctly as a core security control, with runtime protection providing an additional layer of defence.
Read more: Protection from app level threats like SSL pinning, rooting, Frida, and reverse engineering
Common SSL pinning testing mistakes
Several issues can lead to incorrect conclusions during Android SSL pinning testing:
- Relying only on static analysis: Code references do not prove runtime enforcement.
- Testing only one endpoint: Other backend connections may not use pinning.
- Misinterpreting connection failures: Network errors do not automatically confirm successful pinning.
- Ignoring alternate network stacks: Custom or native networking implementations may use different validation mechanisms.
- Treating pinning as complete security: Pinning raises the difficulty of traffic interception but does not eliminate all attacks, particularly when an attacker controls the device or modifies the application.
Android also warns that pinning can create availability risks if server certificates or keys change without a compatible app update. Its use should be evaluated alongside operational requirements and other security controls.
Conclusion
Checking SSL pinning in Android apps requires both static inspection and runtime validation. Proxy testing helps establish whether unauthorised certificates are rejected, while APK analysis reveals potential pinning configurations and implementation paths.
For a broader assessment, Bugsmirror MASST can help security teams evaluate mobile application security through complementary testing approaches, including static analysis, dynamic testing, API security testing, and red teaming. Combining these assessments helps identify weaknesses that a single testing method may overlook.
To see how Bugsmirror Defender strengthens up SSL pinning, book a free trial of Defender for 14 days.
Share this article
Help others discover this content
Don’t give fraud a way in. Secure every layer of your mobile app.
100M+
Users Protected
100+
Apps Secured
1000+
Apps Hardened