WEBVTT

00:00.000 --> 00:02.440
This talk is about VPN filter.

00:02.500 --> 00:04.060
The malware campaign.

00:05.140 --> 00:18.440
And because this is the ICS village, we're going to focus about half the talk on ICS specific component of this, which had some Modbus capability and try and give everybody a better understanding of exactly what that was.

00:18.620 --> 00:21.920
So this is I'm Patrick DeSantis.

00:22.060 --> 00:23.160
This is Carlos Pacho.

00:23.160 --> 00:30.200
We are two of many researchers at Cisco Telus that spent a long time working on this project.

00:30.220 --> 00:36.200
Many months, many hours, lots of really smart people doing really cool stuff with this.

00:36.260 --> 00:45.500
We're two small pieces of a much larger group that probably did a lot cooler stuff than we did, but you get to talk to us instead.

00:47.920 --> 00:51.900
So some boundaries I'm going to set for the talk.

00:51.900 --> 00:55.880
I will talk about VPN filter and its technical capabilities.

00:55.880 --> 00:57.440
We'll talk about the targets.

00:57.720 --> 01:01.180
And specifically, we'll spend a lot of time talking about the Modbus module.

01:01.380 --> 01:03.280
I will not talk about attribution.

01:03.460 --> 01:05.080
The US government took care of that.

01:05.160 --> 01:10.100
I will not talk about any of our partners or victims associated with this campaign.

01:11.820 --> 01:13.120
So no.

01:14.380 --> 01:28.280
So VPN filter is a multi-year state sponsored, very sophisticated malware campaign targeting primarily edge devices in the small office, home office realm.

01:28.680 --> 01:31.320
It's been going on since at least 2016.

01:31.320 --> 01:35.440
2016 was the oldest sample that we are aware of.

01:35.500 --> 01:37.480
So it's been going since before that.

01:37.620 --> 01:43.800
And at the time we went public in May, we estimated there were about half a million infected devices globally.

01:44.520 --> 01:48.100
You know, that number can go up and down depending on how active the actor is.

01:48.100 --> 01:52.840
So this is a nice conservative estimate, at least half a million, which is still a significant amount.

01:53.620 --> 01:55.940
And it's interesting because it's cross -platform.

01:56.060 --> 02:01.500
This is malware that runs on multiple operating systems , and even multiple architectures.

02:01.860 --> 02:08.700
So we've got, you know , samples that run on MIPS, variant of MIPS, MIPS Electra, x86 , tile, more.

02:09.760 --> 02:17.380
And then within the specific architectures that are targeted , the binaries that were compiled were specific for the devices that we're going to run on.

02:17.380 --> 02:18.680
And there were a lot of devices.

02:18.680 --> 02:36.320
So we're aware of over 75 distinct device models from several vendors that have capabilities compiled specifically for those devices, which is some pretty serious effort on the part of the actor to go through and put that much work into it.

02:36.460 --> 02:40.760
Especially when a lot of these are, you know, sub $50 Soho devices.

02:40.760 --> 02:47.320
Other ones are like the MicroTik or Macrotic, I'm not sure how the correct pronunciation is.

02:47.320 --> 02:50.540
Those are rackmount, like enterprise grade network appliances.

02:50.540 --> 02:52.700
Most of the rest are Soho devices.

02:52.880 --> 02:55.900
Some are basic like home wireless routers.

02:56.360 --> 03:02.700
And then QNAP stuff that we saw was mostly pretty sure was just network attached storage devices.

03:03.000 --> 03:11.280
So during the time that we were working on this, a vast majority of the activity was targeting MicroTik and QNAP devices.

03:11.640 --> 03:13.900
But that was just during the time we were looking at it.

03:13.900 --> 03:17.860
If we had looked six months before, there may have been more or less activity.

03:18.540 --> 03:21.540
And you know, if we're looking six months from now, it may vary also.

03:21.620 --> 03:27.280
So but at the time, we looked mostly MicroTik, mostly QNAP, and lots of devices.

03:27.440 --> 03:47.760
So we needed to get into a position where we could bait the actor into delivering some of their, you know, some of those custom payloads for those other devices to us without tipping off our hand that we were actually working on, learning more about it.

03:47.760 --> 03:59.360
And so we were kind of stuck in a position where we wanted to set up like a honeypot infrastructure, leverage honeypots, but your traditional honeypots are often limited in their capabilities.

03:59.360 --> 04:04.020
We couldn't give any indication that we were in a, you know, in a honeypot.

04:04.020 --> 04:06.920
So virtualized or emulated environment was a no go.

04:07.340 --> 04:13.440
So often your honeypot configurations don't capture full network traffic, we needed full PCAN.

04:13.440 --> 04:17.460
We couldn't deal or we couldn't handle just metadata about the traffic.

04:17.520 --> 04:22.720
We needed to be able to look at everything that the device has received and pull files out of them.

04:22.720 --> 04:26.340
Because if the actor brick the device, we lose all forensic artifacts.

04:26.340 --> 04:28.260
So we needed all network traffic.

04:30.620 --> 04:33.900
So we had to set up our own, our own honeypot infrastructure.

04:33.900 --> 04:35.480
And we did that using real devices.

04:35.480 --> 04:41.940
So there's full interaction, honeypots, real devices, we bought about 40 of them.

04:42.340 --> 04:47.520
So in the diagram, we've got, you know, you get your internet.

04:47.700 --> 04:54.000
And then in this area here is where we break off onto our attack, or our target network.

04:54.000 --> 04:55.940
This is the target zone.

04:56.040 --> 04:57.600
So these are real devices.

04:57.600 --> 05:06.860
And they're on the internet using commercial or residential IP space instead of, you know, Cisco IP, because that would kind of be a dead giveaway.

05:07.060 --> 05:11.080
Or you know, like a virtual machine on AWS.

05:12.400 --> 05:16.700
So we had real devices and they had to be not obvious that it was Cisco.

05:18.120 --> 05:22.020
And the switch here, these devices can talk out and everything can talk in.

05:22.020 --> 05:23.880
So it's like they're on the internet directly.

05:23.880 --> 05:27.460
But they can't talk to each other, unless it goes out and comes back in.

05:27.460 --> 05:29.040
So they don't see each other.

05:29.240 --> 05:41.700
And the switch has a mirror port, spam port, that goes to a network tap, one way network tap, which goes to our analysis workstation, which was very locked down, and is set up to not allow any traffic out.

05:41.700 --> 05:48.660
So we've got three places to block any outbound traffic from our analysis zone here.

05:49.080 --> 05:57.440
It would not be a good thing if the actor associated with this campaign were able to go from here to our internal corporate network.

05:57.900 --> 06:01.640
I wouldn't be here talking about it today if we did.

06:02.620 --> 06:05.040
I may be out there with you handing out my resume.

06:06.340 --> 06:09.640
So we spent a lot of time and effort on this component.

06:10.180 --> 06:12.220
Right here we had full network traffic.

06:12.220 --> 06:17.560
So gigabytes of traffic a day associated with activity on these devices was living here.

06:17.560 --> 06:19.080
And that's where we did our analysis.

06:21.580 --> 06:26.460
So standing up this full interaction honeypot environment has some issues, some challenges.

06:26.820 --> 06:35.260
There's a reason why people use the limited interaction honeypots and it offers a lot more convenience, especially when you're spinning up VMs, you can just replicate them.

06:35.840 --> 06:38.560
You don't have to actually manage the physical devices.

06:38.680 --> 06:41.060
We had 40 devices, 40-ish.

06:41.480 --> 06:43.820
Some of them we bought used, so you can't trust them.

06:43.820 --> 06:52.100
So we had to go through each device, validate that it wasn't already owned, set it up in an intentionally vulnerable configuration, because we wanted them to get owned.

06:52.520 --> 06:59.540
So we had to put firmware on there with known vulnerabilities and publicly available exploits.

06:59.920 --> 07:01.880
We set them up for configurations.

07:03.540 --> 07:14.880
There was a large volume of traffic and none of it was legitimate because these devices weren't doing anything, but... Oh, that didn't show up on your screen.

07:14.960 --> 07:17.000
Flamingo wants you to join their Wi-Fi Larry.

07:19.000 --> 07:25.120
So all traffic going to these devices was malicious, or even if it was benign, it was not legitimate.

07:25.260 --> 07:28.540
So there's an old phrase looking for a needle in a stack of needles.

07:28.540 --> 07:35.140
It applies very, you know, it's very applicable to this because every bit of traffic was not legitimate.

07:35.140 --> 07:37.240
And we don't really know what we're looking for.

07:37.240 --> 07:42.380
So we have to find something bad in gigabytes and gigabytes of bad stuff.

07:42.600 --> 07:44.800
And then there's the security versus usability.

07:44.800 --> 07:49.100
And I think Carlos and I, well, we probably had each other in a headlock a few times.

07:49.100 --> 07:55.860
As I'm advocating for security, as I said, if the actor made their way into our network, bad stuff.

07:55.920 --> 08:08.520
But every time I lock something down or like advocate for something to be locked down more, it's, it's inconvenience and annoyance for the researchers that need to be able to interact with the devices and do analysis on the traffic.

08:08.520 --> 08:20.080
But because of the sophistication of the actor, we had to err on the side of security, much to my team and other people's, well, I owe them some beer, I guess.

08:20.560 --> 08:22.120
And the device limitations.

08:22.120 --> 08:24.360
So you see this is just like in control systems.

08:24.360 --> 08:26.520
These are often embedded systems.

08:27.220 --> 08:32.880
The legitimate management interfaces don't provide a lot of functionality for legitimate users.

08:33.020 --> 08:37.840
So you can't just drop down in the shell and log in as root and do whatever you want in Linux.

08:38.080 --> 08:44.760
You know, you might be in a limited environment, or maybe the only administrative control you have is through a web interface.

08:45.340 --> 08:51.720
So just like an ICS, an attacker who owns the device has more control over it than the legitimate user.

08:51.720 --> 09:00.520
So we found ourself in a position of actually exploiting and owning our own devices just to find out if they had been owned by somebody else, which is interesting.

09:01.840 --> 09:11.960
So that was kind of how we dealt with the risk associated with interacting with and having live targets intentionally infected by a state actor.

09:12.920 --> 09:22.940
Now the mailer itself that we're going to get with, there were several groups that did reversing and analysis of the actual mailer.

09:23.520 --> 09:26.060
But I do have to clarify one thing before we go into that.

09:26.060 --> 09:38.340
And there's since we went public in May, there's kind of been, I don't know how it started, but there was an initial misconception about the relationship between VPN filter and black energy malware.

09:38.560 --> 09:52.480
So black energy has a flaw in the implementation of the RC4 encryption algorithm, where it fails to properly initialize the S-boxes during the permutation stage.

09:52.480 --> 09:54.720
So it's a very , very, very specific flaw.

09:54.720 --> 09:57.320
It's not just like, whoops, we used the wrong library.

09:57.340 --> 10:07.080
The VPN filter has the exact same flaw and the exact same part of the implementation of the S-boxes in the permutation stage of the RC4 encryption algorithm.

10:07.080 --> 10:08.240
So there's overlap there.

10:08.240 --> 10:10.060
And it's a very specific overlap.

