CVE-2022-32221: POST following PUT confusion
What the report claims
A bug causes libcurl to perform an HTTP PUT when the user intends an HTTP POST, leading to potential information disclosure and use-after-free vulnerabilities.
Compare with curl's recorded outcome
Known vulnerability
A real vulnerability: CVE-2022-32221 POST following PUT confusion
Shown for comparison after analysis. The pipeline did not see this label.
ProveIt's finding
The available evidence does not settle the report. A maintainer should investigate.
Why this finding?
- The central claim (C1) about CURLOPT_POST vs CURLOPT_UPLOAD interaction cannot be evaluated because the provided source code snippets only show function entry points (curl_easy_perform, curl_easy_setopt), not the option processing logic in Curl_vsetopt or the HTTP method selection in easy_perform.
- All five claims depend on code not included in the provided context. The deterministic checks only confirm option symbols exist, not their behavioral interaction.
- The report references a known issue (#9507) and provides a concrete reproduction case, making the claim plausible, but the provided evidence is insufficient to confirm or refute it.
What still needs checking
- The implementation of Curl_vsetopt (in lib/setopt.c) showing how CURLOPT_POST and CURLOPT_UPLOAD are handled
- The implementation of easy_perform (in lib/easy.c) showing HTTP method selection logic
- Any code that sets data->set.upload or data->set.httpreq based on these options
How this analysis ran 5 claims · 0 citations verified
Checked against curl master on 2022-09-18 (6de7322c03d5). Test evaluation split. Citation verification checks that a referenced line was in the evidence; it does not prove the model interpreted it correctly.
Review a draft reply to the reporter
Edit and verify before sending.
Thank you for the detailed report and reproduction case. To evaluate this, we need to see the option handling code that processes CURLOPT_POST and CURLOPT_UPLOAD (in lib/setopt.c, Curl_vsetopt) and the HTTP method selection logic in lib/easy.c (easy_perform). The provided snippets only show the public API entry points. Could you point to the specific lines where these options interact, or should we fetch those files for review?
Inspect all claims and source code 5 claims · 2 code excerpts
Report claims
When CURLOPT_POST is set but CURLOPT_UPLOAD is also set, libcurl performs an HTTP PUT instead of the intended POST
Read the reasoning
The provided source code only shows curl_easy_perform and curl_easy_setopt entry points (lib/easy.c:769-772, lib/setopt.c:3122-3136). The actual logic that resolves CURLOPT_POST vs CURLOPT_UPLOAD and selects the HTTP method is in Curl_vsetopt (called from curl_easy_setopt) and easy_perform (called from curl_easy_perform), which are not included in the provided snippets. Without seeing the option handling and request preparation code, I cannot verify whether setting both options causes a PUT instead of POST.
The issue occurs during the request preparation phase before the transfer is sent
Read the reasoning
The claim states the issue occurs 'during the request preparation phase before the transfer is sent' but the provided code does not include the request preparation logic (easy_perform or the HTTP method selection code). The only perform-related code shown is the trivial wrapper curl_easy_perform at lib/easy.c:769-772.
Setting both CURLOPT_POST and CURLOPT_UPLOAD in the same easy handle causes the unintended PUT
Read the reasoning
Same as C1: the trigger condition (setting both CURLOPT_POST and CURLOPT_UPLOAD) is described, but the code that processes these options and decides the HTTP method is not in the provided snippets. The curl_easy_setopt function at lib/setopt.c:3122-3136 only shows the varargs dispatch to Curl_vsetopt.
Sensitive data from CURLOPT_READDATA may be sent to an unintended host, and freed data may be accessed after free
Read the reasoning
The impact claim (sensitive data from CURLOPT_READDATA sent to unintended host, use-after-free) depends entirely on C1 being true. Since C1 cannot be verified from the provided code, this impact claim also cannot be verified. The deterministic checks only confirm the option symbols exist, not their interaction behavior.
The provided test program demonstrates the bug by sending a PUT to host1.com with secret data when a POST to host2.com was intended
Read the reasoning
The reproduction code is provided in the report, but without the curl internal logic that handles CURLOPT_POST and CURLOPT_UPLOAD, I cannot confirm the test program would demonstrate the described bug. The provided curl source does not include the relevant decision points.
Read the original report (excerpt)
Source code
| 769 | CURLcode curl_easy_perform(struct Curl_easy *data) |
| 770 | { |
| 771 | return easy_perform(data, FALSE); |
| 772 | } |
| 3122 | CURLcode curl_easy_setopt(struct Curl_easy *data, CURLoption tag, ...) |
| 3123 | { |
| 3124 | va_list arg; |
| 3125 | CURLcode result; |
| 3126 | |
| 3127 | if(!data) |
| 3128 | return CURLE_BAD_FUNCTION_ARGUMENT; |
| 3129 | |
| 3130 | va_start(arg, tag); |
| 3131 | |
| 3132 | result = Curl_vsetopt(data, tag, arg); |
| 3133 | |
| 3134 | va_end(arg); |
| 3135 | return result; |
| 3136 | } |