start	end	text
0	3620	So this is called, your blacklist is dead, air-gapped everything,
4440	9100	and is my diatribe on why I think that the future of command and control for
9100	12340	malware is in the cloud. Just to give a little bit of background
12340	16060	on you, my name, on you, on me, my name is Eric
16060	18640	Lincoln. I'm a threat researcher at Netscope.
18640	21480	I study applied mathematics at Johns Hopkins University.
21820	26460	I wear some lib t-shirts because I'm not allowed to talk about politics
26460	31760	in this presentation. So why am I here?
32320	34860	Well, I'm here because I think a lot about malware.
35080	39760	And I think a lot about what malware authors are going to do.
40800	43120	And, right, so what motivates malware authors?
43120	46100	They don't want to get caught, right? That's the number one thing.
46100	49060	If you have malware on a system, you probably don't want to get caught.
49060	52800	Of course, there are exceptions, you know. But for the most part,
52800	55700	you want to be surreptitious. So how do you avoid detection?
55700	58800	You blend in, right? And so if you're talking to this
58800	62400	sketchy server in Ukraine or you're calling out to an OVH IP,
62400	66420	which if any of you have ever seen malicious network traffic,
66420	70500	you've probably seen, it's pretty obvious, right?
70560	75120	But if I talk to a whitelisted domain, something that is very specifically
76040	79380	authorized instead of a sketchy server in France or Ukraine,
80120	82560	that's a much harder problem to solve, right?
83120	87260	And if you've ever written IDS rules for unspecified IDSs
87260	90600	that I'm not allowed to name, it's really, really hard to detect
90600	96960	things that look like normal traffic but are bad, right?
96960	101500	So you look at Angular exploit kit used a bunch of BBS patterns
101500	105260	when it was trying to put out its landing pages.
105260	108140	And that made it really, really hard for me at the time
108140	110760	to write IDS rules to mitigate it.
111940	115200	So before we really dive into the meat of it,
115200	118380	why do people even use SaaS applications, right?
118380	122460	We have software as a service. I'm willing to bet that everyone here
122460	125780	has some authorized SaaS application in their enterprise.
125780	127440	So what's it good for, right?
127740	131640	I mean, you don't manage the physical infrastructure.
131640	134760	It's patched for you. Users can use it from everywhere.
135580	138760	It's easy. It's cheap. It's effective.
138760	142960	And it's growing, right? Small companies are using it.
142960	147740	Large companies are using it. G Suite, Slack, Dropbox, Box.
147740	150240	You name it, someone is using it, right?
150480	154340	And so it's everywhere and it's easy.
155140	159620	A minor digression is I've had a lot of debate about
159620	163580	is social media SaaS, right? Is social media software as a service?
164820	167980	Salesforce thinks so. I think so.
167980	171640	If you disagree, then you're wrong.
172680	175060	I'm so sorry. You're wrong.
175540	181000	So Reddit is SaaS and Facebook is SaaS. And again, that's not up for discussion.
181380	187240	So is SaaS good for security? And the answer is a resounding maybe, right?
187420	190580	In some sense, you want to offload your risks to a third party.
190580	196180	You want Microsoft to be responsible for protecting your data and encrypting it
196180	201540	because they're probably better at protecting encryption keys than you are.
202000	207000	So it decreases the attack surface of your actual enterprise network.
207260	211660	And also, right, capitalism, because we live in a society,
211660	215060	incentivizes protecting your stuff. If somebody is really, really bad
215060	218820	at protecting your data, you're not going to trust them with it, right?
218820	223760	You're not going to pay them money to do it. That's kind of how the market works.
225260	229300	So does having a bunch of whitelisted services decrease your visibility?
230360	235500	Yeah, right? You have a bunch of network traffic outbound that you assume is good.
235500	239620	You're not inspecting that traffic. Not in any meaningful way.
239860	243280	So yeah. It's a land of contrasts.
244280	246880	So we'll start with a blue team perspective, right?
247900	251760	I do want to start with a caveat that other people are much better at this than I am.
251760	255040	There are people here who have spoken today whose presentations you have seen
255040	262600	who have thought about the blue team approach to protecting against malware and things.
262720	266940	And they're better than I am. So if you saw those talks, good for you.
266940	271940	Otherwise, they're recorded. So I've got a timeline here.
271940	275260	And you can't read it because the text is super tiny.
275260	277820	So I'm just displaying it so I can talk about it.
277820	282260	But basically, we've got kind of different phases of the cyber kill chain.
282260	286680	You've got your actions on objectives. You've got command and control, delivery and exploitation.
286860	294980	And we have seen since about 2009, every single one of these three phases
294980	301060	used in different ways with different services to do all kinds of different things, right?
301060	305360	So you have Google App Engine being used for command and control.
305820	309780	Using EC2 all the way back in 2009, right?
309780	316920	Recently, Trend Micro, and we wrote about it too, but Trend Micro did it first,
316920	321660	wrote about Slub, which uses a variety of SaaS services to do
322100	325020	a couple of different steps of this process, right?
325540	334020	You have Rock Group, which was using GitLab and Giddy, which is a Chinese Git clone or a GitHub
334020	339400	clone, to download follow-on scripts and second-stage payloads, right?
339400	344660	So these things are happening. We had a pretty good run there in 2014,
344660	349560	where there's a decent cluster where you've got PlugX, Inception Framework, right?
349560	357060	So it's being used by cyber criminals, APTs. It's being used by everybody.
357060	359080	And it's only getting easier.
360860	365860	And part of the reason for that is, if you think about domain generation algorithms,
366240	372320	right? So our first domain generation algorithm that we've really observed and kind of the one
372320	376620	that we call the first is Kraken, right? And that was back in 2008.
376620	385200	So in the last 11 years, we've written over 22,500 academic papers.
385200	390860	That's not blog posts and Medium posts and, like, shitty things you wrote and marked down
390860	395300	but never published. These are academic papers that are on Google Scholar, right?
395300	401440	This is a well-researched, well-trodden topic. And if you've spent any time in malware analysis
401440	407000	or blue teaming, some of these names are familiar. You may have heard of Conficker.
407000	411520	You may have heard of the Zeus botnet. Those are things you might have heard of.
411700	414980	Or if you're new, you probably haven't, and that's fine.
415200	419680	So we've spent a lot of time on domain generation algorithms, right? And we've spent a lot of
419680	425740	resources researching how to detect domain generation algorithms. And what's the point
425740	430960	of a domain generation algorithm? It's to make sure that you can't blacklist a domain and kill
430960	438360	the CNC, right? It's to evade IDS detection that depends on the domain. It's to evade firewalls.
438880	444340	Well, if you're just calling out to API.slack.com, you don't need to write a DGA,
444340	448820	and when somebody figures out your DGA, you have to write a whole new DGA.
448960	457300	You can just use API.slack.com, right? So it may not get rid of domain generation algorithms
457300	462380	forever and always, but it is an alternative to domain generation algorithms that serves
462380	468840	the same purpose. And I want to talk a little bit about Slub, which, again,
468840	474060	Trend Micro wrote about, and then we wrote about as well. We being Netscope.
474560	480980	So one of the things that Slub did was it got commands from GitHub gists,
480980	486560	posted command responses in Slack, and then exfiltrated files when it would upload files,
486560	491680	right? It would upload them to file.io, which doesn't require any authentication or API keys,
491680	496480	right? And there are really good blog posts about this if you're interested in the technical
496480	504780	details of Slub. And they've actually really the Slub authors have released a new version
504780	513320	that kills GitHub, which I personally don't think is super great, but I understand it.
513980	517420	And they use Slack a lot more. So they use Slack for passing commands and
517420	523160	for returning responses. And it's a beautiful piece of malware. It really is. If you don't
523160	528480	love malware, you're probably at the wrong conference, honestly.
529440	536180	Right. So why was Slub so effective, okay? It used a bunch of different SaaS services, right?
536180	542500	And file.io in particular is an anonymous upload. So it just uploads it. It doesn't ask you for a
542500	549540	key. You don't log in. There's nothing. You just pass the binary bit or you pass not the binary,
549540	559120	pass the hex bytes of the file to the upload path. And that's it. That's the API. File.io
559120	565420	slash upload. That's all. Just a post. So that's really hard to detect, right? Unless you're
565420	570760	looking at the content of the payload. And of course, looking at the content of the payload
570760	577740	is difficult because all of these things have TLS, right? That's one of the other beauties of
577740	584680	SaaS services as CNC is that they all provide TLS by default. You don't need to create your own cert,
584680	591640	you don't need to get your let's encrypt cert every 30 days. It just uses Dropbox,
591640	600480	file.io, whoever. It uses their TLS cert. And again, it's sneaky. It looks like API calls.
600480	606100	API calls to legitimate websites don't look like CNC traffic. So you're not going to blacklist
606100	611540	these domains, you're not going to blacklist these IPs. And if you write an IDS signature,
612280	616240	you're probably not going to key off of that. You're going to have to key off of something in
616240	622360	the content of the body, right? And that's assuming that you get through the TLS encryption,
622360	627860	meaning that you're probably in line and you're stripping SSL. Which not everybody does.
629120	635500	So how do you defend against SaaSy malware? Well, DLP solutions are pretty good. If you
635500	641000	upload a sensitive file to Dropbox and you have a DLP solution in line that looks at your files
641000	647440	as you upload them to Dropbox or as an attacker uploads them to Dropbox, it's going to say, hey,
647440	652340	these are a bunch of social security numbers. It's probably not good. And you'll get an alert.
653720	659020	Careful monitoring of traffic, which is really just a generic thing that doesn't mean anything.
659020	664540	I'm just saying it so that I cover my ass when one of you asks me what about IDS.
665680	675340	Aggressive user education, right? Not just, like, don't click links unless you trust them. But,
675340	682700	like, ask yourself why you trust a link. If you're clicking a link that was messaged to you in Slack
682700	691100	that goes to a Dropbox, maybe make sure. And then, of course, endpoint detection, right?
691100	696340	Endpoint detection doesn't care what method you use for command and control. It just cares about
696340	702080	whether or not it's detecting the malware. So, it can use domain generation algorithms or call
702080	711520	out over port 666 or listen on port 777, which is sub 7 for the 11 of you who are old enough to
711520	719600	remember that, right? So, that's a good way to do it. And one thing I want to do while I have a
719600	726780	soapbox to stand on, one of my hobby's horse, is there's nothing new under the sun. All of these
726780	733400	services, if you're a blue teamer, you need to think about Dropbox, you need to think about Slack,
733400	738440	you need to think about all of these things the way that you think about ports on your server,
738440	744720	right? If you're hardening a server and you've got FTP open, and you say, well, we don't run
744720	752940	we don't need FTP open on this server. We've got FTPD running, but this isn't an FTP server.
753180	762020	What do you do? You kill FTPD forever. You block port 24, 3, 4, shit, whatever. You know what I
762020	768980	mean. It's been a long day. I yelled at most of you. But the point is, you block that port,
768980	774700	you kill that service. If you don't run Dropbox in your enterprise, don't let people use Dropbox.
775320	781920	Right? What personal Dropbox do they need to use for your corporate files? And I know that's such
781920	787420	an awful thing to say at DEF CON, but seriously, if you're a blue teamer, really give thought to
787420	796560	how you manage these services and be false positive tolerant on them. Because it will screw you.
797700	805420	Now, for the more fun part, right? If you're a red teamer, or if you just like red team things,
806500	816620	how do we use these sorts of services to do stuff? Well, as always, getting in is the hard part,
816620	821880	right? And all of these slide titles are references to music, and you might not get any
821880	830020	of them, and that's okay. This is Tom Petty on the Heartbreakers, yeah. But how do you get in
830020	836040	in the first place? You abuse lax IAM permissions, you force logins, social engineering, old-fashioned
836040	842820	exploitation, you know? Endpoints have vulnerabilities. People don't patch everything.
842820	850960	People run, like, ancient versions of VLC, which is so weird. People run just the weirdest stuff.
850960	860720	Somebody had FileZilla open, like, two months ago? Why? I don't know. And then you've got whatever
860720	868720	blue you want, because people still haven't patched MS17010. Which, if you're in this room,
868720	876300	and you have a box that you know of that hasn't applied that patch, leave. The whole conference,
876300	882440	the state of Nevada, go home and patch it. It's been two years.
883820	891000	Right? And so, then once you have the access, then you can get by IDS, right? And you can pull
891000	897480	your tools from Dropbox. You can pull your tools from S3. You can pull scripts from Pastebin.
897540	906060	Seriously. Just put the Python in Pastebin and make a curl request to the raw and then
906060	913520	pipe it to Python. It's that easy. And it runs and it works. And I don't know. Some people aren't
913520	920000	mitigating this in any way, shape, or form, and it's nuts. And GitHub. GitHub is such an
920900	928660	underutilized way to abuse trust relationships that companies have. Most places, if you have
928860	935680	a GitHub repo, and you make a pull from another GitHub repo or a clone from another GitHub repo,
936360	942040	they just let you. Nobody's blocking GitHub traffic, right? Because what if it breaks your Jenkins
942040	950040	pipeline? Yeah, that one guy found it funny. That was good. Thank you. You specifically.
950620	955940	But seriously, you can just pull code. You can pull whatever from GitHub. And if you have file
955940	959940	storage, forget about it. You can pull executables. You can do whatever you want, right?
962380	967720	Nobody gets this one. That's okay. Carole King had a song called I Can't Hear You No More.
967920	973120	It's fine. And then there's tried and true techniques for doing exfiltration over these
973120	980400	sorts of services, right? You make a draft email in Gmail and attach something to it, but you don't
980400	987360	send it. So, it never trips like an ESA, which is something I wasn't supposed to say. You know,
987360	993960	Slack has an upload feature. Twitter, Dropbox, whatever. You can send data over these things,
993960	1001400	and they are usually trusted. You can create a private Reddit and just post whatever in there,
1001400	1006500	and nobody will ever see it, and nobody will ever block it. It is a great way for you as a red
1006500	1014460	teamer to exfiltrate data in a way that is super surreptitious. And one more thing I wanted to
1014460	1021460	talk about. Before I talk about it, I do want to pay homage. This is not new. People have done
1021460	1030120	this before. I am just demoing my version of it. So, Gcat, Twitter, Slackor, Slub, all did this
1030120	1038860	really well, right? Slackor in particular is real nice. Coalfire put that out. So, huge props to
1038860	1046500	them. And a little bit of a shout out to the Slub authors, because A, I jacked their program flow,
1046500	1054060	and B, it is a sweet piece of malware. It is really good. It was fun to reverse. It was fun
1054060	1062760	to reverse the second time. It was a real friend, you know? So, I want to demonstrate something that
1062760	1070480	we have been calling sassy boy, which is I've got this shirt. That guy has a shirt, too, because he
1070480	1078840	works with me. And I'm going to pause it like six times, and you probably can't see it. So, I'm
1078840	1087100	really sorry, which is why I'm going to talk you through it. So, let's do that. Okay. Right. So, we
1087100	1096440	run the oh, Jesus. Okay. There we go. So, we run the agent. Okay. And this is not full screened. Not
1096440	1105940	well enough. That's fine. Right? And so, you can see on the right, we've got our Slack, and on the
1105940	1112140	left, we have a terminal. And in real life, your malware is not going to be so cooperative and
1112140	1118480	provide you with a terminal. But I have done it so that I can know when things start and end. Also,
1118480	1125420	because I like recording my screen this way. So, play. There we go. Right? So, we run the agent.
1125420	1131180	Okay? And the first thing that happens is it checks in here, and it tells you some basic
1131180	1135600	information. So, down at the bottom, which you can't read, and I should have tried this on a big
1135600	1146340	screen. It says current user is not admin. Username is Eagle Lincoln. Mac scope.local. So, what's it
1146340	1153440	doing? It is checking who the current user is, what their UID is, what their OS is, and what the
1153440	1163000	computer name is. And you see, we pop calc, because you have to. It did download the actual calc.app
1163000	1171260	and run it. So, it is downloading and executing code. That's just a law of demos. If anybody gave
1171260	1179180	you a demo today and didn't pop calc, they're fired. Right? And so, then what did it do? It
1179180	1184240	listed this directory. It listed the current directory that it's running out of. Because I'm
1184240	1188180	lazy and didn't want to move it around or compile it into an executable. But you can do that with
1188180	1195620	pants. Or whatever you want. So, what do we have here? Right? We've got some stuff. And then we're
1195620	1199360	gonna give it a command. We're gonna tell it to list dir. We're gonna have it list our home
1199360	1206280	directory. Users, Eagle Lincoln. And it takes a couple seconds to think about it. And then it
1206280	1211140	comes back. Right? And we've got a bunch of files and directories there, because I don't keep my
1211140	1217280	home dir clean. But we have one in particular that's pretty neat. And that's .ssh.
1218180	1227180	I'm assuming that everyone here knows what lives in .ssh. So, we're gonna go ahead and upload
1227780	1236440	our SSH private key to Dropbox. All we pass it... right? So, this... all of this functionality is
1236440	1245020	not hardcoded. We're passing it a path for a file and we're passing it an OAuth key for Dropbox.
1245020	1254120	The Dropbox is not hardcoded. The only thing that lives in the malware is the upload API call
1254120	1261280	for Dropbox. And then it creates a folder called max scope, which is the name of the computer.
1261860	1269560	And hey, there's my RSA private key. Right? And we love it. And yeah. I'm not gonna show you my
1269560	1274280	RSA private key. I thought about it. And then I remembered that that's my actual production
1274280	1281940	laptop for work. That would be a mistake to display at DEF CON. Yeah, there would be like
1281940	1287840	45 people taking pictures. Right? And then we tell it destroy. And then when it destroys,
1287840	1294480	it kills the whole thing. So, it just dies. That's it. That's the whole demo. Thank you.
1295560	1302700	Thank you. Right? So, code is available. That's not the correct address anymore.
1302700	1308700	It's at net scope OSS. I can modify it. I'll make it available. We have a blog post that
1308700	1315620	links to the code, too. Net scope OSS slash sassy underscore boy. S-A-A-S-Y.
1318360	1325540	But I've open sourced the whole thing. You can see my crappy Python. And you can run it and you
1325540	1331460	can test your own security stuff against it and see what your logs say. Which is why I'm opening
1331460	1341850	it. My caveat is it ran on my Mac, it ran on my Windows VM, and it ran on my Linux installation.
1342380	1349640	I am not promising it will work on yours. Whatever your environment looks like,
1349640	1356060	I hope it works. Or not. I hope it doesn't work if you don't want this running. Right?
1356060	1361120	Anyway, what have we learned? Right? You guys sat here and listened to me talk for
1361660	1367780	however long it's been. So, what have we learned? Right? What are the lessons you should take away?
1368520	1374220	SaaS applications can increase your attack surface. Even though you are not running an
1374220	1380420	NFS that is exposed to the internet and you're running Dropbox instead, now you are trusting
1380420	1388260	Dropbox. Which means if you are not making sure that it is your Dropbox that is being used,
1388260	1394640	you're increasing your exposure. SaaS applications move data very surreptitiously.
1395240	1399380	One thing I thought about demoing, but didn't know what fun commands to run,
1399380	1406380	is that Sassy Boy is basically a reverse shell over Slack, right? And it uses Twitter, too,
1406380	1412740	that's another thing it does. It's got fallback methods. I gotcha.
1414500	1417520	But it opens a reverse shell. You can run whatever command you want. If you want to
1418400	1425020	RMRF slash, go for it. I'm not doing it. I was going to do a live demo and let you guys give
1425020	1430780	me commands, but then I realized that somebody would want to run that and then it would be over.
1431880	1440320	And APIs make it really easy to use one or two or eight services to do bad stuff. And to do bad
1440320	1449280	stuff in a way that has built in TLS, built in IDS evasion, and is just genuinely hard to detect
1449890	1455820	with traditional things. As is customary, I also want to do props and slops.
1455820	1462440	Props to Slack for having a super easy to use REST API. And props to Facebook. Because I tried
1462440	1468560	to use Facebook instead of Slack. And they made it really, really difficult to build a chat bot
1468560	1475460	that abuses their TLS. It's an absolute nightmare to use. And it requires you to jump through way
1475460	1481200	too many hoops. So, I just didn't do it. You probably could, if anybody here is determined.
1481200	1486660	You can definitely... it's possible. It just sucks. And, like, they'll kill it.
1488100	1493400	Props to Polsack, Coalfire, Trend Micro. And anybody who sat through this whole presentation
1493400	1500380	is like, yeah, obviously, idiot. You can use Slack for C&C. And props to Jenko, who took a
1500380	1504600	seat from somebody in the hallway because he doesn't love or care about you. Who made the
1504600	1510980	timeline for this graphic. And a paper that we're releasing about a related topic made it far
1510980	1517460	nicer. Because my original one was hideous. Also, slops to Slack for having a really easy
1517460	1526920	to abuse REST API. Somebody, maybe not in this room, because now you are the enlightened few,
1527580	1531640	is going to have a really nasty piece of malware, which is probably going to be Emotet,
1531640	1536620	because it's always freaking Emotet. They're so good. If any of you know the Emotet authors,
1536620	1542960	please introduce me. I want to meet them so bad. Right? Somebody's going to get popped with
1542960	1548460	malware and it's going to use Slack and it's going to go undetected for like 230 days and
1548580	1552620	a CISO is going to get fired and they're going to be like, oh, my God, it ruined our TDR.
1553140	1559660	Whatever. You've all been warned. Slops to Facebook for making it really hard for me to
1559660	1565360	have a chatbot that abuses their TOS. I really wanted to use Facebook Messenger. There were
1565360	1571400	allegedly people coming here who are from Facebook. Maybe none of you made it because
1571400	1577120	you heard that I wasn't doing it anymore. I don't know. But, yeah, that really sucked and was really
1577120	1582420	frustrating. And slops to my cat, Dasha, who spilled coffee on my keyboard when I was trying
1582420	1589320	to write the malware and cost me like an hour drying out my laptop. That really sucked. So,
1589320	1593980	thank you all for listening to my talk. That's my Twitter and my personal blog. We also have a blog
1593980	1598960	at Netsco. That's it. That's all. You can applaud now. Thank you.
