Bug 1575533 (CVE-2018-1000300)

Summary: CVE-2018-1000300 curl: FTP shutdown response heap-based buffer overflow can potentially lead to RCE
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: bgollahe, bodavis, csutherl, dbhole, erik-fedora, gzaronik, hhorak, jclere, john.j5live, jorton, kanderso, kdudka, lgao, luhliari, lzachar, mbabacek, mike, myarboro, omajid, paul, rwagner, security-response-team, twalsh, weli, yozone
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: curl 7.60.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-10 22:05:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1578682, 1578683, 1578684    
Bug Blocks: 1575537    
Attachments:
Description Flags
Upstream patch none

Description Adam Mariš 2018-05-07 08:26:35 UTC
A heap-based buffer overflow can happen when closing down an FTP connection with very long server command replies.

When doing FTP transfers, curl keeps a spare "closure handle" around internally that will be used when an FTP connection gets shut down since the original curl easy handle is then already removed.

FTP server response data that gets cached from the original transfer might then be larger than the default buffer size (16 KB) allocated in the "closure handle", which can lead to a buffer overwrite. The contents and size of that overwrite is controllable by the server.

This situation was detected by an assert() in the code, but that was of course only preventing bad stuff in debug builds. This bug is very unlikely to trigger with non-malicious servers.

This issue was introduced by:

https://github.com/curl/curl/commit/e40e9d7f0decc79

Affected versions: curl 7.54.1 to and including curl 7.59.0
Not affected versions: curl < 7.54.1 and curl >= 7.60.0

Comment 1 Adam Mariš 2018-05-07 08:26:38 UTC
Acknowledgments:

Name: the Curl project
Upstream: Dario Weisser

Comment 2 Adam Mariš 2018-05-07 08:46:54 UTC
Created attachment 1432531 [details]
Upstream patch

Comment 3 Adam Mariš 2018-05-16 07:25:38 UTC
External References:

https://curl.haxx.se/docs/adv_2018-82c2.html

Comment 4 Adam Mariš 2018-05-16 07:27:10 UTC
Created curl tracking bugs for this issue:

Affects: fedora-all [bug 1578683]


Created mingw-curl tracking bugs for this issue:

Affects: fedora-all [bug 1578684]