CVE-2024-11053:
When asked to both use a `.netrc` file for credentials and to follow HTTP
redirects, curl could...
9.1
Basic Information
Technical Details
Vulnerability Intelligence
Miggo AI
Root 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
.