Headline
CVE-2021-45830: heap-buffer-overflow atH5F_addr_decode_len /hdf5/src/H5Fint.c:2855 · Issue #1314 · HDFGroup/hdf5
A heap-based buffer overflow vulnerability exists in HDF5 1.13.1-1 via H5F_addr_decode_len in /hdf5/src/H5Fint.c, which could cause a Denial of Service.
Ubuntu 20.04.1 LTS, gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
==3895624==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000053a0 at pc 0x55f43fe64fa1 bp 0x7fff5fa6dc60 sp 0x7fff5fa6dc50
READ of size 1 at 0x6060000053a0 thread T0
#0 0x55f43fe64fa0 in H5F_addr_decode_len /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5Fint.c:2855
#1 0x55f43ffd5f01 in H5O__fsinfo_decode /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5Ofsinfo.c:186
#2 0x55f43ffefb74 in H5O_msg_read_oh /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5Omessage.c:514
#3 0x55f43fff033b in H5O_msg_read /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5Omessage.c:455
#4 0x55f43fe7e8d7 in H5F__super_read /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5Fsuper.c:782
#5 0x55f43fe6b6d1 in H5F_open /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5Fint.c:1963
#6 0x55f44029730b in H5VL__native_file_open /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5VLnative_file.c:127
#7 0x55f44026b72b in H5VL__file_open /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5VLcallback.c:3497
#8 0x55f44026b72b in H5VL_file_open /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5VLcallback.c:3646
#9 0x55f43fe46570 in H5F__open_api_common /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5F.c:795
#10 0x55f43fe4a7eb in H5Fopen /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5F.c:836
#11 0x55f43fce521b in h5tools_fopen /home/zxq/CVE_testing/source/hdf5-add/hdf5/tools/lib/h5tools.c:932
#12 0x55f43fcdcafa in main /home/zxq/CVE_testing/source/hdf5-add/hdf5/tools/src/h5format_convert/h5format_convert.c:409
#13 0x7f67d18450b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#14 0x55f43fce03ed in _start (/home/zxq/CVE_testing/source/hdf5-add/hdf5/build/bin/h5format_convert+0x16e3ed)
0x6060000053a0 is located 0 bytes to the right of 64-byte region [0x606000005360,0x6060000053a0)
allocated by thread T0 here:
#0 0x7f67d1c72bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
#1 0x55f43febb1fe in H5FL__malloc /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5FL.c:238
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/zxq/CVE_testing/source/hdf5-add/hdf5/src/H5Fint.c:2855 in H5F_addr_decode_len
Shadow bytes around the buggy address:
0x0c0c7fff8a20: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa
0x0c0c7fff8a30: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00
0x0c0c7fff8a40: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 00
0x0c0c7fff8a50: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
0x0c0c7fff8a60: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00
=>0x0c0c7fff8a70: 00 00 00 00[fa]fa fa fa 00 00 00 00 00 00 00 fa
0x0c0c7fff8a80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff8a90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff8aa0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff8ab0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff8ac0: 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