> For the complete documentation index, see [llms.txt](https://riteshs4hu.gitbook.io/infosec-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://riteshs4hu.gitbook.io/infosec-notes/android-appsec/magisk/module/customcacert.md).

# CustomCACert

**Reference:** <https://redfoxsec.com/blog/installing-burp-suites-ca-as-a-system-certificate-on-android/>

### 1. Export Burp Suite CA Certificate (DER Format)

1. In **Burp Suite**, go to **Proxy → Proxy Settings**.
2. Click **Import/export CA certificate**.
3. Select **Certificate in DER format**, then click **Next**.
4. Click **Select file**, choose a save location, and name the file **Burp.der**.

***

### 2. Convert DER Certificate to PEM Format (Kali Linux)

1. Copy the `Burp.der` file to your Kali Linux machine.
2. Open a terminal, navigate to the folder containing `Burp.der`, and run the following commands:

```bash
openssl x509 -inform DER -in Burp.der -out Burp.pem
openssl x509 -inform PEM -subject_hash_old -in Burp.pem | head -1
cp Burp.pem 9a5ba575.0
```

> **Note:** The output of the second command gives the hash (example: `9a5ba575`), and the file must be renamed as `<hash>.0`.

***

### 3. Push the Certificate to Android Using a Magisk Module

#### Step 1 — Clone the Magisk Module Template

```bash
git clone https://github.com/WindSpiritSR/CustomCACert.git
```

#### Step 2 — Add Your Certificate

Place the generated file **9a5ba575.0** inside:

```
CustomCACert/system/etc/security/cacerts/
```

#### Step 3 — Build the Module

From inside the `CustomCACert` directory, run:

```bash
zip -r CustomCACert.zip ./*
```

#### Step 4 — Transfer the Module to the Device

Example using ADB:

```bash
adb push CustomCACert.zip /sdcard/Download/
```

#### Step 5 — Install via Magisk

1. Open **Magisk**
2. Go to **Modules → Install from storage**
3. Select **CustomCACert.zip**

***

### 4. Enable Proxy on Android (ADB)

To route Android traffic through your Burp proxy:

```bash
adb shell
```

```
su
```

```
settings put global http_proxy <burp-ip>:<port>
```

***

### 5. Disable Proxy on Android (ADB)

To disable routing Android traffic through your Burp proxy:

```bash
adb shell
```

```
su
```

```
settings put global http_proxy :0
```
