Skip to content

cf-serverd: Fixed path ACL bypass through dangling symlink requests (3.24.x) - #6524

Merged
larsewi merged 3 commits into
3.24.xfrom
backport/6509-3.24.x
Nov 26, 2026
Merged

larsewi merged 3 commits into
3.24.xfrom
backport/6509-3.24.x

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport of #6509 by @Dhanu-dynamic to 3.24.x.

Opened automatically by .github/workflows/backport.yml.

Pull requests opened with GITHUB_TOKEN do not trigger other workflows, so CI has not started on its own.

github-actions Bot and others added 2 commits November 24, 2026 09:12
PreprocessRequestPath() (TLS protocol) and AccessControl() (classic
protocol) canonicalise the requested path with realpath() before matching
it against the path ACL, and that match is a plain string prefix check.
realpath() fails on a dangling symlink, and both functions then fell back
to the path exactly as the client sent it, with '..' components and
symlinked directories unresolved. A client admitted to /srv/admitted could
request /srv/admitted/../../etc/some-dangling-link: lstat() resolves it
outside the admitted tree, while the prefix match admits it (and deny
rules miss it). STAT then returns the lstat() metadata and readlink()
target of any dangling symlink on the server.

For a dangling symlink, canonicalise its parent directory with realpath()
and append the link name instead. The classic branch also no longer reads
statbuf after a failed lstat().

Changelog: Title
Signed-off-by: Dhanraj E <dhanraj@labs.digiscrypt.com>
(cherry picked from commit 4f7cb87)
- Removed the classic protocol changes.
- Capped the resolved path at PATH_MAX, as acl_CheckPath() expects.
- Reused ReadLastNode() and GetParentDirectoryCopy().
- Added a test for a symlinked parent directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
(cherry picked from commit e1db2e4)
@CLAassistant

CLAassistant commented Nov 24, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ larsewi
❌ github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@larsewi

larsewi commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

@cf-bottom Jenkins please :)

@cf-bottom

Copy link
Copy Markdown

Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
(cherry picked from commit 93be6ee)
@larsewi

larsewi commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

@cf-bottom Jenkins please :)

@cf-bottom

Copy link
Copy Markdown

@larsewi

larsewi commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

@cf-bottom Jenkins please :)

@cf-bottom

Copy link
Copy Markdown

@larsewi
larsewi merged commit 896019c into 3.24.x Nov 26, 2026
42 of 43 checks passed
@larsewi
larsewi deleted the backport/6509-3.24.x branch November 26, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants