CVE-2010-3842
local file overwrite
Project curl Security Advisory, October 13th 2010 Permalink
VULNERABILITY
curl offers a command line option --remote-header-name (also usable as -J) which uses the filename of the Content-disposition: header when it saves the downloaded data locally.
curl attempts to cut off the directory parts from any given filename in the header to only store files in the current directory. It might overwrite a local file using the same name as the header specifies.
The stripping of the directory did not take backslashes into account. On some operating systems, backslashes are used to separate directories and filenames. This allows a rogue server to send back a response that overwrites a filename in the local machine that the user is allowed to write, potentially a system file, a command or a known executable.
Operating systems affected include Windows, Netware, MSDOS, OS/2 and Symbian.
This error is only present in the curl command line tool, it is NOT a problem of the library libcurl.
INFO
The Common Vulnerabilities and Exposures (CVE) project has assigned the name CVE-2010-3842 to this issue.
CWE-30: Path Traversal
Severity: High
AFFECTED VERSIONS
- Affected versions: curl 7.20.0 to and including 7.21.1
- Not affected versions: curl < 7.20.0 and curl >= 7.21.2
- Introduced-in: https://github.com/curl/curl/commit/80675818e0417be8c99151
Also note that curl is used by many applications, and not always advertised as such.
SOLUTION
libcurl 7.21.2 makes sure that it also strips off paths specified using backslashes as path separator.
RECOMMENDATIONS
We suggest you take one of the following actions immediately, in order of preference:
A - Upgrade to curl and libcurl 7.21.2
B - Apply patch and rebuild
C - Stop using the --remote-header-name
/-J
option
TIMELINE
Dan Fandrich realized the problem exists and reported to the rest of the team on September 3 2010.
We discussed solutions and a first patch was written and tested on September 4th.
curl 7.21.2 was released on October 13th 2010, just before this flaw was publicly disclosed.
CREDITS
- Reported-by: Dan Fandrich
- Patched-by: Daniel Stenberg
Thanks a lot!