10:10.660 --> 10:14.280
VPN filter does not contain a full copy of black energy.

10:14.280 --> 10:21.540
So it's just the overlap that was the only connection that Talos identified and reported.

10:21.540 --> 10:26.020
So if you see anything else out there, it's just this, just RC4.

10:27.860 --> 10:33.280
It's a multistage malware, very sophisticated.

10:33.280 --> 10:42.100
I'm going to probably say that 20 times, but you start with initial exploitation and the malware drops a persistent loader that's specific for the target device that it drops on.

10:42.100 --> 10:48.600
The loader in stage one is the only part of the malware that has persistence that can survive a reboot.

10:48.600 --> 10:50.220
And that depends on the device.

10:50.620 --> 10:58.460
Aside from being persistent, stage one's only job is to find the stage two server, retrieve and install stage two.

10:59.220 --> 11:02.400
It has some really interesting ways of finding the stage two server.

11:02.740 --> 11:11.120
First is it'll look out and grab some images off photo bucket within the exit data and the images specifically in the latitude and longitude.

11:11.900 --> 11:20.000
You run it through a decoding routine, which we, one of our guys reversed, and you can pull out IP addresses out of the latitude and longitude.

11:20.580 --> 11:24.100
It'll then reach out to the IP address and try to get stage two.

11:24.100 --> 11:26.740
If it doesn't work, it tries a couple more images.

11:26.740 --> 11:29.440
If it doesn't work, it eventually goes to a hard coded domain.

11:30.160 --> 11:36.200
If that doesn't work, it does what I think is probably the most interesting part of this stage.

11:36.200 --> 11:42.980
It opens up a raw socket and listens for all traffic on all ports.

11:43.500 --> 11:54.980
And if it receives a TCP SIN with a very, you know, with specific bytes at a specific value, it'll grab another set of bytes and that's the IP address for the stage two server.

11:55.040 --> 12:11.160
So it's basically, it looks out, tries to get stage two, can't get it, it looks out another way, can't get it, falls back into this passive listening mode where the actor can intentionally task it with this, but just by using one TCP SIN to give it the IP address of the current stage two server.

12:11.700 --> 12:26.660
When it gets stage two, stage two is your framework, it's the workhorse, closest equivalent I can give you is like it's the meterpreter component and that it has some baked in functionality and it also has extensible and you can add other modules.

12:26.660 --> 12:31.340
So you can execute shell commands, it's got some collection capability, it's got some exfil capability.

12:31.340 --> 12:37.940
Some of the older stage twos we looked at had a built in kill capability where it would actually brick the devices.

12:38.420 --> 12:40.600
Talk about that in a second too.

12:40.600 --> 12:51.680
And then it's extendable through these stage three modules and plugins, which because it's extensible through modules, the functionality is essentially unlimited.

12:51.740 --> 12:56.680
It's only limited by what the actor actually develops for it.

12:58.620 --> 13:02.840
So Carlos is going to talk about one of those stage three modules.

13:03.240 --> 13:10.020
This is a diagram of what I described, the process of going from exploitation to stage one, to stage two, to stage three.

13:10.020 --> 13:13.660
I can spend an hour up here talking just about this slide.

13:14.100 --> 13:15.340
I can't do that.

13:15.340 --> 13:16.340
I'm not going to do that.

13:16.340 --> 13:17.580
I don't want to do that.

13:18.540 --> 13:24.400
But everybody that worked on this with me, we sat through several hours trying to understand this from many angles.

13:24.860 --> 13:32.020
This image is on the Telos blog, the initial blog post that described when we went public with VPN filter.

13:32.320 --> 13:35.480
It's very interesting, obviously very sophisticated.

13:36.000 --> 13:47.600
When the takedown happened, there was essentially a photo bucket or two in the wall angle had been taken down.

13:48.100 --> 13:52.720
The only thing left was the raw socket.

13:53.200 --> 13:55.040
So the person that had the device was infected.

13:55.040 --> 13:57.440
If you rebooted it, it would try to go to photo bucket.

13:57.500 --> 13:58.480
This stuff wasn't there anymore.

13:58.480 --> 14:00.160
It would try to go to wall, to no wall.

14:00.160 --> 14:00.980
It couldn't.

14:01.100 --> 14:02.840
So it would sit with the raw socket.

14:03.440 --> 14:08.480
So it was still vulnerable, but the actor is going to have to reach out and touch it manually at that point.

14:11.060 --> 14:13.780
So some of the stage three plugins that we've seen.

14:14.160 --> 14:16.180
These are the modules that come after stage two.

14:16.180 --> 14:17.260
These are the extensions.

14:17.640 --> 14:18.800
There's a packet sniffer.

14:19.000 --> 14:21.240
This is the one that Carlos is going to talk about.

14:21.560 --> 14:31.800
There's one that we refer to as Esler, which is interesting because this module allows for modification of traffic as it passes through the compromised device.

14:31.800 --> 14:39.920
So you've got your perimeter device, your edge router, all traffic on port 80 or going to port 80 is getting man in the middle.

14:40.200 --> 14:47.040
And JavaScript can be injected into the traffic that returns to the devices on the inside of the network.

14:47.140 --> 14:54.000
So this module allows the actor to compromise devices on the inside of the security perimeter without actively scanning and exploiting them.

14:54.000 --> 14:58.500
It happens invisibly at the router.

14:59.280 --> 15:04.080
There's a Tor module, which gives stage two the ability to communicate with command and control over Tor.

15:04.160 --> 15:10.840
And then the kill brick component that I mentioned was in stage two.

15:10.920 --> 15:16.080
It meant the older stage twos we found had baked in kill.

