bugCompact Disc Input and Control Library - Bugs: bug #52091, heap overflow in iso_info.c,...

 
 

bug #52091: heap overflow in iso_info.c, libcdio latest version(0.94)

Submitted by:  Junchao Luan <skysider>
Submitted on:  Fri 22 Sep 2017 04:45:49 PM UTC  
 
Category:  API Severity:  5 - Average
Item Group:  libcdio Status:  Fixed
Privacy:  Public Assigned to:  Rocky Bernstein <rocky>
Open/Closed:  Closed

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 26 Sep 2017 08:34:37 PM UTC, comment #2: 

Commit e73a8bb should fix this.

If it doesn't let me know.

Rocky Bernstein <rocky>
Project AdministratorIn charge of this item.
Tue 26 Sep 2017 04:13:20 PM UTC, comment #1: 

I just had a chance to look at this and the message:

> WARN: from_733: broken byte order


indicates that the ISO 9660 image not valid.

So I think this comes down to handling a bad image better than giving a heap overflow. The heap overflow seems to come from the fact that we keep recursing the root filesystem /.

Rocky Bernstein <rocky>
Project AdministratorIn charge of this item.
Fri 22 Sep 2017 04:45:49 PM UTC, original submission:  

I have compiled libcdio with latest master version a few day ago.
When I run iso-info -i crash.iso, it crashes. Here is the output:

../out/slave/crashes/id\:000000\,sig\:11\,src\:000215\,op\:havoc\,rep\:8
iso-info version 0.94 x86_64-pc-linux-gnu
Copyright (c) 2003-2005, 2007-2008, 2011-2015 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
________________________________
ISO 9660 image: ../out/slave/crashes/id:000000,sig:11,src:000215,op:havoc,rep:8
Application : GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM
System      : LINUX
Volume      : CDROM
No Joliet extensions
________________________________
ISO-9660 Information
Note: both -f and -l options given -- -l (long listing) takes precidence
++ WARN: from_733: broken byte order
/:
=================================================================
==7245==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62100001c900 at pc 0x7f1fc210c1e9 bp 0x7fff4ad7b4b0 sp 0x7fff4ad7ac28
READ of size 4097 at 0x62100001c900 thread T0
    #0 0x7f1fc210c1e8  (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x601e8)
    #1 0x7f1fc210d145 in __interceptor_vsnprintf (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x61145)
    #2 0x7f1fc210d3b1 in snprintf (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x613b1)
    #3 0x403296 in print_iso9660_recurse /work/libcdio-asan/src/iso-info.c:257
    #4 0x4037d0 in print_iso9660_fs /work/libcdio-asan/src/iso-info.c:309
    #5 0x404591 in main /work/libcdio-asan/src/iso-info.c:501
    #6 0x7f1fc1a1d82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #7 0x4027b8 in _start (/work/libcdio-asan/src/iso-info+0x4027b8)

0x62100001c900 is located 0 bytes to the right of 4096-byte region [0x62100001b900,0x62100001c900)
allocated by thread T0 here:
    #0 0x7f1fc2144602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x403039 in print_iso9660_recurse /work/libcdio-asan/src/iso-info.c:222
    #2 0x4037d0 in print_iso9660_fs /work/libcdio-asan/src/iso-info.c:309
    #3 0x404591 in main /work/libcdio-asan/src/iso-info.c:501
    #4 0x7f1fc1a1d82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 ??
Shadow bytes around the buggy address:
  0x0c427fffb8d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fffb8e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fffb8f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fffb900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fffb910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c427fffb920:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fffb930: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fffb940: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fffb950: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fffb960: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fffb970: 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
==7245==ABORTING

And When I compile libcdio without sanitize, it just goes into infinite loop and segmentation fault. So there should be something wrong with iso-info.c

And the crash.iso is attached here.

Junchao Luan <skysider>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #41871:  crash.iso added by skysider (48KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rocky (Posted a comment)
  • -email is unavailable- added by skysider (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-09-26 rocky StatusNone => Fixed
        Assigned toNone => rocky
        Open/ClosedOpen => Closed
    2017-09-22 skysider Attached File- => Added crash.iso, #41871

    Back to the top


    Powered by Savane 3.5