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

uname_lkm.c

uname_lkm.c
Posted Jul 26, 2004
Authored by Bugghy | Site vaida.bogdan.googlepages.com

Linux kernel module that will fake uname output for the 2.4 kernel series.

tags | kernel
systems | linux
SHA-256 | d20de33de4d5fa22a3db75f01fb41451871e54126d92a933a2f391636e6d7d5a

uname_lkm.c

Change Mirror Download
//                      uname faker
// v1.0a (24 Jul)
// by bugghy (bugghy@rootshell.be)

// Kernel module used to fake uname output for 2.4 kernels

// gcc -isystem /lib/modules/`uname -r`/build/include -O2 -DMODULE -D__KERNEL__ -c uname.c
// insmod uname.o

// You can add an -EFAULT return in case the buffer got corrupted (man 2 uname)

// Uses:
// 1. fun
// 2. start lkm programming
// 3. recompile a new kernel without shellusers noticing

#if CONFIG_MODVERSIONS==1 // was it defined in kernel ?
#define MODVERSIONS
#include <linux/modversions.h>
#endif

#include <linux/kernel.h> // we're in kernel mode
#include <linux/module.h> // we code a module
#include <sys/syscall.h> // syscall table
#include <sys/utsname.h> // struct utsname
#include <asm/uaccess.h> // copy_to_user

MODULE_AUTHOR("bugghy");
MODULE_DESCRIPTION("uname faker");
MODULE_LICENSE("Dual BSD/GPL");


#define SYSNAME "Plan9"
#define NODENAME "hellboy"
#define RELEASE "0.0.0"
#define VERSION "#0 Fri Aug 13 13:13:13 PPP 6969"
#define MACHINE "x0w33d"

extern void *sys_call_table[];

int (*o_uname) (struct utsname *buf);

int h_uname(struct utsname *buf){

int x;

x = o_uname(buf);

#ifdef SYSNAME
copy_to_user(buf->sysname, SYSNAME, sizeof buf->sysname);
#endif

#ifdef NODENAME
copy_to_user(buf->nodename, NODENAME, sizeof buf->nodename);
#endif

#ifdef RELEASE
copy_to_user(buf->release, RELEASE, sizeof buf->release);
#endif

#ifdef VERSION
copy_to_user(buf->version, VERSION, sizeof buf->version);
#endif

#ifdef MACHINE
copy_to_user(buf->machine, MACHINE, sizeof buf->machine);
#endif

return x;
}

int init_module(void) // replace original uname with hacked one
{
o_uname = sys_call_table[SYS_uname];
sys_call_table[SYS_uname] = h_uname;
return 0;
}

void cleanup_module(void) // replace hacked uname with original one
{
sys_call_table[SYS_uname] = o_uname;
}

Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 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