Reverse Engineering an EV Charger

Andreas Claesson (Security Consultant · mnemonic), Harrison Sand (Security Consultant · mnemonic)

BruCON 0x0F · Day 1

Overview

In an insightful presentation at BruCON, security consultants Harrison Sand and Andreas Claesson from mnemonic delved into the often-overlooked security landscape of Electric Vehicle (EV) charging infrastructure. Their talk, "Reverse Engineering an EV Charger," chronicled their journey of acquiring, disassembling, and deeply analyzing a Zaptec Pro EV charger. This independent research, conducted during work hours and sponsored by mnemonic, aimed to shed light on the security posture of a critical, rapidly expanding segment of modern infrastructure.

Watch on YouTube

Visual summary for Reverse Engineering an EV Charger by Andreas Claesson, Harrison Sand
Visual summary for Reverse Engineering an EV Charger by Andreas Claesson, Harrison Sand

Key moments

  1. 3:00 Why analyze EV chargers? Choosing Zaptec Pro.
  2. 11:40 Physical teardown and identifying internal components.
  3. 18:50 Discovering UART debug interface and login prompt.
  4. 21:50 Desoldering NAND flash to extract firmware.
  5. 30:40 Successfully gaining root access via custom bootloader.
  6. 39:10 Zaptec's cloud debug: remote root command execution.
  7. 41:00 Talk conclusion and security improvement recommendations.

Reverse Engineering an EV Charger

Speakers: Andreas Claesson (Security Consultant, mnemonic), Harrison Sand (Security Consultant, mnemonic)

Conference: BruCON

YouTube: https://www.youtube.com/watch?v=raZHd1Q4Vrc

Overview

In an insightful presentation at BruCON, security consultants Harrison Sand and Andreas Claesson from mnemonic delved into the often-overlooked security landscape of Electric Vehicle (EV) charging infrastructure. Their talk, "Reverse Engineering an EV Charger," chronicled their journey of acquiring, disassembling, and deeply analyzing a Zaptec Pro EV charger. This independent research, conducted during work hours and sponsored by mnemonic, aimed to shed light on the security posture of a critical, rapidly expanding segment of modern infrastructure.

The motivation behind this investigation stemmed from several key observations: the burgeoning EV market, particularly in Norway where over 80% of new car sales are electric; a perceived lack of public security research in this domain; and the entry of relatively new companies into the EV charging space, which might not possess the extensive security maturity of established tech giants. Their work highlights the potential vulnerabilities in devices that are becoming as ubiquitous and essential as traditional fuel stations, emphasizing the need for robust security practices from conception to deployment.

This article details their methodical approach, from initial reconnaissance and hardware teardown to firmware extraction, custom bootloader development, and subsequent analysis of the device's communication protocols and backend integrations. The findings offer valuable lessons for both manufacturers and security professionals, underscoring common pitfalls in IoT device security and proposing actionable improvements to safeguard this vital infrastructure.

Background

▶ Watch: Why analyze EV chargers? Choosing Zaptec Pro. (3:00)

The rapid global adoption of electric vehicles has led to a parallel expansion of EV charging infrastructure. In countries like Norway, where EV sales dominate the automotive market, these chargers are no longer niche devices but critical components of daily life, effectively replacing traditional gas stations. Despite their growing importance, public security research into these devices has historically been limited, creating a potential blind spot for vulnerabilities. Furthermore, many EV charger manufacturers are relatively new companies, which, while innovative, may not have fully matured security development lifecycles compared to more established technology firms. This confluence of factors presented a compelling target for security research.

The researchers selected the Zaptec Pro charger for their study. This model, designed for larger installations such as parking garages or airports, offered a rich set of functionalities that suggested a complex attack surface. Key features included Bluetooth Low Energy (BLE), Wi-Fi, 4G connectivity via a SIM card, and Power Line Communication (PLC), which allows Ethernet-like communication over power cables for load balancing. The charger's architecture involves communication with Zaptec's cloud infrastructure, hosted on Azure, which exposes APIs for third-party integration with payment and management applications like EasyPark and Fortum.

Before acquiring the expensive hardware, Sand and Claesson conducted extensive reconnaissance. They leveraged publicly available documentation, including Zaptec's developer portals with Swagger API documentation and detailed data flow PDFs. They also utilized Certificate Transparency (CT) logs to discover subdomains and internal project links, a technique often overlooked but powerful for uncovering hidden infrastructure. Analysis of the publicly available Android mobile application, decompiled from the Google Play Store, provided insights into BLE functions and potential interaction points with the charger, even without physical access. This preliminary work allowed them to prioritize their efforts and confirm the Zaptec Pro's potential as a research target.

Key Findings

