rootkit的检测

rootkit 后门的介绍

http://blog.chinaunix.net/uid-9278836-id-2005722.html

在官方的资料当中,rootkit hunter可以作的事情包括:侦测rootkit 程序、侦测后门程序、以及主机端的套件检查问题。

記得我們在 基礎學習篇 裡面有提到那個 MD5 的東西吧?簡單的來說,每個檔案都有自己的指紋資料,這個指紋資料是利用雜湊演算的方式來得到一組 MD5 編碼,當這個檔案被更動過,那怕是只改了一個字元,而整個檔案的容量大小不變, 他的 MD5 編碼還是會不同的。因此,若我們在系統安裝完畢之後,立即建立重要檔案的 MD5 資料庫, 然後再以分析工具定期去分析該重要檔案的 MD5 編碼,若有不同,則顯示該檔案被變動過, 此時自然就需要瞭解瞭解為何會被更動了。

利用這個特性, rkhunter 在釋出的時候,就已經收集了各大知名的 Linux distributions 的重要檔案的 MD5 編碼(例如 login, ls, ps, top, w 等等檔案), 並製作成資料庫,然後,當我們安裝好了 rkhunter 並且執行之後, 他就會利用原本資料庫的資料去與我們系統的相關檔案進行比對, 若比對的結果有問題,則會顯示警示文字,提供系統管理員分析。

官方下载:

Project: http://www.rootkit.nl/projects/rootkit_hunter.html
download: http://downloads.sourceforge.net/rkhunter/rkhunter-1.4.2.tar.gz?use_mirror=jaist

解压安装:

解压
#tar -zxvf rkhunter-1.3.4.tar.gz
安装
#cd rkhunter-1.3.4
#./installer.sh -h
Usage: ./installer.sh <parameters>
Ordered valid parameters:
--help (-h)      : 显示帮助
--examples       : 显示安装实例
--layout <value> : 选择安装模板(安装必选参数).
                   模板选择:
                    - default: (FHS compliant),
                    - /usr,
                    - /usr/local,
                    - oldschool: 之前版本安装路径,
                    - custom: 自定义安装路径,
                    - RPM: for building RPM's. Requires $RPM_BUILD_ROOT.
                    - DEB: for building DEB's. Requires $DEB_BUILD_ROOT.
--striproot      : Strip path from custom layout (for package maintainers).
--install        : 根据选择目录安装
--show           : 显示安装路径
--remove         : 卸载rkhunter
--version        : 显示安装版本

我使用的安装指令:

#./installer.sh --layout default --install

rkhunter操作:

#/usr/local/bin/rkhunter --propupd
#/usr/local/bin/rkhunter -c --sk --rwo

#/usr/local/bin/rkhunter --checkall

结果就是“中招”,基本上就是重新安装系统的命了。不过从检查的结果来看,可以判断所中的rootkit的类型和被替换的系统文件。同时对一些程序版本进行检测,提供的信息比较多。

指令参数说明:


/usr/local/bin/rkhunter
Usage: rkhunter {--check | --update | --versioncheck |
                 --propupd [{filename | directory | package name},...] |
                 --list [{tests | {lang | languages} | rootkits},...] |
                 --version | --help} [options]
Current options are:
         --append-log                  在日志文件后追加日志,而不覆盖原有日志
         --bindir <directory>...       Use the specified command directories
     -c, --check                       检测当前系统
  --cs2, --color-set2                  Use the second color set for output
         --configfile <file>           使用特定的配置文件
         --cronjob                     作为cron定期运行
                                       (包含参数 -c, --sk , --nocolors )
         --dbdir <directory>           Use the specified database directory
         --debug                       Debug模式(不要使用除非要求使用)
         --disable <test>[,<test>...]  跳过指定检查对象(默认为无)
         --display-logfile             在最后显示日志文件内容
         --enable  <test>[,<test>...]  对指定检测对象进行检查
                                       (默认检测所有对象)
         --hash {MD5 | SHA1 | NONE |   使用指定的文件哈希函数
                 <command>}            (Default is SHA1)
     -h, --help                        显示帮助菜单
 --lang, --language <language>         指定使用的语言
                                       (Default is English)
         --list [tests | languages |   罗列测试对象明朝,使用语言,可检测的木马程序
                 rootkits]            
     -l, --logfile [file]              写到指定的日志文件名
                                       (Default is /var/log/rkhunter.log)
         --noappend-log                不追加日志,直接覆盖日志文件
         --nocolors                    输出只显示黑白两色
         --nolog                       不写入日志文件
--nomow, --no-mail-on-warning          如果有警告信息,不发送邮件
   --ns, --nosummary                   不显示检查结果的统计数据
 --novl, --no-verbose-logging          不显示详细记录
         --pkgmgr {RPM | DPKG | BSD |  使用特定的包管理用于文件的哈希值验证
                   NONE}               (Default is NONE)
         --propupd [file | directory | 更新整个文件属性数据库或仅仅更新指定条目
                    package]...       
     -q, --quiet                       安静模式(no output at all)
  --rwo, --report-warnings-only        只显示警告信息
     -r, --rootdir <directory>         使用指定的root目录
   --sk, --skip-keypress               自动完成所有检测,跳过键盘输入
         --summary                     显示检测结果的统计信息
                                       (This is the default)
         --syslog [facility.priority]  记录检测启动和结束时间到系统日志中
                                       (Default level is authpriv.notice)
         --tmpdir <directory>          使用指定的临时目录
         --update                      检测更新内容
   --vl, --verbose-logging             使用详细日志记录 (on by default)
     -V, --version                     显示版本信息
         --versioncheck                检测最新版本
     -x, --autox                       当X在使用时,自动启动检测
     -X, --no-autox                    当X在使用时,不自启检测

有了rootkit hunter,侦测 rootkit 程序、侦测后门程序、以及主机端的套件检查问题就变得简单了,很多时候,rootkit hunter可以自动帮我们完成这些复杂的工作。

还有对WEB 目录木马的扫描推荐用hm的

下载地址:http://www.shellpub.com

详细地址看他们官网的。

https://www.cnblogs.com/ichunqiu/p/5736540.html

 

posted @ 2018-04-19 11:50  屌丝的IT  阅读(367)  评论(0)    收藏  举报