Skip to content

Harden Linux manager executable lookup to prevent PATH hijacking#4621

Open
mmorrissette-devolutions wants to merge 1 commit intomainfrom
codex/fix-path-hijacking-vulnerability-in-linux-managers
Open

Harden Linux manager executable lookup to prevent PATH hijacking#4621
mmorrissette-devolutions wants to merge 1 commit intomainfrom
codex/fix-path-hijacking-vulnerability-in-linux-managers

Conversation

@mmorrissette-devolutions
Copy link
Copy Markdown

Motivation

  • Close a local privilege-escalation vector where apt, dnf, and pacman binaries were discovered from the user PATH and later invoked under an elevator (sudo/pkexec), which allowed a PATH-hijacked binary to be run as root after user approval.
  • Restrict manager executable discovery to known system locations to retain required elevation behavior while removing attacker-controlled PATH influence.

Description

  • Changed FindCandidateExecutableFiles() in src/UniGetUI.PackageEngine.Managers.Apt/Apt.cs to only consider /usr/bin/apt and /bin/apt instead of using CoreTools.WhichMultiple("apt").
  • Changed FindCandidateExecutableFiles() in src/UniGetUI.PackageEngine.Managers.Dnf/Dnf.cs to only consider /usr/bin/dnf5, /usr/bin/dnf, /bin/dnf5, and /bin/dnf and removed WhichMultiple usage for dnf candidates.
  • Changed FindCandidateExecutableFiles() in src/UniGetUI.PackageEngine.Managers.Pacman/Pacman.cs to only consider /usr/bin/pacman and /bin/pacman instead of using CoreTools.WhichMultiple("pacman").
  • Preserved the rest of the managers' behavior and the existing elevation flow, so the first available trusted path is still selected for operations that require admin rights.

Testing

  • No automated unit or integration tests were executed because the environment lacks the .NET toolchain; dotnet --version returned command not found so dotnet test could not be run.
  • Performed local code inspection and diff verification to ensure only the candidate discovery lists were modified and no operation/elevation code paths were changed.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant