Bug 1470926 - There is a heap-buffer-overflow in tokdel() function of cflow.
Summary: There is a heap-buffer-overflow in tokdel() function of cflow.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: cflow
Version: 30
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Terje Røsten
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-07-14 02:55 UTC by owl337
Modified: 2019-03-04 01:51 UTC (History)
1 user (show)

Fixed In Version: cflow-1.6-1.fc29 cflow-1.6-1.fc28
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-03-04 00:51:42 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Triggered by "./cflow $POC" (1.05 KB, application/x-rar)
2017-07-14 02:55 UTC, owl337
no flags Details

Description owl337 2017-07-14 02:55:31 UTC
Created attachment 1298072 [details]
Triggered by  "./cflow $POC"

Description of problem:

There is a  heap-buffer-overflow in tokdel() function of cflow. 

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

<= latest version

How reproducible:

./cflow POC1

Steps to Reproduce:

The information is as follows:

$./cflow POC1
 
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:51: size_t redefined
./../../../cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
Segmentation fault

The ASAN debugging  information is as follows:

/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: this is the place of previous definition
/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow:id:000056,sig:11,src:001424,op:ext_AO,pos:1449:46: size_t redefined
...
=================================================================
==53508==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7ffacabd9400 at pc 0x0000004a9542 bp 0x7ffc3515aea0 sp 0x7ffc3515a658
READ of size 752136 at 0x7ffacabd9400 thread T0
    #0 0x4a9541  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4a9541)
    #1 0x4fc8c4  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4fc8c4)
    #2 0x4fbc57  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4fbc57)
    #3 0x4fb5b5  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4fb5b5)
    #4 0x4f2085  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4f2085)
    #5 0x7ffad2e28abf  (/lib/x86_64-linux-gnu/libc.so.6+0x20abf)
    #6 0x438938  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x438938)

0x7ffacabd9400 is located 0 bytes to the right of 752640-byte region [0x7ffacab21800,0x7ffacabd9400)
allocated by thread T0 here:
    #0 0x4bfc45  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4bfc45)
    #1 0x52efdc  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x52efdc)

Shadow bytes around the buggy address:
  0x0fffd9573230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fffd9573240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fffd9573250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fffd9573260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fffd9573270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0fffd9573280:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fffd9573290: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fffd95732a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fffd95732b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fffd95732c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fffd95732d0: 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
==53508==ABORTING


The vulnerability was triggered in function tokdel () at parser.c:238,where the value of (end - beg + 1) * sizeof(token_stack[0])) is too big.

233	void
234	tokdel(int beg, int end)
235	{
236	     if (end >= beg) {
237		  if (end < tos)
238		       memmove(token_stack + beg, token_stack + end + 1,
239			       (end - beg + 1) * sizeof(token_stack[0]));
240		  tos -= (end - beg + 1);
241	     }
242	}


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.

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

Comment 4 Ben Cotton 2018-11-27 18:30:12 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.

Comment 5 Ben Cotton 2019-02-19 17:11:59 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 30 development cycle.
Changing version to '30.

Comment 6 Fedora Update System 2019-02-23 17:06:16 UTC
cflow-1.6-1.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-ef61cfdf11

Comment 7 Fedora Update System 2019-02-23 17:06:26 UTC
cflow-1.6-1.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2019-f5ae0b5614

Comment 8 Fedora Update System 2019-02-24 01:54:18 UTC
cflow-1.6-1.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-f5ae0b5614

Comment 9 Fedora Update System 2019-02-24 03:25:42 UTC
cflow-1.6-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-ef61cfdf11

Comment 10 Fedora Update System 2019-03-04 00:51:42 UTC
cflow-1.6-1.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2019-03-04 01:51:08 UTC
cflow-1.6-1.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.