Miggo Logo

CVE-2021-31879:
GNU Wget through 1.21.1 does not omit the Authorization header upon a redirect to a different...

6.1

CVSS Score

Basic Information

EPSS Score
-
Published
5/24/2022
Updated
4/4/2024
KEV Status
No
Technology
-

Technical Details

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

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability CVE-2021-31879 in GNU Wget allows the Authorization header to be forwarded to a different origin (specifically, a different port on the same host) upon an HTTP redirect. I analyzed the commit 05530454940513c03561503eb916395216559758 from the Wget git repository, which addresses this issue. The commit modifies the create_authorization_line function in src/http.c. This function determines whether the Authorization header should be included in a request. The patch adds a condition to ensure that if the port differs in a redirect, the Authorization header is stripped by returning NULL. Therefore, the create_authorization_line function, in its pre-patch state, is the vulnerable function as it contained the flawed logic that led to the information disclosure. The function get_remote_file_headers calls create_authorization_line and is part of the vulnerable execution path when handling redirects, making it a relevant runtime indicator, but the core flaw resides in create_authorization_line's logic for header retention/stripping during redirects to a different port on the same host and scheme. The patch explicitly adds the port_differs check to this function to mitigate the vulnerability by ensuring the header is stripped under these conditions, which is direct evidence of the flaw's location and nature within this function. The vulnerability occurs because this function fails to remove the header when it should have been removed (when redirecting to a different port).

Vulnerable functions

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

WAF Protection Rules

WAF Rule

*NU W**t t*rou** *.**.* *o*s not omit t** *ut*oriz*tion *****r upon * r**ir**t to * *i***r*nt ori*in, * r*l*t** issu* to *V*-****-*******.

Reasoning

T** vuln*r**ility *V*-****-***** in *NU W**t *llows t** *ut*oriz*tion *****r to ** *orw*r*** to * *i***r*nt ori*in (sp**i*i**lly, * *i***r*nt port on t** s*m* *ost) upon *n *TTP r**ir**t. I *n*lyz** t** *ommit `***************************************