Skip to content

Instantly share code, notes, and snippets.

@lst15
Last active March 17, 2026 17:27
Show Gist options
  • Select an option

  • Save lst15/2e250d57e192dc8f2cd13ec4bd362e5d to your computer and use it in GitHub Desktop.

Select an option

Save lst15/2e250d57e192dc8f2cd13ec4bd362e5d to your computer and use it in GitHub Desktop.
CVE-2025-70061 – RustDesk Privilege Escalation
[Suggested Description]
A vulnerability in RustDesk v1.4.4 allows attackers to escalate privileges and execute arbitrary commands via a specially crafted binary.
------------------------------------------
[Additional Information]
1. Prepare a controlled environment
Create an attacker-controlled directory and set a malicious value in the HOME environment variable. At this stage, no command is executed.
mkdir -p /tmp/rustdesk
export HOME="/tmp/rustdesk;touch /root/pwned;"
The injected payload is treated purely as data and is inherited by the RustDesk process.
2. Launch RustDesk with the contaminated environment.
Run RustDesk while preserving the malicious HOME value and trigger the service installation flow.
HOME="/tmp/rustdesk;touch /root/pwned;" /usr/bin/rustdesk --install-service
At this point:
The shell does NOT interpret or execute the injected command.
- RustDesk reads the HOME variable and may log it (e.g., dir:/tmp/rustdesk;touch /root/pwned;), confirming that untrusted input propagates without sanitization.
This demonstrates that tainted input reaches a sensitive execution path.
3. Construction and execution of privileged commands (vulnerability trigger)
During service installation or uninstallation, RustDesk performs the following flow:
- switch_service() constructs shell command strings using HOME and the application name.
- uninstall_service() concatenates these commands with systemctl operations.
The resulting string is passed to run_cmds_privileged(), which executes it via a shell with root privileges.
Conceptually, the constructed command resembles:
cp -f /tmp/rustdesk;touch /root/pwned;/... /root/...; systemctl stop rustdesk;
Since the command is executed by a shell, the injected `;touch /root/pwned;` is interpreted as a separate command and executed as root.
4. Verification of successful exploitation
After the service routine completes, verify the side effect of the injected command:
ls -l /root/pwned
The presence of this file confirms arbitrary command execution with elevated privileges (local root RCE).
Root Cause:
- Untrusted environment variables are used to construct shell command strings.
- Commands are executed via
------------------------------------------
[Vulnerability Type Other]
OS Command Injection
------------------------------------------
[Product Vendor]
RustDesk
------------------------------------------
[Affected Product Code Base]
RustDesk - 1.4.4
------------------------------------------
[Affected Component]
Service installation and uninstallation routines on Linux (switch_service(), install_service(), uninstall_service(), run_cmds_privileged) and auto-restart logic (run_me_with()) that construct shell commands based on HOME and the executable path.
------------------------------------------
[Attack Type]
Local
------------------------------------------
[Impact Code Execution]
true
------------------------------------------
[Impact Privilege Escalation]
true
------------------------------------------
[Attack Vectors]
Local exploitation via injection of shell metacharacters into the HOME directory during --install-service/--uninstall-service calls or by placing the executable in a path containing ";", ",", "|" or "&". The shell interprets the suffix as additional commands, executing them with root privileges (service install) or with the privileges of the user restarting the application (auto-restart).
------------------------------------------
[Reference]
https://github.com/rustdesk/rustdesk
------------------------------------------
[Discoverer]
Leandro Salustriano dos Santos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment