Unauthenticated RCE on a RIGOL oscilloscope
The password change CGI binary on a RIGOL oscilloscope's web interface builds a shell command using user-supplied input without sanitisation, and an empty old-password field bypasses the password check. An unauthenticated attacker could execute arbitrary commands on the device.
tortel.li
Published on tortel.li
I work in a company that uses custom electronic boards, so there are plenty of instruments floating around that electrical engineers employ to debug faulty connections and solderings.
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 write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The CGI binary uses the user-supplied new password in a shell command via system() without sanitisation, and the old-password check can be bypassed by sending an empty pass0 because strncmp with length zero always returns zero.
Impact
An unauthenticated attacker could execute arbitrary commands on the oscilloscope, potentially taking full control of the device.
What the attacker needed
Network access to the oscilloscope's web interface
How it was found
- Download the firmware and extract the web control application and root filesystem.
- Emulate the root filesystem with qemu and chroot, then start the lighttpd web server.
- Send an HTTP request to changepwd.cgi with an empty pass0 and a pass1 containing shell metacharacters and commands.
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 write-up has not been written yet. The Original tab links to the source.
The oscilloscope runs a small web server that lets you change the admin password. The program that handles the password change takes the new password and pastes it directly into a system command without checking it. By sending an empty old password and a new password containing shell commands, anyone can run commands on the device without logging in.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.