惡意軟件和後門檢測Shell腳本


5

我正在嘗試構建一個外殼腳本,該腳本可以自動檢測惡意軟件,後門程序和rootkit,並且正在嘗試對其進行研究。我發現了

之類的東西
find . -name “*.js” | xargs grep -l “eval(unescape”
find . -name “*.php” | xargs grep -l “eval(base64_decode” 

但是我沒有找到僅與查找.php和.js文件相關的內容,並嘗試查看它是否包含惡意軟件​​。任何人都可以幫助我給出一個我可以用於該腳本的一般概念,以便它可以完成惡意軟件,後門程序和Rootkit檢測的工作。更準確地說,是如何在ubuntu系統上找到這些惡意軟件,後門程序和rootkit。謝謝。

6

You ask about 3 different things...

  1. Root kits;
  2. Backdoors;
  3. Malware.

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:

  • Examine log files for connections from unusual locations or other unusual activity
  • Look for setuid and setgid files (especially setuid root files) everywhere on your system

    find / -user root -perm -4000 -print
    find / -group kmem -perm -2000 -print
    
  • Check your system binaries to make sure that they haven't been altered.

  • Examine all the files that are run by 'cron' and 'at.'
  • Check for unauthorized services.
  • Examine the /etc/passwd file on the system and check for modifications to that file.
  • Check your system and network configuration files for unauthorized entries.
  • Look everywhere on the system for unusual or hidden files (files that start with a period and are normally not shown by 'ls').

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...

  1. immediately install security updates when you're notified;
  2. do not install antivirus, as you really don't need it in Linux; unless you share files with Windows
  3. enable the firewall (sudo ufw enable) without further tweaks;
  4. stick to the official repo's as much as possible, and only deviate from them when strictly necessary and with much caution;
  5. keep Java (both openJDK and Oracle Java) disabled by default in your browser, and only enable it when needed;
  6. use Wine with caution;
  7. and most important of all: use your common sense. The biggest security threat is generally found between keyboard and chair.

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: