Adding a security exception to an app

מתוך ויקי נטפרי
גרסה מ־21:45, 24 בנובמבר 2026 מאת DovidStroh (שיחה | תרומות)
(הבדל) → הגרסה הקודמת | הגרסה האחרונה (הבדל) | הגרסה הבאה ← (הבדל)
קפיצה לניווט קפיצה לחיפוש

לעברית לחצו כאן

To switch from edit view to read view

To search in the Wiki

Home page > Security certificate > Installation of certificate in Android > Adding a security exception to an app ‎‎


From Android 7 onwards, by default apps do not trust security certificates added by the user, only the system certificates. Therefore some apps will not work even after installing the certificate according to the instructions here.

However, there are several ways to edit the app file and set in its configuration files that it should trust the security certificate the user installed. Note that for many apps, adding the exception according to the instructions below will not help or will not be possible, so several options are given, so that if one option does not help, another one might. Note that there are apps that cannot be edited with any of the options below (such as Google apps).


Adding a security exception with the 'apk-mitm' script (recommended)

Can be run on Linux/Windows/MacOS.

First install Node.js from here: https://nodejs.org/en/download (direct download of the Windows installer)

And Java from here: https://www.oracle.com/technetwork/java/javase/downloads/index.html (direct download of the Windows installer)

Then run in CMD or PowerShell on Windows, or in the terminal on Mac (replace with the full path to the apk file):

npx apk-mitm /path/to/yourapp.apk

You can easily add the file path by dragging the file into the CMD window, that is: type npx apk-mitm, a space, drag the apk file into the window, and press Enter.

The script decompiles, edits, and signs the app again.

Embedding the certificate in the app file

The script can also embed the NetFree certificate inside the app file itself, so the app can be used even on Android systems where a security certificate cannot be installed even at the user level (for example some car multimedia systems): https://github.com/shroudedcode/apk-mitm#allowing-specific-certificates

Adding a security exception with the 'AddSecurityExceptionAndroid' script

Can be run on Linux (or on Windows by installing the WSL environment, which emulates Linux).

In this guide we will learn how to do it. The guide consists of two main steps. The first step is adding a Linux system to Windows, and it is relevant only to those who do not have access to a Linux system. Those who have access to a Linux system can go directly to the second part (running the script):

The guide is based on screenshots; the numbers in parentheses mark the step shown in the screenshots in the 'Guide with pictures'.

Installing the Windows Subsystem for Linux on Windows 10

This step will let us run bash commands on Windows (the Windows Subsystem for Linux is only available on 64-bit versions of Windows 10, version 1607 and above).

First we need to enable the feature. Open PowerShell as administrator (2) (3), and run the following command there (4):

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

When the operation (5) finishes, a message will ask us to confirm restarting the computer by typing Y and Enter (6). Confirm.

Now download this file and install it (7) (8). Run the app, wait until the installation completes (9), first set a username (10) and password (11), and enter the password once more to confirm (11).

(12) Run the command sudo apt-get update,

Wait until the operation finishes (13) and then run the command (14)

sudo apt install default-jdk

(15) Confirm by typing Y,

Wait until the operation finishes (16),

That's it, we have now installed the Linux runtime environment on the computer. You can close the terminal.

Running the script

Now download this file (zip file), extract it to a folder, and put the apk file you want to handle in that same folder.

In the folder's address bar (where the path is written) type wsl and press Enter (17). A Linux terminal will open at the folder's location (18),

(18) There, run the command:

‎./addSecurityExceptions.sh app-name.apk

Instead of app-name.apk, write the name of the app.

(19) On the first run we will need to fill in details. We can write our name or any other word, and finally type yes.

That's it. (20)

Now you will see that a file was added in the script folder (21).

Good luck!


Sources:

https://docs.microsoft.com/en-us/windows/wsl/install-win10

https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04

https://github.com/levyitay/AddSecurityExceptionAndroid


Guide with pictures:

Adding a security exception manually

Instructions can be found at the following link:

https://mitmachim.top/post/849673

Lowering the SDK version with the APKTool app


Download the APKTool app, open the option to edit an apk file, and in the target sdk line change it so that Android 6 or lower appears. Then sign the app (a "sign" option appears), and the new apk is created. Tap the file and choose install. If the app is already installed, uninstall the installed app first, and only then install the new app (the words mod-sign should be added to the original file name). For more details see here.