https://github.com/f0rb1dd3n/Reptile
- x86, x86_64
- Linux kernel 2.6.x/3.x/4.x
- Debian/Ubuntu, RHEL/CentOS/Fedora
Boot-time module loading using OS-specific startup files:
- /etc/modules (debian/ubuntu)
- /etc/rc.modules (redhat/centos/fedora)
Rootkit is trying to evade from detection by:
- hiding files by name
- tampering contents of startup files while reading
- hiding kernel module by unlinking from
modules
-list
Implemented via kill(2)
:
- hook
sys_call_table[__NR_kill]
Supported commands are:
- hiding/unhiding processes
- hiding/unhiding rootkit's module
- enabling/disabling of tampering file content function
- gaining root priveleges to calling process
Hooking of system calls by patching syscall-handlers in sys_call_table[]
:
- to write to read-only page
CR0/WP
technique used (x86-only) - netfilter hook (
NF_IP_PRI_FIRST
)
Filtering of file content while reading:
- hook
sys_call_table[__NR_read]
Filtering of directory entries:
- hook
sys_call_table[__NR_getdents]
- hook
sys_call_table[__NR_getdents64]
Filtering PID-like numeric entries while listing /proc
:
- getdents/getdents64 hook used
- hidden tasks are marked using
task->flags
(bit0x10000000
)
Reverse shell spawning by port-knocking-like technique:
- magic packet with token used (
ICMP/UDP/TCP
) - spawning root-shell connection to remote host