Skip to content

Unsafe PATH variable in virtual environment

Moderate
szachovy published GHSA-wfq8-2wwm-pm46 Aug 1, 2025

Package

venv-salt-minion

Affected versions

3006.0-43.2.uyuni.x86_64

Patched versions

3006.0-45.1.uyuni.x86_64, 3006.0-46.1.uyuni.x86_64

Description

Summary

#10452 is a security risk because it allows an attacker to replace binaries from PATH with his own version if called from the virtual environment,

Details

I wanted to answer #10452 when i realized that the discussion is heading into the wrong direction and that this bug has a much bigger impact. salt-call is just an example that showcases the problem.

In older versions when i activated the virtual environment the bin folder from the venv-salt-minion was in PATH before any system folder. So for the example of salt-call the version from the venv-salt-minion was used instead of salt-call from a regular salt-minion installation.

Now the virtual environment includes a directory in the first position that looks like garbage but can create a security issue: this directory is not owned or controlled by the venv-salt-minion but can be controlled by someone else.
When someone creates that directory he can override any binary that the virtual env would call using PATH.

PoC

  1. Create executable /home/abuild/rpmbuild/BUILD/salt-3006.0-suse/venv-salt-minion/bin/which
#!/bin/bash
logger "owned"
/usr/bin/which $@
  1. Activate the virtual environment: source /usr/lib/venv-salt-minion/bin/activate
  2. call which ls
  3. look for string "owned" in /var/log/messages

Impact

A user named abuild or anyone who can create the something in /home/abuild can run commands as the user that uses the virtual env activation script.

Severity

Moderate

CVE ID

No known CVE

Weaknesses

No CWEs

Credits