You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mmdblookup tool is vulnerable to OOB write attack via execution with maliciously crafted parameter list.
Incorrect handling of the value returned by calloc in get_options may lead to:
out-of-bound write attempt and segmentation fault error in case of restrictive memory protection,
near NULL out-of-bound overwrite in case of limited memory restrictions (e.g. in embedded environments).
Memory allocation is performed to handle input parameters, which are controlled by the attacker.
Number of input parameters is limited by an operating system restrictions - e.g. in Linux by ARG_MAX: https://unix.stackexchange.com/questions/120642/what-defines-the-maximum-size-for-a-command-single-argument
mmdblookup allocates nr_params * sizeof(const char * ) bytes - e.g. on 64-bit Linux system following command allocated 1.6 MB block:
./bin/mmdblookup --file x --ip 1 $(python3 -c "print(209000*'0 ')")
If the allocation be unsuccessful (which may happen on systems with limited resources or strict limits) and calloc returns NULL, mmdblookup will fill the memory block starting from 0 with addresses of input parameters (argv).
mmdblookup tool is vulnerable to OOB write attack via execution with maliciously crafted parameter list.
Incorrect handling of the value returned by calloc in get_options may lead to:
Memory allocation is performed to handle input parameters, which are controlled by the attacker.
Number of input parameters is limited by an operating system restrictions - e.g. in Linux by ARG_MAX:
https://unix.stackexchange.com/questions/120642/what-defines-the-maximum-size-for-a-command-single-argument
mmdblookup allocates nr_params * sizeof(const char * ) bytes - e.g. on 64-bit Linux system following command allocated 1.6 MB block:
If the allocation be unsuccessful (which may happen on systems with limited resources or strict limits) and calloc returns NULL, mmdblookup will fill the memory block starting from 0 with addresses of input parameters (argv).
Vulnerable code (mmdblookup.c):
See following recommendations for details (especially the calloc example):
https://wiki.sei.cmu.edu/confluence/display/c/ERR33-C.+Detect+and+handle+standard+library+errors
The issue can be reproduced and tested using ErrorSanitizer (https://gitlab.com/ErrorSanitizer/ErrorSanitizer).
Reproduction steps:
Install gdb
Download and unpack code of ErrorSanitizer (https://gitlab.com/ErrorSanitizer/ErrorSanitizer)
Perform compilation of ErrorSanitizer according to the manual (https://gitlab.com/ErrorSanitizer/ErrorSanitizer#compilation)
cd ErrorSanitizer; make
Set ESAN to the path of ErrorSanitizer directory
export ESAN=/opt/...
Download and unzip attached map temp_0.cur_input
temp_0.cur_input.zip
Run mmdblookup with ErrorSanitizer in gdb using:
gdb -batch -ex='run' -ex='backtrace' --args env LD_PRELOAD="$ESAN/error_sanitizer_preload.so" ./bin/.libs/mmdblookup --file tmp --ip 0 temp_0.cur_input
You should receive similar output:
The text was updated successfully, but these errors were encountered: