News for hackers. Stuff that matters.
Re:Do not expose your RIGOL oscilloscopes to the internet by Towaway69 on Sunday July 16, 2023 @07:36AM (#36745851)
Nice writeup and explanation how to get firmware outside of the hardware.

Bypassing strncmp was particularly insightful.

Re:Do not expose your RIGOL oscilloscopes to the internet by 13of40 on Sunday July 16, 2023 @10:37AM (#36747494)
Was I reading it wrong, or does the system actually store a clear text copy of the password instead of a hash?
Re:Do not expose your RIGOL oscilloscopes to the internet by Towaway69 on Sunday July 16, 2023 @10:49AM (#36747620)
It would appear to be clear text with the assumption that no one can login onto the device. I assume the manufacturer makes this assumption.
Re:Do not expose your RIGOL oscilloscopes to the internet by galangalalgol on Sunday July 16, 2023 @11:20AM (#36747995)
Storing a salted hash would be nice, but scopes without ntp or internal wall clocks are the norm, so not sure what to salt with. And a plain hash is pretty easy to beat right? As far as getting the hash, these are people who are using oscopes, it doesn't seem unlikely they could jtag it out without some decent safeguards in place. Worrying about physical security on an oscope seems like a bad risk management trade.
Re:Do not expose your RIGOL oscilloscopes to the internet by mlyle on Sunday July 16, 2023 @11:53AM (#36748382)
> so not sure what to salt with

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.

Re:Do not expose your RIGOL oscilloscopes to the internet by meithecatte on Sunday July 16, 2023 @11:03AM (#36747773)
I don't think it's strncmp itself that's the problem. They fucked up and are only checking that the provided password matches a prefix of the stored password. And obviously an empty string is a matching prefix.
Re:Do not expose your RIGOL oscilloscopes to the internet by colonwqbang on Sunday July 16, 2023 @11:49AM (#36748341)
The (decompiled) code looks very amateurish in general. Like, who writes something like system("echo >... or system("sync"). Looks like something written by a very green engineer/intern and not reviewed by anyone else.
Re:Do not expose your RIGOL oscilloscopes to the internet by randomhacker123 on Sunday July 16, 2023 @12:54PM (#36749081)
Sadly this looks like "industry standard" to me. I have seen many embedded Linux devices using mostly C applications and a lot of usage of the system() function with no or very poor input validation before. When you want to exploit embedded Linux devices always look for calls to system() first.

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...

Re:Do not expose your RIGOL oscilloscopes to the internet by jacquesm on Sunday July 16, 2023 @02:37PM (#36750130)
Many of these faults are simply the consequence of never reading the manpage of a function but making assumptions about implementation details of an imaginary version of a function with the same name.
Re:Do not expose your RIGOL oscilloscopes to the internet by fest on Sunday July 16, 2023 @06:16PM (#36751966)
Though, in this case, manpage doesn't exactly spell out that two strings of which one is 0 chars long results in a match.

I often remember my PHP days in horror, but mysqli_query manpage does warn you about SQL-injections now.

Re:Do not expose your RIGOL oscilloscopes to the internet by jacquesm on Sunday July 16, 2023 @09:08PM (#36753001)
It does actually.

"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...

Re:Do not expose your RIGOL oscilloscopes to the internet by fest on Wednesday July 19, 2023 @06:13PM (#36794211)
Of course an experienced developer would have thought about edge cases, but I can see a thought process like: ok, I'm comparing two strings. "" != "123" in languages with built-in string types.

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.

Re:Do not expose your RIGOL oscilloscopes to the internet by colonwqbang on Sunday July 16, 2023 @03:45PM (#36750727)
Embedded Linux engineers in general are not incompetent. Many of us do care about quality of the software we write. Although you are right that there is a lot of dodgy embedded software around, that isn't a reason to accept mediocrity like this in newly written user facing APIs.
Re:Do not expose your RIGOL oscilloscopes to the internet by bri3d on Sunday July 16, 2023 @01:15PM (#36749307)
I have never seen firmware from any vendor in any industry that doesn't use these patterns. There's a lot to unpack culturally around "hardware company engineers" vs "software company engineers," but I don't think this is "amateurish" so far as it is "industry standard from another industry."
Re:Do not expose your RIGOL oscilloscopes to the internet by dmvdoug on Sunday July 16, 2023 @03:54PM (#36750810)
I’m sorry, but your comment came right after the comment thread about a guy printing gay porn and I thought you were making a joke and I was giggling about the firmware and hardware thing and then I realized you were making a serious point.