/

CVE-2025-67030

Severity:

HIGH RISK

(8.8)

Directory Traversal in Plexus Utils Expand.extractFile

CVE-2025-67030

Modified

Vulnerability type

Category:

Directory Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write leading to Potential Remote Code Execution

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A directory traversal flaw in the extractFile method of org.codehaus.plexus.util.Expand (plexus-utils) allows crafted archive entries to escape the intended extraction directory.

When untrusted archives are processed, an attacker may leverage this to write files to arbitrary locations and, in some environments, reach arbitrary code execution via overwritten or planted executables, scripts, or configuration files.

Affected context

This vulnerability appears in Java applications that depend on plexus-utils and use org.codehaus.plexus.util.Expand to unpack archives (e.g., ZIPs) without enforcing safe extraction paths.

It is most relevant when:

  • The application processes archives supplied or influenced by external users, CI/CD jobs, or plugins.
  • Extracted content is written to directories that affect application behavior, build artifacts, or deployment outputs.
  • Downstream tools may execute or load files from these locations after extraction.

Exploit preconditions

  • Attack surface: Archive extraction functionality exposed via APIs, build tools, plugins, or web interfaces that call Expand.extractFile.
  • Required access: Ability to provide or manipulate the archive being extracted (e.g., uploaded artifact, dependency bundle, plugin package, or build input).
  • Trigger point: The application invokes Expand on the attacker-controlled archive, and path normalization/validation does not prevent traversal sequences.
  • Why exploitation is possible: The implementation does not robustly sanitize or constrain file paths inside the archive, allowing use of ../ or absolute path tricks to escape the intended extraction directory and write files elsewhere.

Why this happens

The core issue aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

The extractFile logic relies on archive entry names to construct filesystem paths but does not consistently validate that the resulting paths remain inside the designated target directory.

Attackers can craft archive entries with traversal sequences (../ segments) or special paths so that, after path resolution, files land outside the expected extraction root.

When those locations are sensitive (e.g., configuration folders, classpath directories, or executable locations), the bug shifts from a filesystem integrity issue into a code-execution primitive through subsequent use of the modified files.

Potential impact

  • Overwriting existing files on the server, workstation, or build agent where extraction runs.
  • Creating new files in directories outside the intended extraction root.
  • Planting or modifying scripts, JARs, configuration files, or binaries that may later be executed.
  • Tampering with build outputs and artifacts in CI/CD pipelines (supply-chain risk).
  • Escalating to arbitrary code execution if overwritten or planted files are trusted and run by the system or application.

General mitigation guidance

Effective mitigation focuses on constraining file extraction paths and limiting trust in archive contents:

  • Enforce strict path normalization and verification: resolve each target path and confirm it remains within the expected extraction root before writing.
  • Reject archive entries containing .., absolute paths, or platform-specific path escape tricks.
  • Use higher-level utilities or libraries that provide "zip-slip"-safe extraction routines by default.
  • Run archive extraction in directories with limited privileges; avoid extracting directly into system paths, shared classpaths, or live application directories.
  • Apply least-privilege OS permissions to the process performing extraction so that, even if traversal occurs, the impact is constrained.
  • Treat all externally supplied archives as untrusted inputs and apply the same scrutiny as for other user-controlled data.

How teams detect issues like this

Organizations may identify this type of vulnerability through a combination of code inspection and automated analysis:

  • Static analysis patterns:
  • Flag uses of org.codehaus.plexus.util.Expand or custom archive extraction code that concatenates paths without explicit root-bound checks.
  • Look for missing validation of archive entry names and absence of checks that resolved paths stay beneath a specific base directory.
  • Code review signals:
  • Manual inspection of any "unzip", "untar", or "expand" logic, especially in build tools, plugins, and artifact handling code.
  • Attention to code that extracts directly into configuration or execution paths (e.g., bin/, lib/, plugin directories).
  • Policy enforcement:
  • CI rules that disallow custom archive extraction helpers unless they pass a security review or conform to a standardized, vetted utility.
  • Use of SAST/IDE plugins that highlight common "zip-slip" / directory traversal patterns in archive-handling code.

Sources

SourceLink
gist.github.comgist.github.com/weaver4VD/3216dac645220f8c9b488362f61241ec
github.comgithub.com/codehaus-plexus/plexus-utils/commit/6d780b3378829318ba5c2d29547e0012d5b29642
github.comgithub.com/codehaus-plexus/plexus-utils/issues/294
github.comgithub.com/codehaus-plexus/plexus-utils/pull/295
github.comgithub.com/codehaus-plexus/plexus-utils/pull/296
access.redhat.comaccess.redhat.com/errata/RHSA-2026:17668
access.redhat.comaccess.redhat.com/errata/RHSA-2026:18054
access.redhat.comaccess.redhat.com/errata/RHSA-2026:18055
access.redhat.comaccess.redhat.com/errata/RHSA-2026:18059
access.redhat.comaccess.redhat.com/errata/RHSA-2026:35990
access.redhat.comaccess.redhat.com/errata/RHSA-2026:35991
access.redhat.comaccess.redhat.com/errata/RHSA-2026:35992
access.redhat.comaccess.redhat.com/errata/RHSA-2026:35996
access.redhat.comaccess.redhat.com/errata/RHSA-2026:35997
access.redhat.comaccess.redhat.com/errata/RHSA-2026:36012
access.redhat.comaccess.redhat.com/errata/RHSA-2026:38500
access.redhat.comaccess.redhat.com/errata/RHSA-2026:38514
access.redhat.comaccess.redhat.com/errata/RHSA-2026:38796
access.redhat.comaccess.redhat.com/errata/RHSA-2026:40841
access.redhat.comaccess.redhat.com/errata/RHSA-2026:41948
access.redhat.comaccess.redhat.com/errata/RHSA-2026:7109
access.redhat.comaccess.redhat.com/errata/RHSA-2026:7380
access.redhat.comaccess.redhat.com/security/cve/CVE-2025-67030
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2451409
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-67030.json

Frequently asked

questions

It can be, depending on how the host application exposes archive processing.

If users can upload or otherwise supply archives that are passed to Expand.extractFile without strong validation, an attacker may exploit the issue remotely through that interface.

The attacker must be able to influence the archive being extracted—such as providing a ZIP as an upload, dependency, plugin, or build artifact.

No direct shell or local account access is required if the application itself handles archives on the attacker's behalf.

The safest pattern is to ensure robust path canonicalization and containment:

normalize the target path of each archive entry, verify it remains a descendant of the intended extraction directory, and reject any entry that fails this check.

When possible, rely on well-reviewed libraries that implement these guarantees by design.

Treat archive contents as untrusted data, enforce strict directory boundaries during extraction, and incorporate secure coding guidelines for file I/O.

Add static analysis or code review checklists that specifically call out path traversal and "zip-slip" patterns whenever new archive-handling logic or dependencies are introduced.

Find out what's already
exploitable in your codebase.