Bug 1470927 - There is a heap-use-after-free in reference() funtion of cflow.
Summary: There is a heap-use-after-free in reference() funtion 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 03:00 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:41 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Triggered by "./cflow $POC" (680 bytes, application/x-rar)
2017-07-14 03:00 UTC, owl337
no flags Details

Description owl337 2017-07-14 03:00:36 UTC
Created attachment 1298073 [details]
Triggered by  "./cflow $POC"

Description of problem:

There is a heap-use-after-free  in  reference() funtion of  cflow.

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

<= latest version

How reproducible:

./cflow $POC

Steps to Reproduce:

The information is as follows:

$./cflow  POC2
 
Segmentation fault


The ASAN debugging  information is as follows:

$./cflow POC2

=================================================================
==26111==ERROR: AddressSanitizer: heap-use-after-free on address 0x60e00000c4d0 at pc 0x0000004fd9fa bp 0x7ffd71c71750 sp 0x7ffd71c71748
READ of size 8 at 0x60e00000c4d0 thread T0
    #0 0x4fd9f9  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4fd9f9)
    #1 0x50267f  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x50267f)
    #2 0x4fc013  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4fc013)
    #3 0x4fbc2f  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4fbc2f)
    #4 0x4fb5b5  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4fb5b5)
    #5 0x4f2085  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4f2085)
    #6 0x7fabd69d3abf  (/lib/x86_64-linux-gnu/libc.so.6+0x20abf)
    #7 0x438938  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x438938)

0x60e00000c4d0 is located 144 bytes inside of 152-byte region [0x60e00000c440,0x60e00000c4d8)
freed by thread T0 here:
    #0 0x4bf622  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4bf622)
    #1 0x5072cd  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x5072cd)

previously allocated by thread T0 here:
    #0 0x4bf902  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x4bf902)
    #1 0x52edce  (/home/icy/real/cflow-1.5-asan/cflow-1.5/install/bin/cflow+0x52edce)

Shadow bytes around the buggy address:
  0x0c1c7fff9840: 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa fa
  0x0c1c7fff9850: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c1c7fff9860: 00 00 00 fa fa fa fa fa fa fa fa fa 00 00 00 00
  0x0c1c7fff9870: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa
  0x0c1c7fff9880: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
=>0x0c1c7fff9890: fd fd fd fd fd fd fd fd fd fd[fd]fa fa fa fa fa
  0x0c1c7fff98a0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c1c7fff98b0: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
  0x0c1c7fff98c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c1c7fff98d0: fd fd fd fa fa fa fa fa fa fa fa fa fd fd fd fd
  0x0c1c7fff98e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 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
==26111==ABORTING


The vulnerability was triggered in function reference () at parser.c:1275.

(gdb) p &caller->callee 
$13 = (struct linked_list **) 0x60e00000c4d0

heap-use-after-free on address 0x60e00000c4d0 at pc 0x0000004fd9fa bp 0x7ffd71c71750 sp 0x7ffd71c71748

1266	void
1267	reference(char *name, int line)
1268	{
1269	     Symbol *sp = add_reference(name, line);
1270	     if (!sp)
1271		  return;
1272	     if (caller) {
1273		  if (!data_in_list(caller, sp->caller))
1274		       linked_list_append(&sp->caller, caller);
1275		  if (!data_in_list(sp, caller->callee))
1276		       linked_list_append(&caller->callee, sp);
1277	     }
1278	}
1279	


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:33 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:10 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:12:10 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:15 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:25 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:17 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:41 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.