Skip to content

remote.py: unfiltered tar.extractall on Python 3.10/3.11 allows client-side path traversal #4

Description

@thedataengineer

shadowlm/remote.py:171-175:

try:
    tar.extractall(dest, filter="data")
except TypeError:  # Python < 3.12 has no filter= kwarg
    tar.extractall(dest)  # noqa: S202 — archive comes from our server

pyproject.toml sets requires-python = ">=3.10", so the unfiltered branch is live on Python 3.10 and 3.11. The transport is plain HTTP via urllib (remote.py:84), so a malicious or MITM'd server can ship a tar member with ../ components and write arbitrary paths on the client machine. The noqa justification ("archive comes from our server") does not hold once the client can point at any host, which is the whole point of backend="remote".

Fix options:

  1. Backport the sanitization: iterate members, reject absolute paths, .. components, symlinks/hardlinks escaping dest, then extract. Small function, no new deps.
  2. Or require Python >= 3.12 for the remote artifact path and fail with an actionable error on older interpreters.

Option 1 is the right call given the declared floor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions