-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heap-buffer-overflow in color.c:379:42 in sycc420_to_rgb #1347
Comments
@yuawn , szukw000: opj_decompress -i poc.j2k -o poc.j2k.png [INFO] Start to read j2k main header (0). imagetopng: All components shall have the same subsampling, same bit depth, same sign. winfried |
@yuawn ,
winfried |
@szukw000, |
I also reproduced it on released version 2.3.1 released on Apr 2, 2019. |
@yuawn I try to build openjpeg with AFL but got error it can't find clang... already install it beforehand. |
@CityOfLight77 there is no need to build it with AFL. Both of GCC and Clang supports ASAN, just build it as I said above: CFLAGS='-g -fsanitize=address' cmake .. -DCMAKE_BUILD_TYPE=Release
make I reproduced this bug with gcc and clang on the versions from 2.3.1 to current master. |
@yuawn ,
opj_decompress -i /tmp/1347-poc.j2k -o 1347-poc.j2k.png
By the way: I use gcc (GCC) 10.3.0. winfried |
Hi @szukw000, I can confirm that the following script can reproduce the bug successfully: git clone https://github.com/uclouvain/openjpeg.git
cd openjpeg
git checkout v2.4.0
mkdir build
cd build
CFLAGS='-g -fsanitize=address' cmake .. -DCMAKE_BUILD_TYPE=Release
make
wget https://github.com/uclouvain/openjpeg/files/6402272/poc.j2k.gz
gunzip poc.j2k.gz
./bin/opj_decompress -i ./poc.j2k -o ./out.png $ gcc --version
gcc (Ubuntu 10.2.0-5ubuntu1~20.04) 10.2.0
$ md5sum poc.j2k
c85153c022a7469d865a5a0b5e2781f8 poc.j2k |
This issue got assigned CVE-2021-3575. @msabwat would be worthy if you can add this CVE ID to your commit message. |
Did you request it? Still seems reserved, so should be safe to make public now, right? |
Any chance getting canonical fix merged? This is now public as severity 6.8 arbitrary code execution bug. |
any update here? |
@ZaquL I guess that would explain why prior attempts to fix resulted in minor corruption. |
is this finally patched or not? |
Any updates? This vulnerability is still unpatched after two years. |
Is this issue being actively looked into? This vulnerability is still unpatched after two years. The last release for this component was 2 years ago. Is this component being maintained? Is there an alternative to OpenJPEG? |
JasPer would be one possible alternative to OpenJPEG. |
Fix in #1509 |
opj_decompress: fix off-by-one read heap-buffer-overflow in sycc420_to_rgb() when x0 and y0 are odd (CVE-2021-3575, fixes #1347)
Hi,
I found a vulnerability in current master 0bda718, and I also reproduced it on latest released version v2.4.0.
Crash Summary
A heap-buffer-overflow in color.c:379:42 in sycc420_to_rgb, it can lead to heap-based buffer overflow via a crafted
.j2k
file when decompress it.Crash Analysis
There is insufficient validation of
*cb
.openjpeg/src/bin/common/color.c
Lines 375 to 381 in 0bda718
PoC:
poc.j2k.gz
To reproduce (x86-64 Ubuntu 20.04.2 with gcc 9.3.0):
CFLAGS='-g -fsanitize=address' cmake .. -DCMAKE_BUILD_TYPE=Release make ./bin/opj_decompress -i ./poc.j2k -o out.png
ASAN report:
The text was updated successfully, but these errors were encountered: