Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2021-3246: heap-buffer-overflow in in msadpcm_decode_block · Issue #687 · libsndfile/libsndfile

A heap buffer overflow vulnerability in msadpcm_decode_block of libsndfile 1.0.30 allows attackers to execute arbitrary code via a crafted WAV file.

CVE
#vulnerability#ubuntu#git#c++#buffer_overflow

Hi,
fuzzing sndfile-info with AFL++ I found a heap-buffer-overflow in in msadpcm_decode_block /home/andreaf/real/libsndfile/src/ms_adpcm.c:279

I’m on an x86-64 Ubuntu 20.04 with Clang 10.

The AddressSanitizer report is the following:

=================================================================
==24888==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x621000001238 at pc 0x0000005ebedc bp 0x7ffced651bd0 sp 0x7ffced651bc8
WRITE of size 2 at 0x621000001238 thread T0
    #0 0x5ebedb in msadpcm_decode_block /home/andreaf/libsndfile/src/ms_adpcm.c:279:31
    #1 0x5e9cf8 in wavlike_msadpcm_init /home/andreaf/libsndfile/src/ms_adpcm.c:171:3
    #2 0x566da9 in wav_open /home/andreaf/libsndfile/src/wav.c:258:14
    #3 0x4cc6d2 in psf_open_file /home/andreaf/libsndfile/src/sndfile.c:3080:13
    #4 0x4caa5e in sf_open /home/andreaf/libsndfile/src/sndfile.c:359:9
    #5 0x4c57dd in cart_dump /home/andreaf/libsndfile/programs/sndfile-info.c:479:14
    #6 0x4c36c3 in main /home/andreaf/libsndfile/programs/sndfile-info.c:96:13
    #7 0x7f114ca61bf6 in __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:310
    #8 0x41b4c9 in _start (/home/andreaf/libsndfile/programs/sndfile-info+0x41b4c9)

0x621000001238 is located 0 bytes to the right of 4408-byte region [0x621000000100,0x621000001238)
allocated by thread T0 here:
    #0 0x493d82 in calloc (/home/andreaf/libsndfile/programs/sndfile-info+0x493d82)
    #1 0x5e90b4 in wavlike_msadpcm_init /home/andreaf/libsndfile/src/ms_adpcm.c:138:27
    #2 0x566da9 in wav_open /home/andreaf/libsndfile/src/wav.c:258:14
    #3 0x4cc6d2 in psf_open_file /home/andreaf/libsndfile/src/sndfile.c:3080:13
    #4 0x4caa5e in sf_open /home/andreaf/libsndfile/src/sndfile.c:359:9
    #5 0x4c57dd in cart_dump /home/andreaf/libsndfile/programs/sndfile-info.c:479:14
    #6 0x4c36c3 in main /home/andreaf/libsndfile/programs/sndfile-info.c:96:13
    #7 0x7f114ca61bf6 in __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:310

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/andreaf/libsndfile/src/ms_adpcm.c:279:31 in msadpcm_decode_block
Shadow bytes around the buggy address:
  0x0c427fff81f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff8200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff8210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff8220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff8230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c427fff8240: 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa fa
  0x0c427fff8250: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff8260: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff8270: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff8280: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff8290: 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
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  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
  Shadow gap:              cc
==24888==ABORTING

To reproduce on git master:

export CC='clang-10 -fsanitize=address'
export CFLAGS='-g'
./configure --disable-shared
make
./programs/sndfile-info --cart ./sndfile_heap_overflow

The testcase that triggers the bug is (decompress it before):

sndfile_heap_overflow.tar.gz

Related news

Gentoo Linux Security Advisory 202309-11

Gentoo Linux Security Advisory 202309-11 - Multiple vulnerabilities have been found in libsndfile, the worst of which could result in arbitrary code execution. Versions greater than or equal to 1.1.0 are affected.

CVE-2022-33923: DSA-2022-159: Dell PowerStore Family Security Update for Multiple Vulnerabilities

Dell PowerStore, versions prior to 3.0.0.0, contains an OS Command Injection vulnerability in PowerStore T environment. A locally authenticated attacker could potentially exploit this vulnerability, leading to the execution of arbitrary OS command on the PowerStore underlying OS. Exploiting may lead to a system take over by an attacker.

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907