Skip to content

Commit 3661fed

Browse files
Merge pull request #493 from frkngksl:mlflowLFI
PiperOrigin-RevId: 641394310 Change-Id: I4bb5fdfb2ca7ebfe7a7714f7f97f8a20b74ac06b
2 parents e7cbb37 + 62dfe86 commit 3661fed

File tree

12 files changed

+78
-54
lines changed

12 files changed

+78
-54
lines changed

community/detectors/mlflow_cve_2023_1177/README.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

community/detectors/mlflow_cve_2023_1177/settings.gradle

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# MLflow LFI/RFI CVE-2023-6977 Detector
2+
3+
This detector checks for MLflow LFI/RFI vulnerability (CVE-2023-6977). This
4+
vulnerability enables malicious users to read sensitive files on the server. It
5+
encompasses both CVE-2023-1177 and CVE-2023-2780 because exploit of
6+
CVE-2023-6977 bypasses patches of these vulnerabilities by using symlinks.
7+
8+
- https://huntr.com/bounties/fe53bf71-3687-4711-90df-c26172880aaf
9+
- https://nvd.nist.gov/vuln/detail/CVE-2023-6977
10+
11+
## Build jar file for this plugin
12+
13+
Using `gradlew`:
14+
15+
```shell
16+
./gradlew jar
17+
```
18+
19+
Tsunami identifiable jar file is located at `build/libs` directory.

community/detectors/mlflow_cve_2023_1177/build.gradle renamed to community/detectors/mlflow_cve_2023_6977/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ plugins {
22
id 'java-library'
33
}
44

5-
description = 'Tsunami MLflow LFI/RFI (CVE-2023-1177) VulnDetector plugin.'
5+
description = 'Tsunami MLflow LFI/RFI (CVE-2023-6977) VulnDetector plugin.'
66
group 'com.google.tsunami'
7-
version '0.0.1-SNAPSHOT'
7+
version '0.0.2-SNAPSHOT'
88

99

1010
repositories {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'mlflow_cve_2023_6977'
Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 Google LLC
2+
* Copyright 2024 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.google.tsunami.plugins.detectors.cves.cve20231177;
16+
package com.google.tsunami.plugins.detectors.cves.cve20236977;
1717

1818
import static com.google.common.base.Preconditions.checkNotNull;
1919
import static com.google.common.collect.ImmutableList.toImmutableList;
@@ -50,15 +50,15 @@
5050
import java.time.Instant;
5151
import javax.inject.Inject;
5252

53-
/** A {@link VulnDetector} that detects the CVE-2023-1177 vulnerability. */
53+
/** A {@link VulnDetector} that detects the CVE-2023-6977 vulnerability. */
5454
@PluginInfo(
5555
type = PluginType.VULN_DETECTION,
56-
name = "MLflow LFI/RFI CVE-2023-1177 Detector",
57-
version = "0.1",
58-
description = Cve20231177Detector.VULN_DESCRIPTION,
59-
author = "hh-hunter",
60-
bootstrapModule = Cve20231177DetectorBootstrapModule.class)
61-
public final class Cve20231177Detector implements VulnDetector {
56+
name = "MLflow LFI/RFI CVE-2023-6977 Detector",
57+
version = "0.2",
58+
description = Cve20236977Detector.VULN_DESCRIPTION,
59+
author = "hh-hunter, frkngksl",
60+
bootstrapModule = Cve20236977DetectorBootstrapModule.class)
61+
public final class Cve20236977Detector implements VulnDetector {
6262

6363
@VisibleForTesting static final String DETECTION_STRING = "root:x:0:0:root";
6464
@VisibleForTesting static final String CREATE_DETECTION_STRING = "Tsunami-Test";
@@ -72,7 +72,9 @@ public final class Cve20231177Detector implements VulnDetector {
7272
+ " host server, including any files stored in remote locations to which the host server"
7373
+ " has access.This vulnerability can read arbitrary files. Since MLflow usually"
7474
+ " configures s3 storage, it means that AWS account information can also be obtained,"
75-
+ " and information such as local ssh private keys can also be read, resulting in RCE";
75+
+ " and information such as local ssh private keys can also be read, resulting in RCE."
76+
+ " The vulnerability detected here is CVE-2023-6977 which is a bypass for both"
77+
+ " CVE-2023-1177 and CVE-2023-2780. Hence, this plugin encompasses them.";
7678

7779
private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();
7880

@@ -88,22 +90,22 @@ public final class Cve20231177Detector implements VulnDetector {
8890
private static final String CREATE_MODEL_DATA = "{\"name\":\"REPLACE_FLAG\"}";
8991

9092
private static final String UPDATE_CREATE_MODEL_DATA =
91-
"{\"name\":\"REPLACE_FLAG\",\"source\":\"file:///\"}";
93+
"{\"name\":\"REPLACE_FLAG\",\"source\":\"//proc/self/root\"}";
9294

9395
private final HttpClient httpClient;
9496

9597
private final Clock utcClock;
9698

9799
@Inject
98-
Cve20231177Detector(@UtcClock Clock utcClock, HttpClient httpClient) {
100+
Cve20236977Detector(@UtcClock Clock utcClock, HttpClient httpClient) {
99101
this.httpClient = checkNotNull(httpClient);
100102
this.utcClock = checkNotNull(utcClock);
101103
}
102104

103105
@Override
104106
public DetectionReportList detect(
105107
TargetInfo targetInfo, ImmutableList<NetworkService> matchedServices) {
106-
logger.atInfo().log("CVE-2023-1177 starts detecting.");
108+
logger.atInfo().log("CVE-2023-6977 starts detecting.");
107109

108110
return DetectionReportList.newBuilder()
109111
.addAllDetectionReports(
@@ -219,11 +221,18 @@ private DetectionReport buildDetectionReport(
219221
.setMainId(
220222
VulnerabilityId.newBuilder()
221223
.setPublisher("TSUNAMI_COMMUNITY")
222-
.setValue("CVE_2023_1177"))
224+
.setValue("CVE_2023_6977"))
225+
.addRelatedId(
226+
VulnerabilityId.newBuilder().setPublisher("CVE").setValue("CVE-2023-6977"))
227+
.addRelatedId(
228+
VulnerabilityId.newBuilder().setPublisher("CVE").setValue("CVE-2023-2780"))
229+
.addRelatedId(
230+
VulnerabilityId.newBuilder().setPublisher("CVE").setValue("CVE-2023-1177"))
223231
.setSeverity(Severity.CRITICAL)
224-
.setTitle("CVE-2023-1177 MLflow LFI/RFI")
232+
.setTitle("CVE-2023-6977 MLflow LFI/RFI")
225233
.setRecommendation(
226-
"1.Updated to version 2.2.1 or later\n2.Add authentication to MLflow server\n")
234+
"1.Update to the version 2.10.0 or above\n"
235+
+ "2.Add authentication to MLflow server\n")
227236
.setDescription(VULN_DESCRIPTION))
228237
.build();
229238
}

0 commit comments

Comments
 (0)