-
Notifications
You must be signed in to change notification settings - Fork 626
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
memory leak in png_malloc_warn and png_create_info_struct #307
Comments
CVE-2019-17371 was assigned to this issue. |
thx |
@zer0yu Hi, could you please offer more information about how to reproduce this bug. I have cloned gif2png and checkout to tag 2.5.9, the latest version is 3.0.0 and is ported to Golang. After compiling gif2png and extracting gif file(renamed to poc.gif) from your attachment, I executed
and some files:
poc.p01...poc.p50 are empty files. But no message about memory leakage were generated. |
Important detail missing: what version of libpng? |
@zer0yu Hi, I had some tests on gif2png. But I need your help. I used valgrind to check the memory leakage by executing
We can see the key function So I reviewed the gif2png source code, whose git-tag was 2.5.9 and commit id was Here is my patch to fixed it.
And here is the new output message
0 error! So my conclusion is that: the memory leakage is caused by gif2png but NOT libpng.
|
Sorry, it’s my mistake. My env:
details
|
I got hore the same results as this @willson-chen's comment, it does look like a gif2png issue, not libpng's.
|
@ctruta Hi, could you please to offer some help? |
Note that the reporter filed the same leak with gif2png but ESR closed it because he has "withdrawn" the version of gif2png written in C: https://gitlab.com/esr/gif2png/issues/8 |
The gif2png v3.0 has poted to Golang. So I think ESR won't continue to maintain v2.x version. |
Does any such vulnerability currently exist in libpng proper? If not, could this issue be closed? (Also, would anyone know if there is a way to withdraw the CVE, as well?) My org is a downstream user of this library, and the existence of this "vulnerability" with no forthcoming fix is leading to confusion with respect to security reviews and auditing. |
mitre.org manage the CVEs. You can jump to their website, choose I did that when I found the cause of this CVE. But mitre.org just appended a NOTE to the CVE description and no more response after that. |
Do they just need a number of requests, or will they want to hear from a project maintainer? It seems like someone would need to say, authoritatively, that the advisory is in error. |
I have no idea. You can just ask them about it. |
I wrote e-mail to nvd@nist.gov and they marked CVE-2019-17371 as related only to gif2png project. So, now this CVE is not assigned to libpng. This issue can be closed now. |
@theta682, I appreciate your action, but the NVD page still names libpng 1.6.37 as the vulnerable software. Did they mention a time frame for updating the public record? |
If you check the history of CVE-2019-17371 you can see "Modified Analysis - 2/13/2020 11:38:51 AM". This change replaced |
Oh, I see; you had sent the e-mail in the past. I've filled out the form on the MITRE site to request an update to the CVE's description. Hopefully that will be enough to get the matter resolved. |
All right, that was easy. The CVE description has been updated, and now makes no mention of libpng. This issue can now officially be put to rest. |
Thanks for looking into this all the way to the end. I'm closing the issue. |
Hi,libpng team. there are memory leaks in the function
png_malloc_warn
andpng_create_info_struct
, respectively.I compiler gif2png to the 32-bit LSB version with ASAN. The software runs in the x86-64 Ubuntu 16.04 services.
the bug is trigered by
./gif2png -r poc
.libpng_poc.zip
the asan debug info is as follows:
=================================================================
==35676==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 64056 byte(s) in 51 object(s) allocated from:
#0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x7ffff6c43c0d in png_malloc_warn (/lib/x86_64-linux-gnu/libpng16.so.16+0xac0d)
Direct leak of 17544 byte(s) in 51 object(s) allocated from:
#0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x7ffff6c3e032 in png_create_info_struct (/lib/x86_64-linux-gnu/libpng16.so.16+0x5032)
#2 0x4039d8 in processfile (/home/zeroyu/target_gif2png/gif2png64+0x4039d8)
#3 0x40406d in main (/home/zeroyu/target_gif2png/gif2png64+0x40406d)
#4 0x7ffff688f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Direct leak of 6656 byte(s) in 26 object(s) allocated from:
#0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x405df0 in xalloc (/home/zeroyu/target_gif2png/gif2png64+0x405df0)
#2 0x405953 in ReadImage (/home/zeroyu/target_gif2png/gif2png64+0x405953)
#3 0x404a6d in ReadGIF (/home/zeroyu/target_gif2png/gif2png64+0x404a6d)
#4 0x403647 in processfile (/home/zeroyu/target_gif2png/gif2png64+0x403647)
#5 0x40406d in main (/home/zeroyu/target_gif2png/gif2png64+0x40406d)
#6 0x7ffff688f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Direct leak of 2048 byte(s) in 8 object(s) allocated from:
#0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x405df0 in xalloc (/home/zeroyu/target_gif2png/gif2png64+0x405df0)
#2 0x405953 in ReadImage (/home/zeroyu/target_gif2png/gif2png64+0x405953)
#3 0x4049cc in ReadGIF (/home/zeroyu/target_gif2png/gif2png64+0x4049cc)
#4 0x403647 in processfile (/home/zeroyu/target_gif2png/gif2png64+0x403647)
#5 0x40406d in main (/home/zeroyu/target_gif2png/gif2png64+0x40406d)
#6 0x7ffff688f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
SUMMARY: AddressSanitizer: 90304 byte(s) leaked in 136 allocation(s).
[Inferior 1 (process 35676) exited with code 027]
The text was updated successfully, but these errors were encountered: