Repository navigation
nstun: reject unspecified IPv4 guest sources - #368
Merged
robertswiecki merged 1 commit intoNov 20, 2026
Merged
robertswiecki merged 1 commit into
robertswiecki merged 1 commit into
Conversation
The TUN interface has one configured guest IPv4 address. Reject source 0.0.0.0 like any other source mismatch so raw packets cannot skip source-qualified GUEST_TO_HOST rules and fall through to the default allow action. Add dispatch controls for the configured guest, a different non-zero source, and the unspecified source.
Contributor
Author
|
A quick follow-up on this nstun source-validation fix: the Docker workflow is still awaiting approval. Could a maintainer approve it and take a look when convenient? Happy to address any feedback. Thanks. |
Collaborator
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reject IPv4 source
0.0.0.0on the nstun guest TUN path.Problem
The current source check accepts either the configured guest address or
0.0.0.0. A jailed process retainingCAP_NET_RAWcan emit a source-zeropacket. Because nstun evaluates that actual source against
GUEST_TO_HOSTrules, the packet can skip a source-qualified rule for the configured guest
and fall through to the default
ALLOWaction.Fix
Require the source to equal
ctx->guest_ip4, matching the point-to-pointinterface configuration and the existing non-zero spoof handling.
Tests
Scope
This affects the opt-in nstun backend on current
masterwhen a workloadretains
CAP_NET_RAWand policy uses a source selector. nstun is not presentin tag
3.6.