/

CVE-2026-105429

Severity:

HIGH RISK

(8.0)

OS Command Injection (CWE-78) in NetBird SSH Manager

CVE-2026-105429

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78, CWE-116

Impact:

Local Arbitrary Command Execution

Severity:

HIGH RISK

(8.0)

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

NetBird's SSH configuration manager can place an unsanitized peer hostname into a system-wide OpenSSH configuration file. A malicious or compromised peer may exploit this behavior to inject SSH directives, potentially causing commands to execute locally when users run SSH.

NetBird's SSH configuration manager can place an unsanitized peer hostname into a system-wide OpenSSH configuration file. A malicious or compromised peer may exploit this behavior to inject SSH directives, potentially causing commands to execute locally when users run SSH.

Affected context

The issue occurs in NetBird desktop clients that generate an OpenSSH drop-in configuration from peer FQDNs or hostnames. It affects Linux, macOS, Windows, and FreeBSD deployments where peer-controlled or otherwise untrusted names are written into the SSH configuration without adequate escaping; mobile applications are outside the described affected context.

The issue occurs in NetBird desktop clients that generate an OpenSSH drop-in configuration from peer FQDNs or hostnames. It affects Linux, macOS, Windows, and FreeBSD deployments where peer-controlled or otherwise untrusted names are written into the SSH configuration without adequate escaping; mobile applications are outside the described affected context.

Exploit preconditions

  • Attack surface: NetBird peer-name handling and generated OpenSSH configuration
  • Required access: A malicious or compromised peer must be able to present a hostname or FQDN that reaches the configuration-generation path
  • Trigger point: A local user runs an SSH command after the generated configuration has been loaded
  • Why exploitation is possible: A peer name containing special characters can terminate the intended quoted host value and introduce additional SSH configuration directives, including command-execution directives
  • Attack surface: NetBird peer-name handling and generated OpenSSH configuration
  • Required access: A malicious or compromised peer must be able to present a hostname or FQDN that reaches the configuration-generation path
  • Trigger point: A local user runs an SSH command after the generated configuration has been loaded
  • Why exploitation is possible: A peer name containing special characters can terminate the intended quoted host value and introduce additional SSH configuration directives, including command-execution directives

Why this happens

The vulnerable code interpolates peer-controlled hostnames into a double-quoted OpenSSH Match host directive without applying context-appropriate escaping or strict validation. This is an instance of CWE-78: Improper Neutralization of Special Elements used in an OS Command, with CWE-116: Improper Encoding or Escaping of Output describing the unsafe generation of configuration text. The underlying insecure pattern is treating an externally influenced identifier as safe configuration syntax.

The vulnerable code interpolates peer-controlled hostnames into a double-quoted OpenSSH Match host directive without applying context-appropriate escaping or strict validation. This is an instance of CWE-78: Improper Neutralization of Special Elements used in an OS Command, with CWE-116: Improper Encoding or Escaping of Output describing the unsafe generation of configuration text. The underlying insecure pattern is treating an externally influenced identifier as safe configuration syntax.

Potential impact

  • A local user's SSH invocation may execute attacker-controlled commands
  • The affected host may experience unauthorized code execution with the privileges of the invoking user
  • Credentials, configuration, or other user-accessible data could be exposed
  • An attacker could alter files or establish persistence within the user's privilege boundary
  • Multiple client hosts could be affected if the malicious peer is trusted by several deployments
  • A local user's SSH invocation may execute attacker-controlled commands
  • The affected host may experience unauthorized code execution with the privileges of the invoking user
  • Credentials, configuration, or other user-accessible data could be exposed
  • An attacker could alter files or establish persistence within the user's privilege boundary
  • Multiple client hosts could be affected if the malicious peer is trusted by several deployments

General mitigation guidance

Mitigation generally focuses on reducing trust in peer names and preventing untrusted values from becoming SSH configuration syntax.

