Nettacker icon indicating copy to clipboard operation
Nettacker copied to clipboard

--exclude-ports silently ignored for modules using nettacker_fuzzer.data.ports (affects 84+ modules)

Open NSK-394 opened this issue 3 months ago • 3 comments

Context: Found while addressing Codex review on PR #1665 (CVE-2026-20253 Splunk module).

Root cause: nettacker/core/module.py, Module.generate_loops():

if self.module_inputs["excluded_ports"]: excluded_port_set = set(self.module_inputs["excluded_ports"]) if ( self.module_content and self.module_content["payloads"] and "ports" in self.module_content["payloads"][0]["steps"][0] ): all_ports = self.module_content["payloads"][0]["steps"][0]["ports"] all_ports[:] = [port for port in all_ports if port not in excluded_port_set]

This only filters a top-level step["ports"] key. Modules using the nettacker_fuzzer pattern (schema/ports Cartesian-product expansion, see find_repeaters/fuzzer_repeater_perform in utils/common.py) nest their port list under payloads[0]["steps"][0]["url"]["nettacker_fuzzer"]["data"]["ports"] instead -- a completely different path this check never inspects.

Confirmed 84 modules under nettacker/modules/vuln/ use this nested pattern (grep -l "nettacker_fuzzer" nettacker/modules/vuln/*.yaml | wc -l).

Real-world evidence: ran a live scan with --exclude-ports 8000 explicitly targeting a module whose ports include 8000 -- the scan still probed and detected on port 8000, completely ignoring the exclusion.

Impact: --exclude-ports is documented as a way to skip specific ports (e.g., during a maintenance window, or when the operator isn't authorized to touch a given service). For the 84 modules using the nettacker_fuzzer pattern, this exclusion is currently silently ignored -- the module still probes excluded ports. This seems like it could matter more than a typical reliability bug, since it touches what a scan is authorized to do, but I'll defer to your read on priority given the scale of modules affected.

Suggested fix direction: generate_loops() (or a related pre-expansion step) needs to also filter nettacker_fuzzer.data.ports lists before expansion, not just the legacy top-level ports key.

NSK-394 avatar Aug 16 '26 00:08 NSK-394

@NSK-394 Perhaps this is not documented bery well, but --exclude-ports as designed for use with port_scan module only.

For what you are trying to achieve is done in a reverse way by using -g so if you only want to run a module with port 443 you define -g 443 and ports 80 and 8000 (e.g. in your proposed Splunk module) will not be probed, as you are telling Nettacker to only use a specific port(s)

securestep9 avatar Aug 17 '26 20:08 securestep9

ok that makes sense thanks for the clarification, didn't realize --exclude-ports was scoped to port_scan specifically. Good to know -g is the right tool for this. Appreciate you taking the time to explain

NSK-394 avatar Aug 18 '26 01:08 NSK-394

Closing since this is expected behavior, not a bug -g is the correct mechanism for what I was trying to achieve.

NSK-394 avatar Aug 18 '26 01:08 NSK-394