Cap open ports on catch-all hosts across every port source

Open
#3,671 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Start by reading the cdn_port_filter.max_ports implementation from #3663, especially Scanner.filter_catch_all_ports() and the existing CDN/WAF check in ScanEgress where the central cap would live. Then trace the portscan module's masscan result streaming and its cached-port replay per hostname, plus the speculate URL-derived ports and asset_inventory replay paths that bypass the cap today. Done means catch-all hosts are recorded on the scan by any source and the cap is enforced once in ScanEgress, with portscan counting distinct open ports per host as its own detection.

Written by the indexing model from the issue text.

Description

#3663 adds cdn_port_filter.max_ports: when a passive port source (shodan_idb, shodan_enterprise, censys_ip) lists more than that many open TCP ports for a host, only cdn_port_filter.allowed_ports and explicitly targeted ports are kept. Each module applies it to its own API response through Scanner.filter_catch_all_ports(), and the verdict isn't recorded anywhere, so other sources can still flood the same host:

  • portscan streams masscan results port by port and never consults the cap. Against a host that answers SYN-ACK on every port, -c modules.portscan.ports=1-65535 still yields every port, and portscan replays its cached ports for each extra hostname that resolves to the IP.
  • A second passive source whose response stays under the cap, ports speculate derives from URLs, and asset_inventory replays aren't capped either.

Proposal: record catch-all hosts on the scan when a source detects one, and enforce the cap centrally next to the existing CDN/WAF check in ScanEgress, reusing its seed exemption. portscan would need its own detection, such as counting distinct open ports per host as masscan reports them.

Dominant language
Python
Stars
10.9k
Forks
959
Avg merge
2d 7h
Merged PRs (30d)
84

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from blacklanternsecurity/bbot

All issues in blacklanternsecurity/bbot

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.