|
| 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 | + ) |
0 commit comments