CVE-2024-5138: CVE-2024-5138 Snapd Snapctl Auth Bypass Vulnerability
MODERATECVE-2024-5138 is a MODERATE (CVSS 4.0) snapd snapctl auth bypass vulnerability (CWE-285: Improper Authorization) affecting CVE-2024-5138 libraries in the Go ecosystem. The issue involves snapd snapctl auth bypass. Remediation is available by upgrading affected packages to version 2.63.1, 0.0.0-20240524114846-68ee9c6aa916.
CVE-2024-5138 at a Glance
Security Impact
CVSS: 4.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2024-5138
To remediate this vulnerability, upgrade all affected CVE-2024-5138 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/snapcore/snapd to 2.63.1
Upgrade github.com/snapcore/snapd to 0.0.0-20240524114846-68ee9c6aa916
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/snapcore/snapd
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-5138, inspect your project dependencies for CVE-2024-5138:
inspect dependencies for github.com/snapcore/snapd
Analyze the terminal output to locate any version of CVE-2024-5138 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.63.1), 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-285: Improper Authorization, where the product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action. In CVE-2024-5138, 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-2024-5138 Affected CVE-2024-5138 Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/snapcore/snapd
|
Go |
≥ 2.51.6
< 2.63.1
|
2.63.1
|
|
github.com/snapcore/snapd
|
Go |
< 0.0.0-20240524114846-68ee9c6aa916
|
0.0.0-20240524114846-68ee9c6aa916
|
References
Frequently Asked Questions
What is CVE-2024-5138?
Which CVE-2024-5138 versions are affected?
What version fixes CVE-2024-5138?
Is github.com/snapcore/snapd affected?
What is the CVSS score of CVE-2024-5138?
What CWE is associated with CVE-2024-5138?
How can I check Go dependencies for CVE-2024-5138?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-p9v8-q5m4-pf46",
"modified" : "2025-01-16T17:19:07Z",
"published" : "2025-01-16T17:19:07Z",
"aliases" : [ "CVE-2024-5138" ],
"summary" : "CVE-2024-5138: snapd snapctl auth bypass",
"details" : "### Impact\n\nA snap with prior permissions to create a mount entry on the host, such as firefox, normally uses the permission from one of the per-snap hook programs. A unprivileged users cannot normally trigger that behaviour by using `snap run --shell firefox` followed by `snapctl mount`, since snapd validates the requesting user identity (root or non-root). The issue allows unprivileged users to bypass that check by crafting a malicious command line vector which confuses snapd into thinking the help message is requested.\n\nUnprivileged user on a default installation of Ubuntu, where firefox is as provided as a snap, may cause a denial-of-service attack by repeatedly mounting hunspell database over and over and eventually exhausting system memory.\n\nOther attacks, reliant on the same underying mechanism (mount), are possible. In all cases the snap must be installed and grated permission to perform this action (by connecting an appropriate snap interface), which requires administrative privileges. As such we are focusing on the case of default installation where an unprivileged user may exploit this behavior.\n\n### Patches\n\nPatch: https://github.com/canonical/snapd/commit/68ee9c6aa916ab87dbfd9a26030690f2cabf1e14\nRelease: Available from Snapd 2.64\n\n### Workarounds\n\nUsers may disconnect any instances of the mount-control interface to prevent snapd from creating such mount points. For example, the firefox snap has the `host-hunspell` plug, which is of type `mount-control`. The interface can be disconnected with:\n\n```sh\nsudo snap disconnect firefox:host-hunspell\n```\n\n### References\n\nThe original bug report was made on Launchpad: https://bugs.launchpad.net/snapd/+bug/2065077\nCVE.org: https://www.cve.org/CVERecord?id=CVE-2024-5138\nCanonical: https://ubuntu.com/security/CVE-2024-5138",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/snapcore/snapd"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.51.6"
}, {
"fixed" : "2.63.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/snapcore/snapd"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.0.0-20240524114846-68ee9c6aa916"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/canonical/snapd/security/advisories/GHSA-p9v8-q5m4-pf46"
}, {
"type" : "WEB",
"url" : "https://github.com/canonical/snapd/commit/68ee9c6aa916ab87dbfd9a26030690f2cabf1e14"
}, {
"type" : "WEB",
"url" : "https://bugs.launchpad.net/snapd/+bug/2065077"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/canonical/snapd"
}, {
"type" : "WEB",
"url" : "https://ubuntu.com/security/CVE-2024-5138"
}, {
"type" : "WEB",
"url" : "https://www.cve.org/CVERecord?id=CVE-2024-5138"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-285" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-01-16T17:19:07Z",
"nvd_published_at" : null
}
}