CVE-2022-32207: Unpreserved file permissions
What the report claims
Curl fails to preserve file permissions when writing CURLOPT_COOKIEJAR, CURLOPT_ALTSVC, and CURLOPT_HSTS databases, resetting permissions to 0666 & ~umask and potentially overwriting symlinks or special files, leading to information leaks and system damage.
Compare with curl's recorded outcome
Known vulnerability
A real vulnerability: CVE-2022-32207 Non-preserved file permissions
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 failure to preserve file permissions cannot be verified because the provided curl_source lacks the actual database writing implementation for CURLOPT_COOKIEJAR, CURLOPT_ALTSVC, and CURLOPT_HSTS.
- The reproduction steps and impact claims depend on code paths not shown in the provided source snippets (only CMakeLists.txt, curl_setup.h, memdebug.h are provided).
- The report is specific and plausible, citing a concrete commit and issue number, but the evidence needed to confirm or refute it is not in the provided context.
- A human maintainer should examine the cookie jar, altsvc, and hsts file-writing code (likely in lib/cookie.c, lib/hsts.c, or similar) at the relevant revision.
What still needs checking
- Source code for the functions that write CURLOPT_COOKIEJAR, CURLOPT_ALTSVC, and CURLOPT_HSTS databases (e.g., cookie_jar_write, hsts_save, altsvc_save)
- The commit b834890a3fa3f525cd8ef4e99554cdb4558d7e1b diff or the code it changed
- File opening/renaming logic that would show permission handling and symlink behavior
How this analysis ran 6 claims · 0 citations verified
Checked against curl master on 2022-05-17 (0842936292f9). Dev 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. The provided code snippets do not include the cookie jar, altsvc, or hsts database writing logic, so we cannot verify the permission preservation behavior from this context alone. Could you point to the specific source files and functions (e.g., in lib/cookie.c, lib/hsts.c) where these databases are written? That would allow us to check the file permission handling and symlink/special-file behavior you describe.
Inspect all claims and source code 6 claims · 4 code excerpts
Report claims
curl fails to preserve file permissions when writing CURLOPT_COOKIEJAR, CURLOPT_ALTSVC, and CURLOPT_HSTS databases
Read the reasoning
The provided curl_source does not contain the implementation code for writing CURLOPT_COOKIEJAR, CURLOPT_ALTSVC, or CURLOPT_HSTS databases. Only CMakeLists.txt, curl_setup.h, and memdebug.h are shown, which define build configuration and header macros but not the database writing logic. Without the actual file-writing code, I cannot verify whether permissions are preserved.
the vulnerability was introduced in commit b834890a3fa3f525cd8ef4e99554cdb4558d7e1b
Read the reasoning
The external source E1 (RFC 4914 references) does not mention commit b834890a3fa3f525cd8ef4e99554cdb4558d7e1b or curl issue #4914. The deterministic checks note only 2/12 quoted lines appear in curl at the checked revision, but the relevant commit diff is not provided.
using umask 022 and creating a cookie.db file with permissions 600 before curl accesses it
Read the reasoning
This describes a reproduction scenario, not code behavior. The code path that would handle this scenario is not in the provided source.
a file that was previously protected becomes readable by other users and symlinks may be replaced with malicious databases or special files may be overwritten
Read the reasoning
Impact claims depend on the actual file-writing behavior, which is not shown in the provided source. The symlink replacement and /dev/null overwrite claims require examining the file-opening and renaming logic, which is absent.
steps: set umask 022, create a cookie.db with 600 permissions, run curl with -b and -c pointing to it, then list the file permissions
Read the reasoning
Reproduction steps reference external URL (google.com) and command-line flags (-b, -c). The handling of these flags and the cookie jar writing code is not in the provided source.
the fix recommendation suggests checking if the file is a regular file before overwriting and preserving ownership and group
Read the reasoning
This is a fix recommendation, not a claim about current code. The provided source shows S_ISREG macro exists (curl_setup.h:712) and fdopen macro exists (memdebug.h:153), but fchmod is noted as not present at this revision per deterministic checks. The recommendation's code is not in the codebase.
Deterministic checks that failed
- symbol fchmod exists in other curl releases but not at 0842936292f9
- quote only 2/12 quoted lines appear anywhere in curl at 0842936292f9
What the report says about other projects
not addressed The vulnerability was introduced in commit b834890a3fa3f525cd8ef4e99554cdb4558d7e1b to fix issue #4914
Read the original report (excerpt)
Source code
| 133 | install(TARGETS ${LIB_NAME} |
| 134 | EXPORT ${TARGETS_EXPORT_NAME} |
| 135 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 136 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 137 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
| 138 | ) |
| 139 | |
| 140 | export(TARGETS ${LIB_NAME} |
| 141 | APPEND FILE ${PROJECT_BINARY_DIR}/libcurl-target.cmake |
| 142 | NAMESPACE ${PROJECT_NAME}:: |
| 143 | ) |
| 329 | # define stat(fname,stp) curlx_win32_stat(fname, stp) |
Show 1 lines (not cited by the judge)
| 712 | #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) |
Show 1 lines (not cited by the judge)
| 153 | #define fdopen(file,mode) curl_dbg_fdopen(file,mode,__LINE__,__FILE__) |