Summary
validate_port_range() in backend/secuscan/validation.py accepts any valid port range without limiting the total number of ports. A caller can pass 1-65535 which triggers a full 65,535-port Nmap scan, consuming excessive CPU, memory, and network bandwidth. A single request can cause a denial of service.
Location
backend/secuscan/validation.py — validate_port_range()
Steps to Reproduce
- Start a scan task with
port_range = "1-65535"
- Observe that validation passes with no error
- Nmap launches a full port scan — excessive resource consumption
Expected Behavior
Validation should reject port ranges exceeding a configurable maximum (e.g. 1000 ports).
Actual Behavior
No upper limit check exists — any range up to 65535 ports is accepted silently.
Proposed Fix
if (end - start) > settings.max_port_range_size:
return False, f"Port range too large (max {settings.max_port_range_size} ports)"
Summary
validate_port_range()inbackend/secuscan/validation.pyaccepts any valid port range without limiting the total number of ports. A caller can pass1-65535which triggers a full 65,535-port Nmap scan, consuming excessive CPU, memory, and network bandwidth. A single request can cause a denial of service.Location
backend/secuscan/validation.py—validate_port_range()Steps to Reproduce
port_range = "1-65535"Expected Behavior
Validation should reject port ranges exceeding a configurable maximum (e.g. 1000 ports).
Actual Behavior
No upper limit check exists — any range up to 65535 ports is accepted silently.
Proposed Fix