Skip to content

Harden jail mounts, capabilities, and nstun networking defaults - #296

Open
M0nd0R wants to merge 1 commit into
google:masterfrom
M0nd0R:harden-sandbox-nstun-defaults
Open

Harden jail mounts, capabilities, and nstun networking defaults#296
M0nd0R wants to merge 1 commit into
google:masterfrom
M0nd0R:harden-sandbox-nstun-defaults

Conversation

@M0nd0R

@M0nd0R M0nd0R commented Jul 28, 2026

Copy link
Copy Markdown

Summary

  • Confine mount destinations under the jail root (reject .. / path escape before pivot_root) and fail closed when mount isolation flags cannot be applied.
  • Require capability bounding-set drops (CAP_SETPCAP) and treat PR_SET_NO_NEW_PRIVS failure as fatal unless explicitly disabled.
  • Expand nstun SSRF destination denylists, validate UDP lengths / SOCKS5 recv sizing, and change unmatched nstun policy to default-deny (example configs that intend open networking now set explicit ALLOW rules).

Test plan

  • Build on Linux (make / Docker image)
  • Confirm a crafted mount dst containing .. is rejected and does not create host paths outside the staging root
  • Confirm empty user_net with backend: NSTUN drops unmatched egress; configs with explicit ALLOW still pass traffic
  • Confirm guest packets to 169.254.169.254 / multicast are dropped by the SSRF gate
  • Smoke-test an example config that uses user_net (e.g. tests/nstun.cfg)

Block mount-destination path escape before pivot_root, fail closed on
isolation flag/capability drops, expand nstun SSRF denylists, and make
unmatched traffic rules default-deny so empty user_net is not wide open.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant