Android Settings hardening automation

Tool for Hardening Android settings, check/dump Apps Installed on it and list dangerous permissions used by each App

Android Mobile device Hardening (AMDH) is a tool written with python3 that automate the permissions checks for applications installed on Android and can dump the APKs for the first part. The second part of the tool check and harden the settings (global and secure).

The settings hardening follow some CIS (Center of Internet Security) benchmark checks recommendations and Android documentation.

Usage

$ python amdh.py -h
usage: amdh.py [-h] [-H] [-a ADB_PATH] [-t {e,d,3,s}] [-D APKS_DUMP_FOLDER] [-rar] [-R]

Android Mobile Device Hardening
By default the script will scan the Android system and Apps without any modification

optional arguments:
  -h, --help            show this help message and exit
  -H                    Harden system settings /!\ Developer Options and ADB will be disabled /!\ 
  -a ADB_PATH, --adb-path ADB_PATH
                        Path to ADB binary
  -t {e,d,3,s}          Type of applications:
                                e : enabled Apps
                                d : disabled Apps
                                3 : Third party Apps
                                s : System Apps
  -D APKS_DUMP_FOLDER, --dump-apks APKS_DUMP_FOLDER
                        Dump APKs from device to APKS_DUMP_FOLDER directory
  -rar                  Remove admin receivers: Remove all admin receivers if the app is not a system App
  -R                    For each app revoke all dangerous permissions

The next part
The next part is to detect malwares based on permissions analysis and add a nice GUI.

Screenshots:

Hope it will help. Ideas and feedback are very welcome.

4 Likes

I’d say the only thing missing would be a little more in-depth look into how it works, like a before and after. I think it’s really cool. Kind of reminds me of Linenum for Android. I haven’t done any google dorking to see if there was already something like this, I think there might of been years ago from my fragmented memory but it, whatever it was (if it was even real), it’s probably not being developed anymore.

Anyway good shit man. I do recommend though you change the last part of the readme to add in that anyone can help with the codebase or just donate. Sounds more inviting lol

Testing
I do recommend that when you python3 amdh.py with no arguments that if the ADB path is not in the environment settings or cannot be found that you just throw them the help menu. When selecting a choice from the device list if the user doesn’t input a number the number should be a default value like the first choice, if there is no device it should show the help menu. I’m assuming the color-codes are for linux only, and that’s fine, but maybe adding some detection for the operating system would help with the output that I’m getting.

Would also be nice to have a logging option since redirecting output doesn’t work since adb will prompt you for which device you want to connect to. Also when you choose to dump your APK’s to a folder I shouldn’t be getting any output about permissions, since the command I issued was just to dump APKs.

Other than that cool script!

1 Like

Many thanks for the feedback. I update the readme. I thought that it goes without saying and sure any participating are welcome.

I updated my post. No problem man this community is for the bettering of everyone involved!

I update the tool by adding support for windows, screenshots to the readme and solved the issue if you have only one device connected.
Thanks again.

1 Like

Here is the project that I was talking about before twiga, and here’s the blog post describing it.

1 Like

Is it yours project??

1 Like

Yes.
I created also an UI version: https://github.com/SecTheTech/AMDH-UI

1 Like