Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2022-1271

CVE-2022-1271: GNU Gzip Path Traversal Vulnerability

CVE-2022-1271 is a path traversal vulnerability in GNU Gzip's zgrep utility that enables arbitrary file writes through crafted filenames. This article covers technical details, affected versions, impact, and mitigation.

Published: February 17, 2026

CVE-2022-1271 Overview

An arbitrary file write vulnerability was discovered in GNU gzip's zgrep utility that allows attackers to overwrite arbitrary files on the system. When zgrep processes a maliciously crafted filename containing two or more newlines, an attacker can embed selected content and target file names within the crafted multi-line filename. This results in the ability to write attacker-controlled content to arbitrary files, potentially leading to code execution or system compromise.

Critical Impact

Remote, low-privileged attackers can force zgrep to write arbitrary files on vulnerable systems, enabling potential code execution, configuration tampering, or complete system compromise through malicious file overwrites.

Affected Products

  • GNU gzip (all versions prior to patch)
  • Red Hat JBoss Data Grid 7.0.0
  • Debian Linux 10.0
  • Tukaani XZ (xzgrep utility)

Discovery Timeline

  • August 31, 2022 - CVE-2022-1271 published to NVD
  • June 9, 2025 - Last updated in NVD database

Technical Details for CVE-2022-1271

Vulnerability Analysis

This vulnerability exists in the zgrep utility, which is used to search compressed files without first decompressing them. The flaw stems from insufficient validation when the utility processes filenames that contain embedded newline characters. When a filename contains two or more newlines, the zgrep utility fails to properly sanitize the input, allowing portions of the filename to be interpreted as content to write and target file paths.

The attack exploits a fundamental input validation weakness (CWE-20: Improper Input Validation) combined with improper handling of special character sequences (CWE-179: Incorrect Behavior Order: Early Validation). An attacker can craft a malicious filename where the content before certain newlines becomes the data to write, and the content after becomes the target file path.

This vulnerability is particularly dangerous because it requires only low privileges to exploit and can be triggered remotely in scenarios where users process attacker-supplied archive files or filenames through automated scripts using zgrep.

Root Cause

The root cause lies in insufficient input validation within the zgrep shell script when handling filenames with embedded newline characters. The utility fails to properly escape or reject filenames containing multiple newlines before passing them to underlying shell commands. This allows the crafted filename to be split and interpreted in unintended ways, with parts of the filename becoming shell command arguments that specify file write operations to arbitrary paths.

Attack Vector

The attack is network-accessible, requiring an attacker to supply a crafted filename to a system running a vulnerable version of gzip's zgrep utility. Attack scenarios include:

  1. Archive processing: An attacker creates an archive containing files with malicious multi-line filenames. When a victim extracts and processes these files with zgrep, the arbitrary file write occurs.

  2. Automated pipelines: Build systems, log processors, or backup utilities that automatically process compressed files using zgrep can be exploited by introducing files with crafted filenames.

  3. User interaction: A user manually running zgrep on a file with a crafted name supplied by an attacker.

The vulnerability allows writing arbitrary content to any file writable by the user running zgrep. This can be leveraged to:

  • Overwrite shell configuration files (.bashrc, .profile) for code execution
  • Modify cron jobs or systemd service files
  • Tamper with application configuration files
  • Write to web-accessible directories for web shell deployment

Detection Methods for CVE-2022-1271

Indicators of Compromise

  • Presence of files with unusual multi-line filenames in processed directories
  • Unexpected modifications to system configuration files, shell profiles, or cron jobs
  • Log entries showing zgrep operations on files with newline characters embedded in filenames
  • Anomalous file creation or modification timestamps in critical system directories

Detection Strategies

  • Monitor for zgrep process executions with arguments containing newline characters or escape sequences
  • Implement file integrity monitoring (FIM) on critical configuration files and directories
  • Deploy behavioral detection rules that alert on unexpected file writes following zgrep execution
  • Analyze system logs for patterns indicating filename injection attempts in compression utilities

Monitoring Recommendations

  • Enable comprehensive auditing on file operations in sensitive directories (/etc, /home/*/.bashrc, cron directories)
  • Configure SentinelOne to monitor for suspicious command-line patterns involving zgrep and unusual filename characters
  • Implement alerting for modifications to shell initialization files and scheduled task configurations
  • Review archived files for suspicious filenames before processing in automated pipelines

How to Mitigate CVE-2022-1271

Immediate Actions Required

  • Update GNU gzip to the latest patched version immediately on all affected systems
  • Apply the Tukaani XZ patch for xzgrep if using XZ utilities
  • Review and update any scripts that invoke zgrep on untrusted filenames
  • Implement input validation in wrapper scripts to reject filenames containing newline characters
  • Temporarily disable automated zgrep processing of untrusted archives until patches are applied

Patch Information

Security patches have been released by multiple vendors to address this vulnerability. The GNU gzip mailing list contains the official bug report and patch discussion. Tukaani has released a specific patch for xzgrep addressing the same vulnerability in their implementation.

For enterprise environments, consult the following vendor advisories:

  • Red Hat CVE-2022-1271 Advisory
  • Debian CVE-2022-1271 Tracker
  • Gentoo GLSA 202209-01 Advisory
  • NetApp Advisory ntap-20220930-0006

Workarounds

  • Avoid processing files with untrusted filenames using zgrep until patched
  • Implement wrapper scripts that validate filenames and reject those containing newline characters before passing to zgrep
  • Use alternative tools for searching compressed files that are not affected by this vulnerability
  • Sanitize all filenames by stripping or encoding newline characters before compression or processing
bash
# Wrapper script to sanitize filenames before zgrep processing
# Rejects filenames containing newline characters
sanitize_filename() {
    local filename="$1"
    if [[ "$filename" == *$'\n'* ]]; then
        echo "Error: Filename contains newline characters - rejected for security" >&2
        return 1
    fi
    return 0
}

# Example usage before zgrep
if sanitize_filename "$target_file"; then
    zgrep "$pattern" "$target_file"
fi

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

  • Vulnerability Details
  • TypePath Traversal

  • Vendor/TechGnu Gzip

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability0.81%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-179

  • CWE-20
  • Technical References
  • Red Hat CVE-2022-1271 Advisory

  • Red Hat Bug Report #2073310

  • Tukaani XZ Commit Reference

  • Debian CVE-2022-1271 Tracker

  • Gentoo GLSA 202209-01 Advisory

  • NetApp Advisory ntap-20220930-0006
  • Vendor Resources
  • GNU Gzip Bug Email

  • Tukaani XZ Patch for ZDI-CAN-16587

  • Openwall OSS-Security Email
  • Latest CVEs
  • CVE-2025-52793: Esselink.nu Settings CSRF Vulnerability

  • CVE-2025-52772: Virtual Moderator CSRF Vulnerability

  • CVE-2025-48279: WC MyParcel Belgium XSS Vulnerability

  • CVE-2025-39381: KiotViet Sync CSRF Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English