Unauthenticated RCE on a RIGOL oscilloscope
tortel.li
tortel.li
These equipments are simply assuming that anyone can access the interface is not hostile. This is a pretty good assumption in most lab settings that I know, unless the operator is so ignorant. This assumption certainly have made my life much easier in the lab, of course, where every LXI test equipments are connected to a isolated LAN. I would say a lot more f*k in the lab if I have to authenticate myself before sending a SCPI command. I'm happy that most test equipment makers do agree with me.
For example, modern Rohde&Schwartz gears running Windows or Linux (FSV, FSW, FSVA, FSUP, SMA, SMC, ZNL, etc.) have VNC or Windows RDP enabled by default, and have a weak default password shared among the series. Keysight ones too (E5071C, DSOX3000T, maybe not on by default but with a supported way). A hostile user can even screw up a LAN connected, damn simple VxWorks based multimeter like Agilent 34410A badly by sending the calibration commands at the wrong time or some backdoor commands (DIAG:xxxx, haven't tried but looks possible).
Slightly off topic, some Chinese test equipment makers are making hackability as a feature, look at Siglent or Rigol scopes. They can (and they are competent enough to) lock down the system with secure boot like some Tektronix ones. However they don't, so that people with less budget can buy a cheaper model and hack for the bandwidth.
I went through a similar argument with an intranet product that "didn't need to worry about SQL because it's on a trusted network" crashed when Bob O'Reilly tried to make an account.
Having a password implies that it provides some meaningful security. A bad lock is worse than no lock, because it will lead people to put the instrument in inappropriate places.
But a weak password maybe useful sometimes, to prevent your coworker accidentally connect to the wrong equipment and mess up one's experiment.
Here it's never meant to deter a hostile coworker, in that case one reports to one's superior rather than rely on the password which is always stickered to the scope itself (in my lab).
I'm mostly disappointment that the author didn't do any research. While I get the cool-factor of trying to hack the firmware from scratch, a simple search would have found the author the EEVblog [0] for starters. But i admit, it is 104 pages atm. And the biggest dissapointment, an obviously shameless plug, is that this 'reversing' of the firmware, was done more then 5 years ago [1] where I wrote scripts to extract the whole firmware automatically.
There's even rumor that the entire source code has leaked onto the internet already.
I would expect some research would have made this 'discovery' less of an 'omg there's an RCE!'
[0]: https://www.eevblog.com/forum/testgear/hacking-the-rigol-mso... [1]: https://gitlab.com/riglol/rigolee/firmware/
After finding the vuln, I checked online if someone else had already found the vuln, and I admit I have come across the EEVblog, but I didn't find the exact vuln I found (I also must admit I didn't read all the posts there).
I am sorry if I have in some way disrespected your work, but it wasn't my intention at all!
Vulnerability found, 2022-11-08
Sent detailed PoC, 2022-11-09
RIGOL says they would have contacted me with updates from R&D, 2022-11-09
Follow-up on the vulnerability, 2023-01-25
RIGOL says they would reply in 2-3 days, 2023-01-28
Full disclosure, 2023-02-08
The style the author chose to list the timeline is IMHO the most faithful, honest, and polite way of communicating it without adding wrong or legally problematic reasoning to the situation, from their perspective.
On my Siglent scope (an SDS2104X plus) you can easily hack it to enable telnet access. This requires physical access to the device to add a USB stick with a file on it to achieve this, but it's then very open (described here https://www.eevblog.com/forum/testgear/siglent-sds2000x-plus...)
It was actually one of the things that attracted me to this scope, that it was to some extent hackable. Compared to other scopes like the old Tektronix ones running VxWorks it's nice to have something familiar behind the scenes.
Think of all the awesome things I could do!
This security vulnerability does not make me worried, it makes me happy. Rigols have always been somewhat hackable, this is an even easier way to do it.
I have a 16702A, which includes a front panel LCD and keyboard console. It's a beast.
[1] https://www.keysight.com/us/en/product/16700A/logic-analysis...
Bypassing strncmp was particularly insightful.
Scopes have massive amounts of true random data at their disposal. :P
This isn't a nonce where you might need some kind of special timing properties.
We hash so that people can't grab your password and use it elsewhere. We add some salt to make the hash more robust to memory and precomputation attacks.
The "strncmp(saved_pwd,pass0,strlen(pass0))" looks equally bad. Probably someone did not understood the advice "always check the length first" and just did it everywhere.
Intel AMT checked the password in a similar way some time ago: https://www.tenable.com/blog/rediscovering-the-intel-amt-vul...
I often remember my PHP days in horror, but mysqli_query manpage does warn you about SQL-injections now.
"The strncmp() function is similar, except it compares only the first (at most) n bytes of s1 and s2."
Possibly it's years of string wrangling in C that sets me up here for being biased towards the compact way in which the C manpages state what the function will do, but 'early termination' because of zero length strings for comparisions returns 0 just as sure as comparing "" and "" would. And that 0 indicates a match...
I'm definitely not arguing that C shouldn't be used and everybody should be using <insert-the-currently-trendy-systems-programming-language>: just thinking out loud if improved documentation could prevent at least some of the common footguns.
CVE-2022-23968: https://neosmart.net/blog/xerox-vulnerability-allows-unauthe...
2019-09-26 Reported to vendor with POC
2020-01-14 Followed up with vendor
2022-01-24 Publicly disclosed (still no fix over 2 years later!)
2022-01-28 Fix released by vendor
I wonder if the same will happen with this RIGOL oscilloscope vulnerability.Rigol made their own ADC chip that beats most off the shelf stuff yet they have some of the jankiest software and English translation known to man.
> RIGOL says they would reply in 2-3 days, 1/28/23
> Full disclosure, 2/8/23
Those should be January 28 2023 and February 8 2023, which is the date of the post. It's only 13 days after the last communication from RIGOL, not months.
By the way, could at least us developers use ISO dates instead of whatever our local conventions are?
3 months of total stalling without a real reply to him. The last communication was only that they'd provide more details in a few days.
The fact that he asked again before the disclosure timeframe and they were like "uh, just give us a minute" doesn't change anything.
2023-28 and 2023-39 aren't any more readable.
RFC3339 is compatible with "the good parts" of ISO8601 and it's also free.
P.S. sorry for the american time dates, I don't know what I was thinking lol.
sprintf(&CMD_BUF,"echo admin:%s > %s",pass1,path);
system(&CMD_BUF);
You've probably heard of useless use of cat, but this is a useless use of echo. Given that the code even opens the file in question several lines above, I'm surprised that the author didn't know about fprintf.Never connect these things to the internet or any untrusted network. Last thing you need is a 10k instrument bricking itself.
Besides, if I were on a red team, I'd enumerate all devices on the LAN as well. Simply to look for all that old cruft someone set up years ago and never updated... that's where you get persistence. No one goes and checks 'scopes, network gear or printers for indicators of compromise in their firmware, because no one thinks of them if the admin isn't looking for outgoing Internet traffic.
Times have changed a lot in the past decade. No reasonable network admin would be giving public IPs to everything that connects to the network any more.
IPv4 addresses are also scarce relative to a decade ago.
Even then, though, the downsides of consumer network security (mostly) relying on NAT were obvious. Common ports (80, 25, etc) were blocked inbound; the school's printers basically had to be on their own network, or get spammed all day.
You are speaking about academia. It's not mutually exclusive, but it's different then out there in the wild.
It is indeed a different environment.
Instead, you should put a default-deny rule on your firewall for all incoming traffic to user devices (which is generally the default setting anyway).
Coupled with "NAT isn't a firewall", assigning actual IPs to your end devices isn't all that silly if you happen to have a few million to spare.
Here is a service that will show you both your public IPv4 and your public IPv6 address.
Still, that's the only nmap-in-a-website I'm aware of. There are probably others.
Does the nmap scan work on IPv6? That site might actually only be IPv4...
At the end it said
Nmap done: 0 IP addresses (0 hosts up) scanned in 2.20 seconds
Even though it claims to support IPv6
Also the site spent a whole lot of time showing progress bars and stuff.
Whereas when I run Nmap from one of my servers on the internet against my public home IPv6 address
% nmap -6 -A -T4 2a0c:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
I get: Starting Nmap 7.94 ( https://nmap.org ) at 2023-07-16 17:43 CEST
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 2.23 seconds
So in conclusion yeah, that site you linked was not able to scan IPv6I think better than that online version of Nmap is to run Nmap from another computer on another IPv6 enabled network against your own public home IPv6 address. Assuming you have additional computers like a server or a VPS, etc. Same way I did.
Another possible alternative is to use shodan.io and check what they have found in their past scans for your IP address. Seems that shodan requires creating an account now in order to use it. Not sure if it did before. I remember testing shodan.io a few years ago but don’t remember if I had to create an account then.
Also I'd be extremely surprised if Shodan had anything on your IPv6 address.
Nmap done: 0 IP addresses (0 hosts up) scanned in 2.20 seconds
And mine:
Nmap done: 1 IP address (0 hosts up) scanned in 2.23 seconds
And note that 0 IP addresses scanned is exactly what you get if you run nmap with an IPv6 address as target but without the -6 flag. They probably are doing just that; running nmap without the -6 flag.
But let's try something else.
% host google.com
google.com has address 142.250.184.14
google.com has IPv6 address 2a00:1450:4003:808::200e
google.com mail is handled by 10 smtp.google.com.
% nmap -6 -A -T4 2a00:1450:4003:808::200e
Starting Nmap 7.80 ( https://nmap.org ) at 2023-07-16 16:53 BST
Nmap scan report for mad06s10-in-x0e.1e100.net (2a00:1450:4003:808::200e)
Host is up (0.032s latency).
Not shown: 998 filtered ports
PORT STATE SERVICE VERSION
80/tcp open http gws
[...]
Nmap done: 1 IP address (1 host up) scanned in 76.10 seconds
And now try putting 2a00:1450:4003:808::200e into their web tool and see what they report.At the moment their website will get 0 addresses scanned for that as well.
Nmap done: 0 IP addresses (0 hosts up) scanned in 1.58 seconds
Agree nmap from another machine is best but that's not always an option. I'm thinking like if I am on hotel wifi or something. I might not have easy access to another box.
Shodan is a great suggestion.
In the network path. On the device. They control what packets get allowed or denied.
So, to have any way to connect back to my home network I have to run a permanent vpn to a server in aws and connect to that.
NAT on IPv4 vs stateful routing on IPv6 is a wash in terms of performance.
Low end home routers have tiny connection tracking tables and fall back to software routing when that table overflows. IMO if you don't notice the massive drop in performance when this happens, you have very low standards/expectations for internet latency. In had to upgrade to a prosumer router just to get acceptable perf on IPv4
Security vulns happen, but come on, this is the basics.
Unlike the games industry there isn’t nearly as many people drawn to writing the shitware on a consumer router or cut rate oscilloscope.
I'm not giving you a justification, I'm telling you how it is.
> Real engineers don't get away with fuckups with real consequences because of their salary.
I mean they absolutely do.
What is a "real" engineer anyway? I am a licensed engineer (electrical) because I used to work independently as an engineering firm. I understand the various definitions.
The overwhelming majority of those with a title of electrical or computer engineer do not have any kind of professional licensure or certification - at best they may have an accredited 4 year degree.
None of these people are going to be personally liable for fuckups of any kind in their careers.
Just last year I casually inspected and found an RCE in a decade old consumer product just sitting there in plain sight:
http://www.hydrogen18.com/blog/hacking-zyxel-ip-cameras-pt-1...
It’s much easier to create secure web apps using C#, compared to cgi-bin written in C for lighthttpd web server.
The result is that you can get a hell of a lot of scope for very little money, but don't expect it to offer things like "robust security".
That's the kind of thing that makes this site special.
No, this is not Linux zealotry, I also advocate against using Linux as a daily driver on a modern laptop.
The right tool for the right job: OpenWRT on routers, Windows + WSL on laptops.
But, you are asking, how do you use your Windows laptop like this when away from home?
Easy: GL.iNet has tiny travel routers with OpenWRT supported out of the box.
If it works just as well and floats my boat, why change to windows?
I'm sure there are plenty of people that never have a problem with Windows and that can't get Linux to work on their hardware but I'd be careful to generalize from personal experience.
It supports modified OpenWRT with proprietary drivers, which are closed source. Still better than completely black-box travel routers but /shrug.
From https://github.com/gl-inet/glbuilder:
> Since the driver part uses the driver code maintained by many chip manufacturers, we have no right to open it to users. We have tried to provide it to users in the form of ko, but we will always encounter many strange problems.
Why would you do that?