15:16.140 --> 15:24.000
The newer ones, it was missing and we had a suspicion that okay, there's probably a stage three that does that and later on we confirmed.

15:24.280 --> 15:34.080
So this this destroy will go through and clear artifacts like indicators of compromise to try and erase any tracks of its presence.

15:34.080 --> 15:36.540
And then it will brick the device.

15:36.820 --> 15:44.840
Usually the brick is by overriding the first I think 5000 was the most when we saw 5000 bytes of flash.

15:44.980 --> 15:53.800
So it's essentially wiping out the boot loader and the device is done unless you can reprogram that flash memory, which you're not doing on any of these devices.

15:53.940 --> 15:57.840
And 99.9% of the population couldn't even do it if the capability was there.

15:58.340 --> 16:00.760
So brick device bad.

16:01.340 --> 16:04.560
I said very specific or very sophisticated.

16:05.780 --> 16:15.900
So why would somebody go through the trouble of actually building something like this, spending several years doing it, deploying it globally, obviously it probably costs millions of dollars over time.

16:16.180 --> 16:19.020
This is a global intelligence infrastructure.

16:19.900 --> 16:24.480
What we used to refer to as computer network operations are now referred to as cyber operations.

16:24.480 --> 16:31.240
This gives a massive distributed global network to conduct those cyber operations from and mask attribution.

16:31.460 --> 16:41.700
So the any attacks or traffic that comes through this network is going to look like it comes from a SOHO device, you know, somewhere in wherever they choose to make it look like it comes from.

16:41.700 --> 16:45.980
It makes it difficult to track people or track the attribute attacks.

16:47.160 --> 16:50.420
It's also a data collection platform, passively.

16:51.280 --> 16:54.940
What Carlos is going to talk about is going to mention some passive collection and active.

16:54.940 --> 17:03.800
These devices have been used to scan for other things, and then sometimes scan for other vulnerable things and then exploit them and add them to the VPN filter network.

17:04.340 --> 17:15.800
The destructive attack is the thing that we were the most worried about when we had to decide whether or not we were going to go public, or when we would eventually go public, but this kind of drove us to go public when we did.

17:16.340 --> 17:24.160
The actor had the ability to effectively knock about half a million networks off the internet all at once.

17:24.460 --> 17:29.960
So not half a million devices by knocking these routers off, you're knocking everything behind the routers off the internet too.

17:29.960 --> 17:33.640
So take a half a million networks off the internet all at once.

17:33.640 --> 17:34.680
It's pretty serious stuff.

17:34.680 --> 17:36.520
And we were pretty worried about that.

17:36.520 --> 17:37.920
Thankfully, it never happened.

17:38.520 --> 17:41.980
Also, you've got the ability to exploit inside the network.

17:42.900 --> 17:49.400
If the actor was on the internal network, and had been kicked out, so they have a point of presence on the edge router.

17:50.100 --> 17:55.320
And unless the incident response team actually went and validated that they were booted off those edge routers, they can come right back in.

17:55.580 --> 17:57.800
And then everything that the botnet can do, this can do too.

17:57.800 --> 17:59.540
So it has a lot of value.

18:02.540 --> 18:04.860
So that's kind of the big picture overview.

18:05.120 --> 18:11.600
The four hour discussion about what VPN filter is distilled down into 15 minutes.

18:11.820 --> 18:15.900
This is the ICS village, we want to talk about stuff that ICS people care about.

18:15.900 --> 18:22.400
Carlos is going to talk about the technical aspects of the VPN filter, Modbus module.

18:22.720 --> 18:23.400
Carlos.

18:23.400 --> 18:24.560
Thanks, Patrick.

18:26.180 --> 18:31.460
Alright, so I'm going to talk about the VPN filter packets and for module.

18:32.820 --> 18:38.160
The packets for module was responsible for inspecting packets and logging certain connections.

18:38.180 --> 18:44.060
Specifically, the packets for module would log connection information about HTTP and certain Modbus connections.

18:44.700 --> 18:50.280
The packets for module was targeting the R 600 VPN router, which is a five port SOHO router.

18:50.640 --> 18:54.260
When we did a quick search on showdown, we found around 5000 of these devices online.

18:54.260 --> 19:03.900
But I think it's safe to assume that there's a lot more than 5000 devices these online, because showdown was just showing us ones that were that had no mantra enabled and were accessible on the internet.

19:04.520 --> 19:09.420
So this is the picture of the device, the Qt Link R 600 VPN router.

19:10.440 --> 19:13.040
The malware was specifically targeting this device.

19:14.940 --> 19:17.860
So the packet sipper is compiled for Lexra.

19:17.860 --> 19:19.560
Has anybody here heard of Lexra?

19:20.000 --> 19:20.960
Cool.

19:21.020 --> 19:21.960
Two people.

19:22.080 --> 19:22.560
Alright.

19:23.600 --> 19:26.940
This project is the first time I've ever worked with or even heard of Lexra.

19:26.940 --> 19:30.020
It's really similar to MIPS, but it's missing some instructions.

19:30.960 --> 19:35.480
Initially, when I started working on this, I thought the device and sample were MIPS.

19:35.500 --> 19:41.320
And this was problematic, because Patrick and I were attempting to get compiled MIPS code running on the R 600, but we kept getting seg faults.

19:41.640 --> 19:45.280
Eventually, one of our co-workers found out it was Lexra and helped us out with that.

19:45.280 --> 19:46.080
So it was good.

19:48.360 --> 19:50.880
So first off, I want to give a huge shout out to Carl Hurd.

19:50.880 --> 19:55.340
He works on our team at Cisco Talos, and he was the first one to reverse the packets for module.

19:56.060 --> 19:59.360
The sample was first uploaded to VirusTotal in 2016.

