CVE-2026-41991: GNU gzip gzexe Insecure Temporary File Vulnerability
GNU gzip's gzexe utility has a flaw in how it creates temporary files when the mktemp utility is unavailable. Instead of using a secure method, it generates predictable temporary filenames based on the process ID (PID) alone. A local attacker can exploit this by creating a symbolic link at the predicted filename pointing to any file the victim can write to. When gzexe runs and follows that symlink, it overwrites the target file—giving an attacker a way to corrupt or modify files belonging to the user running gzexe.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 4.7 MEDIUM · CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N
- Weaknesses (CWE)
- CWE-377
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-29 / 2026-07-01
NVD description (verbatim)
GNU gzip contains a vulnerability in the gzexe utility related to insecure temporary file handling. When the mktemp utility is not available in the user’s PATH, gzexe falls back to constructing a temporary file path based solely on the process ID (PID). This predictable filename is created without exclusive access or existence checks. A local attacker can pre‑create the predicted temporary file path as a symbolic link pointing to an arbitrary file writable by the victim. When gzexe runs, it follows the symlink and overwrites the target file, resulting in a time‑of‑check to time‑of‑use (TOCTOU) condition that allows arbitrary file overwrite. This issue has been fixed in the commit 4e6f8b24ab823146ab8776f0b7fe486ab34d4269
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2026-41991 is a TOCTOU (time-of-check to time-of-use) vulnerability in gzexe stemming from insecure temporary file creation. The gzexe utility normally relies on mktemp for secure temporary file generation. When mktemp is unavailable, it falls back to a predictable naming scheme based solely on the process ID—a value an attacker can enumerate or predict. The temporary file is created without checking for pre-existence or using exclusive access flags (such as O_EXCL), allowing an attacker to pre-populate a symlink at that path. When gzexe attempts to create and write to the file, it dereferences the symlink and overwrites the attacker-specified target. This violates the assumption that the temporary file path is both unique and under the application's control. The vulnerability is mapped to CWE-377 (Insecure Temporary File) and has been remediated in commit 4e6f8b24ab823146ab8776f0b7fe486ab34d4269.
Business impact
The practical impact depends on the attacker's capability and intent. Since gzexe is typically invoked by individual users compressing or decompressing files, the window of exploitation is limited to moments when the utility is actively running. An attacker must have local system access and the ability to predict or influence the target file path. However, successful exploitation could result in unauthorized modification or corruption of files belonging to the user running gzexe—potentially affecting configuration files, scripts, or data that the user has write access to. In environments where gzexe is used in automated or privileged contexts (though uncommon), the risk escalates. For most organizations, this is a lower-priority issue unless gzexe is central to critical workflows or deployed in multi-tenant environments where privilege isolation is relied upon.
Affected systems
This vulnerability affects GNU gzip installations where the gzexe utility is present and mktemp is not available in the user's PATH. gzexe is a bundled utility that compresses executable files in-place. Affected versions are those prior to the fix commit 4e6f8b24ab823146ab8776f0b7fe486ab34d4269. Organizations should check which gzip version is deployed and whether gzexe is actively used in their environment. The issue is most likely to surface on minimal or embedded systems, container images, or specialized environments where mktemp may not be present by default. Standard Linux distributions typically include mktemp, reducing exposure for mainstream users.
Exploitability
Exploitation requires local system access (AV:L) and relies on a race condition or predictability window that may be difficult to consistently hit (AC:H). The attacker must be able to create files in the same directory where gzexe will attempt to create its temporary file, typically /tmp or a location derived from the user's home directory. The attacker must also correctly predict the PID that gzexe will use, which is possible but requires either guessing, brute-forcing, or timing manipulation. No privileged access is required (PR:L), and no user interaction is needed (UI:N), but the overall attack chain is moderately complex. Practical exploitation is feasible in controlled scenarios (e.g., a co-resident attacker on a shared system), but the utility nature and limited execution context make widespread weaponization unlikely. The vulnerability is not tracked in CISA's Known Exploited Vulnerabilities catalog.
Remediation
Apply the security patch from the GNU gzip project that incorporates commit 4e6f8b24ab823146ab8776f0b7fe486ab34d4269 or later. Verify the exact patched version number against the vendor's advisory or release notes before deploying. As an interim mitigation, ensure mktemp is available in the system PATH for all users who invoke gzexe, or restrict gzexe usage to trusted, controlled environments. Review your use cases for gzexe and assess whether this utility is necessary for your operations; many modern workflows use alternative compression tools or libraries that may have stronger security postures.
Patch guidance
Check your GNU gzip version using 'gzip --version'. Cross-reference the output against the vendor's release notes or security advisory to confirm whether your version includes commit 4e6f8b24ab823146ab8776f0b7fe486ab34d4269 or a later fix. Patches are typically available through your distribution's package manager. For Linux distributions, update gzip via your standard package management tool (apt, yum, pacman, etc.). For other systems or source-based deployments, download the latest gzip source from the GNU project and verify the commit history. Test that mktemp is available in the PATH after patching, and validate that gzexe functions correctly in your environment before retiring older installations. Document the patch deployment date and version for compliance and audit purposes.
Detection guidance
Monitor file system activity in /tmp and similar temporary directories for unexpected symlinks or rapid file creation patterns that may indicate pre-placement of symlinks by a local attacker. Log the execution of gzexe via auditd or similar kernel-level auditing, capturing both the PID and the temporary filenames it attempts to create. Correlate these logs with symlink creation events originating from other user contexts. Check for the presence of mktemp in the system PATH and alert if it becomes unavailable on systems where gzexe is known to be in use. Review system logs for file overwrite events affecting sensitive files shortly after gzexe execution. Consider leveraging integrity monitoring tools to detect unexpected changes to files that may have been targets of a symlink-based overwrite attack. These detections are most useful in multi-user or multi-tenant environments.
Why prioritize this
This vulnerability merits attention but is not critical. The CVSS 3.1 score of 4.7 (MEDIUM) reflects the local-only attack vector, high attack complexity, and lack of confidentiality or availability impact—only integrity is affected. Prioritize remediation if: (1) your organization runs multi-user systems where gzexe is actively used; (2) gzexe is invoked in automated scripts or services with elevated privileges; (3) you operate in a compliance regime that mandates patching all known vulnerabilities promptly. For single-user or locked-down systems where gzexe is rarely or never used, deferral to a regular patching cycle is acceptable. Given the absence of known exploitation in the wild (not in CISA's KEV list), this is a sound engineering and hygiene fix rather than an emergency response priority.
Risk score, explained
The CVSS 3.1 score of 4.7 (MEDIUM) is driven by a local-only attack surface (AV:L), high attack complexity (AC:H)—reflecting the race condition and PID prediction difficulty—and low privilege requirements (PR:L). Impact is limited to integrity (I:H), with no confidentiality or availability loss. The score appropriately reflects that while the vulnerability is real and could allow local file overwrite, the practical risk is constrained by environment, predictability, and use-case factors. It does not yet appear in CISA's Known Exploited Vulnerabilities catalog, indicating no widespread active exploitation has been observed. Organizations should treat this as a medium-priority but non-emergency patch.
Frequently asked questions
What is gzexe and why do we need to worry about it?
gzexe is a GNU gzip utility that compresses an executable file in-place, replacing the original with a compressed version that decompresses and runs itself when invoked. It is not commonly used in modern workflows; most users rely on standalone compression tools or distribution mechanisms instead. However, if your scripts, automation, or legacy systems invoke gzexe, you should ensure the vulnerability is patched. If gzexe is not used in your environment, the practical risk is minimal.
How realistic is it that an attacker could exploit this?
Exploitation requires local system access and the ability to correctly predict or influence a process ID. In multi-user systems with untrusted users or in shared hosting environments, the risk is elevated. In single-user desktops, servers in locked-down data centers, or containerized environments with minimal trust boundaries, the risk is lower. The CVSS score of 4.7 (MEDIUM) and the lack of public exploitation suggest this is a sound engineering fix rather than an imminent security crisis.
Should we delay our normal patch cycle to address this immediately?
No, unless gzexe is central to your operations or your environment has high multi-user risk. The CVSS score, local-only attack vector, and high attack complexity argue against emergency treatment. Incorporate the fix into your regular patch management schedule, prioritizing it according to your organization's risk profile and compliance requirements.
What versions of GNU gzip are affected?
Any version prior to the incorporation of commit 4e6f8b24ab823146ab8776f0b7fe486ab34d4269 is potentially affected. Check your gzip version and verify against the vendor's security advisory or release notes. Most modern Linux distributions should already include a patched version; verify by contacting your distribution maintainer or checking their security tracker.
This analysis is provided for informational purposes and reflects the state of public information as of the publication date. Readers should independently verify all technical details, patch version numbers, and affected product versions against the vendor's official security advisories before making deployment decisions. No exploit code or weaponized proof-of-concept instructions are included in this document. Organizations should conduct their own risk assessments and security testing in isolated environments prior to applying patches in production. SEC.co and its authors assume no liability for the accuracy or completeness of this analysis or for actions taken in reliance upon it. Source: NVD (public-domain), retrieved 2026-08-08. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-41001MEDIUMSpring Boot Artemis Embedded Message Broker Local Privilege Escalation
- CVE-2026-45384MEDIUMArbitrary File Overwrite in bit7z via Symlink Attack
- CVE-2026-46406MEDIUMClaude Code /copy Command Local Information Disclosure and Symlink Exploitation
- CVE-2026-49134HIGHCodexBar Privilege Escalation in CLI Installer (Race Condition)
- CVE-2026-49135HIGHCodexBar Insecure Temporary File Handling Allows Local Credential Theft
- CVE-2026-56288MEDIUMGNU Patch NULL Pointer Dereference DoS Vulnerability
- CVE-2026-56289MEDIUMGNU Patch Denial of Service via Malformed Hunk Offsets
- CVE-2026-57053MEDIUMGNU libidn Out-of-Bounds Memory Read Vulnerability