Skip to content

Insecure sudo recommandation in the documentation

High
bpg-dev published GHSA-gwch-7m8v-7544 Jan 31, 2026

Package

No package listed

Affected versions

< 0.93.0

Patched versions

0.93.1

Description

Note: I'm not sure if it is really a vulnerability, or if it should be an issue instead.

Summary

In the SSH configuration documentation, the sudoer line that you suggested can be escalated to edit any files in the system.

Details

You suggested adding the following lines in the sudoers file:

terraform ALL=(root) NOPASSWD: /usr/bin/tee /var/lib/vz/*

But this is highly insecure as we can escape the folder using ../ and edit any files on the system.

PoC

Using a terraform user with the previously mentioned line in the /etc/sudoers file, I can add a /etc/sudoers.d/sudo file using this command:

echo "ALL=(ALL) NOPASSWD:ALL" | tee /var/lib/vz/../../../etc/sudoers.d/sudo

And then I am full root of the node.

Impact

This breaches the access limits of the Terraform user.

Suggested workaround

Use a strict regex on the command to allow only the names that should be pushed by this user.

Example for cloudinit yaml files:

terraform ALL=(root) NOPASSWD: /usr/bin/tee /var/lib/vz/snippets/[A-Za-z0-9-]*\\.yaml

Severity

High

CVE ID

CVE-2026-25499

Weaknesses

No CWEs

Credits