19:59.800 --> 20:01.800
So this module has been around for quite some time.

20:02.220 --> 20:08.160
I wonder how long the module has been around, because 2016 is just the first time it was uploaded to VirusTotal.

20:08.820 --> 20:10.800
The module is a Linux ELF.

20:10.800 --> 20:12.420
It's stripped and statically compiled.

20:12.700 --> 20:16.080
The fact it was stripped and statically compiled, made reversing a little bit more difficult.

20:16.120 --> 20:20.560
We had no function names, even Lipsy functions, they were unnamed, which was pretty annoying.

20:22.740 --> 20:25.620
So the sample will inspect every packet.

20:26.700 --> 20:28.500
It will initially do some checks.

20:28.620 --> 20:34.940
So it will first check to see if the packet is greater than 150 bytes, if the packet is IPv4, and if the packet is TCP.

20:34.940 --> 20:40.520
If all those conditions are met, then the sample will look for Modbus NHDP.

20:42.440 --> 20:47.500
So in order for the packet sniffer module to run, two arguments need to be provided.

20:47.660 --> 20:50.340
The first argument is the logging directory.

20:50.340 --> 20:52.060
This is where the logs will be stored.

20:52.140 --> 20:54.300
And the second is an IP address.

20:54.700 --> 20:58.280
If these two arguments are not provided, the sample will just exit.

20:58.360 --> 21:03.600
But if the two arguments are provided, we immediately enter the packet's parsing loop.

21:04.160 --> 21:12.720
So in the packet parsing loop, in the beginning we have some IP checks, checking for IPv4, TCP, and the packet size.

21:13.100 --> 21:17.280
And if those checks pass, then we will start looking for Modbus.

21:17.960 --> 21:23.480
And if the loop does not detect Modbus, then it will check for HDP.

21:26.180 --> 21:34.300
So all network traffic passes through this loop, and the loop is specifically looking for Modbus and HDP, and it will discard anything else.

21:34.600 --> 21:41.380
So if something doesn't meet the criteria for Modbus or HDP, the packet will be discarded and the loop will be restarted with the next packet.

21:45.080 --> 21:49.380
So for each packet, the loop is going to check to see if the packet is greater than 150 bytes.

21:50.080 --> 21:52.600
Then the loop is going to make sure the packet is IPv4 and TCP.

21:53.100 --> 21:56.580
And finally, we start the Modbus and HDP checks.

21:58.400 --> 22:02.560
So first off, for those of you that may not know, Modbus is an ICS protocol.

22:02.700 --> 22:12.300
It's commonly used by PLCs, runs on port 502, and the protocol is open so you can grab it from Modbus.org, and it doesn't support encryption.

22:14.820 --> 22:19.600
So once the loop has done the initial IP checks, the loop is going to check for Modbus.

22:19.640 --> 22:24.140
It does this by checking to see the packet's destination port and seeing if it equals 502.

22:24.220 --> 22:32.620
If it does, then the next check is if the packet's destination address is the same IP as the IP provided by the second argument provided to the binary.

22:32.880 --> 22:39.240
If both those checks return true, then the sample considers this packet a Modbus packet and login code gets called.

22:41.300 --> 22:45.700
So the log file is stored in the location provided by the first argument.

22:46.400 --> 22:52.380
The log file will be named rep underscore percent U dot bin, where percent U is the time the log file was written.

22:53.560 --> 23:02.080
The only thing that gets logged for the Modbus portion is the source IP, source port, destination IP, and the destination port.

23:03.600 --> 23:08.440
So this is an example of what the log file might be named and what it might contain.

23:08.620 --> 23:17.580
So rep underscore and a time value dot bin would be the name of the file, and then what's highlighted in orange is what would actually be inside the file.

23:18.200 --> 23:26.360
So we have asterisk Modbus asterisk new line, source IP, colon source port, with a little arrow, to destination IP, destination port.

23:29.550 --> 23:34.410
So I wonder why a sample specifically designed for a SOA router is looking for Modbus .

23:34.410 --> 23:45.670
I don't know if this router will ever be in a position to look at ICS traffic or Modbus traffic, and additionally I wonder what value the Modbus log provides.

23:45.950 --> 23:49.610
The log is a source IP, source port, destination IP, and destination port.

23:49.850 --> 23:56.070
And the destination IP address and the destination port have to be provided to the binary.

23:56.070 --> 23:59.850
So the only thing you get really is the source IP address and the source port.

24:04.360 --> 24:14.000
So, as loop continues, if the loop determines that the packet is not Modbus, then it will start looking for HTTP authorization.

24:15.380 --> 24:25.060
So just a quick recap, in order for the HTTP checks to start, the packet needs to be TCP, IPv4, greater than 150 bytes, and not Modbus.

24:25.060 --> 24:27.260
Then the HTTP checks start.

24:28.880 --> 24:37.060
So, the HTTP checks consist of checking the destination IP address, source port, length of the data, and several strings checks.

24:38.020 --> 24:42.900
The destination IP must be the same as the IP address that was provided to the sample when the sample was initially started.

24:42.900 --> 24:44.800
So it's looking for a very specific IP address.

24:45.480 --> 24:51.960
The source port must be greater than 1024, but it can't be 8080 or 8088.

24:52.760 --> 24:57.960
The length of the data must also be greater than 20 bytes, and then we move on to the strings check.

24:59.020 --> 25:05.940
So, in order for the packet to be logged, the packet must not contain any of the strings in that code block.

25:10.690 --> 25:18.870
And additionally, the packet must contain the string authorization basic, or a username and password combination, but it can't contain both.

25:18.870 --> 25:23.530
If it contains both, the packet will be discarded, and the loop will restart with the next packet.

