start	end	text
0	3660	So, soon to be a good afternoon to everyone.
3660	7720	And now it is my absolute pleasure to introduce you to Emilio.
10740	12900	Thank you, thank you.
13160	14660	Let's see, can you hear me?
15280	16060	Good.
16720	20380	Alright, I think, good morning, good afternoon, good evening,
20380	22140	depending on which time zone you are.
22700	24340	Let me start with...
24340	27860	Today I'm going to present a tool called Circo.
29300	31880	So let me first do some introductions.
33180	35220	Hello, that's me.
35740	40300	So, I come from Japan.
40300	42380	I know that I don't look very Japanese yet,
42380	44680	but I've been living there for 10 years.
45040	48240	So, you can call me either way.
48240	52040	It works both ways, Emilio, Emidio, or something like that.
52240	55420	I like to play with networks, packets, and, you know,
55560	57140	a bit of 3D printing as well.
57660	61780	So, I did demo a few tools already in a couple of conferences.
61940	64880	Some of them are in Japan, so you may be aware or not.
65220	68980	And just keep in mind, I'm not a programmer.
69380	71720	So, the code works, it's nice,
71720	74160	and there's a lot of improvement to do.
74220	75700	But it runs.
75700	78960	As long as it runs, it's not good to go.
80040	82480	Alright, for those of you who are not familiar with it,
82480	84180	it's actually the tool itself.
84400	88060	The idea is born, actually, from the automations.
88400	90480	Within enterprise networks,
90480	92700	we have a lot of automation tools.
92700	94680	And those tools actually are just
95400	98400	discovering every new device that connects to the network,
98400	103640	and actually connecting and provisioning and doing a lot of really cool stuff.
103800	108140	Sure, but what about if it's not the Cisco switch that you are connecting to?
108140	111480	They're basically giving us the credentials for free.
111480	113760	Great! That was a good idea, I thought.
113760	119220	So, what came out, actually, was a way to make something camouflage,
119220	122260	which is not going to be noticed,
122260	126360	and put it in there when you do red teaming within meeting rooms,
126360	130640	open space, secretary, those kind of places.
130860	134480	So, I'm looking to find a way to do this.
134600	139140	So, in this release 1.5, what is new is actually,
139140	143040	before releases, I was not able to have an IP phone working,
143040	145960	so I will go and unplug the IP phone and use that cable,
145960	148680	but that's it, the IP phone will be off.
149220	152480	That's something that people will notice, because either it's not working anymore,
152480	154920	and I wasn't very comfortable.
155460	157760	So, a few people pointed out as well,
157760	163440	so this version I managed to remove the phone, but plug the phone back to the box itself,
163760	165380	and it keep working as if nothing.
165380	168500	So, we're going to dig into that.
168680	174720	I did some coding updates, and also add some exfiltration techniques,
174720	179500	and encryption for forensic, cell destroy switches,
179500	182980	integration with Faraguy, and bypass NAC, basically.
183620	187000	A lot of features, basically, between 1.4 to 1.5.
187860	189740	So, who do we target?
189740	192440	Well, pretty much any automation system out there.
192440	196840	These are quite, quite a few known systems.
196840	198680	HPNA is very popular.
199180	201840	Of course, NetMRI as well.
201840	205580	NAC itself is not an automation system for network provisioning,
205580	210260	but what it does is try to prevent things that I'm trying to do, basically.
210260	212720	So, I will get rid of NAC as well.
213360	217260	And, of course, there's always some admin connecting to things,
217260	219360	that trusts and put password everywhere.
220800	223960	This is an example of things that happen with a Raspberry Pi.
224220	227640	You know, some device in the network that nobody noticed,
227640	230380	you've been exfiltrating data in the NSA.
230380	236160	And this is not uncommon, because NAC is very hard to solve all our problems.
236980	239440	So, it did happen.
240640	244560	Okay, so what are my main issues for version 1.5?
244560	248860	Power options. I'm going to put a Raspberry Pi, which I need power, okay?
248860	253460	Battery, PoE. IP phone, when I plug it, that looks suspicious.
254160	257920	Someone told me about, if you find the little enclosure and you open,
257920	261720	you can see the keys, where the box is exfiltrating data,
261720	264620	because it's just an SD card in Linux.
265040	268900	Yes, so I need to add some forensics, prevent forensics on it.
268900	272140	Encryption, basically. Which is a key, always a problem.
273480	277220	Alright, so let's start with the first problem, that is the power.
277220	281500	So, I came up with the paper idea. It's the easiest one.
281500	287060	You just start drawing things and come up with a list of wishes that you want to do.
287660	294080	So, this concept was, okay, the PoE negotiation is very complicated.
294240	297100	And there's many standards and there's many different ways to do it.
297100	298720	Many implementations are different.
298820	302820	But there's one thing, one element, that the phone and the switch,
302820	304660	they will do the negotiation of the power.
304660	307120	How much power you need, how many watts, etc, etc.
307320	309080	So, I didn't want to get into that.
309080	311220	So, I say, okay, let the phone negotiate.
311220	314440	Once that's done, I just hook the power.
314440	321440	So, you come up with an idea that violates every principle in networking, pretty much.
321480	324160	Okay, why not? Let's give it a try.
324220	328800	So, once you have a paper idea, what you tend to do is breakboarding.
328800	330640	Let's do, let's go, come on.
330640	332820	Plug some cables and see what happens.
332820	334480	Something will blow up for sure.
335460	341980	So, you start to build up some ports and this breaks all network industry standards, by the way.
341980	343600	So, trust me on that one.
344440	350480	So, what tend to happen when you start to do this is at some point, without you noticing, this actually works.
350480	353140	And I'm like, okay, this is actually a good thing.
353360	356220	So, now you actually elaborate on it.
356220	358520	So, you move into prototyping.
358860	366240	So, this is a little board for just, because they keep coming out, the jumpers from the breadboard.
366240	369540	So, you say, okay, let's make it a bit more stable.
369540	371320	So, I did a prototype to see.
371320	378420	Basically, it's four RJ45 and a DC to DC converter plus a USB socket.
378420	379960	So, it was a very simple idea.
380560	383040	It's all the wiring, the thing that goes underneath.
383620	386080	So, again, I never designed a PCB.
386100	390720	So, it would be nice to have a Raspberry Hub, maybe, or go into that.
390840	393600	So, I'm still trying to figure out.
393720	395360	So, prototyping is okay.
396360	400540	All right, how Circo evolved between different releases.
400820	405920	So, Circo has around one year old, maybe, around October 2018.
406500	409440	So, it started like an idea in a box.
409440	412260	When I mean in a box, I mean literally in a cardboard box.
413200	417180	It was good because you can see the components and you can see, ah, this is this.
417180	418660	You can even put labels on it.
418660	423220	So, it was quite, yeah, it was fun.
423220	427760	So, what happened here is that I used to use a PoE LAN modules.
428200	429680	And I bought one that you see.
429680	435160	So, basically, what it does is it does the PoE negotiation and then give you the LAN back and the power.
435180	436700	So, I bought one, 12 volts.
436700	438760	Okay, I need to convert this to 5 volts.
438760	440600	And then I figure out they sell the 5 volts.
440640	443920	So, this is the first release, right?
444360	446540	So, then we evolved into a production.
446680	448220	So, I say, okay, let's move on.
448220	451020	So, I got some enclosures.
452200	457020	They look like these boxes that you have under your desk, over your desk.
457080	460020	So, the whole concept is, okay, let's work with what we have in the market.
460020	462980	So, I look for these enclosures to put stuff in it.
465380	470080	So, in this release, I only have, you see, there's only one cable going on.
470100	473780	That's because I unplugged the phone and that's it.
474240	478560	And also, the smaller version, that was a bit more tricky because there's less space.
478560	485300	But you can use Raspberry Pi Zero, which is a bit cool, but you really need to work with space.
485300	487060	Again, this version has only one LAN.
487280	490480	So, you need to work with the LAN adapters on the Raspberry Pi.
490760	492880	Right, so we move to this version.
493040	495680	This version is actually this box.
495900	502060	This box, because, remember, now I'm still in the phone and I'm going to plug back the phone here.
502220	506200	So, what I'm going to do is use two different LAN adapters on the Raspberry Pi.
506200	509740	So, that's the reason I have a USB LAN adapter plus the onboard.
510800	514680	As well, there is on the bottom, you will see a DC-DC converter.
514680	518680	The 48 volts of PoE back to 5 volts to power the Raspberry Pi.
519380	525100	And on the yellow thing that you may see there, that's actually a magnet switch.
525100	529520	It's a 3D print some handles to mount it.
529520	532820	But it's basically a magnet and a tilt magnet switch.
532820	534900	So, what it does, that is the key lock.
534900	537900	When you open the case, it will detect that you open it.
537900	541020	And, you know, you can RMRF, you can do whatever you want.
541060	542180	Reboot, shutdown.
542480	549300	So, this is to prevent forensic, in case some forensic go and don't unplug the cables and just open the suspicious case that they found.
549580	551900	It will blow up, basically, if you want to.
552040	553600	That was a bit dangerous to do.
554240	558380	EPMs, you know, heatups, fire hazards.
558500	559660	So, just be careful.
560360	564360	Of course, the same thing into the smaller box as well.
564400	568620	Here, what I need to do is choose USB LAN adapters and a hub.
568800	571980	So, it gets tricky, but it still fits.
572060	577340	So, depending on what you find in the market, as a discussed box, you can play around.
579560	583060	So, how much does this cost?
583060	585520	Because this must be a really expensive thing.
585520	588720	Well, this is an example of how this box costs, right?
588720	592880	So, to give you an idea, this is a Raspberry Pi Zero.
593720	601600	The two USB LAN adapters, the USB, micro USB hub, are, like, ridiculously small.
601940	605500	And just the outlet, which is one of the things more expensive.
605860	608920	The outlet, I think, is $10 or something.
609020	610720	So, yeah, you can get this for $50.
611060	613360	So, if you don't want to go to pick it up.
613360	615520	So, you do a pen testing, you leave it there.
615720	618180	You are welcome to go and pick it up, or not.
618720	622160	That's how well things finish on the pen testing report, right?
622640	626020	So, you know, just in case you want to lose it.
627300	627940	All right.
627940	630240	So, the hardware is one thing.
630240	631460	It's very simple components.
631460	636600	It's LAN adapters, Raspberry Pi, plastic box, and some DC-DC bucket.
636740	639040	So, now the question is what we are using as a software.
639580	644060	Well, Circo is actually the little box, but we also have a few components.
644060	648700	We have a component called Carpa, which is actually a software component only.
648720	650220	Running on the internet.
650220	651820	In a VPS, Python, and Linux.
651820	653660	That's very simple components.
653860	655160	So, that's software only. Why?
655160	660500	Because once this box is infiltrated into the network, what is it going to do?
660500	662640	Well, it's going to become a Cisco switch.
662820	664120	To get discovered.
664160	668840	So, all these lovely automation systems will connect to me and give me the credential.
668840	671060	So, essentially, it's a honeypot, basically.
671180	673180	But what happens once I have the credentials?
673280	676300	SNMP, TEL, SSH, whatever the user sends to me.
676340	678420	Great, now I need to exfiltrate to the internet.
678720	680000	And this is the tricky part.
680000	682660	Because I need something on the internet to receive it.
682660	685700	And that's where Carpa comes into play.
686120	690800	At the moment, I have a demo here, which I'm running on a Raspberry Pi, Linux.
690800	697140	You can run it anywhere, any VPS on the internet, Amazon, or any VPS server will do.
697340	704740	The only requirement is that you have a domain name assigned to NS records assigned to this public IP of your VPS.
704740	706420	Or NATED, if you have a NATED.
706420	710140	So, and then we have one more component, which is Haula.
710160	712380	Haula is, again, a software component.
712380	716420	You can run it on a Raspberry Pi with a power bank and a wireless adapter.
716420	720100	What it does is, basically, you can also exfiltrate via wireless.
720700	725600	So, it will do from the box itself to the internet, or via wireless.
725600	726860	Or both, if you want to.
726860	729140	But via wireless, of course, you need to be in proximity.
729480	732440	Keep in mind here, we are not setting up any access point.
732440	736700	This is not an access point, because that will be caught by WIPS, right?
737060	740100	So, we don't want any WIPS to notice us.
740540	743520	So, currently it's in Python 2.
744240	746000	Coming to 3 soon.
746000	750460	And it's all packet manipulation are mainly based in Scapi, in Python.
750920	756800	And we are using some other tools from a different combination of people as well.
756800	758920	For example, for the OS Fuller.
758920	764140	Some part of the code of the OS Fuller to full NAC, effectively speaking.
764720	767780	And what actually exfiltration we can use.
767780	775280	We have ping, traceroute, NTP, HTTP, HTTPS, DNS, proxy and wireless.
775460	779460	Of which, all of these are atomic.
779460	781900	Basically, nothing come back, ever.
781900	785420	So, from a firewall point of view, it's a timeout session, HOUT.
785420	789740	So, there's never a session in none of those protocols that I just mentioned.
789740	792000	Or established connection or anything back.
792000	795660	So, basically the Carpa never send anything back to me.
796640	801220	And another new feature that came out is just because I have a phone, right?
801600	803080	And the phones keep working.
803080	805880	I'm basically man in the middle between the phone and the network.
806060	810640	However, most of the offices people connect the phone and the PC to the phone.
810640	816060	So, that automatically give me free traffic from the PC as well.
816120	819580	So, that was a free bug, kind of.
819660	826440	So, effectively speaking, you can run different tools to capture TELNET, SSH, FTP.
826440	832960	So, unencrypted protocols or hashes are exfiltrated as well.
832960	837980	So, not just the network part, but also the PC, if any, connected to it.
839120	841480	So, how I become a Cisco switch?
841480	845060	Well, I need to be able to send a CDP, LLDPs.
846020	849980	I need to be able to have an SNMP server agent basically running.
850100	851800	And TELNET and SSH.
851960	854080	And all my packets need to look like a Cisco switch.
854240	858400	So, that was the triage, basically, of how we come up.
858740	864760	So, for flows, I have a single mode that used to be when you don't connect the phone back.
864760	868640	And the bridge mode, which is the most interesting for this talk.
871080	875220	So, in bridge mode, this is how it will work the logic, right?
875220	884500	So, once this box turns on, what it does is it does the discovery first to see what is the switch that is close to me, the real switch.
884500	885960	And it tries to get the name.
885960	890480	Once it gets the name, it will try to get one similar to itself.
890480	895760	So, if this switch, for example, is switch Tokyo 01, it will become 03.
896520	899080	It will change the last digit by two.
899120	900620	The logic is very simple.
900700	903060	There is always a fallback to test 01.
903460	907500	We need to pretend to be a nice new brand Cisco switch in the network.
907680	910220	So, we want to get that information first.
910220	914420	Then we get an IP address and we start to set it up.
914980	917360	Of course, the MAC address is of the Cisco switch.
917360	918920	We change MAC address at the beginning.
918920	923760	As well, one thing we want to do is to start to advertise CDP and LLDP to the switch.
923760	926940	That's the way we get discovery of the automation tool.
927440	932580	What tends to happen is the existing production switch is already hooked to automation tool.
932580	937660	And when he sees CDP and LLDP new neighborhoods, he will discover that on the system.
937660	942620	And the system, once a day, will connect and try to pull the config, etc., etc.
943180	945320	Basically, give us the credentials.
945320	954500	So, once this happens, once we get the credentials, we can set it up to how often we want to exfiltrate it.
954880	959200	And I will cycle if we want to just do it once or do it every one hour.
959200	962820	The same exfiltration and which method you want, all of them.
963360	971780	So, to do this demo, I actually need to build a network with a proper switch and a firewall and a router and a DHCP and the internet.
971780	976020	So, I used to have all this spread in the desk.
976140	979600	It was very difficult to set it up. You always forget one cable and things don't work.
979960	985760	So, because in Japan we have a Toyota that makes cars, right?
985760	989100	So, it came out with Macaroni.
989100	994300	This is our infrastructure in a box, basically, in a briefcase.
994760	999380	And it only costs 200 bucks. It doesn't cost 20 grand like Toyota.
999380	1002920	But what it does is simplify things very much.
1003320	1007580	And so, the lab itself... I know, everything has an acronym, right?
1007660	1009760	It matches perfectly.
1010040	1012480	So, the lab itself looks like this.
1012700	1016060	It's basically a proper Cisco... you can look it up after if you want to.
1016060	1019860	It's a proper Cisco switch and a CarPi simulated with a Raspberry Pi.
1019860	1025340	I also hooked a Snort in the outside on the internet to see what the Snort will see.
1025340	1030620	This Snort is configured as it comes. In the middle, there's no tuning.
1030640	1032280	So, it's default, basically. All.
1032580	1035580	So, it's supposed to catch even rubbish traffic as well.
1036560	1041280	So, what I'm going to do is explain how the exfiltration technique works.
1042940	1049200	So, for exfiltration, what I'm doing... I need to be able to tell my device in the internet...
1049200	1052460	which... these credentials, who took it from.
1052460	1059780	So, it came from my telnet daemon, my SSH daemon, through SNMP, or even the PC that was hooked.
1059960	1061680	It's an optional work I'm working.
1061760	1066220	Also, I want to know that this is enabled password of the switch, or is the user unpassword of the switch?
1066220	1068360	And is SNMP the community of, basically?
1068420	1073460	This work with SNMP 1, 2, V2 as well. 3, not yet.
1073800	1076760	Nobody used 3, actually, in any network that I'm aware of.
1076760	1086040	So, this is the format and the source IP of the automation tool, or the laptop administrator, or whoever connects to my box.
1086760	1091460	This is specifically the format that we want to exfiltrate.
1091460	1097260	So, one way to exfiltrate this data is, first of all, we will encrypt it with AES-256.
1098040	1102820	So, let me first go into Showtime.
1104280	1106520	Let's start with the demo.
1107980	1109920	Let me see if you can see.
1118320	1120100	Let me close this.
1131790	1133770	I cannot see, though.
1134610	1136350	I cannot see what I'm typing.
1138290	1139730	Let me bring back...
1144570	1145670	Can I mirror?
1157820	1159440	I don't know how to do this.
1172020	1173280	Look better now?
1175490	1176750	Look okay?
1176750	1178370	Yep, right.
1179030	1185410	So, this is my server in the Internet.
1185490	1190930	So, when I run it, this gives me the options of the server.
1191650	1194010	So, this is my snort.
1194170	1196090	This is my administrator PC.
1196090	1198410	And what I need now is my box.
1198890	1203290	I also have this, because this version integrates with Faraday.
1203290	1206590	So, let me log in.
1209840	1212960	So, Faraday, I just have one workspace.
1213440	1215160	And I have hosts.
1215200	1218120	I only have one host with some vulnerabilities.
1218480	1221200	All right, so let me do the magic.
1229240	1232380	I do need to put a magnet, because I opened the lid.
1232940	1267160	I need to hack the lid open.
1267600	1269700	And there's a lot of flashing lights here.
1269800	1271220	That is just a Raspberry Pi.
1271220	1272940	Nothing more interesting than that.
1272940	1279040	So, one thing that I did find out was how to prevent encryption.
1279040	1284200	So, I'm going to use Lux to encrypt the partition, where I'm going to have the software here in case someone finds it.
1284200	1288920	The problem with encryption is to decrypt and decrypt you need a key.
1288980	1292580	So, what happens when you want to do that in a box that is already closed?
1292580	1293740	You go there and put it.
1293740	1299880	You don't have a laptop and installation system to put a keyboard to a Raspberry or whatever.
1299880	1308020	So, what I came up with is I need a long key that I can use quickly to mount and encrypt this Raspberry Pi.
1308140	1311180	So, I found that this Raspberry Pi has Bluetooth.
1311300	1312260	Great.
1312320	1316380	So, I created a million of applications.
1316380	1319300	There's a Bluetooth application that you can create the services.
1319300	1321460	You can do it from Linux as well.
1321460	1325260	So, what I'm doing is I'm creating a service called Circo.
1325260	1329860	And it has the UUID, which is 128 bits.
1330320	1332720	So, guess what? That's my key.
1333340	1337660	So, what this guy is doing, once he boot up, at the moment it's in demo mode.
1337660	1340340	So, I should be able to access.
1342020	1352400	So, if I do the F, the home drive I want to do is called PEncrypt.
1352420	1357040	So, if I do, there's nothing because it's not mounted, right?
1357080	1359840	So, what I'm going to do is turn on these Bluetooth services.
1360820	1363400	It's a demo key, in case you are sniffing Bluetooth.
1364740	1366760	It's not for production use, right?
1367360	1372960	So, once I turn on, it runs every 5 seconds, I think I put it at 10 seconds.
1373260	1376520	What it does, basically, is it's scanning to see if it found the services.
1376520	1379580	And use that key to mount and decrypt looks.
1380540	1383680	So, ideally this is all automatically, actually.
1385360	1389860	Let me see, I think it's 10 seconds every...
1389860	1391260	I don't remember where I put it.
1391900	1394480	So, I create the services.
1405050	1405850	System.
1407870	1408670	Looks.
1410050	1413350	Yeah, I create a little script, basically, to do that.
1417450	1418790	Let me see, this is on.
1420250	1421790	Or maybe I have Bluetooth.
1422610	1423850	I will explain.
1425170	1426530	There we go.
1432970	1434890	Now it's jamming Bluetooth, right?
1437450	1438790	Yeah, there you go.
1443970	1445670	This is what happens with live demos.
1447090	1448170	Come on.
1459860	1461160	It did work before.
1466540	1467460	Yes.
1468480	1469900	Let me stop start.
1474950	1476330	And let me do start.
1497130	1498790	I think it's my phone, actually.
1518110	1519030	Alright.
1519030	1520270	Let's see.
1556440	1557400	Alright.
1561000	1562860	Let me do this manually.
1570240	1571700	Let me create this.
1579980	1581460	Oh, it did work.
1581860	1583600	Oh, it was already mounted.
1585200	1585900	Yeah.
1587360	1591200	Playing with Bluetooth within DEF CON sometimes is not a good idea.
1591500	1593720	So, let me turn this back off.
1594320	1596020	Alright, it's already mounted.
1596020	1597520	So, let me go to...
1597520	1600980	This normally will start automatically, but...
1600980	1601700	So...
1602720	1603520	Oops.
1603800	1605520	So, I'll just give you the menu.
1605520	1610640	So, I have Carpa, which is the one in the Internet to receive the credentials, which I'm going to start in Verbose mode.
1610740	1613300	And the plugin is a Faraday plugin.
1614120	1615880	And the interface is here.
1615880	1620100	And just a file where you want to put the output, the credentials you find.
1621800	1623580	So, this is the Circo interface.
1623580	1627120	So, what you do, first of all, we go into Bridge mode, where I put Verbose.
1627520	1631700	We go into Bridge mode, because it's the one using the phone and the LAN at the same time.
1631700	1635520	Still have backward compatibility, because that's a good way to do things.
1635900	1638740	And then we can choose what exfiltration technique we want.
1638740	1640680	You can choose either all, or...
1640680	1650280	Can you ping DNS, HTTP, web, NTP, proxy...
1650280	1651080	I don't know.
1651780	1654320	I couldn't put minus A, actually.
1654540	1655980	So, when you start it...
1655980	1658840	Let me see. This one already started. I'm logging into Faraday. OK.
1660740	1663520	Plugin to Faraday, what it does, basically, is...
1663520	1666900	Every credential that he gets, he will inject it into Faraday directly.
1667220	1669200	So, when the Circo starts, it's in Verbose mode.
1669200	1671620	That's the reason you see all the steps of what it's doing.
1671920	1674700	So, it starts becoming a Cisco MAC address switch.
1674700	1676060	This is to bypass NAC.
1676060	1679040	Due to the MAC address I'm using, it's a golden one.
1679220	1680480	So, if you read through NAC...
1680480	1684120	For Cloud NAC manual, there's a very small syntax that says...
1684120	1686360	If you use this MAC address, you are always allowed.
1687380	1689580	Just read the document. It should be fine, right?
1689580	1691360	Guess what? That's what I'm using.
1692500	1694280	Great. Thank you for the manual.
1695060	1696120	So, it becomes a...
1697720	1699040	Can you read, right?
1699440	1700020	Yes?
1700560	1701880	Do you know how we can make it bigger?
1703620	1704680	That's too big?
1704920	1705520	Better?
1707380	1709200	So, what it does is...
1709200	1712460	It becomes a MAC address switch.
1712460	1713240	Discover.
1713240	1714180	Start the ACP.
1714360	1716840	This is all the configuration proxy.
1717020	1718380	The proxy...
1718380	1720640	I have three different techniques for the proxy.
1720640	1721720	We'll go into details.
1721720	1723420	This one is using the ACP.
1723820	1726160	And then, from here onwards...
1726160	1728880	It becomes a honeypot.
1728980	1729520	Right?
1729520	1732640	The last line you see is because the magnet I put there.
1732640	1734960	The lid is open, but I put a magnet manually.
1735260	1737940	So, if I take that magnet out, things will go crazy.
1738660	1740260	So, now...
1740680	1742880	I'm going to go to the real switch.
1742900	1744180	This is my...
1744920	1746200	Real switch.
1746920	1747720	Right?
1750220	1751940	This is Tokyo 01.
1751940	1753400	It's my real switch.
1753400	1756020	If I don't show CDP, neighbors...
1756020	1757020	Guess what?
1757020	1758400	I see a phone.
1758600	1760960	I also see a switch called 03.
1760960	1762460	It's a 2960.
1763000	1765060	You can choose details.
1765780	1767600	And this is...
1767600	1768560	This is an IP address.
1768560	1769880	This is a version.
1769900	1770900	The port.
1771220	1771860	The soft...
1771860	1773120	It's a Cisco switch.
1773140	1776380	So, I can see show CDP and show LLDP.
1776380	1778140	As well, I can see LLDP.
1778240	1780240	So, this switch, believe, is connect...
1780240	1782240	Someone connected a new switch.
1782240	1785260	Maybe in a meeting room, for a training or something.
1785800	1787560	So, it does have an IP address.
1787560	1788800	Which is 151.
1788900	1789780	Right?
1789980	1792380	So, this is my admin PC.
1792380	1794700	What happens if I tell it that IP address?
1798400	1799320	Okay.
1799320	1800600	So, I type my...
1801800	1802920	Superuser.
1804820	1806720	And switch number 3.
1806720	1807240	So, now...
1807240	1809720	What I believe is a switch.
1809780	1811020	I can run commands.
1811020	1811740	Cisco commands.
1811740	1812500	Show version.
1812500	1814060	Yep, it's a 2960.
1814060	1815700	This is the version running.
1815700	1817580	Show IP route.
1817580	1819440	Show IP app.
1819440	1820840	Show MAC address.
1820840	1822880	Show interface description.
1823020	1824560	It is a Cisco switch.
1824560	1825820	Well, I believe it.
1826580	1827760	Show CDP.
1827760	1828600	Neighbors.
1829340	1830760	I need to type it correctly.
1830760	1832240	Of course, it is a Cisco switch.
1832720	1835160	Yeah, I can see now Cisco switch 1.
1835160	1836040	The production one.
1836040	1838900	So, they see each other in theory.
1839120	1841480	Same with show LLDP.
1842040	1842940	Neighbors.
1842940	1844040	Yeah, I can see.
1844040	1845060	So, from this switch...
1845060	1848860	So, when automation systems connect to this switch, either by telnet or SSH,
1848860	1850560	with the master credentials,
1850560	1854480	they will run a set of commands to get the configuration, inventory, etc, etc.
1854480	1857300	So, those are most of the commands that support.
1857300	1861120	I did not code the whole iOS simulator just for fun.
1861360	1862540	It wasn't fun.
1863880	1864560	Yeah.
1864720	1867220	The question mark also worked, by the way.
1868460	1868960	Yeah.
1868960	1873540	Oh, and if you want to go to show run, of course, you need to be enable mode.
1873540	1874900	Okay, go enable.
1875240	1876440	Yeah, sure.
1876880	1878500	Great. Secret.
1879100	1880580	Now, I can do show run.
1880720	1881740	Yeah, that worked.
1881740	1883720	What I can't do is config.
1883800	1885100	No, that doesn't work.
1885100	1890080	That's a common stack errors because I'm not going to prepare an iOS, basically.
1890080	1890640	Right?
1891200	1893200	So, this was a tenant I did.
1893200	1893860	Right?
1893980	1897440	So, you can see in the configuration that the community is public.
1897440	1898680	The SNMP community.
1898680	1903960	Now, what tend to happen is automation system will first try their own SNMP community.
1903960	1905980	And if fail, it will try the public.
1905980	1907900	You know, one of the least of the common ones.
1908040	1913200	So, let's say I will try the system community.
1913200	1914760	The one that they use in the company.
1914760	1915320	Right?
1916180	1918880	So, when I try that, that will not work.
1918980	1921200	A, because it's public, the one that works.
1921400	1926280	But, you did already give in the community with that command.
1926280	1927980	So, when you do public...
1930400	1932660	It has reply like a Cisco switch.
1932660	1935780	It is actually a name, the uptime, the version.
1935780	1938600	It is a full SNMP device that you can pull.
1938600	1942160	Now, what happened when I went back to Carpa?
1942720	1945500	Well, I start to receive this data.
1945520	1947060	This is because it's verbose.
1947060	1952620	So, basically tell me that something via ping from this public IP,
1953560	1958820	telnet, usernetadmin, password Defcon, very smart,
1958820	1961000	from this source IP they connect,
1961000	1964900	which is internal IP of this administrator laptop automation system.
1964900	1970040	And then I get the same password via ping DNS, traceroute.
1970040	1972140	PDNS is proxy, by the way.
1972140	1979620	HTTP, NTP, and then I also get this via here.
1979620	1983460	So, oops, someone connect telnet enable,
1983460	1988000	the E just standby enable with this super secret password.
1988000	1994660	So, again, if I now do the same thing, let me open the...
1995800	1999500	So, this is what this LPS is looking.
1999880	2003020	Ignore the unreachable because I don't have internet connection, of course.
2003020	2005900	But the only traffic that these guys can see,
2005900	2009580	because I enable the default, is a ping.
2009620	2012440	So, a Cisco switch is sending a packet ping.
2012440	2014680	Nothing come back, but that's only alarm.
2014680	2019620	Which I don't know anyone that has a snort with IC ping configured for alarms.
2020700	2023080	That would be quite a lot of alarms.
2023280	2025420	That's the only thing you can see on the snort side.
2026180	2030460	So, again, when you see a P on the community,
2030460	2033800	deleting the switch, my switch did not reply to the community,
2033800	2035260	but you did give it to me.
2035480	2038360	It did reply to public, but not to the community you give me,
2038360	2040020	but I exfiltrate it.
2040340	2044600	So, now if I go to Faraday, right?
2044600	2047920	So, when I do a host, when I do refresh,
2047920	2050340	now I have a new extra host.
2050340	2056560	This 10.10.10.88 is the source IP of the automation tool or administrator,
2056560	2058020	then whoever is connecting.
2058560	2060560	So, what happen is if I go to the credentials,
2061480	2064360	I can see the target, I can see the protocol,
2064360	2067340	this comes with Telnet, the enabler, and the password.
2067340	2070080	This is Telnet, the username, and the password.
2070180	2072360	And this is SNMP.
2072400	2074320	I should put SNMP instead of P.
2074620	2079320	But, so now, as soon as I get them in Carpa,
2079320	2082860	via an API, I can inject it in Faraday in real time.
2083040	2086220	So, that's for helping the pen testing report side.
2087140	2090860	So, now, what happen if I actually remove the magnet?
2091300	2091940	You know?
2093440	2094320	Careful.
2097590	2102030	So, you start to see this alarm, alarm open, alarm open.
2102170	2104770	That means that the, because I did not unplug it, right?
2104770	2106570	I removed the magnet.
2107050	2110710	So, what it does is when it detect that someone opened the case,
2110710	2116090	the magnet get open, it will send a magic packet via exfiltration,
2116090	2117730	saying that someone opened it.
2117730	2122210	So, you know, maybe it's time to make the report.
2123450	2128050	So, of course, you can make it, if you go here, for example,
2128050	2130450	this was the circle running in debug mode, right?
2130450	2132530	So, you see that it's sending the credentials.
2133030	2136210	And here is when I took the magnet off, right?
2136290	2137910	You can do this, for example.
2137910	2141870	That command, what it does is immediately reboot.
2142790	2146090	So, what it does, remember, because we have the Bluetooth encryption.
2146550	2150470	So, unless I'm back close to this box with this thing enabled,
2150470	2151970	that will not work if you reboot.
2152210	2154590	So, if someone unplugged it and replugged it,
2154590	2156030	it will not mount encryption.
2156030	2161110	So, that is a balance between having encryption and functionality.
2161450	2164470	So, if you want encryption, you want the Bluetooth, sure.
2164470	2167090	But if someone by mistake unplugged and replugged it,
2167090	2168290	it will not work again.
2168390	2171810	You need to be back, walking around with your mobile in your pocket, right?
2172690	2174190	So, yeah, you can do whatever you want.
2174190	2178390	You can, you know, PGM pulls, I don't know, burn, fires,
2178390	2179650	whatever you like there.
2180750	2184070	So, this is the way that this stuff works.
2184110	2185530	So, these are the components.
2185630	2188450	So, let me go deep into the exfiltration.
2194340	2195820	Something's in the middle, right?
2197660	2198720	Excuse me.
2198720	2199860	There you go.
2200700	2201700	Go away.
2208770	2210350	Alright, so how I do...
2210350	2212210	So, this is basically a nice honeypot.
2212210	2213770	Now, how do I take the data out?
2213770	2215590	That's an interesting point.
2215670	2218810	So, this is going back to basics.
2218810	2221630	So, we are using protocols that are through firewalls.
2221630	2225390	Some of them are blocking the company, some of them can't go through.
2225390	2229730	So, for example, some companies do allow ping to go for troubleshooting or traceroute.
2229890	2232430	So, these are the protocols I'm using.
2232430	2240770	ICMP, I'm using specific TCP and IP and UDP packets fields to actually put my data.
2240770	2242450	Remember, I have one line.
2242450	2247490	It's a T, dash, comma, username, comma, password, comma, and IP address.
2247490	2255610	That, what I do is encrypt it, AS256, and now chunk it in 2 bytes or 6 bytes.
2255610	2263630	So, the way to work encryption, basically to decrypt it, you need to tell me how many packets I should expect, how long should my crypto be.
2263630	2269830	So, I'm going to send you 13 bytes of crypto in 7 packets, 2 bytes each.
2269870	2274190	So, first of all, I need to be able to tell that in advance before sending the packets.
2274190	2277450	So, what I'm doing is, I'm sending one packet.
2278050	2280290	These are the IP header.
2280290	2282930	There's a field called identification in IP packets.
2282930	2285590	That does not get changed by NAT.
2285590	2288810	When you NAT through a firewall, that doesn't get changed.
2289030	2291810	So, okay, it's 2 bytes that I can use for something.
2292770	2293910	ICMP packets.
2293910	2298050	Within the ICMP packet, you also have identification and sequence numbers.
2298050	2301270	Again, 2 and 2 bytes that I can use for something.
2302030	2304230	So, ICMP, how it works?
2304230	2308250	Basically, I need to tell you my 13 bytes and 7 packets.
2308250	2315150	So, I will send one packet saying that 213 is the IP ID, right?
2315150	2317030	And the rest is just randoms.
2317030	2321070	So, that means that the receiver knows that it's expecting 13 bytes, right?
2321070	2325610	Then I'm going to send you 307 as the IP ID.
2325630	2329650	300 means that actually you're expecting 7 packets, right?
2329650	2332330	And then I will send you 7 packets, right?
2332330	2336510	With the 500, 1, 500, 2 as a sequence ID.
2336510	2340390	That is a sequence of a packet, in case they get a different order.
2340490	2345630	And the crypto, within the ICMP sequence, which is 2 bytes,
2345630	2348770	I will get that to become an integer, and that will be my crypto.
2348770	2351550	So, I need 7 packets to do 13 bytes.
2351610	2354450	Plus padding, right? One byte of padding.
2354710	2358790	So, this is the way that most of the exfiltration technique works.
2358790	2365090	It's basically chunking data into specific fields within different protocols.
2365090	2367350	Like ping, for example, or traceroute.
2367770	2370650	Traceroute, we are using the data payload.
2370690	2374470	The Cisco switch, the last 4 bytes are rubbish.
2374530	2377410	So, we are using those 4 bytes with X.
2377410	2379330	My encrypted data becomes X.
2379330	2380630	So, I encode it into X.
2380630	2383170	It looks like an hexadecimal string.
2383190	2385770	So, that's a good place to put 4 bytes.
2386690	2388210	Again, similar concept.
2388210	2391750	First, I need to tell you I'm sending 30 bytes and 7 packets,
2391750	2393290	and then I send it one by one.
2393330	2396610	Now, if we move into HTTP or HTTPS,
2396610	2398610	remember, I'm not making a session.
2398610	2401530	I'm just merely sending the same packet.
2401890	2402810	That's it.
2402850	2405770	So, there's something called window size in TCP,
2406450	2409550	and do not change between the client and the server.
2409550	2412570	Do not. So, you have not, and that thing doesn't change.
2412570	2413570	Again, great.
2413570	2416950	So, I have 1, 2 bytes that I can use that does not change
2416950	2420230	between an internal client and an internet server.
2420430	2421750	So, that's what I'm using.
2421910	2425470	Similar concept, I'm using the sending 213,
2426230	2428430	like we saw in ISMP,
2428430	2432510	but I'm putting the crypto within the window size of the TCP packet.
2432510	2437530	So, yeah, port 80, 443, or any port you like, 25 if you want to.
2437550	2441590	But remember, most of the stuff probably don't have direct access to the internet.
2441590	2444810	So, those exfiltration may not work.
2446110	2450570	HTTP, HTTPS, actually any TCP port will be the same concept on this, right?
2450570	2453490	You just send the SYN, nothing comes back,
2453490	2456330	and the crypto goes into the window size.
2456390	2457790	Of course, I become an integer, right?
2457790	2459430	It's just supposed to be a number.
2459570	2461570	So, from X, I convert it into an integer.
2461710	2464290	And the whole process is in reverse on the other side.
2464290	2467910	In the CARPA, it's the other side receiving, it's the whole thing the other way around.
2469470	2470750	So, NTP.
2470750	2472190	So, NTP was a bit fun.
2472370	2476690	There's something called transmission timestamp, right?
2476690	2479370	So, the transmission timestamp has this format.
2479770	2483750	So, it's basically a timestamp plus a fraction.
2483890	2487670	And the timestamp is 32 bits, and the fraction is 32 bits.
2487670	2491530	Wait a minute, that's a lot of data I can put there into 32 bits.
2491690	2493830	So, I'm using the fraction.
2493830	2499630	So, basically the way that works is I'm using, I'm playing with the stratum and pole
2499630	2505050	to tell them, again, my crypto is 13 bytes, and it will send 7 packets or 6 packets
2505050	2506970	or whatever is the padding that I need to do.
2506970	2508890	In this case, I can send 4 bytes.
2508890	2511730	So, in reality, I don't need 7 packets because it's 13 bytes.
2511730	2513610	So, maybe 4 packets will do.
2513970	2517350	So, I need to tell them it's 4 packets for this protocol specifically.
2517770	2522810	And then I put it in the fraction, convert it into an integer,
2522810	2525710	so actually it's a float because it's 32 bits.
2525830	2527730	And then the process is the other way.
2527730	2534650	So, inside the NTP query, I'm putting the fraction timestamp of the transmission timestamp,
2534650	2536370	32 bits of it.
2536750	2538690	DNS packet, this one is easy.
2538690	2544250	It just uses subdomain, encrypted.mydomain.com.
2544250	2547030	But I'm not sending a query to the internet.
2547030	2551810	I'm sending an NS query to the actually internal DNS on the company.
2551810	2554030	So, this attack is not direct.
2554650	2556890	So, I don't have access to go outside.
2556990	2563470	But the DNS server has internet resolution through a relay or direct maybe.
2563570	2566390	So, what tends to happen when you do an NS query,
2566390	2568950	what it does, it will do a recursion until you get it.
2569010	2572530	Assuming your DNS actually has internet resolution.
2572790	2575610	Again, this is a hash encrypted.
2575610	2579490	It's 20 bytes, 13 bytes we talk, so it's not a very long chart.
2579490	2583530	Uh, you send it one, one query.
2583530	2585410	Here is, you don't need multiple.
2585810	2588670	So, in this case it's the flow of the thing.
2588670	2591650	You will send just to the DNS server, internal DNS server,
2591650	2593830	and the DNS server will go just directly to the...
2593830	2597370	The trick here is that NS server should be CARPA,
2597370	2601390	the IP address, the public IP of course of that evil domain that you're using.
2601510	2605770	Now, what happen when the company do not have DNS resolution as well?
2605770	2608810	You know, no access to internet in any protocol,
2608810	2611830	no DNS resolution, external DNS resolution.
2612210	2613610	All right, proxy.
2613770	2615010	They might have something.
2615510	2618650	So, proxy works in a way, how you discover proxy?
2618790	2621430	Well, through how you set up in PC's proxy.
2621430	2624730	DHCP option 252, WAP, or GPO.
2624730	2628750	This is the three main, or manually, but I don't think people do that anymore.
2629510	2631450	Those are the three most common.
2631450	2634530	Okay, so what I do for DHCP, I will do a DHCP inform
2634530	2639010	to actually the DHCP server to see if that option 252 is there
2639340	2640770	and get the pack file.
2640770	2643150	Now, what you get is actually a pack file server, right?
2643150	2645910	URL. Get there, connect, get the pack file,
2645910	2648570	parse it to get the proxy IP and port,
2648570	2651070	then connect to the proxy, right?
2651090	2654430	And of course, all proxies are most likely authenticated.
2654650	2655610	Doesn't matter.
2655610	2658430	This doesn't need authenticate to the proxy to work.
2658510	2661310	So, this is a bit tricky because this unfortunately works
2661310	2666290	with all Bluecoats, McAfees, all the high-end proxies.
2666490	2669130	Because they forgot about something.
2669130	2672110	When I do a simple telnet to a proxy,
2672110	2678510	and I do a get http, my crypto.mydomain,
2678510	2681750	and of course, I do enter, enter, and I get a 403, right?
2681750	2682890	From the proxy.
2683150	2688130	However, the proxy will generate the log in the system
2688130	2691010	saying this IP address tried to go to this URL
2691310	2692790	and he got a 403.
2693050	2695450	But a proxy does one more thing.
2695690	2700390	He does an NSQuery of that URL to put in the log, the IP.
2700590	2701810	Which there's no IP.
2701810	2706170	But what that means is he, which has DNS resolution,
2706170	2709950	now is querying my DNS server with a string that I want to send.
2710650	2711310	So, he's...
2712310	2714870	Okay, thank you. That will do.
2715510	2719610	So, yes, it does generate one entry of 403 in a proxy logs.
2719610	2722030	You know how many of those you get in a proxy constantly?
2722990	2723830	Millions.
2724090	2725510	So, yeah, great.
2725510	2728190	That works if we have DHCP 0.252.
2728790	2732530	Okay, sometimes you have WAP, if you still have WAP.
2733010	2736290	Similar concept, I just will look for the WAP DNS entry,
2736290	2739870	connect to the pack file, get the proxy, and do all over again.
2740070	2743750	But again, no DHCP, no WAP, so most likely GPO.
2743950	2746470	So, the last thing I can do is DNS guessing.
2746470	2751070	Basically, you're given a array of names, like keywords,
2751070	2757570	internet, or gateway, or GW, or PRX, or proxy, or gateway something.
2757570	2762510	So, you do that list of 10, 15 words, and I will generate a dictionary
2762510	2766450	with a dash, with an underscore, backward and forward.
2767110	2767990	A matrix.
2767990	2771370	And I will generate a list of 12, we'll say maybe 280.
2771590	2776350	And then I will try, with a DNS internal, which one actually replied back to me.
2776470	2780130	Then I will test, is this a proxy, a pack file server?
2780150	2782270	So, I will try to connect and try to get a pack file.
2782390	2786450	Could be something else. If it doesn't work, I will keep trying until I see something.
2786630	2789210	So, this is the way to go around the GPO.
2789210	2792350	Because GPOs, you need to have access to a Windows to actually see them.
2792350	2796350	They're not in, it's per profile basically, so you can't really sniff it out of the network.
2797610	2799670	And the last thing is the wireless.
2799890	2804310	For wireless infiltration, remember I said I'm not setting up a wireless access point?
2804310	2805870	I'm using beacons.
2805870	2809930	Very short beacons of 500 milliseconds.
2810170	2818150	So, what I'm doing is, within the beacons, I'm using the SSID names of the wireless at home and in many places.
2818150	2820410	Normally tend to have like an X address.
2820410	2825910	The last six digits of the MAC address of that home router is on the name of the wireless SSID.
2825970	2828770	So, I'm taking the opportunity to mirror that.
2828770	2833950	I'm broadcasting my standard MAC address, part of my crypto.
2834310	2837250	Again, I have a 13 byte, I will chop it in three.
2837250	2838990	I will have six, six, and one.
2838990	2840250	We'll get padding.
2840250	2846270	And then broadcast for 500 milliseconds that SSID of each of the three.
2846350	2853190	And the receiver will be looking for, it's like a phone broadcasting SSIDs for a very short time of period.
2853190	2855350	So, that's the reason WIPs will not see it.
2855590	2861530	Basically, I'm using beacons as a back channel to push data out for credentials.
2864690	2866610	And that's it.
2873790	2874670	Questions?
2879080	2879940	Oh, no.
2883870	2885730	Can you defeat MACSEC?
2886490	2889010	The thing is, when you connect the switch, right?
2889250	2891690	What you have is actually a phone connected to the switch.
2892010	2898050	So, most NAC systems, so if you like, you want to have a network with one MAC address allowed only.
2898190	2902190	Well, most of the company has a phone, the phone tend to have a PC after.
2902190	2903710	So, you need at least two.
2904090	2905210	Minimum, right?
2905210	2910370	So, because you are putting a Cisco switch and the MAC address that...
2910830	2911830	Raspberry Pi.
2911830	2914970	The MAC address I'm using is actually a golden MAC.
2915030	2916790	NAC cannot block that one.
2916790	2919270	Because the trick is very simple.
2919270	2923650	There's a MAC address for virtual, like, HSRP or VRRP services.
2923710	2927250	Cisco HSRP is a routing gateway, right?
2927250	2930270	So, what it does is, they have virtual MAC address that they create.
2930270	2934590	Those virtual MAC address are whitelisted by default in all NACs.
2934770	2936350	Based on the documentation.
2936770	2938410	I did not write it.
2938490	2940030	So, I'm using one of those.
2946650	2947810	Any other question?
2951000	2952100	Yeah? Where?
2955550	2956390	This one?
2957210	2958050	Ah, sorry.
2960510	2963830	Yeah, I will release the version after DEF CON.
2963830	2965210	No time over DEF CON.
2965210	2966190	It's procrastination.
2966190	2969830	I will push it out to GitHub, the newest version.
2969990	2974330	And the guide for the building is quite straightforward.
2974410	2977030	It doesn't require electronics to do that.
2977030	2979010	Just Raspberry Pi and a few things.
2979970	2983630	And the presentation, I believe, the slides will be up soon.
2983630	2985410	We put it in the website as well.
2985490	2987130	There's a website somewhere? Yeah.
2992780	2994340	There's stickers on the back.
2994340	2995740	If someone wants stickers.
2996500	2997760	If not, let me know.
2997760	2999000	I still have some stickers.
3000440	3004060	If no more questions, thank you very much for listening.
