A Chinese security team had recently hacked into a Tesla car driving on autopilot from a distance of almost 20 kilometers. According to a blog post from the Keen Security Lab, the team was able to remotely control the vehicle’s brakes, dashboard computer, side mirrors and door locks in the Tesla Model S in both “parking and driving mode”.
“It is worth to note that we used an unmodified car with the latest firmware to demonstrate the attack,” the hackers wrote. “We have verified the attack vector on multiple varieties of Tesla Model S. It is reasonable to assume that other Tesla models are affected.”
In a video posted to YouTube, the hackers demonstrated the remote operation of the car in a carpark at low speeds “for safety”.
Here’s their full demonstration video:
Tesla reported that the hackers were able to gain access to the vehicle via a malicious wi-fi hotspot, and then a web browser.
How the Tesla S Got Hacked
To understand how code signing stymies car hackers, consider the blow-by-blow of the Tencent hackers’ attack, which they broke down for WIRED in a series of emails.
The hackers first dug up a vulnerability in the Tesla S’ browser, which is based on the open source browser framework WebKit. That bug allowed them to start running malicious code in the browser of any Tesla that visited a carefully crafted website.
To demonstrate how a Tesla driver could be tricked into visiting a sabotage site, the hackers created their own Wifi hotspot with the name “Tesla Guest,” a common Wifi network name at Tesla dealerships, and enabled access with the commonly shared password for dealership guest networks, which they found on the web.
They configured their hotspot so that any Tesla that auto-connects to the network would immediately load their malicious page. “When the browser is on, its web access traffic will be redirected to our payload. Then PWN!” writes Samuel LV, the director of Tencent’s KeenLab security team, using the hacker jargon “pwn” to mean “hack” or “take control of.”
(Tesla and Tencent disagree as to whether the trick works without any interaction on the part of the user. Tesla claims the user would have to manually connect to the malicious hotspot and then navigate to an infected website. The hackers have argued the point with Tesla founder Elon Musk on Twitter.)
The Tencent hackers then used another vulnerability in the Tesla’s Linux operating system to gain full privileges on the car’s head unit, the computer in its dashboard.
But even then the group couldn’t send commands to critical driving functions like steering and brakes: The Tesla S’ head unit is separated from its CAN bus by a computer Tesla calls a gateway, which only allows certain commands to be sent from the car’s infotainment system to its driving components. To defeat that safeguard, the hackers simply overwrote the gateway’s firmware with their own. Without code signing, nothing prevents that tactic.
Intruding any system as multifaceted as a car’s required digging up not just one vulnerability but a series of vulnerable bugs that created a way through the target’s network of defenses.
So when researchers at the Chinese firm Tencent revealed they could burrow through the Wifi connection of a Tesla S all the way to its driving systems and remotely activate the moving vehicle’s brakes, they eventually exposed a chain of security problems.
Tesla could have reacted by fixing any one of the bugs to block the attack. Instead, it went further, implementing a more fundamental security feature that will make the next hack of its vehicles more difficult for even sophisticated hackers to pull off.
Tesla added a measure that requires any new firmware written to components on the CAN Bus—the internal network of computers that control everything from steering and brakes to windshield wipers—be digitally signed with a cryptographic key only Tesla possesses.
The new protection, known as code signing, was pushed out wirelessly in a software update earlier this month to all Tesla S cars and Tesla X SUVs. It amounts to far tighter control over who can reprogram sensitive components. The upgrade makes Tesla’s in-vehicle security systems less like a malware-prone Windows PC and more like a locked-down iPhone.
“Cryptographic validation of firmware updates is something we’ve wanted to do for a while to make things even more robust,” says Tesla’s chief technical officer JB Straubel. Straubel notes that Tesla has been working on the code-signing feature for months but accelerated its rollout when the Tencent hackers reported their attack.
The Tesla security team pushed the fix to all Tesla S and X vehicles within ten days. The feature, he says, should be considered a standard for the auto industry, hardening cars’ internal networks even against hackers who have found an initial foothold in the form of another software flaw. “This is what the world needs to move towards,” Straubel says. “Otherwise the door is thrown wide open anytime anyone finds a new vulnerability.”
Why Your Car’s More Hackable Than Your iPhone
In fact, code signing has been a widespread feature in PCs and smartphones for years. It’s what prevents you from installing an app on your iPhone that didn’t come from Apple’s App Store and triggers the warning about an untrusted application in Windows or MacOS when you install a piece of software downloaded from the web.
But as vehicles have become increasingly more digital, automated and Internet-connected, code signing’s cryptographic trust feature has been conspicuously missing from major automotive vendors’ digital defenses.
Exactly which automakers implement the feature is tough to track, given the companies’ lack of transparency around security. But the Chevy Impala that researchers hacked via OnStar in 2010 lacked code signing. So did the 2014 Jeep Cherokee that hackers hijacked on the highway last year in a demonstration for WIRED.
The Jeep hack might still have been possible even if Chrysler had used code signing to protect the vehicle’s CAN network, says Charlie Miller, one of the two hackers who developed the attack. But, Miller adds, “It would have been so much harder we probably wouldn’t have bothered trying.”
Still, major carmakers have resisted recommendations to implement code signing, says Josh Corman, a founder of the Internet-of-things security nonprofit I Am the Cavalry.
That’s due in part to their disparate supply chains, dealers, aftermarket tools, and mechanics, all of which would be affected if a Detroit giant started requiring the same cryptographic validation of software changes that Apple does. “Tesla’s span of control over its parts and suppliers and dealers may afford a better security response,” says Corman. “Their ability to be nimble is objectively greater.”
A Big Fix For a Big Problem
When Tencent KeenLab team shared its attack technique with Tesla earlier this month, Tesla quickly created patches for the browser vulnerability and the Linux kernel flaw.
But it also rushed to fix what CTO Straubel describes as the most serious problem the Chinese hackers exposed: The ability for any hacker who gets deep enough into the vehicles’ systems to rewrite the firmware of the driving components. “The browser vulnerability is not the real issue,” Straubel says. “We felt it was most relevant to respond to the piece that’s the real risk.”
Straubel credits KeenLabs’ researchers for kickstarting Tesla’s move to push out its code signing upgrade. He says Tesla will pay KeenLabs’ team a monetary reward for its work as part of company’s bug bounty program. “They did good work,” Straubel says.
“They helped us find something that’s a problem we needed to fix. And that’s what we did.” And if the rest of the auto industry is paying attention, they might take the lesson of that Chinese hack to heart, too