日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux 被***后的检查

發布時間:2025/3/19 linux 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux 被***后的检查 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Linux 被***后的檢查

1. 檢查用戶登錄記錄

[root@sky]# more /var/log/secure ? ??<==安全信息和系統登錄與網絡連接的信息

[root@sky]#?who /var/log/wtmp ??<==查看哪些用戶在什么時間通過什么IP登錄到本機


2.?檢查網絡連接和監聽端口

[root@sky]# ?netstat -an?? ? ? ? #列出本機所有的連接和監聽的端口,查看有沒有非法連接

[root@sky]#??netstat -rn??? ? ? #查看本機的路由、網關設置是否正確

[root@sky]#??ifconfig –a?? ? ? ? #查看網卡設置

3. 檢查帳戶

[root@sky]#?less /etc/passwd

[root@sky]#?grep :0: /etc/passwd ? ? ? ?#檢查是否產生了新用戶,和UID、GID是0的用戶

[root@sky]#?ls -l /etc/passwd ? ? ? ? #查看文件修改日期

[root@sky]#?awk -F: ‘$3= =0 {print $1}’ /etc/passwd ? ? ? ? #查看是否存在特權用戶

[root@sky]#awk -F: ‘length($2)= =0 {print $1}’ /etc/shadow ? ? ? ? ?#查看是否存在空口令帳戶

?

4. 檢查日志

[root@sky]#?last ? ? ? ??#查看正常情況下登錄到本機的所有用戶的歷史記錄

注意”entered promiscuous mode”

注意錯誤信息

注 意Remote Procedure Call (rpc) programs with a log entry that includes a large number (> 20) strange characters(-^PM-^PM-^PM-^PM-^PM-^PM-^PM-^PM)

?

5. 檢查進程

[root@sky]#?ps -aux ? ??#注意UID是0的

[root@sky]#?lsof -p pid ? ? ??#察看該進程所打開端口和文件

[root@sky]#?cat /etc/inetd.conf | grep -v “^#” ??? ?#檢查守護進程

檢查隱藏進程

[root@sky]#?ps -ef|awk ‘{print }’|sort -n|uniq >1

[root@sky]#?ls /porc |sort -n|uniq >2

[root@sky]#?diff 1 2

?

6. 檢查文件

[root@sky]#?find / -uid 0 –perm -4000 –print

[root@sky]#?find / -size +10000k –print

[root@sky]#?find / -name “…” –print

[root@sky]#?find / -name “.. ” –print

[root@sky]#?find / -name “. ” –print

[root@sky]#?find / -name ” ” –print

注意SUID文件,可疑大于10M和空格文件

[root@sky]#?find / -name core -exec ls -l {} ; ? ? ??#檢查系統中的core文件

檢查系統文件完整性

[root@sky]#?rpm –qf /bin/ls

[root@sky]#?rpm -qf /bin/login

[root@sky]#?md5sum –b 文件名

[root@sky]#?md5sum –t 文件名

?

7. 檢查RPM

[root@sky]#?rpm –Va

輸出格式:

S – File size differs

M – Mode differs (permissions)

5 – MD5 sum differs

D – Device number mismatch

L – readLink path mismatch

U – user ownership differs

G – group ownership differs

T – modification time differs

注意相關的 /sbin, /bin, /usr/sbin, and /usr/bin

?

8. 檢查網絡

[root@sky]#?ip link | grep PROMISC ? ???#正常網卡不該在promisc模式,可能存在sniffer

[root@sky]#?lsof –i

[root@sky]#?netstat –nap?? ? #察看不正常打開的TCP/UDP端口

[root@sky]# arp –a

?

9. 檢查計劃任務

注意root和UID是0的schedule

[root@sky]#?crontab –u root –l

[root@sky]#?cat /etc/crontab

[root@sky]#?ls /etc/cron.*

?

10. 檢查后門

[root@sky]#?cat /etc/crontab

[root@sky]#?ls /var/spool/cron/

[root@sky]#?cat /etc/rc.d/rc.local

[root@sky]#?ls /etc/rc.d

[root@sky]#?ls /etc/rc3.d

[root@sky]#?find / -type f -perm 4000

?

11. 檢查內核模塊

[root@sky]#?lsmod

?

12. 檢查系統服務

[root@sky]#?chkconfig

[root@sky]#?rpcinfo -p ? ?#查看RPC服務

?

13. 檢查rootkit

linux下rootkit檢測掃描工具rootkit hunter的安裝使用

安裝 rkhunter:

安裝 rkhunter 其實真的很簡單!首先,您必須前往下載網頁進行下載,下載點:http://www.rootkit.nl/projects/rootkit_hunter.html

在該網頁的最下方有個 downloads ,請選擇最新版本來下載。也可以直接使用命令下載:

[root@test root]#wget?http://downloads.sourceforge.net/rkhunter/rkhunter-1.4.2.tar.gz?use_mirror=jaist

# 此時會產生生一個名為?rkhunter 的目錄!

[root@test root]#tar -zxvf rkhunter-1.3.4.tar.gz

解壓編譯

[root@test root]#cd rkhunter-1.3.4

[root@test root]#./installer.sh --layout default --install

# 此時會產生一新目錄 /usr/local/rkhunter

# 該目錄內含有一些本系統的重要資料,例如 md5 編碼的資料等等。

# 另外,檢測程式會放置在 /usr/local/bin/rkhunter

檢測系統:

[root@test root]#?rkhunter -checkall

Rootkit Hunter 1.1.8 is running

Determining OS... Ready

?

# 第一部份,先進行 binary 的檢測,包括 MD5 的檢測

Checking binaries

* Selftests

???? Strings (command)??????????????????????????????????????? [ OK ]

* System tools

? Performing 'known good' check...

?? /sbin/ifconfig???????????????????????????????????????????? [ OK ]

....(略)....

?? /sbin/runlevel???????????????????????????????????????????? [ OK ]

[Press? to continue]????? 這里按下 Enter 才能繼續!

# 在第一部份的檢測當中,主要的工作就是在檢驗一些系統重要的 binary files,

# 這些檔案就是常被 root kit 程式包***的范圍!所以首先就得要檢測

# 接下來進行第二部分的檢測

Check rootkits

* Default files and directories

?? Rootkit '55808 Trojan - Variant A'...????????????????????? [ OK ]

?? ADM Worm...??????????????????????????????????????????????? [ OK ]

....(略)....

?? Rootkit 'zaRwT.KiT Rootkit'...???????????????????????????? [ OK ]

?

* Suspicious files and malware

?? Scanning for known rootkit strings???????????????????????? [ OK ]

....(略)....

?? Sniffer logs?????????????????????????????????????????????? [ OK ]

?

[Press? to continue]????? 這里按下 Enter 才能繼續

# 第二部分就是在檢測常見的 rootkit 程式包所造成的系統傷害

# 這部分的檢測當然就是針對各個常見的 rootkit ***的檔案/目錄來偵測

# 接下來是第三部分的檢測

* Trojan specific characteristics

?? shv4

???? Checking /etc/rc.d/rc.sysinit

?????? Test 1???????????????????????????????????????????????? [ Clean ]

....(略)....

???? Checking /etc/xinetd.conf??????????????????????????????? [ Clean ]

?

* Suspicious file properties

?? chmod properties

???? Checking /bin/ps???????????????????????????????????????? [ Clean ]

....(略)....

???? Checking /bin/login????????????????????????????????????? [ Clean ]

?

* OS dependant tests

?? Linux

???? Checking loaded kernel modules...??????????????????????? [ OK ]

???? Checking files attributes??????????????????????????????? [ OK ]

???? Checking LKM module path???????????????????????????????? [ OK ]

?

Networking

* Check: frequently used backdoors

? Port 2001: Scalper Rootkit????????????????????????????????? [ OK ]

