Bug 1466411
Summary: | There is a heap based buffer overflow in libsass | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | owl337 <v.owl337> | ||||
Component: | libsass | Assignee: | Aurelien Bompard <aurelien> | ||||
Status: | CLOSED EOL | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | urgent | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 27 | CC: | aurelien, carnil, mcatanza | ||||
Target Milestone: | --- | Keywords: | Reopened | ||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2018-11-30 17:51:01 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle. Changing version to '27'. This message is a reminder that Fedora 27 is nearing its end of life. On 2018-Nov-30 Fedora will stop maintaining and issuing updates for Fedora 27. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '27'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 27 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed. Note this received CVE-2017-10687. However, it will not be fixed because the bug was not reported to upstream, so upstream is not aware. Feel free to report it to upstream. |
Created attachment 1292899 [details] ./sassc POC1 Description of problem: The security bug was trigged by function json_mkstream() at line libsass/src/sass_context.cpp:91. Version-Release number of selected component (if applicable): <= latest How reproducible: ./sassc POC1 Steps to Reproduce: The debugging information is as follows: $ ./sassc POC1 ================================================================= ==91395==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61d00001f315 at pc 0x0000004a7ce3 bp 0x7ffce9b5ca00 sp 0x7ffce9b5c1b8 READ of size 78 at 0x61d00001f315 thread T0 #0 0x4a7ce2 (/home/icy/real/sassc-master-asan/sassc-master/install/bin/sassc+0x4a7ce2) #1 0x7fd357425036 (/home/icy/libsass/install/lib/libsass.so.1+0x22c036) #2 0x7fd3572b0407 (/home/icy/libsass/install/lib/libsass.so.1+0xb7407) #3 0x7fd3572b0fa6 (/home/icy/libsass/install/lib/libsass.so.1+0xb7fa6) #4 0x7fd357425878 (/home/icy/libsass/install/lib/libsass.so.1+0x22c878) #5 0x7fd357425c58 (/home/icy/libsass/install/lib/libsass.so.1+0x22cc58) #6 0x4ddfb5 (/home/icy/real/sassc-master-asan/sassc-master/install/bin/sassc+0x4ddfb5) #7 0x4debd5 (/home/icy/real/sassc-master-asan/sassc-master/install/bin/sassc+0x4debd5) #8 0x7fd355f84a3f (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f) #9 0x4364f8 (/home/icy/real/sassc-master-asan/sassc-master/install/bin/sassc+0x4364f8) 0x61d00001f315 is located 0 bytes to the right of 2197-byte region [0x61d00001ea80,0x61d00001f315) allocated by thread T0 here: #0 0x4bd4c2 (/home/icy/real/sassc-master-asan/sassc-master/install/bin/sassc+0x4bd4c2) #1 0x7fd3573442a3 (/home/icy/libsass/install/lib/libsass.so.1+0x14b2a3) Shadow bytes around the buggy address: 0x0c3a7fffbe10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3a7fffbe20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3a7fffbe30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3a7fffbe40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3a7fffbe50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c3a7fffbe60: 00 00[05]fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a7fffbe70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a7fffbe80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a7fffbe90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a7fffbea0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a7fffbeb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==91395==ABORTING The GDB debugging information is as follows: (gdb)set args POC1 (gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/icy/real/sassc-master-asan/sassc-master/install/bin/sassc POC1 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". ... (gdb) 91 msg_stream << ">> " << std::string(line_beg + move_in, line_end - shorten) << "\n"; (gdb) n Program received signal SIGSEGV, Segmentation fault. 0xffffffffcc4d7750 in ?? () (gdb) c Continuing. ASAN:SIGSEGV ================================================================= ==93440==ERROR: AddressSanitizer: SEGV on unknown address 0xffffffffcc4d7750 (pc 0xffffffffcc4d7750 bp 0x7fffffffde20 sp 0x7fffffffd598 T0) Program received signal SIGSEGV, Segmentation fault. 0x00007ffff6a78cf9 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1 (gdb) bt #0 0x00007ffff6a78cf9 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1 #1 0x00007ffff6a7a618 in _Unwind_Backtrace () from /lib/x86_64-linux-gnu/libgcc_s.so.1 #2 0x00000000004dc815 in __sanitizer::BufferedStackTrace::SlowUnwindStackWithContext(unsigned long, void*, unsigned long) () #3 0x00000000004c16e4 in __asan::ReportSIGSEGV(char const*, __asan::SignalContext const&) () #4 0x00000000004bfc7d in __asan::AsanOnSIGSEGV(int, void*, void*) () #5 <signal handler called> #6 0xffffffffcc4d7750 in ?? () #7 0x00000000004a7ce3 in memcpy () #8 0x00007ffff7b61037 in std::char_traits<char>::copy (__n=78, __s2=0x61d00001f2e6 "{\335gn: {y {\335gn: {y {\335gn: {y {\335gn: {y {\335gn& y ", <incomplete sequence \335>, __s1=<optimized out>) at /usr/include/c++/5/bits/char_traits.h:290 #9 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy (__n=78, __s=0x61d00001f2e6 "{\335gn: {y {\335gn: {y {\335gn: {y {\335gn: {y {\335gn& y ", <incomplete sequence \335>, __d=<optimized out>) at /usr/include/c++/5/bits/basic_string.h:299 #10 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy_chars ( __k2=<optimized out>, __k1=0x61d00001f2e6 "{\335gn: {y {\335gn: {y {\335gn: {y {\335gn: {y {\335gn& y ", <incomplete sequence \335>, __p=<optimized out>) at /usr/include/c++/5/bits/basic_string.h:342 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*> ( ---Type <return> to continue, or q <return> to quit--- this=0x7fffffffdf60, __beg=0x61d00001f2e6 "{\335gn: {y {\335gn: {y {\335gn: {y {\335gn: {y {\335gn& y ", <incomplete sequence \335>, __end=<optimized out>) at /usr/include/c++/5/bits/basic_string.tcc:229 #12 0x00007ffff79ec408 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char const*> (__end=<optimized out>, __beg=<optimized out>, this=0x7fffffffdf60) at /usr/include/c++/5/bits/basic_string.h:195 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*> (__end=<optimized out>, __beg=<optimized out>, this=0x7fffffffdf60) at /usr/include/c++/5/bits/basic_string.h:214 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<char const*, void> (__a=..., __end=<optimized out>, __beg=<optimized out>, this=0x7fffffffdf60) at /usr/include/c++/5/bits/basic_string.h:538 #15 Sass::handle_error (c_ctx=c_ctx@entry=0x611000009f00) at sass_context.cpp:91 #16 0x00007ffff79ecfa7 in Sass::handle_errors (c_ctx=c_ctx@entry=0x611000009f00) at sass_context.cpp:200 #17 0x00007ffff7b61879 in Sass::sass_parse_block (compiler=0x6040000097d0) at sass_context.cpp:246 #18 sass_compiler_parse (compiler=compiler@entry=0x6040000097d0) at sass_context.cpp:476 #19 0x00007ffff7b61c59 in sass_compile_context (c_ctx=0x611000009f00, cpp_ctx=<optimized out>) at sass_context.cpp:364 #20 0x00000000004ddfb6 in compile_file (options=0x60c00000bf80, input_path=<optimized out>, outfile=0x0) at sassc.c:145 ---Type <return> to continue, or q <return> to quit--- #21 0x00000000004debd6 in main (argc=<optimized out>, argv=<optimized out>) at sassc.c:335 (gdb) The bug was trigged by function json_mkstream() at line libsass/src/sass_context.cpp:91. namespace Sass { // see sass_copy_c_string(std::string str) static inline JsonNode* json_mkstream(const std::stringstream& stream) { // hold on to string on stack! 82 while (line_end && *line_end && *line_end != '\n') { 83 if (*line_end == '\n') break; 84 if (*line_end == '\r') break; 85 line_end++; 86 } 87 size_t max_left = 42; size_t max_right = 78; 88 size_t move_in = e.pstate.column > max_left ? e.pstate.column - max_left : 0; 89 size_t shorten = (line_end - line_beg) - move_in > max_right ? 90 (line_end - line_beg) - move_in - max_right : 0; 91 msg_stream << ">> " << std::string(line_beg + move_in, line_end - shorten) << "\n"; 92 msg_stream << " " << std::string(e.pstate.column - move_in, '-') << "^\n"; 93 } Actual results: crash Expected results: crash Additional info: This vulnerability is detected by team OWL337, with our custom fuzzer collAFL. Please contact ganshuitao and chaoz.cn if you need more info about the team, the tool or the vulnerability.