Skip to content

Security: model method run writes outputs through symlinks #479

@stack72

Description

@stack72

Summary

When .swamp/outputs is replaced with a symlink pointing to an attacker-controlled directory, swamp model method run follows the symlink and writes output data to the external directory. This allows an attacker with write access to the .swamp/ directory to exfiltrate model outputs to arbitrary filesystem locations.

Reproduction

swamp init
swamp model create command/shell test-model
swamp model method run test-model execute  # creates .swamp/outputs/

# Replace outputs dir with symlink
rm -rf .swamp/outputs
ln -s /tmp/attacker-dir .swamp/outputs

swamp model method run test-model execute
ls /tmp/attacker-dir  # contains output files (~1966 bytes written)

Expected Behavior

Before writing to any path under .swamp/, swamp should verify the target is not a symlink pointing outside the repository boundary. If a symlink is detected, the operation should fail with a clear error rather than following it.

Impact

Output data (which may contain resolved secrets or sensitive computation results) can be written to attacker-controlled locations.

Context

Discovered via adversarial security boundary tests in swamp-uat (systeminit/swamp-uat#39).

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions