Skip to main content
Vulnerability Database/CVE-2024-47611

CVE-2024-47611: XZ Utils Path Traversal Vulnerability

CVE-2024-47611 is a path traversal flaw in XZ Utils for Windows that allows attackers to inject malicious arguments through Unicode character manipulation. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-47611 Overview

CVE-2024-47611 is a command line argument injection vulnerability in XZ Utils versions 5.6.2 and older when built for native Windows using MinGW-w64 or MSVC. The command line tools convert Unicode characters that do not exist in the current legacy code page to similar-looking ASCII characters through best-fit mapping. Some mapped characters change the meaning of the command line, allowing attackers to perform argument injection or directory traversal through malicious filenames. The flaw is tracked under CWE-88: Improper Neutralization of Argument Delimiters. Builds for Cygwin or MSYS2 are unaffected, and liblzma is unaffected.

Critical Impact

Attackers can craft filenames with Unicode characters that get converted to ASCII delimiters, injecting arguments into xz command invocations on native Windows builds.

Affected Products

  • XZ Utils 5.6.2 and earlier, built for native Windows with MinGW-w64
  • XZ Utils 5.6.2 and earlier, built for native Windows with MSVC
  • Command line tools only (xz, xzdec, lzmainfo); liblzma is unaffected

Discovery Timeline

  • 2024-10-02 - CVE-2024-47611 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-47611

Vulnerability Analysis

The vulnerability resides in how native Windows builds of XZ Utils convert wide-character command line arguments to the active legacy ANSI code page. When a Unicode character in a filename has no exact representation in the current code page, Windows applies best-fit character mapping. This mapping substitutes visually similar ASCII characters, some of which carry syntactic meaning on the command line.

For example, a Unicode full-width solidus or a modifier character can collapse to ASCII -, /, or .. An attacker who controls a filename passed to xz.exe can thereby introduce option flags or path traversal sequences that the invoking shell or wrapper script never intended. The result is argument injection or directory traversal driven entirely by the filename.

Root Cause

The root cause is reliance on Windows best-fit code page conversion when translating wide-character argv entries into narrow strings for internal processing. Best-fit mapping was never designed as a security boundary. XZ Utils 5.6.3 addresses this by embedding an application manifest in the EXE files, forcing the process to use UTF-8 as its active code page and bypassing best-fit substitutions.

Attack Vector

Exploitation requires an attacker-controlled filename being processed by a vulnerable xz binary on Windows, typically through an automated pipeline, archive extraction workflow, or script that forwards filenames to the tool. The attacker does not need local access or authentication, but the system must invoke the tool against the malicious name.

text
# Patch excerpt from CMakeLists.txt in XZ 5.6.3
# Source: https://github.com/tukaani-project/xz/commit/bf518b9ba446327a062ddfe67e7e0a5baed2394f

# When used with MSVC, CMake can merge .manifest files with
# linker-generated manifests and embed the result in an executable.
# However, when paired with MinGW-w64, CMake (3.30) ignores .manifest
# files. Embedding a manifest with a resource file works with both
# toolchains. It's also the way to do it with Autotools.
if(MSVC)
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
endif()

The patch adds common/w32_application.manifest to the Autotools build:

text
# Source: https://github.com/tukaani-project/xz/commit/bf518b9ba446327a062ddfe67e7e0a5baed2394f

common/tuklib_progname.c \
common/tuklib_progname.h \
common/w32_application.manifest \
common/w32_application.manifest.comments.txt

Detection Methods for CVE-2024-47611

Indicators of Compromise

  • Filenames containing non-ASCII Unicode characters that map to shell-significant ASCII glyphs such as -, /, \, or . under the active code page
  • Unexpected xz.exe invocations with option flags not generated by the calling script
  • Output files written outside the intended working directory, indicating successful directory traversal

Detection Strategies

  • Audit process creation events (Windows Event ID 4688 or Sysmon Event ID 1) for xz.exe command lines containing suspicious Unicode-to-ASCII mappings
  • Inspect archive and file-transfer logs for filenames with mixed scripts, full-width Latin characters, or compatibility-range codepoints
  • Review scripts and scheduled tasks on Windows hosts that pass untrusted filenames to XZ Utils binaries

Monitoring Recommendations

  • Baseline the normal command line arguments used with xz.exe and alert on deviations
  • Track file write operations by xz.exe outside expected output directories
  • Monitor the installed XZ Utils version across Windows hosts and flag any version at or below 5.6.2

How to Mitigate CVE-2024-47611

Immediate Actions Required

  • Upgrade all native Windows XZ Utils installations to version 5.6.3 or later
  • Inventory Windows systems and build pipelines that bundle XZ Utils binaries from third-party distributions
  • Validate or sanitize filenames before passing them to xz.exe in any automated workflow

Patch Information

The fix is included in XZ Utils 5.6.3. The remediation embeds a Windows application manifest in the EXE files that declares UTF-8 as the active code page, eliminating best-fit character substitution. See the GitHub Security Advisory GHSA-m538-c5qw-3cg4 and the upstream commit bf518b9 for full details.

Workarounds

  • Rebuild XZ Utils from source against the Cygwin or MSYS2 toolchains, which are not affected
  • Restrict xz.exe invocations to filenames composed solely of ASCII characters until the upgrade is deployed
  • Wrap calls to xz.exe so that filename arguments are passed through an allowlist or quoted path that cannot be misinterpreted
bash
# Example wrapper check before invoking xz on Windows
if [[ "$FILENAME" =~ [^[:ascii:]] ]]; then
  echo "Rejecting non-ASCII filename to mitigate CVE-2024-47611" >&2
  exit 1
fi
xz.exe -- "$FILENAME"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.