~/androidlabs / apps / termux-vault

// File 02 · Declassified

Termux Vault

org.androidlabs.termuxvault

Encrypted Termux commands. Unlock, tap, run. Nothing sits in plain text.

Some shell commands carry secrets: a token in a curl header, a VPN password, an rsync line that points at your server. Termux Vault keeps each one encrypted and hands it to Termux only after you unlock.

  • AES-256-GCM
  • Argon2id
  • Class 3 biometric
  • Android 11+

// Briefing

What it is

Shell history, notes apps and home-screen shortcuts all keep secrets in clear text. Termux Vault keeps each command encrypted with AES-256-GCM. To edit, delete or run one, you unlock your vault with your passphrase, or with an optional strong biometric. Termux Vault then hands the decrypted command straight to Termux and wipes its own copy from memory.

Not affiliated with or endorsed by the Termux project.

Commands, servers and tokens in the screenshots are made-up examples.

// Capabilities

What it does

  • Run on demand. Tap an entry, unlock, and it runs in Termux.
  • See the result. Every run ends with one line: all commands succeeded, or which line failed. Failures wait for you to press Enter.
  • Per-command behaviour. Keep a successful session open, be notified when it finishes, or hide the output.
  • Reorder commands by dragging.
  • Widget and Tasker. Both only ever show an authentication prompt. Nothing runs unattended.
  • Back up and restore the whole vault as one line of encrypted text.

// Procedure

How a command reaches Termux

  1. 01
    You unlock your vault. The passphrase goes through Argon2id and unwraps the vault key.
  2. 02
    Termux Vault checks that the installed Termux still has the signing certificate you trusted.
  3. 03
    It opens a one-time listener on 127.0.0.1 and starts Termux with only a fixed bootstrap, two random one-run tokens and the command's title. The command itself is never in the Intent.
  4. 04
    Termux and Termux Vault prove to each other that they hold the tokens. Only then is the command sent, through memory and an anonymous pipe: never a file, an argument or an environment variable.
  5. 05
    Termux Vault wipes its copy. The whole exchange has a strict 12-second deadline.

// Threat model

What it protects against, and what it does not

Protects againstDoes not protect against
Anyone who gets your vault file or a backup: commands are ciphertextA compromised phone, root access or a debugger
Other apps reading commands from Intents, process arguments, files, cache, shell history or logsA malicious or modified Termux build that you chose to trust
Unattended runs: widgets and Tasker only show an authentication promptA keyboard or accessibility service you enabled
Screenshots, overlays and tap-jacking over sensitive screensWhat the command itself reveals: output, files, network requests
Running a different Termux: its certificate is checked before every runA weak passphrase: Argon2id slows guessing but cannot make it safe

Keys: per-command AES-256-GCM keys, wrapped by a vault key, wrapped by your passphrase through Argon2id (64 MiB, 3 passes, 4 lanes). Biometric unlock uses a non-exportable Android Keystore key that accepts only Class 3 biometrics. Titles, icons and order are stored unencrypted; only the commands are encrypted.

// Requirements

Before the first run

  • Android 11 or newer.
  • Termux installed in the same Android profile, from F-Droid or GitHub.
  • In Termux, allow other apps to run commands:
    mkdir -p ~/.termux
    echo "allow-external-apps=true" >> ~/.termux/termux.properties
    termux-reload-settings
  • The notification permission and Run commands in Termux environment. Termux Vault asks for both after you create your first vault.

// Automation

Tasker

Long-press an entry and choose Tasker ID. In Tasker, add a Send Intent action:

FieldValue
Actionorg.androidlabs.termuxvault.RUN_ENTRY
Packageorg.androidlabs.termuxvault
Extraentry_id:<UUID from the dialog>
TargetBroadcast Receiver

Termux Vault answers with a notification. Tap it and unlock to run. Tasker can request a run but never decrypts or executes anything by itself.

// Verification

Check the signature

apksigner verify --print-certs TermuxVault-v<version>.apk

The signing certificate SHA-256 must be:

e8503bc245fa92e4238dd741cbc6ec87d5bf945843d6248a1364ba3c880abc37