# 0x3xp/lethe architecture

> Architecture diagram of the GitHub repository 0x3xp/lethe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0x3xp/lethe
- Repository: https://github.com/0x3xp/lethe

## Overview

Lethe is a Windows kernel-mode implant controlled by a small command-line client over a named pipe. The documented workflow is to start the client, load the driver, then issue a command; the driver’s timer/DPC/work-item mechanism processes requests autonomously. Major command capabilities include credential dumping and token manipulation; EDR callback removal is documented as not yet supported. Driver initialization also performs stealth and persistence actions. The graph follows README-described flows where source excerpts do not show the full implementation; it does not imply unshown calls between command handlers.

Main entry points: [`driver/lethe.c`](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c) (Driver initialization), [`client/client.c`](https://github.com/0x3xp/lethe/blob/main/client/client.c) (Command client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client_channel["Client channel"]
  node_client["Command client<br/>[client.c]"]
  node_pipe["Named pipe"]
end

subgraph group_kernel_runtime["Kernel runtime"]
  node_driver_init["Driver initialization<br/>[lethe.c]"]
  node_timer["Periodic timer<br/>[lethe.c]"]
  node_dpc["DPC callback<br/>[lethe.c]"]
  node_work_item["Worker execution<br/>[lethe.c]"]
  node_dispatcher["Command dispatch<br/>[lethe.c]"]
end

subgraph group_commands["Command capabilities"]
  node_ping["Ping response<br/>[lethe.c]"]
  node_credential_dump["Credential dump<br/>[lethe.c]"]
  node_token_steal["Token manipulation<br/>[lethe.c]"]
  node_edr_callbacks["EDR callback removal<br/>[lethe.c]"]
end

subgraph group_stealth_persistence["Stealth and persistence"]
  node_module_unlink["Module-list unlink<br/>[lethe.c]"]
  node_cache_clear["Driver cache clear<br/>[lethe.c]"]
  node_registry_persistence["Registry persistence<br/>[lethe.c]"]
end

node_operator(("Operator"))

node_operator -->|"issues command"| node_client
node_client -->|"creates and writes"| node_pipe
node_pipe -->|"returns result"| node_client
node_driver_init -->|"opens pipe"| node_pipe
node_driver_init -->|"starts periodic execution"| node_timer
node_timer -->|"queues"| node_dpc
node_dpc -->|"queues"| node_work_item
node_work_item -->|"processes request"| node_dispatcher
node_dispatcher -->|"handles ping"| node_ping
node_dispatcher -->|"handles command"| node_credential_dump
node_dispatcher -->|"handles command"| node_token_steal
node_dispatcher -->|"handles command"| node_edr_callbacks
node_driver_init -->|"unlinks module"| node_module_unlink
node_driver_init -->|"clears cache"| node_cache_clear
node_driver_init -->|"installs persistence"| node_registry_persistence

click node_client "https://github.com/0x3xp/lethe/blob/main/client/client.c"
click node_driver_init "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"
click node_timer "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"
click node_dpc "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"
click node_work_item "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"
click node_dispatcher "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"
click node_ping "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"
click node_credential_dump "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"
click node_token_steal "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"
click node_edr_callbacks "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"
click node_module_unlink "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"
click node_cache_clear "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"
click node_registry_persistence "https://github.com/0x3xp/lethe/blob/main/driver/lethe.c"

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_client,node_pipe toneBlue
class node_driver_init,node_timer,node_dpc,node_work_item,node_dispatcher toneAmber
class node_ping,node_credential_dump,node_token_steal,node_edr_callbacks toneMint
class node_module_unlink,node_cache_clear,node_registry_persistence toneRose
class node_operator toneIndigo
```

## Components

### Client channel

- [Command client](https://github.com/0x3xp/lethe/blob/main/client/client.c): `client/client.c`
- **Named pipe**

### Kernel runtime

- [Driver initialization](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`
- [Periodic timer](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`
- [DPC callback](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`
- [Worker execution](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`
- [Command dispatch](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`

### Command capabilities

- [Ping response](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`
- [Credential dump](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`
- [Token manipulation](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`
- [EDR callback removal](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`

### Stealth and persistence

- [Module-list unlink](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`
- [Driver cache clear](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`
- [Registry persistence](https://github.com/0x3xp/lethe/blob/main/driver/lethe.c): `driver/lethe.c`

### Other components

- **Operator**

## Connections

- Operator → Command client: issues command (evidence: `README.md`)
- Command client → Named pipe: creates and writes (evidence: `client/client.c`)
- Named pipe → Command client: returns result (evidence: `client/client.c`)
- Driver initialization → Named pipe: opens pipe (evidence: `driver/lethe.c`)
- Driver initialization → Periodic timer: starts periodic execution (evidence: `README.md`)
- Periodic timer → DPC callback: queues (evidence: `README.md`)
- DPC callback → Worker execution: queues (evidence: `README.md`)
- Worker execution → Command dispatch: processes request (evidence: `driver/lethe.c`)
- Command dispatch → Ping response: handles ping (evidence: `driver/lethe.c`)
- Command dispatch → Credential dump: handles command (evidence: `README.md`)
- Command dispatch → Token manipulation: handles command (evidence: `README.md`)
- Command dispatch → EDR callback removal: handles command (evidence: `README.md`)
- Driver initialization → Module-list unlink: unlinks module (evidence: `driver/lethe.c`)
- Driver initialization → Driver cache clear: clears cache (evidence: `driver/lethe.c`)
- Driver initialization → Registry persistence: installs persistence (evidence: `driver/lethe.c`)
