Skip to content

Commit ac03f3f

Browse files
author
HackTricks News Bot
committed
Add content from: Research Update Enhanced src/mobile-pentesting/android-app-p...
1 parent 053ff61 commit ac03f3f

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

src/mobile-pentesting/android-app-pentesting/install-burp-certificate.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ adb reboot #Now, reboot the machine
4545

4646
Once the **machine finish rebooting** the burp certificate will be in use by it!
4747

48-
## Using Magisc
48+
## Using Magisk
4949

50-
If you **rooted your device with Magisc** (maybe an emulator), and you **can't follow** the previous **steps** to install the Burp cert because the **filesystem is read-only** and you cannot remount it writable, there is another way.
50+
If you **rooted your device with Magisk** (maybe an emulator), and you **can't follow** the previous **steps** to install the Burp cert because the **filesystem is read-only** and you cannot remount it writable, there is another way.
5151

5252
Explained in [**this video**](https://www.youtube.com/watch?v=qQicUW0svB8) you need to:
5353

@@ -59,21 +59,33 @@ Explained in [**this video**](https://www.youtube.com/watch?v=qQicUW0svB8) you n
5959

6060
<figure><img src="../../images/image (54).png" alt="" width="334"><figcaption></figcaption></figure>
6161

62-
2. **Make it System trusted**: Download the Magisc module [MagiskTrustUserCerts](https://github.com/NVISOsecurity/MagiskTrustUserCerts) (a .zip file), **drag&drop it** in the phone, go to the **Magics app** in the phone to the **`Modules`** section, click on **`Install from storage`**, select the `.zip` module and once installed **reboot** the phone:
62+
2. **Make it System trusted**: Download the Magisk module [MagiskTrustUserCerts](https://github.com/NVISOsecurity/MagiskTrustUserCerts) (a .zip file), **drag&drop it** in the phone, go to the **Magisk app** in the phone to the **`Modules`** section, click on **`Install from storage`**, select the `.zip` module and once installed **reboot** the phone:
6363

6464
<figure><img src="../../images/image (55).png" alt="" width="345"><figcaption></figcaption></figure>
6565

6666
- After rebooting, go to `Trusted credentials` -> `SYSTEM` and check the Postswigger cert is there
6767

6868
<figure><img src="../../images/image (56).png" alt="" width="314"><figcaption></figcaption></figure>
6969

70-
### Learn how to create a Magisc module
70+
### Alternative: AlwaysTrustUserCerts (Android 7-16 Beta)
71+
72+
If you're on Android 14+ (or on older devices that received Conscrypt Mainline updates and now use `/apex/com.android.conscrypt/cacerts`), the Magisk module **AlwaysTrustUserCerts** automates the bind-mounting required for system trust. It mirrors user CAs into system trust and injects mounts into Zygote/app namespaces so apps see the certs without manual `nsenter` work.
73+
74+
1. Install the Burp CA as a **user** cert first.
75+
2. Install the module and reboot.
76+
3. If the module offers a choice, prefer `--rbind` when mounting `/system/etc/security/cacerts` into `/apex/com.android.conscrypt/cacerts` to ensure nested mounts (from other modules) are visible.
77+
78+
### Learn how to create a Magisk module
7179

7280
Check [https://medium.com/@justmobilesec/magisk-for-mobile-pentesting-rooting-android-devices-and-building-custom-modules-part-ii-22badc498437](https://medium.com/@justmobilesec/magisk-for-mobile-pentesting-rooting-android-devices-and-building-custom-modules-part-ii-22badc498437)
7381

7482
## Post Android 14
7583

76-
In the latest Android 14 release, a significant shift has been observed in the handling of system-trusted Certificate Authority (CA) certificates. Previously, these certificates were housed in **`/system/etc/security/cacerts/`**, accessible and modifiable by users with root privileges, which allowed immediate application across the system. However, with Android 14, the storage location has been moved to **`/apex/com.android.conscrypt/cacerts`**, a directory within the **`/apex`** path, which is immutable by nature.
84+
In the latest Android 14 release, a significant shift has been observed in the handling of system-trusted Certificate Authority (CA) certificates.
85+
86+
Note: Some Android 12/13 devices that received **Conscrypt Mainline** updates already use `/apex/com.android.conscrypt/cacerts`. If that directory exists on your device, you must use the same APEX injection technique described below.
87+
88+
Previously, these certificates were housed in **`/system/etc/security/cacerts/`**, accessible and modifiable by users with root privileges, which allowed immediate application across the system. However, with Android 14, the storage location has been moved to **`/apex/com.android.conscrypt/cacerts`**, a directory within the **`/apex`** path, which is immutable by nature.
7789

7890
Attempts to remount the **APEX cacerts path** as writable are met with failure, as the system does not allow such operations. Even attempts to unmount or overlay the directory with a temporary file system (tmpfs) do not circumvent the immutability; applications continue to access the original certificate data regardless of changes at the file system level. This resilience is due to the **`/apex`** mount being configured with PRIVATE propagation, ensuring that any modifications within the **`/apex`** directory do not affect other processes.
7991

@@ -150,8 +162,12 @@ echo "System certificate injected"
150162
2. **Preparing CA Certificates**: Following the setup of the writable directory, the CA certificates that one intends to use should be copied into this directory. This might involve copying the default certificates from `/apex/com.android.conscrypt/cacerts/`. It's essential to adjust the permissions and SELinux labels of these certificates accordingly.
151163
3. **Bind Mounting for Zygote**: Utilizing `nsenter`, one enters the Zygote's mount namespace. Zygote, being the process responsible for launching Android applications, requires this step to ensure that all applications initiated henceforth utilize the newly configured CA certificates. The command used is:
152164

165+
Tip: If `/system/etc/security/cacerts` contains nested mounts (common with Magisk modules), use `--rbind` instead of `--bind` so those mounts propagate into app namespaces.
166+
153167
```bash
154168
nsenter --mount=/proc/$ZYGOTE_PID/ns/mnt -- /bin/mount --bind /system/etc/security/cacerts /apex/com.android.conscrypt/cacerts
169+
# If /system/etc/security/cacerts includes nested mounts, prefer --rbind
170+
nsenter --mount=/proc/$ZYGOTE_PID/ns/mnt -- /bin/mount --rbind /system/etc/security/cacerts /apex/com.android.conscrypt/cacerts
155171
```
156172

157173
This ensures that every new app started will adhere to the updated CA certificates setup.
@@ -167,6 +183,8 @@ nsenter --mount=/proc/$APP_PID/ns/mnt -- /bin/mount --bind /system/etc/security/
167183
## References
168184

169185
- [Android 14: Install a system CA certificate on a rooted device](https://httptoolkit.com/blog/android-14-install-system-ca-certificate/)
186+
- [Intercepting traffic on Android with Mainline and Conscrypt](https://blog.nviso.eu/2025/06/05/intercepting-traffic-on-android-with-mainline-and-conscrypt/)
187+
- [AlwaysTrustUserCerts Magisk module](https://github.com/NVISOsecurity/AlwaysTrustUserCerts)
170188
- [Build a Repeatable Android Bug Bounty Lab: Emulator vs Magisk, Burp, Frida, and Medusa](https://www.yeswehack.com/learn-bug-bounty/android-lab-mobile-hacking-tools)
171189

172190
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)