当前位置:网站首页>Record that the server has been invaded by viruses: the SSH password has been changed, the login fails, the malicious program runs full of CPU, the jar package fails to start automatically, and you ha
Record that the server has been invaded by viruses: the SSH password has been changed, the login fails, the malicious program runs full of CPU, the jar package fails to start automatically, and you ha
2022-06-29 18:03:00 【Full stack programmer webmaster】
Problem phenomenon :
ssh The login password : The server password was changed without any reason , I also asked my colleagues that no one has touched the server , Then login to the server again by changing the password . jar Package start Failure : start-up jar package , Soon afterwards, they were directly kill
[[email protected] discovery]# java -jar discovery-1.0.0.RELEASE.jar
################################################
# #
# ## # # ## ### ### ## ### #
# # # # # # # # # # # # # #
# ### # # ### # # # ## # #
# # # ### ### # # # ### # # ### #
# #
# Obfuscation by Allatori Obfuscator v6.4 DEMO #
# #
# http://www.allatori.com #
# #
################################################
2021-02-18 09:08:01.045 INFO 19907 --- [ main] s.c.a.AnnotationConfigApplicationContex: Refreshing org.spring[email protected]1376c05c: artup date [Thu Feb 18 09:08:01 CST 2021]; root of context hierarchy
...
KilledKeep popping up You have new mail in /var/spool/mail/root: Check the relevant contents of this and you will find that there has always been ERROR
|| ERROR || already running…
From [email protected] Thu Feb 18 09:12:01 2021
Return-Path: <[email protected]>
X-Original-To: root
Delivered-To: [email protected]
Received: by k8s-n4.localdomain (Postfix, from userid 0)
id 9ABDD43E1F; Thu, 18 Feb 2021 09:12:01 +0800 (CST)
From: "(Cron Daemon)" <[email protected]>
To: [email protected]
Subject: Cron <[email protected]> /root/.sshd/sshd
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <XDG_SESSION_ID=5360>
X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/0>
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
Message-Id: <[email protected]>
Date: Thu, 18 Feb 2021 09:12:01 +0800 (CST)
|| ERROR || already running...The first reaction is that the server resources are insufficient
Look at the running memory 、 There is enough disk space
Was invaded , Set up a regular task , hold CPU All the resources are occupied . In order to keep the system stable , So automatically kill process
top # View occupancy CPU , etc.
Go straight ahead kill This sshd Your program will regenerate new
kill -9 2172 # Name this sshd、pid by 2172 The program kill fall crontab -l # View scheduled tasks Sure enough, this is the fundamental problem Is written to the scheduled task
solve
Directly clear the scheduled task modification
crontab -e # Modify scheduled tasks # After entering the edit mode, delete it directly, and then wq Save and exit
modify root password
passwd root # modify root password It is recommended to modify the complex password You can search for a random password
Delete virus files
rm -rf /root/.sshd # Delete the suspicious directory directly
View process details ll /proc/7289
I also deleted /usr/bin/sshd Program And pass yum reinstall 、 start-up And then modified ssh Port number Default 22 Modify the port number
View scheduled tasks , Because it's not just through crontab -e This method is modified Check cron. Is there a new program in the directory
Checked /etc/cron All directories , I see several of them have added this pwnrig I deleted all the programs Direct deletion cannot delete Because of the addition of —-ia attribute
To delete Then I'm afraid there are cron Planned tasks have been modified , I'll go through yum Uninstall and then reinstall .
Check whether there are new users , Check out /home Add a new user The user was also recently added Use userdel user Delete the user and You don't succeed You can modify it directly /etc/passwd as well as /etc/shadow file See at the bottom of the file is about user The user's information is direct Delete and save exit
It is probably after the above steps , I tried this again kill Program , This program will be used by me kill fall , But when I reconnect to the server , That is to say linux When the server user logs in, the program will still generate , That is, the environment variables will be loaded when the user logs in , The attacker modified the environment variables of the server , This program will be generated as soon as I log in !
Login is loading environment variable Of Check the documents cat /etc/profile cat /root/.bash_profile As expected, we found the clue
You can't modify and save directly , File properties have been modified
Delete the added items and save them
From the file of the environment variable just now, we can know that he put /bin/ The next program is copied Enter into /bin Under the table of contents , Because I knew that the approximate time was Feb Monthly screening
You can see that several suspicious files have been deleted
[[email protected] bin]# rm -rf bprofr
rm: cannot remove ‘bprofr’: Operation not permitted
[[email protected] bin]# rm -rf crondr
rm: cannot remove ‘crondr’: Operation not permitted
[[email protected] bin]# rm -rf initdr
rm: cannot remove ‘initdr’: Operation not permitted
[[email protected] bin]# rm -rf sysdr
rm: cannot remove ‘sysdr’: Operation not permitted
[[email protected] bin]# chattr -ia bprofr crondr initdr sysdr
[[email protected] bin]# rm -rf bprofr crondr initdr sysdrFinally try again kill This process , This is called sshd My program was kill 了 , And will not regenerate , And this program will not be generated when you log in to the server again Before solving :
After the solution :
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/101819.html Link to the original text :https://javaforall.cn
边栏推荐
- 回文子串的最大长度(字符串哈希+二分)
- 布隆过滤器:
- Industry application of smart city based on GIS 3D visualization
- Goldfish rhca memoirs: do447 building advanced job workflow -- using fact cache to improve performance
- Xiaomai technology x hologres: high availability of real-time data warehouse construction of ten billion level advertising
- Digital twin energy system, creating a "perspective" in the low-carbon era
- 小白月赛51 补题 E G F
- 金鱼哥RHCA回忆录:DO447构建高级作业工作流--创建作业模板调查以设置工作的变量
- 3h精通OpenCV(五)-透视变换
- 上班可以做副业
猜你喜欢

Mysql database literacy, do you really know what a database is

两种Controller层接口鉴权方式

数字孪生能源系统,打造低碳时代“透视”眼

Image migration and data migration synchronization of old and new servers with different Alibaba cloud accounts

Selenium file upload method

Parental delegation mechanism

国内酒店交易DDD应用与实践——理论篇

Teach you how to install the latest version of mysql8.0 database on windows, nanny level teaching

阿里云不同账号新旧服务器镜像迁移数据迁移同步
![分割回文串[dp + dfs组合]](/img/7b/221b000984977508f849e19802c2c2.png)
分割回文串[dp + dfs组合]
随机推荐
Matlab farthest point sampling (FPS)
Premature end of script headers 或 End of script output before headers
Createstore for Redux source code analysis
MySql存储过程循环的使用分析详解
shell教程之循环语句for,while,until用法
Sword finger offer 13 Robot range of motion (BFS)
Fill in the next right node pointer of each node [make good use of each point - > reduce the space-time complexity as much as possible]
Maxcompute string replacement function -replace
Visual studio plug-in coderush officially released v22.1 -- visual tool for optimizing debugging
Kubekey2.2.1 kubernetes1.23.7 offline package production +harbor Department summer and upload image
How to use the chart control of the b/s development tool devextreme - customize the axis position?
软件快速交付真的需要以安全为代价吗?
Jar包后台启动并输出日志
Split palindrome string [dp + DFS combination]
MySQL数据库每日备份并定时清理脚本
小白月赛51 补题 E G F
小迈科技 X Hologres:高可用的百亿级广告实时数仓建设
Mac installation php7.2
字典树(随学)
VB. Net read / write NFC ntag tag source code