Milesight MilesightVPN liburvpn.so create_private_key OS command injection vulnerability
The device authentication API passes the device serial number into a shell command that generates an RSA key, without sanitising it. An attacker who knows the server's authorisation code could inject shell commands and run them on the VPN server.
Originally disclosed on Cisco Talos
An os command injection vulnerability exists in the liburvpn.so createprivatekey functionality of Milesight VPN v2.0.2. A specially-crafted network request 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
Likely the serial number from the request is concatenated into a shell command string passed to system() without validation or escaping.
Impact
An attacker who knows the server's authorisation code could execute arbitrary commands on the VPN server, and that code can be obtained through a separate vulnerability (TALOS-2023-1702).
What the attacker needed
Knowledge of the server authcode; network access to the /Device_Auth API
How it was found
- Send a POST request to the /Device_Auth API with the four expected fields, including a valid authcode.
- Supply a serial number that is not the all-zero placeholder so the key generation path is reached.
- The server checks whether a private key file already exists for that serial number.
- If it does not exist, the server builds an openssl command containing the serial number and runs it through the shell.
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 VPN server builds a text command to create a key file and puts the device's serial number straight into that text. If the serial number contains extra shell instructions, the computer runs them too. This is called command injection: user input ends up being treated as part of a system command.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.