fix: resolve #1102 — tinker补丁zip解压缩漏洞#1792
Open
Nam0101 wants to merge 3 commits into
Open
Conversation
Fixes Tencent#1102 Signed-off-by: Nguyen Van Nam <nam.nv205106@gmail.com>
Fixes Tencent#1102 Signed-off-by: Nguyen Van Nam <nam.nv205106@gmail.com>
Fixes Tencent#1102 Signed-off-by: Nguyen Van Nam <nam.nv205106@gmail.com>
Member
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.
Summary
fix: resolve #1102 — tinker补丁zip解压缩漏洞
Problem
Severity:
High| File:tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/patch/BsDiffPatchInternal.javaThis sibling class extracts native library entries from the same patch zip. It is subject to the same Zip Slip vector if it uses
ZipEntry.getName()to construct destination paths under the patch lib directory.Solution
Refactor the entry-name validator into a shared utility (see suggested
PatchEntryUtilsbelow) and call it for everyZipEntryconsumed inpatchFastExtractDiffInternals/ similar methods. Also perform the canonical-path containment check before writing each extracted file.Changes
tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/patch/PatchEntryUtils.java(new)tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/patch/ResDiffPatchInternal.java(modified)tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/util/PatchEntryUtils.java(new)Testing
Note: this change was drafted with AI assistance and reviewed locally before submission.