CVE-2017-1000257
Critical · 9.1CVSS
9.1
EPSS
6.2%
Published
Oct 31, 2017
CISA due date
—
Cloudanix analysis
A bug in a widely used network library can let a malicious email server cause programs to read extra memory or crash when fetching messages.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Data Exposure
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Out-of-bounds read when IMAP FETCH response reports zero-byte data: libcurl passes a null pointer and zero length to the deliver-data callback, which then calls strlen on a potentially non-null-terminated heap buffer, reading past its end or crashing.
Why it matters to the business
Applications that use libcurl to retrieve email via IMAP can leak adjacent heap memory to the calling program or experience denial of service, risking exposure of sensitive data in transit or unexpected service outages.
How an attack unfolds
An attacker who controls or impersonates an IMAP server returns a FETCH response line declaring zero bytes of data; the vulnerable libcurl client processes the response, invokes strlen on uncontrolled heap memory, and either crashes or returns attacker-influenced data to the application.
How to fix it
Upgrade libcurl to a version containing the fix for this zero-length IMAP response handling issue; rebuild and redeploy all dependent applications; verify the updated library is loaded at runtime.
How to confirm the fix worked
Confirm the running libcurl version is newer than the vulnerable release, then exercise IMAP FETCH operations with zero-length responses in a test environment and monitor for crashes or unexpected memory reads.
Typical attack path
- Position as or compromise an IMAP server reachable by the target client
- Return a crafted FETCH response indicating zero-length data
- Trigger the client to issue the FETCH command
- Cause strlen to read past the supplied buffer, resulting in memory disclosure or crash
How to detect it
Review application and system logs for segmentation faults or memory errors in processes that use libcurl with IMAP; inspect core dumps or heap traces around FETCH handling code paths.
What your security team should do
- Prioritize patching libcurl across all systems that perform IMAP operations
- Inventory applications statically or dynamically linked against libcurl
- Add runtime library version checks to deployment pipelines
- Monitor vendor advisories for any remaining affected distributions
The record
An IMAP FETCH response line indicates the size of the returned data, in number of bytes. When that response says the data is zero bytes, libcurl would pass on that (non-existing) data with a pointer and the size (zero) to the deliver-data function. libcurl's deliver-data function treats zero as a magic number and invokes strlen() on the data to figure out the length. The strlen() is called on a heap based buffer that might not be zero terminated so libcurl might read beyond the end of it into whatever memory lies after (or just crash) and then deliver that to the application as if it was actually downloaded.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Alpine:v3.10 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.11 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.12 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.13 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.14 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.15 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.16 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.17 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.18 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.19 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.20 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.21 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.22 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.3 | curl | 0 | 7.55.0-r2 |
| Alpine:v3.4 | curl | 0 | 7.55.0-r2 |
| Alpine:v3.5 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.6 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.7 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.8 | curl | 0 | 7.56.1-r0 |
| Alpine:v3.9 | curl | 0 | 7.56.1-r0 |
| Debian:11 | curl | 0 | 7.56.1-1 |
| Debian:12 | curl | 0 | 7.56.1-1 |
| Debian:13 | curl | 0 | 7.56.1-1 |
| Debian:7 | curl | 0 | 7.26.0-1+wheezy22 |
| Debian:8 | curl | 0 | 7.38.0-4+deb8u7 |
| Debian:9 | curl | 0 | 7.52.1-5+deb9u2 |
| Mageia:5 | curl | 0 | 7.40.0-3.14.mga5 |
| Mageia:6 | curl | 0 | 7.54.1-2.4.mga6 |
| Red Hat:enterprise_linux:7::client | curl | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::client | curl-debuginfo | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::client | libcurl | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::client | libcurl-devel | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::computenode | curl | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::computenode | curl-debuginfo | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::computenode | libcurl | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::computenode | libcurl-devel | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::server | curl | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::server | curl-debuginfo | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::server | libcurl | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::server | libcurl-devel | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::workstation | curl | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::workstation | curl-debuginfo | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::workstation | libcurl | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:enterprise_linux:7::workstation | libcurl-devel | 0 | 0:7.29.0-42.el7_4.1 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-curl | 0 | 0:7.61.1-1.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-curl-debuginfo | 0 | 0:7.61.1-1.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-httpd | 0 | 0:2.4.34-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-httpd-debuginfo | 0 | 0:2.4.34-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-httpd-devel | 0 | 0:2.4.34-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-httpd-manual | 0 | 0:2.4.34-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-httpd-tools | 0 | 0:2.4.34-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-libcurl | 0 | 0:7.61.1-1.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-libcurl-devel | 0 | 0:7.61.1-1.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-libnghttp2 | 0 | 0:1.7.1-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-libnghttp2-devel | 0 | 0:1.7.1-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-mod_ldap | 0 | 0:2.4.34-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-mod_proxy_html | 0 | 1:2.4.34-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-mod_session | 0 | 0:2.4.34-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-mod_ssl | 0 | 1:2.4.34-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-nghttp2 | 0 | 0:1.7.1-7.el6 |
| Red Hat:rhel_software_collections:3::el6 | httpd24-nghttp2-debuginfo | 0 | 0:1.7.1-7.el6 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-curl | 0 | 0:7.61.1-1.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-curl-debuginfo | 0 | 0:7.61.1-1.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-httpd | 0 | 0:2.4.34-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-httpd-debuginfo | 0 | 0:2.4.34-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-httpd-devel | 0 | 0:2.4.34-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-httpd-manual | 0 | 0:2.4.34-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-httpd-tools | 0 | 0:2.4.34-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-libcurl | 0 | 0:7.61.1-1.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-libcurl-devel | 0 | 0:7.61.1-1.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-libnghttp2 | 0 | 0:1.7.1-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-libnghttp2-devel | 0 | 0:1.7.1-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-mod_ldap | 0 | 0:2.4.34-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-mod_md | 0 | 0:2.4.34-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-mod_proxy_html | 0 | 1:2.4.34-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-mod_session | 0 | 0:2.4.34-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-mod_ssl | 0 | 1:2.4.34-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-nghttp2 | 0 | 0:1.7.1-7.el7 |
| Red Hat:rhel_software_collections:3::el7 | httpd24-nghttp2-debuginfo | 0 | 0:1.7.1-7.el7 |
| SUSE:Linux Enterprise Desktop 12 SP2 | curl | 0 | 7.37.0-37.8.1 |
| SUSE:Linux Enterprise Desktop 12 SP3 | curl | 0 | 7.37.0-37.8.1 |
| SUSE:Linux Enterprise Server 12 SP2 | curl | 0 | 7.37.0-37.8.1 |
| SUSE:Linux Enterprise Server 12 SP3 | curl | 0 | 7.37.0-37.8.1 |
| SUSE:Linux Enterprise Server for Raspberry Pi 12 SP2 | curl | 0 | 7.37.0-37.8.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP2 | curl | 0 | 7.37.0-37.8.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP3 | curl | 0 | 7.37.0-37.8.1 |
| SUSE:Linux Enterprise Software Development Kit 12 SP2 | curl | 0 | 7.37.0-37.8.1 |
| SUSE:Linux Enterprise Software Development Kit 12 SP3 | curl | 0 | 7.37.0-37.8.1 |
| Ubuntu:14.04:LTS | curl | 0 | 7.35.0-1ubuntu2.12 |
| Ubuntu:16.04:LTS | curl | 0 | 7.47.0-1ubuntu2.4 |
| openSUSE:Tumbleweed | curl | 0 | 7.79.1-1.1 |
Related vulnerabilities
- CVE-2021-22898 curl 7.7 through 7.76.1 suffers from an information disclosure when the `-t` command line… Also affects curl
- CVE-2019-5481 Double-free vulnerability in the FTP-kerberos code in cURL 7.52.0 to 7.65.3. Also affects curl
- CVE-2019-5482 Heap buffer overflow in the TFTP protocol handler in cURL 7.19.4 to 7.65.3. Also affects curl
- CVE-2019-5436 A heap buffer overflow in the TFTP receiving code allows for DoS or arbitrary code… Also affects curl
- CVE-2017-8817 The FTP wildcard function in curl and libcurl before 7.57.0 allows remote attackers to… Also affects curl
- CVE-2017-8816 The NTLM authentication feature in curl and libcurl before 7.57.0 on 32-bit platforms… Also affects curl
- CVE-2016-7167 Multiple integer overflows in the (1) curl_escape, (2) curl_easy_escape, (3)… Also affects curl
- CVE-2016-7141 curl and libcurl before 7.50.2, when built with NSS and the libnsspem.so library is… Also affects curl