GHSA-89m4-43j5-vhhx

Suggest an improvement
Source
https://github.com/advisories/GHSA-89m4-43j5-vhhx
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-89m4-43j5-vhhx/GHSA-89m4-43j5-vhhx.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-89m4-43j5-vhhx
Aliases
Published
2026-09-17T16:30:46Z
Modified
2026-09-17T16:45:06Z
Severity
  • 3.7 (Low) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N CVSS Calculator
Summary
Junrar: LocalFolderExtractor mkdir escape allows directory creation outside extraction root
Details

Summary

LocalFolderExtractor validates only the final canonical file path before extraction. However, makeFile() creates intermediate directories one path segment at a time without checking whether each created directory remains inside the destination folder.

A malicious RAR entry can make the final file path resolve inside the extraction destination, while causing intermediate mkdir() calls to create attacker-chosen directories outside the extraction root.

This is an extraction root escape via unchecked intermediate directory creation. The default impact is directory creation outside the intended destination, not unconditional arbitrary file content write.

Affected Code

  • src/main/java/com/github/junrar/LocalFolderExtractor.java
    • createFile() checks only the final canonical path.
    • makeFile() calls dir.mkdir() for each intermediate segment without containment checks.

Relevant code flow:

private File createFile(final FileHeader fh, final File destination) throws IOException {
    String name = invariantSeparatorsPathString(fh.getFileName());
    File f = new File(destination, name);
    String dirCanonPath = f.getCanonicalPath();
    if (!dirCanonPath.startsWith(destination.getCanonicalPath() + File.separator)) {
        throw new IllegalStateException(...);
    }
    if (!f.exists()) {
        f = makeFile(destination, name);
    }
    return f;
}

private File makeFile(final File destination, final String name) throws IOException {
    final String[] dirs = name.split("/");
    String path = "";
    for (int i = 0; i < dirs.length - 1; i++) {
        path = path + File.separator + dirs[i];
        File dir = new File(destination, path);
        dir.mkdir();
    }
    path = path + File.separator + dirs[dirs.length - 1];
    final File f = new File(destination, path);
    f.createNewFile();
    return f;
}

Impact

An attacker who can supply a malicious RAR archive can create directories outside the intended extraction directory.

This violates the expected extraction boundary and can be used for filesystem pollution or file-vs-directory squatting. For example, an attacker can create a directory at a path where a later security-sensitive file is expected, causing future writes to that path to fail.

Database specific
{
    "cwe_ids": [
        "CWE-22"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-09-17T16:30:46Z",
    "nvd_published_at": "2026-09-16T19:17:58Z",
    "severity": "LOW"
}
References

Affected packages

Maven / com.github.junrar:junrar

Package

Name
com.github.junrar:junrar
View open source insights on deps.dev
Purl
pkg:maven/com.github.junrar/junrar

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
7.6.1

Affected versions

0.*
0.7
1.*
1.0.0
1.0.1
2.*
2.0.0
3.*
3.0.0
3.1.0
4.*
4.0.0
5.*
5.0.0
6.*
6.0.0
6.0.1
7.*
7.0.0
7.1.0
7.2.0
7.3.0
7.4.0
7.4.1
7.5.0
7.5.1
7.5.2
7.5.3
7.5.4
7.5.5
7.5.6
7.5.7
7.5.8
7.5.9
7.5.10
7.6.0

Database specific

last_known_affected_version_range
"<= 7.6.0"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-89m4-43j5-vhhx/GHSA-89m4-43j5-vhhx.json"