Skip to content

Commit 6a39755

Browse files
cisco_ios 2022 cves (#162)
* arista 2021 cves * Fix flake8 and syntax errors in Arista CVE scripts * cisco_ios 2022 cves --------- Co-authored-by: mailsanjayhere <mailsanjayhere@gmail.com>
1 parent 9414a94 commit 6a39755

17 files changed

+509
-0
lines changed

CVEasy/Cisco/2022/__init__.py

Whitespace-only changes.

CVEasy/Cisco/2022/cisco_ios/__init__.py

Whitespace-only changes.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from comfy import high
2+
3+
4+
@high(
5+
name='rule_cve202220677',
6+
platform=['cisco_ios'],
7+
commands=dict(
8+
show_version='show version',
9+
check_ios='show running-config | include ios'
10+
),
11+
)
12+
def rule_cve202220677(configuration, commands, device, devices):
13+
"""
14+
This rule checks for the CVE-2022-20677 vulnerability in Cisco IOS Software.
15+
The vulnerability is due to insufficient protection in the Cisco IOS application hosting environment.
16+
An attacker could exploit this vulnerability to inject arbitrary commands into the underlying host
17+
operating system, execute arbitrary code, install applications without authentication, or conduct
18+
cross-site scripting (XSS) attacks.
19+
"""
20+
# Extract the output of the command to check IOS configuration
21+
ios_output = commands.check_ios
22+
23+
# Check if IOS is configured
24+
ios_configured = 'ios' in ios_output
25+
26+
# Assert that the device is not vulnerable
27+
assert not ios_configured, (
28+
f"Device {device.name} is vulnerable to CVE-2022-20677. "
29+
"The device has IOS application hosting configured, "
30+
"which could allow an attacker to execute arbitrary commands, install unauthorized applications, "
31+
"or conduct XSS attacks. "
32+
"For more information, see "
33+
"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-ios-yuXQ6hFj"
34+
)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from comfy import high
2+
3+
4+
@high(
5+
name='rule_cve202220697',
6+
platform=['cisco_ios'],
7+
commands=dict(
8+
show_version='show version',
9+
check_http='show running-config | include ip http'
10+
),
11+
)
12+
def rule_cve202220697(configuration, commands, device, devices):
13+
"""
14+
This rule checks for the CVE-2022-20697 vulnerability in Cisco IOS Software.
15+
The vulnerability is due to improper resource management in the HTTP server code.
16+
An attacker could exploit this vulnerability by sending a large number of HTTP requests
17+
to an affected device, causing it to reload and resulting in a denial of service (DoS) condition.
18+
"""
19+
# Extract the output of the command to check HTTP configuration
20+
http_output = commands.check_http
21+
22+
# Check if HTTP server is enabled
23+
http_enabled = any(service in http_output for service in ['ip http server', 'ip http secure-server'])
24+
25+
# Assert that the device is not vulnerable
26+
assert not http_enabled, (
27+
f"Device {device.name} is vulnerable to CVE-2022-20697. "
28+
"The device has HTTP/HTTPS server enabled, "
29+
"which could allow an attacker to cause a denial of service through crafted HTTP requests. "
30+
"For more information, see "
31+
"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-http-dos-svOdkdBS"
32+
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from comfy import high
2+
3+
4+
@high(
5+
name='rule_cve202220718',
6+
platform=['cisco_ios'],
7+
commands=dict(
8+
show_version='show version',
9+
check_ios='show running-config | include ios'
10+
),
11+
)
12+
def rule_cve202220718(configuration, commands, device, devices):
13+
"""
14+
This rule checks for the CVE-2022-20718 vulnerability in Cisco IOS Software.
15+
The vulnerability is due to insufficient protection in the Cisco IOS application hosting environment.
16+
Multiple vulnerabilities could allow an attacker to inject arbitrary commands into the underlying host
17+
operating system, execute arbitrary code, install applications without authentication, or conduct
18+
cross-site scripting (XSS) attacks.
19+
"""
20+
# Extract the output of the command to check IOS configuration
21+
ios_output = commands.check_ios
22+
23+
# Check if IOS is configured
24+
ios_configured = 'ios' in ios_output
25+
26+
# Assert that the device is not vulnerable
27+
assert not ios_configured, (
28+
f"Device {device.name} is vulnerable to CVE-2022-20718. "
29+
"The device has IOS application hosting configured, "
30+
"which could allow an attacker to execute arbitrary commands, install unauthorized applications, "
31+
"or conduct XSS attacks. "
32+
"For more information, see "
33+
"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-ios-yuXQ6hFj"
34+
)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from comfy import high
2+
3+
4+
@high(
5+
name='rule_cve202220719',
6+
platform=['cisco_ios'],
7+
commands=dict(
8+
show_version='show version',
9+
check_ios='show running-config | include ios'
10+
),
11+
)
12+
def rule_cve202220719(configuration, commands, device, devices):
13+
"""
14+
This rule checks for the CVE-2022-20719 vulnerability in Cisco IOS Software.
15+
The vulnerability is due to insufficient protection in the Cisco IOS application
16+
hosting environment. Multiple vulnerabilities could allow an attacker to inject
17+
arbitrary commands into the underlying host operating system, execute arbitrary
18+
code, install applications without authentication, or conduct cross-site
19+
scripting (XSS) attacks.
20+
"""
21+
# Extract the output of the command to check IOS configuration
22+
ios_output = commands.check_ios
23+
24+
# Check if IOS is configured
25+
ios_configured = 'ios' in ios_output
26+
27+
# Assert that the device is not vulnerable
28+
assert not ios_configured, (
29+
f"Device {device.name} is vulnerable to CVE-2022-20719. "
30+
"The device has IOS application hosting configured, "
31+
"which could allow an attacker to execute arbitrary commands, install unauthorized applications, "
32+
"or conduct XSS attacks. "
33+
"For more information, see "
34+
"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-ios-yuXQ6hFj"
35+
)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from comfy import high
2+
3+
4+
@high(
5+
name='rule_cve202220720',
6+
platform=['cisco_ios'],
7+
commands=dict(
8+
show_version='show version',
9+
check_ios='show running-config | include ios'
10+
),
11+
)
12+
def rule_cve202220720(configuration, commands, device, devices):
13+
"""
14+
This rule checks for the CVE-2022-20720 vulnerability in Cisco IOS Software.
15+
The vulnerability is due to insufficient protection in the Cisco IOS application
16+
hosting environment.
17+
Multiple vulnerabilities could allow an attacker to inject arbitrary commands
18+
into the underlying host operating system, execute arbitrary code, install
19+
applications without authentication, or conduct cross-site scripting (XSS) attacks.
20+
"""
21+
# Extract the output of the command to check IOS configuration
22+
ios_output = commands.check_ios
23+
24+
# Check if IOS is configured
25+
ios_configured = 'ios' in ios_output
26+
27+
# Assert that the device is not vulnerable
28+
assert not ios_configured, (
29+
f"Device {device.name} is vulnerable to CVE-2022-20720. "
30+
"The device has IOS application hosting configured, "
31+
"which could allow an attacker to execute arbitrary commands, install unauthorized applications, "
32+
"or conduct XSS attacks. "
33+
"For more information, see "
34+
"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-ios-yuXQ6hFj"
35+
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from comfy import high
2+
3+
4+
@high(
5+
name='rule_cve202220721',
6+
platform=['cisco_ios'],
7+
commands=dict(
8+
show_version='show version',
9+
check_ios='show running-config | include ios'
10+
),
11+
)
12+
def rule_cve202220721(configuration, commands, device, devices):
13+
"""
14+
This rule checks for the CVE-2022-20721 vulnerability in Cisco IOS Software.
15+
The vulnerability is due to insufficient protection in the Cisco IOS application hosting environment.
16+
Multiple vulnerabilities could allow an attacker to inject arbitrary commands into the underlying host
17+
operating system, execute arbitrary code, install applications without authentication, or conduct
18+
cross-site scripting (XSS) attacks.
19+
"""
20+
# Extract the output of the command to check IOS configuration
21+
ios_output = commands.check_ios
22+
23+
# Check if IOS is configured
24+
ios_configured = 'ios' in ios_output
25+
26+
# Assert that the device is not vulnerable
27+
assert not ios_configured, (
28+
f"Device {device.name} is vulnerable to CVE-2022-20721. "
29+
"The device has IOS application hosting configured, "
30+
"which could allow an attacker to execute arbitrary commands, install unauthorized applications, "
31+
"or conduct XSS attacks. "
32+
"For more information, see "
33+
"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-ios-yuXQ6hFj"
34+
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from comfy import high
2+
3+
4+
@high(
5+
name='rule_cve202220722',
6+
platform=['cisco_ios'],
7+
commands=dict(
8+
show_version='show version',
9+
check_ios='show running-config | include ios'
10+
),
11+
)
12+
def rule_cve202220722(configuration, commands, device, devices):
13+
"""
14+
This rule checks for the CVE-2022-20722 vulnerability in Cisco IOS Software.
15+
The vulnerability is due to insufficient protection in the Cisco IOS application hosting environment.
16+
Multiple vulnerabilities could allow an attacker to inject arbitrary commands into the underlying host
17+
operating system, execute arbitrary code, install applications without authentication, or conduct
18+
cross-site scripting (XSS) attacks.
19+
"""
20+
# Extract the output of the command to check IOS configuration
21+
ios_output = commands.check_ios
22+
23+
# Check if IOS is configured
24+
ios_configured = 'ios' in ios_output
25+
26+
# Assert that the device is not vulnerable
27+
assert not ios_configured, (
28+
f"Device {device.name} is vulnerable to CVE-2022-20722. "
29+
"The device has IOS application hosting configured, "
30+
"which could allow an attacker to execute arbitrary commands, install unauthorized applications, "
31+
"or conduct XSS attacks. "
32+
"For more information, see "
33+
"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-ios-yuXQ6hFj"
34+
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from comfy import high
2+
3+
4+
@high(
5+
name='rule_cve202220723',
6+
platform=['cisco_ios'],
7+
commands=dict(
8+
show_version='show version',
9+
check_ios='show running-config | include ios'
10+
),
11+
)
12+
def rule_cve202220723(configuration, commands, device, devices):
13+
"""
14+
This rule checks for the CVE-2022-20723 vulnerability in Cisco IOS Software.
15+
The vulnerability is due to insufficient protection in the Cisco IOS application hosting environment.
16+
Multiple vulnerabilities could allow an attacker to inject arbitrary commands into the underlying host
17+
operating system, execute arbitrary code, install applications without authentication, or conduct
18+
cross-site scripting (XSS) attacks.
19+
"""
20+
# Extract the output of the command to check IOS configuration
21+
ios_output = commands.check_ios
22+
23+
# Check if IOS is configured
24+
ios_configured = 'ios' in ios_output
25+
26+
# Assert that the device is not vulnerable
27+
assert not ios_configured, (
28+
f"Device {device.name} is vulnerable to CVE-2022-20723. "
29+
"The device has IOS application hosting configured, "
30+
"which could allow an attacker to execute arbitrary commands, install unauthorized applications, "
31+
"or conduct XSS attacks. "
32+
"For more information, see "
33+
"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-ios-yuXQ6hFj"
34+
)

0 commit comments

Comments
 (0)