0

I've always avoided using program execution PHP functions. From all the searching and reading I've done, it seems as though I have no choice but to use the system function to unzip a password protected ZIP file.

Is this truly still the only option where there is no PHP library that can unzip a password protected file?

If I do have to use the system function, is there a way to limit its usage to just the command I will need or something else I can do to prevent any potential vulnerabilities. I have a VPS.

1 Answer 1

1

Yes, there are nice extensions like Zlib and Zip for handling compressed files in PHP but you can't create or extract password protected files with these extensions.

You need to find a 3rd party library (i don't know is there any lib exists) to achieve that or simply continue to use program execution.

Also you may want to make some experiments with passthru() to keep disable shell_exec or system like dangerous methods.

Sign up to request clarification or add additional context in comments.

2 Comments

The passthru() function is less dangerous then? How do I not have the raw output display?
Ended up sticking with using shell_exec since it didn't display the raw output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.