▶ Watch: Discovering UART debug interface and login prompt. (18:50)

The core findings of this research revolve around the successful exploitation of debug interfaces and an unlocked bootloader, which collectively granted the researchers root access to the Zaptec Pro charger. This foundational compromise then enabled deeper analysis of the device's operational security.

Initially, the researchers discovered an exposed UART interface on the main application board. While this interface provided a login prompt and detailed boot logs, initial brute-force attempts against the login failed, and the bootloader was found to be locked, preventing direct interruption of the boot process. However, the presence of an unpopulated SD card slot proved to be a critical vector. By attempting to boot various Linux images, they confirmed the device's capability to boot from an external SD card, provided the correct hardware configuration was supplied.

The most significant breakthrough was the successful desoldering of the NAND flash chip that stored the device's firmware. Using an inexpensive chip reader acquired from AliExpress, they extracted the raw firmware image. This process was complicated by the NAND flash's use of out-of-band data for wear leveling and error correction. A crucial open-source tool, highlighted at Hack in the Box Amsterdam 2019, enabled them to reconstruct a clean, contiguous firmware image by correctly parsing and removing this out-of-band data.

From the extracted firmware, they retrieved the device tree, a critical mapping of the hardware components and their connections. This device tree allowed them to compile a custom U-Boot bootloader with enabled debug options. By loading this custom bootloader onto an SD card and booting the device, they were able to intercept the boot process. They then configured their custom bootloader to point back to the original NAND flash but with the crucial addition of enabling single-user mode in Linux. This bypasses authentication, dropping the user directly into a root shell, at which point they could set their own root password, effectively gaining full administrative control over the charger.

With root access, further investigation revealed several security considerations:

  • Bluetooth Low Energy (BLE): While a four-digit PIN protected local BLE configuration, the PIN was static, device-unique, and printed on the box, with no user-changeable option. Although Brute Force protection was implemented (progressive time delays), the provisioning process occurred at the factory via a local provisioning server, where key material and the PIN were written to the device. The BLE service was implemented in Python using the BlueZ library, passing commands to a local .NET service via DBus. While direct arbitrary command execution was not found, commands like "restart charger" or "trigger firmware update" were available.
  • SSH Connectivity: Password-based authentication was disabled, which is good practice. However, SSH access relied on hardcoded SSH keys provisioned to all devices, meaning Zaptec presumably uses two private keys to authenticate to any of their chargers. This centralized key management presents a single point of failure.
  • Cloud Connectivity (Azure IoT Hub): The device communicated with Zaptec's Azure IoT Hub using MQTT and authenticated with Shared Access Signatures, with keys provisioned at the factory. Intercepting this TLS-encrypted traffic via a custom root CA and mitmproxy revealed extensive debugging and remote management capabilities. Notably, a "Cloud Command Response" function allowed Zaptec to execute arbitrary Linux commands as root on any device via the cloud, and a "Start Remote Tunnel" command established a reverse SSH shell from the charger back to a Zaptec-specified IP address using an onboard private key.

In summary, the key findings illustrate a robust but potentially exploitable design, where initial debug interfaces and an unlocked boot process opened the door to complete device compromise, revealing powerful remote administration capabilities that demand stringent access control and security oversight.

Technical Deep Dive

▶ Watch: Desoldering NAND flash to extract firmware. (21:50)

The journey to compromise the Zaptec Pro charger began with a meticulous hardware teardown and analysis, followed by a sophisticated process of firmware extraction and custom bootloader development.

Upon physical inspection, the charger revealed two primary Printed Circuit Boards (PCBs): a power board and an IoT board. The researchers focused on the IoT board, which houses the core application logic. Key components identified included an ARM Cortex-A7 based microcontroller, a NAND flash chip for firmware storage, and a RAM chip. Other notable components included a 4G modem, a Qualcomm PLC chipset for Power Line Communication, an RFID antenna and chipset for authentication, and a PIC microcontroller likely handling charge session logic and relay control.

A critical observation was an unpopulated pin header adjacent to the NAND flash chip. Initial analysis with a logic analyzer confirmed this as a UART interface, providing access to the device's boot logs and a login prompt. While this offered valuable insights into hardware configuration, the bootloader was locked, preventing interruption of the boot sequence, and the login password remained elusive.

The discovery of an unpopulated SD card slot presented a potential alternative boot path. Through trial and error with various Linux images, the researchers confirmed the device's ability to boot from an SD card, but success hinged on providing the correct hardware configuration. This necessitated obtaining the device's firmware.

