# trevohack/venom architecture

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

- Interactive diagram: https://gitdiagram.com/trevohack/venom
- Repository: https://github.com/trevohack/venom

## Overview

Venom is a Linux loadable kernel module that intercepts kernel execution paths through ftrace. The principal workflow is: a host process invokes a syscall, ftrace redirects selected kernel symbols to Venom handlers, handlers inspect or alter the request, and permitted operations fall through to the original kernel function. Distinct stages include module initialization, hook dispatch, concealment/protection policy, network filtering, and optional logging. The graph reflects sampled implementations plus README-documented hook families; several unsampled handlers are represented only at their exact tree paths.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lifecycle["Module Lifecycle"]
  node_venom_module["Venom Module<br/>[venom.c]"]
  node_ftrace_dispatch["Ftrace Dispatcher<br/>[ftrace.h]"]
  node_runtime_config["Runtime Configuration<br/>[venom.c]"]
  node_arm64_hooks["ARM64 Hooking<br/>[arm64.c]"]
end

subgraph group_concealment["Concealment Controls"]
  node_output_interception["Output Interception<br/>[write.h]"]
  node_input_interception["Input Interception<br/>[read.h]"]
  node_directory_filtering["Directory Filtering<br/>[getdents.h]"]
  node_pid_hiding["PID Hiding<br/>[pid_hiding.h]"]
  node_metadata_hiding["Metadata Hiding<br/>[statx.h]"]
end

subgraph group_protection["Protection Controls"]
  node_filesystem_protection["Filesystem Protection<br/>[harden.h]"]
  node_mount_blocking["Mount Blocking<br/>[mounts.h]"]
  node_module_control["Module Load Control<br/>[insmod.h]"]
  node_signal_control["Signal Control<br/>[kill.h]"]
  node_device_protection["Device Ioctl Protection<br/>[ioctl.h]"]
  node_anti_debugging["Anti Debugging<br/>[ptrace.h]"]
end

subgraph group_network["Network Controls"]
  node_network_proc["Proc Network Filtering<br/>[network.h]"]
  node_packet_filtering["Packet Filtering<br/>[network.h]"]
  node_socket_logging["Socket Logging<br/>[socket.h]"]
end

subgraph group_observability["Logging and Monitoring"]
  node_command_logging["Command Logging<br/>[prinT.h]"]
  node_memory_monitoring["Memory Access Monitoring<br/>[process_vm.h]"]
  node_kernel_hardening["Kernel Hardening<br/>[kexec_load.h]"]
end

node_host_process(("Host Process"))
node_kernel["Linux Kernel"]

node_host_process -->|"issues syscalls"| node_kernel
node_host_process -->|"loads module"| node_venom_module
node_venom_module -->|"initializes config"| node_runtime_config
node_venom_module -->|"installs hooks"| node_ftrace_dispatch
node_venom_module -->|"initializes hiding"| node_pid_hiding
node_venom_module -.->|"supports ARM64"| node_arm64_hooks
node_kernel -->|"enters symbols"| node_ftrace_dispatch
node_ftrace_dispatch -->|"dispatches writes"| node_output_interception
node_ftrace_dispatch -->|"dispatches reads"| node_input_interception
node_ftrace_dispatch -->|"dispatches listings"| node_directory_filtering
node_ftrace_dispatch -->|"dispatches filesystem"| node_filesystem_protection
node_ftrace_dispatch -->|"dispatches mounts"| node_mount_blocking
node_ftrace_dispatch -->|"dispatches modules"| node_module_control
node_ftrace_dispatch -->|"dispatches signals"| node_signal_control
node_ftrace_dispatch -->|"dispatches ioctls"| node_device_protection
node_ftrace_dispatch -->|"dispatches tracing"| node_anti_debugging
node_ftrace_dispatch -->|"dispatches proc views"| node_network_proc
node_ftrace_dispatch -->|"dispatches packets"| node_packet_filtering
node_ftrace_dispatch -->|"dispatches sockets"| node_socket_logging
node_ftrace_dispatch -->|"dispatches memory access"| node_memory_monitoring
node_ftrace_dispatch -->|"dispatches kernel actions"| node_kernel_hardening
node_output_interception -->|"falls through writes"| node_kernel
node_input_interception -->|"falls through reads"| node_kernel
node_directory_filtering -->|"reads directory data"| node_kernel
node_filesystem_protection -->|"blocks or continues"| node_kernel
node_module_control -->|"allows or blocks"| node_kernel
node_network_proc -->|"filters proc output"| node_kernel
node_packet_filtering -->|"drops packets"| node_kernel
node_command_logging -->|"logs commands"| node_kernel
node_runtime_config -->|"sets hidden network"| node_network_proc
node_runtime_config -->|"sets hidden prefixes"| node_directory_filtering
node_runtime_config -->|"sets magic signal"| node_signal_control

click node_venom_module "https://github.com/trevohack/venom/blob/main/venom.c"
click node_ftrace_dispatch "https://github.com/trevohack/venom/blob/main/ftrace/ftrace.h"
click node_runtime_config "https://github.com/trevohack/venom/blob/main/venom.c"
click node_arm64_hooks "https://github.com/trevohack/venom/blob/main/arm/arm64.c"
click node_output_interception "https://github.com/trevohack/venom/blob/main/hooks/write.h"
click node_input_interception "https://github.com/trevohack/venom/blob/main/hooks/read.h"
click node_directory_filtering "https://github.com/trevohack/venom/blob/main/hooks/getdents.h"
click node_pid_hiding "https://github.com/trevohack/venom/blob/main/hooks/pid_hiding.h"
click node_metadata_hiding "https://github.com/trevohack/venom/blob/main/hooks/statx.h"
click node_filesystem_protection "https://github.com/trevohack/venom/blob/main/hooks/harden.h"
click node_mount_blocking "https://github.com/trevohack/venom/blob/main/hooks/mounts.h"
click node_module_control "https://github.com/trevohack/venom/blob/main/hooks/insmod.h"
click node_signal_control "https://github.com/trevohack/venom/blob/main/hooks/kill.h"
click node_device_protection "https://github.com/trevohack/venom/blob/main/hooks/ioctl.h"
click node_anti_debugging "https://github.com/trevohack/venom/blob/main/hooks/ptrace.h"
click node_network_proc "https://github.com/trevohack/venom/blob/main/hooks/network.h"
click node_packet_filtering "https://github.com/trevohack/venom/blob/main/hooks/network.h"
click node_socket_logging "https://github.com/trevohack/venom/blob/main/hooks/socket.h"
click node_command_logging "https://github.com/trevohack/venom/blob/main/hooks/prinT.h"
click node_memory_monitoring "https://github.com/trevohack/venom/blob/main/hooks/process_vm.h"
click node_kernel_hardening "https://github.com/trevohack/venom/blob/main/hooks/kexec_load.h"

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_venom_module,node_ftrace_dispatch,node_runtime_config,node_arm64_hooks toneBlue
class node_output_interception,node_input_interception,node_directory_filtering,node_pid_hiding,node_metadata_hiding toneAmber
class node_filesystem_protection,node_mount_blocking,node_module_control,node_signal_control,node_device_protection,node_anti_debugging toneMint
class node_network_proc,node_packet_filtering,node_socket_logging toneRose
class node_command_logging,node_memory_monitoring,node_kernel_hardening,node_host_process,node_kernel toneIndigo
```

## Components

### Module Lifecycle

- [Venom Module](https://github.com/trevohack/venom/blob/main/venom.c): `venom.c`
- [Ftrace Dispatcher](https://github.com/trevohack/venom/blob/main/ftrace/ftrace.h): `ftrace/ftrace.h`
- [Runtime Configuration](https://github.com/trevohack/venom/blob/main/venom.c): `venom.c`
- [ARM64 Hooking](https://github.com/trevohack/venom/blob/main/arm/arm64.c): `arm/arm64.c`

### Concealment Controls

- [Output Interception](https://github.com/trevohack/venom/blob/main/hooks/write.h): `hooks/write.h`
- [Input Interception](https://github.com/trevohack/venom/blob/main/hooks/read.h): `hooks/read.h`
- [Directory Filtering](https://github.com/trevohack/venom/blob/main/hooks/getdents.h): `hooks/getdents.h`
- [PID Hiding](https://github.com/trevohack/venom/blob/main/hooks/pid_hiding.h): `hooks/pid_hiding.h`
- [Metadata Hiding](https://github.com/trevohack/venom/blob/main/hooks/statx.h): `hooks/statx.h`

### Protection Controls

- [Filesystem Protection](https://github.com/trevohack/venom/blob/main/hooks/harden.h): `hooks/harden.h`
- [Mount Blocking](https://github.com/trevohack/venom/blob/main/hooks/mounts.h): `hooks/mounts.h`
- [Module Load Control](https://github.com/trevohack/venom/blob/main/hooks/insmod.h): `hooks/insmod.h`
- [Signal Control](https://github.com/trevohack/venom/blob/main/hooks/kill.h): `hooks/kill.h`
- [Device Ioctl Protection](https://github.com/trevohack/venom/blob/main/hooks/ioctl.h): `hooks/ioctl.h`
- [Anti Debugging](https://github.com/trevohack/venom/blob/main/hooks/ptrace.h): `hooks/ptrace.h`

### Network Controls

- [Proc Network Filtering](https://github.com/trevohack/venom/blob/main/hooks/network.h): `hooks/network.h`
- [Packet Filtering](https://github.com/trevohack/venom/blob/main/hooks/network.h): `hooks/network.h`
- [Socket Logging](https://github.com/trevohack/venom/blob/main/hooks/socket.h): `hooks/socket.h`

### Logging and Monitoring

- [Command Logging](https://github.com/trevohack/venom/blob/main/hooks/prinT.h): `hooks/prinT.h`
- [Memory Access Monitoring](https://github.com/trevohack/venom/blob/main/hooks/process_vm.h): `hooks/process_vm.h`
- [Kernel Hardening](https://github.com/trevohack/venom/blob/main/hooks/kexec_load.h): `hooks/kexec_load.h`

### Other components

- **Host Process**
- **Linux Kernel**

## Connections

- Host Process → Linux Kernel: issues syscalls
- Host Process → Venom Module: loads module
- Venom Module → Runtime Configuration: initializes config
- Venom Module → Ftrace Dispatcher: installs hooks
- Venom Module → PID Hiding: initializes hiding
- Venom Module → ARM64 Hooking: supports ARM64
- Linux Kernel → Ftrace Dispatcher: enters symbols
- Ftrace Dispatcher → Output Interception: dispatches writes
- Ftrace Dispatcher → Input Interception: dispatches reads
- Ftrace Dispatcher → Directory Filtering: dispatches listings
- Ftrace Dispatcher → Filesystem Protection: dispatches filesystem
- Ftrace Dispatcher → Mount Blocking: dispatches mounts
- Ftrace Dispatcher → Module Load Control: dispatches modules
- Ftrace Dispatcher → Signal Control: dispatches signals
- Ftrace Dispatcher → Device Ioctl Protection: dispatches ioctls
- Ftrace Dispatcher → Anti Debugging: dispatches tracing
- Ftrace Dispatcher → Proc Network Filtering: dispatches proc views
- Ftrace Dispatcher → Packet Filtering: dispatches packets
- Ftrace Dispatcher → Socket Logging: dispatches sockets
- Ftrace Dispatcher → Memory Access Monitoring: dispatches memory access
- Ftrace Dispatcher → Kernel Hardening: dispatches kernel actions
- Output Interception → Linux Kernel: falls through writes
- Input Interception → Linux Kernel: falls through reads
- Directory Filtering → Linux Kernel: reads directory data
- Filesystem Protection → Linux Kernel: blocks or continues
- Module Load Control → Linux Kernel: allows or blocks
- Proc Network Filtering → Linux Kernel: filters proc output
- Packet Filtering → Linux Kernel: drops packets
- Command Logging → Linux Kernel: logs commands
- Runtime Configuration → Proc Network Filtering: sets hidden network
- Runtime Configuration → Directory Filtering: sets hidden prefixes
- Runtime Configuration → Signal Control: sets magic signal
