Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add security checks to prevent directory traversal when decompressing… #537

Closed
wants to merge 2 commits into from

Conversation

afeng2016-s
Copy link

@afeng2016-s afeng2016-s commented Aug 13, 2023

This is a PR submission for #536

To verify that there is a directory traversal risk when unzipping the zip file, I test in FileUtilsTest.java.

1.Using the zipslip vulnerability, create a zip file.Save the created zip file in the D:/code/pf4j directory, if you do not have this path on your computer D drive, create it.
image

  1. Next, call expandIfZip or loadPluginFromPath method to extract the zip file to the root directory of disk D of the computer.
    image

3.To prevent path crossing problems caused by unsafe input, I recommend adding checks to the extract() method.
image

After adding the check, an exception is thrown when there is a malicious file name
image

Sorry, commits/c1b03c92c03cc42ef7d197d962acd785bbea60dd is wrong, commits/ed9392069fe14c6c30d9f876710e5ad40f7ea8c1 provide repair plan is correct.

@afeng2016-s afeng2016-s deleted the dev/pf4j branch August 13, 2023 08:29
@afeng2016-s afeng2016-s restored the dev/pf4j branch August 13, 2023 09:01
@afeng2016-s afeng2016-s reopened this Aug 13, 2023
@decebals
Copy link
Member

Replaced by #538.
@afeng2016-s Thank you for your implication!

@decebals decebals closed this Aug 16, 2023
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.

None yet

2 participants