Skip to content
RCE Advisory Intermediate CVE-2023-22659

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.

Francesco Benvenuto Follow

Originally disclosed on Cisco Talos

High 7.2 View original

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.

Francesco Benvenuto, on Cisco Talos

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

  1. Log in to the router console over telnet or SSH with valid credentials.
  2. Enter privileged mode with the enable command.
  3. Enter configuration mode with configure terminal.
  4. 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.

More by Francesco Benvenuto

View all

152 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.