start	end	text
0	30680	Good morning and welcome back. We're here with live CTF day 2. I'm Mark. I'm Josh.
30680	39480	And we're bringing to you the first of day 2 here. We've got two matches, head-to-head going on behind this wall.
39480	45640	Speed match. We're looking at... we're going to have Undefined versus BlueWater on screen.
45640	50260	And then we're going to have... SuperDiceCode versus NorseCode off screen.
50260	54380	Now we're in the lower bracket here. Sorry to cut you off. But we're in lower bracket here.
54380	58420	So a team that loses this is out. They're out of the entire bracket.
58420	63380	Yeah, a lot of pressure is on. But we've got a good challenge cooked up for them and I think we're ready to start.
63460	69700	I think we're good to go, except our production team has now turned into ghosts or are hiding.
69700	72860	But we're good to go. We're good to go, so let's count it down. Yeah, together.
73480	78640	5, 4, 3, 2, 1. Let's go.
78640	83640	All right, and bear with us here as we figure out...
87640	91900	There we go. All right, and so we're watching Undefined first.
92320	93780	All right, Undefined.
93780	104680	And so this challenge is called Jammer. And this is a special one because it's another throwback challenge to a time when things were a bit simpler, you know?
104680	106060	Ah, better times.
106060	110600	Yeah, really the golden age for vulnerabilities. But this is a stack buffer overflow.
110840	112520	First Ghidra.
113480	121480	Yeah, I think someone noted in the comments yesterday that it was 7 out of 8 teams that they watched had Ida and one Ghidra user.
121480	124000	So I really like to see the variety.
124000	130240	Yeah, we're starting off with Ida versus Ghidra battle of the second and third best reverse engineering tools.
130240	135340	Yeah, you know, I'm a Binary Ninja fan myself, but...
135840	137540	I'm a Binary Ninja dev myself.
137540	141640	People use what they're used to and they're definitely all going to be...
141640	144700	Absolutely. The best tool is the one you can use effectively.
144700	148240	Exactly. And people do get really good at using their favorite.
148620	149740	So let's...
149740	153920	So, okay, we see again two different approaches here.
153920	157680	We see Undefined going with...
157680	159320	That's us.
160140	161660	Team 2 overlay.
165150	167390	All right, so we see Undefined.
167390	173430	They started out a little bit doing, whatchamacallit, dynamic analysis.
173430	176210	Just interacting with the program, seeing what it looks like.
176210	181390	And now they're hopping back into Ghidra, trying to figure out where interaction starts, where they can go.
181690	183190	What is this challenge?
183190	184430	You wrote this challenge.
184790	186670	Right, well, yes, I did.
186730	189270	And this is, as I said, a throwback challenge.
189270	195170	This is a challenge that was originally written for the DARPA Cyber Grand Challenge in 2016.
195170	195610	Really?
195610	199210	Yes, so it's a rematch of a rematch challenge, really.
199330	199570	Nice.
199570	202990	So shout out to Debbie Nuttall, who was the original author of the challenge.
202990	206790	And I lightly modified it so it would fit for our scope here.
207670	213530	But it is a throwback to a bug from 2002.
213530	215870	If you remember the sequel, Slammer Worm?
216350	217430	Slammer Worm?
217430	219170	No, I don't think I was around for that one.
219170	226770	Yeah, yeah, so early in 2003 is when sequel Slammer was taken over the internet.
226770	231310	And so this is a stack-based buffer overflow, a classic stir copy.
231310	235350	And so I think here what we're really going to be looking for is how fast can they find that?
235610	238510	Slammer Jammer, I just got the, I like it.
238970	240590	We're very clever here.
241170	243230	So I was the one that verified this challenge.
243230	249990	So I can say going from zero knowledge to a full solution on this challenge, it was pretty clean.
249990	257410	You know, you figure an interaction flow with the program, and then you start building an idea of what to do, I want to say.
257410	259410	Like, you're not lost in the sauce.
259410	263130	Yeah, yeah, and it is, you know, a simplified challenge.
263130	269390	The DARPA Cyber Grand Challenge was built to be, these challenges were built to be analyzed by automated competitors,
269390	277630	which I think is funny because it's like the biggest data set ever produced to be looked at by machines, right?
277730	282670	And so let's see how fast our competitors can figure this one out.
282670	291260	So let's switch over and look at Blue Water here.
294150	300350	All right, so they're going through, now this binary isn't stripped, is it?
300350	301190	No.
301190	303750	Okay, so they have some symbols to work with in the beginning.
303990	306430	So they're going through, they're annotating different structs.
306850	314070	And they're kind of figuring out, okay, so they're building a struct just called instance, and I think that's returned by create instance.
314110	319390	So the names of these functions really do help you out with your first initial look around.
319930	327270	Yeah, and so what's interesting with this is that we're actually seeing both competitors digging into the structs right away.
327270	335950	And this is an interesting one because there's a decent bit here, but actually the vulnerability itself doesn't require any knowledge of the structure.
335950	337530	Really? Oh, you're right.
337530	339770	It's just a stack-based str copy.
339770	342450	So a classic bug, very simple.
342450	346610	And really the challenge here, because it's a speed race, is who can find it and exploit it faster?
346610	349330	So this is kind of a reverse engineering pwn challenge.
349330	353870	Like you need to find the right area first, obviously recognize the bug.
353870	359210	But then popping a shell after that is, these guys should be used to it.
359210	368490	Right, right. And so that's one of the things that I enjoy about this challenge in particular with the speed challenges is you just have to win first.
368490	378650	And so one strategy, which I'm not seeing either competitor do, is to look at the key functions that might be the fast win functions.
378650	383410	So you can see a reference on BlueWater's screen here.
383410	386610	On the left-hand side you see the list of imports and you see str copy there.
386690	389130	And str copy can be innocuous.
389270	391650	Yeah, but do you see a stern copy and a str copy?
391650	395310	I kind of raised an eyebrow at that and I'm like, the author left this in.
395510	401050	That's true. And especially whenever you're dealing with strings in C code, you have to be careful.
401050	405210	And so you want to, it's always reasonable to take a quick peek at those and see where it gets used.
405210	408710	Oh, yeah. For as much flack as I give Go, they do strings better.
409890	412270	I think C sets a pretty low bar.
412450	413690	Yeah, maybe.
414630	418610	What are you talking about? I'll never bash fgets.
419930	426470	You know, as a friend of mine likes to say, no, I love C. I like bugs and I don't want it to go away.
426470	428150	Yeah, I love C. I love my job.
430190	432170	All right, so we see...
432170	433710	Let's flip over here.
433710	436870	Nope. Just hit this one right here.
437330	438190	Just this.
438910	441970	Yeah, no, we have a fancy new stream set up for day two.
441970	447670	Jordan was here late and early setting stuff up, moving stuff around, so we have no idea what we're working with anymore.
447670	448610	Thank you.
448610	452650	I have to say it's very impressive and I'm very bad at using it so far, but we'll get there.
452650	455850	It's the first match of the day. We're how many minutes in?
455850	456070	Yeah.
456070	456890	A couple.
457170	462970	So as our competitors are digging into it here, they're doing the standard reverse engineering.
462970	465330	Do you want to take a look at the bracket and sort of...
466010	468590	Yeah, we can talk about the bracket, what we're going to see today.
468590	469130	Yeah.
472500	477440	So we've got, as you can see, it's a double elimination bracket.
477440	480660	And so this was a number one feedback from last year, right?
480660	484220	Oh, absolutely. Teams were upset that they got a challenge they weren't familiar with.
484220	488120	We didn't tell them the categories last year either, which was an oversight on our part.
488260	490580	But you were out after one match last year.
490580	494420	And that was absolutely... we got feedback saying this is absolutely not what we want to do.
494420	496500	That's so unfair and stressful.
496500	501400	So it's a double elimination bracket this year, which means a lot more work for us, but a lot more fair for the teams.
501400	503660	And honestly, that's a good tradeoff as far as we're concerned.
503660	509160	Yeah, it's really good to see that because you can be really, really good.
509240	516700	And as we said, sometimes you just notice something that your competitor doesn't and that can get you ahead real fast.
517000	517560	Absolutely.
517560	523240	And all these players are good, so we do want to see the best player come out on top.
526500	529460	So switching over to Undefined.
531080	532740	Let's see, what are they doing?
532740	534820	Oh, that's... see, I don't use Ghidra.
534820	539580	So all of these UIs are new to me, but they also look like they were before my time.
540060	543480	Yeah, well, Ghidra... I mean, it's an impressive tool.
543480	547840	You can do so much with it, and it is not my go-to, but their struct editor...
547840	553820	I like the visual of the sizing going on and being able to pick out specific stuff.
553820	557340	Oh, that's what that is down there. That's nice. Yeah, I like that.
558320	560080	I'm not stealing ideas here.
560160	563060	Yeah. Scoping out the competition.
563340	569680	I got to say, though, with both Ida and Ghidra, I'm not a light theme guy. I really do prefer the dark theme.
569680	574100	I definitely don't appreciate having two monitors with light themes blasting into our eyes.
574100	576400	It's brighter than the studio lights we have here.
576440	578080	It's definitely good to wake you up, though.
578080	581000	Oh, absolutely. The coffee wasn't enough.
581520	584520	All right, so they're still annotating strokes. They're still going through...
585680	591140	They're kind of going through the normal CTF mindset of, OK, get all of my bearings, figure out what's going on.
591140	593780	Then we look for the bug once I know what everything is.
593960	599660	Yeah, well, once you've got a decent bit of annotation here, I really do think that the bug's going to pop out.
599660	603840	And this isn't just, hey, I'm going to go through and name everything.
603840	607620	It's also they're understanding the algorithm as they name things.
607620	611900	And so right now they're looking at strcmp and thinking about, OK, what does this do?
611900	618040	I think if you were taking this approach and you get to the target function with the strcpy, it's going to pop right out.
618040	620280	Oh, yeah. No, you're going to see that immediately.
622340	625560	Especially because... So what is kind of this challenge?
625560	631080	Like, in a nutshell, what does the interaction flow look like? What is it supposed to be?
631080	639660	Yeah, so as we're seeing here, both competitors looking at these functions are talking about querying and servers.
639660	644100	So this is an address resolution service was the sort of origin of the bug.
644100	649920	And the CGC challenge called itself server resolution service.
649920	657380	So really this is about, hey, can you create a query to enumerate these instances and find things?
657600	665360	And it's just copying one of these fields to another in a request leads to an overflow.
666900	672820	Nice. Yeah. So it's a fairly standard service interaction flow, I want to say.
672820	677400	You have creation. You have querying. I don't think you have any deletion here.
677400	680680	So it's not going to be like a false double free or something.
681260	683260	Oh yeah, I don't see free in the function list.
686800	689660	I'm going to flip over to Bluewater here.
689680	695120	It looks like they are... I see them. They just labeled something in a stir copy right there.
697560	703540	It's funny when you see somebody and you know they're close and you're starting to see as he's clicking around.
703540	705760	Oh, he's looking right at the stir copy.
705760	707020	Oh, is he?
707020	708780	Oh, he sees that it's a stack.
708780	709840	He sees it.
709840	711760	I think that we're seeing...
713300	714600	Immediately back to the terminal.
714600	717580	When they flip back to the terminal after that.
717780	720920	Check sec, no railroad, NX disabled, no canary, no pie.
720920	722740	I think he sees his path now.
723280	726700	Yeah, I think he's just like, oh my god, I spent all of that time.
726840	735300	Yeah, well, but also there's a lot of excitement because he's just had a breakthrough and he just wants to know how close is the other competitor.
735300	738000	Oh, yeah, he has no idea if they've already found the bug.
738000	740620	If they're building a ROP chain, there's no NX.
740620	742340	I don't know why.
742340	746260	ROP chains, there's always ROP chains when you have no NX.
746360	747980	I think it's just practice.
748140	751660	And especially there's no ASLR in play.
751780	757960	Do you really think that's faster than just, you know, finding one call or like pop call gadget?
758520	764400	Yeah, and if I recall this one, there is a friendly gadget.
764400	766640	Yes, there's a very friendly gadget.
766860	771280	When I verified this challenge, I sent my solution and I looked at the source like, oh, what does this look like?
771280	774360	And I see a comment on it saying, we left this here to be nice.
774540	785780	Yeah, well, like I said, there's a little modification because we really don't want to beat the players up with things that aren't really the core bug here.
785780	787300	And we want this to go fast.
787300	789560	Yeah, these challenges are meant to be solved.
789560	791680	So the challenge is finding the bug.
791680	795800	We might give you, you know, an easy primitive or two to just kind of facilitate.
795800	799080	So you don't need to search the entire binary space, binary search, if you will.
799540	802320	And, you know, find the right primitive to use here.
802320	803840	We just kind of lay it out for you.
804460	808820	Yeah, and it's a line to walk when you're designing challenges.
808920	810740	How easy do you want to make?
810740	813200	What is the real challenge that you want them to solve?
813200	823820	And in this case, it was really just finding that stir copy, understanding what you've got on your hands, understanding the mitigations, and then writing your exploit.
824120	826340	Yeah, so now they're going.
826940	832240	BlueWater is going to be stepping through, figuring out their offsets, and starting to write their exploit.
832240	834300	What is Undefined doing right about now?
834400	835520	Yeah, let's flip over and see.
835520	843560	It looks like they're reversing in the main function, so they're exploring sort of the switch statement that...
843560	849940	This is almost a menu sort of setup, where you've got a switch statement that handles the different kinds of requests.
850180	851520	And there's not a lot, right?
851900	860600	Originally, in the CGC version, there was more stuff, and we kind of commented that out because we didn't want the competitors to have to spend all their time just sort of digging through, you know?
860600	861360	Yeah.
862220	869800	And it looks like Undefined hasn't reached the area of code with the stir copy yet.
870080	873740	Right, they're still labeling. They're building their understanding.
873980	881540	Now, this might help them in the long run, if they know offsets better, because it looks like BlueWater is over there calculating offsets.
881540	892360	And you can tell, based on what they're looking at, that they're real concerned about linked lists, which are a common source of bugs, mishandling linked lists.
892380	894200	Not in this case, though.
895600	905160	And I think that this is kind of an interesting thing to talk about, because in the CGC, you had these automated competitors that they aren't looking at the binary, right?
905160	905480	Yeah.
905480	917140	They're not reversing or annotating. They were fuzzing and doing symbolic execution, but they can cover a lot of ground, whereas our competitors here are having to manually reverse engineer and find bugs.
917140	920640	As good as you are, you're, at the end of the day, only one person.
920640	930840	That's true. I have been hoping to see somebody pull out, you know, a fuzzer or some other extra tooling to try to overcome this.
930840	935480	Oh, I'm really looking forward to it. But it looks like teams are going to the basics, what they can do the fastest.
936280	943280	And that looks like, you know, GDB with whatever fancy wrapper they want to put on it, Geph or Pwnbag or PETA.
945120	952740	IDA, Ghidra, no Binge yet. Sad. But they're going with what they know and what they've been using for the longest time.
952740	963460	Yeah, and I think that the discussion really is, if you have to solve something in only 20, 30 minutes, do you have time to work with something like an anger?
963460	968560	Like, you have to be really practiced. And there's still a little, you know, finesse involved, unless it pops the answer right out.
968560	973340	Yeah. Well, we saw yesterday with the final match of the day that teams were racing to build ROP chains.
973460	977700	And one team had a full layout, he had the offsets right, and everything was going right.
977700	981640	And then Pwn Tools kept throwing like, oh, you can't append to a relocated ROP chain.
982420	986260	And he was stuck there for 10 minutes. We had to go into sudden death.
986260	990420	And then sudden death was a ROP off again, a ROP race.
991020	999300	And, you know, you get these really fancy tools, but if you trip over all their bells and whistles, you might be better off with basics.
999720	1008480	Yeah, and I think it's interesting because this isn't actually what you'd see in the real world, so to speak.
1008480	1013840	This is a competition. This is testing, pushing people to their limits.
1013860	1019780	But in a normal situation, if you were looking for bugs and trying to write an exploit, you could really take your time.
1019780	1027460	Oh, yeah. No. I mean, in daily jobs, you know, reliability and undetectability of exploits is one thing.
1027540	1031580	But CTF code is notoriously messy.
1031580	1039400	It is built on a pile of commented out things that didn't work, curses, variable names that are just frustration with the author and the challenge.
1039960	1046600	Yeah, we're looking at BlueWater right now. The A's and the B's are sort of the classic visual padding.
1047280	1056160	But, you know, so far I haven't seen a lot of variable names like LOL or HA or WTF, but I've definitely seen that before.
1056160	1058640	Yeah, a lot of maybe, a lot of underscore IDK.
1058640	1059500	Yeah, yeah.
1059500	1064340	But BlueWater is writing in their solution script undefined.
1064340	1067840	It looks like they're also building out their script.
1067840	1075940	So they've enumerated that, hey, there's there's a couple of commands here and they've broken down what each command type can take.
1075940	1079680	So they have the idea. I don't think that they've seen the bug yet.
1079760	1082800	Just just based on what we're looking at here.
1082800	1085080	But they they've got the skeleton going.
1085080	1090480	It looks like over on BlueWater, they're starting to send their BNSH shellcode.
1090800	1093000	Yeah, they look like they're pretty close.
1093000	1095120	Oh, yeah. And they're going to pack an address.
1095360	1096800	Oh, do they have their gadget?
1096800	1099140	Oh, do they? Oh, the receive buffer.
1100360	1103620	OK, so they're putting the address of the receive buffer.
1103960	1110080	But do they have no ASLR in place so they can they can use the binary address?
1110080	1112500	Yeah, no, no, no, nothing.
1112500	1115840	But do they have the gadget?
1116800	1119220	Because, oh, you know what?
1119500	1126260	They might just put on top of the stack and then, you know, Red will get to it or leave.
1126780	1130620	Hmm. I'm not sure exactly.
1130620	1132020	I think we're seeing them.
1132500	1136940	I think they're they're they're still exploring here, but they're pretty close.
1137260	1138740	Oh, yeah. OK, they're going back.
1138740	1140240	They're double checking their offsets.
1140240	1142640	They're making sure they're in the right function here.
1144320	1149380	OK, and then they have a jump and they're like, but but the leaves should load it.
1149380	1150760	It should work.
1153060	1155560	So setting a breakpoint, walking through.
1157060	1159820	Yeah, and he knows he's so close, right?
1159820	1164480	This is this is the tense almost to the finish line.
1164480	1166700	Just got to figure this last bit out.
1167520	1173080	It looks like he's going to hard code the stack, which will work fine in local execution GDB,
1173080	1175520	but stack address not fixed.
1176360	1177800	Yeah, yeah, stack addresses.
1179880	1184680	Not as not your reliable binary gadget here.
1184680	1187860	Yeah, no, it is not built into the binary. It is not affected by Pi.
1187860	1189460	I'm sure it is in some way or another.
1191020	1193220	OK, so we see the first mean variable name.
1196700	1198860	All right, so they're building out shellcode.
1198860	1202500	Yeah, this is starting to look like the code that I wrote to solve this.
1205330	1208550	Building out padding correctly, making sure everything lines up properly.
1208890	1211250	And walking through, they're going to get segfaults here,
1211250	1213830	but they're going to know where exactly in their chain they're segfaulting.
1213830	1216530	It'll give them a better idea where to hone in on that offset.
1217210	1221230	Yeah, and some of this really is just that iterative try one thing,
1221230	1225110	see where see where we're at, maybe a missed assumption or things just.
1225110	1228970	Yeah, here we go. So top of the stack is the address of the receive buffer.
1229350	1234250	And then it looks like the shellcode isn't being written properly.
1235190	1238610	Oh, nope, I saw push x68.
1238790	1239310	OK.
1239310	1240690	That looks promising.
1240690	1244890	The SBB, the add, that doesn't look like the shellcode,
1244890	1247030	but looks like they're landing something.
1247130	1249750	Yeah, they're definitely somewhere. They're almost there.
1249750	1253630	Over on undefined, let's see what's going on.
1253630	1255290	Python solved up high.
1255910	1257850	OK, so they're printing out receive packet information.
1257850	1260190	They're still writing an interaction here.
1260190	1263610	Do they have the query one implemented yet? I can't see quite that far.
1263610	1267710	They have a function written to do the query one.
1267710	1270710	I'm not sure that I've seen them bring that up, though,
1271150	1274670	in terms of looking at it in Ghidra and finding...
1274670	1277190	Oh, they're going really in-depth in the query all.
1277190	1282430	Yeah, they're going a little deep on the reverse engineering,
1282430	1285850	and it may cost them because the bug isn't...
1285850	1288430	It's not too complicated in this case.
1290810	1292350	But we're seeing them.
1293670	1295630	They're giving it everything they've got.
1295970	1297490	They're frantically looking through.
1297490	1301150	I think the speed that they work at is impressive,
1301150	1304970	but you can also, I think at this point, start to sense a little desperation.
1304970	1308210	I'm sure that they're feeling, where is the bug? Where is the bug?
1308210	1309410	Yeah, they're looking through.
1309410	1311830	They're getting a really solid understanding of the binary,
1311830	1315910	but they're missing shallow bugs looking for deep ones.
1315910	1317670	Okay, so hint number one just dropped.
1317670	1319570	The hints are set up to drop.
1320750	1321990	Let's see. What is hint number one?
1321990	1323710	This is a classic old-school bug.
1323710	1325530	What a helpful hint, Mark.
1331330	1334150	When I think of old-school bugs, I think of string bugs.
1334150	1334610	I don't know about you.
1334610	1335170	Fair.
1336030	1339150	String handling bugs, I'm looking at...
1339150	1340850	Stack buffer overflow, too.
1340850	1341930	Yeah, stack buffer overflow.
1341930	1343090	Okay, it is a helpful hint.
1343090	1345870	I'm not thinking linked list. I'm not thinking heap.
1346030	1348190	It's not an IOU ring, but...
1348190	1350270	There's a stack buffer overflow somewhere.
1351050	1357370	And for me, I'm looking at strcpy, strcat, hoping something like that.
1357370	1359390	Any of the classic overflow vectors.
1359390	1360410	Right, right.
1361890	1367790	Now, for all of these challenges, we're doing it to try to set them on the right track,
1367790	1373750	especially a case like this, where maybe they're just looking in the wrong spot,
1373750	1376830	and so hint number one is trying to guide them towards the right spot.
1376910	1380250	And then hint number two is like, okay, here it is, just do this.
1380370	1382370	Hints released at 20, 35 minutes.
1382370	1384210	50 minutes, we go into sudden death.
1384490	1386810	We're setting a hard cutoff on that this year.
1386810	1389170	We made the mistake last year of being too lenient with it.
1390310	1394410	But it looks like we're 15, 18 minutes in, somewhere in there.
1395630	1397770	Yeah, and really, looking at...
1398550	1400450	That's right, hint drop.
1400450	1404650	Hint drops automatically, this go around, which is a nice bit of automation.
1405390	1409510	We're not completely beyond the setting pieces of paper down in front of the competitors.
1409510	1412210	That is how they connect to the challenge server, yeah.
1414330	1415870	But going through...
1415870	1420850	Okay, so blue water is going through making sure they're on the right path,
1420850	1422830	or are they looking for another vector?
1423350	1425390	Or are they just checking offsets?
1425950	1427030	Well, they...
1427030	1429910	And I saw both competitors look at the hint.
1431190	1432830	And it says it's an old school bug.
1432830	1434130	They've got a stack buffer overflow.
1434130	1435930	I think that they're just trying to break down,
1436330	1438630	how do I get to my shellcode at this point?
1438990	1440210	Yep, looking at gadgets.
1440210	1441490	Yeah, oh my.
1441910	1445290	Yeah, that's some ANSI color sequences there.
1445530	1447070	Yeah, see, that made me ANSI.
1450270	1453130	Okay, so we're looking for sub-RSPs, right?
1453310	1454510	Okay, that's the road they're going.
1454510	1457770	I think that there is a call register.
1457770	1461310	There is a pop EDI call EDI or something, RDI.
1461310	1462810	It's not that old school.
1462890	1464430	Trying to make it easier.
1464430	1467250	And so if you have that kind of tool,
1467250	1470750	and you're grepping for a call or a jump gadget,
1470750	1472590	it should just pop out at you.
1472590	1475910	Well, absolutely, but he's looking for what he knows.
1476110	1478050	He's looking for classic...
1478050	1479270	That's right.
1479270	1483970	And if you're used to working on modern exploitation challenges,
1483970	1485150	they're not this easy.
1485150	1487130	You have to do a little more.
1487230	1491950	And so they're probably not expecting it as easy of a challenge.
1491950	1494370	So hopefully as the tournament goes on,
1494370	1496190	we'll see a little bit of that.
1496190	1499030	Okay, check for the easy thing first, and then maybe...
1499030	1501810	Yeah, this is a live CTF. We do want you to solve it.
1502770	1505030	We really want you to solve it.
1506910	1508970	Alright, so it looks like...
1509930	1511950	just building a manual payload here
1512790	1517290	instead of using PwnTool's shellcraft.
1518030	1518970	Or maybe he'll still use it.
1518970	1520870	I think it looks like he's...
1520870	1522530	Oh, he's just figuring out the offsets again.
1522930	1526810	Playing with the padding, trying to understand what exactly...
1526810	1528530	Maybe looking for a leak.
1530870	1531750	Yeah?
1534050	1537270	They're looking at the output there, seeing what the server sent them.
1537270	1538530	There's a lot of junk.
1539230	1540530	It's all randomized.
1540530	1545490	Again, this challenge was built to be run in a different environment
1545490	1549090	where randomization was handled differently.
1549570	1551050	These were automated competitors.
1551050	1552430	They're not reading the output.
1552450	1553330	No.
1553330	1554250	It is garbage.
1554250	1556610	It threw me off a little bit when I was parsing output,
1556610	1558410	and I just got random strings back.
1558410	1560150	And I'm like, am I parsing this right?
1560150	1562050	Is it like 7-bit UTF?
1562970	1565590	But no, it's just completely random strings.
1566530	1568470	Printable strings. That's important.
1568670	1569490	Right, right.
1569490	1572150	Yeah, that would be mean if we just throw a null byte in there.
1572150	1573810	They parse it out and early.
1574410	1575530	Let's switch over to Undefined.
1575530	1576430	It looks like they...
1576430	1579630	I have to imagine that's their overflow that they're playing with,
1579630	1580510	with all those A's.
1580510	1581710	Yeah, it looks like they're stepping through,
1581710	1584350	figuring out where in all those A's they are.
1584810	1589490	And I gotta say, I'm loving their debugger setup here.
1591690	1594530	So they're in parse query, it looks like.
1594530	1596290	Not stepped fully into the query one.
1596290	1598470	Oh no, parse query has a strcpy, doesn't it?
1598470	1600330	Or is it in query one? I forget.
1600450	1601990	I believe it's query one.
1601990	1605470	In parse query, I think they're looking at the string handling to try to...
1605470	1607370	They've got an idea that this is an overflow,
1607370	1610070	so that hint looks like it did give them a little bit of an idea.
1610070	1611510	Yeah, okay, it was a good hint.
1611530	1613670	They're looking for overflows,
1613670	1616410	seeing some comments go down,
1617090	1619090	tracking, hey, what are the maximum lengths
1619090	1621670	that can be sent in different places?
1621730	1624170	And so what that was, that was the parse query,
1624170	1626270	which populates a larger buffer,
1626270	1630150	and then the query one buffer is a stack buffer, which is smaller.
1630150	1632530	So they're on the right path.
1633090	1634320	They're looking for that...
1634830	1636830	Oh, now we see them looking at a strcpy.
1636830	1637510	Oh.
1637510	1642990	So they're thinking, hey, is this a strcpy bug, stack overflow?
1642990	1644450	Right, kind of thinking.
1644650	1645690	The wrong strcpy.
1645690	1648090	That strcpy there is an innocuous one.
1648090	1648490	Yeah.
1648490	1653770	You can totally use it safely with enough checks or static string buffers.
1653770	1657710	But if they were to look at the cross references on strcpy,
1657710	1659990	that would drop them right in the right spot.
1659990	1661090	They would.
1661550	1664650	So let's see, going into...
1664650	1667830	So this is the receive until,
1667830	1673630	so just helpful wrappers around the receive function.
1673750	1675730	Again, this was built in the CGC.
1675730	1679830	There's a fair bit of scaffolding in play that they had.
1679830	1681650	They had their own libc.
1681650	1686910	So the challenge authors then built familiar wrappers commonly
1686910	1690790	to make the challenges look like what we'd expect.
1691270	1695650	But this is, I think, the competitor trying to understand,
1695650	1697130	okay, what are the limits?
1697530	1699690	How much exactly is going to be written in that buffer?
1699690	1701410	Okay, we see the buffer label.
1701410	1703150	The size is right next to it.
1703150	1710210	But over on BlueWater, they have rbp414141.
1710210	1712930	All right, so when we see register control, we know we're close.
1712930	1716470	Because really, in this case, building a stack buffer overflow,
1716470	1718110	there's only a few steps, right?
1718110	1718830	Yeah.
1718830	1720990	So you've got your overflow.
1720990	1723730	You understand, okay, what registers do I control?
1723810	1726710	What are the offsets to control those registers?
1726890	1730090	And then what should I put in each of those?
1730090	1733670	And what's going to be the easiest way to get shellcode running?
1733670	1735190	Now, what I'm worried about with BlueWater
1735190	1739090	is they were returning, I think, to the receive buffer,
1739090	1740930	which I think is in BSS.
1741790	1742650	Oh.
1742650	1746350	So I'm not sure that that's executable,
1746350	1748210	unless you unprotect it.
1748390	1751210	That might have just been where they're putting their return address
1751210	1752830	and they pop it and read to stack.
1752910	1754250	I'm not 100%.
1754970	1758350	I did see them looking at the virtual memory map.
1758350	1763970	So they were looking at permissions for readable, writable, etc.
1763970	1765270	Hopefully, yeah.
1766590	1768490	I mean, we don't know what's going through their heads.
1768490	1770290	They could be thinking anything right now.
1770330	1772430	You could be thinking, man, this would just be so much easier
1772430	1774470	if I can get a UAF in here.
1774870	1775750	Yeah, yeah.
1777350	1780410	Their mind may still be on the DEF CON CTF finals, right?
1780410	1781970	Maybe they've been working on another challenge
1781970	1785450	and this is just total whiplash in terms of...
1785450	1787810	Yeah, BlueWater sat down and asked,
1787810	1791450	can I unplug from HDMI so I can keep working on the challenge I was working on?
1791450	1792430	Love that dedication.
1792430	1794370	Yeah, go for it. We're going live in a couple minutes.
1794370	1796670	And he's like, unplug, keep working on the challenge.
1796670	1798850	I go over and I'm like, we're going live soon.
1798850	1801430	He's like, okay, cool, plug it back in, close everything down
1801430	1803310	so no other team can see what's going on.
1803310	1803630	Awesome.
1803630	1810090	We don't want to leak any DEF CON CTF challenge solution progress,
1810090	1811250	anything about that.
1812250	1816130	Yeah, it's definitely the case where the competitors know
1816130	1818270	that their screens are being streamed.
1818270	1821630	Yes, we are very explicit telling them that.
1821630	1823290	We don't want anyone leaking anything.
1823290	1824770	No password managers pulled up and they're like,
1824770	1825850	oh yeah, what's my password again?
1825850	1826930	Pull it up on screen.
1827830	1830290	RBP, oh, okay, so it looks like he is the offset, right?
1830290	1831590	RBP is bees now.
1832170	1833170	Okay, yep.
1833430	1837130	So he's nailed that offset and now just determining,
1837130	1840210	okay, where do I go from here?
1840210	1841830	What's the gadget I want?
1841830	1843610	Can I do something with RBP?
1843610	1848530	Man, it sure would be great if I had a DRFRSP plus 32 call.
1848870	1852290	I'm just waiting for him to go back to his gadgets file
1852290	1854150	and look for some friendlier gadgets.
1854150	1858770	Yeah, you can make do with what he's found so far,
1858770	1860790	but it is not going to be fast.
1861190	1866070	You need that nice gadget to just kind of expedite the entire process.
1866410	1869730	Or maybe he'll jump back, you know, call some puts,
1869730	1872190	call printf and get a stack leak, do it that way.
1872270	1874810	Yeah, and I never count these competitors out.
1874810	1877090	I fully expect when I write a challenge like this
1877090	1879230	that they are going to come up with some way to solve it
1879230	1880630	that I didn't expect.
1880730	1881610	Absolutely.
1881610	1884930	I mean, we've seen that in a couple challenges yesterday.
1884930	1887910	They were close to intended, but they did, you know,
1887910	1890410	they diverged from the path that we kind of cut for them,
1890410	1891730	that we put in place for them.
1891850	1894370	And I think that really says that these competitors
1894830	1897010	are all experts in the field.
1897310	1900070	You know, they understand these things so well
1900070	1901130	that they can go around.
1901130	1903830	They don't need to walk the path that we kind of laid out for them.
1903830	1905990	They see something off to the side, traverse that,
1905990	1908010	and it might end up being faster, might end up being slower,
1908010	1909890	but it'll work in the end.
1909890	1912870	As I say that they're experts.
1912870	1914570	What does the leave instruction do?
1915730	1917030	But this is real.
1917030	1918450	Honestly, it's totally fair.
1918450	1920510	Every expert uses Stack Overflow.
1920630	1922770	Tell me you don't. Tell me you don't, Josh.
1922770	1923730	I can't.
1923730	1925170	Well, I could. I'd be lying.
1925710	1929010	No, we saw yesterday we had man7.org and Stack Overflow,
1929010	1930610	and I don't know which one is better
1930610	1933050	as far as describing what things do.
1933830	1934490	Let's take a look.
1934490	1937970	I think on the undefined side here,
1937970	1939490	he's in the right function.
1939490	1941130	He's got his cursor on strcpy.
1941130	1945370	I think that we're watching him live understand.
1945490	1948270	So he's got the instance buffer,
1948270	1950230	the stack buffer labeled as instance.
1950230	1952150	He's highlighting the strcpy.
1952150	1954290	He's like, how big can this be again?
1955290	1958050	Wait, this is such a small buffer.
1958050	1959910	Oh, he walked over it.
1961110	1962910	I'm not sure if he just counted out
1962910	1967050	because there was an innocuous one earlier,
1967050	1969370	and it just kind of blends into the background.
1969370	1972110	Or if he saw it, and he's just marking stuff around it
1972110	1973590	so he knows what's going on after.
1973650	1976790	Yeah, perhaps looking for something afterwards
1976790	1983150	that might modify or otherwise change the environment.
1983290	1990070	But the query being the argument to the query1 function,
1990070	1993470	that is a little bit of a hint that, hey,
1993470	1994830	if he can go back and understand
1994830	1998190	what part of that structure he controls,
1998190	1999430	I mean, he's looking right at it.
1999430	2002010	So I think we're seeing...
2002010	2004790	Yeah, rewriting to use the query1, it looks like.
2004790	2007890	So this competitor is understanding,
2007890	2010190	okay, we've got structures in terms of server name,
2010190	2014130	instance name, and then on the right path.
2014130	2015810	You know what I'm seeing a lack of?
2015910	2017750	Type hints in their solve scripts.
2017830	2019650	It is honestly underrated.
2019650	2021730	The number of times I pass a string to a function
2021730	2023490	that takes bytes and the encoding gets messed up,
2023490	2025550	or it passes and PwnTools throws a warning
2025550	2028730	that I'm not aware of, UTF fucks everything up.
2029090	2031810	Like, really, type hints and exploit scripts
2031810	2034070	have saved me so many debugging steps.
2034110	2038270	Oh, yeah, I mean, the only time in the past year or two
2038270	2040850	that I've written Python without type hints
2040850	2042350	was writing a challenge for this.
2042350	2043010	Yeah.
2043390	2045810	Because I didn't want people to figure it out too quickly.
2045810	2047170	Yeah, yeah.
2047670	2051470	All right, let's take a look and switch over to Bluewater.
2051470	2052990	All right, Bluewater.
2052990	2055590	Looks like they're going in the parse query,
2055590	2057430	looking at the calloc lengths.
2060710	2065950	I think they haven't seen the nice gadget yet.
2066550	2068450	Yep, I agree.
2068450	2070410	I think that there's a...
2072150	2074750	They might have a technique in mind.
2076970	2078310	Yeah, so it's hanging.
2078310	2079970	I wonder if they're just going to run it against
2079970	2081770	and wait for the stack to line up
2081770	2083230	at some nice boundary or something.
2083230	2084790	I'm not 100% sure.
2084790	2087390	It looks like they're exploring the other functionality in there.
2087630	2088070	Interesting.
2088070	2091690	If I recall, there's only three or four different things
2091690	2093530	you can get the target to do.
2093530	2095150	Yeah, it's a smaller surface.
2095330	2099110	Perhaps there's something hidden in the other functions
2099110	2103710	that he wants to use or thinks that might be helpful in terms of...
2103710	2104450	Yeah.
2104450	2105870	Now, looking at decompilation,
2105870	2107710	you're not going to see those nice gadgets hidden in there
2107710	2110610	because they're just going to be optimized out in some cases.
2110610	2111510	They could be dead code.
2111510	2113690	They could be just unoptimized.
2113830	2116690	Decompiler throws them away because it's an if-false.
2117150	2118090	Right, exactly.
2118090	2120530	And I think that that's the case with this specific gadget.
2120530	2123090	It was inserted to make life easier,
2123090	2126290	but it's really not in the hot path.
2126290	2129430	It's not something that you're going to run into just running the binary.
2129670	2131930	Yeah, and that kind of brings up one of the major downsides
2131930	2133290	of only looking at decompilation
2133290	2137190	is you're looking at this output where all these heuristics,
2137190	2139470	especially in IDA, all these heuristics were being applied
2139470	2143970	that removes things you're not interested in for actual functionality.
2144190	2149290	But when you're getting down to the actual creation of an exploit,
2149290	2151950	you really need to look at the fine-grained,
2151950	2155190	you know, I have a sub-RSP 32 call.
2155370	2159250	Like, I have all of these things in dead paths that I can use.
2159250	2163190	And we saw him looking at ROP gadgets for, you know, a minute maybe.
2163490	2166410	But he was just searching through for sub-ESPs.
2167190	2172810	Yeah, yeah, I think that there's a tendency to go with what you know.
2172810	2177330	And I don't think that Magic Gadget is going to work on this one, right?
2177330	2180130	So it's like, all right, what's the fallback here?
2180130	2184510	And that can be challenging if, you know, you're not prepared for it.
2184510	2185730	You're not expecting it.
2185810	2188550	I'm wondering if now he's trying to get a libc leak or something
2188550	2191530	and like, oh, just one gadget it, something like that.
2191530	2193170	But just as easily, there's no NX.
2193170	2194910	You can get a stack leak and jump to it.
2195650	2200910	Yeah, I think that at this point, there's...
2202650	2211190	It's just, it feels like this is one of those parts in the pattern of writing an exploit that automation would help, you know?
2211230	2213770	Like, suggest a few things.
2213770	2216510	Because as you said, there's a lot of trust in the tools.
2216510	2218110	Decompilation, a great example.
2219710	2223290	You're counting on the tool to show you exactly what's there.
2223290	2227890	And I think that walking that line of using tools to make you faster
2227890	2234670	and make things that are hard easier is something that I only expect to see more of in the future.
2234670	2239290	And we see over on Blue Water, they just highlighted the RWX stack.
2239610	2240690	I don't think they noticed.
2240690	2241490	Oh, we're back.
2241490	2243150	We're back in the gadgets.
2243430	2247650	But at the same time, Undefined was writing their solve script too.
2247650	2250550	In their solve script, they have hard-coded binary data.
2250550	2252290	So it looks like they're just fine-tuning.
2252290	2254930	They're going through with a fine comb now, figuring out where it goes wrong.
2254970	2257290	Oh, they have a threat to...
2257810	2259890	Is that a controlled address? I can't see that far.
2259890	2261630	Yeah, we've got RSP. They control RSP.
2261630	2267150	And you can see the cyclic pattern is going to allow them to calculate exactly what the offset is.
2267210	2269950	Oh, that's what that was. They were just pasting cyclic output, maybe.
2270730	2273610	Yeah, so now they're going through and actually...
2273610	2276270	And so this is a clever point because even...
2276270	2281730	It's not just, hey, okay, so you can see that they're putting a known value that's going to go in the return address.
2281730	2286170	But then after that, seeing, okay, which of these other values ends up in other registers.
2286170	2291490	So you can understand, hey, each register that I control, this is exactly the offset that's going into it.
2291490	2295310	Oh, yeah. And it looks like... Is that dead beef I see over there?
2295450	2299350	So they've definitely landed the return address overwrite.
2299570	2303550	And now let's see what their strategy to get execution is.
2303830	2305650	All right, so are they going to look through gadgets?
2305650	2309750	Are they going to see any nice leak there?
2310890	2312950	Not 100%. It's never guaranteed.
2312950	2319010	You can be so close to the solution and then overlook one thing, one nice gadget, one win function.
2320570	2322590	And a hint, too, just came out.
2322670	2328550	Yeah, I saw somebody checking the live CTF page to see if that hint had dropped.
2329010	2334550	And I think that we added a timer today so that competitors could see exactly how close they were to getting a hint.
2335190	2339590	That, I was told, was not 100% not going to break the infra.
2339590	2342790	So I did not deploy it for first match.
2343070	2347310	But I told them in person, you know, check back at this time and this time.
2347330	2349470	There will be hints. Refresh the page.
2349890	2353090	But they might be a little too focused on this. They might not notice it.
2353130	2356570	Outstanding. Yeah, the priority is that the infrastructure actually works.
2356730	2361990	Yes. I was not about... I waited in line for breakfast, came over here a couple minutes before.
2361990	2365570	Plug everything in. Please work, please work. IP tables routed everything properly.
2365710	2367530	Container started. I'm like, yes!
2368810	2373450	So, undefined. Hang on, no arch presence.
2373670	2374750	Are they?
2376170	2377070	Oh.
2378310	2382190	I think we're seeing a... Yeah, we're seeing a ret to the receive buffer again.
2384390	2387950	And so, they're working through. They've got the overwrite.
2387950	2390750	They know that they've got the bug.
2390750	2393250	They're just trying to finish out.
2393250	2397170	And honestly, BlueWater, if we flip over them, they're looking through gadgets.
2397170	2400650	They know that they've been closed for a long time.
2400650	2403870	They see that pop RVP ret, which is pretty nice.
2404030	2404390	Yep.
2404390	2406470	But that doesn't give them the stack offset.
2406910	2408930	Yep. Yeah, so at this point...
2408930	2410650	They're just going with full ROP chain.
2410950	2412750	Well, and that's an option.
2414150	2418610	I don't know if it is. Because there's no system call in this.
2418690	2420490	There's no, like...
2420490	2424010	Like, I guess if you get lucky and find the syscall ret, right?
2424070	2425410	That's what it comes down to.
2425410	2427450	But I don't know if there are any raw syscalls in this.
2429070	2431530	Good point. I think...
2431530	2433690	You know, but it's...
2435350	2438610	With an overwrite like this, there's...
2438610	2440770	There's a few things you can do.
2440770	2442530	If I recall...
2442530	2445550	It's not null terminated, so you can write...
2445550	2446250	Oh!
2447750	2449150	It's... I want to say it's new...
2449150	2449770	That's pretty nice.
2449770	2451210	No, it's a strcpy, so it is...
2451210	2452330	Oh, yeah, yeah, yeah.
2452370	2455290	Okay, but you can have null-free shellcode pretty easily.
2455290	2457190	That's not too bad of a constraint.
2459930	2462430	Let's see. So they're getting the offset right.
2462430	2464750	Oh, no, you don't...
2465270	2469110	No. I mean, if they're writing a ROP chain,
2469110	2473330	you can just fully ROP to it and probably build binsh that way
2473330	2474970	because you have address of the receive buffer.
2474970	2476650	You can just send binsh in it.
2476950	2479730	That's right. You've got a larger buffer that you can stage stuff.
2480250	2482150	So they actually...
2482150	2484390	And it looks like that's what they're trying to do.
2485290	2486330	Oh, I hope so.
2486850	2488190	Where is that?
2489730	2493110	Yeah, so they have padded shellcode on there.
2493110	2495970	They're putting ROP gadgets after, which are going to be on top of the stack
2495970	2497690	and hopefully RET to it.
2497730	2500150	And that makes sense with the other...
2500150	2501910	When they were looking at the other functions,
2501910	2504890	I think that they might have been trying to send data
2504890	2506850	to get it staged somewhere else
2506850	2509910	and then maybe look for references to that data later.
2509910	2512310	Yeah, but it looks like also that
2512990	2515150	they're sending 7 A's instead of 8,
2515150	2518030	so they still have that leading FD on top of the stack.
2518470	2520210	So I'm not sure if they see that
2520210	2521470	or if they just see the A's at the end.
2521470	2523190	Okay, cool. I'm overriding everything.
2526270	2528690	Yeah, they see a REX.B.
2528690	2530470	I don't think that's part of their shellcode.
2530990	2532690	I just wanted to point out Undefined
2533610	2534790	pulling out the checksec,
2534790	2537590	understanding that there's no mitigations in play.
2539710	2541470	They're looking for...
2541470	2543850	How do I get execution?
2543850	2545250	I've got the strcpy.
2545250	2548010	They have strcpy. We saw them get RIP.
2548310	2550630	They got RIP once at deadbeef.
2550630	2552770	Okay, so what we're seeing here is
2552770	2556710	looking at ROP gadgets.
2556910	2560090	Oh, yeah. And they're looking for RSP gadgets.
2560090	2560850	Yep.
2561090	2564350	Which is on the right path. It's close.
2566710	2568450	Yeah, you know, parsing these outputs,
2568450	2570170	that wall of text,
2570170	2572130	it's always tough for me.
2572190	2573990	I always feel like there's got to be a better way.
2575150	2576970	Oh, this is a tool I haven't seen before
2576970	2578510	on Bluewater.
2578910	2580250	Disasm.will.gl
2581090	2583050	Oh, this is nice. It's like a nicer
2583050	2584790	Diffuse CA, honestly.
2584810	2586650	Diffuse CA is something I go to for just like
2586650	2588830	in-browser disassembly-assembly.
2588830	2590890	You know, I just want to copy a bunch of bytes out.
2591750	2594170	Yeah, having little tools like that is...
2596270	2597230	It's really helpful.
2597230	2599630	And in competitions like this,
2599630	2601590	really having a number of tools to go to
2601590	2603910	is helpful. You want to have all the tools
2603910	2605530	in your toolbox that you could possibly need
2605530	2607210	because you never know what's going to come up
2607210	2608190	for a challenge.
2609030	2610830	Oh, and it looks like...
2610830	2613270	Okay, so he's looking now.
2613590	2615390	What opcodes can I use
2615390	2617670	that start with 0x3, the command code
2617670	2619670	in the packet, to get to this path?
2622400	2623880	Oh, they're both so close.
2623880	2625960	I just heard mumbles of sudden death.
2626380	2628220	I'm not sure when we're getting there,
2628220	2630400	but I imagine we're getting close.
2630940	2632320	Ten minutes?
2632940	2635620	Eight. Eight minutes to sudden death.
2635620	2635960	Wow.
2635960	2637820	Sudden death, an easier challenge,
2637820	2639500	should be solved fairly quickly.
2639840	2642600	We did not write all of them last night,
2642600	2644600	but I verified all of them and they work.
2644600	2646160	Very easy challenges.
2646160	2648480	Very fast. Does not require this level
2648480	2650600	of either reverse engineering
2650600	2652290	or this kind of...
2653580	2656400	these exploitation chops, I guess.
2657140	2659280	Yeah, and, you know, really hoping
2659280	2661140	to see a solve for this, especially because
2661140	2664100	I feel for the competitors. Been there.
2664100	2665580	You know you're so close
2665580	2667160	and you hate to
2667160	2669540	go into sudden death when you know
2669540	2671480	you're just minutes away from a solve.
2671500	2673160	Yeah, but it looks like
2673160	2675500	over on Blue Water,
2675500	2677420	they're trying to read from an invalid
2677420	2679560	address and that really looks like
2680360	2681520	just random data
2681520	2682720	on the stack.
2682980	2685320	They're reading to what's in their RBP.
2685320	2687200	Oh, they're scrolling so fast.
2688840	2691680	Oh, RBP is argv0.
2692200	2693780	Or a pointer to argv0.
2693780	2695820	So they're too far down the stack.
2698060	2699780	Okay. Sometimes it just
2699780	2701480	becomes a challenge to follow the thought process
2701480	2703740	because these competitors are so fast.
2703740	2705360	Oh, and they have five different threads
2705360	2706780	going at once. Yep, they're trying
2707280	2709240	different ideas, seeing what
2709240	2711320	sticks. Yeah.
2711320	2713400	And really, we give a
2713400	2715560	general category of
2715560	2717200	what the challenge is.
2717200	2719140	So I think this one was old school Pwn
2719140	2721320	as the hint or something like that. Or as the
2721320	2723040	category we give the competitors.
2723360	2725240	So outside of that,
2725240	2727200	they don't have anything. They don't know whether to
2727200	2729120	send, you know, the guy that
2729120	2730280	wrote House of
2730820	2732840	Blue 42 or whatever.
2733160	2734080	Yeah, there's
2735940	2737380	we try to
2737380	2739080	set them up this go around
2739080	2741540	with information at least categorical
2741540	2743560	so that they can say,
2743560	2745560	hey, you're better at heap challenges, you're better at stack
2745560	2747620	challenges. And we
2747620	2749920	see that second...
2749920	2751440	Second hint, query 1
2751440	2753660	uses strcpy was the hint.
2753660	2755320	Both competitors already there.
2755320	2757500	Already knew that, yeah. So I don't think hint 2
2757500	2759500	is going to be that helpful. I mean, really,
2759500	2761600	at this point, they have everything they need.
2761980	2763540	You know, we're
2763540	2765540	not going to say, oh yeah, this gadget
2765540	2767460	is at this offset. That's so
2767460	2769580	incredibly free. They need to know what they're looking for.
2769580	2771520	They need to have an idea of what they need next
2771520	2772840	in the exploit chain.
2773760	2775320	But it looks like they're getting
2775320	2776840	hung up on kind of
2777700	2779220	how do I get a leak?
2779540	2780740	True, true. I mean,
2781280	2783360	yes, we could have put the hint as
2784100	2785380	maybe this gadget would be
2785380	2787320	helpful. And I think that both of these
2787320	2789400	competitors honestly would really appreciate that right now.
2789400	2791440	Then it would just be a race to see who can
2791440	2793100	type in that address faster.
2793100	2795100	It's just monkey type at that point.
2796560	2797720	I think on the
2797720	2799820	undefined side, we're seeing
2799820	2801720	some PwnTools use that
2801720	2803440	they're resolving symbols
2803440	2805960	to get those addresses automatically.
2806360	2807120	I think that that's
2808300	2809620	I'd love to see the power
2809620	2810720	users of
2812380	2813740	libraries, frameworks, tools
2813740	2814620	and see how
2815760	2817800	they can make their lives easier. Because I really feel
2817800	2820440	like that should be faster.
2820440	2821760	Oh yeah, PwnTools has
2821920	2823860	a lot of great bells and whistles on it.
2823860	2825620	It has a lot of great functionality for
2825620	2827380	mundane tasks.
2827860	2829880	Like calculating offsets, working from a
2829880	2831780	base. You don't need to have some libc
2831780	2833780	base variable in there. You can just load the
2833780	2836140	elf setBaseAddress once and then work relative
2836140	2839020	to that with symbols. It's really nice.
2839020	2842440	Yeah, and this
2843720	2844160	this
2844160	2845000	RobGadget
2845000	2846800	interaction that they're doing is very cool.
2846800	2849780	I don't think I've seen this tool.
2849780	2850480	Yeah, so what tool
2850480	2852700	are they using? I can't read there.
2851620	2853620	RpLin64
2853500	2854640	could be a custom
2854640	2856840	tool. Oh, it could be. I'm a fan of
2856840	2859200	like Ropper. RopGadget is a classic.
2859200	2860760	Well, I think actually what we were seeing
2860760	2862540	was a grep output that they could scroll
2862540	2864620	through and highlight lines, which
2865200	2866800	was... Yeah, we have
2866800	2868820	or we had in RPiSec a tool
2868820	2870720	called Grepper, g-r-e-p-r
2870720	2872460	that would
2872460	2874660	do RopGadget search and then provide a nice
2874660	2876860	live filterable view of all the gadgets
2876860	2878600	and you can use like regexes in there.
2878600	2879700	It's really nice.
2879700	2881740	Yeah, stuff like that.
2881740	2883640	I mean, it seems simple
2883640	2885660	but you put enough of these
2885660	2887400	simple tools
2887400	2889320	put them together and it
2889320	2891580	makes your life easier, which equates to
2891580	2893700	faster solve. Hopefully
2893700	2896000	it does because we see
2896000	2897520	so close
2897520	2899940	we see blue...
2899940	2900980	Oh, wait.
2901880	2903640	Alright, so they're looking for pops
2903640	2905780	still. Over on
2905780	2907980	blue water we also saw them looking at
2907980	2910060	that pop rbp ret
2910060	2912480	call or gadget again.
2912620	2913980	Yeah, they're both looking
2913980	2916000	for that. Yeah, but
2916000	2917900	because they've got control over rbp
2920140	2921920	That's going to put them maybe in some
2921920	2924100	random invalid address because
2924100	2925960	there's just data after that before their
2925960	2928120	buffer. They really need that
2929380	2929940	that
2929940	2932000	stack ink or deck
2932000	2933900	I forget which one it is. I think it's ink.
2936850	2937630	Yeah, and this is
2937630	2938850	this is tough because
2940630	2941790	you never know
2941790	2943690	what exactly is going to be
2943690	2945910	the gadget that's going to do it for you going in
2945910	2947710	and everything's easy to look at in
2947710	2949890	retrospect, right? Oh, yeah. No, CTF
2949890	2951970	is a lot about making do with what you have.
2951970	2953630	And you can easily
2953630	2955710	accept that all you have are the
2955710	2958190	gadgets and the binary. There aren't any nice ones there.
2958190	2959850	But at least take a cursory
2959850	2961630	look. Oh!
2961630	2963710	Move racks rsb. Add
2963710	2965450	racks. Oh!
2965450	2968050	Okay, he found the nice gadget.
2968590	2969490	4019fd. My
2969490	2970770	favorite address.
2971530	2973650	It's up there in me. It's like
2975010	2975570	it's in
2975570	2977510	the top 4 billion, I want to say. Yeah.
2977670	2978550	Roughly.
2980770	2981570	At least
2981570	2982610	the 32 bit.
2983410	2985770	So this is exactly what we talked about.
2986370	2987590	They're going back
2987590	2989190	to the gadgets, finding the
2989650	2991470	thing that's going to make their life easier
2991470	2993510	and I think at this point it's just a matter of
2993510	2995250	time. Oh yeah. So it looks like
2995250	2997750	BlueWater found the nice gadget they're working through.
2997810	2999710	That pop is going to take them exactly
2999710	3001830	to the beginning of their overflow.
3001990	3003650	So it should just be as simple
3003650	3005430	as inserting shellcode after that.
3005430	3007110	Almost like it was made that way.
3007330	3009430	Imagine. Alright, let's take a look at
3009430	3010470	Undefined.
3011090	3013310	Looking through stack addresses here.
3013310	3015850	Trying to understand what they control.
3015850	3017350	What this pointer specifically
3017350	3019170	is looking at. You know, the pop, rut
3019950	3021430	kind of gadgets.
3022670	3023450	They're looking to see
3023450	3025650	if that's useful for them. They are.
3025650	3026910	And then over on
3027410	3028990	BlueWater, they're on the stack.
3029310	3031490	And I see that syscall instruction. I see push0x3b
3031490	3033430	syscall. They walk through it. They just
3033430	3035190	have registers set up wrong it looks like.
3035190	3036670	I couldn't see quite in time.
3039110	3040690	So they might just have offset
3041170	3043190	1. Might be missing the first instruction
3043190	3045110	in that chain. Could just be a XOR
3045110	3046970	of like RCX or something.
3047050	3048930	Yeah, I saw that they were using the PwnTools
3048930	3050510	built-in shellcode. So
3050510	3052810	probably not any mistakes there.
3052810	3055410	No, it's very thorough. It's verbose.
3055410	3056850	But making sure that that
3056850	3057770	came through
3059190	3060750	untouched, you know, completely
3060750	3062850	valid, that looks like what they're
3062850	3064730	doing there. Yeah, I don't know if PwnTools
3064730	3066890	shellcode actually has nullbytes in it.
3067330	3068990	It might have nullbytes.
3070390	3072810	Which would really break
3072810	3074930	this flow here. Because it would stop reading the string.
3074930	3076630	But no, it got to the syscall.
3076630	3078150	So it can't have nullbytes in there.
3078150	3079930	So there's the call. He's looking at
3080890	3082470	this. Alright.
3082470	3084630	Oh yeah, that's...
3086050	3086490	ESPDI
3086490	3088430	REF RSP. Probably doesn't want that
3088430	3089850	at the beginning of his shellcode.
3090190	3091210	Does he?
3092150	3093930	I don't know.
3093930	3096510	Oh, and I just got word that we're heading to sudden death.
3096510	3098330	We're heading to sudden death?
3100870	3101750	No!
3102570	3104410	He's on his shellcode!
3106630	3107510	Oh my gosh.
3107930	3110850	No! Oh, don't save the database.
3110850	3112130	You can feel it.
3112130	3113650	That's so upsetting.
3113930	3116330	Oh, he's deleting the challenge.
3117170	3118930	Oh, that's so sad.
3118930	3121430	He was walking through his shellcode.
3122950	3124430	But we mentioned...
3124430	3126270	I made sure to mention 50 minutes.
3126270	3127830	We're going to sudden death.
3127830	3130330	That is so sad.
3130330	3132310	So we're having some technical difficulties
3132310	3134450	with the camera here
3134450	3136450	on our end, but...
3136970	3138510	Oh, so we're just going to stay
3138510	3140150	on bracket view for a bit.
3140670	3142830	I don't know which way this is going to go.
3143090	3144410	Undefined was working slowly
3144410	3146750	through it. They were about to find the gadget, I'm sure.
3146790	3148350	BlueWater just found it.
3148350	3150530	Yep, they were just looking through gadgets again.
3150530	3151410	Oh man.
3152610	3154450	Oh, that's...
3156190	3157550	You know that...
3157550	3160130	It wasn't guaranteed to go one way or another because BlueWater
3160130	3162450	was just starting to debug where they were
3162450	3164510	jumping to. I think that they were very close.
3164510	3166710	You saw them highlighting the first instruction in their payload
3167270	3168450	and it was just...
3169830	3170550	As far
3170550	3172690	as I know, bad.
3172690	3174130	It was just a bad instruction.
3174530	3176570	Well, not bad instruction, but it was bad instruction to have
3176570	3178490	in your payload. It wasn't the right
3178490	3179270	instruction.
