fix(archive): validate GNU tar metadata - #838
Conversation
Read GNU long-name and long-link records during the raw tar scan so it validates the same paths used by the extractor. Reject escaping targets and writes through hidden symlink names while keeping safe GNU metadata compatible.
|
@rustytrees Thanks for the contribution! One small request: could you please instruct your agent to follow the PR template provided in the repository for PRs? It helps keep the PRs consistent and easier to review. Thanks! |
|
I published a runnable PoC for the GNU metadata mismatch fixed here: git clone https://github.com/rustytrees/malt-security-pocs.git
cd malt-security-pocs
git checkout bd0e2a4d088cc63c8a7ab1613e851d23808b5a4d
./scripts/run-poc.sh --malt /path/to/malt --expect vulnerable h01The PoC combines GNU Exact |
Description
The tar pre-scan now reads GNU long-name and long-link records before validating the following entry. It checks the same effective name and link target that the extractor uses.
Regression tests cover an escaping long-link target, a hidden symlink name followed by an outside write, and safe GNU metadata.
Related Issue
Closes #854.
Notes for Reviewers
Verification completed:
zig build test-one: 2,427 passedzig build test: 5,062 passed, 3 skippedgit verify-commit