curl --continue-at confusion
When curl is run with --continue-at, the --no-clobber option is ignored and output is appended to an existing file, and combining --continue-at with --remove-on-error can delete an existing file on an early error. An attacker who can influence curl arguments could cause unexpected modification or deletion of files.
- Disclosed after 7 months
Summary:
When curl command is used with --continue-at, the --no-clobber is unexpectedly ignored and curl will append the output to the target file, even if it already exists. If --continue-at is used with--remove-on-error it can lead to unexpected removal of the file on early errors. Note that this also happens when combined with --remote-name and --remote-header-name.
Steps To Reproduce:
Tampering a file even if --no-clobber:
echo not to be touched > robots.txtcurl --no-clobber -C 1 -O https://curl.se/robots.txt
NOTE: Without -C 1 the output is written to robots.txt.<n>.
Deleting a file when combining --remove-on-error with --continue-at:
echo something > importantcurl --remove-on-error -C 1 -o important https://nonexisting.curl.se/
NOTE: Without -C 1 the file is not removed.
Remediation
The easiest way to stop these issues from happening is to forbid use of --continue-at in combination with --no-clobber or --remove-on-error.
Impact
Unexpected modification or deletion of an existing file.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the resume option takes precedence over the file-safety options without checking for the conflicting combination.
Impact
Unexpected modification or deletion of an existing file could occur when these option combinations are used.
What the attacker needed
Local file with the target name exists; curl invoked with conflicting options
The fix
The tool should refuse to combine the resume option with the no-clobber or remove-on-error options.
How it was found
- Create a local file with known contents.
- Run curl with the resume option, the no-clobber option and remote-name against a URL.
- Observe that the existing file is appended to instead of being left alone.
- Create another local file and run curl with remove-on-error, the resume option and an output name pointing at a non-existent host.
- Observe that the existing file is removed.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
curl is a command-line tool for downloading things from the internet. Some of its options are meant to protect files on your disk, such as refusing to overwrite an existing file or deleting a partial download when something fails. This report shows that one option, which resumes a download, quietly overrides those protections, so a file you expected to be safe can be changed or removed.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.