首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Groovy有log4j漏洞吗?

Groovy有log4j漏洞吗?
EN

Stack Overflow用户
提问于 2022-02-25 17:36:36
回答 1查看 225关注 0票数 1

我正在使用Groovy,有人问我Groovy (第3版)是否有Log4J漏洞,我说过我会检查。

我有基于3.0.7命令的groovy --version版本,它提供了以下输出:

Groovy Version: 3.0.7 JVM: 17.0.1 Vendor: Red Hat, Inc. OS: Linux

在互联网上简单的搜索和堆叠溢出没有找到答案。

我的研究表明,不受影响的原因如下:

Groovy命令(在Linux中)是一个shell脚本,所以没有selected.

  • Groovy。
  • 没有导入库
  • 的两个包装文件,它们很可能委托给用户拥有的Log4J的任何版本,基本上是一个编译器,可以将Groovy或Java代码转换为JVM代码。它不是服务器端应用程序,也没有监听传入请求的后台进程。

我的研究(我是如何决定的)

这就是我得出的结论,即Groovy没有log4j漏洞。

我检查过的包是从这个页面下载的apache-groovy-sdk-3.0.9.ziphttps://groovy.apache.org/download.html#distro

解释了Log4J漏洞的几个地方

我将指向Apache的网站https://logging.apache.org/log4j/2.x/security.html来描述它。但基本上,使用log4j的应用程序正在运行,并允许记录最终用户的输入。由于Groovy不是一个不接受传入的internet连接的应用程序,所以它是一个编译器/转换程序--它没有这个漏洞。

但我继续说。

没有log4j jar文件(基于查找)

代码语言:javascript
复制
find . -type f | sort | grep -i jar | grep -i log4j

没有输出,所以在Groovy发行版中没有嵌入的log4j文件jar文件。

源代码中没有log4j导入

代码语言:javascript
复制
find . -type f | grep '\.java$' | xargs grep -l import | grep -i 'import.*log4j'

两个包装器的log4j源文件(基于代码的检查)

代码语言:javascript
复制
find . -type f | sort | grep -i log4j
./doc/html/api/groovy/util/logging/Log4j2.html
./doc/html/api/groovy/util/logging/Log4j2.Log4j2LoggingStrategy.html
./doc/html/api/groovy/util/logging/Log4j.html
./doc/html/api/groovy/util/logging/Log4j.Log4jLoggingStrategy.html
./doc/html/gapi/groovy/util/logging/Log4j2.html
./doc/html/gapi/groovy/util/logging/Log4j.html
./src/src/main/java/groovy/util/logging/Log4j2.java    <<<< SEE THIS
./src/src/main/java/groovy/util/logging/Log4j.java     <<<< SEE THIS
./src/src/test/groovy/util/logging/Log4j2Test.groovy
./src/src/test/groovy/util/logging/Log4jTest.groovy

如果有人可以在互联网上找到其他说明Groovy不易受攻击的引用,请告诉我。

EN

回答 1

Stack Overflow用户

发布于 2022-02-25 17:58:16

Groovy有log4j漏洞吗?

不是,但我们肯定可以编写一个Groovy应用程序来引入该漏洞。

我创建了一个默认的空Groovy3.0.7项目,并生成了一个依赖关系报告。下面是默认的运行时类路径:

