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

Issue about Partial Path Traversal #33

Open
Fewword opened this issue Feb 12, 2023 · 0 comments
Open

Issue about Partial Path Traversal #33

Fewword opened this issue Feb 12, 2023 · 0 comments

Comments

@Fewword
Copy link

Fewword commented Feb 12, 2023

The patch file for CVE-2021-21234 still has a vulnerability, which is a partial path traversal vulnerability.
In commit 1c76e1e, the securityCheck function use canonicalLoggingPath.startsWith(baseCanonicalPath) to check for path traversal vulnerabilities. But it still allows a malicious actor to potentially break out of the expected directory. The impact is limited to sibling directories. For example, userControlled.getCanonicalPath().startsWith("/usr/out") will allow an attacker to access a directory with a name like /usr/outnot.

Comparing paths with the java.nio.files.Path#startsWith will adequately protect againts this vulnerability.

For example: file.getCanonicalFile().toPath().startsWith(BASE_DIRECTORY) or file.getCanonicalFile().toPath().startsWith(BASE_DIRECTORY_FILE.getCanonicalFile().toPath())

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

No branches or pull requests

1 participant