---
id: CVE-2022-1271
title: An arbitrary file write vulnerability was found in GNU gzip's zgrep utility
summary: >-
  An arbitrary file write vulnerability was found in GNU gzip's zgrep utility.
  When zgrep is applied on the attacker's chosen file name (for example, a
  crafted file name), this can overwrite an attacker's content to an arbitrary
  attacker-s…
severity: high
cvss: 8.8
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'
cwe:
  - CWE-179
  - CWE-20
vendor: gnu
product: gzip
affected:
  - gzip < 1.12
  - jboss_data_grid = 7.0.0
  - debian_linux = 10.0
  - xz < 5.2.5
patched:
  - gzip 1.12
  - xz 5.2.5
published: '2022-08-31'
updated: '2026-10-14'
sourceUpdated: '2026-10-14T13:17:17.760'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2022-1271'
references:
  - url: 'https://access.redhat.com/security/cve/CVE-2022-1271'
    label: secalert@redhat.com
  - url: 'https://bugzilla.redhat.com/show_bug.cgi?id=2073310'
    label: secalert@redhat.com
  - url: >-
      https://git.tukaani.org/?p=xz.git%3Ba=commit%3Bh=69d1b3fc29677af8ade8dc15dba83f0589cb63d6
    label: secalert@redhat.com
  - url: 'https://lists.gnu.org/r/bug-gzip/2022-04/msg00011.html'
    label: secalert@redhat.com
  - url: 'https://security-tracker.debian.org/tracker/CVE-2022-1271'
    label: secalert@redhat.com
  - url: 'https://security.gentoo.org/glsa/202209-01'
    label: secalert@redhat.com
  - url: 'https://security.netapp.com/advisory/ntap-20220930-0006/'
    label: secalert@redhat.com
  - url: 'https://tukaani.org/xz/xzgrep-ZDI-CAN-16587.patch'
    label: secalert@redhat.com
  - url: 'https://www.openwall.com/lists/oss-security/2022/04/07/8'
    label: secalert@redhat.com
  - url: 'https://access.redhat.com/security/cve/CVE-2022-1271'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://bugzilla.redhat.com/show_bug.cgi?id=2073310'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: >-
      https://git.tukaani.org/?p=xz.git%3Ba=commit%3Bh=69d1b3fc29677af8ade8dc15dba83f0589cb63d6
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://lists.gnu.org/r/bug-gzip/2022-04/msg00011.html'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://security-tracker.debian.org/tracker/CVE-2022-1271'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://security.gentoo.org/glsa/202209-01'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://security.netapp.com/advisory/ntap-20220930-0006/'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://tukaani.org/xz/xzgrep-ZDI-CAN-16587.patch'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://www.openwall.com/lists/oss-security/2022/04/07/8'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://cert-portal.siemens.com/productcert/html/ssa-398330.html'
    label: 0b142b55-0307-4c5a-b3c9-f314f3fb7c5e
  - url: 'https://cert-portal.siemens.com/productcert/html/ssa-455250.html'
    label: 0b142b55-0307-4c5a-b3c9-f314f3fb7c5e
tags:
  - nvd
epss: 0.0507
epssPercentile: 0.92147
ingestedAt: '2026-10-14T13:30:58.418Z'
---

## Overview

An arbitrary file write vulnerability was found in GNU gzip's zgrep utility. When zgrep is applied on the attacker's chosen file name (for example, a crafted file name), this can overwrite an attacker's content to an arbitrary attacker-selected file. This flaw occurs due to insufficient validation when processing filenames with two or more newlines where selected content and the target file names are embedded in crafted multi-line file names. This flaw allows a remote, low privileged attacker to force zgrep to write arbitrary files on the system.

## Affected

- `gzip < 1.12`
- `jboss_data_grid = 7.0.0`
- `debian_linux = 10.0`
- `xz < 5.2.5`

## Remediation

Upgrade past the affected range:

- `gzip 1.12`
- `xz 5.2.5`
