--- title: Missing Certificate Pinning in Network Security Configuration platform: android id: MASTG-TEST-0242 type: [static, code] weakness: MASWE-0047 profiles: [L2] knowledge: [MASTG-KNOW-0014, MASTG-KNOW-0015] --- ## Overview Apps can configure [certificate pinning using the Network Security Configuration](../../../knowledge/android/MASVS-NETWORK/MASTG-KNOW-0015.md#pinning-via-network-security-configuration-api-24). For each domain, one or multiple digests can be pinned. The goal of this test is to check if the app does not implement certificate pinning using the NSC. However, note that the app may be using other pinning methods covered in other tests. ## Steps 1. Use @MASTG-TECH-0013 to reverse engineer the app. 2. Use @MASTG-TECH-0117 to obtain the AndroidManifest.xml 3. Use @MASTG-TECH-0150 to check if a `networkSecurityConfig` is set in the `` tag. 4. Use @MASTG-TECH-0151 to extract all domains from `` that have a pin set (``) from the Network Security Configuration file. ## Observation The output should contain a list of domains which enable certificate pinning. ## Evaluation The test case fails if no `networkSecurityConfig` is set, or any relevant domain does not enable certificate pinning.