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:

November 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close