25:24.730 --> 25:34.830
So, in this code block on the left, I have user names, or user parameters, and on the right, password parameters, so you have to have one from each side in order for the packet to be logged.

25:37.310 --> 25:49.270
If the HTTP logging has been met, the entire packet is logged to rep underscore %u.bin, where %u is the time of logging.

25:50.030 --> 25:59.450
And the log will be stored in the location provided to the sample when you initially ran it.

26:01.130 --> 26:06.190
So, it looks like the HTTP checks are looking for credentials to a specific website.

26:06.250 --> 26:11.770
It's highly targeted, as the destination IP address is already known, and needed for the packet zipper sample.

26:11.870 --> 26:18.130
Additionally, the sample does not send logs off the remote server, but maybe another sample does this, I don't know.

26:20.690 --> 26:27.330
So, in conclusion, the sample is targeting, specifically, the R600 bpen router, which is a SOHO router.

26:27.490 --> 26:32.810
The sample is looking for a specific IP address, and is grabbing modbus.http information.

26:33.590 --> 26:42.630
The sample cannot modify traffic without a significant code rewrite, but we have, as Patrick said, we've observed other samples that are able to modify traffic.

26:44.110 --> 26:47.230
So, thanks for coming to talk, hope you guys enjoyed it.

26:54.040 --> 26:58.680
I just want to reinforce, it's very, very targeted.

26:58.820 --> 27:04.160
Just that model of device, you have to give it the destination IP address.

27:04.780 --> 27:10.640
It's logging just the source IP and source port of modbus traffic, nothing else.

27:10.660 --> 27:15.500
And it's got a bunch of filters in place to discard a lot of the HTTP auth stuff.

27:15.700 --> 27:24.760
And it's storing the whole packet, but the filters in place will ensure that only a few of the packets that contain HTTP authentication stuff actually get saved.

27:25.860 --> 27:31.000
So, the question is, in what environment are you going to find this router?

27:31.300 --> 27:38.160
And what ICS device would be on the target of this?

27:38.380 --> 27:52.660
Where somebody would be on one side of this router and there would be an ICS device on the other, and both modbus traffic and HTTP traffic are passing to the same device, because the IP address is given as an argument when the module is run.

27:53.120 --> 27:57.020
So, that is the question of the day.

27:58.280 --> 28:00.400
Where is this device being used?

28:00.720 --> 28:08.360
And what ICS device receives modbus traffic and gets authentication over HTTP?

28:09.360 --> 28:11.060
We'll take questions.

28:11.060 --> 28:17.160
I was wondering, is it common at all for ICS type environments to use SOHO routers?

28:17.160 --> 28:18.160
Has that been found?

28:18.160 --> 28:26.180
Is that possible that the attackers have a very specific configuration in mind that they're going for somewhere that uses that sort of setup?

28:26.180 --> 28:35.000
So, in this case, this is obviously intended to target either a specific individual or a specific group that does things a certain way.

28:35.940 --> 28:38.400
This specific module isn't going to work on any of the other.

28:38.400 --> 28:42.700
It won't work as a plug-in to stage two on a different device.

28:42.700 --> 28:50.660
It only works on the TP-Link R600 VPN, and you have to give it that destination IP before it will log anything.

28:50.800 --> 28:58.200
So, when the actor dropped this, it's obvious that they were looking for certain stuff and only certain stuff, because it filters out everything else.

28:58.200 --> 29:01.520
Even things that would be valuable, like other HTTP connections.

29:03.200 --> 29:06.420
I mean, it's hard to say, but they might have had something specific in mind.

29:06.420 --> 29:09.380
Yeah, and whether or not this device should be an ICS environment?

29:09.380 --> 29:11.140
No, but whether or not it is?

29:11.140 --> 29:12.020
Yeah.

29:12.760 --> 29:20.740
So, I think some figure, like oil companies and stuff, backhaul their ICS communication back to their condition.

29:22.200 --> 29:25.600
So, you can considerably see that suit on someone's desk.

29:27.720 --> 29:29.180
I don't have a question.

29:29.180 --> 29:29.810
What type of...

29:32.740 --> 29:46.040
I would like to, and this is for you guys, if you can think of any field devices that may be what the actor was looking to receive the information about, if you want to, let me know.

29:46.040 --> 29:46.340
Let me know.

29:46.480 --> 29:52.960
Otherwise... It's not like a module for another industrial hardware type device.

29:53.400 --> 29:54.160
What do you mean?

29:54.240 --> 29:58.820
Well, you know, like, would they use that same core for another industrial hardware device?

29:58.820 --> 29:59.780
For the TV link?

30:00.160 --> 30:01.420
Not to my knowledge.

30:01.420 --> 30:04.940
It's just that, yeah, as far as I know.

30:05.400 --> 30:08.380
And it's that weird, like Carlos said, it's that lecture architecture.

30:08.720 --> 30:17.480
So, as we were writing our own proof of concept code and executing it on the device, we were getting psych faults all day long.

30:17.680 --> 30:21.740
And it turns out we needed a custom tool chain to compile code for this device.

30:22.000 --> 30:27.480
So it's not like it's, you know, the code may be portable, but it's still got to be compiled specifically for this.

30:27.640 --> 30:28.640
I don't know of anything.

30:28.640 --> 30:32.440
And there's strings in the binary that say R600 VPN.

30:32.700 --> 30:37.240
You know, so even if there was something else that , you know... Using that more... Right.

30:37.400 --> 30:38.400
Incorporated with it.

30:38.400 --> 30:38.820
Yeah.

30:40.420 --> 30:43.400
So just to be clear, is the package going through it?

