Reports and Resources
Null pointer dereference in H5AC.c – HDF5 – 1.13.0
Loginsoft-2020-1005
11 March, 2020
CVE Number
CVE-2020-10810
CWECWE – 476 : NULL Pointer Dereference
Product DetailsHDF5 is a data model, library, and file format for storing and managing data. It supports an unlimited variety of data types and is designed for flexible and efficient I/O and for high volume and complex data. HDF5 is portable and is extensible, allowing applications to evolve in their use of HDF5. The HDF5 Technology suite includes tools and applications for managing, manipulating, viewing, and analyzing data in the HDF5 format.
URL: https://www.hdfgroup.org/downloads
Vulnerable Versions
1.13.0
Vulnerability DetailsDuring our research we observed Null pointer dereference in the function H5AC_unpin_entry() located in H5AC.c. The same be triggered by sending a crafted file to the h5clear binary. It allows an attacker to cause Denial of Service.
SYNOPSISDuring our research on hdf5, When function H5F__dest() to flushe the cache located in H5Fint.c calls another function H5AC_unpin_entry() to Unpin a cache entry located in H5AC.c, here before calling function H5C_log_write_unpin_entry_msg() for generating log message in line if(cache_ptr->log_info->logging) it is trying to dereference cache_ptr() pointer which is null and it triggers the null pointer dereference.
Analysis
DEBUG:
GDB:
Valgrind Output:
==21963== Memcheck, a memory error detector ==21963== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==21963== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info ==21963== Command: ./h5clear -s -m POC ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C90: ??? ==21963== Address 0x58c0c90 is 0 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C91: ??? ==21963== Address 0x58c0c91 is 1 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C92: ??? ==21963== Address 0x58c0c92 is 2 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C93: ??? ==21963== Address 0x58c0c93 is 3 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C94: ??? ==21963== Address 0x58c0c94 is 4 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C95: ??? ==21963== Address 0x58c0c95 is 5 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C96: ??? ==21963== Address 0x58c0c96 is 6 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C97: ??? ==21963== Address 0x58c0c97 is 7 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C98: ??? ==21963== Address 0x58c0c98 is 8 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C99: ??? ==21963== Address 0x58c0c99 is 9 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C9A: ??? ==21963== Address 0x58c0c9a is 10 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C9B: ??? ==21963== Address 0x58c0c9b is 11 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C9C: ??? ==21963== Address 0x58c0c9c is 12 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C9D: ??? ==21963== Address 0x58c0c9d is 13 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C9E: ??? ==21963== Address 0x58c0c9e is 14 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0C9F: ??? ==21963== Address 0x58c0c9f is 15 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0CA0: ??? ==21963== Address 0x58c0ca0 is 16 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0CA1: ??? ==21963== Address 0x58c0ca1 is 17 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0CA2: ??? ==21963== Address 0x58c0ca2 is 18 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0CA3: ??? ==21963== Address 0x58c0ca3 is 19 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0CA4: ??? ==21963== Address 0x58c0ca4 is 20 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0CA5: ??? ==21963== Address 0x58c0ca5 is 21 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0CA6: ??? ==21963== Address 0x58c0ca6 is 22 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0CA7: ??? ==21963== Address 0x58c0ca7 is 23 bytes after a block of size 64 alloc'd ==21963== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21963== by 0x38382F: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x58C0A8F: ??? ==21963== by 0x58C089F: ??? ==21963== by 0x37: ??? ==21963== by 0x4CB5B2: ??? (in /hdf5/build/bin/h5clear) ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0CA8: ??? ==21963== Address 0x58c0ca8 is 24 bytes after a block of size 64 in arena "client" ==21963== ==21963== Invalid read of size 1 ==21963== at 0x318FB7: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x504A81: ??? (in /hdf5/build/bin/h5clear) ==21963== by 0x16: ??? ==21963== by 0x58C0CA9: ??? ==21963== Address 0x58c0ca9 is 25 bytes after a block of size 64 in arena "client" ==21963== ==21963== Invalid read of size 8 ==21963== at 0x1A825C: ??? (in /hdf5/build/bin/h5clear) ==21963== Address 0x8 is not stack'd, malloc'd or (recently) free'd ==21963== ==21963== ==21963== Process terminating with default action of signal 11 (SIGSEGV) ==21963== Access not within mapped region at address 0x8 ==21963== at 0x1A825C: ??? (in /hdf5/build/bin/h5clear) ==21963== If you believe this happened as a result of a stack ==21963== overflow in your program's main thread (unlikely but ==21963== possible), you can try to increase the size of the ==21963== main thread stack using the --main-stacksize= flag. ==21963== The main thread stack size used in this run was 8388608. Segmentation fault
Proof of Concept./h5clear -s -m $POC
Vendor Disclosure: 2020-3-10
Credit
Discovered by ACE Team – Loginsoft