Repository navigation
cf-serverd: Fixed path ACL bypass through dangling symlink requests (3.24.x) - #6524
Conversation
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)
|
|
|
@cf-bottom Jenkins please :) |
|
Alright, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/15194/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-15194/ |
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech> (cherry picked from commit 93be6ee)
|
@cf-bottom Jenkins please :) |
|
Sure, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/15202/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-15202/ |
|
@cf-bottom Jenkins please :) |
|
Sure, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/15211/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-15211/ |
Backport of #6509 by @Dhanu-dynamic to 3.24.x.
Opened automatically by .github/workflows/backport.yml.
Pull requests opened with
GITHUB_TOKENdo not trigger other workflows, so CI has not started on its own.