Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upgdCtxPrintf vsnprintf return value not checked - leaks stack memory #211
Comments
vapier
added
the
bug
label
May 13, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
vapier
May 13, 2016
Member
we probably should extend the IO layer to accept a va_list rather than go through a local buffer. then we can just pass it down directly w/out any stack allocation.
|
we probably should extend the IO layer to accept a va_list rather than go through a local buffer. then we can just pass it down directly w/out any stack allocation. |
vapier
changed the title from
gdCtxPrintf vsnprintf return value not checked - leaks memory in PHP 5.5
to
gdCtxPrintf vsnprintf return value not checked - leaks stack memory
May 14, 2016
vapier
closed this
in
4dc1a2d
May 14, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
fmunozs
commented
May 27, 2016
|
Hello, will this get a CVE assigned? Thanks. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
vapier
May 27, 2016
Member
i don't care much about CVE's. just upgrade to the latest version and be done.
|
i don't care much about CVE's. just upgrade to the latest version and be done. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
kaplanlior
commented
Jul 7, 2016
|
CVE-2016-5116 at http://seclists.org/oss-sec/2016/q2/430 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fmunozs commentedMay 13, 2016
Description:
See reproduction test case, length from the failed vsnprintf attempt [1] to copy more than 8000 chars on a 4096 buffer, vsnprintf [2] "a return value of size or more means that the output was truncated", however libgd returns this length as is and PHP prints more information from memory than it should.
Libgd isn't checking the vsnprintf return value and PHP 5.5 will print the length specified, leaking memory data.
This was reported to PHP
https://bugs.php.net/bug.php?id=72115
Compile PHP 5.5 with ASAN.
BP on https://github.com/php/php-src/blob/PHP-5.5/ext/gd/gd_ctx.c#L39
[1] https://github.com/libgd/libgd/blob/master/src/gd_xbm.c#L188
[2] http://linux.die.net/man/3/vsnprintf /
Test script:
Actual result: