11 methods to check Linux for intrusion

Source: Internet
Author: User
This article mainly introduces 11 methods to check whether Linux has been infiltrated. they are all checked by some linux commands. For more information, see

This article collects and sorts out some methods for reviewing Linux System Intrusion. these methods can be added to your routine O & M inspection.

1. check the account

Copy codeThe code is as follows:
# Less/etc/passwd

# Grep: 0:/etc/passwd (check whether a new user is generated, and the UID and GID are 0)

# Ls-l/etc/passwd (view the file modification date)

# Awk-F: '$3 = 0 {print $1}'/etc/passwd (check whether a privileged user exists)

# Awk-F: 'length ($2) = 0 {print $1} '/etc/shadow (check whether an empty password account exists)

2. check logs

Copy codeThe code is as follows:
# Last
(View historical records of all users logging on to the local machine under normal conditions)

Note "entered promiscuous mode"

Error message

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

3. check the process

Copy codeThe code is as follows:
# Ps-aux (note that the UID is 0)

# Lsof-p pid (view the ports and files opened by the process)

# Cat/etc/inetd. conf | grep-v "^ #" (check the daemon process)

Check hidden processes

# Ps-ef | awk '{print}' | sort-n | uniq> 1

# Ls/porc | sort-n | uniq> 2

# Diff 1 2

4. check the file

Copy codeThe code is as follows:
# Find/-uid 0-perm-4000-print

# Find/-size + 10000 k-print

# Find/-name "…" -Print

# Find/-name "..."-print

# Find/-name "."-print

# Find/-name "-print

Note the SUID file, which may be larger than 10 MB or space files.
# Find/-name core-exec ls-l {}\
(Check the core file in the system)

Check system file integrity

# Rpm-qf/bin/ls

# Rpm-qf/bin/login

# Md5sum-B file name

# Md5sum-t file name

5. check RPM

Copy codeThe code is as follows:
# Rpm-Va
Output format:

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

Note the related/sbin,/bin,/usr/sbin, and/usr/bin.

6. check the network

Copy codeThe code is as follows:
# Ip link | grep PROMISC (normal Nic should not be in promisc mode, and sniffer may exist)

# Lsof-I

# Netstat-nap (view the TCP/UDP ports that are not normally opened)

# Arp-

7. check scheduled tasks

Copy codeThe code is as follows:
Note that the root and UID are 0 schedule

# Crontab-u root-l

# Cat/etc/crontab

# Ls/etc/cron .*

8. check the backdoor

Copy codeThe code is as follows:
# Cat/etc/crontab

# Ls/var/spool/cron/

# Cat/etc/rc. d/rc. local

# Ls/etc/rc. d

# Ls/etc/rc3.d

# Find/-type f-perm 4000

9. check the kernel module

Copy codeThe code is as follows:
# Lsmod

10. Check System Services

Copy codeThe code is as follows:
# Chkconfig

# Rpcinfo-p (view RPC service)

11. check rootkit

Copy codeThe code is as follows:
# Rkhunter-c

# Chkrootkit-q

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.