Skip to content

return BreakoutError when symlink does not link to a path inside the destination - #9486

Merged
taylorsilva merged 1 commit into
masterfrom
symlink-target-validation
Mar 16, 2026
Merged

taylorsilva merged 1 commit into
masterfrom
symlink-target-validation

Conversation

@taylorsilva

Copy link
Copy Markdown
Member

Changes proposed by this PR

Issue reported to [email protected] by @SnailSploit

Added tests to verify this behaviour for hard links and symlinks.

Thankfully it is not easy to exploit this code path within Concourse. This code gets called in two scenarios:

  • When fly downloads outputs from a fly execute --output build
  • When baggageclaim streams a volume in (Windows/macOS workers only)

Neither case has an easy path to exploit.

In the first case, you'd have to trick the user into running a malicious Task config which would create an output volume with the goal of overwriting a specific file on the users' system. This would require the attacker knowing the directory the user will run fly execute in and what file the attacker wants to overwrite. The user also has to include the correct output in --output in the fly execute command. If the user can be socially engineered to run an arbitrary task on their Concourse system, the attacker could just as easily get the user to execute a simple bash script instead. The external CI system is also potentially a better target than the users' system.

In the second case, you'd have to already have access to run arbitrary workloads on the Concourse worker or some way to craft a volume that will then be streamed to a Windows or macOS worker. This would involve intimiate knowledge of the target pipeline and would likely mean the attacker can modify the pipeline to do whatever they want, which would make this exploit moot to the attacker.

…destination

Added tests to verify this behaviour for hard links and symlinks.

Thankfully it is not easy to exploit this code path within Concourse.
This code gets called in two scenarios:

- When fly downloads outputs from a `fly execute --output` build
- When baggageclaim streams a volume in (Windows/macOS workers only)

Neither case has an easy path to exploit.

In the first case, you'd have to trick the user into running a malicious
Task config which would create an output volume with the goal of
overwriting a specific file on the users' system. This would require the
attacker knowing the directory the user will run `fly execute` in and
what file the attacker wants to overwrite. The user also has to include
the correct output in `--output` in the `fly execute` command. If the
user can be socially engineered to run an arbitrary task on their
Concourse system, the attacker could just as easily get the user to
execute a simple bash script instead. The external CI system is also
potentially a better target than the users' system.

In the second case, you'd have to already have access to run arbitrary
workloads on the Concourse worker or some way to craft a volume that
will then be streamed to a Windows or macOS worker. This would involve
intimiate knowledge of the target pipeline and would likely mean the
attacker can modify the pipeline to do whatever they want, which would
make this exploit moot to the attacker.

Signed-off-by: Taylor Silva <[email protected]>
@taylorsilva
taylorsilva requested a review from a team March 16, 2026 15:14
@taylorsilva
taylorsilva merged commit 6c09a5f into master Mar 16, 2026
12 checks passed
@taylorsilva
taylorsilva deleted the symlink-target-validation branch March 16, 2026 17:27
@taylorsilva taylorsilva mentioned this pull request Mar 17, 2026
4 tasks done
aliculPix4D added a commit to Pix4D/concourse-tar-streaming-issue that referenced this pull request Jun 9, 2026
aliculPix4D added a commit to Pix4D/concourse-tar-streaming-issue that referenced this pull request Jun 9, 2026
aliculPix4D added a commit to Pix4D/concourse-tar-streaming-issue that referenced this pull request Jun 9, 2026
aliculPix4D added a commit to Pix4D/concourse-tar-streaming-issue that referenced this pull request Jun 9, 2026
aliculPix4D added a commit to Pix4D/concourse-tar-streaming-issue that referenced this pull request Jun 9, 2026
aliculPix4D added a commit to Pix4D/concourse-tar-streaming-issue that referenced this pull request Jun 9, 2026
taylorsilva added a commit that referenced this pull request Jun 15, 2026
Basically reverting #9486, but adding one safe-guard against path
escapes from symlinks when creating a relative symlink. `os.Root` is
doing the heavy-lifting for us here. It'll protect us from extraction
attacks that try to write outside the destination directory.

Signed-off-by: Taylor Silva <[email protected]>
taylorsilva added a commit that referenced this pull request Jun 15, 2026
Basically reverting #9486, but adding one safe-guard against path
escapes from symlinks when creating a relative symlink. `os.Root` is
doing the heavy-lifting for us here. It'll protect us from extraction
attacks that try to write outside the destination directory.

Signed-off-by: Taylor Silva <[email protected]>
taylorsilva added a commit that referenced this pull request Jun 15, 2026
Basically reverting #9486, but adding one safe-guard against path
escapes from symlinks when creating a relative symlink. `os.Root` is
doing the heavy-lifting for us here. It'll protect us from extraction
attacks that try to write outside the destination directory.

Signed-off-by: Taylor Silva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant