-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Critical - P2
-
None
-
Affects Version/s: 8.0.9
-
Component/s: None
-
Environment:python buildscripts/scons.py \
CC=clang-15 CXX=clang++-15 \
LLVM_SYMBOLIZER=/usr/bin/llvm-symbolizer-15 \
--sanitize=address,fuzzer \
--allocator=system \
--opt=debug \
--disable-warnings-as-errors \
--link-model=static \
CCFLAGS="-fprofile-instr-generate -fcoverage-mapping" \
LINKFLAGS="-fprofile-instr-generate" \
-j$(nproc)python buildscripts/scons.py \ CC=clang-15 CXX=clang++-15 \ LLVM_SYMBOLIZER=/usr/bin/llvm-symbolizer-15 \ --sanitize=address,fuzzer \ --allocator=system \ --opt=debug \ --disable-warnings-as-errors \ --link-model=static \ CCFLAGS="-fprofile-instr-generate -fcoverage-mapping" \ LINKFLAGS="-fprofile-instr-generate" \ -j$(nproc)
-
Server Programmability
-
ALL
-
-
Programmability 2023-03-30
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Hello! During exploring mongo r8.0.9 I found some fuzzing tests in master branch. Fromjson fuzzer is one of them, which I backported to version r8.0.9. ASAN detected error in 3rd party library code (Intel RDF Math Library). Its'not part of MongoDB, but how about to add some fixes?
ASAN error description:
When parsing a JSON document containing a $numberDecimal field with a numeric literal longer than 100 characters, the fromjson function initiates a call chain leading to __bid128_from_string in the third-party Intel RDF Math Library (bid128_string.c). In this function, a buffer char buffer[100] is allocated on the stack (line 295), but when processing a long number, the loop on line 632 accesses this buffer at an index greater than 99 (buffer[i] > '0'), resulting in a stack-buffer-overflow. This crash is reproducible on a 308-byte test case and can be used by an attacker to perform a denial of service (DoS). The expected behavior is correct error handling or rejection of an overly long number without crashing the server. The issue was discovered using fuzzing (libfuzzer + ASAN) and requires a fix in the Decimal128 parsing code.
I explored this part of 3rd party code in mongodb master branch and found that error is actual for latest version too. If you interesting in patching, I can open pr with possible fix
- is related to
-
SERVER-19622 Vendorize Intel DFP math library for 128-bit binary integer decimal support
-
- Closed
-