Milesight UR32L libzebra.so change_hostname OS command injection vulnerability
The change_hostname function in libzebra.so builds a shell command from the new hostname without sanitising it, then runs it with system(). An authenticated attacker can inject shell metacharacters into the hostname to execute arbitrary commands on the router.
Originally disclosed on Cisco Talos
An os command injection vulnerability exists in the libzebra.so changehostname functionality of Milesight UR32L v32.3.0.5. A specially-crafted network packets can lead to command execution.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The hostname is inserted into a shell command string with snprintf and passed to system() without escaping, and the only validation is that the first character is alphabetic.
Impact
An authenticated admin-level user could execute arbitrary commands on the device, as demonstrated by forcing a reboot; the report does not claim exploitation by lower-privileged users.
What the attacker needed
Valid admin credentials for the router console; access to telnet or SSH service
The fix
The hostname should be validated and shell-escaped, or the configuration change should be applied without invoking a shell.
How it was found
- Log in to the router console over telnet or SSH with valid credentials.
- Enter privileged mode with the enable command.
- Enter configuration mode with configure terminal.
- Run the hostname command with a value that starts with a letter and contains shell metacharacters.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The router's command-line interface lets an admin change the device hostname. The code that applies the change pastes the hostname into a shell command and runs it, so special characters like quotes and dollar signs are treated as shell instructions rather than plain text. Someone who can log in can therefore run their own commands on the router.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.