Groovy是否存在log4j漏洞



我正在使用Groovy,有人问我Groovy(版本3(是否有Log4J漏洞,我说我会检查一下。

我有基于groovy --version命令的3.0.7版本,该命令提供以下输出:
Groovy Version: 3.0.7 JVM: 17.0.1 Vendor: Red Hat, Inc. OS: Linux

在互联网上简单搜索一下,斯塔克夫弗洛并没有找到答案。

我的研究表明没有,因为以下原因它没有受到影响:

  • 未找到log4j Jar文件
  • Groovy命令(在Linux中(是一个shell脚本,因此没有Log4J
  • 没有导入库
  • 两个包装文件,可能委托给用户选择的log4j的任何版本
  • Groovy基本上是一个将Groovy或Java代码转换为JVM代码的编译器。它不是服务器端的应用程序,也没有后台进程侦听传入的请求

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

这就是我得出Groovy不存在log4j漏洞的结论的原因。

我检查的包是从Groovy网站下载的apache-groovy-sdk-3.0.9.zip。https://groovy.apache.org/download.html#distro

Log4J漏洞在几个地方进行了解释

我将指向Apache的网站https://logging.apache.org/log4j/2.x/security.html但基本上,一个使用log4j的应用程序正在运行,并允许记录最终用户的输入。由于Groovy不是一个不接受传入互联网连接的应用程序,它是一个编译器/传输程序,因此不存在漏洞。

但我继续。。。

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

find . -type f | sort | grep -i jar | grep -i log4j

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

源代码中没有log4j导入

find . -type f | grep '.java$' | xargs grep -l import | grep -i 'import.*log4j'

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

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不易受攻击的引用,请告诉我。

Groovy是否存在log4j漏洞?

没有,但肯定可以编写一个引入漏洞的Groovy应用程序。

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

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 (*)

最新更新