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"
}
] |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 11