Open zhuvensi opened 5 months ago
I can not reproduce it. Did you test with master / 0.13.76 ?
Yes,I test it with the newest version.
Well, then I must assume there is some information missing. I would have liked to check before the next release but I guess it can wait a bit.
I am also able to reproduce the issue. extra_ptr
could be allocated in one byte, where the function ZZIP_EXTRA_ZIP64_CHECK, or later in the code, will call ZZIP_GETEXTRA() where it checks 2 first bytes to check the magic number. Therefor we get a heap-buffer-overflow. extra_ptr
should be allocated with at least 2 bytes.
I propose, with my PR to check if the u_extras is at least the same size of the zzip_extra struct.
probably fixed in v0.13.78
Describe:
A heap-buffer-overflow was discovered in zziplib v0.13.77. The issue is being triggered in function __zzip_parse_root_directory() at zzip/zip.c:539.Attackers may exploit this vulnerability to execute and cause a DOS attack.
Reproduce:
Tested in Ubuntu 22.04 First,Compile the program with address sanitizer:
AFL_USE_ASAN=1 CC=afl-clang-fast CXX=afl-clang-fast++ cmake ..
Then the poc is inputed:
/home/zziplib/build/bins/unzzip -l /home/zziplib/build/fuzz_out/default/crashes/id:000000,sig:06,src:000083,time:235075,execs:252387,op:havoc,rep:2
ASAN Reports:
and this is the code at the bug address:
Poc Poc file is here
Fuzzer Fuzzer is AFL.