【问题标题】:Sonarqube is throwing undertow-core vulnerability finding. How to resolveSonarqube 正在寻找核心漏洞。如何解决
【发布时间】:2020-12-16 22:26:55
【问题描述】:

Sonarqube 正在寻找核心漏洞。如何解决。

   "textRange": {
      "startLine": 1,
      "endLine": 1,
      "startOffset": 0,
      "endOffset": 38
    },
    "flows": [],
    "status": "OPEN",
    "message": "Filename: test-0.0.1-SNAPSHOT.jar: undertow-core-2.0.29.Final.jar 
| Reference: CVE-2020-1745 | CVSS Score: 9.8 | Category: CWE-200 | A file inclusion 
vulnerability was found 
in the AJP connector enabled with a default AJP configuration port of 8009 in 
Undertow version 2.0.29.Final and before and was fixed in 2.0.30.Final. A remote, 
unauthenticated attacker could exploit this vulnerability to read web application files 
from a vulnerable server. In instances where the vulnerable server allows file uploads, 
an attacker could upload malicious JavaServer Pages (JSP) code within a variety of file 
types and trigger this vulnerability to gain remote code execution.",

Undertow 在 pom 上不可用,因为它是另一个依赖项的子项(spring-boot-starter-undertow,已更新到最新版本的 2.3.3.RELEASE)。有没有办法让 spring-boot-starter 有特定版本的 undertow?



[INFO] +- org.springframework.boot:spring-boot-starter-undertow:jar:2.3.3.RELEASE:compile
[INFO] |  +- io.undertow:undertow-core:jar:2.0.29.Final:compile
[INFO] |  |  +- org.jboss.xnio:xnio-api:jar:3.3.8.Final:compile
[INFO] |  |  \- org.jboss.xnio:xnio-nio:jar:3.3.8.Final:runtime

[INFO] |  +- io.undertow:undertow-servlet:jar:2.0.29.Final:compile
[INFO] |  +- io.undertow:undertow-websockets-jsr:jar:2.0.29.Final:compile
[INFO] |  |  \- org.jboss.spec.javax.websocket:jboss-websocket-api_1.1_spec:jar:1.1.4.Final:compile
[INFO] |  +- jakarta.servlet:jakarta.servlet-api:jar:4.0.3:compile
[INFO] |  \- org.glassfish:jakarta.el:jar:3.0.3:compile

【问题讨论】:

  • 上面写着:您使用的是易受攻击的版本。更新。它甚至会具体告诉您哪个新版本修复了该漏洞。
  • @chrylis-cautiouslyoptimistic- 在 pom 上不提供 Undertow。
  • 您的 spring boot 启动器已过时。您使用的是 2.1.0,最新版本是 2.3.3...
  • 是时候了解传递依赖了。
  • 您可以尝试使用 maven 排除从启动程序中排除 undertow,然后导入 undertow-core 2.0.30,但我不确定这是否可行。

标签: java spring security sonarqube


【解决方案1】:

如果您需要特定版本的 Undertow,只需将其包含在您的 pom.xml 中即可:

<dependency>
  <groupId>io.undertow</groupId>
  <artifactId>undertow-core</artifactId>
  <version>2.0.30.Final</version>
</dependency>

这样做,您将覆盖您可能通过其他依赖项获得的任何其他版本——包括 Spring 的。

如果您需要的版本已经包含在其他包的依赖项中,并且您希望 Spring 使用那个(而不是手动覆盖 pom 中的每个 Undertow 依赖项),您可以尝试 exclude 只提供一个由首发:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-actuator</artifactId>
    <version>2.3.3.RELEASE</version> <!-- already includes undertow 2.0.30 -->
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-undertow</artifactId>
  <version>2.3.3.RELEASE</version>
  <exclusions>
    <exclusion>
      <groupId>io.undertow</groupId>
      <artifactId>undertow-core</artifactId>
    </exclusion>
  </exclusions>
</dependency>

如果您执行上述操作,Spring 将选择 spring-boot-actuator 提供的 undertow-core 版本,而不是 spring-boot-starter-undertow 提供的版本。

【讨论】:

    猜你喜欢
    • 2021-06-05
    • 2022-01-17
    • 2022-01-16
    • 2021-12-15
    • 2018-10-12
    • 2019-03-06
    • 2012-01-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多