Feb 27, 2026·5 min read·137 visits
Junrar versions prior to 7.5.8 contain a critical path traversal flaw on POSIX systems. Attackers can embed files with backslash-containing names (e.g., '..\..\etc\passwd') in RAR archives. These bypass validation but are processed as directory separators during extraction, allowing arbitrary file writes and potential RCE.
A path traversal vulnerability in the Junrar Java library allows attackers to overwrite arbitrary files on Linux and Unix systems. The flaw arises from a semantic discrepancy in how backslash characters are handled during file validation versus file creation. By crafting a RAR archive with Windows-style path separators, an attacker can bypass directory traversal checks and write files outside the intended extraction directory, potentially leading to Remote Code Execution (RCE).
Junrar is a widely used open-source Java library for extracting RAR archives. A security vulnerability identified as CVE-2026-28208 affects versions prior to 7.5.8, specifically when running on non-Windows operating systems (Linux/Unix). The vulnerability allows for directory traversal, enabling the extraction of files to locations outside the intended destination directory.
The issue falls under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory). Unlike typical path traversal bugs where the application fails to sanitize ../ sequences, this vulnerability exploits a platform-specific interpretation of the backslash (\) character. While Windows treats backslashes as directory separators, POSIX systems treat them as valid literal characters within a filename. This discrepancy leads to a bypass of the library's security controls, resulting in arbitrary file write capabilities.
The vulnerability is rooted in a logical inconsistency between the validation phase and the file creation phase within LocalFolderExtractor.java. The library attempts to prevent path traversal by resolving the canonical path of the extraction destination and ensuring it starts with the intended target directory.
However, on Linux and Unix systems, the java.io.File API interprets backslashes (\) as literal characters, not directory separators. When the validation logic processes a malicious entry name like ..\..\etc\passwd, File.getCanonicalPath() treats the entire string as a single filename located inside the destination directory. Since no directory traversal is detected by the OS at this stage, the path validation check passes successfully.
Crucially, after validation, the library performs a manual path reconstruction to support Windows-style archives. The makeFile method explicitly splits the entry name using backslashes (name.split("\\\\")) and reassembles it using the system's native file separator (which is / on Linux). This transformation effectively converts the literal backslashes—which passed validation—into functional directory separators, executing the directory traversal that the validation step failed to detect.
The vulnerability existed in how the LocalFolderExtractor class handled file paths. Below is the logic flow demonstrating the flaw and the subsequent fix.
Vulnerable Logic (Simplified):
The code first validates the path using getCanonicalPath. On Linux, dest/..\file resolves to exactly that path, satisfying the startsWith check. Later, the file is created by splitting on backslashes.
// Vulnerable implementation in LocalFolderExtractor.java
private File createFile(FileHeader fh, File destination) {
// 1. Validation: On Linux, backslashes are NOT separators.
// A path like "..\\..\\evil.sh" is seen as a valid filename.
File f = new File(destination, fh.getFileName());
if (!f.getCanonicalPath().startsWith(destination.getCanonicalPath())) {
throw new Exception("Malicious path");
}
return f;
}
// Later, in makeFile or similar logic:
// 2. Reconstruction: The filename is split by backslash and rejoined with '/'
// converting the "safe" filename into a traversal path.
String[] parts = fh.getFileName().split("\\\\");
File current = destination;
for (String part : parts) {
current = new File(current, part);
}Patched Logic:
The fix introduces input normalization before any validation occurs. The helper method invariantSeparatorsPathString replaces all backslashes with forward slashes. This ensures getCanonicalPath correctly identifies and resolves traversal attempts regardless of the OS.
// Fixed implementation in Commit 947ff1d
private File createFile(final FileHeader fh, final File destination) throws IOException {
// FIX: Normalize backslashes to forward slashes BEFORE validation
String name = invariantSeparatorsPathString(fh.getFileName());
File f = new File(destination, name);
// Now "../../evil.sh" is correctly resolved and rejected
if (!f.getCanonicalPath().startsWith(destination.getCanonicalPath())) {
throw new IllegalStateException("Rar contains file with invalid path");
}
return f;
}
static String invariantSeparatorsPathString(String path) {
return path.replace("\\", "/");
}To exploit this vulnerability, an attacker must craft a RAR archive containing a file entry with a specific naming convention and induce a victim to extract it on a vulnerable Linux/Unix system.
Step-by-Step Attack Vector:
..\..\..\..\home\victim\.bashrc.createFile. The Linux filesystem interprets the filename as a literal string. The canonical path remains within the extraction root, bypassing the security check.\ and rejoins it with /. The path becomes ../../../../home/victim/.bashrc.The impact of CVE-2026-28208 is rated as Medium (CVSS 5.9), primarily due to the complexity requirement (AC:H) that the application must process a malicious file on a specific OS type (non-Windows). However, the practical impact is severe if these conditions are met.
Consequences:
/etc/cron.d/*, ~/.ssh/authorized_keys, or web server scripts), an attacker can execute arbitrary commands on the host system.The vulnerability does not affect Windows deployments because java.io.File on Windows correctly interprets backslashes as separators, allowing the canonical path check to function as intended.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
Junrar junrar | < 7.5.8 | 7.5.8 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-22 |
| CVSS v3.1 | 5.9 (Medium) |
| Attack Vector | Network (User Interaction Required) |
| Impact | Arbitrary File Write / RCE |
| Exploit Status | PoC Available |
| EPSS Score | 0.11% |
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.
CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.
CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.
CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.
A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.
CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.