Miggo Logo

CVE-2024-11053:
When asked to both use a `.netrc` file for credentials and to follow HTTP redirects, curl could...

9.1

CVSS Score
3.1

Basic Information

EPSS Score
0.38656%
CWE
-
Published
12/11/2024
Updated
1/31/2025
KEV Status
No
Technology
-

Technical Details

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

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability CVE-2024-11053 describes a scenario where curl could leak a password from an initial host to a redirected host if the .netrc file had an entry for the redirected host that omitted the password. The analysis of the fixing commit (e9b9bbac22c26cf6731) pinpoints the logical flaw to the 'parsenetrc' function in 'lib/netrc.c'. This function is responsible for parsing .netrc files. The patch modifies 'parsenetrc' to ensure that if a login is found for a host but no password is specified in its .netrc entry, the password output parameter is explicitly set to an empty string. This prevents the password from a previous host (stored in the variable passed to 'parsenetrc' by its caller) from being reused for the redirected host. Therefore, 'parsenetrc' is identified as the function containing the vulnerable logic.

The function override_login in lib/url.c calls Curl_parsenetrc (which is the public wrapper for the static parsenetrc) and is responsible for managing credentials, including those from .netrc files. While override_login is involved in the process where the vulnerability manifests (it calls the vulnerable function and uses its output), the actual logical flaw of not clearing a stale password when a .netrc entry lacks one resides within parsenetrc itself. The changes in override_login in the same commit are more about how it interacts with Curl_parsenetrc and handles the results, rather than fixing the core parsing logic error.

The commit 46620b97431e19c53ce82e5 (introducing commit) refactored how credentials were handled, moving them from connection-specific to transfer-specific structures (data->state.aptr.*). This change, while aiming to improve credential management, inadvertently created the conditions for the vulnerability if the .netrc parsing logic (parsenetrc) didn't correctly clear passwords when they weren't found for a specific host during a redirect.

The commit 9fce2c55d4b0273ac99 is a regression fix for parsenetrc related to how it handles password-only entries, further confirming that parsenetrc is the central function for .netrc parsing logic and where the fixes were concentrated.

Therefore, parsenetrc is the most direct answer for the function containing the vulnerability. During runtime, override_login would call Curl_parsenetrc (which calls the static parsenetrc), and the incorrect password handling within parsenetrc would lead to the credential leak when processing redirects. Thus, both override_login and parsenetrc (and its wrapper Curl_parsenetrc) would appear in a stack trace during exploitation, but the root cause of the vulnerability is in parsenetrc.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

W**n *sk** to *ot* us* * `.n*tr*` *il* *or *r***nti*ls *n* to *ollow *TTP r**ir**ts, *url *oul* l**k t** p*sswor* us** *or t** *irst *ost to t** *ollow**-to *ost un**r **rt*in *ir*umst*n**s. T*is *l*w only m*ni**sts its*l* i* t** n*tr* *il* **s *n *

Reasoning

T** vuln*r**ility *V*-****-***** **s*ri**s * s**n*rio w**r* *url *oul* l**k * p*sswor* *rom *n initi*l *ost to * r**ir**t** *ost i* t** .n*tr* *il* *** *n *ntry *or t** r**ir**t** *ost t**t omitt** t** p*sswor*. T** *n*lysis o* t** *ixin* *ommit (***