Repository navigation
Security Model
The tool runs untrusted input (an APK) through a decompiler, hands the output to a model, and executes commands the model chooses against a device. Each of those is a trust boundary with a specific control.
| Boundary | Untrusted input | Control |
|---|---|---|
| Browser to server | HTTP requests | Loopback-only bind, CORS restricted to localhost origins, credentials disabled |
| Upload and path entry | Filenames, local paths | Filename reduced to a safe basename; path resolved with symlinks followed and required to be inside the home directory on a separator boundary |
| Static file serving | Request paths | Each path segment matched against a directory listing rather than joined onto a path |
| Model to filesystem (phase 1) | Tool paths | Every path resolved against the artifact root (JADX/Blutter output, the recovered Dart source, the Metro module tree, the extracted assets/www tree, or the recovered assemblies) and rejected on escape |
| Model to device (phase 2) | adb commands | Parsed with shlex, dispatched through a verb allowlist, every verb constrained to the target package |
| Settings to network | base_url |
Scheme check plus DNS resolution rejected against private, loopback, link-local and unique-local ranges |
| Logs and responses | Exception text | Provider errors summarized before reaching the client; verbose output scrubbed for credentials before it reaches the terminal, the WebSocket and scan.log
|
| APK contents to disk | Zip member paths, recovered names | Cordova assets/www and Xamarin assembly extraction refuse any member whose path would escape the destination (zip-slip). Dart kernel source URIs and Metro module names are rebuilt from sanitised components and checked to stay inside the destination before anything is written |
| APK contents to Ghidra | Native library bytes | The library is copied into a fresh temporary directory under a sanitised name before Ghidra sees it, so nothing from the archive reaches the command line; the launcher is run as an argument vector with no shell |
| Device to device shell (install check) | Installed APK path | Before installing, pm path, dumpsys package and sha256sum run on the device. The package name is validated before it is composed into those commands, and the installed path the device reports is matched against a strict path pattern before it is hashed, so a hostile device answer cannot inject into the next command |
| Stored keys to the browser | Reveal request | Full keys are returned one at a time by POST, never in a URL or the general settings snapshot |
uvicorn binds 127.0.0.1 only. There is no authentication, because there is no remote surface by design. Exposing the port to a network gives anyone who can reach it full control of scans, settings and stored API keys.
CORS allows http://localhost and http://127.0.0.1 with and without ports 5173 and 8000. allow_credentials is false.
Two request-driven path expressions exist and both are constrained:
- Local-path scan creation resolves the input with
os.path.realpathafterexpanduser, then requires the result to start with the home directory plus a separator. The separator matters: a bare prefix test would also accept a sibling directory such as<home>-other. - SPA static serving never joins a request path onto a directory.
_static_file()walks the requested segments, matching each againstiterdir()output and returning thePaththe listing produced..., absolute paths and symlinked entries cannot match an entry, and symlinks are rejected explicitly.
Scan ids are validated against ^[0-9a-f]{12}$ before any folder operation, and uploaded filenames are stripped to a basename with a restricted character set.
AgentTools resolves every model-supplied path against the artifact root (JADX's output for Java/Kotlin, the recovered Dart and platform layer for Flutter, the Metro module tree and platform layer for React Native, the extracted assets/www tree for Cordova, the recovered assemblies for Xamarin) and raises if the result is neither the root nor beneath it. The sandbox logic itself has no framework-specific code; only the SourceProfile passed in changes which extensions and noise paths it recognizes. objdump output has the absolute host path replaced with the sandbox-relative one, so local filesystem layout is not disclosed to the model or into the transcript.
The phase 1 agent can cause two subprocesses, both through inspect_native on a .so file inside the sandbox and both as argument lists, never shell strings - and the file review after it reaches them the same way, through the same tool surface, for each native library the app's own code loads: objdump -T with a 15-second timeout, and, when ghidra_path is set, Ghidra's analyzeHeadless on a sanitised copy of the library in a temporary directory, with a 720-second timeout that kills the whole process group. Known framework runtimes and libraries over 64 MB are refused before Ghidra starts. On Windows the launcher is a batch file, which is exactly why no APK-derived string may appear among its arguments.
The model can propose adb commands, but VerifyTools never passes a model-supplied string to a shell. It tokenizes with shlex, strips adb, -s <serial> and shell prefixes, then dispatches on the verb. Twelve verbs are permitted and each is checked:
-
logcattakes no arguments and returns the last 200 lines from the target app's process only, so other apps' log output never reaches the model;screencaptakes none either. -
run-asmust name the target package and usels,catorfind, with..rejected and arguments shell-quoted. -
dumpsys,pm,pidofaccept only exact forms naming the target package. -
am startandam broadcastmust name the package via-n <package>/<Component>or-p <package>. -
inputacceptstapwith two integers,text(quoted), orkeyeventwith one integer. -
getproptakes exactly one shell-quoted property name. -
contenttakesquery,read,insert,update,deleteorcallon acontent://URI whose authority the target app declares, read fromdumpsys package; arguments shell-quoted. -
uiautomatoraccepts onlydump, and returns only the target app's own on-screen elements, parsed with a regular expression rather than an XML parser because the dump is untrusted. -
sleeptakes one whole number from 1 to 10 and pauses on the host; nothing reaches the device.
Commands joined with && or ; are split after shlex parsing, so a separator inside quotes stays part of its argument, and each part is checked on its own, at most six per step. Pipes, redirection and & are refused whole, so no part can feed another or write a file.
am and content are what another installed app would send, so they must not run with more privilege than one. Where adb's shell is root (many emulators and userdebug builds), they run as the shell user, uid 2000, through su 2000 cmd or su 2000 -c; root would otherwise pass checks every other app fails, such as sending protected broadcasts or starting unexported components. When root cannot be dropped, the output says the command ran as root.
The package itself is validated against an Android package-name pattern when the tool surface is constructed.
Frida is not constrained by an allowlist: a script runs arbitrary JavaScript inside the target process. That is the point of the tool, and it is bounded by the app's own sandbox, by the requirement for root, and by attaching only to the package under test.
Each provider holds a pool of keys, tried in order, so an exhausted quota rotates rather than failing the scan.
Keys are stored in the OS keychain where one exists, and in a Fernet-encrypted file with 0600 permissions where none does. The fallback key file sits beside the ciphertext, so it protects against casual reads rather than against an attacker with filesystem access; the tool prints a one-time warning saying so.
Removing a key clears both stores. A keychain delete that fails for any reason other than "nothing was stored there" prints a warning naming the provider, rather than reporting success while the key is still in the OS keychain.
Keys never appear in settings.json. GET /api/settings reports has_api_key, api_key_count, masked previews and each key's label only. A label is the user's own note, such as an email address; it is kept with its key in the keychain, never in settings.json, and never written to scan output, which can be shared. A full key is returned only by POST /api/settings/credentials/{provider}/reveal, one index at a time. POST rather than GET, so the secret is in the request body, not in browser history and access logs.
Two leak paths were closed explicitly:
- The Gemini API key is sent in the
x-goog-api-keyheader. It used to be a URL query parameter, which httpx repeats in exception text that is logged and returned to callers. -
verbose_printscrubs its input before printing or forwarding to the WebSocket sink, masking?key=,api_key=,token=,password=,Bearer <token>and"secret": ...patterns.
Scan failures reach the browser as Scan failed (ref: <8 hex>), with the exception and traceback logged server-side under that reference. Provider test failures return a fixed summary rather than the provider's exception text, which can contain URLs, paths and credentials.
The tool makes network requests to: the configured AI provider (for Ollama cloud, also its public /api/tags model catalogue, fetched without a key), api.github.com and GitHub release downloads for frida-server, https://www.google.com/ during the HTTPS interception check, and http://www.google.com opened on the device during the visual check. A custom provider base_url is checked against private ranges when saved, so a saved endpoint cannot be pointed at cloud metadata services or internal hosts.
- A malicious APK is decompiled and read, not executed on the host. It is installed and launched on the device during phase 2, so use a disposable emulator.
- Scan folders hold the copied APK and the decompiled tree (kept after the scan in verbose runs, and while a scan is paused for provider quota),
scan.log(verbose runs) andcheckpoint/(while running or paused). Log lines are credential-scrubbed, but decompiled source and checkpoint state are the app's own content, so treat a scan folder as sensitive as the APK it came from. - A hostile model response can waste steps and produce false findings. It cannot escape the path sandbox or the adb allowlist, but a Frida script it authors runs inside the target app.
- Anyone with access to the loopback port has full control. Do not forward it.
lu77U-MobileSec · Live demo · Benchmarks · Report an issue · Documents version 0.1.5
Start
Results
How a scan works
Reference
Help and contributing