Common defensive patterns include:

  • Accepting peer FQDNs or hostnames only when they conform to a strict DNS-name grammar
  • Applying escaping appropriate to the exact OpenSSH configuration context
  • Preferentially using structured configuration APIs or fixed templates rather than string concatenation
  • Rejecting invalid values before writing configuration files
  • Restricting write access to system-wide SSH configuration paths
  • Running desktop services with least privilege and protecting generated files from unauthorized modification
  • Reviewing existing generated configuration for unexpected directives and regenerating it from validated data

Mitigation generally focuses on reducing trust in peer names and preventing untrusted values from becoming SSH configuration syntax.

Common defensive patterns include:

  • Accepting peer FQDNs or hostnames only when they conform to a strict DNS-name grammar
  • Applying escaping appropriate to the exact OpenSSH configuration context
  • Preferentially using structured configuration APIs or fixed templates rather than string concatenation
  • Rejecting invalid values before writing configuration files
  • Restricting write access to system-wide SSH configuration paths
  • Running desktop services with least privilege and protecting generated files from unauthorized modification
  • Reviewing existing generated configuration for unexpected directives and regenerating it from validated data

How teams detect issues like this

Detection can combine source review, runtime monitoring, and policy enforcement:

  • Use static analysis to identify concatenation or interpolation of peer-controlled values into SSH configuration text
  • Review code for missing validation or escaping before values enter quoted directives
  • Monitor changes to system-wide SSH configuration directories and alert on unexpected Match, ProxyCommand, or LocalCommand directives
  • Apply repository policies that require allowlisted hostname validation and security review for generated configuration
  • Test configuration generation with boundary characters and verify that output remains syntactically constrained
  • Automated code-review and software-composition tools may help identify related injection patterns

Detection can combine source review, runtime monitoring, and policy enforcement:

  • Use static analysis to identify concatenation or interpolation of peer-controlled values into SSH configuration text
  • Review code for missing validation or escaping before values enter quoted directives
  • Monitor changes to system-wide SSH configuration directories and alert on unexpected Match, ProxyCommand, or LocalCommand directives
  • Apply repository policies that require allowlisted hostname validation and security review for generated configuration
  • Test configuration generation with boundary characters and verify that output remains syntactically constrained
  • Automated code-review and software-composition tools may help identify related injection patterns

Sources

SourceLink
github.comgithub.com/netbirdio/netbird/pull/6805
github.comgithub.com/netbirdio/netbird/releases/tag/v0.74.7
github.comgithub.com/netbirdio/netbird/security/advisories/GHSA-xmg2-v32j-x2hf

Frequently asked

questions

It can be triggered through NetBird peer information, but command execution occurs on a client host when a local user subsequently runs SSH. Exploitability therefore depends on peer trust, client configuration, and the ability to influence the relevant hostname.

The attacker generally does not need interactive shell access if they can cause a malicious peer name to be processed. A local user must run SSH for the injected directive to be evaluated.

Validate peer names against a strict DNS hostname allowlist before generating configuration, and apply correct context-specific escaping rather than inserting raw values into SSH directives.

Treat peer metadata as untrusted input, avoid configuration string concatenation, protect generated files, and add tests and policy checks for special-character injection in every supported platform.

It can be triggered through NetBird peer information, but command execution occurs on a client host when a local user subsequently runs SSH. Exploitability therefore depends on peer trust, client configuration, and the ability to influence the relevant hostname.

The attacker generally does not need interactive shell access if they can cause a malicious peer name to be processed. A local user must run SSH for the injected directive to be evaluated.

Validate peer names against a strict DNS hostname allowlist before generating configuration, and apply correct context-specific escaping rather than inserting raw values into SSH directives.

Treat peer metadata as untrusted input, avoid configuration string concatenation, protect generated files, and add tests and policy checks for special-character injection in every supported platform.

Find out what's already
exploitable in your codebase.