Skip to content

CVE-2024-5138: snapd snapctl auth bypass

Moderate severity GitHub Reviewed Published Jan 16, 2025 in canonical/snapd • Updated Jan 16, 2025

Package

gomod github.com/snapcore/snapd (Go)

Affected versions

>= 2.51.6, < 2.63.1
< 0.0.0-20240524114846-68ee9c6aa916

Patched versions

2.63.1
0.0.0-20240524114846-68ee9c6aa916

Description

Impact

A 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.

Unprivileged 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.

Other 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.

Patches

Patch: canonical/snapd@68ee9c6
Release: Available from Snapd 2.64

Workarounds

Users 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:

sudo snap disconnect firefox:host-hunspell

References

The original bug report was made on Launchpad: https://bugs.launchpad.net/snapd/+bug/2065077
CVE.org: https://www.cve.org/CVERecord?id=CVE-2024-5138
Canonical: https://ubuntu.com/security/CVE-2024-5138

References

@ernestl ernestl published to canonical/snapd Jan 16, 2025
Published to the GitHub Advisory Database Jan 16, 2025
Reviewed Jan 16, 2025
Last updated Jan 16, 2025

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

EPSS score

0.045%
(18th percentile)

Weaknesses

CVE ID

CVE-2024-5138

GHSA ID

GHSA-p9v8-q5m4-pf46

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.