Repository navigation
Prevent arbitrary file writes with malicious resource names. - #3484
Conversation
|
I clearly suck at understanding Windows pathing and cross-platform. Will revisit after some learning/research |
|
I still think that we can stick to extracting to the same path inside of the apk/zip itself. Basically unzipping but decoding some types on-the-fly. |
|
The challenge I suffer with here is that Path/File want to detect the path separator from the host OS. I want to specify one because as you mentioned these are paths correlating to Zip/Apk and then transitioned to host system. So for now - a basic check for traversal, which should suffice. |
|
Looks nice. Great effort! |
|
@iBotPeaches Can you cut a new release for apktool with this patch? I see that there is 2.10.0 scoped for April. Since this is a security fix, can we get a fixed version in the interim? |
I was planning a patch release this weekend. |
* refactor: rename sanitize function * fix: expose getDir * fix: safe handling of untrusted resource names - fixes: GHSA-2hqv-2xv4-5h5w * test: sample file for GHSA-2hqv-2xv4-5h5w * refactor: avoid detection of absolute files for resource check * chore: enable info mode on gradle * test: skip test on windows * chore: debug windows handling * fix: normalize entry with file separators * fix: normalize filepath after cleansing * chore: Android paths are not OS specific * refactor: use java.nio for path traversal checking * chore: align path separator on Windows for Zip files * chore: rework towards basic directory traversal * chore: remove '--info' on build.yml
Now its out - v2.9.2 - https://apktool.org/blog/apktool-2.9.2 |
* refactor: rename sanitize function * fix: expose getDir * fix: safe handling of untrusted resource names - fixes: GHSA-2hqv-2xv4-5h5w * test: sample file for GHSA-2hqv-2xv4-5h5w * refactor: avoid detection of absolute files for resource check * chore: enable info mode on gradle * test: skip test on windows * chore: debug windows handling * fix: normalize entry with file separators * fix: normalize filepath after cleansing * chore: Android paths are not OS specific * refactor: use java.nio for path traversal checking * chore: align path separator on Windows for Zip files * chore: rework towards basic directory traversal * chore: remove '--info' on build.yml
Fixes: #GHSA-2hqv-2xv4-5h5w