To extract the firmware, the NAND flash chip was carefully desoldered using an inexpensive rework station and Krypton tape (a Chinese equivalent of Kapton tape). The desoldered chip was then read using a specialized chip reader purchased from AliExpress. This process yielded a raw binary dump of the firmware. A significant challenge arose from the NAND flash architecture, which interleaves data with out-of-band data used by a controller for wear leveling and error correction. To create a usable, contiguous firmware image, the researchers utilized a publicly available tool, presented at Hack in the Box Amsterdam 2019, which intelligently parsed and corrected the raw NAND dump.

The cleaned firmware image contained the crucial device tree. A device tree is a data structure that describes the hardware components of a system to the operating system kernel, detailing memory addresses, interrupt lines, and pin mappings. Since Zaptec had customized the development board, their specific device tree was essential for correctly configuring a custom boot environment.

With the device tree in hand, the researchers built a custom U-Boot bootloader. U-Boot, a common open-source bootloader for embedded systems, was downloaded from GitHub. The extracted device tree was incorporated into the U-Boot build process, ensuring compatibility with the Zaptec hardware. This custom U-Boot image was then written to an SD card.

Upon booting the Zaptec Pro with the SD card, the custom U-Boot prompt was accessible. From this prompt, the researchers configured U-Boot to boot the existing Linux kernel from the onboard NAND flash, but with a critical modification: enabling single-user mode in the Linux boot arguments. Single-user mode is a maintenance mode in Linux that bypasses normal authentication, typically dropping the user directly into a root shell. This allowed them to set a new root password, thereby gaining full, persistent root access to the device's operating system.

With root access, the researchers could then explore the device's services and configurations. The Bluetooth Low Energy stack was found to be implemented as a Python service utilizing the BlueZ library, communicating with a local .NET service via DBus for command execution. While direct arbitrary command injection was not discovered through BLE, commands like "restart charger" and "trigger firmware update" were available. The device's unique four-digit BLE PIN was factory-provisioned and found in factory logs, indicating it was written along with other key material during assembly.

SSH access was configured to use SSH keys rather than passwords, with the same keys provisioned across all devices. This centralized key management, while avoiding password-based attacks, introduces a significant risk if the private keys are compromised.

Finally, analysis of the cloud connectivity revealed the use of Azure IoT Hub with MQTT and Shared Access Signatures for authentication. By installing a custom root CA and employing mitmproxy, the researchers decrypted the TLS traffic, exposing the full extent of Zaptec's remote management capabilities. Two critical functions were identified: "Cloud Command Response," which allowed Zaptec to execute arbitrary Linux commands as root on the charger, and "Start Remote Tunnel," which established a reverse SSH tunnel from the charger to a specified IP address using an onboard private key. These capabilities highlight powerful, yet potentially dangerous, remote access mechanisms that require rigorous internal security controls.

Demo / Proof of Concept

▶ Watch: Zaptec's cloud debug: remote root command execution. (39:10)

While the talk did not feature a live, interactive demo in the traditional sense, the entire reverse engineering process served as a compelling proof of concept for gaining deep access and control over the EV charger. The ability to extract the firmware, build a custom bootloader, and ultimately achieve root access to the device's operating system demonstrated a profound level of compromise.

A lighthearted, yet effective, proof of concept of their control was the ability to manipulate the device's internal components. With root access, the researchers managed to make the charger's small internal speaker play "Jingle Bells", showcasing their capacity to execute arbitrary code and interact with hardware peripherals. This simple act underscored the complete administrative control they had achieved over the device.

Beyond this, their investigation into the device's Bluetooth Low Energy (BLE) interface, SSH configuration, and Azure IoT Hub communication provided further proofs of concept regarding the potential for both local and remote exploitation. Although they did not actively exploit Zaptec's cloud infrastructure, the discovery of the "Cloud Command Response" and "Start Remote Tunnel" functionalities served as a critical demonstration of powerful remote administration tools. The fact that Zaptec could execute arbitrary root commands or establish reverse SSH shells on any device highlighted the significant implications of their findings. The researchers' ability to intercept and decrypt the encrypted MQTT traffic to Azure IoT Hub via mitmproxy further proved their comprehensive control over the device's network communications. These findings collectively illustrate the critical security posture of the Zaptec Pro charger and the potential consequences of such deep-level access.

Defensive Implications

▶ Watch: Talk conclusion and security improvement recommendations. (41:00)

