Repository navigation
fix: harden validation, the guard, sshuttle invocation, units and releases - #20
Merged
Merged
Conversation
- ipaddress accepts a scope id after "%" and keeps its text, spaces, quotes and braces included, in str(); a crafted scope in subnets, exclude or gateway reached the root nft script, where an include made root read a file and log its lines - refuse "%" in subnets, exclude, gateway, probe and dns-servers - collapse() and the stored networks rebuild each network from its number and prefix, so only address characters reach nft and sshuttle's arguments even if a check is missed - a failed guard logs only nft's error line, not the source lines it quotes after it - the editor's inet_pton already refused scope ids; shared cases now cover each address field Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- the remote only had to match a character class, so "@corp", "@-gD1080" and "user:password@host" passed; sshuttle then ran its server locally as root without ssh, passed the host to ssh as an option, or put the password on its command line and in the journal - split the destination as sshuttle's parse_hostport does, [USER@]HOST[:PORT]: the user part is not empty and has no ":", the host is not empty, does not start with "-" and is an IPv6 address when bracketed or with several colons, and a port is 1 to 65535 - the error for a ":" in the user part leaves out the value, which holds the password - port checks for remote and probe read ASCII digits only and refuse a number too long for int() with a profile error - the GNOME editor applies the same rules; shared cases cover both Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- a claim counted while any process with its PID had nm-sshuttle-service in its command line; any user can name a process so, and one that got the PID of a killed instance kept that instance's leftover claim alive and blocked overlapping activations - the instance records its start time (field 22 of /proc/PID/stat) in the claim, and the claim counts only while that process runs as root with that start time - a claim from an older version, without a start time, needs a process with every user ID 0, not euid 0 alone, which sudo has while it waits for a password Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- an instance took Connect and Disconnect from any sender the bus let through; its per-activation names rely only on the bus's default deny of method calls, so a confined root process, or a principal a local policy lets send, could make the plugin reroute traffic to a server of its choice and run ssh as any user - other senders get org.freedesktop.DBus.Error.AccessDenied and a warning in the journal; when NetworkManager's name watch has not reported yet, the plugin asks the bus who owns the name - the bus policy gets no deny by interface, which would also refuse every message without an interface field to any service; a test keeps it that way Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- only the health check while up re-installed a missing guard; after a ruleset flush in a gap, which can last long while asleep or offline, traffic to the tunnelled networks took the default route until the tunnel was up again - a gap and the reconfiguration after it check the guard every 10 s, paused or not, and before each attempt, and install it again when nft lists no guard table; the plugin gives up when that fails - guard_listed() tells a missing table from nft that cannot be asked, which is left alone Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- without systemd-resolved, or with /etc/resolv.conf not pointing at its stub, glibc asks the listed servers itself and moves on to the LAN's as soon as the guard refuses the VPN's in a gap; every lookup, intranet names included, then went to the local network's resolver, which could also answer them - at Connect with dns split or all, the plugin reads NetworkManager's DnsManager Mode and gives up unless it is systemd-resolved and every nameserver in /etc/resolv.conf is 127.0.0.53 or 127.0.0.54 - nm-sshuttle check reports both; the docs and the Debian description no longer say that DNS degrades without resolved, and a VM scenario checks the refusal Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- the sweep kept an sshuttle table while any user listened on its port, so a user who bound the port of a table left by a killed sshuttle received the redirected tunnel traffic and DNS, past the guard; the health check fell back to every listener when it could not find the tunnel unit's cgroup - a listener counts only when uid 0 holds it on 127.0.0.1 or ::1, or the wildcard address, and only for its own family; the sweep also keeps a user's listener while sshuttle's root firewall helper runs below its process, as for an sshuttle the user runs, and warns with the user ID when it deletes a table under a user's listener - the unit's cgroup is also found on hybrid and legacy cgroup hosts; where none holds systemd's units the plugin gives up at the first health check instead of reconnecting every 10 s, and check warns - nft_health() needs the tunnel's own ports and has no global fallback Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- sshuttle took the first free port from 12300 down, which any user can bind; holding all 3300 of them stopped every tunnel from starting - exec-tunnel passes --listen 127.0.0.1:P with P from 225 to 240, below ip_unprivileged_port_start: the slot's own two ports first, then the others, so that TIME_WAIT after quick restarts does not block a slot; the test bind skips SO_REUSEADDR, as sshuttle does - sshuttle 1.3.1 and 2.0.0 crash when --listen gives both families a port, so ::1 gets port 0; the IPv6 and DNS ports stay sshuttle's choice, and the plugin says when sshuttle found none of them free - exec-tunnel and check warn when the sysctl lets users bind the ports - the sshuttle upstream draft gets the crash and a request for an option for the DNS port Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- sshuttle 2.0.0 runs ssh -G and a lookup as root on its -r value, on whatever network the host is on, and excludes every address it gets, also when gateway is set. A forged DNS answer could take internal addresses out of the tunnel, outside the plugin's checks. - Pass -r 127.0.0.1 instead: an address needs no lookup, and sshuttle already excludes it as its IPv4 listen address. - The bridge gets the real remote as ssh-as-user USER --remote REMOTE. It accepts only the tail sshuttle 1.3.1 and 2.0.0 append for the stand-in ([-F CFG] 127.0.0.1 -- COMMAND), checks the remote again and gives ssh [-p PORT] [USER@]HOST split as sshuttle's parse_hostport splits it, so ssh sees the same destination as before. - profile: _remote() becomes split_remote(), which returns the parts; the rules are unchanged. - VM test M2-02m checks sshuttle's and ssh's remotes; document the lookup and the bridge in the design and upstream notes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- The first hop's addresses come from a lookup on whatever network the host is on, and each one is excluded from the tunnel and accepted by the guard. A forged DNS answer could take any internal address out of the tunnel while the VPN showed connected. - Profile.first_hop_addresses() drops a looked-up address that lies in the subnets or, with DNS, the DNS servers, unless exclude covers it, and keeps at most 8 (MAX_HOPS). gateway, and a HostName that is an address (first-hop --kind says which), are never looked up and are taken as given. - Connect fails when no address is left; after a network change or resume the old addresses stay. Refused addresses are logged, and while there are any, ssh is pinned to a kept address, since its own lookup could pick one the guard rejects; a failed start or reconnect names them. - check applies the same filter, and active_conflict uses it for the other profiles' first hops. - A jump host reached by name inside the tunnelled networks, including any of a 0.0.0.0/0 or ::/0 profile, now needs gateway or exclude. Document this in the design, user guide, README, IPv6 notes and the editor's hint. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- The plugin unit's OOMScoreAdjust=-500 was inherited by the first hop's ssh -G and whatever the user's ssh config runs from it (Match exec), and by the tunnel's ssh. Because systemd writes it as root, it was also the floor those user processes could set again, so the user could keep processes away from the OOM killer at the system's expense - ssh-as-user now writes 0 to /proc/self/oom_score_adj as root, after its arguments are checked and before anything runs as the user; written with CAP_SYS_RESOURCE, 0 also resets the floor - Document this in design §4.7 and the changelog Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- sshuttle's root firewall helper rewrites /etc/hosts when it handles a host list, and a helper killed before it restored the file left its lines there for every user and every network - nm-sshuttle never wants host lists, so the tunnel unit now enforces that: it gets ProtectSystem=full, so /usr, /boot and /etc are read-only for sshuttle and its helper; a normal start and stop never write the file, and a helper that tries fails before changing it - cleanup, which runs outside the tunnel unit, removes the lines a stopped sshuttle left: only lines in the exact form the helper writes, and only for ports without a live sshuttle listener as the sweep counts them. It opens the file with O_NOFOLLOW, leaves symlinks and non-regular files alone, keeps owner, mode and SELinux label, and renames only if the file did not change meanwhile - A VM check looks for /etc read-only in the tunnel unit's mount namespace; update design §4.8 and the changelog Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- None of the sandboxing that the design planned was in the units, so the root sshuttle client, which parses the stream from the ssh peer, and everything the plugin and dispatcher run had the whole system - All three units get ProtectKernelTunables, ProtectControlGroups, LockPersonality, RestrictRealtime and RestrictSUIDSGID - The tunnel unit gets a capability bounding set with only what nft, iptables, tproxy, the redirect port, setpriv, the sweep and iptables-legacy's modprobe use; it drops CAP_SYS_ADMIN and with it the mounts that would undo ProtectSystem. It does not contain a root compromise, as CAP_SYS_PTRACE and CAP_SYS_MODULE remain - The plugin unit and the dispatcher get ProtectSystem=true and keep /etc writable for cleanup; the dispatcher, which runs nothing as the user, also gets ProtectHome=read-only, PrivateTmp, RestrictAddressFamilies and RestrictNamespaces - No NoNewPrivileges, ProtectHome, PrivateTmp or PrivateDevices where the user's ssh runs: it must read ~/.ssh, write known_hosts, reach the agent and X11, open a FIDO key and run setuid helpers - Describe what ships and why in design §4.7, §4.8 and §4.10, the user guide and the changelog Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- The signing key is limited to workflow runs on main, but such a run built whatever commit a vX.Y.Z tag named. Anyone who could push a tag, or start the packages workflow with a tag input, could get source that never went through main's branch rules signed with the project's key and published to every user of the repository - plan.sh now refuses a tag whose commit is not an ancestor of origin/main, and fails clearly on a shallow checkout or a missing origin/main. It checks every tag it picks, including the newest tag and the tag of a dry run, so a rogue tag fails every run loudly - plan.sh outputs the tag's commit, and make-srpm.sh refuses a tag that names another commit by the time the srpm job runs, so a tag moved between the two jobs is not built - signing-key.sh restricts the github-pages environment to main as well, keeps an existing environment's reviewers and wait timer when it restricts it, and gains --restrict to re-apply the restriction to a repository that is already set up - packaging/README.md asks for a tag ruleset that lets only administrators create, move or delete v* tags, and explains why tags are part of the trust boundary; update design §7, the release workflow's comment and the changelog Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- The install steps imported the signing key straight from the site and installed the repository package from the same site, and the only fingerprint to compare with was on that site too. Whoever controlled the site, or the connection to it, could serve their own key and repository and be trusted from then on; dnf also does not check the signature of a package named on the command line - README.md, the user guide and the site's page now download the key file, show it with gpg --show-keys, and import it only if it holds the fingerprints listed in the README on GitHub and no other key. They install the repository package with localpkg_gpgcheck=1, so dnf checks it against that key; the smoke test installs it the same way - The README and the site show fingerprints unspaced, as gpg prints them; publish.sh writes the site's fingerprint that way, and the site says that its own fingerprint proves nothing on its own - signing-key.sh and packaging/README.md say to keep the README's list of fingerprints in step with the key file, and a test checks that it matches the committed key; update the changelog Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- The publish job, which holds the signing key, ran in whatever image the fedora:44 tag named at the time. A changed image under that tag would run next to the key and could sign anything - publish now runs in quay.io/fedora/fedora:44 pinned by digest, and so do srpm and release-rpm, whose output it signs as built, and dry-run, so that a pull request with a new digest tries it without the key - The rpm and smoke-test matrix jobs keep following the current Fedora releases - packaging/README.md explains which jobs are pinned and why, that Dependabot does not update a job's container image, and how and how often to refresh the digest; update the changelog Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Requested by Dennis · project thread
Fixes every issue a security review of v0.1.0 confirmed: 4 medium, 6 low and 6 hardening items. There is one commit per fix.
CHANGELOG.md(Unreleased, Security) has the user-facing summary.Profile validation
fix(profile): refuse IPv6 scope IDs in every address and network. A crafted scope reached root'snft -f -script, where anincludemade root read files in /etc and log them. Guard elements are now built from the network's number, and a failed guard logs only nft's first line.fix(profile): checkremotethe way sshuttle splits it, in both Python and the GNOME editor. This refuses an empty host,@-optionanduser:password@host.Guard, sweep and runtime state
fix(tunnel): the sweep and the health check count only root's listeners on loopback. Before, another user's listener could keep a dead redirect table and receive the tunnelled traffic.fix(tunnel): sshuttle listens on a per-slot port in 225–240, so other users cannot squat it. The IPv6 and DNS ports are still sshuttle's choice (upstream limitation, documented).fix(service): VPN.Plugin calls are accepted only from NetworkManager's unique name. Claims are tied to the process start time. dns split/all is refused unless resolved handles lookups.fix(guard): a guard removed during a reconnect gap is put back.First hop
fix(tunnel): sshuttle gets-r 127.0.0.1, and the ssh bridge supplies the real remote. sshuttle 2.0.0 therefore no longer resolves the remote as root on the LAN.fix(service): first-hop addresses inside the profile's networks or DNS servers are ignored unlessexcludecovers them, and at most 8 are used. Behaviour change: a jump host reached by name inside the tunnelled networks, including any0.0.0.0/0profile, now needsgatewayorexclude.Units
fix(tunnel): oom_score_adj is reset before anything runs as the user.fix(tunnel): the tunnel unit has/etcread-only, so sshuttle's firewall helper cannot write/etc/hosts, andcleanupstrips any lines it left.fix(data): conservative systemd sandboxing for all three units (design §4.7 explains each choice).Release pipeline
fix(packaging): only tags onmainare packaged and signed. The install steps compare the key fingerprint beforerpm --import.fix(ci): the signing job's image is pinned by digest.Testing
python3 -m pytest: 500 passed, 2 skipped. GNOME editor suite: 4/4.Manual steps after merge
v*to admins (steps inpackaging/README.md).scripts/signing-key.sh --restrictto limitgithub-pagesandrpm-signingtomain.Generated by Claude Code