1

使用 Elastic 安全检测对 CVE-2021-44228 (Log4j2) 的利用

 2 years ago
source link: https://www.elastic.co/cn/blog/detecting-log4j2-with-elastic-security
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

使用 Elastic 安全检测对 CVE-2021-44228 (Log4j2) 的利用

  • Share on Twitter

  • Share on LinkedIn

  • Share on Facebook

  • Share by Email

  • Print

blog-security-detection-720x420.png

重要说明:

  • 要了解 Elastic 当前如何评估我们产品中关于该漏洞的内部风险,请参见此处的建议。
  • 本博文在最初发布以后,已于 2021 年 12 月 14 日进行了更新,进一步介绍了检测和猎捕方面的改进。

本博文对 CVE-2021-44228 进行了简要介绍,并为 Elastic 安全用户提供了检测方法,以发现他们环境中对该漏洞的主动利用。

在我们了解到更多信息后,我们会在本博文中提供进一步的更新。这一版本的内容截至于 2021 年 12 月 14 日(星期二)。您可以通过 Log4j2 的安全页面直接调查来自 Apache 的更新。

CVE-2021-44228 (Log4Shell) 摘要

Log4j2 是一个开源日志记录框架,可集成到最终用户系统和服务器上的许多基于 Java 的应用程序中。2021 年 11 月下旬,阿里巴巴的陈兆军(音)发现了一个远程代码执行漏洞,最终在 CVE ID:CVE-2021-44228 中报告,于 2021 年 12 月 10 日公布。该漏洞是通过对传入框架的用户输入进行不正确的反序列化而被利用的。它允许远程代码执行,并允许攻击者泄露环境变量等敏感数据,或在目标系统上执行恶意软件。

已发现的漏洞会影响从版本 2.0-beta9 到版本 2.14.1 的所有 Log4j2 版本。早期修补该问题的方法生成了许多候选版本,最终在本博文发布时建议将框架升级到 Log4j2 2.15.0-rc2。

鉴于所观测到的广泛利用的复杂性和性质,在任何已发现软件利用 Log4j2 易受攻击版本的环境中,在采取缓解措施方面应高度重视。

在 Elastic 安全中检测对 Log4Shell 的利用

Elastic 安全用户可以使用以下事件关联检测规则来识别对 Log4j2 漏洞的主动利用。 根据基于主机的事件数据的格式,您可能需要修改此检测规则以匹配数据字段。

使用终端数据时的检测规则

sequence by host.id with maxspan=1m
 [network where event.action == "connection_attempted" and 
  process.name : "java" and
  /* 
     outbound connection attempt to 
     LDAP, RMI or DNS standard ports 
     by JAVA process 
   */ 
  destination.port in (1389, 389, 1099, 53, 5353)] by process.pid
 [process where event.type == "start" and 

  /* Suspicious JAVA child process */
  process.parent.name : "java" and
   process.name : ("sh", 
                   "bash", 
                   "dash", 
                   "ksh", 
                   "tcsh", 
                   "zsh", 
                   "curl",
                   "perl*",
                   "python*",
                   "ruby*",
                   "php*", 
                   "wget")] by process.parent.pid了解详情

使用 Auditbeat 数据时的检测规则

sequence by agent.id with maxspan=1m
 [network where event.action == "connected-to" and 
  process.name : "java" and
  /* 
     outbound connection attempt to 
     LDAP, RMI or DNS standard ports 
     by JAVA process 
   */ 
  destination.port in (1389, 389, 1099, 53, 5353)] by process.pid
 [process where event.type == "start" and 

  /* Suspicious JAVA child process */
  process.parent.name : "java" and
   process.name : ("sh", 
                   "bash", 
                   "dash", 
                   "ksh", 
                   "tcsh", 
                   "zsh", 
                   "curl",
                   "perl*",
                   "python*",
                   "ruby*",
                   "php*", 
                   "wget")] by process.parent.pid了解详情

使用 Endgame 流式传输事件时的检测规则

sequence by agent.id with maxspan=1m
 [network where event.category == "network" and 
  process.name : "java" and
  /* 
     outbound connection attempt to 
     LDAP, RMI or DNS standard ports 
     by JAVA process 
   */ 
  destination.port in (1389, 389, 1099, 53, 5353)] by process.pid
 [process where event.type == "start" and 

  /* Suspicious JAVA child process */
  process.parent.name : "java" and
   process.name : ("sh", 
                   "bash", 
                   "dash", 
                   "ksh", 
                   "tcsh", 
                   "zsh", 
                   "curl",
                   "perl*",
                   "python*",
                   "ruby*",
                   "php*", 
                   "wget")] by process.parent.pid了解详情

此检测规则会查找到 LDAP、RMI 和 DNS 标准端口的出站连接尝试(经常被最近观测到的 JAVA/JNDI 注入攻击滥用),后跟同一 Java 进程实例的子进程。

现在,让我们演示这个规则如何检测对 log42j 漏洞的利用:

上面的屏幕截图显示了攻击者通过 base-64 编码的有效负载利用该漏洞

上面的屏幕截图显示了攻击者通过 base-64 编码的有效负载利用该漏洞,目标是 Christophe Tafani-Dereeper 创建的易受攻击的示例应用程序

此屏幕截图显示了在 Elastic Security 中检测到对 CVE-2021-44228 的主动利用,其中详细说明了利用的告警和时间线视图。

此屏幕截图显示了在 Elastic Security 中检测到对 CVE-2021-44228 的主动利用,其中详细说明了利用的告警和时间线视图。

上面的屏幕截图显示在检测告警的调查中,Java 执行了一个 shell 脚本来下载并运行 bash 脚本。
  • Share on Twitter

  • Share on LinkedIn

  • Share on Facebook

  • Share by Email

  • Print

  • 就职于一个全球分布式的团队,只需通过一次 Zoom 会议,就可在团队中找到与您工作方式相同的同事。具有影响力地灵活工作?从一开始就有发展机会?

pattern-footer-cta-generic-top-left-145x250-blue-bg.svg
pattern-footer-cta-stack-bottom-left-172x90-blue-bg.svg
pattern-footer-cta-generic-top-right-172x90-blue-bg.svg
pattern-footer-cta-generic-bottom-right-145x250-blue-bg.svg

注册 Elastic Cloud 免费试用版

在您所选的云服务提供商上迅速完成全套技术栈的部署。作为 Elasticsearch 的开发公司,我们为您在云端的 Elastic 集群提供多项功能和贴心支持。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK