ext/zip: don't use gl_pathc after call to globfree (#79424)#5311
Closed
maxcrees wants to merge 1 commit intophp:PHP-7.3from
maxcrees:zip-glob-uaf
Closed
ext/zip: don't use gl_pathc after call to globfree (#79424)#5311maxcrees wants to merge 1 commit intophp:PHP-7.3from maxcrees:zip-glob-uaf
maxcrees wants to merge 1 commit intophp:PHP-7.3from
maxcrees:zip-glob-uaf
Conversation
Member
|
Am I reading right that this is not a use-after-free in the classical sense (i.e. it would not show up in valgrind / asan), and as such we also don't need to treat this as a security issue? |
Contributor
Author
|
I'm not a security researcher so I'm not sure, I just wanted to fix this so that |
nikic
approved these changes
Mar 27, 2020
Member
nikic
left a comment
There was a problem hiding this comment.
Thanks for the context. For reference, the musl implementation: https://github.com/bminor/musl/blob/d0b547dfb5f7678cab6bc39dd736ed6454357ca4/src/regex/glob.c#L300
Member
|
cc @remicollet |
remicollet
approved these changes
Mar 28, 2020
Member
|
@sroracle could you please open a bug, so it can be linked in changelog ? |
Contributor
Author
|
Opened as #79424. Added an entry to NEWS and adjusted the commit message as appropriate. |
This breaks on Linux with the musl libc, since it zeroes out gl_pathc during globfree.
Member
|
Thanks a lot, Amended and applied in 7.3+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was introduced by b734bf4 ("- sync with PECL HEAD"), so 7.2, 7.3, 7.4, and master are affected. I based it against 7.3 per the CONTRIBUTING recommendations.
However, there is still a minor problem here - there is a discrepancy between the types of
globbuf.gl_pathc(size_t) and the return value ofphp_zip_glob(int). I wasn't sure how best to correct this so I leave that to the maintainers.