1 00:00:00,000 --> 00:00:05,740 We have a new speaker today, so please give him a big round of applause. 2 00:00:06,280 --> 00:00:10,520 The guy's name is called Ben Bolland. 3 00:00:10,520 --> 00:00:14,080 He's from England, across the pond. 4 00:00:14,360 --> 00:00:20,540 The talk we're giving today is called, Man in the Malware, Intercepting Adversarial Communications. 5 00:00:21,280 --> 00:00:22,920 So, it's his first time. 6 00:00:22,920 --> 00:00:24,220 Make him feel welcome. 7 00:00:24,480 --> 00:00:25,660 And thanks for coming today, guys. 8 00:00:25,660 --> 00:00:26,380 All right? 9 00:00:27,560 --> 00:00:29,000 There you go. 10 00:00:31,280 --> 00:00:33,040 Thank you, thank you, thank you. 11 00:00:35,240 --> 00:00:36,360 And welcome. 12 00:00:36,720 --> 00:00:40,220 As he mentioned there, yeah, this is my first DEF CON talk. 13 00:00:40,220 --> 00:00:42,240 This is actually the second time I've been in the States. 14 00:00:42,240 --> 00:00:43,620 The first was last week. 15 00:00:43,700 --> 00:00:44,700 I'm loving it. 16 00:00:44,700 --> 00:00:47,260 It's been an incredible event so far. 17 00:00:47,440 --> 00:00:52,380 And before I get started, I just want to say a massive thank you to everybody who's chosen to come to this talk. 18 00:00:52,380 --> 00:00:56,180 I know you've got super busy days, so I appreciate that. 19 00:00:57,380 --> 00:00:59,580 So yeah, without further ado, let's begin. 20 00:00:59,580 --> 00:01:00,880 Let's jump in. 21 00:01:01,500 --> 00:01:02,860 So, quick agenda. 22 00:01:02,860 --> 00:01:05,080 I'm going to start off with an obligatory, who am I? 23 00:01:05,080 --> 00:01:07,600 I'm going to talk about myself, what I do, where I'm from. 24 00:01:07,680 --> 00:01:12,060 And then we're going to make sure we're all have a similar level of understanding. 25 00:01:12,060 --> 00:01:17,080 We've covered the baseline knowledge surrounding info-stealers, malware, command and control. 26 00:01:17,360 --> 00:01:23,660 And we're going to look about different ways malware can achieve command and control and can exfiltrate data. 27 00:01:23,660 --> 00:01:25,960 And we're going to look at Telegram as an example. 28 00:01:25,960 --> 00:01:30,180 And we're going to look at the OPSEC issues this may cause. 29 00:01:30,480 --> 00:01:44,480 And then finally, we're going to finish off with a case study where we intercept some communications from a threat actor and there are some major, major OPSEC failures which lead to some awesome intelligence wins for us. 30 00:01:44,780 --> 00:01:46,260 So yeah, who am I? 31 00:01:46,260 --> 00:01:47,100 I'm Ben. 32 00:01:47,100 --> 00:01:49,300 I go by the online handle PolygonBen. 33 00:01:49,300 --> 00:01:52,540 I'm extremely fortunate to work at Huntress. 34 00:01:52,540 --> 00:01:53,640 I'm an analyst there. 35 00:01:53,640 --> 00:01:55,220 Um, in the UK team. 36 00:01:55,580 --> 00:01:58,480 Um, and I just want to take a chance to, to thank Huntress. 37 00:01:58,620 --> 00:02:01,140 Um, I wouldn't be here if it wasn't for them. 38 00:02:01,200 --> 00:02:02,780 Um, so thanks a lot. 39 00:02:02,780 --> 00:02:04,780 Um, and I love threat hunting. 40 00:02:04,780 --> 00:02:05,840 I love malware analysis. 41 00:02:05,840 --> 00:02:07,500 Um, I'm a big blue teamer. 42 00:02:07,660 --> 00:02:09,980 Um, I've got a blog, a YouTube channel. 43 00:02:09,980 --> 00:02:14,260 I got into security by doing CTFs when I was, um, a bit younger. 44 00:02:14,260 --> 00:02:15,560 But enough about me. 45 00:02:15,560 --> 00:02:17,440 Um, let's get to the interesting part . 46 00:02:17,440 --> 00:02:19,280 Um, so what's ahead, right? 47 00:02:19,280 --> 00:02:21,740 We're going to be looking at real malware, real info-stealers. 48 00:02:21,740 --> 00:02:23,600 I'm going to be doing some live malware analysis. 49 00:02:24,060 --> 00:02:29,640 Um, and we're going to look at this malware and figure, um, some mistakes that the threat actor made. 50 00:02:29,640 --> 00:02:32,220 And we're going to exploit these mistakes for intelligence wins. 51 00:02:32,560 --> 00:02:40,400 And as a result of these intelligence wins, we're going to be able to look at a whole cyber crime operation from the cyber criminal's own hacking machine. 52 00:02:40,760 --> 00:02:41,760 Um, so yeah. 53 00:02:41,980 --> 00:02:42,880 Let's get on with it. 54 00:02:42,880 --> 00:02:43,800 Let's take a step back. 55 00:02:43,800 --> 00:02:45,200 That sounds super exciting. 56 00:02:45,320 --> 00:02:47,980 Um, super interesting, but we need to cover the foundations. 57 00:02:48,440 --> 00:02:54,220 Um, so info-stealers, command and control, threat intelligence, OPSEC or operational security, malware analysis. 58 00:02:54,220 --> 00:02:56,640 We're going to go through the basics to begin with. 59 00:02:56,940 --> 00:02:58,380 Um, so info-stealers. 60 00:02:58,380 --> 00:03:00,760 Info-stealers is just a type of malware. 61 00:03:00,760 --> 00:03:08,080 They're, um, a specific type of malware which will exfiltrate data and steal, uh, credentials and sensitive documents. 62 00:03:08,080 --> 00:03:12,480 And it will send it back to an attacker owned location or an attacker controlled location. 63 00:03:12,480 --> 00:03:14,540 This could be an FTP server. 64 00:03:14,580 --> 00:03:17,220 Um, they could be exfiltrating data over DNS. 65 00:03:17,220 --> 00:03:22,380 There are multiple ways, um, uh, information can be exfiltrated. 66 00:03:22,720 --> 00:03:27,240 Um, and in terms of the malware we're seeing most in the wild, it's info-stealers. 67 00:03:27,240 --> 00:03:32,240 Um, we're particularly seeing a lot of info-stealers getting deployed via click fix and fake capture. 68 00:03:32,240 --> 00:03:45,920 This is the, uh, sort of new malware delivery technique which came around, uh, September last year and it's sort of blown up in prevalence where you just sort of trick a user to pasting a command into run box or Windows PowerShell or something like that. 69 00:03:45,920 --> 00:03:50,720 It's really simple but it's effective and we're seeing a lot of info-stealers get deployed as a result of this. 70 00:03:51,180 --> 00:03:55,460 Um, so command and control, um, all malware will communicate for the most part. 71 00:03:55,460 --> 00:04:02,240 It has to either receive commands from some threat actor and server or it needs to exfiltrate data or send data back to some server. 72 00:04:02,240 --> 00:04:04,540 So malware will typically communicate. 73 00:04:04,540 --> 00:04:14,460 There are some exceptions where there is no malware communi- there's no communication, there's no network traffic but for the most part, malware will communicate and there are multiple ways they can do this. 74 00:04:14,540 --> 00:04:26,040 Um, if we look at command and control, this just command and control describes the techniques by which malware or threat actors can communicate with a victim machine and a threat actor in location. 75 00:04:26,520 --> 00:04:29,200 Um, so how does this communication occur ? 76 00:04:29,200 --> 00:04:37,800 Um, traditionally we saw, uh, malware CTU over regular network protocols like HTTP, HTTPS, DNS, SMTP. 77 00:04:37,800 --> 00:04:44,940 This sort of blends in with regular traffic and you're not seeing let's say a network connection to port 31337 which is super dodgy. 78 00:04:44,940 --> 00:04:49,400 Um, but even this traditional CTU, it's not perfect and it has its issues. 79 00:04:49,880 --> 00:04:54,760 Um, so for example if you did want to do this, a threat actor or cyber criminal would have to buy their own domain. 80 00:04:54,760 --> 00:04:57,560 They would have to set up some hosting in the cloud. 81 00:04:57,640 --> 00:05:00,580 They would configure their CTU server, set up their firewall. 82 00:05:00,740 --> 00:05:04,240 Um, and this takes a lot of effort and there's, um, issues with this. 83 00:05:04,240 --> 00:05:19,620 You have to obviously buy the infrastructure and host that and that may cause OPSEC issues depending on how you're paying for the infrastructure and it's going to get burnt eventually and you're going to have to rebuild this and it's sort of a cycle for these cyber criminals of rebuilding new infrastructure after old ones get burnt, 84 00:05:19,620 --> 00:05:20,660 um, and so on and so forth. 85 00:05:20,660 --> 00:05:22,160 And this is hassle. 86 00:05:22,280 --> 00:05:32,200 Um, so we're seeing a shift in threat actors moving from this sort of traditional method for command and control where you buy your infrastructure and you set it up to using trusted infrastructure. 87 00:05:32,200 --> 00:05:41,940 Um, so living off the land, um, so adversaries use free trusted platforms for command and control and there is a massive variation of platforms you could use. 88 00:05:41,940 --> 00:05:44,380 So, um, we can see up there Telegram. 89 00:05:44,380 --> 00:05:47,740 Um, you can even see CloudFlare, CounterStrike 1.6. 90 00:05:47,740 --> 00:05:50,120 I believe you can proxy C2 communications. 91 00:05:50,140 --> 00:06:06,220 Um, there are loads of different trusted platforms which you can proxy your C2 communications through and instead of, let's say when the malware executes, it, uh, makes a network connection to a newly registered suspicious dot X, Y, Z domain, it would make a network connection to a trusted, 92 00:06:06,220 --> 00:06:15,140 uh, Gmail API domain or Telegram API domain and this is less likely to, uh, raise flags for the network defenders. 93 00:06:15,420 --> 00:06:32,220 Um, so if you are a cyber criminal, you're a threat actor and you want a cheap way to host your command and control which is high availability , it's free, it's quick, it's serverless, it's encrypted , um, it's trusted and it's relatively anonymous. 94 00:06:32,220 --> 00:06:33,520 What would you choose? 95 00:06:33,980 --> 00:06:38,120 Um, for a lot of cyber criminals, the answer to this question is Telegram. 96 00:06:38,260 --> 00:06:49,840 And instead of let's say buying a domain and setting it up, they will create a Telegram account and create a Telegram bot and use the Telegram API to send data and receive commands and so on and so forth. 97 00:06:49,840 --> 00:06:59,240 Um, and there is a massive variation of malware, everything from rats, um, developed by nation states to info stealers, um, which use Telegram as a way to communicate. 98 00:06:59,240 --> 00:07:02,000 Um, however, it comes with its issues. 99 00:07:02,000 --> 00:07:12,480 Um, so in order to actually, um, use C2 over Telegram and to proxy your sort of command and control communications, you need a, a bot. 100 00:07:12,480 --> 00:07:16,600 This is like an automated account and anyone can easily create a bot. 101 00:07:16,600 --> 00:07:28,840 You just need to go on Telegram on your phone or on your computer and message the person bot father and you can just use the commands new bot and it asks for your username and it asks for, um, and then it will give you a bot token. 102 00:07:28,840 --> 00:07:40,920 This is your credential, your API key, your authentication material and you can see there, um, after it generates your token, it gives the message keep your token secure and store it safely. 103 00:07:40,920 --> 00:07:43,700 So this is really important, really important. 104 00:07:43,700 --> 00:07:49,980 If somebody else gets the hand of my bot token, they can control my account basically. 105 00:07:50,100 --> 00:08:02,560 And, um, for malware to communicate with the Telegram API, um, it has to use, it has to be embedded with some sort of API keys and Telegram authentication material for a particular bot account. 106 00:08:03,080 --> 00:08:04,980 Um, so how does this work? 107 00:08:04,980 --> 00:08:11,940 Um, the malware developer will hard code within the malware, sometimes encrypted, sometimes obfuscated the Telegram API key. 108 00:08:11,940 --> 00:08:29,660 And then when the malware is run and it's executed, um, instead of making a network connection to, um, uh, suspicious IP address or a domain name, it will send a DNS request to api.telegram.org and then starts sending HTTP requests to, um, the Telegram API. 109 00:08:29,680 --> 00:08:35,440 Uh, but what API methods would be useful for a threat actor or a cyber criminal who is developing malware? 110 00:08:35,460 --> 00:08:39,580 And particularly if you're interested in developing info-stealers which exfiltrate data. 111 00:08:39,840 --> 00:08:42,820 So first of all, we can use the send message API. 112 00:08:42,820 --> 00:08:43,860 This is really simple. 113 00:08:43,860 --> 00:08:50,940 It allows us to send mess- uh, send a message as a bot to a group chat or a channel or a private DM. 114 00:08:51,180 --> 00:08:53,260 And all it requires is a chat ID. 115 00:08:53,260 --> 00:08:57,840 This is a unique identifier of a chat and it requires some text to send. 116 00:08:58,020 --> 00:09:01,700 Um, so once you've got the chat ID, you can send whatever message. 117 00:09:01,700 --> 00:09:19,960 If you were a malware developer, um, maybe once you've harvested the credentials during the malware's execution and you want to send this to a location, where you would use the send message API, um, and provide the chat ID being the, the cyber criminal's Telegram chat and the text being what you want to exfiltrate, 118 00:09:19,960 --> 00:09:21,480 maybe the stolen credentials. 119 00:09:21,740 --> 00:09:25,020 Um, another important, uh, API method is get me. 120 00:09:25,020 --> 00:09:28,760 This will allow us to validate whether a Telegram bot token is valid. 121 00:09:28,760 --> 00:09:34,100 If it, the, the token still exists, um, and it can also tell us a bit more about the privileges. 122 00:09:34,120 --> 00:09:38,880 Like, can we add this particular bot to a group or can we, um, add it to a chat? 123 00:09:38,880 --> 00:09:39,840 Can we message it? 124 00:09:39,840 --> 00:09:46,760 Um, and sometimes it has extra capabilities like webhooks, um, which we can be made aware of from this get me function. 125 00:09:46,760 --> 00:09:50,820 This can help us enumerate the capabilities of a particular bot account . 126 00:09:51,360 --> 00:09:54,680 Um, oh, that's not working. 127 00:09:54,820 --> 00:09:56,740 Let me, there we go. 128 00:09:56,740 --> 00:10:00,420 And finally, we've got the get updates, uh, method. 129 00:10:00,420 --> 00:10:04,480 This will allow us to, uh, figure out changes which has happened to a bot . 130 00:10:04,480 --> 00:10:08,420 So let's say you've got a bot account and you add it to a new group or a new chat. 131 00:10:08,420 --> 00:10:13,520 When you call the get updates method, it will tell us the ID of the chat it is a member of. 132 00:10:13,520 --> 00:10:18,840 And if there's been any new messages received, um, if there's been any new members , um, so on and so forth. 133 00:10:18,840 --> 00:10:27,720 So we can use this, um, get updates method to enumerate what chats, what groups this particular bot is a part of. 134 00:10:27,720 --> 00:10:33,740 And if this is a cyber criminal's bot, we can see who else this bot is part of, what other chats are it in. 135 00:10:33,920 --> 00:10:35,460 And this is a really useful one. 136 00:10:35,460 --> 00:10:39,140 Um, and we use this mainly just to find those chat IDs. 137 00:10:39,140 --> 00:10:46,240 So for example, um, in the screenshot there, we can see this bot is a member of two particular distinct, uh, group chats. 138 00:10:46,600 --> 00:10:50,840 Um, and what we can then do is forward messages from one group to another. 139 00:10:51,280 --> 00:10:54,380 And we can use the forward message, uh, method to do this. 140 00:10:54,520 --> 00:11:00,460 And we need to provide the two chat IDs, the source chat and the destination chat. 141 00:11:00,460 --> 00:11:04,100 And a chat like a, an ID for a message, a message ID. 142 00:11:04,100 --> 00:11:12,300 Um, we don't know, we don't always know what the message IDs are so we can sort of enumerate through all possible integers and forward all messages across. 143 00:11:13,120 --> 00:11:19,160 Um, so for actor OPSEC failures, um, I talked about OPSEC earlier. 144 00:11:19,160 --> 00:11:24,620 Um, we're going to talk about a big OPSEC failure in a minute but I just want to, um, go over this to begin with. 145 00:11:24,620 --> 00:11:28,640 Um, so operational security, we hear it, uh, in the security community quite a lot. 146 00:11:28,640 --> 00:11:37,720 Maybe we're talking about an individual who is over sharing at a pub or maybe they've got too much on their social media or maybe they use the same password across all their different accounts. 147 00:11:37,720 --> 00:11:41,120 All of these things would constitute poor operational security. 148 00:11:41,440 --> 00:11:50,480 Um, and we often forget, like any individual in this room, cyber criminals and threat actors also have some level of operational security. 149 00:11:50,580 --> 00:11:57,920 Um, and I'm going to go over a few operational security failures that threat actors can make and we see them make quite often. 150 00:11:57,920 --> 00:12:09,140 Um, so for example, like, um, your IT infrastructure or your own network, if you have weak or default credentials or it's vulnerable, um, this would all constitute poor OPSEC. 151 00:12:09,320 --> 00:12:14,560 Um, having open directories, um, containing malware and your toolkit exposed. 152 00:12:14,560 --> 00:12:22,640 Um, often times when we're analyzing malware or we're looking at some execution chain, um, additional payloads will be pulled down from a web server. 153 00:12:22,700 --> 00:12:23,240 Okay? 154 00:12:23,240 --> 00:12:31,900 And when the threat actor sets up this web server, they may accidentally share the whole entire directory rather than the one payload they were, uh, aiming to share. 155 00:12:31,900 --> 00:12:38,580 And this means when we visit this open directory, we can see the whole entire file system and, uh, move through it. 156 00:12:38,580 --> 00:12:48,840 If this was, let's say, on a Linux machine on the home folder, uh, the threat actor may expose their bash history, uh, file which would, uh, leak all the commands the cyber criminal has run. 157 00:12:49,220 --> 00:12:54,160 And then I've highlighted their embedded malware with important API keys and credentials. 158 00:12:54,360 --> 00:12:56,900 Um, I don't really need to explain why this is an OPSEC failure. 159 00:12:56,900 --> 00:13:02,500 If we've got our hands on cyber criminals, um, passwords and credentials, they're doing something wrong. 160 00:13:02,880 --> 00:13:18,900 Um, reusing online handles across campaigns in real life, we see this quite a lot in law enforcement wins, um, whether it's an individual on a cyber crime forum who uses, um, the same online handle that they use, let's say, on Twitter or on some normal clear web forum from years ago. 161 00:13:18,900 --> 00:13:24,400 Um, we sometimes see this used in, um, arrests and takedowns and so on and so forth. 162 00:13:24,400 --> 00:13:26,480 Um, command and control not encrypted. 163 00:13:26,480 --> 00:13:39,340 So, um, if you've got your command and control communications, um, not encrypted as it's being sent through the network, network defenders may be able to look at this and, uh, find interesting information which is being sent or received. 164 00:13:39,340 --> 00:13:41,620 Um, and they could potentially use this in detections. 165 00:13:41,660 --> 00:13:44,540 Um, I'm not going to go through and explain all of these OPSEC failures. 166 00:13:44,540 --> 00:13:46,520 Um, a lot of them are pretty obvious. 167 00:13:46,520 --> 00:13:48,180 Um, I just wanted to highlight these. 168 00:13:48,280 --> 00:13:52,720 Um, so, uh, let me, there we go. 169 00:13:52,800 --> 00:13:53,500 Awesome. 170 00:13:53,500 --> 00:13:56,840 So, yeah, we can exploit these failures for intelligence wins, right? 171 00:13:56,840 --> 00:14:01,940 It's, it's fun to do this and I'm not saying go out there and start pwning threat actor infrastructure, that's illegal. 172 00:14:01,980 --> 00:14:17,060 Um, but what we can do in some cases may fall under sort of OSINT, whether it's like open directories that accidentally leaving their front doors open and sharing all their malware and their interesting files or whether it's them using the same domains and infrastructure across multiple attacks. 173 00:14:17,100 --> 00:14:19,200 Um, these will constitute OPSEC failures. 174 00:14:19,240 --> 00:14:23,480 Um, and we can all use these in the SOC, in the blue team, uh, to help our detections. 175 00:14:23,480 --> 00:14:28,120 Um, I gave an example here which is a, a really, really effective one we use at Huntress. 176 00:14:28,260 --> 00:14:32,560 Um, and that's the threat actors rarely change the host names of their machines. 177 00:14:32,560 --> 00:14:39,220 So, um, let's say they've got a, a, they've spun up a, a VPS somewhere and this is where they're initiating their attacks from. 178 00:14:39,220 --> 00:14:52,000 They may use the same image and share that across, um, uh, multiple intrusions and they use the same sort of, uh, VM image and we see the same host name popping up in the logs across multiple intrusions. 179 00:14:52,000 --> 00:14:55,760 Um, so we know this is a super, super high fidelity indicator of compromise. 180 00:14:55,760 --> 00:15:01,800 If we see this weird desktop unique username, I know for certain it's linked to XYZ threat actor. 181 00:15:01,800 --> 00:15:03,400 Um, and this is an OPSEC failure. 182 00:15:03,400 --> 00:15:06,520 If they changed up every time, we wouldn't be able to use this for detection. 183 00:15:06,680 --> 00:15:11,960 Um, so we're going to actually go on to the technical part now where we're going to be doing some live malware analysis. 184 00:15:11,960 --> 00:15:14,160 Everything I'm going to show is real. 185 00:15:14,160 --> 00:15:19,680 Um, it was found in the wild and I am going to show fake, uh, I'm going to show InfoStealer log data. 186 00:15:19,680 --> 00:15:24,540 Um, however all screenshots, um, and all images shown are of the cyber criminal's own desktop. 187 00:15:24,540 --> 00:15:26,220 No victim data is shown. 188 00:15:26,540 --> 00:15:32,000 Um, so we've got some malware analysis and like a lot of malware, it was delivered via phishing. 189 00:15:33,680 --> 00:15:37,300 And here we've got a DHL phishing campaign. 190 00:15:37,300 --> 00:15:41,780 We can see it's sent from no reply DHL at wind HYM dot site. 191 00:15:41,800 --> 00:15:44,320 Uh, remember this domain, it will come up later. 192 00:15:44,620 --> 00:15:47,540 And we can see everyone in this room would obviously be able to see this is phishing. 193 00:15:47,540 --> 00:15:54,080 There's this weird dot seven, uh, seven Z attachment, um, relating to some sort of shipment arrival. 194 00:15:54,080 --> 00:15:58,940 So, um, as a malware analysis, we'll download this attachment, we'll rip it apart and we'll see what's going on. 195 00:15:59,200 --> 00:16:00,840 So we can do exactly that. 196 00:16:00,840 --> 00:16:05,520 Um, we can unzip it and we can see, um, this doesn't contain, um, some DHL document. 197 00:16:05,520 --> 00:16:07,740 This actually contains a JavaScript file. 198 00:16:08,140 --> 00:16:11,520 And I've trimmed it down a little bit and only included the important parts. 199 00:16:11,520 --> 00:16:19,300 But what we can see is going on is when this JavaScript file is double clicked, uh, a secondary PowerShell script is then downloaded. 200 00:16:19,860 --> 00:16:24,760 Um, and this is written to disk in the temp directory named D D D D D dot PS1. 201 00:16:24,760 --> 00:16:25,840 So this is obviously dodgy. 202 00:16:25,840 --> 00:16:27,260 Um, but what do we do now? 203 00:16:27,260 --> 00:16:30,460 We download this secondary PowerShell script and now we analyze this one. 204 00:16:30,660 --> 00:16:36,900 This one looks a lot smaller, um, but it actually contains a massive chunk of base 64 encoded text. 205 00:16:37,520 --> 00:16:39,620 Uh, so what we can do, we can regex that out. 206 00:16:39,620 --> 00:16:46,060 We can basically just cut open this PowerShell script, regex out the base 64 encoded blob and then decode that. 207 00:16:46,260 --> 00:16:56,660 What this PowerShell script is actually doing is it's just writing an executable X dot EXE to disk and the contents of the executable is the base 64 decoded blob. 208 00:16:56,700 --> 00:17:01,560 Um, so we can manually decode that and run the file command on Linux and say, yeah, look, this is a binary. 209 00:17:01,560 --> 00:17:04,680 This is an executable, which we were expecting to see. 210 00:17:04,800 --> 00:17:08,140 Um, and we can also see this is a dot net binary, a dot net executable. 211 00:17:08,140 --> 00:17:11,600 So, um, this is important and it's useful for me. 212 00:17:11,600 --> 00:17:25,240 I'm not a reverse engineer, but when we come across dot net binaries in the world, we can easily decompile them, uh, maybe using DN spy and get basically the full plain text source code, um , compared to let's say if I was analyzing a C compiled binary , 213 00:17:25,240 --> 00:17:27,880 I may have to open up in Ghidra and I don't know how to do that. 214 00:17:28,040 --> 00:17:30,180 Um, so I can look at the source code. 215 00:17:30,180 --> 00:17:37,960 I can do some analysis of this X dot AXC file, which was written to disk and we can see, yeah, look, this was, um, C sharp compiled dot net. 216 00:17:37,960 --> 00:17:41,540 And we can use the capital to enumerate the capabilities of the binary. 217 00:17:41,540 --> 00:17:45,420 And we can see some signs that maybe some process injection is going on. 218 00:17:45,420 --> 00:17:55,080 We see areas of memory being allocated, um, uh, permissions on memory change, all this stuff sort of hints towards process injection. 219 00:17:55,080 --> 00:18:00,440 Um, but we can see the full source code and we can analyze this and we can validate that this is actually the case. 220 00:18:00,440 --> 00:18:07,700 So this X dot AXC binary, when it is run, it will actually spawn a new process, reg asm dot AXC. 221 00:18:07,700 --> 00:18:09,780 And reg asm dot AXC is legitimate. 222 00:18:09,780 --> 00:18:12,260 This is signed, um, this is native to Windows. 223 00:18:12,260 --> 00:18:14,060 This doesn't raise concerns. 224 00:18:14,080 --> 00:18:17,840 But X dot AXC doesn't just spawn reg asm dot AXC. 225 00:18:17,840 --> 00:18:19,040 It suspends it. 226 00:18:19,040 --> 00:18:20,760 And then it carves its memory out. 227 00:18:20,760 --> 00:18:28,140 And then it dynamically decrypts and injects a final payload into the memory space of reg asm dot AXC. 228 00:18:28,140 --> 00:18:32,820 And then it resumes the process and runs the malicious pay, payload. 229 00:18:32,820 --> 00:18:40,240 Um, so we can dynamically sort of extract this final payload which is the stage 4 and this is what is injected into reg asm. 230 00:18:40,240 --> 00:18:44,220 And we can run strings on this and instantly we get sort of big wins down there. 231 00:18:44,220 --> 00:18:47,540 Keylogger dot AXC, username value, password value. 232 00:18:47,540 --> 00:18:53,280 And then we see some file paths to common chromium, um, browser locations. 233 00:18:53,320 --> 00:18:59,160 Um, so we can look into this a bit deeper and we can actually identify this is a sample of malware called Nova. 234 00:18:59,160 --> 00:19:00,600 Nova Info Stealer. 235 00:19:00,600 --> 00:19:05,100 And this was initially found in December, uh, 2024 by Anyron. 236 00:19:05,180 --> 00:19:10,900 Um, it was a fork of Snake Keylogger, um, which is also dot net based, um, Info Stealer and Keylogger. 237 00:19:10,900 --> 00:19:23,160 Um, Nova has the capability to, uh, take all the stolen information, credentials, files, everything gets gathered and it can either exfiltrate over Telegram, FTP or SMTP. 238 00:19:23,320 --> 00:19:27,260 Um, and you can control this in the configuration when you build Nova Info Stealer. 239 00:19:27,660 --> 00:19:34,360 Um, and as I mentioned, we can view that plain text source code of the dot net binaries, um, using DN spy. 240 00:19:34,360 --> 00:19:38,600 And, um, we can see at the bottom there that there's a Telegram bot token. 241 00:19:38,600 --> 00:19:41,380 And, um, this wasn't encrypted, it wasn't obfuscated. 242 00:19:41,380 --> 00:19:46,540 Obviously there was multiple layers of obfuscation and encryption that we unraveled during the analysis. 243 00:19:46,540 --> 00:19:53,460 But during this final, uh, payload we can see, um, down there the bot token and chat ID. 244 00:19:53,460 --> 00:19:56,340 So this is the cyber criminals bot token. 245 00:19:56,340 --> 00:19:59,040 And the chat where the data will be sent to. 246 00:19:59,060 --> 00:20:00,120 So now what? 247 00:20:00,120 --> 00:20:02,740 We've got the token, we've got the chat ID. 248 00:20:02,960 --> 00:20:06,600 If you recall, there was that forward message API. 249 00:20:07,320 --> 00:20:16,480 And, um, we can use some scripts to help us, um, basically intercept and copy the whole entire Telegram chat. 250 00:20:16,480 --> 00:20:21,920 Um, compromise their, their C2, uh , channel and take a copy of it. 251 00:20:22,180 --> 00:20:28,740 And we can do that using scripts, um, generate, developed by any run or just using the API functions in curl. 252 00:20:28,740 --> 00:20:30,120 That's a hassle, that's fiddly. 253 00:20:30,120 --> 00:20:31,920 Um, any run of develop some awesome scripts. 254 00:20:31,920 --> 00:20:35,000 So we can use the prepare bot scripts to get the chat ID. 255 00:20:35,000 --> 00:20:42,400 What this basically does in the back end is we add the fret actors bot, which we've, uh, got the bot token for. 256 00:20:42,400 --> 00:20:51,840 We add it to our own Telegram chat and then we get that get updates method and that will give us the ID of our Telegram chat with the fret actors bot. 257 00:20:51,840 --> 00:21:03,780 We already have the ID of the fret actors Telegram chat from the malware analysis and then we can start forwarding messages from the Telegram's chat, from the fret actors chat to my chat. 258 00:21:03,880 --> 00:21:11,460 And then as a result of this, over time, as it iterates through all the messages, we'll get a complete copy of the whole C2 channel. 259 00:21:12,140 --> 00:21:17,020 Um, and let me, we can, this is the prepare bot script. 260 00:21:17,020 --> 00:21:22,140 So we will run the prepare bot script, provide the bot token and it will tell us the username of the bot. 261 00:21:22,380 --> 00:21:26,400 Um, and then we add that username to a group. 262 00:21:26,920 --> 00:21:32,400 Um, and then once we've done that, we've now, we'll get given the chat ID of our chat. 263 00:21:32,400 --> 00:21:35,100 And here we can see we're running the forward messages script. 264 00:21:35,100 --> 00:21:40,160 We provide the bot token and we provide the source chat and the destination chat. 265 00:21:40,180 --> 00:21:45,140 And then it will start through iterating through the message IDs and forwarding all the communications. 266 00:21:45,460 --> 00:21:48,660 And, um, this is what it looks like here. 267 00:21:48,720 --> 00:21:51,680 Um, if you scroll down through the chat, you can see screenshots. 268 00:21:51,860 --> 00:21:54,480 Um, there's metadata surrounding the IP addresses. 269 00:21:54,480 --> 00:21:55,860 There's key log files. 270 00:21:56,040 --> 00:21:59,360 Um, and there's thousands and thousands of messages. 271 00:21:59,420 --> 00:22:02,920 And when I was doing this, I was expecting this to be victim data. 272 00:22:02,920 --> 00:22:06,480 We can see there loads of key log files and there's so much to go through. 273 00:22:06,480 --> 00:22:13,160 Um, so we've got hundreds of stolen screenshots and key log files from a threat actor's telegram. 274 00:22:13,160 --> 00:22:14,360 What do we do now? 275 00:22:14,440 --> 00:22:21,720 Um, so I downloaded all of the screenshots and just sort of sorted by time and looked what is the first screenshot which was uploaded. 276 00:22:22,120 --> 00:22:25,960 Um, and this is the first screenshot. 277 00:22:26,280 --> 00:22:32,280 And if we look at this, we can see it looks like they're writing some source code. 278 00:22:32,280 --> 00:22:34,180 Maybe there's some PHP going on there. 279 00:22:34,180 --> 00:22:36,140 But we can see this isn't legitimate source code. 280 00:22:36,140 --> 00:22:41,180 This looks like, um, the back end development of maybe a phishing web page. 281 00:22:41,200 --> 00:22:43,640 So this raises my concern straight away. 282 00:22:43,640 --> 00:22:48,920 And I was thinking, huh, maybe another cyber criminal has accidentally got infected by malware. 283 00:22:49,000 --> 00:22:51,560 So, uh, this infosealer somehow. 284 00:22:51,560 --> 00:22:55,640 Um, but I go through the screenshots and this is the second screenshot I see. 285 00:22:56,300 --> 00:22:59,620 This is the DHL email which we saw earlier. 286 00:22:59,620 --> 00:23:07,400 And we can see it's got the same subject and we can see information relating to the malware we analyzed within the telegrams chat. 287 00:23:07,760 --> 00:23:22,460 So I'm beginning to think to myself now that I've just compromised this threat actors telegram chat and I'm looking through all of what I was expecting to see victim data and I can only see so far screenshots from the cyber criminal's own desktop. 288 00:23:22,580 --> 00:23:40,120 Um, but we can go through again and we can see, look, there's that email using the Nova campaign and eventually we can see on Namecheap the cyber criminal buying the domain windhm.site which was then used in the future to deliver emails that I analyzed and then copied the chat and got this. 289 00:23:40,120 --> 00:23:41,400 It's, it's kind of weird. 290 00:23:41,440 --> 00:23:42,740 Um, but what has happened here? 291 00:23:42,740 --> 00:23:48,780 Why are we seeing screenshots of the threat actors computer when we were expecting to see victim data? 292 00:23:48,800 --> 00:23:57,500 Well, imagine you are a cyber criminal and you, you're doing these mouse spam campaigns and you're buying these domains, you're setting up this infrastructure and a lot of effort goes into this. 293 00:23:57,540 --> 00:24:02,100 And maybe you're sending mass emails to 30,000 people at a time. 294 00:24:02,180 --> 00:24:04,380 Um, you want to make sure your payload works right. 295 00:24:04,380 --> 00:24:12,180 You want to make sure after you've sent this 30,000 people that if they run it, that images and key logs and credentials are going to start being sent to the telegram chat. 296 00:24:12,180 --> 00:24:15,520 So we obviously just tested it locally but not on like a test machine. 297 00:24:15,620 --> 00:24:20,720 He tested it on his own production hacking machine and just compromised his whole operation. 298 00:24:20,720 --> 00:24:22,660 But, uh, we'll carry on going through. 299 00:24:22,660 --> 00:24:30,820 Um, I also had a look at the key log files and I want to, I saw that one domains, like if I pivot on that domain we saw within the key log files, what else can I find? 300 00:24:30,820 --> 00:24:37,840 And then I found an IP address which linked that main and I can also find an email address, Aaron Diskubrick at Hotmail.com. 301 00:24:37,840 --> 00:24:43,100 I'm hoping that's not his real name because I didn't want to dox him but if it is, hey ho. 302 00:24:43,100 --> 00:24:51,940 Um, but, um, and we can go and see more screenshots and this is him logging into his Cloudflare dashboard panel. 303 00:24:51,940 --> 00:24:58,400 And we can see that wind HYM domain or, I'm not sure if we can, but what we can see is additional domains. 304 00:24:58,400 --> 00:25:03,880 So these are other domains the cyber criminals bought, set up for other cyber crime operations. 305 00:25:03,880 --> 00:25:09,520 So it's not just this DHL one, we've now identified all this additional infrastructure and I can go pivot on this. 306 00:25:09,520 --> 00:25:11,560 I can start looking at biocon.com. 307 00:25:11,560 --> 00:25:16,360 I can see this first domain was used for DHL mouse spam, similar to what we saw originally. 308 00:25:16,360 --> 00:25:21,140 The second one looks to be for credential harvesting and so on and so forth. 309 00:25:21,140 --> 00:25:24,560 We can see this cyber criminal is trying all different variations of malware. 310 00:25:24,560 --> 00:25:31,100 He's not just sticking to Info Stealers and getting those logs and selling those, he's also doing phishing campaigns, credential harvesting campaigns. 311 00:25:31,120 --> 00:25:35,800 And it's interesting to see this from the Fratactazome, uh, computer. 312 00:25:36,340 --> 00:25:38,000 As I mentioned, I work in a SOC. 313 00:25:38,000 --> 00:25:39,860 Day in, day out, I deal with cyber attacks. 314 00:25:40,260 --> 00:25:47,240 Um, and when I deal with these, we deal from it from the perspective of our telemetry, our detections. 315 00:25:47,360 --> 00:25:56,400 It's extremely rare we see the adversarial activity from the own, like, initiating workstation, the Fratactazome machine. 316 00:25:56,400 --> 00:25:57,680 So it's pretty interesting. 317 00:25:57,680 --> 00:26:10,500 Um, but we can go through and look at the more domains he owns and link these to other campaigns and start building up a picture of this individual, um, and the activity he gets up to, um, in the cyber crime world. 318 00:26:10,500 --> 00:26:17,560 But so on and so forth, um, we can go through and there's, there's hundreds and hundreds and haven't included all, but we can start getting his root credentials for SSH. 319 00:26:17,560 --> 00:26:20,020 So he's just bought a VPS and set it up. 320 00:26:20,040 --> 00:26:23,920 He's probably going to use this in a few hours to start sending out mass phishing emails. 321 00:26:23,920 --> 00:26:25,400 But look, we've got his root credentials. 322 00:26:25,400 --> 00:26:26,200 We can log in. 323 00:26:26,200 --> 00:26:29,100 Oh, and by the way, uh, I was looking at this two weeks late. 324 00:26:29,200 --> 00:26:33,220 So, um, when I copied the telegram chat, I was looking back retrospectively. 325 00:26:33,640 --> 00:26:36,660 Um, I'm not looking at this in real time. 326 00:26:37,020 --> 00:26:46,620 Um, but so forth, we can go through and see like they're setting up fast panel, um, and we can see like even more credentials being set up and then they're not using a password manager. 327 00:26:46,620 --> 00:26:47,240 Come on. 328 00:26:47,240 --> 00:26:52,760 Um, they've got notepad TXT up with all their plain text credentials right there for me to read. 329 00:26:52,820 --> 00:26:55,500 Um, including the URLs for some when I need it. 330 00:26:55,500 --> 00:26:56,900 Um, so super useful. 331 00:26:57,040 --> 00:26:59,040 Um, and they're configuring DNS. 332 00:26:59,040 --> 00:26:59,820 They're setting it up. 333 00:26:59,820 --> 00:27:01,000 They've got issues. 334 00:27:01,000 --> 00:27:02,680 Here's quite an interesting one. 335 00:27:02,680 --> 00:27:06,140 Um, they're using, it's called mail dime or gamma mail dime. 336 00:27:06,140 --> 00:27:08,360 I can't remember and I can't see it on the screen. 337 00:27:08,540 --> 00:27:11,860 Um, but this is their software they use to send out mass phishing emails. 338 00:27:11,860 --> 00:27:16,780 And I think we can see, um, something like 35,000 emails being sent out at a time . 339 00:27:16,780 --> 00:27:21,220 And we can look at that particular attachment which is like a PO update. 340 00:27:21,220 --> 00:27:23,460 This is a different campaign to the one I analyzed. 341 00:27:23,460 --> 00:27:28,320 Um, but what we can see here is emails being sent out at mass. 342 00:27:28,440 --> 00:27:31,620 Um, and this one I believe is for the biocon domain we saw. 343 00:27:31,860 --> 00:27:35,480 Um, and then we can go again and go through and through. 344 00:27:35,480 --> 00:27:37,120 And I don't want to bore you with all of this. 345 00:27:37,140 --> 00:27:44,260 Um, but we seriously got so much information which we could go to fast panel, name cheap, um, cloud flare, so on and so forth and report this. 346 00:27:44,280 --> 00:27:45,940 And they probably did nothing about it. 347 00:27:45,960 --> 00:27:52,900 Um, so we can see even more credentials and we can see even more, um, sort of VPSs that this threat actor is using. 348 00:27:52,900 --> 00:27:58,480 We can see more email addresses, uh, more usernames, um, and so on and so forth. 349 00:27:58,860 --> 00:28:02,020 Here we see they've got SMTP issues which is lovely to see. 350 00:28:02,020 --> 00:28:03,580 They're doing some troubleshooting. 351 00:28:03,680 --> 00:28:05,600 They're checking if DNS is broken again. 352 00:28:06,380 --> 00:28:14,500 Um, so it's, it, I, I find it interesting to see them troubleshooting and, and doing all this stuff from the, the, uh, the cyber criminals own, own screen. 353 00:28:14,520 --> 00:28:16,700 Um, but yeah, so on and so forth. 354 00:28:16,700 --> 00:28:17,920 We can see DocuSign. 355 00:28:17,920 --> 00:28:22,220 This is, I can imagine, uh, credential harvesting AITM sort of campaigns. 356 00:28:22,220 --> 00:28:23,540 We see this a lot in the wild. 357 00:28:23,540 --> 00:28:26,620 Um, but it's interesting to see the threat actor trying to set it up. 358 00:28:26,620 --> 00:28:28,460 And we often see him testing this locally. 359 00:28:28,540 --> 00:28:35,120 So like sending it to test Gmail accounts to see if, um, they get flagged and also flagged up by spam, um, or not. 360 00:28:35,120 --> 00:28:41,020 And it's interesting to see all which, everything which goes into just like a basic boring sort of phishing campaign. 361 00:28:41,160 --> 00:28:47,900 Um, but like I could go on and on and on with all the credentials and everything we see. 362 00:28:47,940 --> 00:28:59,420 Um, it looked like he was doing some social engineering and some maybe, uh, emailing just people who've replied to his phishing and trying carrying them on and getting information and credit card information. 363 00:28:59,420 --> 00:29:01,600 Um, so it's interesting to see. 364 00:29:01,620 --> 00:29:04,440 Um, but yeah, there's a lot there. 365 00:29:04,440 --> 00:29:06,100 Let's take a, let's take a recap . 366 00:29:06,100 --> 00:29:09,200 So we started off with one email file, one email file. 367 00:29:09,600 --> 00:29:14,920 And from that we saw the email file had an attachment and it was a JavaScript file. 368 00:29:14,960 --> 00:29:21,420 And when that JavaScript file was run, it will download a PowerShell script and the PowerShell script write an executable to disk. 369 00:29:21,420 --> 00:29:32,420 And when the executable, uh, was written to disk and run, it will spawn a new legitimate process, regasm.exe, inject the info sealer code into regasm.exe and then run it. 370 00:29:32,480 --> 00:29:37,540 And then from that point on, uh, data will be exfiltrated over telegram. 371 00:29:37,540 --> 00:29:39,160 And we did that analysis. 372 00:29:39,160 --> 00:29:40,660 We were able to find that bot token. 373 00:29:40,660 --> 00:29:47,840 And from that one bot token, we were able to copy the whole chat and basically reveal a whole entire cybercrime operation. 374 00:29:48,220 --> 00:29:57,120 Um, from one OPSEC mistake, um, which then led on to discover more OPSEC mistakes like storing all your passwords in notepad. 375 00:29:57,420 --> 00:29:59,220 Um, so yeah. 376 00:29:59,320 --> 00:30:01,280 Um, how could you do this at home, right? 377 00:30:01,280 --> 00:30:06,420 If you wanted to go home and look for malware which is communicating over telegram, um, there are multiple ways to do this. 378 00:30:06,420 --> 00:30:13,220 If you've got a VirusTotal enterprise account which has the capability to maybe use the retro hunt or live hunt features, you could use a rule like this. 379 00:30:13,220 --> 00:30:14,120 Um, here's an example. 380 00:30:14,120 --> 00:30:21,580 We're just looking for, um, PowerShell files which have been tagged as malicious by VirusTotal which just communicating with API telegram dot org. 381 00:30:21,980 --> 00:30:41,380 Um, alternatively, you could do some Google dorking and go look for the domain or the string API dot telegram dot org and Google that alongside Joe's sandbox or any run or common other sandboxes, um, or even VirusTotal and you may be able to just by Googling find samples of malware which have, 382 00:30:41,380 --> 00:30:48,960 um, these API keys embedded within them and you can then use these to, uh, intercept communications. 383 00:30:49,280 --> 00:30:56,020 Um, so this is the example, um, this is actually how I identified the sample this talk is based on. 384 00:30:56,180 --> 00:31:04,600 And I was looking for PowerShell scripts and we can see on VirusTotal we didn't need to do all that fancy malware analysis and rip it all apart. 385 00:31:04,600 --> 00:31:08,860 On VirusTotal it gives us that chat ID and that bot token straight away. 386 00:31:08,860 --> 00:31:09,900 So you didn't need to do that. 387 00:31:09,900 --> 00:31:10,980 It's really, really easy. 388 00:31:10,980 --> 00:31:29,160 If I wanted to, I could have gone on VirusTotal, found this sample, gone on the relations tab and the, VirusTotal when it's running its sandbox and it collects its telemetry, it realizes there is a HTTP request made to telegram dot API dot org and then within that is the bot token chat ID which we can use. 389 00:31:29,160 --> 00:31:31,060 Um, so that's how I found this sample. 390 00:31:31,060 --> 00:31:37,780 And then once I found the sample I worked backwards and then I realized actually this came from a JavaScript file which came from an email. 391 00:31:38,020 --> 00:31:42,300 And then after the PowerShell, PowerShell file it, rip X dot AXC. 392 00:31:42,300 --> 00:31:48,080 So that's what I found initially and then after that I built up the whole picture and then intercepted the communications. 393 00:31:48,700 --> 00:31:53,920 So, yeah, to finish up, to conclude, for actors make mistakes, let's exploit them. 394 00:31:54,280 --> 00:31:57,120 Um, being really careful with that first point there. 395 00:31:57,160 --> 00:32:00,960 Um, you have to do, yeah, be careful. 396 00:32:00,960 --> 00:32:08,980 Um, so yeah, intelligence gains like these, uh, from OPSEC failures, uh, the massive, right, we found so much about, about this, this cyber criminal. 397 00:32:08,980 --> 00:32:12,100 We found out all the infrastructure they used to host out their attacks. 398 00:32:12,460 --> 00:32:14,840 Um, so, yeah. 399 00:32:14,840 --> 00:32:19,300 And it's not just this, um, and I did want to note this isn't a novel technique. 400 00:32:19,300 --> 00:32:21,400 This malware wasn't found by me. 401 00:32:21,400 --> 00:32:23,000 This isn't sophisticated or advanced. 402 00:32:23,000 --> 00:32:24,160 This is pretty simple stuff. 403 00:32:24,160 --> 00:32:26,320 This is just two API methods. 404 00:32:26,320 --> 00:32:34,640 Forwarding messages from one telegram to a telegram chat to another and then using the get updates, uh, um, API request just to find the chat ID. 405 00:32:34,640 --> 00:32:39,220 This is simple stuff but in this particular case study there was a really interesting finding. 406 00:32:39,240 --> 00:32:44,520 Um, and this stuff is done in the wild, in the CTI community, in the security industry already. 407 00:32:44,560 --> 00:32:46,600 Um, so it's nothing novel. 408 00:32:46,700 --> 00:32:53,880 Um, but the intelligence wins from this massive and we can use these in our detection enduring teams or for hunting teams. 409 00:32:53,980 --> 00:32:56,340 Um, so I believe that's it from me. 410 00:32:56,340 --> 00:32:57,680 I hope everyone enjoyed this. 411 00:32:57,680 --> 00:32:59,860 Um, I'm open up for questions I believe now. 412 00:32:59,860 --> 00:33:01,980 So, um, thank you.