Bug 1026986 (CVE-2017-6834) - VUL-1: CVE-2017-6834: audiofile: heap-based buffer overflow in ulaw2linear_buf (G711.cpp)
Summary: VUL-1: CVE-2017-6834: audiofile: heap-based buffer overflow in ulaw2linear_bu...
Status: RESOLVED FIXED
Alias: CVE-2017-6834
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P4 - Low : Normal
Target Milestone: unspecified
Assignee: Security Team bot
QA Contact: Security Team bot
URL:
Whiteboard: CVSSv2:NVD:CVE-2017-6834:4.3:(AV:N/AC...
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-26 12:52 UTC by Mikhail Kasimov
Modified: 2020-10-21 09:19 UTC (History)
6 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Kasimov 2017-02-26 12:52:24 UTC
Ref: http://seclists.org/oss-sec/2017/q1/512
=============================================
Description:
audiofile is a C-based library for reading and writing audio files in many common formats.

A fuzz on it discovered an heap overflow.

The complete ASan output:

# sfconvert @@ out.mp3 format aiff
WRITE of size 2 at 0x7fb583d33800 thread T0                                                                             
                                                                                                                        
                               
    #0 0x7fb58398c8b1 in ulaw2linear_buf(unsigned char const*, short*, int) 
/tmp/portage/media-libs/audiofile-0.3.6-r1/work/audiofile-0.3.6/libaudiofile/modules/G711.cpp:42:13                     
                                                                           
    #1 0x7fb58398c8b1 in G711::runPull() 
/tmp/portage/media-libs/audiofile-0.3.6-r1/work/audiofile-0.3.6/libaudiofile/modules/G711.cpp:206                       
                                                                                                              
    #2 0x7fb58397305a in afReadFrames 
/tmp/portage/media-libs/audiofile-0.3.6-r1/work/audiofile-0.3.6/libaudiofile/data.cpp:222:14                            
                                                                                                                 
    #3 0x50bbeb in copyaudiodata 
/tmp/portage/media-libs/audiofile-0.3.6-r1/work/audiofile-0.3.6/sfcommands/sfconvert.c:340:29                           
                                                                                                                      
    #4 0x50b050 in main /tmp/portage/media-libs/audiofile-0.3.6-r1/work/audiofile-0.3.6/sfcommands/sfconvert.c:248:17   
                                                                                                                        
                               
    #5 0x7fb582a4878f in __libc_start_main 
/tmp/portage/sys-libs/glibc-2.23-r3/work/glibc-2.23/csu/../csu/libc-start.c:289                                         
                                                                                                            
    #6 0x419f48 in _init (/usr/bin/sfconvert+0x419f48)                                                                  
                                                                                                                        
                               
                                                                                                                        
                                                                                                                        
                               
0x7fb583d33800 is located 0 bytes to the right of 917504-byte region [0x7fb583c53800,0x7fb583d33800)                    
                                                                                                                        
                               
allocated by thread T0 here:                                                                                            
                                                                                                                        
                               
    #0 0x4d2d08 in malloc 
/tmp/portage/sys-devel/llvm-3.9.1-r1/work/llvm-3.9.1.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64          
                                                                                                                        
     
    #1 0x50bb48 in copyaudiodata 
/tmp/portage/media-libs/audiofile-0.3.6-r1/work/audiofile-0.3.6/sfcommands/sfconvert.c:327:17                           
                                                                                                                      
    #2 0x50b050 in main /tmp/portage/media-libs/audiofile-0.3.6-r1/work/audiofile-0.3.6/sfcommands/sfconvert.c:248:17   
                                                                                                                        
                               
    #3 0x7fb582a4878f in __libc_start_main 
/tmp/portage/sys-libs/glibc-2.23-r3/work/glibc-2.23/csu/../csu/libc-start.c:289                                         
                                                                                                            
                                                                                                                        
                                                                                                                        
                               
SUMMARY: AddressSanitizer: heap-buffer-overflow 
/tmp/portage/media-libs/audiofile-0.3.6-r1/work/audiofile-0.3.6/libaudiofile/modules/G711.cpp:42:13 in 
ulaw2linear_buf(unsigned char 
const*, short*, int)                                                                      
Shadow bytes around the buggy address:                                                                                  
                                                                                                                        
                               
  0x0ff73079e6b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                       
                                                                                                                        
                               
  0x0ff73079e6c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                       
                                                                                                                        
                               
  0x0ff73079e6d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                       
                                                                                                                        
                               
  0x0ff73079e6e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                       
                                                                                                                        
                               
  0x0ff73079e6f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                       
                                                                                                                        
                               
=>0x0ff73079e700:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa                                                       
                                                                                                                        
                               
  0x0ff73079e710: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa                                                       
                                                                                                                        
                               
  0x0ff73079e720: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa                                                       
                                                                                                                        
                               
  0x0ff73079e730: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa                                                       
                                                                                                                        
                               
  0x0ff73079e740: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa                                                       
                                                                                                                        
                               
  0x0ff73079e750: 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
==2586==ABORTING

Affected version:
0.3.6

Fixed version:
N/A

Commit fix:
N/A

Credit:
This bug was discovered by Agostino Sarubbo of Gentoo.

CVE:
N/A

Reproducer:
https://github.com/asarubbo/poc/blob/master/00188-audiofile-heapoverflow-ulaw2linear_buf

Timeline:
2017-02-20: bug discovered and reported to upstream
2017-02-20: blog post about the issue

Note:
This bug was found with American Fuzzy Lop.

Permalink:
https://blogs.gentoo.org/ago/2017/02/20/audiofile-heap-based-buffer-overflow-in-ulaw2linear_buf-g711-cpp
=============================================

https://software.opensuse.org/package/audiofile

TW|42.{1,2}: 0.3.6

VUL-1 because: http://seclists.org/oss-sec/2017/q1/504
========================================================
Hello all.

I discovered multiple crashes in the audiofile library.
The maintainer was informed privately, I didn't see reactions and all details are public on my blog.
I posted them to the cveform too, but I didn't get response.
I'll send update if something will change. 

--
Agostino Sarubbo
Gentoo Linux Developer
========================================================
Comment 1 Swamp Workflow Management 2017-02-26 23:01:52 UTC
bugbot adjusting priority
Comment 3 Antonio Larrosa 2017-03-09 10:22:35 UTC
This is fixed by the check for multiplication overflow in boo#1026978
( https://github.com/mpruett/audiofile/pull/42/commits/7d65f89defb092b63bcbc5d98349fb222ca73b3c )

*** This bug has been marked as a duplicate of bug 1026978 ***
Comment 9 Ednilson Miura 2017-04-05 11:42:07 UTC
Testing this as an update for sles11sp4:

Before update:
# sfconvert 00188-audiofile-heapoverflow-ulaw2linear_buf out.mp3 format aiff
Segmentation fault

After Update:
# sfconvert 00188-audiofile-heapoverflow-ulaw2linear_buf out.mp3 format aiff
Audio File Library: file missing data -- read 0 frames, should be 42 [error 5]
Audio File Library: file missing data -- read 0 frames, should be 42 [error 5]
Audio File Library: file missing data -- read 0 frames, should be 42 [error 5]
Audio File Library: file missing data -- read 0 frames, should be 42 [error 5]
Audio File Library: file missing data -- read 0 frames, should be 42 [error 5]
(loops forever)

This update is fine for sles12sp1/sp2.
Comment 10 Swamp Workflow Management 2017-04-05 16:19:22 UTC
SUSE-SU-2017:0940-1: An update that fixes 14 vulnerabilities is now available.

Category: security (low)
Bug References: 1026978,1026979,1026980,1026981,1026982,1026983,1026984,1026985,1026986,1026987,1026988,949399
CVE References: CVE-2015-7747,CVE-2017-6827,CVE-2017-6828,CVE-2017-6829,CVE-2017-6830,CVE-2017-6831,CVE-2017-6832,CVE-2017-6833,CVE-2017-6834,CVE-2017-6835,CVE-2017-6836,CVE-2017-6837,CVE-2017-6838,CVE-2017-6839
Sources used:
SUSE Linux Enterprise Software Development Kit 12-SP2 (src):    audiofile-0.3.6-10.1
SUSE Linux Enterprise Software Development Kit 12-SP1 (src):    audiofile-0.3.6-10.1
SUSE Linux Enterprise Server for Raspberry Pi 12-SP2 (src):    audiofile-0.3.6-10.1
SUSE Linux Enterprise Server 12-SP2 (src):    audiofile-0.3.6-10.1
SUSE Linux Enterprise Server 12-SP1 (src):    audiofile-0.3.6-10.1
SUSE Linux Enterprise Desktop 12-SP2 (src):    audiofile-0.3.6-10.1
SUSE Linux Enterprise Desktop 12-SP1 (src):    audiofile-0.3.6-10.1
Comment 14 Antonio Larrosa 2017-04-10 07:05:10 UTC
(In reply to Ednilson Miura from comment #9)
> Testing this as an update for sles11sp4:
> 
> Before update:
> # sfconvert 00188-audiofile-heapoverflow-ulaw2linear_buf out.mp3 format aiff
> Segmentation fault
> 
> After Update:
> # sfconvert 00188-audiofile-heapoverflow-ulaw2linear_buf out.mp3 format aiff
> Audio File Library: file missing data -- read 0 frames, should be 42 [error
> 5]
> Audio File Library: file missing data -- read 0 frames, should be 42 [error
> 5]
> Audio File Library: file missing data -- read 0 frames, should be 42 [error
> 5]
> Audio File Library: file missing data -- read 0 frames, should be 42 [error
> 5]
> Audio File Library: file missing data -- read 0 frames, should be 42 [error
> 5]
> (loops forever)
> 

Hi Ednilson, that's the same problem than https://bugzilla.suse.com/show_bug.cgi?id=1026982#c9 and is also fixed by https://build.suse.de/request/show/130465 . Thanks for testing this.
Comment 15 Swamp Workflow Management 2017-04-18 10:17:25 UTC
openSUSE-SU-2017:1038-1: An update that fixes 13 vulnerabilities is now available.

Category: security (low)
Bug References: 1026978,1026979,1026980,1026981,1026982,1026983,1026984,1026985,1026986,1026987,1026988
CVE References: CVE-2017-6827,CVE-2017-6828,CVE-2017-6829,CVE-2017-6830,CVE-2017-6831,CVE-2017-6832,CVE-2017-6833,CVE-2017-6834,CVE-2017-6835,CVE-2017-6836,CVE-2017-6837,CVE-2017-6838,CVE-2017-6839
Sources used:
openSUSE Leap 42.2 (src):    audiofile-0.3.6-10.3.1
openSUSE Leap 42.1 (src):    audiofile-0.3.6-12.1
Comment 17 Swamp Workflow Management 2017-05-05 13:10:51 UTC
SUSE-SU-2017:1182-1: An update that fixes 13 vulnerabilities is now available.

Category: security (moderate)
Bug References: 1026978,1026979,1026980,1026981,1026982,1026983,1026984,1026985,1026986,1026987,1026988
CVE References: CVE-2017-6827,CVE-2017-6828,CVE-2017-6829,CVE-2017-6830,CVE-2017-6831,CVE-2017-6832,CVE-2017-6833,CVE-2017-6834,CVE-2017-6835,CVE-2017-6836,CVE-2017-6837,CVE-2017-6838,CVE-2017-6839
Sources used:
SUSE Linux Enterprise Software Development Kit 11-SP4 (src):    audiofile-0.2.6-142.17.1
SUSE Linux Enterprise Server 11-SP4 (src):    audiofile-0.2.6-142.17.1
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    audiofile-0.2.6-142.17.1
Comment 19 Johannes Segitz 2017-06-27 14:55:24 UTC
SLE 10 SP3 is unfixed. Also please don't close security bugs but assign them to the security team once your done.
Comment 20 Antonio Larrosa 2017-06-27 15:32:48 UTC
Ah, ok, I'll reopen and reassign the others I also closed today
Comment 22 Alexandros Toptsoglou 2020-07-10 11:49:04 UTC
Done