CVE-2026-47722: nebula-mesh Host Advanced Overrides Allow YAML Vulnerability

HIGH
Advisory Identifier: GHSA-7hp6-g3pq-3pc3
CWE-94
Published
Advisory Summary

CVE-2026-47722 is a HIGH host advanced overrides allow yaml vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting nebula-mesh libraries in the Go ecosystem. The issue involves host advanced overrides allow yaml injection into agent config.yml. Remediation is available by upgrading affected packages to version 0.3.2.

CVE-2026-47722 at a Glance

CVE Identifier CVE-2026-47722
GHSA Identifier GHSA-7hp6-g3pq-3pc3
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product nebula-mesh
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2026-47722

To remediate this vulnerability, upgrade all affected nebula-mesh dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/juev/nebula-mesh fixed: 0.3.2
Upgrade github.com/juev/nebula-mesh to 0.3.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/juev/nebula-mesh

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-47722, inspect your project dependencies for nebula-mesh:

inspect dependencies for github.com/juev/nebula-mesh

Analyze the terminal output to locate any version of nebula-mesh in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.3.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In nebula-mesh, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

`internal/configgen/generator.go:86,108,119` interpolates the operator-supplied `ListenHost` and `TunDevice` fields raw into a `text/template` that produces the agent's `config.yml`. `internal/web/advanced.go:20-35` accepts both with only `strings.TrimSpace` — no character or shape validation. ## Exploit An operator (or attacker with any operator key, given the cross-tenant CRUD advisory) sets `adv_tun_device` to: ``` nebula0 lighthouse: am_lighthouse: true hosts: ["10.0.0.1"] # ``` The agent fetches the rendered config on its next signed poll. On config reload, it loads the injected YAML keys: the host self-promotes to lighthouse, attracts mesh traffic, or sets `am_relay: true` to be selected as a relay. The `ListenHost` field has the same shape. ## Affected All released versions prior to v0.3.2. ## Threat model - **Today**: operator can compromise their own host's config (trivially allowed if they own the host, but they can also set lighthouse/relay flags that the operator-create form does NOT expose — privilege uplift within their own tenant). - **Combined with the critical /api/v1 authz advisory**: any operator key can mutate ANOTHER tenant's host overrides and inject YAML there. - **Post-fix of the authz advisory**: still relevant — the agent unconditionally trusts whatever config the server hands it, so any future operator-impersonation bug re-amplifies this. ## Suggested fix Two options, either acceptable: 1. **Input validation** in `parseAdvancedFromForm` (`internal/web/advanced.go`): - `ListenHost`: regex `^[A-Za-z0-9.:\[\]_-]+$` (IPv4/IPv6/hostname) - `TunDevice`: regex `^[A-Za-z0-9_-]{1,15}$` (Linux IFNAMSIZ caps at 15) Reject invalid input with a form-level error; do not write to the host row. 2. **Safer marshalling**: switch `configgen/generator.go` to marshal a typed Go struct via `gopkg.in/yaml.v3` (which escapes correctly) instead of `text/template` string-concat. Larger change, but eliminates this entire injection class. Option 2 is preferable long-term. Option 1 is the quick fix. The `unsafe_routes` advanced field is already `netip.Parse{Prefix,Addr}`-validated at `enroll.go:226-233` — apply the same validation discipline to the other advanced fields.

CVE-2026-47722 Affected nebula-mesh Versions

1 component(s)
Fixed Versions:
0.3.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/juev/nebula-mesh
Go
< 0.3.2
0.3.2

References

Frequently Asked Questions

What is CVE-2026-47722?
CVE-2026-47722 is a security vulnerability in nebula-mesh involving Host advanced overrides allow YAML injection into agent config.yml under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which nebula-mesh versions are affected?
Affected versions include releases prior to 0.3.2 across affected packages: github.com/juev/nebula-mesh.
What version fixes CVE-2026-47722?
Upgrading to 0.3.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/juev/nebula-mesh affected?
Yes, github.com/juev/nebula-mesh is affected in releases prior to 0.3.2. Upgrade your dependency to 0.3.2 or later.
What CWE is associated with CVE-2026-47722?
CVE-2026-47722 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check Go dependencies for CVE-2026-47722?
Run the dependency tree command: 'inspect dependencies for github.com/juev/nebula-mesh'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7hp6-g3pq-3pc3",
  "modified" : "2026-06-08T23:08:15Z",
  "published" : "2026-06-08T23:08:15Z",
  "aliases" : [ "CVE-2026-47722" ],
  "summary" : "nebula-mesh: Host advanced overrides allow YAML injection into agent config.yml",
  "details" : "`internal/configgen/generator.go:86,108,119` interpolates the operator-supplied `ListenHost` and `TunDevice` fields raw into a `text/template` that produces the agent's `config.yml`. `internal/web/advanced.go:20-35` accepts both with only `strings.TrimSpace` — no character or shape validation.\n\n## Exploit\nAn operator (or attacker with any operator key, given the cross-tenant CRUD advisory) sets `adv_tun_device` to:\n\n```\nnebula0\nlighthouse:\n  am_lighthouse: true\n  hosts: [\"10.0.0.1\"]\n#\n```\n\nThe agent fetches the rendered config on its next signed poll. On config reload, it loads the injected YAML keys: the host self-promotes to lighthouse, attracts mesh traffic, or sets `am_relay: true` to be selected as a relay. The `ListenHost` field has the same shape.\n\n## Affected\nAll released versions prior to v0.3.2.\n\n## Threat model\n- **Today**: operator can compromise their own host's config (trivially allowed if they own the host, but they can also set lighthouse/relay flags that the operator-create form does NOT expose — privilege uplift within their own tenant).\n- **Combined with the critical /api/v1 authz advisory**: any operator key can mutate ANOTHER tenant's host overrides and inject YAML there.\n- **Post-fix of the authz advisory**: still relevant — the agent unconditionally trusts whatever config the server hands it, so any future operator-impersonation bug re-amplifies this.\n\n## Suggested fix\nTwo options, either acceptable:\n\n1. **Input validation** in `parseAdvancedFromForm` (`internal/web/advanced.go`):\n   - `ListenHost`: regex `^[A-Za-z0-9.:\\[\\]_-]+$` (IPv4/IPv6/hostname)\n   - `TunDevice`: regex `^[A-Za-z0-9_-]{1,15}$` (Linux IFNAMSIZ caps at 15)\n   Reject invalid input with a form-level error; do not write to the host row.\n\n2. **Safer marshalling**: switch `configgen/generator.go` to marshal a typed Go struct via `gopkg.in/yaml.v3` (which escapes correctly) instead of `text/template` string-concat. Larger change, but eliminates this entire injection class.\n\nOption 2 is preferable long-term. Option 1 is the quick fix.\n\nThe `unsafe_routes` advanced field is already `netip.Parse{Prefix,Addr}`-validated at `enroll.go:226-233` — apply the same validation discipline to the other advanced fields.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/juev/nebula-mesh"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.3.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/juev/nebula-mesh/security/advisories/GHSA-7hp6-g3pq-3pc3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/forgekeep/nebula-mesh/issues/126"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/forgekeep/nebula-mesh/commit/c1506f7344ab375a145a7449b193af3f19bb41ef"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/juev/nebula-mesh"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-08T23:08:15Z",
    "nvd_published_at" : null
  }
}