|
| 1 | +from comfy import high |
| 2 | + |
| 3 | + |
| 4 | +@high( |
| 5 | + name='rule_cve202320033', |
| 6 | + platform=['cisco_xe'], |
| 7 | + commands=dict( |
| 8 | + show_version='show version', |
| 9 | + check_mgmt='show running-config | include interface GigabitEthernet0' |
| 10 | + ), |
| 11 | +) |
| 12 | +def rule_cve202320033(configuration, commands, device, devices): |
| 13 | + """ |
| 14 | + This rule checks for the CVE-2023-20033 vulnerability in Cisco IOS XE Software for |
| 15 | + Catalyst 3650/3850 Series Switches. The vulnerability is due to improper resource |
| 16 | + management when processing traffic received on the management interface. |
| 17 | + An attacker could exploit this vulnerability by sending a high rate of traffic to |
| 18 | + the management interface. |
| 19 | + """ |
| 20 | + # Extract the version information from the command output |
| 21 | + version_output = commands.show_version |
| 22 | + |
| 23 | + # List of vulnerable software versions |
| 24 | + vulnerable_versions = [ |
| 25 | + # 16.3 versions |
| 26 | + '16.3.1', '16.3.2', '16.3.3', '16.3.1a', '16.3.4', '16.3.5', '16.3.5b', |
| 27 | + '16.3.6', '16.3.7', '16.3.8', '16.3.9', '16.3.10', '16.3.11', |
| 28 | + # 16.4-16.9 versions |
| 29 | + '16.4.1', '16.5.1', '16.5.1a', '16.6.1', '16.6.2', '16.6.3', '16.6.4', |
| 30 | + '16.6.5', '16.6.4a', '16.6.6', '16.6.7', '16.6.8', '16.6.9', '16.6.10', |
| 31 | + '16.7.1', '16.8.1', '16.8.1a', '16.8.1s', '16.9.1', '16.9.2', '16.9.1s', |
| 32 | + '16.9.3', '16.9.4', '16.9.3a', '16.9.5', '16.9.6', '16.9.7', '16.9.8', |
| 33 | + # 16.11-16.12 versions |
| 34 | + '16.11.1', '16.11.2', '16.11.1s', '16.12.1', '16.12.1s', '16.12.2', |
| 35 | + '16.12.3', '16.12.8', '16.12.4', '16.12.3s', '16.12.3a', '16.12.5', |
| 36 | + '16.12.6', '16.12.5b', '16.12.6a', '16.12.7', '16.12.9' |
| 37 | + ] |
| 38 | + |
| 39 | + # Check if the current device's software version is in the list of vulnerable versions |
| 40 | + version_vulnerable = any(version in version_output for version in vulnerable_versions) |
| 41 | + |
| 42 | + # If version is not vulnerable, no need to check further |
| 43 | + if not version_vulnerable: |
| 44 | + return |
| 45 | + |
| 46 | + # Extract the output of the command to check management interface configuration |
| 47 | + mgmt_output = commands.check_mgmt |
| 48 | + |
| 49 | + # Check if management interface is configured |
| 50 | + mgmt_configured = 'interface GigabitEthernet0' in mgmt_output |
| 51 | + |
| 52 | + # Assert that the device is not vulnerable |
| 53 | + assert not mgmt_configured, ( |
| 54 | + f"Device {device.name} is vulnerable to CVE-2023-20033. " |
| 55 | + "The device is running a vulnerable version AND has management interface configured, " |
| 56 | + "which could allow an attacker to cause a denial of service. " |
| 57 | + "For more information, see" |
| 58 | + "https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-cat3k-dos-ZZA4Gb3r" |
| 59 | + ) |
0 commit comments