Okay, if everyone's ready, we'll get started with the first live demo of the day. I'm going to hand over very, very shortly to Dave, who's going to be introducing his presentation, Winning a SANS 504 CTF Without Winning a SANS 504. Without further ado, Dave just done his shot, so now he can take over. Thanks. Thank you very much. Good morning. Welcome. So, I am Big Dave. I'm not the biggest Dave, but I am one of the many Big Daves that exist within this world. Everyone knows a Dave, right? So, W, first thing you should do when you log on to a Linux terminal, W, who else is on with me? So, this is me, Big Dave. That's my personal account everywhere. If you want to reach out to me, ask me questions after this, that's the place to do it. It is personal, so you will just see random bullshit, random sketches I do and other stuff. I'm a security researcher. I work for a company in San Jose. My job is to look at attackers, how they're doing stuff inside the network. So, not the traditional IOCs, like what? How have they popped a box? More behavioral than that. I worked for an engineering support company in the UK, working with the MOD, nuclear power, that sort of thing. Very big company. Got to work with a lot of interesting adversaries. It was through working with those guys that I uncovered some of the techniques and some of the stuff I'm going to talk about today. I also worked as a network engineer before that, so it's pretty standard. But the weirdest part is I have a BA in drama. So, that's relevant for this field, right? So, the background to this talk, I spent a long time when I was working with my previous company in the trenches of the spam reporting folder. People just send us emails every day, and I was doing this day in, day out, just ridiculous volumes of email saying, this is spam, this is malicious, this is advertising, this is fine, you can click on these links and you can't click on these ones. Through that, we had to think of novel ways to also beat the enterprise filters, so how can we get past the anti-spoofing? How can we send emails that look like other people? How can we get files through these devices as well? I worked, obviously, as part of the blue team in that, I was a SOC analyst, so we went up against everyone from Nigerian scammers who would say, do you want your share of 85,000 Nigerian dollars? But we also ran investigations which deal with a more serious side, and it's the one that people know a lot about and they hear a lot about now, the sort of, the CFO fish. Somebody pretends to be your CFO, they send it to your financial controllers, it usually looks really bad. There are a couple of cases, though, where that isn't the case. But let's give you a background of what I'm talking about today. The SANS 504. The SANS 504, it's run by SANS, it's the hacker tools, techniques, exploits, and incident handling course, so it's the sort of basic stuff for the SOC. Five-day course covers the basics of incident response, processes of incident response, good practice for incidents. Incident response. And pen testing as well. It's a lot heavier on the pen testing, actually, than incident response, which is a bit weird given that it is more of an incident response course, but fair enough. On the Saturday, they run a CTF. The CTF is a small network of plannable machines that you have to get two flags, put them together, and come up with a phrase that pays. And then you win the CTF and you get a coin. You get your 504 challenge coin. I didn't win the CTF, but I have a 504 challenge coin. And I'll come on to that. So my SANS was in London, 2015 spring. It was taught by Kevin Fiscus. Please feel free to at him on Twitter. I asked him before the talk. It's fine. It was two days of me being very serious and five days of me being very devious. So on the first couple of days, Kevin said that at the end of the week, we're going to be doing the CTF. And he said in front of the class, hey, I encourage social engineering. Because I've never been socially engineered to give up the phrase that pays. And so whilst the rest of the class went off and went, oh, I'm going to produce a letter that says I have a share of $20 million if you give me a hint to the CTF, or someone went and got a picture of his Jeep from Facebook and said, oh, we're going to craft something from the DMV. It's going to say he's been caught speeding. And then if he gives us a hint to the CTF, then we'll let him off his fine. And I took it way too seriously. So the challenge. The CTF was set up. Encourage us to socially engineer to get the phrase that pays. He showed us bad examples of previous phishing and said he found them hilarious. I definitely took it too seriously. I was advised not to do this by my peers who said, you shouldn't fuck with your CTF, with your SANS instructor. They will kick you off the course. So the target. He said he'd never been socially engineered by a student. He's a security professional. He works in incident response. He's incredibly smart. And he was aware that he was opening himself up for incoming attacks. Okay. So the patsy. There was another SANS instructor that week giving a presentation where, importantly, there was free beer at the back where I stood for the entire talk. Getting beautifully rat assed. They gave a presentation. The presentation was on memory forensics. It was great. They were showing off a new tool. The tool worked really well. It did some new interesting stuff with not messing around. It worked with memory space when grabbing the memory dump. It's fantastic. It's better than other things I've used to do this before. But it gave me an idea. Because, more importantly, in the memory dump was an example of the SANS 504 CTF that they run on the Sunday. Just showing the meterpreter shell from the network list, so, oh, look, here's an open TCP on 4444. And it gave me an idea. The plan. Well, what did I know? I knew the instructors knew each other. They worked for SANS. I'd seen them talking. I knew that they were going to give a presentation. So I thought I'd go along to that. It sounded interesting. There was free beer. And I knew about some interesting e-mail tricks. Now, I guarantee almost everyone in this room when they were 10 or 11, maybe even younger or older, in the 90s, let's say, found an open mail relay on the Internet and sent an e-mail to their friends. As Bill Gates at Microsoft.com, hey, there's a new update to Windows. Please click on this link. We're not going to sub-7 your machine at all. So the execution. From a high level, I crafted an e-mail in the style of the Patsy and I sent it from the Patsy. I found a hosting provider with Open SMTP. That's about it. There's a touch more to it. A study in pink. I love this site. Alwaysdata.com. The best thing about this site is that you can start for free. There is no sign-up fee. There's no, like, 30-day trial. They will give you a really basic account for absolutely nothing. You also don't have to fill in any correct information. So that's Butts at Guerrilla Mail. I think my name's Jimmy Riddle. I live at 1 France 77 in the city of Spain. The only thing that has to be correct is the country has to match where you're signing up from. So it looks at your GOIP. That's the only thing that needs to be correct in that form. It takes no credit card details, nothing else. You can lie through your back teeth. And it has a handy Roundcube webmail interface. If you don't want to type out those bothersome SMTP commands on the shell, you can just go and do it. You can just do it from their Roundcube interface. So there's my e-mail address. Buttsnatch at Alwaysdata.com. And I can edit that identity. So there's my e-mail address. And I can put in anything I want. So here I've just changed it to say the e-mail is actually just say it's from Recon at DEF CON. Reply to, send it back here. I want to get my e-mail right. And here's the rub. It's a really old trick. We call this envelope spoofing. So when you send the e-mail, at the very top you have your SMTP headers and you have the from address. You have the to address, the receipt to. But a lot of that actually gets stripped these days by the edge e-mail systems. So you can rarely, unless you're intercepting the traffic from the edge to the exchange server, you won't ever see the original from address because it gets cut. You will, however, see the envelope. Now the envelope is actually part of the data of the e-mail. So this is all outside of the protocol. And the data of the e-mail is the important bit to the application. So when the application receives the e-mail, it doesn't look at the original sender because it's usually been stripped. It looks at the e-mail. It looks to the envelope to give you the sender and to make the e-mail look like it came from that person. So there's some other interesting things that happen when that goes ahead inside most of the applications. If you can nail the e-mail address to somebody within someone else's address book, Outlook, Gmail, Mail for Mac, any modern e-mail application will pull in contact details, presence information, signatures, everything that makes that e-mail look legitimately as if it has come from that person. So all you've got to do is send. All you've got to do is mail their e-mail address and possibly how they talk and how they act as well. If it's dumb and it works, is it really dumb? So this is a bit of a case study. Facebook and Google both lost about $100 million to a scammer. Now the guy's been arrested since and it was absolutely huge. Two tech giants. The company's insurance came to a well-known type of scam in which the attacker tricks the victim by innocent looking e-mails. So there's not been many details given out on how this was done. They said it was financial fraud. It's a well-known technique, et cetera, et cetera. So I want to shed some light on what happened. During the time of this attack, the common method to do this type of CFO fraud was to pretend to be the CFO, to say, please authorize this payment to this company because they are our supplier. It failed 99% of the time. There are some big cases, like 70,000 pounds was given to some company in Taiwan through this sort of fraud. But in this case, they went for the supplier, classic target supply chain, right? They targeted the supply chain. They infected them with an old-school Java rat. From that, they then sat on that supplier's e-mail and they watched outbound e-mail. Not only did they scrape... E-mail addresses to send to, e-mail addresses to send from, they also scraped headed paper, physical signatures that were transmitted across e-mail because they were in the wire. So the e-mail came out of the supplier, it got snuffed by the attacker, and then it got sent on to the target. Now this was interesting because they then waited for a very large invoice to go across to the attacker. At which point, they would... Then send a follow-up e-mail, oh, by the way, sorry to interrupt, we are currently under audit. All our bank accounts have been frozen. Can you please change the bank accounts to these new ones because they're not under audit and we can take the payment and it'll be sorted out afterwards. If you know much about financial auditing, that wouldn't happen. That's just insanity. But the reply in due diligence says, hey, can you send us this with headed paper with the signature of your... Or financial controllers? Of course, the attacker has already stolen all that. So they send another one and the payment gets authorized to some Swiss bank account and they walk out the door with Facebook and Google with $100 million. These are smart people working in big tech companies and these guys can get duped. What I always say to people when they say, oh, well, we bought the best firewalls, we bought the best e-mail routing, we bought the best AV, it's like, I don't care if someone wants to get you, they will get you. Doesn't matter if you are Facebook, Google, or a SANS instructor. If somebody is really out to target you and to send you malicious content, they will do it every single time. And I have a nice heavy coin in my pocket that proves that to my SANS instructor. So what do you need to know? Well, you need to know their e-mail address. How did I get this from a security professional? They were a very private person at the time. All they gave out in their talk was their Twitter handle. And this was before Twitter. Twitter let you embed the link to your website. The hook. I mean, this was pretty easy based on the content being presented. I've already said they were showing off the SANS 504 memory dumps and the capture the flag in the presentation. But I needed something to make it a little more believable. So I need a handle, man. I'm not anything if I don't have a handle. So the context, the recon was carried out a few years ago. Like I say, it was before putting your website on Twitter was actually kind of a thing. It was kind of common. The security professional didn't advertise their e-mail address, just their Twitter handle. There is a lovely piece of SANS 504 advice, and I've spoken to a couple of instructors around here this week. At the beginning of the week, they say, if you own a website, put your own e-mail address in the admin field because if it ever gets hacked, you want to be e-mailed, right? You want to be notified. Whilst great advice for notification of breach, it's actually brilliant for finding out people's personal e-mail addresses because sometimes they are not. They don't scrub it. They don't put something odd in there. They don't put a guerrilla address. They just put something that is very personal to them, so I took a shot in the dark. I knew the professional's Twitter handle, so I started going through all of the common TLDs to see if that was registered to them as a TLD, and I got the hit. This is from a couple of years back before it was all scrubbed by domains by proxy, but basically it was a, I believe it was a dot, this one was a dot com. It was really easy to get this one, and it had their personal e-mail address, their g-mail address, which wasn't anywhere else in there. I mean, it's easy recon. It's Whois data. Coming soon to a Whois near you, though, a lot of this data is going to go because of GDPR, so have fun with that. When that happens, we're going to be in an interesting place of finding out this sort of information. We're going to have to revert to older social engineering techniques to try and get this stuff as well. Like, don't worry. Don't worry at Wendy's. No one's going to believe you unless you have proof. The reason I say this is I could send an e-mail to Kevin from his colleague, and I could make up any cock and bull story about, hey, you dropped your USB key and it's got the phrase that pays, or I need to know it because I'm going to be teaching the course next week and I need to make sure I'm pre-warned, but I've got a degree in drama. I'm good at making stuff up. I'm getting good at playing pretend. I spent three years studying playing pretend. I actually spent six months of that building a puppet, which is great. I ruined a hoodie like that because the head was made of foam and I had to shave it down with a Dremel, and it just sticks into any fabric. It's awful stuff. But it's great. A little Japanese man sat on the floor telling a story, trying to play a shamisen, terrible. So I sat in on the presentation given by the SANS instructor, and not only did I watch the presentation and enjoy the content and go, hey, that's a cool tool. I'm going to go and add it to my tool chain. I took note of how they spoke. I took note of the phrases they used. I took note of the way they would leave gaps or go on non sequiturs. And so when I sat in the gym that evening on a bike, I sat there crafting an email in my head. And when I got back to my hotel, I wrote an email that looked like it was from the SANS instructor. It was from his colleague. And as I said earlier, what makes an accurate email? Well, modern email programs do the heavy lifting for me. All these applications here add contact information to spoofed emails, so if you want to spoof the envelope, these applications will make it look much more legitimate for you. Like I say, they read it from the envelope, not the original SMTP mail from. Yeah, worth noting actually, a lot of these mail applications make it really difficult to view the source now. Well, not really difficult, they just hide it behind a few menus. Exchange, for example, well, Outlook and Exchange hid it behind a couple of menus and lots of people now ask where it is. Gmail, it's reasonably easy, you can do View Original. Office.com Outlook is actually quite difficult to find the menu item to give you the source. So it's hard to start, for normal people, it's hard to start looking at this information, especially if you're viewing it on a mobile as well. I mean, forget it. Yeah. Yeah. But I'll try. So when I deducted the email, I made it look like it was from his colleague. I wrote it to look like it was from his colleague. I spoofed the email address, but I was nearly sure it was their email address and it turns out I was right. Not always as it seemed. There's a third player in the room. So yeah, I forgot that was the last slide, my bad. But yeah, the next day I sent him this email. It was a fraud. I send it to him at, I think it's about half past 12 at night. We're in London. I know the pub's closed at 11. It's fine. I know that they're instructors and they're friends. They're going to be out drinking. So unless there's something else going on between them that I don't know about, I know they're probably not going to be together, and he might have had a couple of beers with him. So I send him an email at half past 12 at night. And I wake up the next day, check my account, open it up. My heart's racing, butterflies in my stomach. And there it is, the phrase that pays. Now, I'm not going to tell you the phrase that pays because I've spoken to other people who've won the CCF and it hasn't changed. So I had that, and I was like, well, I mean, I guess I could be right. He could be tricking me. He might know. So I basically ran all the way to my SANS course. I was skipping like a giddy schoolgirl. I was so excited. This was Wednesday. The CCF's on Saturday. I walked in, and he was talking to one of the SANS adjudicators. Now, these guys are taking the course, but they don't pay. They're there to field questions, help people, to be a T-boy. They wear a little apron. I think that's really cute. So I went in. He was talking to the SANS adjudicator. He's going, so last night, my colleague sent me an email, and apparently one of my students is trying to socially engineer them for the phrase that pays. And I had him. I knew I had him. And because he was so bought into this idea that they had sent him the email, it looked perfect that he was so bought in that he was telling a story of how one of his students had the balls to go and target another SANS instructor for the phrase that pays. So I just sidled up to him and just went, here's the phrase that pays. Oh, fuck you. And that was it. I confirmed knowledge. So at the end of the week, at the Saturday CTF, unfortunately, my team didn't win. We were about a minute behind the winners. We had both halves of the flag. We'd pop the vulnerable kernel on the Linux machine to get the second half, which is one of the more tricky bits. So there you go. We had both halves of the stream. All we had to do was put them together and decode it. As we were getting to that point, we were like, hey, what about that tool we learned about at the beginning of the week? That'd be great. Let's use that. Put them together. We'll make it one part of it. And then some guy went, we got it. I was like, ah, shit. Because I'd like to have won, right? I was still in the same competition. I knew the winning answer, but we were all in the same competition. So Kevin was like, congratulations. How'd you do it? Let's go through it. And they gave all their details. And I'm like, yeah, we did that. We did that. Oh, yeah, we found that. Yeah, that's great. Well done. Okay, okay. I'm not going to ask you for the phrase that pays. I'm going to ask you. And he made me stand up in front of everyone and explain myself and how I got the phrase that pays. And that is how you walk away from a SANS 504 CTF, capture the flag with a coin without winning the SANS 504 CTF. Does anyone got any questions? Thank you.