代码语言:javascript
复制
runtimeClasspath - Runtime classpath of source set 'main'.
\--- org.codehaus.groovy:groovy-all:3.0.7
     +--- org.codehaus.groovy:groovy:3.0.7
     +--- org.codehaus.groovy:groovy-ant:3.0.7
     |    +--- org.codehaus.groovy:groovy:3.0.7
     |    +--- org.apache.ant:ant:1.10.9
     |    |    \--- org.apache.ant:ant-launcher:1.10.9
     |    +--- org.apache.ant:ant-junit:1.10.9
     |    |    \--- org.apache.ant:ant:1.10.9 (*)
     |    +--- org.apache.ant:ant-launcher:1.10.9
     |    +--- org.apache.ant:ant-antlr:1.10.9
     |    \--- org.codehaus.groovy:groovy-groovydoc:3.0.7
     |         +--- org.codehaus.groovy:groovy:3.0.7
     |         +--- com.github.javaparser:javaparser-core:3.17.0
     |         +--- org.codehaus.groovy:groovy-templates:3.0.7
     |         |    +--- org.codehaus.groovy:groovy:3.0.7
     |         |    \--- org.codehaus.groovy:groovy-xml:3.0.7
     |         |         \--- org.codehaus.groovy:groovy:3.0.7
     |         \--- org.codehaus.groovy:groovy-docgenerator:3.0.7
     |              +--- org.codehaus.groovy:groovy-templates:3.0.7 (*)
     |              +--- org.codehaus.groovy:groovy:3.0.7
     |              \--- com.thoughtworks.qdox:qdox:1.12.1
     +--- org.codehaus.groovy:groovy-astbuilder:3.0.7
     |    \--- org.codehaus.groovy:groovy:3.0.7
     +--- org.codehaus.groovy:groovy-cli-picocli:3.0.7
     |    +--- org.codehaus.groovy:groovy:3.0.7
     |    \--- info.picocli:picocli:4.5.2
     +--- org.codehaus.groovy:groovy-console:3.0.7
     |    +--- org.codehaus.groovy:groovy:3.0.7
     |    +--- org.codehaus.groovy:groovy-templates:3.0.7 (*)
     |    \--- org.codehaus.groovy:groovy-swing:3.0.7
     |         \--- org.codehaus.groovy:groovy:3.0.7
     +--- org.codehaus.groovy:groovy-datetime:3.0.7
     |    \--- org.codehaus.groovy:groovy:3.0.7
     +--- org.codehaus.groovy:groovy-docgenerator:3.0.7 (*)
     +--- org.codehaus.groovy:groovy-groovydoc:3.0.7 (*)
     +--- org.codehaus.groovy:groovy-groovysh:3.0.7
     |    +--- org.codehaus.groovy:groovy-templates:3.0.7 (*)
     |    +--- org.codehaus.groovy:groovy:3.0.7
     |    +--- org.codehaus.groovy:groovy-console:3.0.7 (*)
     |    +--- org.codehaus.groovy:groovy-xml:3.0.7 (*)
     |    \--- jline:jline:2.14.6
     +--- org.codehaus.groovy:groovy-jmx:3.0.7
     |    \--- org.codehaus.groovy:groovy:3.0.7
     +--- org.codehaus.groovy:groovy-json:3.0.7
     |    \--- org.codehaus.groovy:groovy:3.0.7
     +--- org.codehaus.groovy:groovy-jsr223:3.0.7
     |    \--- org.codehaus.groovy:groovy:3.0.7
     +--- org.codehaus.groovy:groovy-macro:3.0.7
     |    \--- org.codehaus.groovy:groovy:3.0.7
     +--- org.codehaus.groovy:groovy-nio:3.0.7
     |    \--- org.codehaus.groovy:groovy:3.0.7
     +--- org.codehaus.groovy:groovy-servlet:3.0.7
     |    +--- org.codehaus.groovy:groovy:3.0.7
     |    +--- org.codehaus.groovy:groovy-templates:3.0.7 (*)
     |    \--- org.codehaus.groovy:groovy-xml:3.0.7 (*)
     +--- org.codehaus.groovy:groovy-sql:3.0.7
     |    \--- org.codehaus.groovy:groovy:3.0.7
     +--- org.codehaus.groovy:groovy-swing:3.0.7 (*)
     +--- org.codehaus.groovy:groovy-templates:3.0.7 (*)
     +--- org.codehaus.groovy:groovy-test:3.0.7
     |    +--- org.codehaus.groovy:groovy:3.0.7
     |    \--- junit:junit:4.13.1
     |         \--- org.hamcrest:hamcrest-core:1.3
     +--- org.codehaus.groovy:groovy-test-junit5:3.0.7
     |    +--- org.codehaus.groovy:groovy:3.0.7
     |    +--- org.junit.jupiter:junit-jupiter-api:5.7.0
     |    |    +--- org.junit:junit-bom:5.7.0
     |    |    |    +--- org.junit.jupiter:junit-jupiter-api:5.7.0 (c)
     |    |    |    +--- org.junit.jupiter:junit-jupiter-engine:5.7.0 (c)
     |    |    |    +--- org.junit.platform:junit-platform-engine:1.7.0 (c)
     |    |    |    +--- org.junit.platform:junit-platform-launcher:1.7.0 (c)
     |    |    |    \--- org.junit.platform:junit-platform-commons:1.7.0 (c)
     |    |    +--- org.opentest4j:opentest4j:1.2.0
     |    |    \--- org.junit.platform:junit-platform-commons:1.7.0
     |    |         \--- org.junit:junit-bom:5.7.0 (*)
     |    +--- org.junit.platform:junit-platform-launcher:1.7.0
     |    |    +--- org.junit:junit-bom:5.7.0 (*)
     |    |    \--- org.junit.platform:junit-platform-engine:1.7.0
     |    |         +--- org.junit:junit-bom:5.7.0 (*)
     |    |         +--- org.opentest4j:opentest4j:1.2.0
     |    |         \--- org.junit.platform:junit-platform-commons:1.7.0 (*)
     |    \--- org.junit.jupiter:junit-jupiter-engine:5.7.0
     |         +--- org.junit:junit-bom:5.7.0 (*)
     |         +--- org.junit.platform:junit-platform-engine:1.7.0 (*)
     |         \--- org.junit.jupiter:junit-jupiter-api:5.7.0 (*)
     +--- org.codehaus.groovy:groovy-testng:3.0.7
     |    +--- org.codehaus.groovy:groovy:3.0.7
     |    \--- org.testng:testng:7.3.0
     |         \--- com.beust:jcommander:1.78
     \--- org.codehaus.groovy:groovy-xml:3.0.7 (*)
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71269668

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档