Repository navigation
Description
Summary
The archive extractors themselves hold up: property-testing Lemonade's in-process extractor and GNU tar (used for the SDK and uv) with archives built from traversal names, absolute paths, backslashes, UNC prefixes, NUL and non-UTF-8 bytes, outward symlinks and hard links found no write outside the install root, across 3,000 cases each. The defects below are all in code that runs after extraction.
1. ComfyUI: a top-level symlink in the source archive relocates the install
first_child_dir (apps/rocm/src/comfyui.rs) picks the source directory with path.is_dir(), which follows symlinks. An archive whose single top-level entry is a link (l -> .., or l -> /some/dir) has that link chosen, renamed to source/, and install then calls create_dir_all(source/models) — creating the models folder, and every later run's state, wherever the link points.
2. uv bootstrap: the binary lookup follows links out of staging and can recurse without bound
find_binary_in (crates/rocm-core/src/uv.rs) recurses through is_dir()/is_file(), both of which follow symlinks, with no depth limit and no cycle check:
- an entry
uv -> <outside>/fileis found, andmake_executablethen sets mode0755on the outside file; - two entries
a -> .andb -> .make the search recurse effectively forever (still running after 20 s in testing); - a single
l -> /walks the whole filesystem.
3. ComfyUI keeps world-writable modes from the archive
The tar crate drops setuid/setgid but does not apply the umask, so a 0777/0666 entry stays world-writable. Lemonade's extractor already masks modes; ComfyUI's does not.
Trust boundary — read before triaging severity
Each of these needs a forged or tampered archive:
- The ComfyUI source is GitHub's branch tarball over HTTPS, with no checksum, cached under the app's
downloads/directory and reused without re-checking. GitHub's own archives always have a single real top-level directory, so reaching (1) needs a forged archive or an edited cached file. - The
uvrelease is fetched from GitHub over HTTPS with no checksum. A maliciousuvarchive is executed anyway, so (2) is defence in depth rather than a new attack path.
These are hardening issues. They are filed because the fixes are small and the same code already does the right thing elsewhere.
Possible solution
Use symlink_metadata / DirEntry::file_type() (which does not follow links) in first_child_dir and find_binary_in, bound the recursion depth, and mask modes with & 0o755 in the ComfyUI unpack as Lemonade already does.
Not verified
- Running as root: GNU
tarrun as root preserves ownership and setuid bits by default, which would matter for the SDK anduvpaths. Not testable here. - Windows:
bsdtar,Expand-Archive, and backslash/drive-letter handling as real separators were not exercised; the properties are Unix-only.
Environment
- Built from
main. Findings 1–3 reproduced on Linux.
Activity
test: keep hostile archives inside the watched tree, judge modes per …
test: property-test every archive extractor against the filesystem
test: keep hostile archives inside the watched tree, judge modes per …
test: property-test every archive extractor against the filesystem (R…
test: give the #522 symlink reproducers the known gap: prefix
test: give the #522 symlink reproducers the known gap: prefix
test: give the #522 symlink reproducers the known gap: prefix
test: property-test --gpu selection and the SSE line emitters (ROCMAI…