[00:00.000 --> 00:15.720] Okay, so hi all Welcome to the You know, the topic of my presentation is context-aware anomaly detection in Automotive CANN without decoding So my name is Ravi Rajput. [00:15.720 --> 00:29.020] I'm a principal architect and information security at Neotech Global I have expertise in telecom and automotive service security and I had [00:33.700 --> 00:40.060] I spent my life in Advanced pen testing. [00:40.400 --> 01:04.720] I had launched an AutoAC OS, which is an operating system designed for automotive pen testing and it was launched in BlackHat Arsenal in Asia and it has been It has reached millions of downloads now and it has been used by VMs I am a core team member of a telecom village at DefCon I had been I had presented at DefCon, [01:04.720 --> 01:40.820] BlackHat, HITV, NullCon, HitCon and several besides conferences So the agenda of today's talk is we will talk about how the CAN bus is blind and how the machine learning can detect the anomaly without the use of decoding it So we will go ahead with the demo as well We will we will talk about the working mechanism of the models that are the algorithms that will be used and We will discuss about the key findings and result and the deployment possibilities as well. [01:40.880 --> 01:46.940] And later we will have a Q&A So CAN bus is blind, right? [01:47.340 --> 01:52.360] The problem with CAN bus is there is no authentication Encryption or integrity check. [01:52.360 --> 01:53.680] There is no sanity checks. [01:53.860 --> 02:01.840] It's a broadcast architecture So every ECU can receive the message or can send the message, right? [02:01.920 --> 02:36.420] No built-in support for access control or anomaly detection the traditional Detection is based on the rules that catches the you know patterns There is no state awareness, okay, it's a stateless protocol CAN is a stateless protocol so it allows a malicious actor to inject the inconsistent state triggering the alerts Over here, [02:36.420 --> 03:18.060] we will use the machine learning algorithm to detect the CAN anomalies it Rely heavily on the you know protocol decoding the traditional way depends on the decoding while the approach That can be used for anomaly detection in CAN is supervised and unsupervised learning While the challenge with the supervised learning is that we need and CAN dataset labeled to understand the anomalies while the unsupervised Unsupervised learning doesn't need that, [03:18.060 --> 03:21.160] and that is the reason we will go with unsupervised. [03:22.580 --> 03:34.580] And if we see CAN messages as sequential and time-sensitive, we will be able to detect the anomalies. [03:35.540 --> 03:40.240] So anomalies doesn't mean that one wrong message, it's a break in the context. [03:41.540 --> 03:53.520] So, you know, the problem that I was trying to address was like every vehicle model have a different structure, signal, meanings, and encodings. [03:53.520 --> 03:56.880] So it's not scalable across the fleets or vendors. [03:57.320 --> 04:10.300] The solution for it is try to find out the frequency of CAN IDs and the burst patterns, payload byte entry entropy, timing deltas, and sequence correlation. [04:11.100 --> 04:18.680] The algorithm that can be used for detecting will be LSTM, and the better version will be LSTM VAE. [04:20.380 --> 04:27.240] So it can learn what a normal sequence of CAN messages look like. [04:27.240 --> 04:34.420] And when the frequency changes, what will be the, you know, correction error. [04:35.420 --> 04:42.340] So autoencoders are trained on normal behavior, and it reconstructs the expected output. [04:42.340 --> 04:50.460] Whatever the deviation is, if it is above some threshold, it is detected as an anomaly. [04:51.700 --> 04:56.540] So and then why LSTM and LSTM VAE? [04:56.540 --> 05:00.760] So LSTM is long short-term memory network. [05:01.180 --> 05:14.360] It knows what is to forget, what is to remember, and what is to be, like, so it knows the memory to be remembered. [05:14.480 --> 05:24.800] So it sees the, you know, the whole network as like the whole messages as a, what we say, the sequence. [05:25.450 --> 05:29.350] Okay, rather than picking up the messages separately. [05:30.140 --> 05:43.750] It's like a musician, you know, trying to play a music and if he misses a note or do some minor mistake, the whole music is disrupted. [05:44.260 --> 05:47.380] That is how the LSTM also works. [05:47.380 --> 05:49.030] It's a sequential thing. [05:50.170 --> 05:57.190] So the VAE adds a variational interface, inference to the standard VAE. [05:57.190 --> 05:59.750] It adds actually a latent distribution. [06:01.430 --> 06:08.670] So the intuition behind this LSTM is feed-free, feed-forward network. [06:09.790 --> 06:10.190] Okay . [06:11.450 --> 06:18.830] So it maintains, like, it has three gates, what to forget, what to remember, and what to output. [06:19.050 --> 06:21.990] Okay, so it maintains the cell state. [06:22.330 --> 06:30.610] Okay, so why the neural net failed for the sequence is there is no understanding of sequence flow and the time dependencies. [06:30.690 --> 06:39.230] So if we map the message IDs with the time, we will be able to understand the pattern and if there is a burst, there is a change in the pattern. [06:39.230 --> 06:43.530] We will be able to detect the anomalies above some threshold. [06:45.770 --> 06:50.390] So the sequence-to-sequence model will be like input sequence encoder. [06:50.870 --> 06:56.450] It will be feed to latent vector, then decoder, and it will try to reconstruct the sequence. [06:56.990 --> 07:01.230] Okay, the reconstruction error is typically mean sequence error. [07:01.590 --> 07:07.150] Okay, it will try to minimize this sequence error, but it still gets above. [07:07.810 --> 07:10.470] It will try to detect that. [07:10.470 --> 07:32.490] It's something like if I am driving my car from 0 to 10 to 20, then 25, 30 kilometers per hour, but there is a message saying that 0, then 10 kilometers per hour, but then all of a sudden there is a 100 kilometers per hour of message, then it is the change in a pattern. [07:32.630 --> 07:34.750] This is what LSTM detects. [07:36.310 --> 08:02.970] So, so that there is an input that you have to, like the input will be the sequence of 10 frames, typically shaped as, you know, sequence length, and we have to do the feature extraction engineering, like feature engineering, and then read the, the encoders will read the input sequence one time step at a time. [08:27.540 --> 08:29.800] Clearly, that anomalies are there. [08:31.240 --> 08:40.220] So the LSTM way is basically the extension of autoencoders with a latent variable on the distribution. [08:41.040 --> 09:02.140] Okay, so basically it has loss function is into two parts reconstruction loss, which actually measures how well the sequence is rebuilt, and the KL divergence loss, which measures how the how far latent distribution deviates from the standard normal. [09:02.680 --> 09:15.200] So it's a while you can consider this autoencoder as a, you know, not distributed, but this can be taught as a distributed as like the way. [09:18.460 --> 09:23.770] The major part of way is latent sampling. [09:24.200 --> 09:26.920] Okay, which introduced the control noise. [09:26.920 --> 09:34.690] Okay, that's a major difference between we and auto LSTM autoencoder. [09:35.660 --> 09:43.180] Why uncertainty matters in a can or anomaly detection is automotive networks are noisy and busty. [09:43.180 --> 09:46.160] Static threshold can cause false positives. [09:46.560 --> 09:50.880] Okay , need models that can express confidence, not just anomalies. [09:51.840 --> 09:58.760] And how this LSTM way tackles uncertainty is learns the distribution of a valid behavior rather than a fixed pattern. [10:00.160 --> 10:04.060] It produces a latent vector with a mean and variance. [10:05.040 --> 10:17.460] And samples from that mean and variance to the variability and more tolerance to the natural deviation. [10:17.460 --> 10:27.000] So if we talk about the real-life example, replay attack basically detected with the wrong timing. [10:27.000 --> 10:32.360] That is a latent shift draft KL spike in the divergence spike. [10:32.860 --> 10:36.280] While the fuzzing is detected on the entropy spike. [10:37.820 --> 10:57.600] Okay, so the data pipeline for the demo that we will do currently is we will, you know, collect the log for the normal, you know, canvas for training the data for training the model. [10:58.580 --> 11:09.480] While the attack.log will be used for evolution, and it will extract the timestamp canid and payload byte. [11:09.580 --> 11:17.320] Then it will filter the, you know, this non-standard form of frames and discard that. [11:17.720 --> 11:28.610] We'll try to find the difference in timestamp as a delta t, then the entropy and the frequency of canid in a sliding window. [11:30.200 --> 11:40.310] Feature engineering constructs a sequence of windows basically and tries to normalize the min-max or Z-score. [11:41.380 --> 11:46.750] Then we will train the model and then inference the scoring. [11:47.480 --> 11:52.530] So rather than going through the slides, let's do some demo. [11:54.290 --> 12:01.150] The simple demo will be by using the ICSIM. [12:02.530 --> 12:06.830] Okay, so I'm trying to increase the speed and left and right. [12:07.210 --> 12:17.430] Okay, so what we will do here is we'll try to capture the normal log. [12:22.240 --> 12:26.280] And we will do some normal activity. [12:26.440 --> 12:38.720] Okay, and we'll first this other canids as well. [12:38.720 --> 12:43.820] So the main target canid will be on the door that is 19B. [12:44.460 --> 12:52.280] Okay, so the door lock and unlock mechanism that is 19B basically canid. [12:52.280 --> 12:54.040] So we are capturing that. [12:58.330 --> 13:03.130] Okay, so now it must be enough. [13:09.560 --> 13:11.200] Yeah, perfect. [13:13.280 --> 13:23.260] Now on the one screen, we will try to fuzz on particular canid 19B. [13:23.300 --> 13:29.440] While on the second, we'll run the... we'll capture the log. [13:44.280 --> 13:46.740] Okay, as you can see here. [13:47.920 --> 13:54.780] The door, we are basically fuzzing on the door canid. [14:02.340 --> 14:05.580] We'll give five more seconds. [14:09.010 --> 14:13.230] Hey, Ravi, just a heads up, you've got five minutes left for your presentation. [14:15.130 --> 14:17.790] Okay, just five minutes. [14:19.150 --> 14:25.030] Yeah, they need five minutes to get the next speaker on before, so sorry. [14:26.670 --> 14:41.250] Okay, so rather than going on this, I will show you the already experimented one and the results. [14:51.870 --> 14:55.550] So we'll get the logs from here and on this. [14:55.900 --> 15:05.060] And once you run, you will find the feature engineering and you will find the time delta and the entropy. [15:05.600 --> 15:20.090] Okay, the sequence generator will get the MSE loss and you will get the MSE loss graph. [15:20.090 --> 15:29.110] Then the model will try to detect the anomalies over the top five canids. [15:30.470 --> 15:34.770] Okay, over here, you can see the canid 19B is detected. [15:34.770 --> 15:38.610] There is a little bit of a false positive. [15:38.610 --> 15:54.630] While if you can see on this VE, which is more robust algorithm, you will see that 19B is detected as highest entropy and anomaly detection. [15:55.510 --> 16:01.930] And you can see the peak of this canid. [16:02.210 --> 16:09.270] While you can see this, the entropy is very much over here, which can be concluded that anomaly. [16:11.230 --> 16:19.970] And these are the other graphs that we can discuss, but due to the lack of time, we will go with just a simple output of this. [16:19.970 --> 16:23.950] I will publish this on GitHub as well after the talk. [16:25.050 --> 16:29.170] And it will give you the reconstruction error, but that we had already talked about. [16:29.170 --> 16:31.930] The reconstruction error will be high. [16:31.930 --> 16:35.670] That is how the anomaly detection will be detected. [16:35.670 --> 16:44.210] So let's talk about the key findings, the unusual or previously unseen IDs. [16:46.510 --> 16:47.250] Sorry [16:51.880 --> 17:01.050] , the unseen IDs during replays in rare IDs showing up high frequency will be detected as can anomalies. [17:01.540 --> 17:08.820] Payload entropy spikes and timing deviations will be shown as anomalies. [17:08.940 --> 17:18.140] While you can go ahead with VE is another version of like LSTM's VE is another version for the replay attack detection. [17:18.140 --> 17:28.440] And for the deployment possibilities are you can deploy this lighter version of this model on your ECUs as well. [17:28.440 --> 17:35.280] And this can be the best option for your VSOC as well as SIEM solutions. [17:35.980 --> 17:40.160] Yep, so let's move to the Q&A. [17:40.600 --> 17:44.560] Maybe we have time for one question. [17:44.560 --> 17:46.600] I think we might have time for one question. [17:46.600 --> 17:48.180] We only have two minutes left. [17:48.180 --> 17:51.340] Is anyone in the audience got anything to ask? [17:57.990 --> 18:00.770] The question was, what is the application for this? [18:00.770 --> 18:04.230] Is this specially designed for intrusion detection? [18:06.310 --> 18:08.130] Yeah, currently it is. [18:08.590 --> 18:12.150] I'm currently experimenting on intrusion detection only. [18:12.330 --> 18:17.950] Still not have figured out for the, you know, prevention part. [18:17.950 --> 18:21.190] Is that good? [18:21.990 --> 18:24.710] I think we're out of time now. [18:24.710 --> 18:27.450] So thank you so much, Ravi, for your presentation. [18:28.490 --> 18:29.790] Thank you. [18:30.010 --> 18:31.610] Thank you so much. [18:32.250 --> 18:36.350] You can reach out to me on social media anytime. [18:37.910 --> 18:39.030] Thank you. [18:39.030 --> 18:39.590] Thank you. [18:39.590 --> 18:40.270] Thank you.