Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Modpack format path warning does not cover all possible bad paths on windows #84

Closed
SilverAndro opened this issue Jan 31, 2023 · 2 comments

Comments

@SilverAndro
Copy link

SilverAndro commented Jan 31, 2023

Going off of https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats the given warning on https://docs.modrinth.com/docs/modpacks/format_definition/#path that says to "make sure it doesn't contain .. or start with a drive name (i.e., [A-Z]:/, [A-Z]:\, and /).", If implemented at face value, would still result in multiple bad file paths being permitted such as:

  • \Program Files\Custom Utilities\StringFinder.exe: A relative path from the root of the current drive.
  • \\system07\C$\: The root directory of the C: drive on system07. (A network drive/resource)
  • DOS device paths such as \\.\C:\Test\Foo.txt and \\?\C:\Test\Foo.txt
  • Paths with ..\

This could be resolved by either adding \ as a disallowed starting character and adding ..\, or promoting normalization checks instead

@Akarys42
Copy link

If those paths are accepted by some launcher implementations, this should be escalated to a security advisory (CWE-35: Path transversal)

@SilverAndro
Copy link
Author

CWE-22 actually

CWE-35 is covered by the .. restriction as it's specifically about improper normalization and not generic path traversal

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants