# A Survey on Machine-Learning Based Security Design for Cyber-Physical Systems
## 4 ML-Based Cyber-Physical Attack Detection
### Application Layer  
A light-weight ML-based software anomaly detector targeting a camera application in an embedded system is proposed in [125]. The proposed ML detector adopts a \(k\)-means algorithm, grouping data into \(k\) clusters, where the ML model utilizes the distribution of system call frequencies. A CNN model that detects malware is proposed in [126] to classify benign and malicious application software with various features related to permissions, code patterns, and application program interface (API) calls. The authors in [126] adopt a deep auto-encoder as a pre-training method of a CNN model to enhance the training speed of the proposed CNN model. The proposed detector reaches 99.8% accuracy in malware classification, which is higher than existing SVM models. In [127], an ML-based detector of malicious behavior in a computing system is proposed, using a thermal side channel of a CPU with thermal sensors. With a CNN algorithm, the proposed ML model utilizes temporal changes in a heat map of computing components under attacks such as code injection on a computational loop. The performance evaluation of the proposed detector is conducted on a multi-core processor, which shows robust real-time anomaly detection for the computing system with real-time thermal monitoring using a finite number of thermal sensors on chip. The authors in [128] analyze the performance of various ML-based side channel-attack detection strategies to defend against micro-architectural side channel attacks. The analysis show that excessively frequent feature sampling for the side-channel attack not only increases the computing overhead from attack detection but also decreases accuracy. Therefore, appropriate feature sampling rates and computational overheads should be selected simultaneously. The same paper shows a trade-off between attack detection performance and detection latency [128] and proposes proper ML model selection for attack detection. An ML-based cache side-channel attack detection strategy is proposed in [129] under realistic computational load conditions, where the cache side-channel attack under zero-load, medium-load, and heavy-load conditions is considered. Hardware events on caches and system-wide information, including total CPU cycles and branch-miss prediction, are selected to train the ML model for attack detection. The evaluation of the ML-based detection strategy is conducted with 12 ML models, where most of them show performance degradation under heavy-load conditions, and with some ML models (such as KNN), a detection overhead is generated. A real-time cache side-channel attack detection method is proposed in [130] with a softmax classification algorithm. The proposed ML-based attack detection method is implemented with an Intel Performance Counter Monitor to measure and learn the state of the CPU for the ML model. Performance evaluation is conducted on various CPUs, where the proposed method can detect an attack within about one second, and the CPU usage is less than 1% for each CPU environment. Against cyber-physical attacks, and exploiting computing hardware vulnerabilities, an ML-based attack classification method is proposed in [131], where the authors consider two cyber-physical attacks (row hammer and Spectre), which are side-channel attacks exploiting a structural vulnerability of the computer architecture. The authors choose three different ML models--logistic regression, the SVM, and MLP--to build attack classifiers. The proposed methods with three different ML models show detection performances of better than 99.7% accuracy and 98% accuracy against row hammer and Spectre, respectively. A CNN-based row hammer detection model is proposed in [132], which provides the online detection of row hammer without Linux kernel modification. The proposed CNN model monitors suspicious DRAM access patterns and learns complex patterns in DRAM accesses.