Parallel upload hangs curl if upload file not found
When curl is run with the parallel flag and an upload file that does not exist locally, the tool hangs indefinitely instead of exiting. An attacker who can influence such a command could cause a denial of service by stalling scripts or services that rely on curl.
- Disclosed after 3 days
Attempting to upload (-T) a not found file with parallel (-Z) flag present, will cause curl to get stuck and never terminate, potentially stalling scripts that make use of this particular flags.
curl -T blabla-notexists -Z upload.example.com www.google.com www.cnn.com www.apple.com
Same issue occurs if using -Z or --parallel flags.
$ curl -T blabla-notexists -Z upload.example.com www.google.com www.cnn.com www.apple.com curl: Can't open 'blabla-notexists'! curl: try 'curl --help' or 'curl --manual' for more information DL% UL% Dled Uled Xfers Live Qd Total Current Left Speed -- -- 0 0 1 0 1 --:--:-- 0:00:01 --:--:-- 0 curl: Can't open 'blabla-notexists'! curl: try 'curl --help' or 'curl --manual' for more information curl: Can't open 'blabla-notexists'! curl: try 'curl --help' or 'curl --manual' for more information curl: Can't open 'blabla-notexists'! curl: try 'curl --help' or 'curl --manual' for more information curl: Can't open 'blabla-notexists'! curl: try 'curl --help' or 'curl --manual' for more information curl: Can't open 'blabla-notexists'! curl: try 'curl --help' or 'curl --manual' for more information curl: Can't open 'blabla-notexists'! curl: try 'curl --help' or 'curl --manual' for more information curl: Can't open 'blabla-notexists'! curl: try 'curl --help' or 'curl --manual' for more information curl: Can't open 'blabla-notexists'! curl: try 'curl --help' or 'curl --manual' for more information curl: Can't open 'blabla-notexists'! curl: try 'curl --help' or 'curl --manual' for more information curl: Can't open 'blabla-notexists'! curl: try 'curl --help' or 'curl --manual' for more information
Doesn't happen with --parallel-max or --parallel-immediate flags.
Observing the network with tcpdump, shows NO traffic at all.
I suspect this is just an ordinary bug, but reporting it in case there is a security angle that might be present. Really the only obvious security issue is that curl will block possibly forever, and if curl tool is used inside a script or binary (via system() for example) could cause that script/binary to stop/block/hang. In some cases, this could lead to a bad situation, leading to denial of service or loss of service availability for program/process/server/service using curl in such a way.
Not 100% sure, but I suspect that libcurl does not have this issue. I could be wrong.
Steps to Reproduce: Upload (-T) a file with curl while in parallel mode (-Z) and the upload file must not exist locally.
curl -T blabla-notexists -Z upload.example.com www.google.com www.cnn.com www.apple.com
Impact
curl hangs leading to denial of service or loss of service availablity for script or binary using curl CLI tool.
Mitigation: Don't use -Z parallel flag with -T upload flag.
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 a bug in curl's parallel transfer handling where a local file-open failure does not properly terminate the transfer, leaving the process waiting indefinitely.
Impact
curl hangs, which could lead to denial of service or loss of service availability for a script or binary using the curl CLI tool.
What the attacker needed
Curl CLI with parallel and upload flags; upload file does not exist locally
The fix
Avoid using the parallel flag together with the upload flag.
How it was found
- Run curl with the upload flag pointing to a file that does not exist locally.
- Include the parallel flag and several URLs.
- Observe that curl prints repeated 'Can't open' errors but never exits.
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 transferring data. The parallel flag lets it work on several transfers at once. If you ask it to upload a file that is not on your computer, it should print an error and stop, but with the parallel flag it gets stuck forever, which can freeze any script waiting for it.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.