243 points · by svenfaw · 11y ago · 121 comments
D-link has accidentally published private keys for certificates which they use to sign their software. It was possible to extract the keys from the manufacturers open source firmware packages. That made it possible for Criminals to abuse the certificates.
[short explanation of how the certs work for n00bs]
The mistake was find by bartvbl who informed the reporter of the problem. He had bought a D-Link DCS-5020L security camera and wanted to download the firmware. D-Link makes the source from lots of firmware available under a GPL license. "After looking through the files it turned out that the they contained the private keys which are used to sign the code" reported bartbvl, "It gets worse - some of the batch files contained the commands and passphrases that were needed [to sign the software".
The user was able to confirm that the key could be used by signing a file that wasn't from D-Link. The certificate expired at the start of september, which means that the trick no longer works. Even now that the expiry date has passed, software which has been signed will still be seen as being valid. Windows only shows a certificate error after the certificates have been withdrawn. This withdrawal has already happened so this [bug/failure] cannot be abused.
Software security specialists Fox-IT confirm the findings. Yonathan Klijnsma, a researcher from the company: "The certificate was indeed in one of the firmware packages, version 1.00b03, the source of which was released on 27-feb-2015. The cert was thus published before it expired, which is a big error". He [, Yonathan,] found four other certificates in the same folder.
D-Link have in the meantime released new versions of the firmware which do not contain the certificates. In a statement the company told us that they regularly update the firmware in order to 'conform to the latest security and quality standards'. They emphasized that there is no question of [malicious] premeditation. "D-Link [does everything to prevent development of backdoors, bla bla boilerplate PR speak, etc etc]". D-Link promised Tweakers that they will release a new firmware next week which contains further fixes for the security problems.
A company finally holds up their end of the GPL by including all source needed to create a working build, and it's called a mistake!?
For every device requiring images to be signed with a specific key, this is exactly what the manufacturer should be forced to release!
> For every device requiring images to be signed with a specific key, this is exactly what the manufacturer should be forced to release!
What do you mean by "should" here? If the source is covered by GPLv3, then yeah, if they use code-signing they need to have some way to let you get around it. That's the point of the anti-tivoization clause. But if the software is distributed under GPLv2, or any other license, then there's no anti-tivoization restriction, and therefore no "should" about it.
Yes, which is blatantly anti-GPL2. I really wish any Linux copyright holder would step up to the plate and force the argument that since code+signature is the functional unit, adding the signature makes a derivative work and its source must be released in the preferred form for modification. The entire point of the GPL2 is that a developer who creates code and receives a modified version back should be able to modify that instance of code - tivoization is entering into the license in bad faith.
Of course going GPL3 would make for a more solid foundation for doing so, but clarifying this subject directly conflicts with the desires of the proprietary sponsors - Google etc.
IAAL (and an open source licensing lawyer at that, for many years). I'm also a contributor to FSF projects :)
Even I would tell you the GPLv2 almost certainly does not cover code signing.
It's actually very epxlicit about what needs to be there: That's the whole problem with gplv2: " For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable."
That's it. It very clearly and explicitly says what you must include, and installation keys in not there.
It even says 'scripts used to control installation", not "scripts involved in installation" or anything like that.
No it's not. It's anti-GPLv3. GPLv2 absolutely allows tivoization. Stallman thinks this is bad, but not everybody else agrees (I know Linus Torvalds thinks tivoization is fine in the context of GPLv2, and I believe the FSF agrees).
> I really wish any Linux copyright holder […]
Your argument here is not a legal one. Any Linux copyright holder that did this would lose horribly. And in particular, Linus Torvalds explicitly stated that he does not support relicensing the Linux kernel under GPLv3 because of this (even if it were possible, which it isn't because of the very large number of copyright holders). Source: https://en.wikipedia.org/wiki/Tivoization#GPLv3
> The entire point of the GPL2 is that a developer who creates code and receives a modified version back should be able to modify that instance of code
And they can! But the GPLv2 does not require that the modified code must be able to be installed back on the original hardware by the person doing the modification.
> tivoization is entering into the license in bad faith
Not by any legal definition of "bad faith", and even with the informal definition, a lot of people would disagree with you.
The correct solution to this problem is to release a tool for people to change the code signing certificates on their devices to ones which they control, and to arrange for this tool to require a reasonable level of physical access so that it cannot be used remotely. Then device owners can have code signing security on their own terms and be confident that only their own trusted builds can be pushed to their devices via remote updates, which is a super useful feature when you have more than two devices.
Then there can either be an option to disable this check or a large warning that is produced when you try to install unsigned code. There's really no point in code signing if everyone has access to the private keys.
(Basicly he doesn't consider tivoization to be that much of an issue, and doesn't consider it to be something he wanted when he selected the GPLv2)
See, I bought this WNDR3800 off Ebay, because I wanted to put OpenWRT on it. Its compatible. But I made the mistake of buying a used router that was managed by a ISP. They built their own firmware and purposefully made the firmware updater require specific headers in the firmware package. Now I can't update this device to OpenWRT, without some very specific hacking and compiling my own version of OpenWRT.
Who owns this hardware? I bought it. I paid for it. Its in my house. But apparently this ISP is truly the owner and I can't do anything that I wish with this device.
The firmware is based on Linux, the ISP of course hasn't released their source. The only way I know about the header bit is because somebody else figured this out years ago and there is a single message on a random web forum detail it.
Presumably, the "openness" of the original device running Linux is what allowed them to build their own custom firmware in the first place.
The important point here is that vendors aren't locking down their firmware because they're control freaks that hate when customers install modified firmware, it's also a big security hole. If you can replace your firmware with a modified copy, so can anyone else who manages to gain access to your device. There's other angles too of course, such as vendors who offer unique hardware may want to require their customers to always be using that business's products, as that's how they make money, but when we're talking about generic equipment like routers, the most important reason is security.
This argument breaks down when you're not talking about the manufacturer -- at the time the ISP made that modification, they bought it. They owned it. Should they not be permitted to do what they like? Should you not be permitted to write your own firmware which requires headers?
Maybe it's just me, but this seems like an easy thing to get over by buying some different hardware. Instead of stressing out about this particular WNDR3800, focus your angst on the general case, which is the FCC's attempt to make it illegal to upload custom firmware to any router.
Don't try to make a "freedom" argument here. Vote with your Value and buy an unlocked piece of harware.
You're right about GPLv2 — vendors are not legally forced to provide any way to load modified binaries (that's the primary reasoning to license software under GPLv3). Yet, there is a belief that every hardware manufacturer should do so to respect the customers freedom to tinker with the device, especially after the support from vendor is gone.
Only if its a consumer product by the specific rules used in the GPLv3. Business products under the GPLv3 don't require that.
The keys for official releases are supposed to be kept by a trustworthy senior management or some people with highly restricted privilege. Also the software/firmware shipping process must be well audited if there are serious (not just pretending to be) security requirements. The keys should not be exposed to a random technician or a new hire who can possibly responsible for destroying your and your clients' businesses. It looks like they didn't have a quite "formal" shipping flow at least in this case.
Since most routers dont require signed firmware this just makes the few that does as bad as them.
Personally i would think the likely hood that the key would be used for good(Open WRT) is far greater than that it would be used for bad.
On a general note:
Consumer routers are in my experience generally very easy to hack in to stuff like http://192.168.1.1/setting.cgi?setname=`echo 'password' | passwd` is not uncommon so altering the firmware is seldom needed.
> since the parent poster seemed to feel the need to use an extremely uncommon acronym to show his or her superiority.
That was uncalled for, though.
I think "If there's an AWS product for it, it's not that obscure" is a reasonable standard. You could pretty clearly google "keys HSM" and it would show up.
its always felt more like a protection racket to me... especially when you can takes someone's codesigned stuff and resign it. getting the ability to code sign requires just money, time and a bare minimum of paperwork...
the trusted authority on these things is completely untrustworthy by the nature of their business imo.
Very assuring! I am worried about my other D-Link home surveillance cam products now.
Let me remind you this excellent piece: http://www.devttys0.com/2015/04/what-the-ridiculous-fuck-d-l...
Of course it could just be incompetence, but it's particularly interesting to consider the alternative. Seeing all the other companies who have leaked keys, datasheets, and other useful but officially proprietary information on their products, really makes me wonder. Also, those vulnerabilities which allow for jailbreaking and rooting of locked-down devices? Are they also there deliberately? For some reason, I really hope so.