The findings from the Zaptec Pro reverse engineering project offer several crucial defensive implications for EV charger manufacturers, IoT device developers, and infrastructure operators. Addressing these areas is vital for enhancing the security and resilience of critical charging infrastructure.

  1. Implement Secure Boot: The most significant vulnerability exploited was the ability to boot an unsigned, custom bootloader from an SD card. Manufacturers must implement secure boot mechanisms, where every stage of the boot process (from bootloader to kernel) is cryptographically signed and verified. This prevents unauthorized firmware from loading, effectively blocking attacks like the one demonstrated. If a custom bootloader is not signed with the manufacturer's private key, the device should refuse to boot it.
  2. Encrypt Firmware on Flash Memory: The researchers were able to extract the device tree and other critical configuration details by desoldering and reading the NAND flash chip. Encrypting the firmware on the flash memory would render such physical extraction attempts largely useless, as the contents would be unreadable without the decryption key.
  3. Disable Debug Interfaces in Production: The exposed UART interface and the ability to boot from an SD card were critical entry points. In production devices, all debug interfaces (UART, JTAG, SWD, USB debug modes) should be permanently disabled or physically removed. Similarly, booting from external media like SD cards should be disabled or restricted to cryptographically signed images only.
  4. Secure Remote Management Channels: The discovery of "Cloud Command Response" and "Start Remote Tunnel" functionalities highlights the immense power and risk associated with remote administration tools. Manufacturers must implement:
  • Strict Access Control: Ensure only authorized personnel with multi-factor authentication can access these powerful commands. Implement robust logging and auditing for all remote command executions.
  • Principle of Least Privilege: Remote commands should operate with the minimum necessary privileges. Executing arbitrary commands as root across a fleet of devices is a significant risk.
  • Secure Key Management: The use of hardcoded SSH keys shared across all devices for remote tunnels is a critical weakness. Each device should ideally have unique keys, managed securely, or use ephemeral keys for remote access sessions.
  • Network Segmentation: If remote tunnels are necessary, they should be established to highly restricted, segmented networks, not directly into core operational networks.
  1. Review Bluetooth Low Energy (BLE) Security: While a four-digit PIN and brute-force protection were present, the static, factory-provisioned nature of the PIN printed on the box is a concern. Manufacturers should:
  • Allow User-Configurable PINs: Enable users to change the BLE PIN.
  • Enhance Authentication: Consider stronger, encrypted authentication mechanisms on top of BLE, especially for sensitive operations.
  • Secure Provisioning: Ensure the factory provisioning process for key material and PINs is highly secure and documented.
  1. Supply Chain Security: The reliance on cheap, accessible tools (AliExpress chip readers, rework stations) underscores that basic hardware attacks are increasingly within reach for hobbyists and adversaries. Manufacturers need to consider the physical security of their devices and components throughout the supply chain.
  2. Threat Modeling and Regular Audits: Continuous threat modeling for new features and regular security audits (both internal and external) of the entire system, from hardware to cloud infrastructure, are essential to identify and mitigate vulnerabilities proactively.

By implementing these defensive strategies, manufacturers can significantly raise the bar for security, protecting EV charging infrastructure from both local and remote exploitation.

Key Takeaways

  • Physical Access is a Gateway: Exposed debug interfaces (UART) and unencrypted, bootable external media (SD card slot) are critical vulnerabilities that can lead to full device compromise if not secured in production.
  • Firmware Encryption is Essential: Unencrypted firmware on flash memory is a treasure trove for attackers, allowing extraction of critical details like device trees and configuration, paving the way for custom bootloader development and root access.
  • Secure Boot is Non-Negotiable: Implementing robust secure boot mechanisms that verify cryptographic signatures for every stage of the boot process is fundamental to preventing unauthorized code execution and maintaining device integrity.
  • Remote Management Requires Extreme Vigilance: Powerful remote administration capabilities, such as arbitrary command execution as root or reverse SSH tunnels via cloud services, present significant risks if not governed by stringent access controls, logging, and least privilege principles. Hardcoded, shared SSH keys are a critical vulnerability.
  • IoT Security Maturity Varies: While the Zaptec charger demonstrated some good security practices (e.g., disabled password authentication for SSH), it also exposed common weaknesses seen in devices from newer companies, highlighting the need for comprehensive security development lifecycles in rapidly evolving markets.
  • Accessibility of Hardware Hacking Tools: The increasing availability of inexpensive hardware hacking tools (rework stations, chip readers from AliExpress) lowers the barrier to entry for physical attacks, making robust hardware-level security a more urgent requirement for IoT devices.

About the Speaker(s)

Harrison Sand is a security consultant at mnemonic, a Norwegian cybersecurity company. His day-to-day work primarily focuses on application security, including penetration testing of mobile applications, IoT devices, and various other systems. He has a broad range of experience across different security domains.

Andreas Claesson also works as a security consultant at mnemonic, alongside Harrison, specializing in application security. Andreas brings a unique perspective with a background as a hardware engineer, having worked on the hardware of older mobile phones. His expertise in hardware design proved invaluable during the physical teardown and analysis phases of the EV charger project.

Reviews

→ Top-rated talks at BruCON 0x0F

All talks from BruCON 0x0F