Bug 1468475 - There is an out of bound read in ole.c of catdoc.
Summary: There is an out of bound read in ole.c of catdoc.
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: catdoc
Version: 35
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Adel Gadllah
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-07-07 08:14 UTC by owl337
Modified: 2022-12-13 15:12 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-12-13 15:12:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Triggered by "./catdoc $POC" (61.37 KB, application/x-rar)
2017-07-07 08:14 UTC, owl337
no flags Details
this is file format of POC (88.43 KB, application/msword)
2017-07-08 09:32 UTC, owl337
no flags Details

Description owl337 2017-07-07 08:14:59 UTC
Created attachment 1295216 [details]
Triggered by  "./catdoc $POC"

Description of problem:

ole.c:254 propCurrent = getlong(BBD, propCurrent*4);

When allocated BBD,
bbdNumBlocks = getulong(oleBuf,0x2c);
        bbdSize = bbdNumBlocks * sectorSize;
        if (bbdSize > fileLength) {
                /* broken file, BBD size greater than entire file*/
                return NULL;
        }

        if((BBD=malloc(bbdNumBlocks*sectorSize)) == NULL ) {


If the value at 0x2c of bbdNumBlocks equals 0 will cause the BBD size smaller, the following analytical code failed to check this situation, leading to out of bound read.


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

<= latest version

How reproducible:

./catdoc $POC


Steps to Reproduce:


The ASAN debugging information is as follows:

ASAN:SIGSEGV
=================================================================
==52554==ERROR: AddressSanitizer: SEGV on unknown address 0x602000047a3c (pc 0x00000048ffdd sp 0x7ffe186591a0 bp 0x7ffe18659790 T0)
==52554==WARNING: Trying to symbolize code, but external symbolizer is not initialized!
    #0 0x48ffdc (/home/company/collafl/testcases/catdoc-0.95/install/bin/catdoc_asan+0x48ffdc)
    #1 0x491739 (/home/company/collafl/testcases/catdoc-0.95/install/bin/catdoc_asan+0x491739)
    #2 0x482189 (/home/company/collafl/testcases/catdoc-0.95/install/bin/catdoc_asan+0x482189)
    #3 0x47de9e (/home/company/collafl/testcases/catdoc-0.95/install/bin/catdoc_asan+0x47de9e)
    #4 0x7f78138a0a3f (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
    #5 0x47c838 (/home/company/afl-fuzz-master/testcases/catdoc-0.95/install/bin/catdoc_asan+0x47c838)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ??:0 ??
==52554==ABORTING


The gdb debug info is as follows:

#0  0x0000000000405bfa in getlong (buffer=0x691110 "", offset=0x3a00c) at numutils.c:22
#1  0x00000000004067fb in ole_init (f=0x68dc80, buffer=0x7fffffffdd40, bufSize=0x8) at ole.c:254
#2  0x00000000004028de in analyze_format (f=0x68dc80) at analyze.c:58
#3  0x0000000000401b6a in main (argc=0x2, argv=0x7fffffffdf28) at catdoc.c:180
#4  0x00007ffff7a2e830 in __libc_start_main (main=0x401526 <main>, argc=0x2, argv=0x7fffffffdf28, init=<optimized out>, 
    fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdf18) at ../csu/libc-start.c:291
#5  0x0000000000401459 in _start ()

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 1 Robert Scheck 2017-07-07 19:11:46 UTC
Did you also send this bug report to the upstream developers of catdoc?
May I kindly ask you to provide the reproducer in an open format (thus
not *.rar)?

Comment 2 owl337 2017-07-08 09:32:51 UTC
Created attachment 1295478 [details]
this is file format of POC

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

Comment 6 Ben Cotton 2018-11-27 18:30:01 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 7 Ben Cotton 2018-11-30 17:51:13 UTC
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.

Comment 8 Ben Cotton 2021-08-10 13:39:10 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.

Comment 9 Ben Cotton 2022-11-29 16:45:14 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
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
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 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 Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 10 Ben Cotton 2022-12-13 15:12:11 UTC
Fedora Linux 35 entered end-of-life (EOL) status on 2022-12-13.

Fedora Linux 35 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 Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


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