You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A possible Zip Slip vulnerability exists in the code.Zip Slip is a vulnerability that exploits insecure path manipulation, which allows an attacker to achieve arbitrary file writes by constructing a specific zip file and writing the file to an arbitrary path, including a sensitive or system path, when unzipping it.
Fix
Fixing this vulnerability requires stricter validation and normalization of the outputName to ensure that it does not contain any malicious path fragments (e.g., ..) . This can be fixed using the following method:
Validate and normalize the path: ensure that the outputName does not contain a sequence of path traversal characters (e.g. ..) .
Handle paths safely: Use safe path splicing methods and avoid splicing strings directly.
...
// check outputName,make sure it doesn't contain a sequence of path traversal charactersif (outputName.contains("..")) {
thrownewIOException("Invalid output name: " + outputName);
}
...
if (fName.length() < outputName.length()) {
StringlocalDir = outputName.substring(0, outputName.length() - fName.length());
Pathpath = TMP_FILE.toPath().resolve(localDir).normalize(); // Safe handling of paths with resolve and normalizeif (!path.startsWith(TMP_FILE.toPath())) { // Ensure that the path is not outside the intended directorythrownewIOException("Invalid output directory: " + path);
}
dir = Files.createDirectories(path).toFile();
} else {
dir = TMP_FILE;
}
...
Expected behavior
Version
easeagent-v2.2.8
Configuration
Logs
OS and Hardware
The text was updated successfully, but these errors were encountered:
Describe the bug
A possible Zip Slip vulnerability exists in the code.Zip Slip is a vulnerability that exploits insecure path manipulation, which allows an attacker to achieve arbitrary file writes by constructing a specific zip file and writing the file to an arbitrary path, including a sensitive or system path, when unzipping it.
To Reproduce
In the following code
easeagent/loader/src/main/java/com/megaease/easeagent/JarUtils.java
Line 88 in 942ca08
In the function createTempJarFile
easeagent/loader/src/main/java/com/megaease/easeagent/JarUtils.java
Line 104 in 942ca08
Fix
Fixing this vulnerability requires stricter validation and normalization of the outputName to ensure that it does not contain any malicious path fragments (e.g.,
..
) . This can be fixed using the following method:..
) .Expected behavior
Version
easeagent-v2.2.8
Configuration
Logs
OS and Hardware
The text was updated successfully, but these errors were encountered: