Skip to content

OS command injection in vulnerability scan exec_netscan via host parameter (incomplete fix bypass)

Moderate
cardigliano published GHSA-p4gm-6qx7-gq3m Aug 3, 2026

Software

ntopng

Affected versions

<= 6.7.260803

Patched versions

None

Description

Vulnerable Code

scripts/lua/modules/vulnerability_scan/vs_utils.lua, function exec_netscan(), line 2565.

function vs_utils.exec_netscan(host, cidr)
   local s = string.split(host, '%.')
   local net = s[1]..".."..s[2]..".."..s[3].."."
   local nmap = vs_utils.get_nmap_path()
   local command = nmap..' -sP -n ' .. net .. net_range
   out = ntop.execCmd(command)  -- popen("/bin/sh", "-c", command)
end

The host parameter is split on . and reassembled into an nmap command without shell metacharacter sanitization. At HEAD (commit 838ccd5, 2026-07-16), nmap_scan_host() and nmap_check_host() received partial input validation, but exec_netscan() remains vulnerable -- an incomplete fix bypass.

Note: the http_lint.lua global validation module blocks exploitation via the web API for most inputs, but exec_netscan() can also be reached from internal Lua callers.

Attack Path

  1. Authenticated user triggers a network scan with host value 1$(id).2.3.0
  2. exec_netscan() splits on .: s = {"1$(id)", "2", "3", "0"}
  3. Command becomes: nmap -sP -n 1$(id).2.3.1-254
  4. ntop.execCmd() passes this to /bin/sh -c, executing the injected id command
  5. Same applies to backticks, pipe, semicolons embedded in any octet

Impact

An authenticated ntopng user can execute arbitrary OS commands on the server via crafted host parameters to the network scan function. While the web API has global validation that mitigates direct exploitation, the underlying function remains vulnerable and the fix applied to sibling functions was not applied to exec_netscan().

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
High
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H

CVE ID

No known CVE

Weaknesses

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. Learn more on MITRE.