Nelesh:
Be advised that this particular hack is NOT a server compromise
but rather an infected client. You should contact whoever owns
the account where the index files have been modified and let them
know that their home computer is infected with a pretty dangerous
trojan that records the keystrokes on their computer and captures
their passwords so that hackers in China can access their hosting
and (bad news) bank accounts.
They have been compromised for sure if someone has already
logged into their web hosting account and updated the index files
and they need to update their virus scanner with the latest updates
and perform a full system scan and also get a "good" spyware
detection program such as Spyware Doctor from PCTools.
A note to logicsupport:
The cleanup script is a nice idea but I would search for the proxy port
instead (:8080) of the URL as it is not likely to show up in regular home pages
and thus far has stayed consistent in hacked files on various servers while the
URL link frequently changes
Script for cronjob for general detection for this:
Code:
#!/bin/bash
IFS="$"
# Change to your administrator email address
ALERT="root"
# Location of Log file
HLOG="/var/log/china-hack.log"
# Location of temporary test report
TLIST="/tmp/hack-test.$$"
# --------------------------------------------------
# Begin main China Hack Detection Script
# --------------------------------------------------
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment for cron job
typeset -i TCOUNT=0
PATH=$PATH:$HOME/bin:.
export PATH
cd /home
if [ -e ${TLIST} ]; then
rm -f ${TLIST}
fi
ls /var/cpanel/users | while read MUSER; do
find ./${MUSER}/public_html -type f -mtime -30 -name 'index.php' -o -name 'index.html' -o -name 'index.htm' >> ${TLIST}
done
cat ${TLIST} | while read HFILE; do
TCOUNT=$(grep -c ':8080' ${HFILE})
if [ ${TCOUNT} -gt 0 ]; then
sed -i'.hack' "/"8080"/d" "${HFILE}"
echo "$(date) ${HFILE}" >> ${HLOG}
echo "${TCOUNT} ${HFILE}"
echo "Potential China hack found in ${HFILE}" | mail -s "Alert: Potential China Hack Detected" '${ALERT}'
fi
TCOUNT=0
done
if [ -e ${TLIST} ]; then
rm -f ${TLIST}
fi
#End of Script