/

CVE-2026-72603

Severity:

CRITICAL RISK

(9.9)

OS Command Injection (CWE-78) in wg-easy Client Creation

CVE-2026-72603

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Root-Level Remote Code Execution

Severity:

CRITICAL RISK

(9.9)

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 critical OS command injection vulnerability in wg-easy allows an authorized user to inject additional WireGuard PostUp directives through a client name.

When the crafted name is written to the WireGuard configuration, wg-quick may execute the injected commands with root privileges on the host.

Affected context

The vulnerability occurs in wg-easy deployments where users with the clients.create permission can create WireGuard clients and supply a client name that is incorporated into generated configuration files. Risk exists when newline characters and directive content are preserved rather than treated strictly as data before the configuration is processed by wg-quick.

Exploit preconditions

  • Attack surface: The client-creation functionality and generated WireGuard configuration
  • Required access: An authenticated account with the clients.create permission
  • Trigger point: Creation or activation of a client whose name is written into a WireGuard configuration
  • Why exploitation is possible: Newline characters are not neutralized, allowing client-controlled text to become additional PostUp directives executed by wg-quick

Why this happens

The underlying bug is improper neutralization of user-controlled input used in an operating-system command configuration context. A client name is treated as ordinary text but is inserted into a line-oriented WireGuard configuration without enforcing field boundaries or rejecting control characters.

This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because attacker-controlled data can alter command-bearing directives that are later interpreted with root privileges.

Potential impact

  • An attacker may execute arbitrary operating-system commands as root
  • The host running wg-easy could be fully compromised
  • Attackers could access, modify, or delete local data
  • Network credentials and WireGuard private material could be exposed
  • The compromised host could be used for lateral movement or service disruption

General mitigation guidance

Mitigation generally focuses on ensuring that user-controlled client metadata cannot become configuration syntax or executable command content.

Common defensive patterns include:

  • Enforcing strict allowlists for client-name characters and rejecting control characters
  • Encoding or safely serializing values according to the WireGuard configuration grammar
  • Keeping command-bearing directives separate from user-provided metadata
  • Avoiding shell-interpreted command construction where structured APIs or fixed trusted commands are available
  • Applying least privilege to the service and limiting the privileges of processes that activate network configurations
  • Restricting which roles can create clients and reviewing permission assignments regularly
  • Treating generated configuration files as security-sensitive artifacts with controlled ownership and write access

How teams detect issues like this

Detection approaches can include:

  • Static analysis for string interpolation or concatenation of user input into shell commands and line-oriented configuration files
  • Code review checks for missing validation of newline, carriage-return, shell metacharacter, and directive-specific input
  • Tests that submit boundary and control-character values to all client-name creation paths
  • Monitoring generated WireGuard configurations for unexpected additional directives or command-bearing fields
  • Auditing client-creation events and correlating them with unusual privilege-level process execution
  • Policy enforcement requiring allowlisted identifiers and security review for code that generates privileged configuration

Sources

SourceLink
github.comgithub.com/wg-easy/wg-easy

Frequently asked

questions

It may be exploitable through the wg-easy management interface when that interface is reachable and the attacker has the required authenticated permission. It is not necessarily an unauthenticated attack.

The attacker needs an account or execution context with the clients.create permission, along with access to the client-creation functionality.

Treat client names as constrained data: reject control characters, enforce a strict identifier allowlist, and ensure values cannot introduce new configuration lines or command-bearing directives.

Use structured configuration generation, separate untrusted metadata from executable settings, apply least privilege, and include adversarial input tests and static analysis in the development process.

Find out what's already
exploitable in your codebase.