
Linux kernel integrity monitor for detecting syscall hooking
ksentinel monitors critical kernel functions and the syscall table for unauthorized modifications. It detects common syscalls that are targeted by most rootkits including ftrace hooks, kprobes, and syscall table hijacking.
NOTE: ksentinel is in its initial version; more improvements will come in future commits.
VFS Layer:
Network Stack:
Credentials:
Module System:
Tracing Infrastructure:
Plus 500+ additional syscall wrappers via prefix matching.
make
During compilation, a random 32-character unlock key is generated and displayed. Write it down immediately. This key is embedded in the compiled module and is not stored externally.
Keep it secure if anti-unload protection is enabled.
sudo make install
The module loads hidden from lsmod with anti-unload protection enabled by default.
sudo insmod ksentinel.ko
sudo ./ksentinel-manager.sh load # load module
sudo ./ksentinel-manager.sh status # check status
sudo ./ksentinel-manager.sh watch # monitor live
sudo ./ksentinel-manager.sh violations # view alerts
dmesg -wT | grep ksentinel
When anti-unload is enabled, the module must be unlocked before removal:
echo "your_32char_key" > /proc/.ksctl
Or use the manager:
sudo ./ksentinel-manager.sh unlock
sudo rmmod ksentinel
Example with custom parameters:
sudo insmod ksentinel.ko period_ms=5000 anti_unload=false
ksentinel performs periodic integrity checks based on the period_ms parameter.
Lower intervals provide faster detection but increase CPU usage. Default interval (2000ms) has minimal impact on modern systems.
ksentinel: [CHANGE - HOOK PATTERN] sys_getdents64 @ 0xffffffff81234567
baseline=1234567890abcdef current=fedcba0987654321
bytes: e9 ab cd ef 12 90 90 90 ...
flags: JMP/CALL_DETECTED ENDBR64_PREFIX
ksentinel: [SCT HOOK] syscall[78] expected=0xffffffff81111111 got=0xffffffffa0222222 (fake_getdents+0x0)
ksentinel: [LSTAR TAMPERED] baseline=0xffffffff81800000 now=0xffffffffa0300000 (evil_syscall_entry+0x0)
ksentinel can detect modifications made by:
Detection depends on loading ksentinel before the rootkit.
Kernel Configuration:
Supported Kernels:
Check kernel configuration:
grep -E "KALLSYMS|KPROBES" /boot/config-$(uname -r)
The module is hidden with anti-unload protection. Unlock first:
sudo ./ksentinel-manager.sh unlock
make clean # clean build artifacts
make # compile module
make install # load module
make uninstall # unload module
Contributions welcome. Maintain code style and add tests for new features.
GPL-2.0-only
This program is free software licensed under GPL version 2.0. Any modifications must preserve attribution to the original author and be distributed under the same license.
See LICENSE file for full terms.
MatheuZSecurity
Rootkit Researchers community: https://discord.gg/66N5ZQppU7
This tool is for security research and system administration. Use responsibly. The author is not responsible for misuse or damage caused by this software.
| Parameter | Type | Default | Description |
|---|
| period_ms | uint | 2000 | Integrity check interval in milliseconds |
| sym_prefixes | string | "sys_,x64_sys,do_sys,ksys_" | Comma-separated symbol prefixes to monitor |
| extra_syms | string | "" | Additional specific symbols to watch |
| anti_unload | bool | true | Enable anti-unload protection |