Miggo Logo

CVE-2024-2004:
When a protocol selection parameter option disables all protocols without adding any then the...

3.5

CVSS Score
3.1

Basic Information

EPSS Score
0.68501%
Published
3/27/2024
Updated
10/29/2024
KEV Status
No
Technology
-

Technical Details

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

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability (CVE-2024-2004) occurs when a protocol selection option (like curl --proto -all,-http) effectively disables all protocols. Due to a logic error, the default set of protocols would remain enabled instead of no protocols being allowed. The analysis of the fixing commit 17d302e56221f5040092db77d4f85086e8a20e0e reveals that the core of the vulnerability lies in the protocol2num function in lib/setopt.c. This function is responsible for parsing the protocol string and setting the curl_prot_t bitmask. The fix involved moving the initialization *val = 0; (where val is the pointer to the protocol bitmask) to the very beginning of this function. This ensures that the protocol set is always cleared before attempting to parse and add allowed protocols from the input string. If the string results in no protocols being explicitly allowed, the set correctly remains empty. The Curl_vsetopt function is the caller of protocol2num for the CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR options. It passes the user-provided string and the address of the protocol set (e.g., data->set.allowed_protocols) to protocol2num. The patch also modified Curl_vsetopt to pass the pointer to data->set.allowed_protocols directly, rather than using an intermediate variable, ensuring the fix in protocol2num has the intended effect. Therefore, protocol2num contains the direct faulty logic, and Curl_vsetopt is the immediate function that processes the user input leading to the vulnerable code path.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

W**n * proto*ol s*l**tion p*r*m*t*r option *is**l*s *ll proto*ols wit*out ***in* *ny t**n t** ****ult s*t o* proto*ols woul* r*m*in in t** *llow** s*t *u* to *n *rror in t** lo*i* *or r*movin* proto*ols. T** **low *omm*n* woul* p*r*orm * r*qu*st to *

Reasoning

T** vuln*r**ility (*V*-****-****) o**urs w**n * proto*ol s*l**tion option (lik* `*url --proto -*ll,-*ttp`) *****tiv*ly *is**l*s *ll proto*ols. *u* to * lo*i* *rror, t** ****ult s*t o* proto*ols woul* r*m*in *n**l** inst*** o* no proto*ols **in* *llow