Skip to content

Commit 61d1710

Browse files
updated cisco_nxos vulnerabiliteis with software versions and doc files for them
1 parent ef6fdf4 commit 61d1710

15 files changed

+745
-174
lines changed

CVEasy/Cisco/2022/cve202220623.py

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from comfy import high
22
import re
33

4+
45
@high(
56
name='rule_cve202220623',
67
platform=['cisco_nxos'],
@@ -12,44 +13,52 @@
1213
def rule_cve202220623(configuration, commands, device, devices):
1314
"""
1415
CVE-2022-20623: BFD DoS vulnerability in Cisco NX-OS.
15-
Affects Nexus 9000 Series if BFD is enabled and version ≤ 7.0(3)I7(10) or ≤ 9.3(8).
16+
Affects Nexus 9500 Series switches with BFD enabled on:
17+
- NX-OS versions < 7.0.3.I7.10
18+
- NX-OS versions < 9.3(8)
19+
- NX-OS 10.2(2) *only* if GX ASIC is in use (not checked here)
20+
Note: Nexus 9200/9300 not affected even on same NX-OS versions.
1621
"""
17-
platform_output = commands.show_version
22+
version_output = commands.show_version
1823
bfd_output = commands.check_bfd
1924

20-
# 1. Check if device is a Nexus 9000
21-
is_n9k = 'Nexus 9000' in platform_output
22-
if not is_n9k:
25+
# Skip if BFD is not enabled
26+
if 'feature bfd' not in bfd_output:
2327
return
2428

25-
# 2. Check if BFD is enabled
26-
bfd_enabled = 'feature bfd' in bfd_output
27-
if not bfd_enabled:
29+
# Skip if platform is not Nexus 9500
30+
if 'Nexus 9500' not in version_output:
2831
return
2932

30-
# 3. Extract NX-OS version
31-
match = re.search(r'NXOS:\s+version\s+([\w\.\(\)]+)', platform_output, re.IGNORECASE)
33+
# Extract NX-OS version
34+
match = re.search(r'NXOS:\s+version\s+([\w\.\(\)]+)', version_output, re.IGNORECASE)
3235
if not match:
33-
return # Can't extract version
36+
return
3437

3538
version = match.group(1)
3639

37-
def parse_version(ver):
38-
return [int(x) if x.isdigit() else x for x in re.split(r'[\.\(\)I]+', ver) if x]
40+
def parse_version(v):
41+
return [int(x) if x.isdigit() else x for x in re.split(r'[.\(\)I]+', v) if x]
3942

4043
v = parse_version(version)
41-
is_vulnerable = False
42-
43-
# 4. Compare version against vulnerable builds
44-
if version.startswith("7.0.3") and 'I' in version:
45-
is_vulnerable = v <= parse_version("7.0.3.I7.10")
46-
elif version.startswith("9.3"):
47-
is_vulnerable = v <= parse_version("9.3.8")
48-
49-
# 5. Assert only if BFD is enabled and version is affected
50-
assert not is_vulnerable, (
51-
f"Device {device.name} is vulnerable to CVE-2022-20623. "
52-
f"Nexus 9000 Series switch with NX-OS version {version} has BFD enabled, "
53-
"which could allow a remote attacker to cause BFD session flaps and a denial of service. "
54-
"See: https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-nxos-bfd-dos-wGQXrzxn"
44+
45+
# Determine the correct threshold based on major.minor version
46+
if v[:2] == parse_version("7.0")[:2]:
47+
is_safe = v >= parse_version("7.0.3.I7.10")
48+
elif v[:2] == parse_version("9.3")[:2]:
49+
is_safe = v >= parse_version("9.3.8")
50+
elif v[:2] == parse_version("10.2")[:2]:
51+
# 10.2.2 requires GX ASIC, which we're not checking — skip
52+
return
53+
else:
54+
# Unknown version family — skip check
55+
return
56+
57+
# Assert only if device is vulnerable
58+
assert is_safe, (
59+
f"Device {device.name or device.ipaddress or 'unknown'} is vulnerable to CVE-2022-20623. "
60+
f"NX-OS version {version} on a Nexus 9500 with BFD enabled may allow denial of service. "
61+
"Upgrade to a fixed release or apply the appropriate SMU. "
62+
"See: "
63+
"https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-nxos-bfd-dos-wGQXrzxn"
5564
)

CVEasy/Cisco/2022/cve202220624.py

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,65 @@
11
from comfy import high
22
import re
33

4+
45
@high(
5-
name='rule_cve202220624',
6-
platform=['cisco_nxos'],
6+
name="rule_cve202220624",
7+
platform=["cisco_nxos"],
78
commands=dict(
8-
show_version='show version',
9-
check_cfs='show running-config | include cfs ipv4 distribute'
9+
show_version="show version",
10+
show_cfs_status="show cfs status",
1011
),
1112
)
1213
def rule_cve202220624(configuration, commands, device, devices):
1314
"""
14-
CVE-2022-20624: NX-OS CFSoIP DoS vulnerability.
15-
Affects NX-OS ≤ 7.0(3)I7(10) or ≤ 9.3(8), only if CFSoIP is enabled.
15+
CVE-2022-20624:
16+
Cisco Fabric Services over IP (CFSoIP) DoS vulnerability in Cisco NX-OS.
1617
"""
17-
cfs_output = commands.check_cfs
18+
1819
version_output = commands.show_version
20+
cfs_output = commands.show_cfs_status
21+
22+
# Skip if CFSoIP is not enabled
23+
if "Distribution over IP : Enabled" not in cfs_output:
24+
return
1925

20-
# Check if CFSoIP is enabled
21-
cfs_enabled = 'cfs ipv4 distribute' in cfs_output
22-
if not cfs_enabled:
23-
return # Not vulnerable if CFSoIP is off
26+
# Skip if not one of the affected platforms
27+
if not any(p in version_output for p in ["Nexus 3000", "Nexus 9000", "UCS 6400"]):
28+
return
2429

25-
# Extract NX-OS version from show version
26-
match = re.search(r'NXOS:\s+version\s+([\w\.\(\)]+)', version_output, re.IGNORECASE)
30+
# Extract NX-OS version
31+
match = re.search(r'NXOS:\s+version\s+([\w\.\(\)]+)', version_output)
2732
if not match:
28-
return # Version unknown, skip
33+
return
2934

3035
version = match.group(1)
3136

3237
def parse_version(v):
33-
return [int(x) if x.isdigit() else x for x in re.split(r'[\.\(\)I]+', v) if x]
38+
return [int(x) if x.isdigit() else x for x in re.split(r'[.\(\)I]+', v) if x]
3439

3540
v = parse_version(version)
36-
is_vulnerable = False
3741

38-
if version.startswith("7.0.3") and 'I' in version:
39-
is_vulnerable = v < parse_version("7.0.3.I7.10")
40-
elif version.startswith("9.3"):
41-
is_vulnerable = v < parse_version("9.3.8")
42+
# Determine if the version is vulnerable based on platform
43+
if "UCS 6400" in version_output:
44+
# UCS 6400 fixed in: 4.1(3h), 4.2(1l)
45+
is_safe = (
46+
v >= parse_version("4.1.3h") or
47+
v >= parse_version("4.2.1l")
48+
)
49+
else:
50+
# Nexus 3000/9000 fixed in: 7.0(3)I7(10) or 9.3(8)
51+
if v[:2] == parse_version("7.0")[:2]:
52+
is_safe = v >= parse_version("7.0.3.I7.10")
53+
elif v[:2] == parse_version("9.3")[:2]:
54+
is_safe = v >= parse_version("9.3.8")
55+
else:
56+
# Unknown family — skip
57+
return
4258

43-
assert not is_vulnerable, (
44-
f"Device {device.name} is vulnerable to CVE-2022-20624. "
45-
f"NX-OS version {version} has CFSoIP enabled, which allows unauthenticated DoS attacks. "
46-
"Upgrade to a fixed version or disable CFSoIP. "
59+
# Assert only if device is vulnerable
60+
assert is_safe, (
61+
f"Device {device.name or device.ipaddress or 'unknown'} is vulnerable to CVE-2022-20624. "
62+
f"NX-OS version {version} with CFSoIP enabled may allow a remote DoS. "
63+
"Upgrade to a fixed release or apply the appropriate SMU. "
4764
"See: https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-cfsoip-dos-tpykyDr"
4865
)

CVEasy/Cisco/2022/cve202220625.py

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,60 @@
11
from comfy import high
22
import re
33

4+
45
@high(
5-
name='rule_cve202220625',
6-
platform=['cisco_nxos'],
6+
name="rule_cve202220625",
7+
platform=["cisco_nxos"],
78
commands=dict(
8-
show_version='show version',
9-
check_cdp='show running-config | include no cdp enable|cdp enable'
9+
show_version="show version",
10+
show_running_config_cdp="show running-config cdp all | include \"cdp enable\"",
1011
),
1112
)
1213
def rule_cve202220625(configuration, commands, device, devices):
1314
"""
14-
CVE-2022-20625: DoS via CDP in NX-OS.
15-
Vulnerable if CDP is enabled AND version is < fixed.
16-
Fixed in: 7.0(3)I7(10), 8.4(5), 9.3(8)
15+
CVE-2022-20625: Cisco Discovery Protocol Service DoS Vulnerability
16+
An unauthenticated attacker on the local network can send crafted CDP messages
17+
that restart the service, possibly the whole device. This affects multiple platforms.
1718
"""
18-
cdp_output = commands.check_cdp
19+
1920
version_output = commands.show_version
21+
cdp_output = commands.show_running_config_cdp
22+
23+
if "cdp enable" not in cdp_output:
24+
return
2025

21-
# Check if CDP is enabled
22-
cdp_enabled = 'cdp enable' in cdp_output
23-
if not cdp_enabled:
24-
return # Safe
26+
if not any(model in version_output for model in [
27+
"Nexus 3000", "Nexus 5500", "Nexus 5600", "Nexus 6000", "Nexus 7000",
28+
"Nexus 9000", "UCS 6200", "UCS 6300", "UCS 6400", "Firepower 4100", "Firepower 9300",
29+
"MDS 9000", "Nexus 1000V"
30+
]):
31+
return
2532

26-
# Extract NX-OS version
27-
match = re.search(r'NXOS:\s+version\s+([\w\.\(\)]+)', version_output, re.IGNORECASE)
33+
match = re.search(r"NXOS:\s+version\s+([\w\.\(\)]+)", version_output, re.IGNORECASE)
2834
if not match:
29-
return # Unknown version, skip
35+
return
3036

3137
version = match.group(1)
3238

3339
def parse_version(v):
34-
return [int(x) if x.isdigit() else x for x in re.split(r'[\.\(\)I]+', v) if x]
40+
return [int(x) if x.isdigit() else x for x in re.split(r"[.\(\)I]+", v) if x]
3541

3642
v = parse_version(version)
37-
is_vulnerable = False
38-
39-
if version.startswith("7.0.3") and 'I' in version:
40-
is_vulnerable = v < parse_version("7.0.3.I7.10")
41-
elif version.startswith("8.4"):
42-
is_vulnerable = v < parse_version("8.4.5")
43-
elif version.startswith("9.3"):
44-
is_vulnerable = v < parse_version("9.3.8")
45-
46-
assert not is_vulnerable, (
43+
is_safe = False
44+
45+
if v[:2] == parse_version("7.0")[:2]:
46+
is_safe = v >= parse_version("7.0.3.I7.10")
47+
elif v[:2] == parse_version("8.4")[:2]:
48+
is_safe = v >= parse_version("8.4.5")
49+
elif v[:2] == parse_version("9.3")[:2]:
50+
is_safe = v >= parse_version("9.3.8")
51+
elif v[:2] == parse_version("4.1")[:2]:
52+
is_safe = v >= parse_version("4.1.3")
53+
elif v[:2] == parse_version("4.2")[:2]:
54+
is_safe = v >= parse_version("4.2.1")
55+
56+
assert is_safe, (
4757
f"Device {device.name or device.ipaddress or 'unknown'} is vulnerable to CVE-2022-20625. "
48-
f"NX-OS version {version} with CDP enabled allows an adjacent attacker to crash the service or device. "
49-
"Upgrade to a fixed release. "
58+
"Upgrade to a fixed version or disable CDP globally where applicable. "
5059
"See: https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-cdp-dos-G8DPLWYG"
5160
)

CVEasy/Cisco/2022/cve202220650.py

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,53 @@
11
from comfy import high
2+
import re
23

34

45
@high(
5-
name='rule_cve202220650',
6-
platform=['cisco_nxos'],
6+
name="rule_cve202220650",
7+
platform=["cisco_nxos"],
78
commands=dict(
8-
show_version='show version',
9-
check_nxapi='show running-config | include feature nxapi'
9+
show_version="show version",
10+
show_feature_nxapi="show feature | include nxapi",
1011
),
1112
)
1213
def rule_cve202220650(configuration, commands, device, devices):
1314
"""
14-
This rule checks for the CVE-2022-20650 vulnerability in Cisco NX-OS Software.
15-
The vulnerability is due to insufficient input validation of user supplied data that is sent to the NX-API.
16-
An authenticated, remote attacker could exploit this vulnerability by sending a crafted HTTP POST request
17-
to the NX-API of an affected device, allowing them to execute arbitrary commands with root privileges.
18-
Note: The NX-API feature is disabled by default.
15+
CVE-2022-20650: NX-API command injection vulnerability in Cisco NX-OS
16+
An authenticated attacker could exploit the NX-API feature to run arbitrary
17+
OS commands as root due to improper input sanitization.
1918
"""
20-
# Extract the output of the command to check NX-API configuration
21-
nxapi_output = commands.check_nxapi
2219

23-
# Check if NX-API is enabled
24-
nxapi_enabled = 'feature nxapi' in nxapi_output
20+
version_output = commands.show_version
21+
nxapi_output = commands.show_feature_nxapi
2522

26-
# If NX-API is not enabled, device is not vulnerable
27-
if not nxapi_enabled:
23+
if "nxapi" not in nxapi_output or "enabled" not in nxapi_output:
2824
return
2925

30-
# Assert that the device is not vulnerable
31-
assert not nxapi_enabled, (
32-
f"Device {device.name} is vulnerable to CVE-2022-20650. "
33-
"The device has NX-API enabled, which could allow an authenticated attacker "
34-
"to execute arbitrary commands with root privileges through crafted HTTP POST requests. "
35-
"For more information, see"
36-
"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-nxos-nxapi-cmdinject-ULukNMZ2"
26+
if not any(model in version_output for model in [
27+
"Nexus 3000", "Nexus 5500", "Nexus 5600", "Nexus 6000", "Nexus 9000"
28+
]):
29+
return
30+
31+
match = re.search(r"NXOS:\s+version\s+([\w\.\(\)]+)", version_output, re.IGNORECASE)
32+
if not match:
33+
return
34+
35+
version = match.group(1)
36+
37+
def parse_version(v):
38+
return [int(x) if x.isdigit() else x for x in re.split(r"[.\(\)I]+", v) if x]
39+
40+
v = parse_version(version)
41+
is_safe = False
42+
43+
if v[:2] == parse_version("7.0")[:2]:
44+
is_safe = v >= parse_version("7.0.3.I7.10")
45+
elif v[:2] == parse_version("9.3")[:2]:
46+
is_safe = v >= parse_version("9.3.8")
47+
48+
assert is_safe, (
49+
f"Device {device.name or device.ipaddress or 'unknown'} is vulnerable to CVE-2022-20650. "
50+
"NX-API is enabled and the software version is unpatched. "
51+
"See: https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-"
52+
"sa-nxos-nxapi-cmdinject-ULukNMZ2"
3753
)

0 commit comments

Comments
 (0)