? Port 60922: zaRwT.KiT?????????????????????????????????????? [ OK ]

?

* Interfaces

???? Scanning for promiscuous interfaces????????????????????? [ OK ]

?

[Press? to continue]????? 這里按下 Enter 才能繼續

# 第三部分在檢測***以及可疑的檔案屬性

# 當然,因為***程式可能會開后門,所以網路服務(port)也在這里檢測

# 同時還包含核心模組等等的檢測

#再來則是第四部分

System checks

* Allround tests

?? Checking hostname... Found. Hostname is test.vbird.tw

?? Checking for passwordless user accounts... OK

?? Checking for differences in user accounts...?????????????? [ NA ]

?? Checking for differences in user groups... Creating file It seems

??????????? this is your first time.

?? Checking boot.local/rc.local file...

???? - /etc/rc.local????????????????????????????????????????? [ OK ]

???? - /etc/rc.d/rc.local???????????????????????????????????? [ OK ]

???? - /usr/local/etc/rc.local??????????????????????????????? [ Not found ]

....(略)....

* Filesystem checks

?? Checking /dev for suspicious files...????????????????????? [ OK ]

?? Scanning for hidden files...?????????????????????????????? [ OK ]

?

[Press? to continue]????? 這里按下 Enter 才能繼續

# 第四部分主要在進行系統開機與相關服務的檢測

# rc.local 與 password/accounts 的檢測都會在這里進行檢查

# 此外,在 /dev 裡面也會檢查是否有被影響的檔案

#接下來是第五部分

Application advisories

* Application scan

?? Checking Apache2 modules ...?????????????????????????????? [ Not found ]

?? Checking Apache configuration ...????????????????????????? [ OK ]

?

* Application version scan

?? - GnuPG 1.2.1????????????????????????????????????????????? [ Vulnerable ]

?? - Bind DNS [unknown]?????????????????????????????????????? [ OK ]

?? - OpenSSL 0.9.7a?????????????????????????????????????????? [ Vulnerable ]

?? - Procmail MTA 3.22??????????????????????????????????????? [ OK ]

?? - OpenSSH 3.7.1p2????????????????????????????????????????? [ Unknown ]

?

Security advisories

* Check: Groups and Accounts

?? Searching for /etc/passwd...?????????????????????????????? [ Found ]

?? Checking users with UID '0' (root)...????????????????????? [ OK ]

?

* Check: SSH

?? Searching for sshd_config...

?? Found /etc/ssh/sshd_config

?? Checking for allowed root login...??????? [ OK (Remote root login disabled) ]

?? Checking for allowed protocols...???????? [ OK (Only SSH2 allowed) ]

?

* Check: Events and Logging

?? Search for syslog configuration...???????????????????????? [ OK ]

?? Checking for running syslog slave...?????????????????????? [ OK ]

?? Checking for logging to remote system...? [ OK (no remote logging) ]

?

[Press? to continue]????? 這里按下 Enter 才能繼續

# 第五部分在檢查一些常見的服務的套件版本!

# 因為僅檢查版本資訊而已,并沒有針對可能的漏洞去***,

# 所以,這裡的資訊有可能是誤判的,不要懷疑

# 我的 OpenSSL 0.9.7a 是已經經過官方 patch 的版本,也就是說,

# 他已經封住漏洞了,但是這裡卻顯示有問題!原因就是這樣啦!

?

---------------------------- Scan results ----------------------------

MD5

MD5 compared: 51

Incorrect MD5 checksums: 0

?

File scan

Scanned files: 328

Possible infected files: 0

?

Application scan

Vulnerable applications: 2

?

Scanning took 114 seconds

-----------------------------------------------------------------------

# 最后這里是作一個輸出的總結!我們可以在這里看到

# 最終的簡單資料,透過這個資料,可以了解系統目前的狀態


轉載于:https://blog.51cto.com/9592318/1626647

總結

以上是生活随笔為你收集整理的Linux 被***后的检查的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。