FTP shutdown response buffer overflow
curl might overflow a heap based memory buffer when closing down an FTP connection with long server command replies. When doing FTP transfers, curl keeps a spare "closure handle" around internally that is 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 highly unlikely to trigger with non-malicious servers.
02 / AFFECTED SOFTWARE
Affected packages
8 explicit affected versions
16 explicit affected versions
03 / CONNECTIONS
Connected vulnerabilities
04 / EVIDENCE
Source records
curl version curl 7.54.1 to and including curl 7.59.0 contains a CWE-122: Heap-based Buffer Overflow vulnerability in denial of service and more that can result in curl might overflow a heap based memory buffer when closing down an FTP connection with very long server command replies.. This vulnerability appears to have been fixed in curl < 7.54.1 and curl >= 7.60.0.
curl might overflow a heap based memory buffer when closing down an FTP connection with long server command replies. When doing FTP transfers, curl keeps a spare "closure handle" around internally that is 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 highly unlikely to trigger with non-malicious servers.
05 / REFERENCES
Further evidence
- http://www.oracle.com/technetwork/security-advisory/cpujul2018-4258247.html
- http://www.oracle.com/technetwork/security-advisory/cpuoct2018-4428296.html
- http://www.securityfocus.com/bid/104207
- http://www.securitytracker.com/id/1040933
- https://curl.haxx.se/docs/adv_2018-82c2.html
- https://security.gentoo.org/glsa/201806-05
- https://usn.ubuntu.com/3648-1/
- https://www.oracle.com/technetwork/security-advisory/cpujan2019-5072801.html