Supervised and Unsupervised Intrusion Detection Based on CAN Message Frequencies for In-vehicle Network

Takuya Kuwahara, Yukino Baba, Hisashi Kashima, Takeshi Kishikawa, Jun'ichi Tsurumi, Tomoyuki Haga, Yoshihiro Ujiie, Takamitsu Sasaki, Hideki MatsushimaJ. Inf. Process 2018 · DOI

Abstract

This paper proposes a fast, lightweight intrusion detection system (IDS) for in-vehicle Controller Area Network (CAN) bus networks based entirely on message frequency. By tracking the counts of messages overall and per-ID within short time windows, the authors achieve near-perfect detection of denial-of-service (DoS) attacks and highly accurate detection of stealthy attacks in under 3 milliseconds using both supervised and unsupervised machine learning techniques.

Introduction: The Vulnerability of In-Vehicle Networks

Modern vehicles are essentially rolling computer networks. Dozens of Electronic Control Units (ECUs) control everything from the engine to the brakes, communicating primarily via the CAN protocol. However, CAN was designed without security in mind—it lacks encryption and authentication. If a hacker gains access to the network (e.g., via a cellular connection to the infotainment system, as seen in the infamous 2015 Jeep Cherokee hack), they can inject malicious messages to physically control the car.

Because modifying the CAN protocol to add cryptography is practically difficult for legacy and current systems, the industry needs passive Intrusion Detection Systems (IDS). The challenge is building an IDS that is fast enough to operate in real-time and lightweight enough to run on constrained automotive hardware, all without needing to reverse-engineer proprietary payload contents.

Methodology

The authors capitalize on a simple characteristic of CAN networks: normal messages are broadcast at highly stable, periodic intervals. Therefore, injecting malicious messages inevitably alters the frequency of traffic. They extract two types of features from fixed time windows (e.g., 10ms to 200ms):

  1. Total-Counting Feature: A simple scalar representing the total number of messages observed in the window.
  2. ID-Counting Feature: A vector where each element represents the count of messages associated with a specific CAN ID in that window.
Comparison of Total-Counting and ID-Counting features extracted from CAN message sequences.

Detection Approaches

To detect anomalies, the authors test two distinct approaches:

Unsupervised Learning (Primary Contribution): For Total-Counting, they fit a Gaussian distribution to normal traffic counts and use a statistical test (p-value) to flag anomalies. For the high-dimensional ID-Counting feature, they employ a more sophisticated pipeline to ensure real-time feasibility.

The unsupervised detection pipeline using PCA and k-d Tree for rapid anomaly detection.

As shown above, the pipeline uses Principal Component Analysis (PCA) to reduce the vector to 10 dimensions. They then use a k-d Tree to rapidly calculate the nearest-neighbor distance between the current time window and known normal windows. If the distance exceeds a statistically derived threshold, it is flagged as an attack.

Supervised Learning: As a baseline, they train an L2-regularized logistic regression classifier using labeled normal and malicious data.

Datasets and Experimental Setup

The authors collected real CAN traffic from an actual vehicle and simulated attacks by injecting fake messages targeting the steering wheel ECUs. They created four datasets to test different conditions:

  • Large-Parked & Large-Moving: Simulates DoS attacks where a massive flood of malicious messages is injected to overwhelm the network.
  • Small-Parked & Small-Moving: Simulates "stealthy" attacks. The attacker knows the normal transmission cycle and injects just a few malicious messages right after the normal ones to override the ECU without flooding the bus.

Key Insights and Results

  • Periodicity as a Security Proxy: Because ECUs broadcast at strict intervals, frequency analysis is a highly robust proxy for intrusion detection. Payload inspection is not required to identify anomalies.
  • Granularity for Stealth Detection: While Total-Counting effectively catches DoS attacks, it fails against stealthy attacks because minor message additions do not significantly shift the overall traffic volume. However, the ID-Counting feature captures these spikes for specific IDs.
  • Efficiency of Nearest-Neighbor Distances: Measuring the distance to the closest known normal state in a reduced feature space is computationally cheap and highly effective for spotting anomalies.

Performance Metrics

  • High Accuracy on DoS: Both features achieved an Area Under the Curve (AUC) of > 0.999 on the "Large" (DoS) datasets.
  • ID-Counting Superiority on Stealth: For "Small" (stealthy) attacks, the unsupervised ID-Counting feature significantly outperformed Total-Counting (e.g., AUC of 0.991 vs 0.602 at a 10ms window).
  • Real-Time Performance: The unsupervised PCA + k-d tree pipeline is incredibly efficient, taking less than 3 milliseconds (averaging ~1ms) to classify a message sequence.

Conclusion

While supervised learning performs best, it requires training data covering all possible attack varieties, which is unrealistic for zero-day threats. The unsupervised approach is more practical for real-world deployment. However, the unsupervised method struggled slightly with stealthy attacks when the time window was very short (10ms), due to insufficient statistical deviation. Future research should focus on improving unsupervised methods to enhance their robustness against highly optimized stealth attacks in connected vehicles.

Summary updated

BibTeX
@article{kuwahara2018supervised,
  author = {Takuya Kuwahara and Yukino Baba and Hisashi Kashima and Takeshi Kishikawa and Jun'ichi Tsurumi and Tomoyuki Haga and Yoshihiro Ujiie and Takamitsu Sasaki and Hideki Matsushima},
  title = {{Supervised and Unsupervised Intrusion Detection Based on CAN Message Frequencies for In-vehicle Network}},
  journal = {J. Inf. Process.},
  year = {2018},
  doi = {10.2197/ipsjjip.26.306},
}
Figure