Container: Restrict path of template files and targets#17550
Merged
tomponline merged 2 commits intocanonical:mainfrom Feb 3, 2026
Merged
Container: Restrict path of template files and targets#17550tomponline merged 2 commits intocanonical:mainfrom
tomponline merged 2 commits intocanonical:mainfrom
Conversation
cf0f96e to
45f2df4
Compare
…targets This fixes three security issues related to file templates: - The template target path could be made to be relative or gothrough symlinks in a way that could lead to arbitrary write to the host filesystem. - The template directory could be relative, allowing for arbitrary read from the host filesystem. - The template file itself could be made relative, allowing for arbitrary reads from the host filesystem. In the case of the template target path, the new logic makes use of the kernel's openat2 system call which brings a variety of flags that can be used to restrict path resolution and detect potential issues. For the template path itself, we now validate that it is a simple local file and that the template directory isn't a symlink. This fixes CVE-2026-23954 Reported-by: Rory McNamara <[email protected]> Signed-off-by: Stéphane Graber <[email protected]> (cherry picked from commit c1d90bd34a7ccc224276b87644d7c75437f1cb64) Signed-off-by: Thomas Parrott <[email protected]> License: Apache-2.0
…llow error wrapping Also: - Closes rootfs file handle earlier. - Handles errors if file handles error when closing. Signed-off-by: Thomas Parrott <[email protected]>
45f2df4 to
c981c47
Compare
simondeziel
approved these changes
Feb 3, 2026
kadinsayani
approved these changes
Feb 3, 2026
tomponline
added a commit
to tomponline/lxd-pkg-snap
that referenced
this pull request
Feb 4, 2026
Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551 Signed-off-by: Thomas Parrott <[email protected]>
tomponline
added a commit
to canonical/lxd-pkg-snap
that referenced
this pull request
Feb 4, 2026
Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551
tomponline
added a commit
that referenced
this pull request
Feb 6, 2026
tomponline
added a commit
to tomponline/lxd-pkg-snap
that referenced
this pull request
Feb 9, 2026
Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551 Signed-off-by: Thomas Parrott <[email protected]>
tomponline
added a commit
to tomponline/lxd-pkg-snap
that referenced
this pull request
Feb 9, 2026
Cherry-picks from canonical/lxd#17577 Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551 Signed-off-by: Thomas Parrott <[email protected]>
tomponline
added a commit
to tomponline/lxd-pkg-snap
that referenced
this pull request
Feb 9, 2026
Cherry-picks from canonical/lxd#17577 Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551 Signed-off-by: Thomas Parrott <[email protected]>
tomponline
added a commit
to canonical/lxd-pkg-snap
that referenced
this pull request
Feb 9, 2026
Cherry-picks from canonical/lxd#17577 Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551
tomponline
added a commit
that referenced
this pull request
Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on lxc/incus#2848
Related to GHSA-7f67-crqm-jgh7 (CVE-2026-23954)
This addresses a security issue that was responsibly disclosed to the Incus security team by Rory McNamara of snyk.io.