[PR #5552] [CLOSED] [client] filter CGNAT and CNI addresses from ICE candidates #28119

Open
opened 2026-08-05 08:05:48 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5552
Author: @pappz
Created: 3/9/2026
Status: Closed

Base: mainHead: fix/filter-cgnat-cni-ice-candidates


📝 Commits (3)

  • 09da089 [client] filter CGNAT and CNI addresses from ICE candidates
  • 92d5418 Add method to track and merge default interface blacklist entries
  • 5a4d377 [client] split config I/O functions into config_io.go

📊 Changes

5 files changed (+470 additions, -294 deletions)

View changed files

📝 client/iface/udpmux/universal.go (+14 -0)
📝 client/internal/peer/worker_ice.go (+39 -0)
📝 client/internal/profilemanager/config.go (+35 -294)
client/internal/profilemanager/config_io.go (+301 -0)
📝 client/internal/profilemanager/config_test.go (+81 -0)

📄 Description

In Kubernetes environments using Cilium or similar CNI plugins, pod
CIDR addresses (e.g. 100.65.x.x) from the RFC 6598 CGNAT range
(100.64.0.0/10) were being gathered as valid ICE host candidates.
This caused WireGuard endpoints to resolve to non-routable pod IPs,
producing overlay-routed connections with degraded latency instead of
true P2P paths between hosts.

Add three layers of defense:

  • Expand the default interface blacklist with common Kubernetes CNI interface prefixes (cilium_, lxc, cali, flannel, cni, weave)
  • Filter local and remote ICE candidates whose addresses fall within the CGNAT range but outside the NetBird WireGuard network
  • Reject UDP mux writes to CGNAT addresses as a defense-in-depth fallback

Describe your changes

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Bug Fixes

    • Early filtering of RFC 6598 (CGNAT) addresses to prevent invalid ICE candidates and refused writes.
  • Improvements

    • Expanded default interface blacklist for Kubernetes CNIs and introduced merge behavior that preserves user removals.
    • Consolidated and enhanced configuration management: unified read/update/create paths, migration handling, and import/export support.
  • Tests

    • Added tests for blacklist migration and honoring user-removed entries.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/5552 **Author:** [@pappz](https://github.com/pappz) **Created:** 3/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/filter-cgnat-cni-ice-candidates` --- ### 📝 Commits (3) - [`09da089`](https://github.com/netbirdio/netbird/commit/09da089a90993e781a885878aecd397ff616f54f) [client] filter CGNAT and CNI addresses from ICE candidates - [`92d5418`](https://github.com/netbirdio/netbird/commit/92d5418c02b068bab33aeacb6bd20f585a31c9b6) Add method to track and merge default interface blacklist entries - [`5a4d377`](https://github.com/netbirdio/netbird/commit/5a4d3770660460620dd25649593f9c74fca869c8) [client] split config I/O functions into config_io.go ### 📊 Changes **5 files changed** (+470 additions, -294 deletions) <details> <summary>View changed files</summary> 📝 `client/iface/udpmux/universal.go` (+14 -0) 📝 `client/internal/peer/worker_ice.go` (+39 -0) 📝 `client/internal/profilemanager/config.go` (+35 -294) ➕ `client/internal/profilemanager/config_io.go` (+301 -0) 📝 `client/internal/profilemanager/config_test.go` (+81 -0) </details> ### 📄 Description In Kubernetes environments using Cilium or similar CNI plugins, pod CIDR addresses (e.g. 100.65.x.x) from the RFC 6598 CGNAT range (100.64.0.0/10) were being gathered as valid ICE host candidates. This caused WireGuard endpoints to resolve to non-routable pod IPs, producing overlay-routed connections with degraded latency instead of true P2P paths between hosts. Add three layers of defense: - Expand the default interface blacklist with common Kubernetes CNI interface prefixes (cilium_, lxc, cali, flannel, cni, weave) - Filter local and remote ICE candidates whose addresses fall within the CGNAT range but outside the NetBird WireGuard network - Reject UDP mux writes to CGNAT addresses as a defense-in-depth fallback ## Describe your changes ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Early filtering of RFC 6598 (CGNAT) addresses to prevent invalid ICE candidates and refused writes. * **Improvements** * Expanded default interface blacklist for Kubernetes CNIs and introduced merge behavior that preserves user removals. * Consolidated and enhanced configuration management: unified read/update/create paths, migration handling, and import/export support. * **Tests** * Added tests for blacklist migration and honoring user-removed entries. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 08:05:48 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#28119