Don't let AI subnet probes scan public neighboring hosts - #21
Draft
cursor[bot] wants to merge 1 commit into
Draft
Conversation
probe_targets replaced the RFC1918 allowlist with allowed_net. Callers pass _subnet_of(target_ip), so a public scan target became a public /24 and AI-selected neighbors were connected to without authorization. Co-authored-by: dmitryflynn <dmitryflynn@users.noreply.github.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.
Bug and impact
AI-directed subnet probing (
probe_targets) could TCP-connect to hosts on a public /24 that the operator never authorized.Trigger: a scan of a public target (e.g.
scanme.nmap.org) with probing + AI enabled. The subnet director returns neighboring IPs;_run_subnet/ the deep coordinator passallowed_net=_subnet_of(target_ip)(a public/24). Those neighbors were then probed.That is unauthorized scanning of third-party hosts from the user's agent (and from SaaS workers).
Root cause
9452ed1added an RFC1918 gate, then replaced it wholesale withallowed_netwhen that argument was set. Callers always pass_subnet_of(target_ip), so a public target turned the allowlist into that host's public/24instead of narrowing RFC1918.Fix
RFC1918 is mandatory.
allowed_netmay only narrow (keep probes on the target's private/24), never enlarge the set to public space.Validation
python3 -m pytest test_ip_scope.py -q— 12 passed (including new public-allowed_netand RFC1918-narrowing cases)test_ip_scope.py test_security.py test_security_hardening.py test_ai_agent.py— 72 passed