Reverse Engineering of MSE2 Engine Control Unit
Full-stack analysis of Bajaj MSE2 ECU, from hardware interfacing to line-by-line binary de-obfuscation and logic reconstruction.
Project Overview
The MSE2 ECU is the central brain of many modern motorcycles, including the Bajaj Pulsar series. This project represents a complete Security & Functional Audit of this controller. By extracting and analyzing the firmware, I reconstructed the logic behind its safety systems, diagnostic protocols, and security handshakes.
Hardware Context
The research began with the physical ECU hardware. Establishing a stable bench connection was essential for capturing the firmware dump and monitoring live diagnostic traffic.
Deep Logic Extraction (Line-by-Line Analysis)
Using advanced Disassemblers, the binary artifacts were translated into structured C code. The following core subsystems were identified and analyzed:
1. The Boot & Initialization “Brain” (sub_22D0)
This function serves as the mastermind for ECU startup.
- Clock Configuration: Tuning the system to 80MHz with a high-precision margin (error < 0.33%).
- Protocol Setup: Initializing the CAN network at 500kbps and verifying memory integrity via specific markers like
0xDEADBEEF.
2. Cryptographic Security Access (sub_23D2C)
I performed a line-by-line de-obfuscation of the UDS Service 0x27 handler.
- Seed-to-Key Transformation: Reconstructed the mathematical model used by the ECU to generate dynamic security keys.
- Algorithm Analysis: Mapping the sequential XORs and bit-shifting operations used to protect the ECU’s flash memory from unauthorized access.
3. Fault Management & System Health (sub_2B2C)
Identified as the Fault Manager, this routine acts as the ECU’s internal doctor:
- DTC Generation: Monitoring sensors and incrementing error counters.
- Threshold Logic: Deciding when a transient glitch should be logged as a permanent Diagnostic Trouble Code (DTC).
- Fail-Safe Modes: Activating protective routines (Fault Reactions) to prevent engine damage during sensor failures.
Key Technical Accomplishments
- Binary Reconstruction: Deciphered the logic for
0x2E(WriteData) and0x3D(WriteMemory) services. - Architecture Mapping: Full understanding of the PowerPC-based execution flow and register settings.
- Security Auditing: Identification of vulnerabilities in the Seed/Key exchange process.