I'm trying to build a shell script which can automatically detect malware, backdoors and rootkits and I'm trying to research for it. I found some of the things like
find . -name “*.js” | xargs grep -l “eval(unescape”
find . -name “*.php” | xargs grep -l “eval(base64_decode”
But I dont find only these relevant to just find for .php and .js files and try to see if it consists of malware. Can anyone please help me to give a general idea that I can use for the script so that it can do the work of malware, backdoors and rootkits detection. More precisely to say how can one find these malwares, backdoors and rootkits on a ubuntu system. Thanks.
You ask about 3 different things...
Root kits
Most root kits use the kernel to hide themselves and they are only visible from within the kernel.
If you want to know how to find them why not use the power of open source and install
rkhunter
and see how they do it? You can find the source here.Besides that CERT has a thorough explanation on what to look for when dealing with root kits. Highlights from the link:
Look for setuid and setgid files (especially setuid root files) everywhere on your system
Check your system binaries to make sure that they haven't been altered.
Most of these you can do from command line.
Also worth reading:
Backdoors
The problem with backdoors is that they generally are flaws in software that get abused. The basic set of rules...
Worth reading:
Malware
Scan
/etc/hosts
for weird IP adresses and host names. If you look at these:either a browser extension or an alteration to
/etc/hosts
is the cause.Also a good read is: