evolve or die

sexy-socket.c

sexy-socket.c
Posted Oct 30, 2003
Authored by DownBload | Site ii-labs.org

Sexy-SOCKET v0.1 is a Linux LKM which restricts creation of AF_INET sockets to the root account only. Works on kernels v2.2.x and 2.4.x.

tags | kernel, root
systems | linux
MD5 | 2b734c7c8f206fa99ac2281d200c7877

sexy-socket.c

Change Mirror Download
/*
Sexy-SOCKET v0.1
~~~~~~~~~~~~~~~~
This LKM will provide AF_INET sockets only to root account.
It is created for w4rcr0 wargame (http://www.ii-labs.org/wargame/).
Sexy-SOCKET will work on 2.2.x and 2.4.x kernels.
Coded by DownBload <downbload@hotmail.com> \
Illegal Instruction Labs <www.ii-labs.org>
*/

#define MODULE
#define __KERNEL__
#include <linux/kernel.h>
#include <linux/module.h>
#include <asm/errno.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <asm/unistd.h>
#include <asm/uaccess.h>

extern void *sys_call_table[];

int (*origsock)(int call, unsigned long *args);

// STOLEN KERNEL SOURCE
#define AL(x) ((x) * sizeof(unsigned long))
static unsigned char nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
AL(3),AL(3),AL(4),AL(4),AL(4),AL(6),
AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)};
// END OF KERNEL SOURCE

int *hacksock(int call, unsigned long *args)
{
// STOLEN KERNEL SOURCE
unsigned long a[6];
unsigned long a0,a1;
int err;

if(call<1||call>SYS_RECVMSG)
return -EINVAL;

/* copy_from_user should be SMP safe. */
if (copy_from_user(a, args, nargs[call]))
return -EFAULT;
a0=a[0];
a1=a[1];
// END OF KERNEL SOURCE
if ((current->uid != 0) && (call == SYS_SOCKET) && (a0 == AF_INET))
return -1;
else
return origsock (call,args);
}


int init_module (void)
{
origsock = sys_call_table[__NR_socketcall];
sys_call_table[__NR_socketcall] = hacksock;
return 0;
}


void cleanup_module(void)
{
sys_call_table[__NR_socketcall] = origsock;
}

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

May 2012

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2012 Packet Storm. All rights reserved.

close