Skip to content

Validate zip directory entries during extraction#898

Open
dfgvaetyj3456356-hash wants to merge 1 commit into
combust:masterfrom
dfgvaetyj3456356-hash:security/zip-extract-directory-traversal
Open

Validate zip directory entries during extraction#898
dfgvaetyj3456356-hash wants to merge 1 commit into
combust:masterfrom
dfgvaetyj3456356-hash:security/zip-extract-directory-traversal

Conversation

@dfgvaetyj3456356-hash
Copy link
Copy Markdown

Summary

  • validate zip entry paths before creating directory entries during extraction
  • keep the same containment check for file entries
  • add a regression test for ../ directory entries that previously could create directories outside the extraction target

Why

FileUtil.extract checked normalized paths for file entries, but directory entries were created before any containment validation. A crafted archive with a directory entry such as ../outside/ could therefore create directories outside the intended extraction root.

Testing

  • git diff --check

I could not run the Scala test suite locally because this Windows environment does not have sbt, scala, scalac, or java on PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant