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

Security Fix #728

Merged
merged 1 commit into from
Apr 27, 2024
Merged

Security Fix #728

merged 1 commit into from
Apr 27, 2024

Conversation

jinhaochan
Copy link
Contributor

The fix in the commit 8f5a3a3 is insufficient to prevent path traversal, as the attacker can still use payloads such as content/../index.php to bypass the check.

This PR uses realpath to resolve all path traversing operations to give the final path.

For example /var/html/content/../index.php becomes /var/html/index.php

It then creates a variable contentDir which is the fully qualified path for the content folder

e.g. /var/html/content/

When a user deletes a file, it checks if the absolute path of the file starts with contentDir (/var/html/content/). If it does not, it means that the file does not exist in /var/html/content/, and the operation is denied.

@danpros danpros merged commit b89317f into danpros:master Apr 27, 2024
@danpros
Copy link
Owner

danpros commented Apr 27, 2024

Great, thank you!

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