renef-mcp

v0.4.0
renef-mcp Checked 2 hours ago Published 5 days ago

MCP server for Renef v0.4.0 - Dynamic Instrumentation Toolkit for Android ARM64

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

adb_app

Inspect, list, start, or force-stop Android apps via ADB. Actions: - `current`: Get currently focused app (package, activity, PID, UID) - `list`: List installed packages via `pm list packages` (optional substring `filter`) - `start`: Launch an app via `am start` (optional `activity`) - `start_monkey`: Launch an app via `monkey -p <package_name> -c LAUNCHER 1` - `stop`: Force-stop an app via `am force-stop <package_name>` Args: action: "current", "list", "start", "start_monkey", or "stop" package_name: Android package name (required for "start", "st…

ParameterTypeDescription
action *string
activitystring
filterstring
package_namestring

adb_device_status

Check Android device root & SELinux status, and optionally toggle SELinux mode. Args: selinux_action: Optional - "disable" (Permissive / setenforce 0) or "enable" (Enforcing / setenforce 1). Leave empty to inspect only. Returns: JSON report with root status, su/Magisk checks, and SELinux state

ParameterTypeDescription
selinux_actionstring

adb_devices

List connected Android devices (`adb devices -l`). Returns: Connected ADB devices output

renef_attach

Attach to a running Android process by PID or package name and inject libagent.so. Uses Renef's signal-based injector (no ptrace). Args: target: Process ID (e.g., "12345") or running package name (e.g., "com.example.app") timeout: Injection timeout in seconds (default: 30.0) Returns: JSON status with attached PID

ParameterTypeDescription
target *string
timeoutnumber

renef_command

Send a raw command directly to renef_server over the framed TCP transport. Works both with an active target session (e.g., `hooks`, `sec libc.so`, `md 0x... 64`) and for sessionless server commands (e.g., `ping`, `la`, `memdump <pid> --maps`). Args: command: Raw renef_server command string timeout: Reply timeout in seconds (default: 35.0) Returns: Raw text response from renef_server

ParameterTypeDescription
command *string
timeoutnumber

renef_events

Collect hook output, syscall trace lines, and structured `send({...})` JSON events. In Renef v0.4.0, hook callbacks and syscall tracers emit to a dedicated event channel separate from normal command replies. Call this tool to retrieve buffered events or wait up to `wait_ms` milliseconds for new ones. Args: wait_ms: Milliseconds to wait for incoming events (0 = immediate drain, max 30000) include_logcat: Also fetch recent `RENEF_LUA` lines from Android logcat as fallback Returns: JSON object with `events` (structured `send()` payloads), `output` (p…

ParameterTypeDescription
include_logcatboolean
wait_msinteger

renef_exec

Execute single-line or multi-line Lua 5.4 code in the target process. Uses Renef v0.4.0's framed protocol and safe quoting (no 64 KB limit, no temp files, safe with newlines, quotes, `//`, and `~`). Returns printed output and exact Lua compile/runtime error messages. IMPORTANT: Use Renef Lua API (`hook`, `Interceptor`, `NativeFunction`, `Memory`, `Module`, `Process`, `Thread`, `Java`, `Jni`, `Syscall`, `OS`, `File`, `KCov`, `send`), NOT Frida JS syntax. See `renef://api-reference`. Args: lua_code: Lua code to execute in the target process timeout:…

ParameterTypeDescription
lua_code *string
timeoutnumber

renef_list_apps

List installed applications on the Android device via renef_server (no injection needed). Args: filter: Optional substring filter for package names (e.g., "chrome", "example") Returns: JSON object with count and sorted package names

ParameterTypeDescription
filterstring

renef_load_script

Load and execute one or more local Lua script files in the target process. Reads the file(s) on the host and sends them over Renef v0.4.0's framed protocol (supports scripts of any size with full Lua error reporting). Args: script_paths: Path to a Lua file, or space-separated paths to multiple files (e.g., "hook.lua" or "taint_filter.lua root_emulator_bypass.lua") timeout: Execution timeout per script in seconds (default: 30.0) Returns: JSON summary with per-script execution results

ParameterTypeDescription
script_paths *string
timeoutnumber

renef_ping

Check connectivity to renef_server and report session status. Optionally updates the target host/port (defaults to RENEF_HOST/RENEF_PORT or 127.0.0.1:1907). Args: host: Optional host override (e.g., "127.0.0.1") port: Optional TCP port override (e.g., 1907) Returns: JSON status including pong, framing protocol support, and active target info

ParameterTypeDescription
hoststring
portinteger

renef_reset

Reset the Renef session or perform a full device/server hard reset. Modes: - `session` (default): Closes the local TCP connection and clears session state. Fast and safe. - `hard`: Closes local session, kills target app (if specified/tracked), kills and restarts `renef_server` on the Android device, refreshes ADB port forwarding, optionally redeploys v0.4.0 binaries (`renef_server` + `/data/local/tmp/libagent.so`), and verifies with `ping`. Args: mode: Reset mode - "session" (default) or "hard" redeploy: (hard mode only) Re-push renef_server and li…

ParameterTypeDescription
kill_appstring
modestring
redeployboolean

renef_resume

Resume a target process that was spawned with `renef_spawn(..., pause=True)`. Detaches the ptrace spawn gate so app code runs and any deferred hooks install as their target libraries load. Returns: JSON status with server response

renef_rpc

Evaluate a Lua expression in the target process and return its structured JSON value. Uses Renef v0.4.0's `rpc` command: Lua tables become JSON arrays/objects, booleans stay true/false, and errors return exact Lua error messages. Examples: - `OS.getpid()` -> `12345` - `{pid = OS.getpid(), tid = Thread.id()}` -> `{"pid": 12345, "tid": 12360}` - `Module.find("libc.so")` -> base address integer Args: expression: Lua expression to evaluate timeout: Silence timeout in seconds (default: 30.0) Returns: JSON object with `ok` and `…

ParameterTypeDescription
expression *string
timeoutnumber

renef_spawn

Spawn an Android app and inject the Renef v0.4.0 agent (libagent.so). Default injection (`pause=False`) is signal-based (NO ptrace, immune to TracerPid checks). With `pause=True`, uses the ptrace spawn gate to freeze the main thread before app code runs so deferred hooks on not-yet-loaded libraries catch the very first call. Anti-debug note: `pause=True` sets TracerPid != 0 while paused. Prefer `pause=False` against targets suspected of anti-debug/ptrace checks unless early-hook timing is specifically needed. Args: package_name: Android package name (e.g., "c…

ParameterTypeDescription
package_name *string
holdboolean
pauseboolean
timeoutnumber

renef_verbose

Toggle verbose debug logging inside the injected agent (`verbose on` / `verbose off`). Args: enabled: True to enable verbose agent logs, False to disable Returns: JSON status with server reply

ParameterTypeDescription
enabled *boolean

renef_hook_generate

Generate a Renef Lua hook template using the server's `hookgen` command. Examples: - `renef_hook_generate("libnative.so", "0x1234")` — template for offset - `renef_hook_generate("libc.so", "malloc")` — template for symbol in library - `renef_hook_generate("malloc")` — search symbol across loaded libraries Args: lib_name: Library name, or symbol name if `offset_or_symbol` is omitted offset_or_symbol: Optional hex offset or symbol name inside `lib_name` Returns: Generated Lua hook template

ParameterTypeDescription
lib_namestring
offset_or_symbolstring

renef_hook_java

Install a Java/ART method hook (Android 12+ safe JNI twin engine; fallback on older Android). Java hook argument layout in Lua callbacks: - Instance methods: `args[0]` = ArtMethod* (internal), `args[1]` = `this`, `args[2]` = arg1, ... - Static methods: `args[0]` = ArtMethod*, `args[1]` = arg1, ... - `skip_original=True` sets `args.skip = true` in onEnter (CRITICAL for bypassing void methods like SSL pinning checks without triggering exceptions). - `return_value` overrides the return value in onLeave: e.g. `"false"`, `"true"`, `"0"`, `"42"`, or `'JNI.string("HOO…

ParameterTypeDescription
class_name *string
method_name *string
on_enterstring
on_leavestring
return_valuestring
signaturestring
skip_originalboolean

renef_hook_native

Install a native ARM64 hook on a library function by hex offset or export symbol name. Supports all Renef v0.4.0 native hook features: - Inline trampoline hooks (default) or PLT/GOT targeted hooks (`caller="libfoo.so"` or `"*"`) - Custom Lua `on_enter` (`args[0..7]` = x0-x7) and `on_leave` (`retval` = x0; return value overrides x0) - Default argument/return logging when both `on_enter` and `on_leave` are omitted - Fire-and-forget async hooks (`asynchronous=True`) for high-frequency observation-only hooks - Deferred hooks: if `lib_name` is not loaded yet (e.g., under `r…

ParameterTypeDescription
lib_name *string
target *string
asynchronousboolean
callerstring
on_enterstring
on_leavestring

renef_hooks_list

List all active native and Java hooks with their IDs (`0`, `j0`, ...) and hit counts. Returns: Formatted list of active native and Java hooks from the agent

renef_interceptor

Replace or revert a native function using Renef v0.4.0's `Interceptor` API. - `action="replace"`: Replaces `(lib_name, target)` so the original never runs (unless invoked via `NativeFunction` inside the replacement callback). `replacement` can be an integer constant (e.g., `"0"`, `"1"`, `"-1"`), boolean (`"true"`/`"false"`), or a Lua function string (`"function(args) return 0 end"`). - `action="revert"`: Restores original bytes / GOT entry and removes the hook/replacement. Args: action: "replace" or "revert" lib_name: Library name (e.g., "libnati…

ParameterTypeDescription
action *string
lib_name *string
target *string
callerstring
replacementstring

renef_native_call

Call a native ARM64 function directly inside the target process via `NativeFunction`. Supports up to 8 integer/pointer args (x0-x7) and 8 float/double args (d0-d7). Explicit calls via `NativeFunction` DO trigger installed hooks on the target address. Supported types for `ret_type` and `arg_types`: `"int"`, `"long"`, `"pointer"`, `"bool"`, `"string"`, `"void"`, `"float"`, `"double"`. Args: address: Target function address (e.g., "0x7f8a12340") ret_type: Return type (default: "pointer") arg_types: Optional list of argument types (e.g., ["pointer", "…

ParameterTypeDescription
address *string
arg_types
args
ret_typestring
timeoutnumber

renef_unhook

Remove native hook(s), Java hook(s), or all hooks from the target process. In Renef v0.4.0, Java hooks can also be removed individually by their `j<id>` ID (as shown in `renef_hooks_list`). Args: hook_id: Hook ID to remove: "all" (default), native ID like "0", or Java ID like "j0" Returns: JSON status with server reply

ParameterTypeDescription
hook_idstring

renef_java_call

Call a Java static method, construct an instance, or call/release a boxed JavaObject. Uses Renef v0.4.0's `Java.use(class):call(...)` / `:new(...)` and instance handles. Examples: - Static call: `class_name="java/lang/System"`, `method_name="currentTimeMillis"`, `signature="()J"` - Constructor: `class_name="java/io/File"`, `constructor=True`, `signature="(Ljava/lang/String;)V"`, `args=["/data/local/tmp"]` - Instance call: `instance_handle=1`, `method_name="exists"`, `signature="()Z"` - Release handle: `instance_handle=1`, `release=True` Args: class_name:…

ParameterTypeDescription
args
class_namestring
constructorboolean
instance_handleinteger
method_namestring
releaseboolean
signaturestring
timeoutnumber

renef_java_classes

Enumerate loaded Java classes from the app's dex files (`Java.enumerateLoadedClasses`). Args: pattern: Optional case-insensitive substring filter (e.g., "okhttp", "com.example", "Trust") limit: Maximum class names to return (default: 200, max: 2000) Returns: JSON object with total matches and list of class names

ParameterTypeDescription
limitinteger
patternstring

renef_java_method_info

Inspect ART metadata for a Java method using `Java.methodInfo`. Returns the `ArtMethod*` pointer, access flags, quick entry point, JNI native function pointer (if native) and whether it is bound, plus `native`, `static`, and `hooked` booleans. Args: class_name: Java class name (dots or slashes accepted, e.g., "com/example/NativeBridge") method_name: Method name (e.g., "checkLicense") signature: JNI signature (e.g., "(Ljava/lang/String;)Z") Returns: JSON object with ART method details

ParameterTypeDescription
class_name *string
method_name *string
signature *string

renef_jni

Raw JNI string & reference helpers (`Jni.*` API — distinct from `JNI.*` return tags). Actions: - `new_string`: Create a Java String from UTF-8 text -> `Jni.newStringUTF(value)` (returns ref pointer) - `get_string`: Read UTF-8 text from a `jstring` or raw ART `String*` pointer -> `Jni.getStringUTF(ref)` - `string_length`: Get UTF-16 character length of a `jstring` / ART `String*` -> `Jni.getStringLength(ref)` - `delete_ref`: Delete a JNI global reference -> `Jni.deleteGlobalRef(ref)` Args: action: "new_string", "get_string", "string_length", or "delete_ref"…

ParameterTypeDescription
action *string
refstring
valuestring

renef_mem_dump

Dump or disassemble target memory via server-side `md` (`/proc/<pid>/mem`). Args: address: Target memory address (e.g., "0x7f8a1c2b0") size: Number of bytes to dump (1..4096, default: 64) disassemble: If True, disassemble ARM64 instructions (`-d` flag) Returns: Formatted hex dump or ARM64 disassembly from renef_server

ParameterTypeDescription
address *string
disassembleboolean
sizeinteger

renef_mem_manage

Allocate, free, or change page permissions in target process memory (Renef v0.4.0 API). Actions: - `alloc`: Allocate `size` bytes with permissions `prot` (e.g., `"rw-"`, `"rwx"`, `"r-x"`) -> `Memory.alloc` - `alloc_str`: Allocate a NUL-terminated copy of `text` in target memory -> `Memory.allocStr` - `free`: Free memory allocated at `address` (optional `size`) -> `Memory.free` - `protect`: Change memory protection of `[address, address+size)` to `prot` -> `Memory.protect` Args: action: "alloc", "alloc_str", "free", or "protect" address: Memory address…

ParameterTypeDescription
action *string
addressstring
protstring
sizeinteger
textstring

renef_mem_read

Safely read memory from the target process (checks /proc/self/maps first to avoid crashes). Supported formats: - `hex` (default): Raw bytes as hex + printable ASCII preview (`size` defaults to 64, max 1MB) - `hexdump`: Formatted classic hexdump (`Memory.hexdump`, `size` defaults to 64) - `string`: NUL-terminated UTF-8/C string (`Memory.readStr`, `size` defaults to 256) - `u8`, `u16`, `u32`, `u64`, `pointer`: Little-endian unsigned integer Args: address: Target memory address (e.g., "0x7f8a1c2b0") size: Number of bytes for hex/hexdump (default 64) or ma…

ParameterTypeDescription
address *string
formatstring
sizeinteger

renef_mem_write

Write bytes or integers to target process memory (with optional code-page patching). - When `patch=True` (or writing to read-only/executable code pages), uses `Memory.patch` which automatically handles `mprotect` and instruction cache flushing. - Supports `type`: `"hex"` (e.g. `"C0035FD6"` = ARM64 `RET`), `"u8"`, `"u16"`, `"u32"`, `"u64"`. Args: address: Target memory address (e.g., "0x7f8a1c2b0") value: Hex bytes string (for type="hex") or integer string (decimal or "0x..." hex) type: Data type - "hex" (default), "u8", "u16", "u32", "u64" pa…

ParameterTypeDescription
address *string
value *string
patchboolean
typestring

renef_memdump_passive

Injection-free, ptrace-free passive memory read via renef_server (`/proc/<pid>/maps` & `/proc/<pid>/mem`). Does NOT spawn, attach, inject `libagent.so`, or call `ptrace`. Ideal for inspecting anti-tamper / anti-debug targets before deciding whether to inject. Modes: - `maps` (default): Lists memory mappings from `/proc/<pid>/maps` (optional substring `filter`). - `dump`: Reads raw bytes in `[start_addr, end_addr)` directly from `/proc/<pid>/mem`. If `output_path` is provided, writes the binary dump to that host file. Args: pid: Target process PID on the…

ParameterTypeDescription
pid *integer
end_addrstring
filterstring
modestring
output_pathstring
start_addrstring

renef_detect_framework

Detect the Android app's framework by checking loaded native libraries. Identifies Flutter, React Native, Unity, Xamarin, Cordova/Ionic, NativeScript, or Android Native, and recommends the matching `techniques://ssl_pinning/{platform}` URI. Returns: JSON object with detected frameworks, matched libraries + hex base addresses, and resource hints

renef_disassemble

Disassemble ARM64 instructions at a target address using `Module.disassemble` (Capstone). Validates that the entire address range is mapped and readable before disassembling, so bad addresses return a clean error instead of crashing the target app. Args: address: Starting virtual address (e.g., "0x7f8a12340") count: Number of ARM64 instructions to decode (1..1024, default: 16) Returns: JSON object with human-readable `listing` and structured `instructions` (including `is_branch`, `is_call`, `is_jump`)

ParameterTypeDescription
address *string
countinteger

renef_module_exports

List or search exported (`.dynsym`) or full (`.symtab`) symbols of a loaded library. - Uses Renef v0.4.0's `Module.findExportByName(lib, pattern)` when `pattern` is set and `include_symbols=False`. Supports glob wildcards (`*`, `?`) — e.g. `"SSL_*"`, `"*verify*"`, or exact names like `"fopen"`. - Set `include_symbols=True` to read `.symtab` (`Module.symbols`, empty for stripped binaries). Args: lib_name: Library name (e.g., "libc.so", "libssl.so", "linker64") pattern: Optional glob pattern (`"pthread_*"`, `"*open*"`) or exact symbol name incl…

ParameterTypeDescription
lib_name *string
include_symbolsboolean
limitinteger
patternstring

renef_module_find

Find the base address of a loaded library in the target process (`Module.find`). Args: lib_name: Library name (e.g., "libc.so", "libflutter.so"). Supports partial matches. Returns: JSON object with `found`, `base`, and `base_hex`

ParameterTypeDescription
lib_name *string

renef_module_list

List loaded modules/libraries in the target process with base addresses and sizes. Args: filter: Optional case-insensitive substring filter on module name or path (e.g., "ssl", "flutter") limit: Maximum entries to return (default: 200) Returns: JSON object with total count and module records

ParameterTypeDescription
filterstring
limitinteger

renef_module_sections

List ELF sections of a loaded library (`sec <lib_name>`). Args: lib_name: Library name (e.g., "libnative.so", "libflutter.so") Returns: Formatted ELF section list from renef_server

ParameterTypeDescription
lib_name *string

renef_process

Inspect target process memory ranges, threads, thread ID, and stack backtrace. Actions: - `info` (default): PID (`OS.getpid`), current agent thread ID (`Thread.id`), and thread count - `ranges`: Enumerate `/proc/self/maps` via `Process.enumerateRanges()` (optional substring `filter` on path or perms like `"r-xp"`) - `threads`: Enumerate all live thread IDs via `Process.enumerateThreads()` - `thread_id`: Current agent thread ID (`Thread.id()`) - `backtrace`: PAC-aware stack backtrace (`Thread.backtrace()`) Args: action: "info", "ranges", "threads", "thread_…

ParameterTypeDescription
actionstring
filterstring
limitinteger

renef_recipes

List, inspect, or run bundled Renef v0.4.0 pentest recipes and example Lua scripts. Recipes are templates (not universal drop-ins) — use `action="get"` to read and tailor their `CONFIG` table before running, or `action="run"` to execute directly in the target. Actions: - `list` (default): List bundled recipes and examples - `get`: Return the full Lua source of a recipe/example by `name` - `run`: Execute a bundled recipe/example directly in the active target session Args: action: "list", "get", or "run" name: Script name (with or without `.lua`,…

ParameterTypeDescription
actionstring
categorystring
namestring
timeoutnumber

search_techniques

Search across technique documentation with optional platform filtering. Performs full-text search across all documentation files in a technique category, returning matching lines with file context. Supports regex patterns for advanced searching. Args: query: Search term or regex pattern (e.g., "OkHttp", "Trust.*Manager") technique: Technique category to search (default: "ssl_pinning") platform: Filter to specific platform (optional, e.g., "flutter", "android") case_sensitive: Enable case-sensitive search (default: False) context_li…

ParameterTypeDescription
query *string
case_sensitiveboolean
context_linesinteger
platformstring
techniquestring

renef_port_forward

Manage ADB TCP port forwarding rules for `renef_server` or rootless gadget mode. Actions: - `status` (default): List all active ADB port forwards - `add`: Add `adb forward tcp:<local_port> <remote>` (defaults to configured port -> RuntimeInit UDS; or if `gadget_pid > 0`, forwards to `localabstract:renef_pl_<gadget_pid>`) - `remove`: Remove forwarding rule for `tcp:<local_port>` - `remove_all`: Remove all ADB port forwarding rules Args: action: "status", "add", "remove", or "remove_all" local_port: Local TCP port (0 = use configured RENEF_P…

ParameterTypeDescription
actionstring
gadget_pidinteger
local_portinteger
remotestring

renef_server

Manage the on-device Android `renef_server` daemon and `libagent.so` deployment. Uses Renef v0.4.0 device paths: - `/data/local/tmp/renef_server` (`chmod +x`) - `/data/local/tmp/libagent.so` (`chmod 777` + `chcon u:object_r:app_data_file:s0`) Actions: - `status` (default): Check deployment of both binaries and whether `renef_server` is running - `deploy`: Push v0.4.0 `renef_server` and `libagent.so` to device with proper permissions/SELinux context - `start`: Setup ADB port forward (`tcp:<port>`) and start `renef_server` in background as root - `kill`: Stop ru…

ParameterTypeDescription
actionstring
clear_logsboolean
linesinteger

renef_file

Filesystem operations executed inside the target process context (`File.*` API). Runs with the target app's UID/SELinux context, so it can read the app's private data files (`/data/data/<pkg>/...`) and dump in-memory payloads directly to disk. Actions: - `read`: Read file contents -> `File.read(path)` - `write`: Dump target memory `[address, address+size)` to a device file (max 100MB) -> `File.write(path, addr, size)` - `exists`: Check if file exists -> `File.exists(path)` - `readlink`: Resolve a symlink target -> `File.readlink(path)` - `fdpath`: Get filesyst…

ParameterTypeDescription
action *string
addressstring
fdinteger
pathstring
sizeinteger

renef_kcov

Kernel coverage collection via Linux KCOV (`KCov.*` API; requires kernel `CONFIG_KCOV=y`). Manages a session-wide `_kcov` handle in the target's Lua VM. Actions: - `start`: Open `/sys/kernel/debug/kcov` with optional `buf_size` (default 256K entries) and enable recording - `enable`: Re-enable recording on the open `_kcov` handle - `disable`: Pause recording (buffer preserved for `collect`/`edges`) - `count`: Return number of recorded kernel PCs without copying - `collect`: Collect recorded kernel PC addresses (hex list, capped at `max_entries`) - `edges`: Comp…

ParameterTypeDescription
action *string
buf_sizeinteger
max_entriesinteger

renef_os

OS-level helpers executed inside the target process (`OS.*` API). Actions: - `getpid`: Get the target process's PID (`OS.getpid()`) - `listdir`: List non-dot entries of a directory on device (`OS.listdir(path)`) - `kill`: Send a POSIX signal to a PID (`OS.kill(pid, signal)`) - `tgkill`: Send a POSIX signal to a specific thread (`OS.tgkill(pid, tid, signal)`) Args: action: "getpid", "listdir", "kill", or "tgkill" path: Directory path on device (required for "listdir", e.g., "/proc/self/task") pid: Target process/thread-group ID (required for "ki…

ParameterTypeDescription
action *string
pathstring
pidinteger
signalinteger
tidinteger

renef_syscall

Trace Linux/Android syscalls in the target process (`Syscall.*` API). Actions: - `trace`: Trace specific syscalls (`syscalls=["openat", "read", "connect"]`, optional `caller="libapp.so"`) OR trace an entire `category` (`"file"`, `"network"`, `"memory"`, `"process"`, `"ipc"`) - `trace_all`: Trace all supported syscalls (`Syscall.traceAll()`) - `untrace`: Stop tracing specific syscalls (`syscalls=[...]`) - `stop`: Stop all active syscall tracing (`Syscall.stop()`) - `list`: List available traceable syscalls (optional `category` filter) - `active`: Show currentl…

ParameterTypeDescription
action *string
callerstring
categorystring
syscalls