30:43.680 --> 30:51.720
It looks at every packet that travels through it, and then it goes through the checks that Carlos explained to filter out the stuff that it doesn't want.

30:52.100 --> 30:57.040
And if it meets all the checks for Modbus, it just logs stuff that it already knew.

30:57.040 --> 31:03.480
Like it knows the destination IP because it's an argument that was passed to it when the module was executed.

31:03.660 --> 31:06.000
It doesn't log any of the Modbus data.

31:06.080 --> 31:14.900
It just... The IP address that the traffic came from and the port that it came from, and the IP address that it was going to, which we know, and port 502, which we know.

31:14.900 --> 31:19.080
So the only thing the actor learns that's new is source port and source IP.

31:19.580 --> 31:29.420
And then any HTTP traffic that meets all those filters going to the same IP address as the Modbus is going to, it'll log that entire packet.

31:30.820 --> 31:31.700
Yes?

31:43.840 --> 31:55.600
So in this instance, I would imagine they either did it manually, especially since it's so targeted, or there may have been capability at the C2 node that would connect and pull, right?

31:57.080 --> 31:58.280
No.

31:59.580 --> 32:03.340
Stage 2 had the ability to execute shell commands.

32:03.340 --> 32:07.160
So it'd be just like you're logged in to the terminal, you know, as splitting through.

32:07.660 --> 32:15.660
Were you able to do any analysis just where, you know, say there's 5,000 routers, you know, was there any, hey, that's a lot.

32:16.180 --> 32:21.820
Were there any kind of geographic trends you could see in certain countries or in certain areas?

32:23.020 --> 32:26.200
Nothing that stood out at the time, but we have the map and slides.

32:26.200 --> 32:28.740
We can put it up on the, and if you can zoom into it.

32:29.040 --> 32:29.500
Yeah.

32:30.780 --> 32:38.800
Most of the U.S., so almost 900 in the U.S., 600 in Russia, Brazil, Portland, Uruguay.

32:38.800 --> 32:44.740
And this is just specifically the TP-Link R600 VPN with remote management enabled.

32:46.300 --> 32:51.640
My first thought was it was oil and gas.

32:51.780 --> 32:53.400
Oil and gas.

32:55.640 --> 32:57.740
Not a lot of evidence.

32:57.740 --> 32:58.480
Right.

32:59.920 --> 33:00.500
Yes, sir.

33:00.500 --> 33:01.980
Piece into the breadcrumbs together.

33:02.920 --> 33:05.100
Following the breadcrumbs, you all piece into the breadcrumbs.

33:06.660 --> 33:07.660
Yes, sir.

33:07.760 --> 33:10.160
Yeah, the first stage, the raw socket.

33:13.740 --> 33:16.220
Easy way to take over the whole box.

33:16.220 --> 33:24.920
Yeah, so anybody that knows what that SIM packet is can own any device that is in that passive raw socket mode.

33:25.240 --> 33:35.040
So you just have to send a SIM that has the right magic bytes, and then it's going to pull out an IP address, and it's going to reach out, and you're going to have to deliver stage two to it.

33:35.120 --> 33:37.580
But I mean, if you know, so yeah, you could do it.

33:46.150 --> 33:58.450
For this module, because it's set up to just log the data about what goes through, it would be, it would need to be seriously modified to intercept.

33:59.290 --> 34:05.270
So instead of just looking at the packet and allowing it to go through, it's going to have to stop it, change it, pass it through.

34:05.270 --> 34:09.370
This module doesn't have any capability to do that, but that other module does.

34:09.370 --> 34:12.450
So they definitely have the ability to modify traffic.

34:12.450 --> 34:15.730
This module does not, but it's still possible.

34:18.750 --> 34:20.970
How alarming is this behavior?

34:20.970 --> 34:26.570
Has there been any sort of effort to go out and be like, have you seen this router to like potential industrial use cases or anything?

34:26.570 --> 34:28.850
Or is it kind of still pretty passive collection?

34:28.850 --> 34:30.990
Like, maybe...

34:30.990 --> 34:32.810
I'm here asking you guys.

34:35.350 --> 34:51.670
It's intriguing because it's so targeted, but because of the wide range of vendors and devices that were also known to be used, this type of activity could be used on any of those other devices.

34:51.670 --> 34:53.870
They just had to pile for the device and push it out.

35:03.370 --> 35:11.070
So it depends on which stage it's in and what device it is, and there's a whole bunch of weird ways to figure it out.

35:11.070 --> 35:16.850
If it's in that raw socket mode, you can detect it.

35:17.750 --> 35:19.510
CyberX put out a script a few weeks ago.

35:19.510 --> 35:26.950
It's up on GitHub, where it'll send the SYN packet and it'll reach out to an IP that the script gives.

35:27.670 --> 35:38.650
Also, I think on Sys or Mac, if someone corrects me if I'm wrong, Symantec had a tool that would let you know if... I

35:41.840 --> 35:55.960
think it was just a module.

35:57.520 --> 36:04.260
I did my damnedest to get live devices...

36:04.260 --> 36:11.320
If they had live devices, established connection and control, they just never had that module pushed out.

36:11.320 --> 36:17.260
So one of the interesting things about the Stage 3 modules, the device has to be tasked to pull them down.

36:17.260 --> 36:21.780
There's no list of modules in Stage 2 that it knows.

36:21.780 --> 36:23.500
You have to know the name of the module.

36:23.500 --> 36:31.720
The device has to be told, reach out and get this module, and then it will reach out to Command and Control, request the module, retrieve it, and execute it.

36:31.940 --> 36:38.000
So yeah, I'd like to be able to say, like, I just requested all the modules from Command and Control.

