Miggo Logo

CVE-2022-1271: An arbitrary file write vulnerability was found in GNU gzip's zgrep utility. When zgrep is...

8.8

CVSS Score
3.1

Basic Information

EPSS Score
0.7146%
Published
9/1/2022
Updated
8/26/2024
KEV Status
No
Technology
-

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability CVE-2022-1271 affects GNU gzip's zgrep utility. The zgrep utility is a shell script, typically named zgrep.in in the source code. Analysis of the provided URLs, especially the direct link to the fixing commit in the GNU gzip repository (https://git.savannah.gnu.org/cgit/gzip.git/commit/?id=dc9740df61e575e8c3148b7bd3c147a81ea00c7c), confirms the vulnerability and the fix. The commit message is 'zgrep: avoid exploit via multi-newline file names'. The patch shows changes to zgrep.in, specifically modifying the sed command used to escape filenames. The original sed command failed to handle filenames with multiple newlines correctly, leading to improper sanitization. This allowed crafted filenames to inject commands or alter file paths. Since zgrep is a shell script, there isn't a traditional function name as in compiled languages. The vulnerable code is a specific block within the main file-processing loop of the script. Runtime indicators would involve the zgrep script executing, which in turn calls printf and sed. The vulnerability lies in how zgrep constructs the arguments for and processes the output of these sed calls when handling filenames.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

*n *r*itr*ry *il* writ* vuln*r**ility w*s *oun* in *NU *zip's z*r*p utility. W**n z*r*p is *ppli** on t** *tt**k*r's **os*n *il* n*m* (*or *x*mpl*, * *r**t** *il* n*m*), t*is **n ov*rwrit* *n *tt**k*r's *ont*nt to *n *r*itr*ry *tt**k*r-s*l**t** *il*.

Reasoning

T** vuln*r**ility *V*-****-**** *****ts *NU *zip's z*r*p utility. T** `z*r*p` utility is * s**ll s*ript, typi**lly n*m** `z*r*p.in` in t** sour** *o**. *n*lysis o* t** provi*** URLs, *sp**i*lly t** *ir**t link to t** *ixin* *ommit in t** *NU *zip r*p