/

CVE-2026-85013

Severity:

HIGH RISK

(7.3)

OS Command Injection (CWE-78) in environment-modules

CVE-2026-85013

Awaiting Analysis

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A shell command injection flaw in environment-modules allows a maliciously named modulefile to inject shell metacharacters into Bash completion for module or ml commands. If the file is placed in a directory visible through the victim's MODULEPATH, commands may execute in the victim's shell with that user's privileges.

Affected context

The vulnerability occurs in deployments where environment-modules exposes module names to Bash completion and a local attacker can place or influence modulefiles in a directory included in another user's MODULEPATH. The risk arises when completion logic treats module names as shell syntax rather than as untrusted data.

Exploit preconditions

  • Attack surface: Bash completion for module or ml commands
  • Required access: Local access sufficient to create or influence a modulefile in a MODULEPATH-visible location
  • Trigger point: The victim requests shell completion for a module-related command
  • Why exploitation is possible: Malicious module names containing shell metacharacters are evaluated in the completing user's shell

Why this happens

The underlying bug is improper neutralization of special elements used in a shell command, mapping to CWE-78: OS Command Injection. Completion code constructs or evaluates shell expressions using module names without keeping those names within a data-only context. As a result, attacker-controlled metadata can be interpreted as executable shell syntax.

Potential impact

  • Arbitrary commands may execute in the victim's shell
  • Confidentiality of user-accessible data could be affected
  • User files or development environments could be modified or deleted
  • Credentials or environment variables may be exposed
  • Availability of the user's session or systems could be disrupted

General mitigation guidance

Mitigation generally focuses on ensuring that module names remain data throughout completion processing. Secure-by-default patterns include using shell completion APIs that avoid evaluation, passing values as safely quoted arguments, and applying strict validation or allowlisting to names before they reach shell operations. Reducing trust in shared MODULEPATH locations, limiting who can create modulefiles, and applying least privilege to user sessions can further reduce exposure.

How teams detect issues like this

Detection approaches include static analysis for shell evaluation constructs, unquoted variable expansion, command substitution, and dynamic construction of completion commands. Code review should examine whether module names and filesystem-derived values are treated as executable syntax. Policy checks can require safe completion interfaces, quoting rules, and restricted ownership of MODULEPATH directories. Automated shell-security review tools may help identify related patterns.

Sources

SourceLink
access.redhat.comaccess.redhat.com/errata/RHSA-2026:64766
access.redhat.comaccess.redhat.com/errata/RHSA-2026:80664
access.redhat.comaccess.redhat.com/errata/RHSA-2026:82919
access.redhat.comaccess.redhat.com/errata/RHSA-2026:84594
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-85013
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2465635
github.comgithub.com/envmodules/modules/security/advisories/GHSA-8hrw-p88g-qhmg

Frequently asked

questions

It is primarily a local attack scenario. An attacker generally needs the

ability to place or influence a modulefile in a location visible through the

victim's MODULEPATH.

The key requirement is write or equivalent control over a MODULEPATH-visible

directory. The attacker does not necessarily need direct access to the

victim's shell before the completion action occurs.

Completion logic should treat module names strictly as data, avoid shell

evaluation, and use safe quoting or structured completion interfaces.

Apply shell input-handling policies, review completion scripts for dynamic

evaluation, restrict shared module directories, and use least-privilege

ownership and access controls.

Find out what's already
exploitable in your codebase.