Skip to content
Misconfiguration Write-up Intermediate

Snap Trap: The Hidden Dangers Within Ubuntu’s Package Suggestion System

The command-not-found package on Ubuntu suggests snap packages based on command names, and attackers can register snap names that match commands or aliases to have their malicious snaps recommended. This could lead users to install malicious packages, potentially leading to supply chain attacks.

Ilay Goldman Follow

Published on aquasec.com

Aqua Nautilus researchers have identified a security issue that arises from the interaction between Ubuntu’s command-not-found package and the snap package repository. While command-not-found serves as a convenient tool for suggesting installations for uninstalled commands, it can be inadvertently manipulated by…

Ilay Goldman (@GoldmanIlay), on aquasec.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the command-not-found tool trusts snap package names without verifying their legitimacy, allowing attackers to register names that match commands or aliases.

Impact

Attackers could deceive users into installing malicious snap packages, potentially leading to supply chain attacks affecting Linux users and Windows running WSL.

What the attacker needed

Ubuntu system with command-not-found; Attacker can publish snaps to Snap Store; User runs an uninstalled command

The fix

Users should verify package sources, and developers should register corresponding snap names to prevent impersonation.

How it was found

  1. Run a command that is not installed, such as 'tarquingui'.
  2. Observe that command-not-found suggests installing the snap 'tarquin'.
  3. Register a snap with the name 'tarquingui' and publish a malicious package.
  4. Run the command again and see that command-not-found now suggests the malicious snap 'tarquingui'.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you type a command that isn't installed, Ubuntu's command-not-found tool suggests packages to install. The researchers found that attackers can publish their own packages with names that match commands or common typos, so the tool might suggest the attacker's package instead of the real one. If you install it, you could get malware.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More from Ubuntu

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.