# oopnv70-lab/ghostlock-aak-apk architecture

> Architecture diagram of the GitHub repository oopnv70-lab/ghostlock-aak-apk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oopnv70-lab/ghostlock-aak-apk
- Repository: https://github.com/oopnv70-lab/ghostlock-aak-apk

## Overview

GhostLock AAK is an Android loader/trigger for a separately supplied preload library, not the exploit implementation itself. The user grants Shizuku access, selects the library, and starts a run; MainActivity reads the file and coordinates a Shizuku UserService, which writes it and streams shell output back for display. The README documents the LD_PRELOAD-to-exploit transition, but the library and kernel exploit code are not in this tree, so those stages are external. Source excerpts cover the two core Java files; other links rely on README statements.

Main entry points: [`app/src/main/java/com/ghostlock/aak/MainActivity.java`](https://github.com/oopnv70-lab/ghostlock-aak-apk/blob/main/app/src/main/java/com/ghostlock/aak/MainActivity.java) (App UI and orchestration), [`app/src/main/java/com/ghostlock/aak/CommandService.java`](https://github.com/oopnv70-lab/ghostlock-aak-apk/blob/main/app/src/main/java/com/ghostlock/aak/CommandService.java) (UserService)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Android app"]
  node_activity["App UI and orchestration<br/>[MainActivity.java]"]
  node_file_picker["System file picker"]
  node_selected_so["Selected preload library"]
end

subgraph group_privileged["Privileged execution"]
  node_shizuku["Shizuku service"]
  node_command_service["UserService"]
  node_preload_file["Installed preload library"]
end

subgraph group_exploit["Exploit runtime"]
  node_shell["Privileged shell"]
  node_exploit_library["Exploit constructor"]
  node_kernel["Linux kernel rtmutex"]
end

node_user(("Research user"))

node_user -->|"operates"| node_activity
node_activity -->|"opens picker"| node_file_picker
node_file_picker -->|"returns selection"| node_activity
node_activity -->|"reads bytes"| node_selected_so
node_activity -->|"requests permission"| node_shizuku
node_activity -->|"binds service"| node_shizuku
node_activity -->|"calls write and run"| node_command_service
node_selected_so -->|"sends bytes"| node_command_service
node_command_service -->|"writes library"| node_preload_file
node_command_service -->|"executes command"| node_shell
node_shell -->|"loads via LD_PRELOAD"| node_preload_file
node_preload_file -->|"runs constructor"| node_exploit_library
node_exploit_library -->|"triggers rtmutex flaw"| node_kernel
node_command_service -->|"streams output"| node_activity

click node_activity "https://github.com/oopnv70-lab/ghostlock-aak-apk/blob/main/app/src/main/java/com/ghostlock/aak/MainActivity.java"
click node_command_service "https://github.com/oopnv70-lab/ghostlock-aak-apk/blob/main/app/src/main/java/com/ghostlock/aak/CommandService.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_activity,node_file_picker,node_selected_so,node_user toneBlue
class node_shizuku,node_command_service,node_preload_file toneAmber
class node_shell,node_exploit_library,node_kernel toneMint
```

## Components

### Android app

- [App UI and orchestration](https://github.com/oopnv70-lab/ghostlock-aak-apk/blob/main/app/src/main/java/com/ghostlock/aak/MainActivity.java): `app/src/main/java/com/ghostlock/aak/MainActivity.java`
- **System file picker**
- **Selected preload library**

### Privileged execution

- **Shizuku service**
- [UserService](https://github.com/oopnv70-lab/ghostlock-aak-apk/blob/main/app/src/main/java/com/ghostlock/aak/CommandService.java): `app/src/main/java/com/ghostlock/aak/CommandService.java`
- **Installed preload library**

### Exploit runtime

- **Privileged shell**
- **Exploit constructor**
- **Linux kernel rtmutex**

### Other components

- **Research user**

## Connections

- Research user → App UI and orchestration: operates (evidence: `README.md`)
- App UI and orchestration → System file picker: opens picker (evidence: `app/src/main/java/com/ghostlock/aak/MainActivity.java`)
- System file picker → App UI and orchestration: returns selection (evidence: `app/src/main/java/com/ghostlock/aak/MainActivity.java`)
- App UI and orchestration → Selected preload library: reads bytes (evidence: `app/src/main/java/com/ghostlock/aak/MainActivity.java`)
- App UI and orchestration → Shizuku service: requests permission (evidence: `app/src/main/java/com/ghostlock/aak/MainActivity.java`)
- App UI and orchestration → Shizuku service: binds service (evidence: `app/src/main/java/com/ghostlock/aak/MainActivity.java`)
- App UI and orchestration → UserService: calls write and run (evidence: `app/src/main/java/com/ghostlock/aak/MainActivity.java`)
- Selected preload library → UserService: sends bytes
- UserService → Installed preload library: writes library (evidence: `app/src/main/java/com/ghostlock/aak/CommandService.java`)
- UserService → Privileged shell: executes command (evidence: `app/src/main/java/com/ghostlock/aak/CommandService.java`)
- Privileged shell → Installed preload library: loads via LD_PRELOAD (evidence: `README.md`)
- Installed preload library → Exploit constructor: runs constructor (evidence: `README.md`)
- Exploit constructor → Linux kernel rtmutex: triggers rtmutex flaw (evidence: `README.md`)
- UserService → App UI and orchestration: streams output (evidence: `app/src/main/java/com/ghostlock/aak/MainActivity.java`)
