0x01
Before you start
PDFTwo places to run things: your computer, talking to the phone over USB with adb, and the Linux terminal inside the phone. They do different jobs.
- From the computer (adb) you can read what Android itself knows: installed apps, permissions, settings, system state. This is how you audit.
- The Terminal app on a SEKRTLY runs Debian in a virtual machine. It is sealed off from Android: it cannot see your apps or messages. Use it for tools: SSH, encryption, checksums.
- Nothing here needs root. If a guide asks you to root your phone to “secure” it, close it: rooting breaks the security model.
- Lines starting with $ run on your computer. Lines starting with e@sekrt:~$ run in the phone’s Terminal app. Do not type the prompt itself.
0x02
adb: look at your phone from a computer
PDFadb (Android Debug Bridge) is the official tool for talking to Android over USB. Install the platform tools, open the door for a few minutes, and close it when you are done.
- On the phone: Settings › About phone › tap Build number 7 times. Then Settings › System › Developer options › USB debugging.
- Connect the cable. The phone shows the computer’s key fingerprint: accept it only if you are at your own computer.
- When you finish: turn USB debugging off and tap “Revoke USB debugging authorizations”.
# macOS (Homebrew) · on Debian/Ubuntu: sudo apt install adb
$ brew install android-platform-tools
$ adb devices
List of devices attached
3A281FDH2000XY device # "unauthorized" = accept the prompt on the phone
$ adb kill-server
0x03
Audit your apps and permissions
PDFEvery app you installed, and every sensitive permission it holds right now. Run it once a month; anything you don’t recognise or don’t use, uninstall.
$ adb shell pm list packages -3 -i
package:org.example.notes installer=null
package:com.example.maps installer=app.store.example
#!/usr/bin/env bash
# Lists the apps you installed and the sensitive permissions they hold right now.
set -uo pipefail
SENS='CAMERA|RECORD_AUDIO|ACCESS_FINE_LOCATION|ACCESS_BACKGROUND_LOCATION|READ_CONTACTS|READ_SMS|READ_CALL_LOG|BODY_SENSORS|READ_MEDIA_IMAGES'
for pkg in $(adb shell pm list packages -3 | cut -d: -f2 | tr -d '\r'); do
perms=$(adb shell dumpsys package "$pkg" \
| grep -oE "android.permission.($SENS): granted=true" \
| sed -E 's/android.permission.([A-Z_]+).*/\1/' | sort -u | tr '\n' ' ')
[ -n "$perms" ] && printf '%-42s %s\n' "$pkg" "$perms"
done
$ adb shell pm revoke org.example.notes android.permission.RECORD_AUDIO
$ adb shell pm uninstall org.example.notes
- A flashlight with microphone access, a game with your contacts: those are the ones to question.
- On a SEKRTLY, Network and Sensors are permissions too. An app with no reason to go online can be cut off from the internet entirely in its app settings.
- An unknown installer (or null) means the app came from outside a store. That can be fine if you sideloaded it, but you should know about it.
0x04
Hunt for spyware and stalkerware
PDFCommercial spying apps need to see your screen, read your notifications or control the device. To do that they use a handful of Android features. Check every one of them.
#!/usr/bin/env bash
# Accessibility, notification access, device admins, always-on VPN and apps without a launcher icon.
s() { adb shell "$@" | tr -d '\r'; }
echo "== Accessibility services"; s settings get secure enabled_accessibility_services
echo "== Notification listeners"; s settings get secure enabled_notification_listeners
echo "== Device admins"; s dumpsys device_policy | grep -i -A3 "admins" || echo "(none)"
echo "== Always-on VPN"; s settings get secure always_on_vpn_app
echo "== Installed apps with no icon on the home screen"
comm -23 <(s pm list packages -3 | cut -d: -f2 | sort) \
<(s cmd package query-activities --brief -a android.intent.action.MAIN \
-c android.intent.category.LAUNCHER | grep / | sed 's/^ *//' | cut -d/ -f1 | sort -u)
- Accessibilityempty or null, or only tools you chose (a screen reader, a password manager)
- Notification listenersonly apps you recognise
- Device adminsnothing, unless your company manages the phone
- Apps with no iconnothing you can’t explain
For a deeper check, the open-source forensic tools used by human-rights researchers compare your phone against known spyware indicators. Collect with AndroidQF (it asks you to confirm on the phone), then analyze on the computer with MVT:
$ ./androidqf # download the release for your system from its official repository
$ pipx install mvt
$ mvt-android download-iocs
$ mvt-android check-androidqf --output results/ <androidqf-folder>
0x05
Check the system’s integrity
PDFVerified boot checks every byte of the operating system at start-up. These properties tell you whether the bootloader is locked and which security patch you are on.
$ for p in ro.boot.verifiedbootstate ro.boot.flash.locked ro.boot.vbmeta.device_state \
ro.build.version.security_patch; do
printf '%-34s %s\n' "$p" "$(adb shell getprop $p | tr -d '\r')"
done
- verifiedbootstateyellow on a SEKRTLY (locked with its own key) · green on a stock phone · orange means unlocked: stop
- flash.locked1
- vbmeta.device_statelocked
- security_patcha date from the last month or two
- On a SEKRTLY, the yellow notice at start-up is normal: it shows the fingerprint of the system key. Compare it once with the one published for the system and it should never change.
- For a check that doesn’t trust the phone at all, the Auditor app uses the security chip’s hardware attestation, verified by a second phone. Pair it once and run it whenever the phone has been out of your hands.
0x06
What your phone tells the networks around it
PDFEvery saved Wi-Fi network is a name your phone may go looking for, and every DNS query says which sites you visit. Clean the list and encrypt the lookups.
$ adb shell cmd wifi list-networks
Network Id SSID Security type
0 Home wpa2-psk
7 Airport_Free_WiFi open
$ adb shell cmd wifi forget-network 7 # open networks you used once: forget them
$ adb shell settings get global private_dns_mode # off · opportunistic · hostname
$ adb shell settings get global private_dns_specifier
$ nmap -sn 192.168.1.0/24 # use your own range; every device should be one you know
- Private DNS set to a provider you chose (hostname) encrypts lookups on every network. Off means anyone on the Wi-Fi can read them.
- Turn Wi-Fi off when you leave home, or keep the phone in the Faraday sleeve: a phone that is silent can’t be fingerprinted.
- With the SEKRTLY Private Network, everything travels through your own encrypted network even on hotel or airport Wi-Fi.
0x07
The Linux terminal inside your SEKRTLY
PDFYour SEKRTLY can run a full Debian in a virtual machine: a real terminal in your pocket, isolated from your apps and files. Turn it on in Developer options (Linux development environment; the name may vary by version) and open the Terminal app.
e@sekrt:~$ sudo apt update && sudo apt install -y age openssh-client gnupg curl
e@sekrt:~$ age -p -o notes.txt.age notes.txt # asks for a passphrase
e@sekrt:~$ shred -u notes.txt # remove the plain copy
e@sekrt:~$ age -d -o notes.txt notes.txt.age # decrypt when you need it
e@sekrt:~$ ssh-keygen -t ed25519 -a 100 -C "sekrt"
e@sekrt:~$ cat ~/.ssh/id_ed25519.pub
e@sekrt:~$ sha256sum -c file.zip.sha256 # "OK" or stop
e@sekrt:~$ gpg --verify file.zip.sig file.zip # with the author’s public key imported
e@sekrt:~$ tr -dc 'A-Za-z0-9' </dev/urandom | head -c 24; echo
- The virtual machine can’t read your photos, messages or other apps, and they can’t read it. That isolation is the point.
- It is not a tool to audit Android from inside: for that, use adb from a computer.
- Keep it updated with apt like any Linux system.
0x08
Accounts, passwords and keys
PDFMost break-ins are not about the phone at all: they are a reused password or a code sent by SMS. Check your passwords without revealing them, and move off SMS.
#!/usr/bin/env bash
# Only the first 5 characters of the SHA-1 hash leave your computer (k-anonymity).
# The password itself is never sent. Uses the public Pwned Passwords range service.
command -v sha1sum >/dev/null && SHA="sha1sum" || SHA="shasum -a 1"
read -rs -p "Password: " P; echo
H=$(printf %s "$P" | $SHA | awk '{print toupper($1)}'); unset P
N=$(curl -s "https://api.pwnedpasswords.com/range/${H:0:5}" | tr -d '\r' | grep "^${H:5}:" | cut -d: -f2)
echo "${N:-0} leaks" # anything above 0: change it everywhere you used it
- Order of strength: a physical security key or passkey › an authenticator app (TOTP) › SMS. Use the strongest each account offers.
- Ask your carrier for a port-out PIN or SIM lock so nobody can move your number to another SIM.
- Give your email account the strongest protection of all: it resets every other password.
0x09
The paranoid’s routine
PDFSecurity is not a setting, it is a habit. Ten minutes a month is enough.
- Weekly: restart the phone. After a restart everything is encrypted again until you unlock it, and some attacks don’t survive it.
- Monthly: run e-permissions.sh and e-watchers.sh, read the output, uninstall what you don’t use. Check the boot state.
- Monthly: forget Wi-Fi networks you won’t use again. Review active sessions in your email and messaging apps.
- Before crossing a border or going into a protest: turn the phone off completely. A powered-off phone is at its most protected.
- On a SEKRTLY: set the automatic reboot timer, set a duress PIN that wipes the phone, and keep USB data blocked while locked.
0x0A
If you think you were hacked
PDFDon’t panic and don’t start deleting. The order matters.
- 1 · Isolate: airplane mode, or straight into the Faraday sleeve. The phone stops reporting and receiving.
- 2 · From a different, clean device: change your email password first, then the bank, then the rest. Close every other session.
- 3 · If you want to know what happened, collect evidence with AndroidQF before touching anything (see the spyware chapter).
- 4 · Then reset: a factory reset, or on a SEKRTLY, a clean reinstall of the system. Restore only data, not apps from a backup.
- 5 · Turn on the protections you were missing so it doesn’t happen twice.
