当前位置:网站首页>Log4j2 major vulnerabilities and Solutions
Log4j2 major vulnerabilities and Solutions
2022-07-06 16:59:00 【Xiaoxiamo】
Causes of events
2021 year 12 month 10 Day is an ordinary day , Circle of friends , Various forums 、 Official account and group , Are discussing one Log4j2 A loophole in the , How many programmers get up in the middle of the night to change the code . this bug It even threatens the global network security , Companies that have proven that their servers are vulnerable to vulnerabilities include, but are not limited to, apple 、 Amazon 、 tesla 、 Google 、 Baidu 、 tencent 、 NetEase 、 JD.COM 、Twitter、 Steam etc. . Why does this vulnerability react so strongly ? There are several reasons :
One 、 It covers a wide range ( Any use of Log4j2 Project , Are in danger
Two 、 It's easy to operate ( Just a simple operation can seriously damage the server
3、 ... and 、 High degree of harm ( It is equivalent to having the permission of the application
Four 、 Long time ( It is expected that this will happen in the next few years bug, As long as the service is not updated , Loopholes are always 
according to the understanding of , This vulnerability was first discovered by Alibaba employees .11 month 24 Japan , Alibaba cloud security team to Apache Reported Apache Log4j2 Remote code execution vulnerability .12 month 9 Japan , More details are made public .
Log4j2 Introduce
That caused such a large-scale security problem Log4j2 What is it , What's the use ?Log4j2 yes Apache A project for , One is based on Java The logging tool for . Log4j2 It's easy to control log Whether the information is displayed 、log The output type of the message 、 Output mode 、 Output format , More detailed control of the log generation process , It can be configured flexibly through the configuration file without a lot of code changes . therefore , Many Internet companies choose to use Log4j2 . The project is in progress. 2014 Reconstructed in , And introduced a lot of rich features , It is also the rewritten version , That's what we have bug. The new version of logging framework is widely used in business system development , Used to record log information . So the main victims this time are the use of Log4j2 Of Java application (Log4j 1.x Instead of being affected ), The common open source projects affected by this are :Spring-Boot-strater-log4j2、Apache Solr、Apache Flink、Apache Druid、Elasticsearch、Flume、Dubbo、Redis、Logstash、Kafka etc. .
Hazard principle
that Log4j2 bug What is the way of destruction , It's very simple , It's like SQL Inject , This is more powerful , Is directly Code injection , Code execution permission is naturally equivalent to application permission . This belongs to a tool person who prints logs , Don't work hard , Also introduced the devil to the village .
What is the main principle ? When printing the log , If you find that the log content contains keywords ${ }, So in { } The contents contained will be replaced as variables , This allows an attacker to execute arbitrary commands . Detailed vulnerability disclosure can be viewed :https://issues.apache.org/jira/projects/LOG4J2/issues/LOG4J2-3201?filter=allissues
In fact, it is mainly because of Log4J2 A plug-in in :Lookup, There's a big problem . This is an uncommon plug-in , But the code triggers very often , Up to every trigger in your code info,warn,error When the log is written , Will check whether to execute Lookup The logic of . Among them, the more serious problems are JndiLookup and RMILookup function ,JNDI You can find and find data and resources ,RMI It's a remote call . If you use your host , Remotely call the destructive code I started ( Application service ) Well , At this time, your service host is the meat on the chopping board , Lose your life .
Solution
Mode one : Discard directly Log4j2
What we should pay attention to here is , You have no dependencies in the project , It doesn't mean that there is no , Need global search
Mode two : Rise to 2.15.0 Or later
Up to 2021.12.14 Japan , It has reached 2.16-rc1 Version of the , Just a few more crazy versions these days , It is suggested to update at least to 2.15.0 Above version 
Address :https://github.com/apache/logging-log4j2/tags
Mode three : change JVM Operation parameters
Some projects , May rely on more complex , And it is not convenient to recompile , It can be run directly , Add the following JVM Parameters , This can prohibit Lookup take effect
-Dlog4j2.formatMsgNoLookups=true
边栏推荐
- 7-4 harmonic average
- 数据传送指令
- J'ai traversé le chemin le plus fou, le circuit cérébral d'un programmeur de saut d'octets
- Ffmpeg command line use
- Redis standalone startup
- ~Introduction to form 80
- LeetCode 1984. Minimum difference in student scores
- ~74 JD top navigation bar exercise
- LeetCode 1545. Find the k-th bit in the nth binary string
- 7-8 likes (need to continue to improve)
猜你喜欢

字节跳动开源GAN模型压缩框架,算力最高节省97.8%丨ICCV 2021

~79 Movie card exercise
![[graduation project] QT from introduction to practice: realize imitation of QQ communication, which is also the last blog post in school.](/img/ef/2072aac5f85c7daf39174784dec7ee.jpg)
[graduation project] QT from introduction to practice: realize imitation of QQ communication, which is also the last blog post in school.

Usage of insert() in vector

~Introduction to form 80

I'm "fixing movies" in ByteDance

"One year after graduation, I won ACL best paper"

Fdog series (VI): use QT to communicate between the client and the client through the server (less information, recommended Collection)

Ffmpeg command line use

Fdog series (4): use the QT framework to imitate QQ to realize the login interface, interface chapter.
随机推荐
Shell_ 04_ Shell script
100张图训练1小时,照片风格随意变,文末有Demo试玩|SIGGRAPH 2021
Eureka single machine construction
js垃圾回收机制和内存泄漏
Go language uses the thrift protocol to realize the client and service end reports not enough arguments in call to oprot Writemessagebegin error resolution
7-7 ring the stupid bell
Design of DS18B20 digital thermometer system
Activit零零碎碎要人命的坑
LeetCode 1636. Sort the array in ascending order by frequency
Continue and break jump out of multiple loops
LeetCode 1020. Number of enclaves
在 vi 编辑器中的命令模式下,删除当前光标处的字符使用 __ 命 令。
How to generate six digit verification code
Error: case label `15 'not within a switch statement
Eureka high availability
逻辑运算指令
ByteDance 2022 school recruitment R & D advance approval publicity meeting, students' top 10 issues
这群程序员中的「广告狂人」,把抖音广告做成了AR游戏
Solr new core
QT system learning series: 1.2 style sheet sub control lookup