T1059.008: Network Device CLI

Adversaries may abuse scripting or built-in command line interpreters (CLI) on network devices to execute malicious command and payloads. The CLI is the primary means through which users and administrators interact with the device in order to view system information, modify device operations, or perform diagnostic and administrative functions. CLIs typically contain various permission levels required for different commands.

Scripting interpreters automate tasks and extend functionality beyond the command set included in the network OS. The CLI and scripting interpreter are accessible through a direct console connection, or through remote means, such as telnet or SSH.

Adversaries can use the network CLI to change how network devices behave and operate. The CLI may be used to manipulate traffic flows to intercept or manipulate data, modify startup configuration parameters to load malicious system software, or to disable security features or logging to avoid detection.

Positive Technologies products that cover the technique

MaxPatrol SIEM knowledge base

eltex: PT-CR-2322: Eltex_Logging_To_Untrusted_Host: Logging to an untrusted host was configured network_devices_compromise: PT-CR-2128: Cumulus_Logging_To_Untrusted_Host: Logging to an untrusted host is configured network_devices_compromise: PT-CR-570: Cisco_ASA_Logging_Usernames_Outside: Sending usernames to an untrusted host is configured on Cisco ASA network_devices_compromise: PT-CR-1817: S_Terra_Gate_Logging_To_Untrusted_Host: Logging to an untrusted host is configured network_devices_compromise: PT-CR-578: Cisco_ASA_Logging_To_Untrusted_Host: Sending logs to an untrusted host is configured on Cisco ASA network_devices_compromise: PT-CR-572: Cisco_Execute_Suspicious_Command: A suspicious command is executed on Cisco IOS

Detection

IDDS0017Data source and componentCommand: Command ExecutionDescription

Consider reviewing command history in either the console or as part of the running memory to determine if unauthorized or suspicious commands were used to modify device configuration. Consider comparing a copy of the network device configuration against a known-good version to discover unauthorized changes to the command interpreter. The same process can be accomplished through a comparison of the run-time memory, though this is non-trivial and may require assistance from the vendor.

Mitigation

IDM1038NameExecution PreventionDescription

TACACS+ can keep control over which commands administrators are permitted to use through the configuration of authentication and command authorization.

IDM1026NamePrivileged Account ManagementDescription

Use of Authentication, Authorization, and Accounting (AAA) systems will limit actions administrators can perform and provide a history of user actions to detect unauthorized use and abuse. TACACS+ can keep control over which commands administrators are permitted to use through the configuration of authentication and command authorization

IDM1018NameUser Account ManagementDescription

Use of Authentication, Authorization, and Accounting (AAA) systems will limit actions users can perform and provide a history of user actions to detect unauthorized use and abuse. Ensure least privilege principles are applied to user accounts and groups so that only authorized users can perform configuration changes.