CVE-2017-1000101: cURL: URL globbing out of bounds read
curl's URL globbing feature had an out-of-bounds read when parsing a numerical range in a crafted URL. An attacker could cause curl to read beyond a heap buffer, potentially leading to a crash or unintended memory disclosure.
- Fixed in 4 months
- Disclosed after 9 months
FYI, this security advisory will not be released until 9 August 2017:
curl supports "globbing" of URLs, in which a user can pass a numerical range
to have the tool iterate over those numbers to do a sequence of transfers.
In the globbing function that parses the numerical range, there was an
omission that made curl read a byte beyond the end of the URL if given a
carefully crafted, or just wrongly written, URL. The URL is stored in a heap
based buffer, so it could then be made to wrongly read something else instead
of crashing.
An example of a URL that triggers the flaw would be
`http://ur%20[0-60000000000000000000`.
Reported to project maintainers: 14 June 2017 Acknowledged: 14 June 2017 Patched: 14 June 2017 Released: 9 August 2017 Advisory: 9 August 2017
Stack:
curl -q http://ur%20[0-60000000000000000000
curl: (6) Couldn't resolve host 'ur'
=================================================================
==16611==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000023de8 at pc 0x0000004f9ecc bp 0x7ffef3e73b50 sp 0x7ffef3e73b48
READ of size 1 at 0x603000023de8 thread T0
#0 0x4f9ecb in glob_range /root/curl/src/tool_urlglob.c:282:12
#1 0x4f9ecb in glob_parse /root/curl/src/tool_urlglob.c:412
#2 0x4f9ecb in glob_url /root/curl/src/tool_urlglob.c:450
#3 0x4e2b37 in operate_do /root/curl/src/tool_operate.c:526:18
#4 0x4e076e in operate /root/curl/src/tool_operate.c:2052:20
#5 0x4de7d6 in main /root/curl/src/tool_main.c:252:14
#6 0x7fa930f74b44 in __libc_start_main /build/glibc-KShDyh/glibc-2.19/csu/libc-start.c:287
#7 0x4c3f1c in _start (/root/curl/src/curl+0x4c3f1c)
0x603000023de8 is located 0 bytes to the right of 24-byte region [0x603000023dd0,0x603000023de8)
allocated by thread T0 here:
#0 0x4a689b in malloc (/root/curl/src/curl+0x4a689b)
#1 0x7fa930fd4989 in __strdup /build/glibc-KShDyh/glibc-2.19/string/strdup.c:42
SUMMARY: AddressSanitizer: heap-buffer-overflow /root/curl/src/tool_urlglob.c:282 glob_range
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 an off-by-one error in the globbing range parser caused it to read one byte past the end of the URL buffer.
Impact
The out-of-bounds read could crash curl or potentially disclose memory contents, though the advisory does not confirm exploitability beyond a read.
What the attacker needed
Curl with URL globbing enabled; user runs curl with a crafted URL
The fix
The flaw was patched on 14 June 2017.
How it was found
- Run curl with a URL containing a malformed numerical glob range.
- Observe the heap-buffer-overflow read in glob_range.
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. It can expand patterns like [0-10] into multiple URLs, called globbing. A bug in that expansion let curl read past the end of the URL text, which could crash it or leak memory.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.