Skip to content

[BUG] validate_command_network_egress is Dead Code — Secondary Fields Bypass Target Validation #614

@ionfwsrijan

Description

@ionfwsrijan

Description

The function validate_command_network_egress() (validation.py:515-594) inspects every command argument for network destinations against the safe-mode + network policy configuration. However, it is never imported or invoked anywhere in the execution pipeline (executor.py or routes.py). While the primary target field is validated at executor.py:296-351, secondary plugin fields like proxy, virtual_host, config_file, and user_agent can contain arbitrary network destinations that bypass target validation entirely. For example, the nikto plugin's proxy field could be used to route connections through an attacker-controlled proxy without any validation.

Files Affected

  • secuscan/core/validation.pyvalidate_command_network_egress() definition (lines 515-594)
  • secuscan/core/executor.pyexecute_task() where the function should be called but isn't

Expected Behavior

Before spawning any subprocess, every command argument should be inspected for network destinations. If a plugin field like proxy, virtual_host, or config_file contains a network host, it should be validated against the network policy just like the primary target field.

Actual Behavior

validate_command_network_egress() is defined but never called. Secondary plugin fields bypass all network policy validation. An attacker can use the proxy field (or similar) to route scanner traffic through arbitrary hosts.

Steps to Reproduce

  1. Configure a scan with a plugin that has a proxy field (e.g., nikto)
  2. Set the proxy to an arbitrary external host not in the allowlist
  3. Disable the primary target validation check
  4. Execute the scan
  5. Observe that the scan connects through the unvalidated proxy host
  6. Confirm validate_command_network_egress is never called by adding a breakpoint

Impact

An attacker who can control scan parameters (or a plugin with exploitable fields) can route scanner traffic through arbitrary hosts, bypassing the entire safe-mode network policy. This is a high-severity vulnerability in a security tool where the safe mode is a core feature.

Fix Required

Wire validate_command_network_egress() into executor.py's execute_task() before spawning the subprocess. Each argument from plugin configurations needs to be checked against the network policy. The function itself may also need adjustments to handle different argument formats from different plugins.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions