CVE-2026-39245: Directory Traversal in decompress Package – Upgrade to 4.2.2
The decompress package before version 4.2.2 contains a path validation flaw that allows attackers to write files outside the intended extraction directory. When decompressing archives, the library checks whether extracted files stay within a safe folder, but the check uses a string-matching approach that can be bypassed. For example, a path like '/tmp/app_config' would incorrectly pass validation for the directory '/tmp/app' because the string '/tmp/app' appears at the start of it—even though they are different directories. An attacker can exploit this to place malicious files in adjacent directories, potentially compromising the application or system.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 6.2 MEDIUM · CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
- Weaknesses (CWE)
- CWE-22
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-07-09 / 2026-07-13
NVD description (verbatim)
decompress before 4.2.2 contains an improper path containment check that enables directory traversal and arbitrary file write. The safeMakeDir function (index.js line 29) and the extraction path validation (index.js line 106) use String.indexOf() to verify the resolved path is within the output directory: realDestinationDir.indexOf(realOutputPath) !== 0. This check is flawed because it does not enforce a path separator boundary. For example, "/tmp/app_config".indexOf("/tmp/app") returns 0, incorrectly passing the check even though /tmp/app_config is outside /tmp/app. Combined with the unvalidated symlink creation in the same package, an attacker can write arbitrary files to directories adjacent to the extraction target. This is a bypass of the fix for CVE-2020-12265. The correct check requires appending a path separator: realParentPath.indexOf(realOutputPath + path.sep) !== 0.
5 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2026-39245 is a directory traversal vulnerability in the decompress package caused by improper path containment validation. The safeMakeDir function and extraction path validation at index.js lines 29 and 106 rely on String.indexOf() to confirm that resolved paths remain within the output directory. The vulnerable check—realDestinationDir.indexOf(realOutputPath) !== 0—lacks path separator enforcement, creating a semantic bypass. A path like '/tmp/app_config' returns 0 when indexOf('/tmp/app') is called, passing validation despite residing outside '/tmp/app'. This flaw is compounded by unvalidated symlink creation within the package. The vulnerability represents a bypass of the earlier CVE-2020-12265 mitigation. The correct implementation requires appending path.sep: realParentPath.indexOf(realOutputPath + path.sep) !== 0, ensuring boundary-aware validation.
Business impact
Successful exploitation enables arbitrary file writes to the filesystem, with scope limited to the local system where the application runs. In typical deployment scenarios, this could allow an attacker who controls archive contents to overwrite application configuration files, inject malicious code into adjacent directories, or corrupt critical data. For applications processing untrusted archives (e.g., user uploads, third-party integrations), this creates a direct path to code execution or privilege escalation if the application runs with elevated permissions. Organizations relying on decompress for archive handling should assume that previously-validated archive files may now pose a risk if processed with vulnerable versions.
Affected systems
The decompress package versions prior to 4.2.2 are affected. Any application or service that includes decompress as a dependency and processes compressed archives is vulnerable. This includes Node.js applications that extract user-supplied or untrusted archives. Verify your dependency tree and lockfile (package-lock.json, yarn.lock, or pnpm-lock.yaml) to identify if decompress is a direct or transitive dependency, and confirm the installed version. Check vendor documentation or GitHub releases to confirm version 4.2.2 availability and compatibility with your application.
Exploitability
Exploitation requires local access and the ability to influence archive content that the application will decompress. The attack vector is local with low complexity: no special privileges, user interaction, or network access are needed—only control over a compressed file that the target application will extract. The main constraint is that the attacker must either directly provide the archive or compromise a repository from which the application fetches it. Given that many applications process archives from multiple sources (file uploads, API responses, CI/CD pipelines), the exploitability is moderate to high in real-world scenarios, though the CVSS score reflects the local-only attack surface.
Remediation
Upgrade decompress to version 4.2.2 or later, which corrects the path validation logic to enforce path separator boundaries. Review your application's dependency management and ensure the update is reflected in your lockfile. For applications that cannot immediately upgrade, implement additional validation of extracted file paths in application code as a compensating control, though this should not replace the package-level fix. Test the upgrade in a non-production environment first to confirm compatibility with your application version.
Patch guidance
Update decompress to version 4.2.2 or higher. If you use npm: run 'npm update decompress' or specify the minimum version in package.json and reinstall. If you use Yarn: run 'yarn upgrade decompress' to ^4.2.2. If you use pnpm: run 'pnpm update decompress'. After updating, regenerate your lockfile, run your test suite, and confirm that archive extraction behaves correctly. Verify against the official decompress GitHub repository or npm package page to confirm the exact version number and release date before deploying.
Detection guidance
Monitor for attempts to extract archives where output paths contain suspicious parent-directory traversal sequences (../, etc.), though note that this vulnerability does not require explicit traversal syntax—the flaw is in validation logic itself. Log all archive extraction operations, including source file, destination directory, and extracted file paths. Implement file integrity monitoring on configuration directories and other sensitive paths adjacent to typical extraction targets. Identify applications using decompress by scanning dependencies; tools like 'npm audit', 'snyk test', or 'trivy' can flag vulnerable versions in your supply chain. Look for recent archive processing by the affected application and correlate with any unexpected file modifications in sibling directories.
Why prioritize this
Although the CVSS score is medium (6.2) due to local-only attack surface, prioritize based on context: if your application processes archives from untrusted sources or runs with elevated privileges, treat this as higher priority. The vulnerability is a bypass of a prior fix, indicating the attack surface remains attractive to adversaries. Organizations with strict security postures should patch immediately; those with air-gapped or low-risk archive workflows may defer slightly, but should not delay indefinitely.
Risk score, explained
The CVSS 3.1 score of 6.2 (MEDIUM) reflects a local attack vector with no privilege requirements or user interaction needed, but no confidentiality impact and limited scope. The integrity impact is marked HIGH because arbitrary file writes are possible. The score assumes local-only access; if your threat model includes remote archive ingestion (e.g., via API or user upload), the practical risk is higher than the score suggests.
Frequently asked questions
Does this vulnerability require network access to exploit?
No. The attack is local-only. An attacker must have the ability to provide or influence a compressed archive that the vulnerable application will decompress. In cloud or web scenarios, this might mean uploading a malicious archive, but the exploitation itself occurs on the target system during extraction.
Can I work around this without upgrading if I validate archive contents in my application code?
Partial mitigation is possible by adding path validation in your application layer—for example, checking that extracted file paths are within the intended directory using a robust path normalization library—but this does not replace the package-level fix and may introduce gaps. Upgrade to 4.2.2 or later as the primary remediation; application-level checks are a secondary safeguard.
Is this vulnerability actively exploited in the wild?
The vulnerability is not currently listed on the CISA Known Exploited Vulnerabilities (KEV) catalog, indicating no confirmed active exploitation at this time. However, the technical details are public, and the flaw is straightforward to exploit if an attacker can control archive contents, so do not rely on lack of current exploitation as a reason to delay patching.
Does this affect older versions of Node.js or specific environments?
No; this is a decompress package vulnerability, not a Node.js version issue. Any environment running decompress versions before 4.2.2 is affected, regardless of Node.js version. Verify your actual installed version in node_modules or your lockfile, as Node.js version and decompress version are independent.
This analysis is provided for informational purposes to support security decision-making. Verify all patch version numbers, release dates, and vendor recommendations against official sources before deployment. The severity and applicability of this vulnerability depend on your specific use of the decompress package, archive sources, and application privileges. SEC.co makes no warranties regarding the accuracy or completeness of this analysis. Always test security updates in a non-production environment first. Source: NVD (public-domain), retrieved 2026-08-17. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2018-25393MEDIUMNavigate CMS 2.8.5 Path Traversal Vulnerability (CVSS 6.5)
- CVE-2018-25421MEDIUMOpen STA Manager 2.3 Path Traversal File Download Vulnerability
- CVE-2019-25734MEDIUMContact Form by WD CSRF & Local File Inclusion Vulnerability
- CVE-2019-25740MEDIUMJoomla com_jsjobs Arbitrary File Deletion Vulnerability
- CVE-2022-50953MEDIUMWordPress admin-word-count-column Plugin Local File Read Vulnerability
- CVE-2024-47263MEDIUMSynology Hyper Backup Path Traversal – Admin Privilege Required
- CVE-2024-47273MEDIUMSynology Hyper Backup Path Traversal Vulnerability (4.3 MEDIUM)
- CVE-2025-24268MEDIUMmacOS Path Traversal Vulnerability – Patch Sequoia 15.4