28 Commits

Author SHA1 Message Date
Robert Swiecki
229682c59e Merge pull request #292 from M0nd0R/fix-mount-staging-escape
Reject path traversal in mount destinations during jail staging
2026-08-26 21:20:27 +02:00
Robert Swiecki
5d53b5c28b Merge pull request #282 from carrerasdarren-cell/nstun-cloud-local-destinations
nstun: block cloud-local service destinations
2026-08-26 20:08:34 +02:00
Robert Swiecki
79d12b54f2 Merge pull request #289 from carrerasdarren-cell/fix/nstun-policy-validation
nstun: reject invalid policy rule fields
2026-08-26 11:48:27 +02:00
robertswiecki
2ed350a0f2 Merge pull request #302 from mustafagozhamam/fix/nstun-parent-lifecycle
Fix NSTUN parent lifecycle cleanup
2026-08-26 09:23:13 +02:00
skaiea13-ai
b4cff719c2 Limit nstun TCP receive buffers with a shared payload budget
Cap retained guest-to-host TCP payload across flows so a stalled sink cannot grow the supervisor toward the per-flow limit times the maximum flow count.
2026-08-22 04:30:29 +09:00
Mustafa
9f166b999f Fix NSTUN parent lifecycle cleanup 2026-08-18 21:31:15 +03:00
mundur
6cd216d0aa Harden new mount API against symlink escapes during staging
PR #292 rejected '.'/'..' and added O_NOFOLLOW on the legacy
createDirRecursively walk, but mnt_newapi createDirAt still used
multi-component mkdirat(), which follows intermediate symlinks.

After a -s symlink mount pointing outside the staging root, later
mounts with destinations under that symlink (e.g. link/pwned) could
create directories or attach mounts on the host before pivot_root.

Walk destinations one component at a time with O_NOFOLLOW, resolve
parent fd + basename for leaf symlinkat/move_mount/open_tree/openat,
and use AT_SYMLINK_NOFOLLOW in existsAs*At helpers.
2026-07-28 01:36:17 +00:00
mundur
9b54e97fd4 Reject path traversal in mount destinations during jail staging
Mount destinations were joined as newroot+"/"+dst and walked with
mkdirat/openat without rejecting "."/".." components or following
symlinks safely. An attacker who can influence mount dst (CLI, config,
or prefix_dst_env) could create directories, symlinks, or mounts outside
the intended staging root on the host before pivot_root.

Add isSafeContainmentPath(), validate destinations in both legacy and
new mount APIs, use O_NOFOLLOW while walking parents, and include a
standalone regression test.
2026-07-27 10:53:58 +00:00
Darren Carreras
0d905f1da2 nstun: reject invalid policy rule fields 2026-07-21 19:59:04 -04:00
Darren Carreras
bd9439b3f2 nstun: block cloud-local service destinations 2026-07-16 18:42:09 -04:00
Robert Swiecki
6356dee0c6 Makefile/all: make libnl3 optional 2026-04-14 14:26:28 +02:00
Robert Swiecki
3c92a17d2b nstun: set IPV6_V6ONLY on IPv6 so it doesn't collide with IPv4 2026-04-03 02:01:11 +02:00
Robert Swiecki
1695944e40 tests - config for TCP/UDP redirection 2026-04-01 21:55:53 +02:00
Robert Swiecki
0381754dfc nstun: add support for ENCAP_CONNECT - http connect encapsulation 2026-03-31 23:54:57 +02:00
Robert Swiecki
e49f75c528 Makefile: improved test (wget) for socks5 2026-03-31 07:51:59 +02:00
Robert Swiecki
5151646146 nstun: IPv6 implementation 2026-03-31 07:49:52 +02:00
Robert Swiecki
0f8b4a389e nstun: IPv6 implementation 2026-03-31 06:55:27 +02:00
Robert Swiecki
2ee9590ba6 nstun: use redirect_port correctly for REDIRECT's 2026-03-30 09:39:04 +02:00
Robert Swiecki
a2bd0b0ad1 nstun: Implement HOST_TO_GUEST forwarding 2026-03-30 07:12:52 +02:00
Robert Swiecki
1d5282c23c net: remove encap for traffic rules (ip-route), it can be done via a backend 2026-03-29 14:37:19 +02:00
Robert Swiecki
95617dd234 config+net: Refactored config.proto to make nstun the default user_net backend. 2026-03-29 13:59:40 +02:00
Robert Swiecki
6276ae6be2 Add nstun, an experimental user-mode networking stack.
It provides lightweight IP-level connectivity for jailed processes via a TUN device and an epoll-based NAT proxy thread, as an alternative to pasta.

Supports TCP, UDP, and ICMP proxying with per-flow tracking, configurable firewall/redirect rules, SOCKS5 encapsulation for TCP and UDP.
2026-03-29 00:30:24 +01:00
Robert Swiecki
91e692a155 net: support for network rules 2026-03-27 21:24:23 +01:00
Robert Swiecki
5c21086f89 oom_score_adj + simpler pasta port forwarding config 2026-03-22 21:21:18 +01:00
Robert Swiecki
b3a82bfda7 test: port-mappings - make ports sam for UDP/TCP to make sure it is possible 2026-03-22 21:01:41 +01:00
Robert Swiecki
55a48e7c63 tests/: increase default time limit to 100s 2026-03-22 17:30:53 +01:00
Robert Swiecki
d76d89c3f9 Makefile: more networking tests 2026-03-22 14:23:44 +01:00
Robert Swiecki
af79a9a1e7 Makefile+tests/: new seccomp tests 2026-03-22 10:30:13 +01:00