| .. | |||
| Makefile | 5 years ago | ||
| README.md | 5 years ago | ||
| ftrace_helper.h | 5 years ago | ||
| random.png | 5 years ago | ||
| rootkit.c | 5 years ago | ||
/dev/random and /dev/urandomBoth /dev/random and /dev/urandom are character devices defined in drivers/char/random.c. In particular, we care about the random_fops and urandom_fops structs which tell us which functions are to be called whenever a process tries to read/write/seek/etc the random and urandom "files".
Line 1989 onwards tells us that random_read() and urandom_read() are responsible.
The function hooks only have to call the original read functions, fill a buffer with 0x00, then copy back this buffer into userspace. All this is achieved with copy_from_user() and copy_to_user().
To use:
makeinsmod rootkit.ko/dev/random with dd if=/dev/random bs=1 count=128 | xxd/dev/urandom with dd if=/dev/urandom bs=1 count=128 | xxd0x00!rmmod rootkit