Podcast
Root Causes 240: Hyundai Production Private Key Found in How-to Manual
Hosted by
Jason Soroko
Fellow
Original broadcast date
September 7, 2022
A white hat researcher recently defeated a production automobile's PKI by searching for the private key on Google. Join us as we describe the implementation error making this possible and how it might have come about.
Podcast transcript
Lightly edited for flow and brevity.
TCTim CallanSo, what we wanna talk about today is, I would say, fairly say, a jaw-dropping article, is jaw-dropping a fair description, Jay?
TCTim CallanThat we recently saw in The Register, and this is dated Wednesday, August 17, and here’s the headline: “Software Developer Cracks Hyundai Car Security with Google Search” Thomas Claburn is the author, and um, tell us what we learned from the article, Jay.
So at the highest level, you can imagine that there’s software in your car. Just about every car right now has, in fact, a pile of software, within your dashboard but also, even within the engine management system, so the computers that run your engine. Anyway, it has become common practice after a whole lot of black hats, where white hat researchers have shown you can take control of cars because they’re just so darn computerized and also connected, that firmware running these embedded computers can be messed with, and what I mean messed with, I mean replaced with malicious firmware or all kinds of other techniques that the bad guys or the white hat researchers have. So, it’s a very good practice to be able to Code Sign that software to make sure that it’s legit. The genuineness of the firmware on these computer systems is very, very important.
TCTim CallanNot only does Code Signing show us that the source is legitimate - it’s who we think they are - but it also can help making sure you know when this was timestamped so you can know it’s the current update, and also, you know that the bits in that update haven’t been changed in any way. So those are three very valuable things that get attached to Code Signing your firmware. But go on.
Basically, white hat researcher taking a look directly at the firmware of one of these embedded systems in a car, said, I don’t know where I’ve seen this before or whatever it was. They essentially did a Google search on once they saw a piece of this embedded software and then determined the private key that had signed the firmware was directly out of the example manual from NIST, in other words, 800-38A, which is basically, here’s how you implement PKI 101. And it was literally directly out of that book. In other words, somebody at Hyundai, and believe me, I’m not picking on companies. Computers are hard, Tim. We know this. But it was them. They were listed in this article. First of all, there’s the WOW moment of realizing somebody decided to take a published example in probably one of the most widely read PKI, how to do PKI manuals there is; guidance in terms of how to perform PKI and chose to use not just the technique but chose to use the exact private key example out of the book.
It’s a demonstration of fundamental misunderstanding of what that guidance was trying to give you. It wasn’t trying to give you, here’s the private key everybody in the world should use, it was an example of here’s what a private key looks like, don’t use this but, this is what it is going to look like. Somebody at Hyundai decided to use it literally.
TCTim CallanSo somebody was developing software inside of Hyundai and went in and used the NIST guidance and did not understand - I would contend - did not understand fundamentally what the public/private key exchange was or did or why we have it, when they were working on the software. Or they would have realized that they can’t do this.
TCTim CallanOr at least, somehow, there has to be something in the technology process for a system like this or, if we wanted to argue that this is an IoT device for someone in the IoT space. There’s gotta be something in your technology process where things like encryption and public keys go through some level of technical review, technical understanding, technical audit by the people inside of your organization who get this. And there absolutely are people at Hyundai who understand PKI. It just seems like this bit of software didn’t get under their eyeballs.
TCTim CallanIt could’ve been an OEM. But even if it were an OEM, then there needs to be a process for ensuring that that’s correct too.
Quite often, you would use that, you would hook into that just to say okay, that’s obviously a genuine part that comes from a specific factory, but now for the purposes of what I’m doing with PKI in terms of either encryption or signing or whatever it is you're doing cryptographically, you will then provide you own key pair, and so in this case, wow, did you ever miss that.
TCTim CallanIt’s true. That solves that, doesn’t it?
And even if this were a public/private key pair that had not been published in a place where people can find it, at the end of the day, you're rolling forward with a firmware with a software update system using a private key that was provided to you by an outside party, if this did come from an OEM. If this came from an OEM, then someone decided we’re gonna use this private key that was given to me outside my organization and you shouldn’t do that either, because that now means your private key is exposed.
And even if this were a public/private key pair that had not been published in a place where people can find it, at the end of the day, you're rolling forward with a firmware with a software update system using a private key that was provided to you by an outside party, if this did come from an OEM. If this came from an OEM, then someone decided we’re gonna use this private key that was given to me outside my organization and you shouldn’t do that either, because that now means your private key is exposed.
TCTim CallanYou don’t know how far back and chips go way back. Chips go that far up the chain. So, in the event that something gets incorporated that far up the chain, and if it rolls through, you could see that coming at you. That’s why IoT supply chain, especially for something complex like automotive, is so complicated.
TCTim CallanIs breaking.
TCTim CallanBut that’s dangerous, and that’s scary too because you could have problems. I mean this was some white hat finding it, dinking around with his own car, but, what if we discover that the hard way when cars are going down the Freeway?
TCTim CallanIt’s a legitimate question. Now, I’m gonna ask you one other question. I’m gonna pivot a little, which is to say, was it really important and valuable in the misguidance that their example public/private key pair were in there as real key pairs? Like, could the misguidance simply have said, [insert key here]? Because that would have avoided this problem too.
TCTim CallanI haven’t looked at the actual document, so I can’t comment on whether there’s any explanation in there that says, like, don’t use these, and, and I get that, and they may very well say, we’re writing this document for people who know what they’re doing. If you don’t know what you're doing, you have no business reading this document. Maybe that is a perfectly valid position to take. It just made me wonder if that was an avoidable error, um, or if it would be possible to publish what looked like a public and private key pair that wouldn’t work. That might still accomplish your objective, Jason, of knowing what the blob supposed to look like but you could, if nothing else, what if they didn’t match each other? At that point, you wouldn’t actually allow somebody to make this error. Maybe there were ways that could have been done on that side, too.
TCTim CallanFlip a bit half way through the public key, and you don’t have this problem anymore.
TCTim CallanMmaybe there’s a lesson learned there, too. Maybe if you're providing material to engineers you could also give a little thought about the usability of that material and the way that that too could hit a pitfall. Maybe a little bit of thought to that might be another ah-ha moment out of this. Anyway, very, very interesting article. I think nothing either of us expected to see and it was just like wow.
TCTim CallanThis was, this was surely some kind of process failure that should not have occurred. It’s not like engineers at Hyundai haven’t thought about this. They certainly have a process that they think prevents this kind of outcome, and it just didn’t happen in the case.
TCTim CallanAnyway. So there you go. There’s your gee-whiz moment for the day.