GHSA-x9qq-236j-gj97: Github.com/canonical/lxd Canonical LXD Documentation Improvement To Vulnerability
LOWGHSA-x9qq-236j-gj97 is a LOW canonical lxd documentation improvement to vulnerability (General Security Weakness) affecting Github.com/canonical/lxd libraries in the Go ecosystem. The issue involves canonical lxd documentation improvement to make clear restricted.devices.disk=allow without restricted.devices.disk.paths also allows shift=true. Remediation is available by upgrading affected packages to version 5.20.0, 0.0.0-20240118092008-ce1bd0dd37bb.
GHSA-x9qq-236j-gj97 at a Glance
How to Fix GHSA-x9qq-236j-gj97
To remediate this vulnerability, upgrade all affected Github.com/canonical/lxd dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/canonical/lxd to 5.20.0
Upgrade github.com/canonical/lxd to 0.0.0-20240118092008-ce1bd0dd37bb
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/canonical/lxd
How to Check if You Are Affected
To determine whether your application is affected by GHSA-x9qq-236j-gj97, inspect your project dependencies for Github.com/canonical/lxd:
inspect dependencies for github.com/canonical/lxd
Analyze the terminal output to locate any version of Github.com/canonical/lxd in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.20.0), 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 General Security Weakness. In Github.com/canonical/lxd, 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
GHSA-x9qq-236j-gj97 Affected Github.com/canonical/lxd Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/canonical/lxd
|
Go |
≥ 5.19.0
< 5.20.0
All 1 versions
5.19.0
|
5.20.0
|
|
github.com/canonical/lxd
|
Go |
≥ 0.0.0-20230920084527-cbe39c5d3f14
< 0.0.0-20240118092008-ce1bd0dd37bb
|
0.0.0-20240118092008-ce1bd0dd37bb
|
References
Frequently Asked Questions
What is GHSA-x9qq-236j-gj97?
Which Github.com/canonical/lxd versions are affected?
What version fixes GHSA-x9qq-236j-gj97?
Is github.com/canonical/lxd affected?
What CWE is associated with GHSA-x9qq-236j-gj97?
How can I check Go dependencies for GHSA-x9qq-236j-gj97?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-x9qq-236j-gj97",
"modified" : "2025-07-22T14:57:33Z",
"published" : "2023-12-05T23:32:58Z",
"aliases" : [ ],
"summary" : "Canonical LXD documentation improvement to make clear restricted.devices.disk=allow without restricted.devices.disk.paths also allows shift=true",
"details" : "### Summary\n\nIf a user has restricted access to a project that is configured with `restricted=true`, they can gain root access on the system by creating a disk device with `shift=true` and creating a setuid root executable. This is possible because the `shift` property is not restricted unless `restricted.devices.disk.paths` is set.\n\n### Details\n\nThe following patch shows the offending code with a possible fix:\n```patch\n--- a/lxd/device/disk.go\n+++ b/lxd/device/disk.go\n@@ -429,17 +429,19 @@ func (d *disk) validateEnvironmentSourcePath() error {\n if instProject.Name != api.ProjectDefaultName {\n // If restricted disk paths are in force, then check the disk's source is allowed, and record the\n // allowed parent path for later user during device start up sequence.\n- if shared.IsTrue(instProject.Config[\"restricted\"]) && instProject.Config[\"restricted.devices.disk.paths\"] != \"\" {\n- allowed, restrictedParentSourcePath := project.CheckRestrictedDevicesDiskPaths(instProject.Config, d.config[\"source\"])\n- if !allowed {\n- return fmt.Errorf(\"Disk source path %q not allowed by project for disk %q\", d.config[\"source\"], d.name)\n+ if shared.IsTrue(instProject.Config[\"restricted\"]) {\n+ if instProject.Config[\"restricted.devices.disk.paths\"] != \"\" {\n+ allowed, restrictedParentSourcePath := project.CheckRestrictedDevicesDiskPaths(instProject.Config, d.config[\"source\"])\n+ if !allowed {\n+ return fmt.Errorf(\"Disk source path %q not allowed by project for disk %q\", d.config[\"source\"], d.name)\n+ }\n+\n+ d.restrictedParentSourcePath = shared.HostPath(restrictedParentSourcePath)\n }\n\n if shared.IsTrue(d.config[\"shift\"]) {\n return fmt.Errorf(`The \"shift\" property cannot be used with a restricted source path`)\n }\n-\n- d.restrictedParentSourcePath = shared.HostPath(restrictedParentSourcePath)\n }\n }\n```\n\n### PoC\n\n```bash\n$ lxc project create restricted -c restricted=true -c restricted.devices.disk=allow\n$ lxc project switch restricted\n$ lxc profile device add default root disk path=/ pool=default\n$ lxc init ubuntu:22.04 c1\n$ lxc config device add c1 d1 disk source=/ path=/mnt shift=true\n$ lxc start c1 # no error\n\n$ lxc project set restricted restricted.devices.disk.paths=/ # explicitly allow mounting /\n$ lxc restart c1\nError: Failed to start device \"d1\": The \"shift\" property cannot be used with a restricted source path\n```\n\nCreated https://github.com/canonical/lxd/issues/12606 to improve the documentation as per https://github.com/canonical/lxd/security/advisories/GHSA-x9qq-236j-gj97#advisory-comment-91918",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/canonical/lxd"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.19.0"
}, {
"fixed" : "5.20.0"
} ]
} ],
"versions" : [ "5.19.0" ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/canonical/lxd"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.0.0-20230920084527-cbe39c5d3f14"
}, {
"fixed" : "0.0.0-20240118092008-ce1bd0dd37bb"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/canonical/lxd/security/advisories/GHSA-x9qq-236j-gj97"
}, {
"type" : "WEB",
"url" : "https://github.com/canonical/lxd/issues/12606"
}, {
"type" : "WEB",
"url" : "https://github.com/canonical/lxd/commit/ce1bd0dd37bb3810fe6f16c237a4b65257f231f1"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/canonical/lxd"
} ],
"database_specific" : {
"cwe_ids" : [ ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2023-12-05T23:32:58Z",
"nvd_published_at" : null
}
}