36:38.000 --> 36:43.520
I don't know, but without knowing the names of them, they could have had it and just... we never saw it.

36:44.100 --> 36:46.880
They were selective about what they deployed and where they deployed it.

36:48.120 --> 36:49.200
I saw another hand.

36:49.200 --> 36:54.200
So, you said that you got a virus code on 2016?

36:55.040 --> 36:56.740
This module did, yes.

36:56.980 --> 36:59.380
And what was that?

36:59.380 --> 37:01.680
Was that somebody uploading firmware?

37:03.100 --> 37:04.980
I'm wondering what was the circuit?

37:04.980 --> 37:13.600
So this specific binary is ELF executable, so Linux executable, and they uploaded that executable.

37:13.600 --> 37:14.940
I'm wondering how they got it.

37:14.940 --> 37:17.340
Did you ask Iris to upload it?

37:18.780 --> 37:21.320
I mean, should you?

37:21.620 --> 37:22.480
Right.

37:24.620 --> 37:27.140
I'm just wondering how they would have gotten it.

37:27.140 --> 37:28.840
I would love to know.

37:28.840 --> 37:30.560
I would love to know who uploaded it.

37:30.560 --> 37:37.100
So, in order to get it off of the device, you've got to own the device.

37:37.100 --> 37:49.280
Some of the older TP-Link R600s had a backdoor web shell that was known, so somebody could have used that and saw that they were in fact pulled it off and uploaded it.

37:49.280 --> 37:51.040
The actor may have uploaded it.

37:51.680 --> 37:53.920
Some people will trade graphics a little.

37:54.220 --> 37:56.000
Everybody's been known to make mistakes.

37:56.280 --> 37:57.300
So maybe they...

37:57.300 --> 38:04.800
Other than that, it would have either been pulled out of network traffic and uploaded, pulled off the device and uploaded, or uploaded by the actor.

38:07.180 --> 38:09.100
Well, all that seems very unlikely.

38:11.440 --> 38:12.160
I mean...

38:13.560 --> 38:18.280
No, I would love to hear ideas and scenarios for...

38:18.280 --> 38:21.920
And this is just one of countless modules.

38:22.300 --> 38:28.680
So, we know how many we've seen, but theoretically, it's up to the actor.

38:28.680 --> 38:30.540
They can just write it in the file and push it out.

38:30.840 --> 38:32.500
Those are their plugins.

38:32.920 --> 38:36.020
You mentioned there's a possibility this is a control, right?

38:36.300 --> 38:37.340
So that's one thing.

38:37.340 --> 38:45.520
I don't know if you mentioned it or not, but it's in the realm possible that the actor put that in there to distract you.

38:45.520 --> 38:47.460
Like, oh shit, they're looking for Modbus.

38:47.920 --> 38:48.500
You know?

38:48.920 --> 38:49.720
Yeah, exactly.

38:51.040 --> 38:51.760
Right.

38:53.640 --> 38:54.940
Were they really looking at Modbus?

38:54.940 --> 38:56.840
Or did they want us to think they were looking at Modbus?

38:58.980 --> 39:00.180
If you guys know.

39:00.800 --> 39:01.680
I'll buy you a beer.

39:04.440 --> 39:05.200
A sample?

39:06.100 --> 39:06.580
So...

39:07.200 --> 39:07.920
No.

39:09.800 --> 39:14.800
Well, I mean, if you have a paid account with Wirestotal, you have access to all that stuff.

39:14.800 --> 39:17.660
So, anybody in this room could search.

39:21.850 --> 39:29.450
So, Talos is working with several partners, external to Talos, and that's one of those things that I'm not going to get into.

39:29.790 --> 39:36.910
But the blog post that initially disclosed this will tell you as much as we're comfortable releasing.

39:36.910 --> 39:38.950
But we work with people outside of Talos.

39:47.430 --> 39:53.730
I don't remember, do you remember the VPN function in that?

39:53.730 --> 39:54.290
I don't remember.

39:54.290 --> 39:56.130
I'm pretty sure it was just using OpenVPN.

39:56.130 --> 39:59.490
It was BusyBox and OpenSSL and OpenVPN.

39:59.490 --> 40:01.310
We're pretty sure.

40:01.310 --> 40:02.550
I can double check.

40:03.930 --> 40:10.610
But if anybody has any other questions or follow-ups, you can just hit me or Carlos up here or afterwards.

40:36.510 --> 40:46.350
So, if you specify any IP address, it's the destination IP address, and then as the traffic passes through, it'll log the actual credentials going to that IP.

40:47.590 --> 40:49.230
Is that what you're saying you found?

40:54.730 --> 40:57.210
We think there's a couple, yeah.

40:57.370 --> 41:04.350
So, it can take three parameters or arguments, but it only takes two.

41:04.350 --> 41:05.630
So, what's the third?

41:05.630 --> 41:08.950
What was the other?

41:08.950 --> 41:16.750
So, it'll accept, it'll log the traffic, if it has HTTP basic authorization or a username and password combination.

41:16.750 --> 41:20.050
But if both are present, it ignores it.

41:20.570 --> 41:22.090
So, I mean, there were a few things where...

41:23.350 --> 41:33.730
My theory was that they were eliminating as much noise as possible, because if you start logging everything that matches HTTP basic auth and everything that matches Modbus, the device is going to fill up and you're going to have a break.

41:33.730 --> 41:38.730
So, they wanted to filter out everything except what they were specifically looking for.

41:38.730 --> 41:40.650
That's just my theory.

41:40.870 --> 41:43.650
And, yeah, I think there's a couple coding mistakes too.

41:46.070 --> 41:47.410
All right, thank you.

41:47.410 --> 41:48.270
Appreciate it.

