11 ms·
Hacking a VW Golf Power Steering ECU
- ewagsjr 5y agoAs cool as this is, I will never EVER hack/jailbreak car steering. I can't put my faith in unsupported (non-OEM may be a better term for it) software keeping me safe. I watch the tesla autopilot videos of them totally messing up and that is fully supported but still failing too much. But cool POC for sure.
- joshenders 5y agoWhat did you get your elevator operator for Christmas?
- therealcamino 5y agoWell, presumably you're not letting your neighbor down the hall flash your elevator's firmware. He/she said non-OEM.
- bri3d 5y agoThis is probably one of the best write-ups I've seen around the basics of automotive control unit reverse engineering. More modern VW control units are the same in broad strokes - they use UDS on ISO-TP instead of KWP on TP2.0, but this is just evolution of the same fundamentals. And instead of the wacky SGO format inside of FRF update files, they use the ASAM MCD-2 D-ODX format to define flashing layers. Most European automakers are similar. One interesting difference and trend in automotive control modules (also mentioned in Willem's fantastic write-up) is that many EU modules started adding signature checking and encrypted updates in the late 2000s, while most US and Japanese automakers have only done so in the last 2-3 years. These encrypted and signature checked updates are by and large still fairly vulnerable - often due to logic errors in the complex upgrade processes and occasionally due to a strange insistence on using RSA using PKCS#1.5 with e=3 and inadequate padding validation.
- ptsneves 5y ago> One interesting difference and trend in automotive control modules (also mentioned in Willem's fantastic write-up) is that many EU modules started adding signature checking and encrypted updates in the late 2000s Do you mean the XOR encryption used? As someone working on the embedded linux(!= than embedded MCU) side i was very surprised to find such a crude "encryption" scheme employed. On the other hand i reckon there is only so much encryption an 8bit MCU can do. Also tolerance for complex encryption designs must be very low when you are trying to limit the scope of a life critical component. The anti brute force measure was a bit more refined and almost got the job done. Regardless, i agree. An great write-up. The binwalk and narrow down of possible CPUs used due to the ASIL-D constraint were really illuminating.
- pd0wm 5y agoThe XOR encryption was just for the update container. Newer update files usually employ some stronger forms of compression/encryption. However, it's usually some strange in-house crypto, so eventually people figure it out. bri3d refers to using RSA signatures on the firmware once it's written to the flash. By ensuring the firmware is signed using the manufacturers private key it should (in theory) prevent messing with the firmware, even if all encryption/flashing steps have been reverse engineered. Some interesting reading: https://github.com/bri3d/VW_Flash/blob/master/docs/docs.md https://github.com/bri3d/VW_Flash/blob/master/docs/docs.md https://github.com/jglim/UnsignedFlash https://github.com/jglim/UnsignedFlash
- chrisseaton 5y ago> Do you mean the XOR encryption used? As someone working on the embedded linux(!= than embedded MCU) side i was very surprised to find such a crude "encryption" scheme employed. I'm not a cryptographer - but I don't think there's anything wrong with XOR encryption, and I'm not sure why you're putting it in scare-quotes - XOR with a sufficiently large key is absolutely fine, and with a one-time pad is unbreakable. XOR with very large keys is how critical military encryption systems such as radios work.
- 5y ago
- blincoln 5y agoThis may go without saying, but a word of caution for anyone who wants to try this themselves: doing any sort of automated scanning of ECU hardware (e.g. the equivalent of trying to find undocumented opcodes in a CPU) stands a good chance of bricking the hardware (permanently), so plan to buy several of them if you want/need to go that route.
- j4hdufd8 5y agoWhat does it mean to permanently brick the hardware?
- emidln 5y agoMost ECUs have diagnostic messages that can read/write memory. This is often intended to be controlled by what "mode" the ECU is in (manufacturing/engineering/production/dealer-service), but these aren't always well tested or properly implemented controls. Fuzzing these leads to weird behavior and state machines with not-well-tested transitions. Whether you can reset these to a known state is ECU specific, and often will involve knowledge that isn't publicly known.
- jacquesm 5y agoAnd sometimes it will require gear that isn't publicly available.
- deleted 5y ago[deleted]
- balls187 5y ago> What does it mean to permanently brick the hardware? Colloquially means rendering a device in useless state which cannot be recovered. "Bricking" typically occurs when performing some sort of software update that goes awry, such as during powerfailure, using unofficial updates, etc. More and more systems have ways to recover from a bad update, especially when the manufacturer offers OTA updates, but in the case like article where an the ECU is not designed to be updated by end-consumers, a bad flash/update can lead to the device being left useless.
- marcodiego 5y agoPower Steering ECU... this things determines how the driving wheel makes the car turn. Safety issues must be considered.
- bob1029 5y agoI will never purchase a vehicle for my own purposes that does not use hydraulics for brakes and steering. Putting a computer between my foot/hands and the physics unfolding in front of me is a total non-starter.
- deleted 5y ago[deleted]
- Veritio 5y agoDo you consider an automatic emergency break as less reliable than it helps? Because we do have a lot of numbers on cars were there is a computer in-between. Which should indicate to me that it is safer to drive with one instead of without one. Like just yesterday (I'm driving a new car) I thought about emergency breaking automatic vs. manual and I actually feel safer knowing that the car can potentially break faster. In the brochure of my mother's potentially future car, it actually advertise emergency breaking with emergency steering to drive left or right. I also found that quite good to have as it should be able to determine much faster if it can evade and where to evade. Or do you mean this different?
- bob1029 5y ago> I thought about emergency breaking automatic vs. manual and I actually feel safer knowing that the car can potentially break faster. For me, the knowledge that some other engineer designed a system that is a complete black box (from my perspective), which can arbitrarily stop my car with incredible braking force is terrifying. What happens if the emergency braking system decides to have a bug while you are exiting the freeway at 75mph?
- l33tman 5y ago
- Veritio 5y agoWhile I find this quite interesting, a street is not a lab. He should not do this on any public road and potentially he broke already some law.
- birken 5y agoThe driver is always responsible for what their vehicle does. As long as the driver can override the steering (which they can), then there is really nothing to be concerned about. This is the same for cars using openpilot, or Tesla's self driving systems or any other steering assistance features.
- l33tman 5y agoThis seems like a bit of an over-simplification.. A car needs to be type approved to run on our streets and the insurance companies need to accept whatever you did to the car in case of a crash. You don't really want to end up paying 100% yourself when you crash into that school bus with your mod. However it would be interesting to learn how type approvals handle the self-driving things. Maybe they really do allow all kinds of computer-assisted things? I don't know. If you change some structural beams in the car you surely lose approval. But can you mod steering and braking? What about openpilot users that crash?
- oceanplexian 5y agoYou can do a thought experiment where some esoteric firmware modification results in an accident, but it's 1000x more likely that Joe Sixpack spaces out while driving, runs a red light, and crashes into a busload of kids. Once we've solved that problem, drunk driving, distracted driving, poor driver education, and thus eliminated 99.9% of accidents, then it might make sense to have a debate about those pesky car modders or edge-case Tesla autopilot failures that are responsible for the last 0.01%.
- the_pwner224 5y ago> As long as the driver can override the steering (which they can) EPS is much more powerful than humans. It can apply huge torque and cause incredibly fast acceleration of the steering wheel (from full lock on one side to the other in a split second). Messing with the firmware definitely could cause a situation where the car just does whatever it wants to and the driver can do nothing about it.
- markus_zhang 5y agoOne question: in part 2 it shows that Ghidra is able to produce disassembly from machine code, does that mean Ghidra knows the instruction set V850 uses?
- pd0wm 5y agoGhidra uses an intermediate language called p-code. When defining the CPU opcodes (and how to parse them), you also write a small snippet of p-code that represent that instruction. This makes the decompiler architecture agnostic. Example: https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra/Processors/V850/data/languages/Instructions/Arithmetic.sinc https://github.com/NationalSecurityAgency/ghidra/blob/master...
- markus_zhang 5y agoThanks, I see. So it means anyone can add any architecture to Ghidra.
- deleted 5y ago[deleted]
- formerly_proven 5y ago> The electronics seemed to be fabricated using bare dies attached to some substrate, probably to lower cost and improve reliability at higher temperatures. The board is made up of two parts, a low-power part with the CPU and CAN transceivers, and some high-power part with 6 MOSFETs forming a three phase H-Bridge. > https://blog.willemmelching.nl/images/vw/IMG_3181.jpg https://blog.willemmelching.nl/images/vw/IMG_3181.jpg It doesn't really look cheap to me (large machined surfaces on the cast aluminium casing, two ceramic PCBs, everything connected with wire bonding, even the motor windings and the external connector, which means that at least those bonds are carried out on an almost completely assembled product; also look at the sheer size of the motor bonds) but it does look very reliable - everything is bonded or welded, zero connectors, no fasteners, all solid state.
- stephen_g 5y agoYeah, it looks like it's extremely optimised for reliability. The construction reminds me of some of the space stuff I'd seen made by a company I worked for (it was all done before my time though). It probably wouldn't be incredibly expensive in this case (automotive) because all the wire bonding and tab welding can be automated, but clearly cost isn't the main concern behind the design!
- t0mas88 5y agoAutomotive has quite broad temperature and vibration requirements and is supposed to work for 15 years+ so it makes sense to pick something like this.
- unbanned 5y agoFerrari used this method for their ECUs in the 360 to reduce risk of damage from vibration and heat.
- terr-dav 5y agoAh, so they're designed to be on fire.
- 5y ago
- torquemodwanted 5y agoI'd love to do a torque mod on a modern Honda EPS, but there's simply no easy way for a "normal" person do it. The amount of time and effort is extreme with no background knowledge of the problem. (Yes, I understand there's liability, etc.). It's completely taboo in openpilot discussions (e.g., the Discord channel), so I'm curious if there's an alternative community open to talking about it (distributing pre-patched or providing a patcher). For Honda cars at least, openpilot is absolutely hindered by the low torque allowed by the stock firmware.
- olivermarks 5y agoGreat write up which also illustrates how deep DRM/closed systems are in cars built this century. Until around mid 90's cars still had lots of relays and barely comprehensible wiring looms if you could get your hands on workshop manuals. The sooner we go back to a BEV with the simplicity of a 1960's VW Beetle the better imo, not least so that the third world can get a look in.
- Beached 5y agopretty sure this won't happen. regulations require computerized standards to be used for various parts of a cars functions. this would require some insane lobbying to pull off.
- t0mas88 5y agoSo far electric vehicles are getting worse not better, because they're less regulated on things like OBD access. And manufactures see them as a chance to make an always connected car that phones home. Tesla was first but everyone else is copying them now.
- grishka 5y agoIt's not like you can't disable these network interfaces one way or another. And of course it'll still work without this connectivity.
- trulyme 5y agoFor now. Like web pages used to work if you disabled JavaScript.
- grishka 5y agoThis is different. Cars could potentially be driven far away from civilization, so their reliability is sometimes critical for their occupants' survival. A car can't disable itself and leave people stranded in the middle of nowhere just because it doesn't have a cellular signal to phone home. And btw, many web pages do still work if you disable js. I'm saying that as someone who routinely disables js for websites that abuse it.
- mcguire 5y ago"After convincing the dongle to connect (even though most of the car was not present on the CAN bus) it was able to show some diagnostics information about the ECU." I am picturing this as a scene out of a '50s sci-fi horror movie. The mad scientist with a power steering controller on a tray in his lab. :-)
- PaulHoule 5y agoBeing willing to buy a second copy of the system you are hacking on is one of those things that separates the men from the boys or those who succeed from those who fail.
- phkahler 5y ago>> Only try this on an actual car if you know what you’re doing. Even though only two very small patches are made to the model specific calibration values, making changes to your EPS might have unintended consequences. The author has no idea what he's doing, or more specifically what hazards might be lurking right under his nose. I worked in EPS for 6 years and it's all really cool stuff right up until you download code and it promptly turns left all the way to the stop the first time you touch the wheel. That was a bug ;-) I can't tell you how hazardous it may be to tweak tuning parameters - that depends on a lot of things. Tuning aside, just commanding it over CAN might allow you to do things that wouldn't normally happen and might damage something - i.e. are all protections still in place when taking an external command? I didn't work on this model, or at this company, I'm just saying I've seen a lot of stuff and wouldn't recommend messing around with safety-critical ECUs like this.
- pd0wm 5y agoIn this case the EPS already came stock with the functionality to request torque over CAN, that part of the code or the amount of torque was not touched. I agree it would not be a good idea to patch that functionality into an EPS that doesn't come with that from the factory.
- phkahler 5y agoOne system I know of had to have software to reduce torque at the end stops or it could destroy FETs and shut down. If this system needed such protection, we might wonder if its included when taking external torque commands. I would if I wrote the code, but you never know when operating outside their expected use cases. It's also much more benign to destroy components than to have actual bugs. And he's not changing software at the source level.
- deleted 5y ago[deleted]
- userbinator 5y agoand it promptly turns left all the way to the stop the first time you touch the wheel. I bet many have had nearly the same experience with rebuilding a power steering gear... yet that's no justification for taking away control from the things you own. "Life is risk, risk is life."
- Txoko 5y agoAny Mercedes hacks?
- MuffinFlavored 5y agoVery few ECUs have CCP/XCP writing wide open. A lot of magic is in the area of defeating the cryptographic signature check on the device (hash of flashed contents).
- nnadams 5y agoThis is true, although in a previous job I was surprised to be working on systems that could receive steering commands with unencrypted CAN messages. As others have mentioned most USA manufacturers are moving to encrypted CAN buses now though.
- fnord77 5y ago> Unfortunately, steering commands are not accepted after 6 minutes of continuous operation or below 50 km/h. is this for safety or does the duty cycle of this require some off-time for cooling or whatever?
- Nextgrid 5y agoI think the 6 minute timeout it could be a fallback mode in case the component sending the commands malfunctions and keeps spamming the same command in a loop over and over again. Granted, if this happens while driving you're likely to have an accident anyway, but if you don't, then waiting 6 minutes would allow you to reclaim your steering for the rest of the journey.
- omginternets 5y agoThis is timely! I just made the decision to buy a car (either a 2021 or 2022 Subaru WRX, most likely), and have been curious about hacking the ECU, CAN bus, etc. I’m aware that tuning is a thing, but it’s generally not my scene. What I really want is to do the work myself instead of going to a tuner or buying one of those Cobb kits. Can HN recommend any resources and/or other technically-oriented communities?
- symlinkk 5y agoNASIOC is the oldest WRX forum on the internet, you should find a lot of knowledgeable people there.
- l8rlump 5y agoAs far as I'm aware for Subarus, Taxtrix Openport 2.0[1] is popular with modders and seems to have good software/workflow. Through this article though I discovered the Panda[2]. It reportedly does J2534 and I wonder if this means it can use the same workflow. The price of the white Panda is attractive. I'm not sure if Openport is still actively developed. Oh, and stay away from the cheap clones. They're reportedly not good[3][4]. Does anyone have experience with the Pandas for remapping and use as a diagnostic tool? [1] https://www.tactrix.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=17&category_id=6&option=com_virtuemart&Itemid=53&redirected=1&Itemid=53 https://www.tactrix.com/index.php?page=shop.product_details&... [2] https://comma.ai/shop/products/panda https://comma.ai/shop/products/panda [3] https://www.youtube.com/watch?v=N4XJSuh10Xs https://www.youtube.com/watch?v=N4XJSuh10Xs [4] https://www.youtube.com/watch?v=jTNHqRYmzrk https://www.youtube.com/watch?v=jTNHqRYmzrk
- omginternets 5y agoThis is so cool! Thanks a million! Is there a place where one can download ECU mappings for various car models? Maybe this is silly, but it seems like there ought to be some kind of community-maintained repo, no?
- l8rlump 5y ago
- nickysielicki 5y agoI just bought a comma panda because of this blog post. Looking forward to car hacking.
- jazdw 5y agoGreat write up! I am the author of the TP2.0 page you linked to. I went through a very similar process to you, ended up disassembling the code for a Siemens PPD ECU (PowerPC architecture from memory, it was about 10 years ago) so I could turn of the DPF regeneration functionality.