Bug 1470722

Summary: There is an illegal address access in ast.cpp of libsass library.
Product: [Fedora] Fedora Reporter: owl337 <v.owl337>
Component: sasscAssignee: leigh scott <leigh123linux>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: aurelien
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1474346    
Description Flags
Triggered by "./sassc $POC" none

Description owl337 2017-07-13 14:13:52 UTC
Created attachment 1297658 [details]
Triggered by  "./sassc $POC"

Description of problem:

There is a illegal address access in  ast.cpp of libsass library. 

Version-Release number of selected component (if applicable):

<= latest version

How reproducible:

./sassc POC2

Steps to Reproduce:

The Asan debugging information is as follows:

==19674==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000088 (pc 0x7fd93f54a03a bp 0x7fffa50804f0 sp 0x7fffa507f8a0 T0)
    #0 0x7fd93f54a039  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x193039)
    #1 0x7fd93f553b3c  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x19cb3c)
    #2 0x7fd93f941694  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x58a694)
    #3 0x7fd93f94019b  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x58919b)
    #4 0x7fd93f5500a9  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x1990a9)
    #5 0x7fd93f9509d6  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x5999d6)
    #6 0x7fd93f9819da  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x5ca9da)
    #7 0x7fd93f94f71a  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x59871a)
    #8 0x7fd93f953114  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x59c114)
    #9 0x7fd93f9819da  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x5ca9da)
    #10 0x7fd93f94f71a  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x59871a)
    #11 0x7fd93f6451aa  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x28e1aa)
    #12 0x7fd93f6403b3  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x2893b3)
    #13 0x7fd93fb51e60  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x79ae60)
    #14 0x7fd93fb50aa1  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x799aa1)
    #15 0x7fd93fb50ee1  (/home/icy/secreal/libsass-asan/install/lib/libsass.so.1+0x799ee1)
    #16 0x4ddfc5  (/home/icy/secreal/sassc-asan/install/bin/sassc+0x4ddfc5)
    #17 0x4debe5  (/home/icy/secreal/sassc-asan/install/bin/sassc+0x4debe5)
    #18 0x7fd93e142a3f  (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
    #19 0x436508  (/home/icy/secreal/sassc-asan/install/bin/sassc+0x436508)

AddressSanitizer can not provide additional info.

The gdb degub info is as follows:

Program received signal SIGSEGV, Segmentation fault.
Sass::Complex_Selector::append (this=0x6462f0, ss=...) at ast.cpp:1229
1229	        last()->head_->concat(h);
(gdb) bt
#0  Sass::Complex_Selector::append (this=0x6462f0, ss=...) at ast.cpp:1229
#1  0x00007ffff776caa6 in Sass::Complex_Selector::resolve_parent_refs (this=0x631430, pstack=std::vector of length 2, capacity 2 = {...}, implicit_parent=true) at ast.cpp:1334
#2  0x00007ffff79e0b78 in Sass::Eval::operator() (this=0x7fffffffde20, s=0x631430) at eval.cpp:1768
#3  0x00007ffff79dfe71 in Sass::Eval::operator() (this=0x7fffffffde20, s=0x631350) at eval.cpp:1739
#4  0x00007ffff776a7cb in Sass::Selector_List::eval (this=0x631350, eval=...) at ast.cpp:1256
#5  0x00007ffff79eaa2e in Sass::Expand::operator() (this=0x7fffffffde10, r=0x6312a0) at expand.cpp:117
#6  0x00007ffff7a09771 in Sass::Expand::append_block (this=0x7fffffffde10, b=<optimized out>) at expand.cpp:799
#7  0x00007ffff79e9f89 in Sass::Expand::operator() (this=0x7fffffffde10, b=0x631190) at expand.cpp:81
#8  0x00007ffff79ec3f7 in Sass::Expand::operator() (this=0x7fffffffde10, r=0x630d20) at expand.cpp:151
#9  0x00007ffff7a09771 in Sass::Expand::append_block (this=0x7fffffffde10, b=<optimized out>) at expand.cpp:799
#10 0x00007ffff79e9f89 in Sass::Expand::operator() (this=0x7fffffffde10, b=0x630c30) at expand.cpp:81
#11 0x00007ffff7800358 in Sass::Context::compile (this=0x62ff40) at context.cpp:659
#12 0x00007ffff77fd303 in Sass::File_Context::parse (this=0x62ff40) at context.cpp:588
#13 0x00007ffff7b16376 in Sass::sass_parse_block (compiler=0x62fe80) at sass_context.cpp:227
#14 sass_compiler_parse (compiler=0x62fe80) at sass_context.cpp:476
#15 0x00007ffff7b15562 in sass_compile_context (c_ctx=0x62fda0, cpp_ctx=0x7ffff7fda050) at sass_context.cpp:364
#16 0x00007ffff7b1592a in sass_compile_file_context (file_ctx=0x62fda0) at sass_context.cpp:463
#17 0x0000000000402796 in compile_file (options=0x62fd20, input_path=<optimized out>, outfile=0x0) at sassc.c:145
#18 0x0000000000403117 in main (argc=<optimized out>, argv=<optimized out>) at sassc.c:335

Actual results:


Expected results:


Additional info:

This vulnerability is detected by team OWL337, with our custom fuzzer collAFL. Please contact ganshuitao@gmail.com   and chaoz@tsinghua.edu.cn if you need more info about the team, the tool or the vulnerability.

Comment 1 Adam Mariš 2017-07-24 12:42:24 UTC
Please, report this issue to upstream. Thanks!

Comment 2 Jan Kurik 2017-08-15 09:11:39 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 3 Ben Cotton 2018-11-27 18:30:08 UTC
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.