1 00:00:00,000 --> 00:00:04,700 Alright, so this is the Digital Cockroach Bait Station. Uh, we're gonna talk about how to 2 00:00:04,700 --> 00:00:11,760 build spam honeypots and who am I? Uh, I'm senior threat intelligence researcher with, uh, 3 00:00:11,780 --> 00:00:17,860 ThreatConnect and I'm on the TCERT team and I can't see a thing because of that light but I 4 00:00:17,860 --> 00:00:22,920 hope some of the team members are out there somewhere. But, uh, that's my Twitter handle 5 00:00:22,920 --> 00:00:30,420 Maur Utkonos. Uh, Utkonos is the, uh, Russian word for duckbill platypus, in case you were 6 00:00:30,420 --> 00:00:37,180 wondering. And also a few days ago I met the other, uh, person who happens to use the same, uh, 7 00:00:37,320 --> 00:00:46,900 handle at, at, uh, Black Hat. So, so why, why are we doing this? What is the, what are the, what 8 00:00:46,900 --> 00:00:51,400 are the problems that we're trying to solve and what requirements do we have? So, I, my 9 00:00:51,400 --> 00:00:52,900 requirements are that I need, uh, I need to, uh, I need to, uh, I need to, uh, I need to 10 00:00:52,920 --> 00:00:59,020 fresh malware samples and I need fresh malicious links. Uh, I also need fresh, uh, advanced fee 11 00:00:59,020 --> 00:01:04,260 fraud scams. So, um, you know, just to go over technical terms, advanced fee fraud is like the, 12 00:01:04,340 --> 00:01:10,380 um, the Nigerian prince that wants, uh, to send you a million dollars but he needs you to send 13 00:01:10,380 --> 00:01:15,420 him fifty dollars or a hundred dollars before you can get your million dollars from him. So, 14 00:01:15,520 --> 00:01:22,860 those are advanced fee fraud scams, uh, aka 419. And the, the goal of course in all of this is to 15 00:01:22,920 --> 00:01:30,000 get actionable threat intelligence. So, IOCs, um, IP addresses, um, spamming nodes, whatever, 16 00:01:30,160 --> 00:01:37,340 whatever it is that you're looking for but you need to know, uh, the intelligence. So, there's a, 17 00:01:37,420 --> 00:01:43,400 uh, sort of a, uh, difference in terminology. Um, I'm just gonna use them interchangeably because 18 00:01:43,400 --> 00:01:50,520 the idea of a spam trap and spam honeypot I think are almost exactly the same. Um, and to go to 19 00:01:52,920 --> 00:01:54,020 something that's an internet addiction can be quite complex. So spam traps are also 20 00:01:54,020 --> 00:02:01,600 email addresses. Those are created not for communication but to relies on, um, spam, so the 21 00:02:01,600 --> 00:02:07,660 point here is to get more spam and to get it from as many different sources as possible. And 22 00:02:07,660 --> 00:02:14,320 also to be able to track, uh, which address you sent over here, which address you put on this 23 00:02:14,320 --> 00:02:19,880 website, and then you can have metrics as to which, you know, which location for an email 24 00:02:19,880 --> 00:02:22,900 address is better at generating certain types of spam. Uh, neurotransmitters, uh, you know, 25 00:02:22,920 --> 00:02:31,040 and then therefore, you know, gathering certain types of botnets, certain types of binaries, and 26 00:02:31,040 --> 00:02:36,680 then you can figure out, alright, I should focus on seeding the email addresses in this area to 27 00:02:36,680 --> 00:02:46,800 get more of Y. I need to seed over here to get more of X. So, my background is biology and so I 28 00:02:46,800 --> 00:02:52,780 found it fascinating to, you know, kind of do a little bit of correlation or at least 29 00:02:52,780 --> 00:02:59,880 connection between biology and what I do now. And so I'm, I don't know if you recognize all of 30 00:02:59,880 --> 00:03:08,080 these bait traps, but this one is for cockroaches. I'm sure you all have seen those. The one in 31 00:03:08,080 --> 00:03:14,980 the center, the, so the subtitle there, the URL where I got it, that's actually, they actually 32 00:03:15,400 --> 00:03:22,600 named it wrong. It's not for cockroaches, that's actually for flies. Typically used for catching 33 00:03:22,780 --> 00:03:27,260 drosophila and that kind of stuff. But, or house flies, whatever type of flies you want to 34 00:03:27,260 --> 00:03:33,120 catch. That one's more of a general, you know, insect trap, where insects are going to slide 35 00:03:33,120 --> 00:03:39,940 down and they can't get up the sides and get out. This one's disgusting. That's, the brown 36 00:03:39,940 --> 00:03:50,800 slime that's on there is roach butter, I think it's called. And then the one on the left, or on my 37 00:03:50,800 --> 00:03:58,740 right, your left, I don't know. That one is driven by CO2. And this is probably the most 38 00:03:58,740 --> 00:04:04,620 disgusting of all of them. That's a bed bug trap. And I don't know if you know the way, the way 39 00:04:04,620 --> 00:04:12,380 the bed bugs operate is they follow CO2. So they're looking for your breath at night. So, 40 00:04:12,500 --> 00:04:20,780 moving on from the, the biology. So this is the diagram of, of a spam honeypot. And this is 41 00:04:20,800 --> 00:04:25,040 the whole idea here is to keep everything as simple as possible. Absolutely simple as 42 00:04:25,040 --> 00:04:30,100 possible. Because I don't want to spend time working on the spam honeypot. I want to spend 43 00:04:30,100 --> 00:04:38,000 time working, analyzing the data that I get from it. So, spam goes in. It's your choice as to 44 00:04:38,000 --> 00:04:44,700 what mail server you want to use. I use post fix now. I had started out using sendmail, but 45 00:04:44,700 --> 00:04:48,560 then I realized I didn't want to have two honeypots in the same thing. I didn't want to have 46 00:04:48,560 --> 00:04:50,780 just a, a sendmail honeypot in the same thing. I wanted to have two honeypots in the same thing. 47 00:04:50,800 --> 00:04:58,900 Inside of a spam honeypot. And so, uh, inside the mail server I have all of the incoming email 48 00:04:58,900 --> 00:05:06,180 processed by a Python script. And if any of you were at my workshop on Friday afternoon, uh, you 49 00:05:06,180 --> 00:05:13,420 have a copy of a simpler, a much simpler version of that, uh, Python script. And the goal 50 00:05:13,420 --> 00:05:20,780 there is to, uh, change the email headers and the rest of the email into, uh, JSON format. And 51 00:05:20,800 --> 00:05:28,680 then from there to insert that as, uh, uh, an indexable, uh, JSON document into Elasticsearch. 52 00:05:32,440 --> 00:05:36,000 So, I just wanted to cover a few definitions if you're not familiar with some of the things that 53 00:05:36,000 --> 00:05:42,020 I've been talking about. So, post fix is a general purpose mail server. Uh, I prefer using it on 54 00:05:42,020 --> 00:05:47,880 FreeBSD because I have a lot of experience with FreeBSD and hardening it. So, uh, that's my 55 00:05:47,880 --> 00:05:55,800 preferred operating system. Uh, JSON is JavaScript object notation, uh, it's a machine and human 56 00:05:55,800 --> 00:06:00,960 readable data interchange format. Uh, that's the website if you want to know more about it. If you 57 00:06:00,960 --> 00:06:09,260 haven't heard of JSON, uh, you must have heard of it. So, uh, Elasticsearch is a full text search 58 00:06:09,260 --> 00:06:15,680 engine. It's accessible via rest API. It stores documents. I'm going to try to raise my voice over 59 00:06:17,880 --> 00:06:23,160 So it stores documents in JSON, so it's perfect for my purpose of taking JSON and making 60 00:06:23,160 --> 00:06:29,820 something that I can search through and find commonalities among, you know, spam campaigns 61 00:06:30,540 --> 00:06:39,500 and so on. So the mail server configuration is the goal, it's very simple again. So you want 62 00:06:39,500 --> 00:06:45,160 to accept e-mail that's sent to any user name and sent to any domain. So you want it to be 63 00:06:45,160 --> 00:06:49,680 completely open, but you don't want it to reply to anything. You don't want it to send back 64 00:06:49,680 --> 00:06:54,480 bounce messages. You don't want to have any sort of outbound e-mail coming from it at all. 65 00:06:55,020 --> 00:07:03,560 Typically, you know, I change the host firewall so that it can't do anything outbound. And so, 66 00:07:03,660 --> 00:07:08,640 you know, obviously, anything at anything, so star, at star, at star, whatever you want to 67 00:07:09,640 --> 00:07:15,140 accept, you want to accept all of it. So the idea here is to make sure that when you're 68 00:07:15,160 --> 00:07:17,380 sending something to the server, you want it to process all inbound e-mail with a custom 69 00:07:17,380 --> 00:07:23,560 Python script and also naturally because it's a mail server, you get to, you get a copy of all 70 00:07:23,560 --> 00:07:29,020 the messages in the different, if you set it up for mbox or if you set it up for mail dir, you 71 00:07:29,020 --> 00:07:37,040 get a copy of all the messages nicely divided up by e-mail address that it was sent to. And so, 72 00:07:37,120 --> 00:07:43,880 the Python script and I see at least one person from class. So we went over this Python script in 73 00:07:43,880 --> 00:07:53,700 class and so I built it using e-mail.parser core module in Python. And I prefer Python 3, but 74 00:07:53,700 --> 00:07:59,360 the, for all intents and purposes, this particular library is almost the same in both 2 and 3, or 75 00:07:59,360 --> 00:08:05,780 2.7 and 3 and above. And what I use it for is to translate all of the e-mail into JSON format, 76 00:08:05,940 --> 00:08:10,980 specifically the headers, so that the headers are divided up into key value pairs, which they 77 00:08:10,980 --> 00:08:13,860 already are in, you know, in an e-mail. And so, you know, it's, it's, it's, it's, it's, it's, it's, 78 00:08:13,880 --> 00:08:17,960 it's not really a real e-mail format, but it's just a flat text file, ah, and this way I've 79 00:08:17,960 --> 00:08:21,980 translated it into JSON and it's a little bit more usable, especially with Elasticsearch. 80 00:08:23,740 --> 00:08:28,660 So, ah, this is the slide where I could probably spend the next 10 hours, ah, talking about it. 81 00:08:28,860 --> 00:08:35,660 So, ah, so I've done, I've done a lot, a lot, a lot of thinking about, ah, e-mail headers and 82 00:08:35,660 --> 00:08:43,860 what data you can get from e-mail headers. Ah, how to use it and, and what it means. So, so 83 00:08:43,880 --> 00:08:50,400 divided this mind map into two components. So there's the header and the body. And the 84 00:08:50,400 --> 00:08:58,260 header, the first thing at the top, so that's the date time zone. And this is actually more 85 00:08:58,260 --> 00:09:04,480 important than would be obvious. So the date and time zone shows you either where the 86 00:09:06,020 --> 00:09:13,200 spammer, so this is a forgeable header field. But the time zone will show you the 87 00:09:14,120 --> 00:09:20,920 geographical approximate location of the origin IP address. So, you know, if you see some 88 00:09:20,920 --> 00:09:27,160 date time zones, the time zones that are in Eastern Europe, China, you know, these things are 89 00:09:27,160 --> 00:09:36,540 not a strong indicator, but they're still an indicator. So received SPF, this is actually an 90 00:09:36,540 --> 00:09:43,860 anti-spam header field. And so looking for things like SPF fail are, you know, a good way to 91 00:09:43,880 --> 00:09:53,560 find stuff that's nasty. DKIM, domain keys. So this is another anti-spam header. But this 92 00:09:53,560 --> 00:10:01,140 one is driven cryptographically. And one thing that was interesting was, so a couple years ago, 93 00:10:01,240 --> 00:10:09,080 LinkedIn had a fantastic idea of injecting their own spam in a man-in-the-middle system 94 00:10:09,080 --> 00:10:13,860 called intro. And intro basically broke DKIM very badly. And it was a very, very bad idea. So 95 00:10:28,600 --> 00:10:37,480 the next part is the hello string. This is the component of an SMTP handshake. And I don't know 96 00:10:37,480 --> 00:10:43,860 if anyone has done like a manual SMTP handshake by telnetting to port 25 on a mail server. So 97 00:10:43,860 --> 00:10:51,620 So the first thing that you do is you type ELHO or H-E-L-O and then you type in the, you 98 00:10:51,620 --> 00:10:57,840 give the mail server the domain that you theoretically are coming from. You can totally lie 99 00:10:57,840 --> 00:11:03,600 to many mail servers. Some mail servers will check whether that is related to the reverse 100 00:11:03,600 --> 00:11:10,520 DNS of the IP that you're coming from or not. This one is important. I think this one is 101 00:11:10,520 --> 00:11:18,180 very, very important for two reasons. First of all, if you're dealing with a piece of malware 102 00:11:18,180 --> 00:11:23,480 which sends out spam, it's obviously going to be connecting to a mail server to deliver the 103 00:11:23,480 --> 00:11:32,660 spam. And so it needs to be configured in advance with some sort of fake H-E-L-O string. It's 104 00:11:32,660 --> 00:11:38,400 not, if it's coming from a compromised workstation, obviously that, it doesn't, it might 105 00:11:38,400 --> 00:11:40,500 know, but it doesn't care what the, what the IP address is. So it's not going to be able to 106 00:11:40,520 --> 00:11:45,300 tell what the real domain name is if there even is one for that, you know, maybe it's 107 00:11:45,300 --> 00:11:51,560 someone's home, uh, home workstation and there's no domain that it can possibly figure out. So it 108 00:11:51,560 --> 00:11:58,800 can't tell the truth to a mail server. So it will be, uh, configured to either say the same 109 00:11:58,800 --> 00:12:05,340 thing over and over, so that's an indicator, or it'll have something similar to, uh, you know, a 110 00:12:05,340 --> 00:12:09,640 domain generation algorithm where it comes up with something that's different each time. However, 111 00:12:09,640 --> 00:12:15,180 because it's, because it's created algorithmically, uh, you can then use that as an indicator 112 00:12:15,180 --> 00:12:20,860 as well. If you can figure out what the algorithm is that it uses to generate that set, uh, or that 113 00:12:20,860 --> 00:12:29,700 type of, that, uh, that set of, um, domain names, you can then identify, uh, the particular, uh, 114 00:12:29,960 --> 00:12:37,540 botnet or, uh, piece of, uh, malware which is generating that particular piece of spam. The next 115 00:12:37,540 --> 00:12:39,620 part is the originating IP. So, you, your IP address is generated by the spam server. So, it's, you, 116 00:12:39,620 --> 00:12:45,440 obviously this is the IP address of the thing or the entity, whatever it is that's sending the 117 00:12:45,440 --> 00:12:51,420 spam out to your mail server, to your spam honeypot I should say. And there's a few ways, few 118 00:12:51,420 --> 00:12:56,640 things that you can do to analyze this particular piece of information. So these are the 119 00:12:56,640 --> 00:13:05,720 basics. Network who is, basically getting what the identity of the ISP or at least maybe 120 00:13:05,720 --> 00:13:12,800 lower ISP, the hosting company or maybe the local reseller of the IP address. And then 121 00:13:12,800 --> 00:13:19,040 GOIP, so the location of the IP address. Some of this, if you get the GOIP from network who 122 00:13:19,040 --> 00:13:24,480 is, it might not actually correlate with the real geographic location of that IP address, but 123 00:13:24,480 --> 00:13:32,080 at least it will give you a hint. And then ASN who is. ASN who is typically is a little bit 124 00:13:32,080 --> 00:13:35,700 cleanlier, cleaner than network who is. It, it's a little bit cleaner than network who is. 125 00:13:35,720 --> 00:13:40,660 Typically has better, better data in it than network who is. It's maintained a little bit 126 00:13:40,660 --> 00:13:49,480 better. R who is, this is, this is where if a particular IP address has been reassigned to 127 00:13:49,480 --> 00:13:55,860 maybe a, a hosting reseller or something like that, the R who is, the R who is data will 128 00:13:55,860 --> 00:14:03,860 contain the address and, and identity information of that reseller. Reply to, this is an 129 00:14:03,860 --> 00:14:05,700 important one. When we, when I was working with, when I was working with, when I was working with 130 00:14:05,720 --> 00:14:12,440 R, I was doing anti-phishing. This is basically the, if, if you're talking about a 419 scam or 131 00:14:12,440 --> 00:14:20,500 advanced fee fraud, the adversary needs to collect the replies to, to their, to their fraud scam. 132 00:14:20,880 --> 00:14:26,940 So typically the reply to address is not forged. Typically the reply to address, as long as it 133 00:14:26,940 --> 00:14:34,240 still exists and hasn't been taken down, has, you know, some slime ball actually reading the email 134 00:14:34,240 --> 00:14:41,540 that comes into that. So that's another important indicator there. Um, subject, obviously, uh, 135 00:14:41,560 --> 00:14:48,880 this is an indicator, very valuable. Uh, you, you have a new fax, please click here. Uh, or some 136 00:14:49,460 --> 00:14:55,260 such thing like that. And then the from address, this is typically forged. This is very easily 137 00:14:55,260 --> 00:15:02,360 forged. Um, and it could say almost anything. Uh, it might even be different than the reply to. 138 00:15:09,200 --> 00:15:25,080 So what's that? Uh, sure. Alright, now hard to concentrate. Um, alright, so envelope sender. 139 00:15:25,460 --> 00:15:32,760 This one is, uh, another component that comes from the SMTP handshake. So if you've, uh, again if 140 00:15:32,760 --> 00:15:38,180 we go back to the manual SMTP handshake, where we've got the H-E-L-O string, the next two things 141 00:15:38,180 --> 00:15:49,400 that you do is, uh, mail from and receipt to. So, uh, that one is, uh, typically, um, also an 142 00:15:49,400 --> 00:15:56,100 indicator. So this one, this one, uh, some mail servers will check whether this is, uh, um, has 143 00:15:56,100 --> 00:16:02,740 it. I'll try. Hold on. Uh, this one, this one, uh, some mail servers will check whether this is, uh, 144 00:16:02,760 --> 00:16:08,280 an indicator. Uh, so envelope sender, uh, also an indicator, obviously. Uh, return path, again, 145 00:16:08,440 --> 00:16:17,460 this is an indicator. X mailer, this is one that. So, uh, X mailer, this is one that I find 146 00:16:17,460 --> 00:16:25,240 important, uh, especially when, uh, talking about compromised websites. So the X mailer is, uh, a 147 00:16:25,240 --> 00:16:32,740 header field that shows, uh, either the name of the file or the full URL of the mailer, uh, in the 148 00:16:32,760 --> 00:16:38,580 uh, that sent the, the, the piece of spam. So if it was coming from, like, a PHP mailer that was 149 00:16:38,580 --> 00:16:44,060 installed, uh, via back door on a compromised website, uh, often, thank you very much. Um. 150 00:16:50,260 --> 00:17:01,920 Okay. Where was I? Alright, so X mailer. Uh, X mailer is a, is an important indicator, I think, uh, for two reasons. Um, 151 00:17:03,800 --> 00:17:11,940 often the, uh, the PHP script that sends the spam, and we'll see this in a moment, um, actually this is in a slide from the, from the 152 00:17:11,940 --> 00:17:20,780 workshop, I apologize, so we won't actually see the emails, uh, the, the X mailer, uh, string. Uh, but, X mailer, if you have a 153 00:17:20,780 --> 00:17:32,740 compromised website and there's been a back door installed, and you'll often see, you know, mailer1.php, and if you go to that URL, you'll have, like, uh, text entry boxes, and you'd basically end up, uh, 154 00:17:32,760 --> 00:17:45,520 you enter your spam, uh, headers, you enter your spam body, and all that stuff, and then hit send, and then it sends it, uh, via the, the web server, and so often the URL for that particular, uh, 155 00:17:45,700 --> 00:18:02,440 X mailer, that, that PHP mailer will, will appear in the X mailer, uh, header field. And so that becomes a URL indicator. Um, indicator that the website has been compromised. It's also, uh, sometimes it can be forged. 156 00:18:02,760 --> 00:18:12,040 So I've seen botnets which will just generate fake xmailer header fields in a set. So they'll 157 00:18:12,040 --> 00:18:21,200 say, they'll just have a canned set of fake xmailer headers. But again, that's another 158 00:18:21,200 --> 00:18:25,680 indicator. So I can see, I can actually determine that this is a specific, this specific 159 00:18:25,680 --> 00:18:32,360 botnet because I see this fake xmailer header and if I go and look for that particular URL 160 00:18:32,360 --> 00:18:38,200 there's nothing there because it, you know, that's not, you know, that's not how that 161 00:18:38,200 --> 00:18:45,040 botnet sent that particular piece of spam. And then obviously mailer URL that's related just 162 00:18:45,040 --> 00:18:48,720 like what I was saying to the xmailer. So that's, that is the indicator that I'm talking 163 00:18:48,720 --> 00:18:54,600 about. So the next component here is the MIME boundary string. So if you're not familiar with 164 00:18:54,600 --> 00:19:00,680 MIME or what I'm talking about here, it's the, there's one, one in, one of these in the 165 00:19:00,680 --> 00:19:07,420 header and it, it tells your mail client where the boundary of any attachment or where the 166 00:19:07,420 --> 00:19:15,080 change from either HTML to text or, and each one has this MIME boundary string in the beginning 167 00:19:15,080 --> 00:19:21,580 and the end of that attachment. And then it's also in the, in the header. So I have a theory 168 00:19:21,580 --> 00:19:28,960 and I, I, you know, I'm working on this at the moment that the MIME boundary string is also an 169 00:19:28,960 --> 00:19:30,620 indicator. And the reason why I'm working on this at the moment is that the MIME boundary string is also an indicator and the reason 170 00:19:30,620 --> 00:19:36,660 for this is possibly the, the, you know, some bop nets might just use a, a pre-generated specific MIME boundary 171 00:19:36,660 --> 00:19:49,500 string. And then you'll be able to, to use that obviously as a, as an indicator. SimHash. So this is not actually a header field, obviously. So SimHash is a 172 00:19:49,500 --> 00:20:00,600 type of piece wise fuzzy hashing. There's a, I, there's probably more than this, but the two main ones that I use are SSDeep and SimHash. And so one of the 173 00:20:00,620 --> 00:20:11,800 And ssdeep is more specifically tailored towards binaries. So if you have a malware binary, you 174 00:20:11,800 --> 00:20:17,660 run it through ssdeep and then you get a signature where you can compare two different binaries 175 00:20:17,660 --> 00:20:24,140 and see maybe how similar or how different they are from each other. And so simhash, the 176 00:20:24,140 --> 00:20:29,900 concept is the same but the target is slightly different. So the simhash is an algorithm 177 00:20:29,900 --> 00:20:41,180 that is meant to look at text. So and my concept here is to take the simhash algorithm and 178 00:20:41,180 --> 00:20:47,760 then run the simhash algorithm on each header field so that you can, you know, show the 179 00:20:47,760 --> 00:20:53,880 similarity or difference between any single header field that you've run through the simhash 180 00:20:53,880 --> 00:20:59,880 algorithm. Okay and also, by the way, there's one header field here on the ssdeep that's 181 00:20:59,900 --> 00:21:06,220 just received which is missing from my mind map, it was one of those so extremely obvious 182 00:21:06,220 --> 00:21:09,760 that I didn't even put it on the mind map but someone in the workshop mentioned, you know, hey, 183 00:21:10,220 --> 00:21:15,940 you don't have received on there, but yeah. So received is another important header. And 184 00:21:15,940 --> 00:21:25,080 also I want to point out that the Python script that I use, uh basically catches all header 185 00:21:25,080 --> 00:21:29,880 fields. So it converts the entire header, even the x, you know, the x on the left hand side, you can 186 00:21:29,880 --> 00:21:35,740 X, by the way, you can have X and then an arbitrary string after that as a key. So you can 187 00:21:35,740 --> 00:21:41,780 have as many X blah, blah, blahs as you want in a header. So the script that I use catches 188 00:21:41,780 --> 00:21:50,000 all of them and just converts the whole thing into a key value pair set in JSON. So moving 189 00:21:50,000 --> 00:21:55,400 on to the body, these are some of the indicators that you can pull out of a body. Phone 190 00:21:55,400 --> 00:22:00,800 number. Obviously this is for, again, if we're going back to like the 419 scams, a lot of them 191 00:22:00,800 --> 00:22:10,520 use a VoIP line or, you know, a mobile phone number and they'll be sitting there and it'll 192 00:22:10,520 --> 00:22:17,380 basically, they'll have one number that they're routing calls to and then the sort of like 193 00:22:17,380 --> 00:22:23,260 crumple zone of numbers that they expect to have taken down constantly are the ones that 194 00:22:23,260 --> 00:22:25,140 you're going to find in the e-mail. 195 00:22:25,220 --> 00:22:25,380 Yeah. 196 00:22:25,400 --> 00:22:34,360 In the spam. Obviously, attachments. This is one thing that is, you know, a method that 197 00:22:34,360 --> 00:22:40,180 they deliver malware to you with. So obviously, you know, it's the old don't click on and 198 00:22:40,180 --> 00:22:46,940 don't run anything that's executable or a document that you get in e-mail from anyone that 199 00:22:46,940 --> 00:22:54,280 you don't know. And even if you know them, let's not run it anyway. And then URLs. So often 200 00:22:54,280 --> 00:22:55,380 you'll find a drive-by. You'll see a lot of them. You'll see a lot of them in the spam 201 00:22:55,380 --> 00:22:57,160 email. So you'll find a place where they're just, like, a tag URL contained in an e-mail. 202 00:22:57,260 --> 00:23:03,700 You'll also find phishing pages. We covered some pretty interesting phishing techniques and 203 00:23:03,700 --> 00:23:11,700 pages in our, in my workshop. Again, take a SEM hash. So all the text, all the body of, 204 00:23:11,820 --> 00:23:17,220 all spam body emails is text. So obviously, you just take a SEM hash of this. You can do 205 00:23:17,220 --> 00:23:25,000 comparisons. Also, do SEM hashes of the body components. So take a SEM hash of maybe the 206 00:23:26,460 --> 00:23:40,100 HTML and the text. Some stupid email clients only generate HTML emails with no text. So 207 00:23:40,100 --> 00:23:46,180 this is where what I mean by rendered sim hash, use something like beautiful soup or 208 00:23:46,180 --> 00:23:53,140 another HTML parser and just remove all of the HTML tags so that you're left behind with 209 00:23:53,140 --> 00:23:59,600 just the text and then take a sim hash of that text. And obviously an email address, you can 210 00:23:59,600 --> 00:24:04,940 get email addresses and keep the text itself. So that's the, those are the things that you can 211 00:24:04,940 --> 00:24:11,940 collect from the body of the email and that's the header. Alright and then after you've 212 00:24:11,940 --> 00:24:18,720 generated, after you've generated this blob of JSON for the header, put it into elastic 213 00:24:18,720 --> 00:24:23,120 search. Create an index, set the type, you know you have like type, type, type, type, type, type, 214 00:24:23,120 --> 00:24:31,120 and index. You know I just call it email as the type and then emails as the index. And then you 215 00:24:31,120 --> 00:24:41,160 can use Kibana to do visualizations on the data that you have jammed into elastic search. Alright 216 00:24:41,160 --> 00:24:48,420 so now the fun begins. You've done the boring stuff, you've stood up a server, that part is 217 00:24:48,420 --> 00:24:53,100 done. Now we get to have some fun baiting the trap. So, I'm going to show you a little bit of 218 00:24:53,120 --> 00:24:57,740 this. Register a domain. Don't bother paying for a domain the first time you go through this. 219 00:24:57,960 --> 00:25:04,620 Just go and get a, go get one of the free, free domains. If you do buy a domain, make sure you 220 00:25:04,620 --> 00:25:10,320 turn on privacy. You don't want your home address or your work address or anything related to 221 00:25:10,320 --> 00:25:19,160 you in the, in the whois information for a spam trap, spam honeypot domain. Obviously that is a 222 00:25:19,160 --> 00:25:23,100 bad idea. And then you want to configure DNS. So you want to configure DNS. You want to configure DNS. 223 00:25:23,120 --> 00:25:28,380 There's a couple of sort of very specific components here. You want to assign three IP 224 00:25:28,380 --> 00:25:36,780 addresses. The point here is you are mimicking, you're making this look believable as an actual set 225 00:25:36,780 --> 00:25:43,640 of mail servers. So you want to behave exactly like a, you know, an email admin at a normal 226 00:25:43,640 --> 00:25:50,140 company. So you want it to look legitimate. So assign three email addresses, I'm sorry, email 227 00:25:50,140 --> 00:25:53,100 addresses, sorry, three IP addresses. Assign three IP addresses. Assign three IP addresses. Assign 228 00:25:53,120 --> 00:25:58,900 three IP addresses. Even if you're only running one, ah, virtual server, assign three, assign 229 00:25:58,900 --> 00:26:06,320 three IP addresses to that, ah, in, you know, virtual NICs and you'll be able to have, you're 230 00:26:06,320 --> 00:26:11,540 basically increasing your, your attack surface that the spammers are going to be able to send to. 231 00:26:11,900 --> 00:26:19,400 Um, also, create primary and backup host names. Again, you want it to look like a real set of mail 232 00:26:19,400 --> 00:26:23,100 servers. So mail one dot blah, blah, blah dot com. Mail two dot mail two dot mail three dot 233 00:26:23,100 --> 00:26:32,780 dot blah blah dot com, mail three dot blah blah dot com. Also, create three DNSMX records, not 234 00:26:32,780 --> 00:26:40,660 just one, and assign them different priorities. I found this is very important because often 235 00:26:41,320 --> 00:26:48,200 the way companies have set up their backup and primary mail servers, they've done it 236 00:26:48,200 --> 00:26:56,000 incorrectly in that they trust the email that comes from their backup server, but their 237 00:26:56,000 --> 00:27:02,540 backup server may not have the same level of spam filtration as their primary, and so 238 00:27:02,540 --> 00:27:10,320 spammers will avoid even sending to the organization's primary server. They will send the 239 00:27:10,320 --> 00:27:18,180 spam to the backup, you know, the secondary and tertiary MX records, specifically the 240 00:27:18,200 --> 00:27:24,420 because they know that sometimes that will avoid the spam protections that the organization 241 00:27:24,420 --> 00:27:32,460 has. And, if you're a mail admin, sysadmin, go and check. Go and check and make sure that your 242 00:27:32,460 --> 00:27:36,660 secondary and tertiary mail servers have the same spam protection that your primary does, 243 00:27:37,530 --> 00:27:46,180 because that's a huge hole. But, the point here is have those tertiary and secondary MX records 244 00:27:46,180 --> 00:27:52,880 so that you catch that additional, you know, that additional fractional larger amount of 245 00:27:52,880 --> 00:27:59,720 spam. And then you want to generate email addresses. So, you want to see them across the 246 00:27:59,720 --> 00:28:04,960 internet. You want to spread them everywhere. Put them in forum posts. Jam them into your, jam 247 00:28:04,960 --> 00:28:12,360 them on your website. Put them in comments. You know, be as crazy about them as you want. See 248 00:28:12,360 --> 00:28:16,160 them in your website. Give them to your friends. You know, make it as easy as you can to get them 249 00:28:16,160 --> 00:28:22,620 into your game. See who can generate the most spam. See who can, like, get the most stuff coming 250 00:28:22,620 --> 00:28:29,500 from the particular email address that they have seeded for you. But, for all of this, keep 251 00:28:29,500 --> 00:28:36,640 track of where and when and who you gave them to and where they went. And this is super 252 00:28:36,640 --> 00:28:42,440 important so that you know, when I seeded this email address to here, compared to seeding an 253 00:28:42,440 --> 00:28:46,140 email address here, I can then track the metrics for how much spam they have. So, you know, 254 00:28:46,140 --> 00:28:53,040 how much spam each one generated. So, maintain a database or keep a spreadsheet or, I don't 255 00:28:53,040 --> 00:28:57,620 know, write them down on a piece of paper. But make sure that you keep track of where the 256 00:28:57,620 --> 00:29:02,160 addresses went and when you, when you seeded them. So that you can do some metrics on that 257 00:29:02,160 --> 00:29:12,520 afterwards. So, registering a domain. There's many, many, many free services for getting domain 258 00:29:12,520 --> 00:29:16,120 names out there. The adversary uses them. Why can't we? So, you know, you want to make sure you 259 00:29:16,120 --> 00:29:20,040 don't have to spend money on this. So, just go, don't, don't need to spend money on this. Also, 260 00:29:20,860 --> 00:29:27,920 protect your identity by using, basically, burner emails, domain registration, free DNS 261 00:29:27,920 --> 00:29:34,540 services. All of these, there are free services out there for each one. And when you're 262 00:29:34,540 --> 00:29:39,560 setting things up, if it's possible, if it's possible that you can set it up this way, when 263 00:29:39,560 --> 00:29:44,580 you contact all of these things to set them up, use Tor, you know. Be as protective as possible 264 00:29:44,580 --> 00:29:45,420 of your own identity. 265 00:29:46,120 --> 00:29:53,200 And then before you begin seeding, make sure that you verify your DNS records and verify your 266 00:29:53,200 --> 00:29:58,620 who is. Look at it, look at it carefully and make sure that you haven't missed something and left 267 00:29:58,620 --> 00:30:03,680 maybe your name in there, or something that someone could, something that could lead an 268 00:30:03,680 --> 00:30:11,600 adversary back to you. So, take a look at it. If you want to look at your DNS records, maybe look 269 00:30:11,600 --> 00:30:16,100 at your DNS records on a, another machine, use a VPN, maybe, you know, you can find a way to do it. 270 00:30:16,120 --> 00:30:21,480 to look at it from somewhere else so you can see whether the TTL has updated and you can see 271 00:30:21,480 --> 00:30:29,200 the fresh DNS record. Also make the user name on the server generic. Don't log into your 272 00:30:29,200 --> 00:30:35,940 server with a user name that's your name. Because if the server gets popped, they now know 273 00:30:35,940 --> 00:30:42,900 your name. So make it generic, doesn't matter. Whatever you want to just make your user name, 274 00:30:42,900 --> 00:30:49,660 user name or your admin user, admin, doesn't matter. Just make sure it's not your name. So 275 00:30:49,660 --> 00:30:58,920 check your DNS records. This is just a dump from example.com, set up how I would want a spam 276 00:30:58,920 --> 00:31:08,220 honeypot set up correctly. So as you can see I've set up five name servers and then three MX 277 00:31:08,220 --> 00:31:12,880 records and I've called them mail one, mail two, and mail three. And I've called them 278 00:31:12,880 --> 00:31:19,360 the, they all have a different priority as you can see. The 10, 20 and 30 priority. And then 279 00:31:19,360 --> 00:31:24,760 the A records for each one. That's just fake. Those are fake numbers. But I've set three 280 00:31:24,760 --> 00:31:33,360 different IP addresses for each one of the mail servers. And again back to the really fun 281 00:31:33,360 --> 00:31:36,960 stuff. So this is when you generate email addresses. So you want to generate email 282 00:31:36,960 --> 00:31:42,860 addresses that look believable. So have fun with it. Have a lot of fun with it. So this is a 283 00:31:42,880 --> 00:31:48,600 These are a few of my favorite random name generators. So you can go in there. Behind the 284 00:31:48,600 --> 00:31:52,300 name you get to learn a little bit about what the meaning of the names are that you're 285 00:31:52,300 --> 00:32:00,220 seeding into email addresses. Random name generator.info. Name mesh. These are funny 286 00:32:00,220 --> 00:32:06,260 actually. And these are for generating believable domain names that sound like a real 287 00:32:06,260 --> 00:32:11,360 business. These are hilarious. They will generate just, you know, ridiculous business 288 00:32:11,360 --> 00:32:18,440 names. And business name generator. I love Scrabble, by the way. I love playing Scrabble. 289 00:32:18,460 --> 00:32:23,740 Scrabble is fantastic. So why not increase your Scrabble knowledge while you're seeding your 290 00:32:23,740 --> 00:32:29,420 spam honeypot. So go look through Scrabble word finder. Start memorizing some of the smaller, 291 00:32:29,560 --> 00:32:35,340 you know, the two-letter words or three-letter words and whatever. Go through word find, 292 00:32:35,540 --> 00:32:41,340 word finder, your dictionary. Increase your Scrabble knowledge while you're, while you're 293 00:32:41,340 --> 00:32:47,720 working on spam. Also anagram solvers. These are great. You put in, basically you put in a word 294 00:32:47,720 --> 00:32:53,200 and then it shows you all of the other, you know, words that are made up of the same letters, but 295 00:32:53,200 --> 00:33:02,280 rearranged. So just, the point here is have fun with this process. It doesn't, it doesn't need to 296 00:33:02,280 --> 00:33:10,000 be boring. And hopefully after you've done all of this and you've got your, your mail service set 297 00:33:11,340 --> 00:33:20,940 addresses and now you have spam rolling in. And this one is great. This is probably the best 298 00:33:21,710 --> 00:33:28,580 piece of spam that I've ever seen in my entire life. So it has ASCII art in it and it's 299 00:33:29,290 --> 00:33:37,080 basically a hand telling you click on this link. And if you look at the link, I would never 300 00:33:37,080 --> 00:33:44,120 click on that. If you see a link that ends in main.php or document.php or something like 301 00:33:44,120 --> 00:33:57,700 that, never good. Never, never, never good. Okay. So, thank you. This is my Twitter 302 00:33:57,700 --> 00:34:04,080 handle. That's my company's Twitter handle. This is the blog. Next week after we're all 303 00:34:04,080 --> 00:34:07,060 back home, there will be slides and everything. So if you have any questions, feel free to 304 00:34:07,060 --> 00:34:12,640 ask anything from my workshop and from the presentation up on our blog. And do we have any 305 00:34:12,640 --> 00:34:28,900 questions out there? Anybody? In the back. You'll have to yell because. Very good point. So, 306 00:34:30,000 --> 00:34:37,040 if I'm getting your gist, make your entire DNS, set of DNS records blank. And if you don't, 307 00:34:37,060 --> 00:34:42,540 have a DNS record that is believable. So, have a and actually you're right. Maybe even have a 308 00:34:42,540 --> 00:34:50,620 web server with a believable website on there. So, he's saying have an A record for www.blahblahblah.com 309 00:34:50,620 --> 00:34:55,560 so that you have a fully believable DNS record. That's a very good point. 310 00:34:56,080 --> 00:35:01,580 Just blahblahblah.com Get email. 311 00:35:07,140 --> 00:35:13,340 Another good point. So yes, you will get, you will get spam to those records. Right. Alright. 312 00:35:13,840 --> 00:35:29,120 Any other questions? Yes. You're going to have to yell. Yes. Actually the, so the, the 313 00:35:29,120 --> 00:35:34,380 Python script code that if you, the people that came to my workshop, they already have a copy 314 00:35:34,380 --> 00:35:39,580 of it and we've worked with it, but I'll make sure to put this up on, when I get back to, to, 315 00:35:39,580 --> 00:35:57,720 to home. More questions? Yes. Oh, yeah, they're, they're not, they're not necessary, but I'm, 316 00:35:57,720 --> 00:36:04,040 I'm not concerning myself with the necessity of a particular email header. I'm using these as 317 00:36:04,040 --> 00:36:11,180 indicators to determine possibly the origin of that particular piece of spam. Uh, use it to 318 00:36:11,180 --> 00:36:18,700 correlate, um, across like maybe this particular botnet compared to this particular botnet 319 00:36:18,700 --> 00:36:25,920 produces a, a slightly different set of X, X, you know, X headers. So whether they're, whether 320 00:36:25,920 --> 00:36:27,700 they are, uh, required to, uh, use the code or not, they're, they're not necessarily, they're 321 00:36:27,720 --> 00:36:34,520 required or not is not important to me. It's using them, uh, as an indicator. If that makes 322 00:36:34,520 --> 00:36:51,580 sense. Question? More questions? Okay. Um, so the question was is there any insight on, um, 323 00:36:51,980 --> 00:36:56,900 you know, taking the knowledge, like taking the knowledge that you're gathering from this and 324 00:36:56,900 --> 00:37:03,760 then using it, uh, in the, your example with SpamAssassin. So I would say, uh, yes. And 325 00:37:03,760 --> 00:37:08,740 that's, that's actually the, the ultimate goal of all of this. So what you're going to do is 326 00:37:08,740 --> 00:37:14,240 you've got, uh, basically a library of spam that you've already collected. You have spam coming 327 00:37:14,240 --> 00:37:20,980 in. You're analyzing the spam. You're pulling out indicators like the origin IP. Um, and these 328 00:37:20,980 --> 00:37:29,120 are all things that you can use to block, you know, future spam. In addition to knowing about, you 329 00:37:29,120 --> 00:37:33,340 know, to, in addition to the, the, the threat intelligence component of it, you can also take 330 00:37:33,340 --> 00:37:39,160 these indicators and you can push them out to a defensive device or defensive system such as, uh, 331 00:37:39,200 --> 00:37:49,400 SpamAssassin. More questions? Okay. Thank you everybody. Thanks for coming out. Appreciate it.