awesome-linux-rootkits/details/reptile.md

54 lines
1.5 KiB
Markdown
Raw Normal View History

2018-07-02 15:20:13 +00:00
# Reptile kernel rootkit details
https://github.com/f0rb1dd3n/Reptile
2018-07-02 16:14:03 +00:00
## Environment
- Linux kernel 2.6.x/3.x/4.x
- x86 (`sys_call_table` search method is x86-only)
## Persistency
Boot-time module loading using OS-specific startup files:
2018-07-02 16:17:31 +00:00
- /etc/modules (debian/ubuntu)
- /etc/rc.modules (redhat/centos/fedora)
2018-07-02 16:14:03 +00:00
## Detection evasion
Rootkit is trying to evade from detection by:
2018-07-02 16:17:31 +00:00
- hiding files by name
2018-07-02 16:14:03 +00:00
- tampering contents of startup files while reading
2018-07-02 16:17:31 +00:00
- hiding kernel module by unlinking from `module_list`
2018-07-02 16:14:03 +00:00
## Management interface
Implemented via `kill(2)` by hooking `sys_call_table[__NR_kill]` entry. Supported commands are:
- hiding/unhiding processes
- hiding/unhiding rootkit's module
- enabling/disabling of tampering file content function
- gaining root priveleges to calling process
2018-07-02 16:17:54 +00:00
## Altering system behaviour
2018-07-02 16:14:03 +00:00
2018-07-02 16:17:31 +00:00
Hooking of system calls by patching syscall-handlers in `sys_call_table[]`:
- to write to read-only page `CR0/WP` technique used (x86-only)
2018-07-02 16:14:03 +00:00
## Hiding (tampering) of file contents
Filtering of file content while reading by hooking:
2018-07-02 16:17:31 +00:00
- `sys_call_table[__NR_read]`
2018-07-02 16:14:03 +00:00
## Hiding of files and directories
Filtering of directory entries by hoocking:
2018-07-02 16:17:31 +00:00
- `sys_call_table[__NR_getdents]`
- `sys_call_table[__NR_getdents64]`
2018-07-02 16:14:03 +00:00
## Hiding of processes and process trees
Filtering PID-like numeric entries while listing `/proc`.
Hidden tasks are marked using `task->flags \| 0x10000000`.
Not able to hide all threads and children of hidden (parent) process.