[00:11.580 --> 00:17.440] And we're back. Live CTF here at DEF CON. And I'm Mark Griffin and I'm joined this time [00:17.440 --> 00:24.060] by Josh from Vector35. Yeah, Josh aka Negasora on everything I'm on. And it's been fun working [00:24.060 --> 00:29.040] on this. It's my first time on camera for it. I think, oh my gosh, maybe ever. You're [00:29.040 --> 00:32.740] welcome. Yeah, thank you so much seasoned veteran like yourself. Yeah, right. My second [00:32.740 --> 00:37.840] time. Yeah. No, but I've been working behind the scenes and just set up infrastructure [00:37.840 --> 00:43.700] to be one script that works. So I think without further ado. Yeah, let's get into it. So again, [00:43.700 --> 00:47.880] this is the third challenge. We got matches five and six. Bluewater versus Macaroni and [00:47.880 --> 00:53.160] we'll be commenting Super Dice Code versus Hypoid. Yeah. So Bluewater, Macaroni, team [00:53.160 --> 01:00.560] one versus team eight seated. And then Super Dice Code placed fourth and falls Hypoid 12th. [01:00.560 --> 01:04.200] So I think these are going to be pretty good matches. There could be an upset here. I'm [01:04.200 --> 01:07.800] excited to see it. So should we just get into it? All right. Yeah. Let's start the challenge [01:07.800 --> 01:18.200] in five, four, three, two, one. Go. Go. And we're live. Let's watch. And I think we can [01:19.640 --> 01:26.800] watch and get right into it. Oh, very nice. All right. So this is a challenge called Shop [01:26.800 --> 01:34.380] that I wrote. Oh, God. Three months ago. Yeah. Let's go three months ago and not a month ago. [01:34.380 --> 01:39.420] Super fresh in your mind. Super. Oh, it's real. You know, I still think about it. Never. [01:42.080 --> 01:47.540] It's a simple one. I'm not going to lie. You know, it should be one of the faster matches, [01:47.540 --> 01:52.120] but it should still be interesting to see the way they approach it because it is open ended [01:52.120 --> 01:57.940] enough that there are there's more than just my intended solution. Yeah. And, you know, of course, [01:57.940 --> 02:02.700] with the time pressure and the environment and these these folks have been working hard on the [02:02.700 --> 02:07.540] DEF CON CTF final. So they're under a lot of pressure, a lot of mental fatigue already, [02:07.540 --> 02:13.840] I'm guessing. So definitely even the easiest problems can become hard. Yeah, absolutely. [02:13.920 --> 02:18.420] But we see Super Dice Code getting right into it, dropping it into IDA, starting to [02:18.420 --> 02:24.720] starting to annotate, fill out the the names of everything so they can really figure out what's [02:24.720 --> 02:28.740] going on. Now, interestingly, Hypeboi, instead of dropping it directly into a decompiler, [02:28.740 --> 02:33.800] well, OK, as I say that, but they were just interacting with it. They just wanted to see [02:33.800 --> 02:38.300] what the flow was before they even took a look at it, which honestly, that's usually my approach. [02:38.300 --> 02:42.560] If I know it's not like malware in the CTF setting, I just run the thing and I'm like, [02:42.560 --> 02:46.440] OK, it prints here. Let's step back from the first print and see if anything weird happens. [02:46.440 --> 02:50.700] Then I continue forward. Yeah, you know, I find it's really interesting. There's really [02:51.380 --> 02:56.220] a lot of different opinions on how to go about it. Some people like to go completely static until [02:56.220 --> 02:59.980] they have an idea of what the bug is, and some people just want to jump in and start interacting [02:59.980 --> 03:06.320] with it. The people that just look at a binary statically and get it, like just have a solution [03:06.320 --> 03:12.400] from it. I don't know how they have the stack layout in their mind like that. I try to remember [03:12.400 --> 03:18.600] and it pulls a memory overflow. Yeah, some of my good friends. But yeah, me, I love dynamic [03:18.600 --> 03:24.060] analysis. I want to see it in the debugger. That's how I operate. And I think I already [03:24.060 --> 03:29.480] see a debugger popping open. Yeah, that's fast. Oh my gosh. OK, so they're going through the [03:29.480 --> 03:34.300] interaction loop right now, at least over on Hypeboi they are. Yeah, we're looking at Hypeboi. [03:34.380 --> 03:40.140] And let's see. So it's a shop interface. You can open accounts, you can look at shelves, [03:40.140 --> 03:46.160] log into an account. And this is a fairly standard format for a CTF problem, right? [03:46.160 --> 03:50.380] Where there's a menu and you've got different options and each option sort of presents you a [03:50.380 --> 03:55.440] different functionality. And usually it's a combination of those functionalities that you [03:55.440 --> 04:00.320] use to leverage a bug, right? Oh, yeah. Yeah. Whenever I see a menu pop up, my first thought [04:00.320 --> 04:04.520] is heap. And then if I don't see mallocs or anything in there, I'm just like this author [04:04.520 --> 04:10.380] has no idea. Yeah, well, so the last challenge, for example, no menu. It was a straight stack [04:10.380 --> 04:17.500] buffer overflow. The bug was in parsing. And in this case, we're looking at a heap bug and the [04:17.500 --> 04:26.640] menu is classic. Though I think that this one, it's not exactly your typical heap, right? Like [04:26.640 --> 04:32.820] usually there's like one setup, add, delete, print sort of thing. It looked like there was a little [04:32.820 --> 04:36.040] bit more going on in this one. There's a little more going on. You have to do a little bit of [04:36.040 --> 04:40.980] heap manipulation to actually get things to line up where you want it. The gist of it and actually [04:40.980 --> 04:48.440] super dice code just was in the win. Yeah, the win function here. So they already marked a [04:48.440 --> 04:53.680] condition as the win flag, which, you know, it's like an admin check kind of. Okay. I was going to [04:53.680 --> 04:58.340] ask, was it labeled win function? Because I know some of the these like faster challenges. I think [04:58.340 --> 05:05.020] yeah, this is stripped. So they're, they're working from nothing. Gosh. And that's, that is [05:05.020 --> 05:13.260] something that for me, I, I really just love it when I see symbols in a binary, if it's stripped [05:13.260 --> 05:18.880] and you have to, you have to manually annotate what each variable is or function, it can be [05:18.880 --> 05:23.460] time consuming. Yeah. Allow me to be a shill for a second, but Binary Ninja just got auto var naming. [05:23.460 --> 05:27.800] So like, honestly, it's been kind of nice. I used to, when I was testing one of your challenges, [05:27.800 --> 05:32.400] it just sped it up. And that's a good point. And you know, one of the things that I'm [05:32.400 --> 05:41.480] interested to see here is that we've got amazing competitors with really all sorts of tools, but [05:42.120 --> 05:47.900] I think that I've largely just been seeing IDA and debugger use and, you know, phone tools for [05:47.900 --> 05:52.820] scripting, but not a whole lot else. And I was curious what people might bring to these [05:52.820 --> 05:58.580] challenges, whether it's something like anger, symbolic execution, or, or the shellfish team [05:58.580 --> 06:03.840] didn't go for anger, right? I I'm thinking it's a second language for them, which it probably is, [06:03.840 --> 06:08.920] but I does their first language, especially, I think it was Kyle bought for shellfish. [06:08.920 --> 06:15.900] So that doesn't surprise me. But yeah, but with a bug like this, what, what, what's your approach? [06:15.900 --> 06:20.740] So you, we've talked about, okay, so there's a menu, but you know, what's your approach for [06:20.740 --> 06:24.300] trying to find a bug when you see that menu? What are you looking for? [06:24.300 --> 06:35.200] So when I see that menu, I want to look for like misuses. So passing to realloc, malloc zero, [06:35.200 --> 06:40.700] you know, just like an unchecked free, especially in custom memory implementations. [06:40.700 --> 06:46.300] That's a really big one. So those are the first step. And then I go through, I annotate structures. [06:46.300 --> 06:51.240] I want to see like, is it going to be a fast spin thing? Is it going to be a T-cache thing? [06:51.340 --> 06:56.820] Like, because if it's a T-cache thing, you know, it's ABC, it's like a formula. [06:58.140 --> 07:02.660] So I'm looking to see kind of what the allocated chunks would be, how they can push each other [07:02.660 --> 07:08.180] around. If I have any likely, like, or if I have an overwrite, like how far invented out it can I [07:08.180 --> 07:15.440] get, et cetera. Yeah. And, and so you brought up a fast spin T-cache. I think that it's really [07:15.440 --> 07:20.900] important for a lot of folks who are newer to this, that you can get a challenge like this, [07:20.900 --> 07:25.780] and maybe you don't know those techniques, and it can be really intimidating. But a lot of the time, [07:25.780 --> 07:31.760] it is more procedural, I think, than people make it. Once you understand the bug primitive, like, [07:31.760 --> 07:36.300] what does this really give you or allow you to do that you shouldn't be able to do? From there, [07:36.300 --> 07:40.920] as you said, you can say, oh, well, this is, this is playing into, you know, [07:40.920 --> 07:45.960] using a T-cache-based technique or something similar. Really, hacking is just that. It's [07:45.960 --> 07:51.780] building on, you know, baby steps of knowledge and kind of inching closer to your goal. And that's, [07:51.780 --> 07:58.460] you know, hackers are notorious for, you know, having code that works, but it's built on a pile [07:58.460 --> 08:05.760] of hacks. Like, but that, that's kind of a thought process you pick up, is you make tiny steps [08:05.760 --> 08:12.320] towards the eventual goal. Yeah. So, let's take a look at, let's switch over to Hypeboi here. [08:12.560 --> 08:15.900] So, what are we seeing on the, what does it look like they're doing with their debugger over there? [08:15.900 --> 08:21.080] Okay. So, they actually just got double free in T-cache. Oh. Very nice. Making good progress. [08:21.080 --> 08:25.240] Yeah, that's making great progress. I think it's making great progress. I don't remember [08:25.240 --> 08:32.860] the solution right now. It sounds really familiar. But, well, I can see, it looks like they're using [08:32.860 --> 08:38.900] Jeff as their GDB init script. And it looks like they've got a heap helper that they're using, [08:38.900 --> 08:43.260] right? To tell them what they've got. Oh, and those can be invaluable. I used that [08:43.260 --> 08:46.080] when developing this challenge. Yeah. And it was just so nice helping [08:46.940 --> 08:52.400] figure out what the layout was. I used Pwnbag, Pwndebug. But I used to use Jeff. [08:52.940 --> 08:56.760] Both of them are fantastic. Used to use PdoA before that. Yep. [08:58.760 --> 09:02.700] Let's see. So, they're going through, they're figuring out that there's a max number of users. [09:02.860 --> 09:10.100] No. Oh, they're just figuring out that users is a linked list. Okay. [09:11.480 --> 09:18.460] So, going through, figuring out how they get to the double free. And there's a common technique, [09:18.460 --> 09:25.660] or a common technique. There's a way to avoid detecting tcache double frees. And that's to [09:25.660 --> 09:36.020] something in between. You know? It's dumb. But glibc is itself. So, let's see. Setting break [09:36.020 --> 09:40.620] points in... I shouldn't have stripped this. It makes it hard to commentate. [09:41.060 --> 09:43.980] It looks like they're setting break points in the checkout. [09:44.040 --> 09:51.320] Though I will say, it may not be easy to tell from the streams, but these folks are extremely [09:51.320 --> 09:56.840] fast. Oh, they're crazy fast. They are annotating as they're going. And they're typing so fast. If [09:56.840 --> 10:02.020] we had them on the stream, you know, it's just... Oh, it's wild. It's crazy. You see the people... [10:02.020 --> 10:06.500] They're so fast. Yeah. And you think one person is going fast and the other person just suddenly [10:06.500 --> 10:14.320] jumps like five steps ahead of them. It was last match, I think, where... no, two matches ago, [10:14.320 --> 10:18.240] where someone was building a ROP chain before the other guy even started. Other guy just [10:18.240 --> 10:22.380] knocked one out immediately. The guy was still debugging. The first guy was still debugging it. [10:22.380 --> 10:26.140] He's like, oh, my God, I can't believe it. When you're in these high-pressure, you know, [10:26.140 --> 10:32.160] race situations, your thinking just goes all over the place. Your heart rate's up. You're thinking, [10:32.160 --> 10:35.840] like, oh, how far is he? Did he find something I didn't like? He's been paused for kind of a [10:35.840 --> 10:41.160] long time now. Is he just watching his script run? Like, so many things going through your mind. [10:41.160 --> 10:45.960] Yeah, I really feel like it's stops and starts, you know? Like, you will be... [10:46.340 --> 10:50.880] okay, I see what I need to do here. Get there. And then you need to stop and think and explore [10:50.880 --> 10:55.120] what's the next step. And then, especially at this level, once they know what that next step [10:55.120 --> 10:59.100] is, they are off to the races. Oh, yeah. And it's just bing, bing, bing, bing. And then, [10:59.100 --> 11:02.760] okay, what's the next thing that they have to figure out? Getting from point A to B is something [11:02.760 --> 11:06.820] they've done thousands of times. Yeah, yeah. There really is a lot of practice. In fact, [11:07.300 --> 11:14.020] before we went live on the stream on the last one, I saw one of the competitors pop and open [11:14.140 --> 11:19.540] a challenge binary from a year past or something and practicing right there, right before they went [11:19.540 --> 11:27.340] into this match. Getting his APM up. Oh, my God. You know, you can't... there's so much work that [11:27.340 --> 11:32.620] goes into building the knowledge and the reflexes that these competitors have. Oh, yeah. And just [11:32.620 --> 11:37.320] kind of the sixth sense you get for it, like something sticks out to you that looks totally [11:37.320 --> 11:42.160] mundane and you don't know why. Yeah, that's... I think that that's something that I hear from [11:42.800 --> 11:48.420] pretty much every really seasoned CTF player or vulnerability researcher is, [11:48.420 --> 11:52.960] this looks wrong. There's something wrong here. I may not be able to tell you yet what it is, [11:52.960 --> 12:02.140] but I know something's wrong. Let's pop over to SuperDiceCode. Now, they're [12:02.140 --> 12:04.920] still going through labeling a lot of this stuff. [12:05.520 --> 12:10.740] It looked like they had a little bit more progress than the last time we were looking at them. [12:10.740 --> 12:16.640] So, it looks like they're looking for overflowing a field in the password entry. So, [12:17.260 --> 12:22.160] they've annotated in the comments some field offsets is what it looked like or maybe sizes. [12:22.300 --> 12:25.780] And now they're typing out the struct. Okay, nice. [12:27.420 --> 12:31.880] Oh, yeah, they just pulled it in. Pulled out the decouplation. And now they're... yeah. [12:33.340 --> 12:41.080] Interesting. So, this is a big step of the process is just figuring out what the structs are. [12:41.780 --> 12:45.640] Because when it comes down to it, if you don't know that, you're going to be staring at [12:45.640 --> 12:50.680] I plus 18 and you're going to be thinking like, which one was that again? [12:51.120 --> 12:56.900] Yeah, this is a lot of the behind the scenes work with reverse engineering that I think [12:56.900 --> 13:03.640] if you're an old hand at it, if you're a veteran, you know there's a lot of that [13:03.640 --> 13:09.140] work that you need to do in order to really understand what's going on and have a sense. [13:09.140 --> 13:15.160] And usually, that's not a fast process, especially if you've got a strict binary [13:15.160 --> 13:21.340] or a really large binary. And so, it's really interesting with these speed matches. [13:21.680 --> 13:26.340] You don't want to be spending time annotating, but you kind of have to in order to understand. [13:26.340 --> 13:30.740] Absolutely. It's cost benefit. It's, you know, retaining knowledge in the binary versus [13:30.740 --> 13:32.440] you're losing time for it. [13:32.440 --> 13:36.820] Right. I just saw I'm checking out that admin check, which I'm sure is going to be... [13:36.820 --> 13:38.900] Well, it only lets the best admins through. [13:39.380 --> 13:42.260] It's infallible, obviously. You shouldn't even look at it. [13:45.750 --> 13:49.770] And I'm noticing here, it's interesting that they're flipping back and forth between [13:49.770 --> 13:53.390] the disassembly and the graph view and the decompilation. [13:54.250 --> 13:58.290] Yeah, going in graph view, it's really nice to see kind of interaction loops and switch cases [13:58.830 --> 14:02.910] laid out in front of you and see if there are any complex paths it can take. [14:02.910 --> 14:03.570] Yeah. [14:03.870 --> 14:05.590] And then linear is just nice. [14:05.590 --> 14:10.870] True. I don't know about you, but for decompilation, I want it linear. [14:10.870 --> 14:13.710] But when I'm looking at assembly, I want it in graph view. [14:13.870 --> 14:20.270] And I mean, I learned to RE on disassembly and graph view. [14:20.270 --> 14:21.690] So that's very comfortable for me. [14:21.690 --> 14:24.770] I know some people are linear disassembly all the way. [14:24.770 --> 14:30.210] I like linear because that's how I learned to write assembly, you know, in a file. [14:30.210 --> 14:32.610] So that's how I read it. [14:33.210 --> 14:37.290] Yeah. And I think that, you know, we were just talking about how much time you have [14:37.290 --> 14:40.010] to spend REing or annotating. [14:40.690 --> 14:47.150] One of the things that I was taught and I pass on to anybody that I teach about reverse [14:47.150 --> 14:52.210] engineering is you really want to spend as little time as possible annotating or like [14:52.210 --> 14:54.530] diving into what does this function do? [14:54.530 --> 14:57.870] Unless you're absolutely certain that that's an important function, [14:57.870 --> 14:59.650] because especially in a match like this. [14:59.650 --> 15:00.210] Oh my gosh. [15:00.210 --> 15:03.410] Imagine, you know, there's this function that doesn't really do anything. [15:03.410 --> 15:04.450] The rabbit holes. [15:04.450 --> 15:05.930] Yeah, the rabbit holes. [15:05.970 --> 15:11.810] How many times have you like just gotten dragged into like an optimized stir comp function [15:11.810 --> 15:16.830] or like something that's so obvious when you look at it, when you look back at it? [15:16.830 --> 15:17.070] Right. [15:17.070 --> 15:20.370] But when you're in there, you're just like, oh, this, this moves so much memory around, [15:20.370 --> 15:21.850] like it has to be doing something weird. [15:21.850 --> 15:22.710] There's an offset missing? [15:22.710 --> 15:25.470] No, it's totally fine. [15:26.030 --> 15:30.170] Yeah, and that's something where having the experience, the reps, [15:30.170 --> 15:35.130] understanding common algorithms and what they look like in the decompiler or in the graph, [15:35.130 --> 15:40.290] disassembly graph view can really pay off because, you know, I've been there and I'm sure you have, [15:40.290 --> 15:44.890] or been there working with a team member where they pop open a function and it's, [15:44.890 --> 15:47.610] you know, stripped or whatever, and they just look at it and go, [15:47.610 --> 15:51.190] yep, that's quicksort or that's this hash function. [15:51.210 --> 15:52.650] I don't even need to read it. [15:52.650 --> 15:57.810] No, I feel like everyone competing here has been on both sides of that, [15:57.810 --> 16:00.270] where you're looking at it and you're like, I have no idea what this is doing. [16:00.270 --> 16:02.210] And it's like, no, that's just bubble sort. [16:02.490 --> 16:06.810] Or, you know, you're looking at some algorithm on someone else's screen, [16:06.810 --> 16:10.750] just like from across the room while you're waiting for, you know, Z3 to finish sometime. [16:11.030 --> 16:16.090] And you're just like, oh, you're looking at like Winston Churchill's algorithms. [16:16.370 --> 16:18.130] I couldn't think of one. [16:18.530 --> 16:20.610] Classic. I love Winston Churchill's algorithms. [16:20.610 --> 16:22.930] One of the computers of all time. [16:23.290 --> 16:25.250] Yeah. Little known. [16:25.470 --> 16:31.150] Okay. And so on the superdice code, we see that their exploit script [16:31.150 --> 16:32.750] starting to take some shape here. [16:32.750 --> 16:35.970] They're starting to put the entries from the menu into the script itself, which [16:36.510 --> 16:40.370] to me gives an indication that they've got an idea of what they're doing. [16:40.370 --> 16:42.130] Are they breaking inside of malloc? [16:47.780 --> 16:49.440] Well, I see read. [16:49.440 --> 16:54.380] Yeah. Well, at the very, oh, yeah, they have some breakpoints inside of libc malloc. [16:54.380 --> 17:00.100] Oh, do you think that maybe they have a watch point or something that prints out? [17:00.100 --> 17:03.780] Oh, yeah. It looks like it's printing out the pointer and the size for a malloc, [17:03.780 --> 17:08.060] which is very smart, especially if you don't have one of those [17:09.740 --> 17:12.860] heap introspection tools, it sort of lays it out for you. [17:12.900 --> 17:17.120] Yeah. Well, this also just sees because, you know, you could have the heap layout in front of you, [17:17.120 --> 17:18.780] but you don't know the previous state of it. [17:18.820 --> 17:22.600] This kind of helps you figure out, oh, I need to move this allocation later. [17:22.600 --> 17:29.340] Yeah. Yeah. And I'm sure that the the tension is just mounting. [17:29.340 --> 17:34.380] And when you when you have to do that sort of thing and instrument malloc. [17:34.380 --> 17:37.020] Yeah. That's that's tough. [17:37.020 --> 17:38.500] All right. Let's take a look at Hypeboi. [17:38.500 --> 17:41.980] Yeah. Hypeboi, it looks like they're making some progress on their exploit. [17:42.460 --> 17:47.520] They have once we see it, they have interaction wrappers. [17:48.380 --> 17:51.320] No, they don't. They just have commands they're sending raw. [17:52.820 --> 17:56.740] Looks like they've got they've tried a few things based on what I'm seeing commented. [17:56.740 --> 17:59.760] Oh, yeah. And they're what is that? [17:59.760 --> 18:04.960] To creating a user to zero is add an item to cart, I think. [18:04.960 --> 18:06.400] Then they log out. [18:06.560 --> 18:09.540] OK, that's sounding like like they're moving towards the solution. [18:09.540 --> 18:10.840] It sounds like they figured something. [18:10.840 --> 18:13.040] Oh, and look, they're laying out the chunks and the sizes. [18:13.260 --> 18:18.240] OK. And you see them counting with the mouse. [18:18.320 --> 18:20.100] I love that. I do that. [18:21.000 --> 18:24.760] Yeah, I don't know about you, but it's often the case for me where [18:24.760 --> 18:28.580] I will be trying so many things out in a script that by the end of it, [18:28.580 --> 18:32.880] it's like three quarters is junk that I never went down a rabbit hole. [18:32.880 --> 18:33.920] Nope, that's not what I want to do. [18:33.920 --> 18:35.160] And just commented it out. [18:35.160 --> 18:38.060] And there's like five lines of actual work. [18:38.060 --> 18:39.960] Yeah, absolutely. [18:39.960 --> 18:42.100] Well, you have to do the work to get the final result. [18:42.600 --> 18:44.660] You can't just sit down and have a solution to this. [18:44.660 --> 18:46.620] You need to work on it. [18:46.620 --> 18:48.700] And we see him going through it really fast. [18:50.280 --> 18:53.120] Yeah, so fast, just flipping through screens. [18:53.120 --> 18:55.540] They have this understanding in their head [18:55.540 --> 18:58.100] of the shape of this and what they're trying to do. [18:58.100 --> 19:02.620] And you can see him moving between IDA and their terminal and debugger. [19:02.620 --> 19:07.140] So it looks like HiPoI hasn't defined a user struct yet. [19:07.140 --> 19:11.280] So I don't know if they're just writing it off or if there have been other places. [19:11.500 --> 19:13.600] Or maybe they just didn't assign it in that case. [19:13.920 --> 19:18.280] Well, you know, as we were saying, it takes time to build struct annotations. [19:18.280 --> 19:20.420] Depending on what you're used to doing, [19:21.840 --> 19:24.820] maybe they just felt like they didn't have time for it. [19:24.840 --> 19:26.500] True, maybe they don't need to. [19:28.340 --> 19:33.400] If we take a look on the super dice codes tied here, [19:33.400 --> 19:37.280] I think I just saw a double free or a tcache issue. [19:37.280 --> 19:38.840] So I feel like they're making progress too. [19:38.840 --> 19:40.260] Okay, very nice. [19:41.660 --> 19:43.460] Yeah, because they took kind of different approaches, [19:43.460 --> 19:47.280] it doesn't surprise me that HiPoI got the first tcache free or tcache double free. [19:48.280 --> 19:51.680] Because it looks like super dice code has way more marked up. [19:52.020 --> 19:53.920] I noticed that, yeah, as they were going on, [19:53.920 --> 19:56.680] they were consistently just annotating, annotating. [19:56.680 --> 19:59.880] Yep, we can see they're using phone debug [19:59.880 --> 20:04.020] and getting the heap helper to lay out what's going on. [20:04.020 --> 20:06.900] Yeah, it may not look it, but these are like two very different approaches. [20:06.900 --> 20:11.420] HiPoI going highly dynamic, super dice code going methodical. [20:11.460 --> 20:12.700] Well, they're both methodical. [20:12.700 --> 20:15.060] But going static and then running, you know, [20:15.060 --> 20:17.660] figuring out if his assertions hold. [20:17.660 --> 20:18.300] Right. [20:18.960 --> 20:21.340] And then going back and annotating some more. [20:22.240 --> 20:27.640] And I just saw, I don't know if we've seen checksec yet, [20:27.640 --> 20:31.120] but I am, I can't remember what the mitigations were on this. [20:31.120 --> 20:32.800] Oh, I'm surprised, yeah. [20:32.980 --> 20:33.840] Really shaped. [20:34.460 --> 20:35.740] Well, it's a heap exploit. [20:35.740 --> 20:38.980] No, no, this has like full railroad, it has pi. [20:38.980 --> 20:40.000] Okay, okay. [20:40.160 --> 20:41.500] It has canaries. [20:41.500 --> 20:44.480] This isn't, if I recall, this is more of a [20:44.480 --> 20:47.460] figure out how to do a precise corruption and you win, [20:47.460 --> 20:52.440] rather than having to do a full, you know, riprop or... [20:52.440 --> 20:52.880] Yeah. [20:52.880 --> 20:57.900] So once you get, you know, some write primitive, you... [20:59.540 --> 21:01.280] Well, no, I don't think it has pi. [21:02.920 --> 21:03.940] I don't remember. [21:03.940 --> 21:06.700] But anyway, once you get a controlled write, [21:06.700 --> 21:08.340] you overwrite the admin flag and win. [21:08.340 --> 21:11.100] There was a win function there that admins get through. [21:11.360 --> 21:13.960] Which, of course, they'll never be able to do because they're not admins. [21:13.960 --> 21:15.300] Not yet. [21:15.300 --> 21:16.980] Yeah, I don't know why they're there, it's crazy. [21:17.960 --> 21:19.720] Just a matter of time, I'm sure. [21:20.220 --> 21:25.280] Yeah, but I'm, yeah, I'm surprised there's been no checks there. [21:26.200 --> 21:28.720] I guess they just haven't found anything to warrant it. [21:29.340 --> 21:35.800] Right, well, you know, if it is a heap bug, then your first question probably is, [21:35.800 --> 21:38.160] like, what's the bug, right? [21:38.160 --> 21:38.820] Yeah. [21:40.320 --> 21:43.100] Not an admin, so we see them poking at that, [21:43.100 --> 21:45.560] seeing the system call right there. [21:45.560 --> 21:46.820] They know they want to get there. [21:47.040 --> 21:47.380] Yeah. [21:49.240 --> 21:51.700] Ah, so, yep, now they're starting to figure out, [21:51.700 --> 21:54.580] okay, what do I need to change to get there? [21:54.720 --> 21:55.660] Got it. [21:57.520 --> 22:00.760] Oh, yeah, and they're not even calling names, they're calling them chunks. [22:00.780 --> 22:03.820] They don't care what they are, they just care about the memory they use. [22:03.820 --> 22:04.500] Right. [22:07.500 --> 22:08.400] All right. [22:11.020 --> 22:14.000] Yep, okay, so we see that they've got on one side, [22:14.000 --> 22:17.520] they've used their debugger to instrument the malloc and free calls, [22:17.520 --> 22:22.320] see exactly which pointers are getting allocated when, as they're interacting with it. [22:22.320 --> 22:24.100] And that's very fast, they've got it in their head. [22:24.100 --> 22:24.780] That's really fast. [22:24.780 --> 22:27.520] Yep, this command is going to malloc the free mode. [22:29.540 --> 22:36.980] So, I feel like they're getting closer and closer. [22:36.980 --> 22:38.480] All right, error removing item. [22:41.750 --> 22:42.610] All right. [22:42.610 --> 22:43.930] Man, they're moving so fast. [22:43.930 --> 22:44.030] All right. [22:44.030 --> 22:45.990] Yeah, let's hop back over to Hypoi. [22:45.990 --> 22:49.450] And they're making good progress. [22:49.450 --> 22:52.910] Looks like they've created a second user. [22:55.070 --> 22:57.770] And we'll see what else they did once they go back to their script. [22:57.770 --> 23:00.750] We have to be faster reading, because they know these scripts really well, [23:00.750 --> 23:03.650] and we have to keep track of two of them that they're writing. [23:05.310 --> 23:11.230] Yeah, so this is, I think it's funny, this is sort of the tense time when, [23:11.230 --> 23:15.050] okay, it's not a quick solve, it's starting to drag on a little bit. [23:15.050 --> 23:19.130] Like you said, there's kind of a morale aspect, but there's also hints, right? [23:19.190 --> 23:20.570] There's two hints. [23:20.610 --> 23:24.670] I think they're at, what are they, 25 and 40 minutes? [23:25.230 --> 23:28.090] 20, 35, something like that. [23:28.090 --> 23:28.270] Yeah. [23:28.270 --> 23:32.430] So, they're probably, I don't know how long we've been going here, [23:32.430 --> 23:37.630] probably right about on the first hint or so, as far as timing. [23:38.010 --> 23:43.630] And it's up to the challenge authors to figure out what is the hint that we should provide [23:43.630 --> 23:49.910] to really give them a little bit of a breakthrough, and then that second hint should really be the, [23:49.910 --> 23:52.550] all right, you've got, what, like 10 minutes left? [23:52.550 --> 23:55.950] So, it should really pretty much lay it out there for them, that second hint. [23:55.950 --> 23:58.170] Oh, it does. Oh, it does. [23:59.610 --> 24:01.870] Yeah, the first hint, not very helpful. [24:02.350 --> 24:05.010] You know, it's a nudge, it's a nub in the right direction. [24:05.010 --> 24:08.230] The second hint is shooting them out of a cannon in the right direction. [24:08.950 --> 24:10.210] Sometimes you need that. [24:10.210 --> 24:11.550] Sometimes, yeah. [24:11.550 --> 24:17.150] If you get the second hint, which, to be fair, these aren't the easiest challenges in the world. [24:17.410 --> 24:19.990] Like, these aren't your CTF 50-point challenges. [24:20.490 --> 24:25.130] Yeah, and I think that that's really important to mention here, is that we sort of categorize [24:25.130 --> 24:28.350] these as easy because we want the challengers to be able to solve them. [24:28.350 --> 24:33.750] We want it to be more of a speed competition, but it is always hard to know exactly, like, [24:33.750 --> 24:37.250] what is, what's the exact difficulty level to get right? [24:37.250 --> 24:41.090] And it's really hard to judge that when you have teams from all over the world [24:41.090 --> 24:44.330] with different specialties, different members every year. [24:45.070 --> 24:47.410] And, you know, they're the best in the world. [24:47.410 --> 24:49.170] They're at DEF CON finals. [24:49.290 --> 24:50.190] Right, right. [24:51.730 --> 24:57.990] Yeah, so going back to the hints real quick, I remember on the first challenge, [24:57.990 --> 25:01.310] there was a, we were in that moment where it was a little tense. [25:01.430 --> 25:04.210] How long is it going to take to get to a solve here? [25:05.330 --> 25:10.650] And so the first hint went out, and I'm pretty sure they looked at the hint, looked at us, [25:10.650 --> 25:12.530] and they were like, all right, I already knew that. [25:12.530 --> 25:13.750] Like, let me get back to hacking. [25:13.750 --> 25:15.090] Why are you distracting me, you know? [25:15.090 --> 25:20.850] Yeah, actually, I think the first challenge, the first challenge is pretty long, right? [25:20.850 --> 25:25.490] So on the first challenge, now remember, we are, we're doing two matches, [25:25.490 --> 25:27.110] two head-to-head matches, right? [25:27.290 --> 25:34.190] And on the first challenge, the sort of other match finished very quickly. [25:34.190 --> 25:41.030] We're announcing one match, and then the other match is, you can see one stream of each player, [25:41.030 --> 25:46.330] and those players solve it quite quickly, at least 10 or 15 minutes faster. [25:46.330 --> 25:51.110] And I think that on that, it was really a, somebody noticed a detail that the [25:51.110 --> 25:56.170] challenge author left in that made it easier that I think everybody else missed. [25:56.950 --> 26:02.790] Yeah, at the end of the first challenge, I was building the, it goes long, [26:02.870 --> 26:05.430] a sudden-death challenge, and I was building it, ready to deploy it. [26:05.530 --> 26:05.890] Yeah. [26:06.070 --> 26:09.930] But right as I finished building it, I was about to ping people that, [26:09.930 --> 26:12.150] hey, we need to go sudden-death. They got dissolved. [26:12.370 --> 26:15.850] Yeah, it was a tense moment over here at the live CTF HQ. [26:15.850 --> 26:20.150] Oh, yeah. I'm really hoping we don't go into sudden-death here. [26:20.150 --> 26:22.430] Of course, because it's my challenge, I want them to solve it. [26:22.430 --> 26:22.950] Sure. [26:22.950 --> 26:26.310] But, you know, I want to give them some closure on the challenge. [26:26.710 --> 26:30.430] Right? Oh, I know, I think I saw at least one competitor who, [26:30.430 --> 26:33.390] they just wanted to finish, you know? [26:33.390 --> 26:33.790] Oh, yeah. [26:33.790 --> 26:36.350] They didn't win, but they wanted to finish. [26:36.350 --> 26:39.430] They asked, can I stay around and just please debug my ROP chain? [26:39.430 --> 26:39.950] Yeah. [26:39.950 --> 26:41.390] Like, why didn't it work? [26:41.390 --> 26:51.490] Yeah. So let's reassess where we've got SuperDiceCode and see what works. [26:51.490 --> 26:55.950] It looks like SuperDiceCode is breaking on the admin checker once again. [26:56.010 --> 26:57.770] Setting some breakpoints in their exploits here. [26:57.770 --> 26:58.950] Oh, no, they're just calm, yeah. [26:58.950 --> 27:01.450] They look like they are on their way. [27:02.050 --> 27:03.170] Username and password. [27:03.590 --> 27:04.650] Single-stepping. [27:07.710 --> 27:10.630] They have a different pwnbag layout than I do, and it's kind of messing with my... [27:10.630 --> 27:12.490] Yeah, and they're very fast, right? [27:12.490 --> 27:16.690] So I'm used to looking at Jeff, and it's just a little bit different layout. [27:17.870 --> 27:19.650] Yeah, we have the screens on the wrong side. [27:19.650 --> 27:21.590] I have the Jeff screen and you have pwnbag. [27:21.810 --> 27:22.970] Oh, you want to switch seats? [27:22.970 --> 27:24.050] No, I'm good. [27:27.400 --> 27:28.380] Let's see. [27:29.320 --> 27:32.620] I'm definitely looking at that login. [27:32.620 --> 27:35.160] Well, SuperDiceCode is annotating everything they can. [27:35.160 --> 27:37.120] They're getting a good understanding of the program. [27:37.120 --> 27:40.840] Even if the bug hasn't immediately jumped out at them, you know, by the time they reach [27:40.840 --> 27:46.220] that intersection of their two kind of growing ends of knowledge, something will click. [27:46.660 --> 27:50.180] Yeah, and that's, as you said, the differing approaches. [27:50.420 --> 27:57.420] I tend to be more of the, I want dynamic analysis, but I really just want it so I can enrich my [27:57.980 --> 28:06.560] static so I have a real understanding or a guarantee that what I'm looking at is what [28:06.560 --> 28:07.520] I think it is. [28:07.520 --> 28:11.260] Because if I try to do it all statically, you know, there's a lot of question marks [28:11.260 --> 28:12.600] in my variable names. [28:12.840 --> 28:15.520] Well, you can see on SuperDiceCode they have eight what? [28:15.560 --> 28:19.080] Like they have 16 password, eight what? [28:20.620 --> 28:25.400] There are so many times I just call something like underscore maybe or underscore maybe not. [28:27.600 --> 28:29.180] Offset eight thing. [28:31.280 --> 28:34.700] I'm pretty sure I saw LOL go down in a comment somewhere. [28:36.060 --> 28:36.860] Oh, here we go. [28:36.860 --> 28:37.980] Double free detected. [28:37.980 --> 28:38.440] All right. [28:38.440 --> 28:39.820] So they have double free. [28:40.260 --> 28:43.120] Need to figure out how to bypass that check. [28:45.790 --> 28:49.470] And I think you can almost feel it in the pace that they're going. [28:49.470 --> 28:51.710] They feel like they're on to something. [28:51.710 --> 28:53.110] They feel like they're close. [28:54.210 --> 28:57.810] See the TCache chain there. [28:57.810 --> 28:58.770] Comprex negative... [28:59.510 --> 29:00.750] That was an impact. [29:02.170 --> 29:03.370] That's an instruction. [29:03.370 --> 29:03.770] Okay. [29:03.770 --> 29:04.610] I don't know though. [29:04.610 --> 29:05.850] I didn't write it. [29:05.990 --> 29:07.050] I was in read. [29:09.330 --> 29:10.990] That would explain it. [29:12.050 --> 29:14.990] I did not in fact write libc. [29:15.210 --> 29:16.690] Believe it or not, I did not do that. [29:16.690 --> 29:17.750] You're not the author. [29:17.750 --> 29:18.350] No, sorry. [29:18.350 --> 29:19.630] I'm not John libc. [29:19.630 --> 29:21.610] We'll have to see if we can get them on next time. [29:21.610 --> 29:22.190] Yeah. [29:26.920 --> 29:28.420] So they're definitely... [29:28.420 --> 29:30.740] Oh, so it looks like over on HypeBoy. [29:30.740 --> 29:32.040] HypeBoy. [29:32.060 --> 29:37.180] They have just kind of highlighted Realloc as a point of interest, [29:37.180 --> 29:42.140] which may or may not be a point of interest, but they're breaking on it. [29:43.300 --> 29:44.760] There we go. [29:46.220 --> 29:52.100] So for Realloc, when you're looking at a Realloc in the context of a challenge like this, [29:52.100 --> 29:54.140] what specifically are you looking for? [29:55.540 --> 29:58.500] I mean, Realloc is such a specific thing. [29:58.500 --> 30:01.860] Going through it, it's usually totally fine. [30:01.860 --> 30:09.060] If someone calculates a size wrong, or they increment a list size, like size T, [30:09.060 --> 30:13.320] and then Realloc for it, and you have a leak at the end of it. [30:13.320 --> 30:16.620] You know, just basic things like that, where you kind of do things out of order. [30:17.540 --> 30:22.000] Also, if you pass zero to Realloc, fun fact, it's free. [30:22.080 --> 30:24.060] That's what I was going to highlight. [30:24.060 --> 30:24.700] Yeah. [30:24.960 --> 30:27.980] So that might be relevant. [30:27.980 --> 30:29.000] Yep. [30:31.020 --> 30:36.000] Realloc is always relevant if you can get a mismatch between the size value going into Realloc [30:36.000 --> 30:42.140] and the size of the field as the object itself, or how it's being interacted with. [30:42.160 --> 30:46.940] But also, if you can get that value to be zero somehow, Realloc becomes a free. [30:46.940 --> 30:51.540] And I am guessing that that's the case. [30:51.540 --> 30:55.540] You have to be real careful as a C author with that. [30:55.540 --> 30:56.440] Oh, yeah. [30:56.460 --> 30:57.620] You got to be real careful. [30:57.620 --> 31:00.520] Otherwise, you know, you might end up with tcache double free. [31:00.520 --> 31:02.280] And, you know, no one wants that. [31:02.580 --> 31:04.020] Especially these players. [31:04.720 --> 31:06.380] Oh, I think that they do want it. [31:06.380 --> 31:07.380] Oh, nah. [31:07.840 --> 31:09.440] That's not how the program's supposed to work. [31:09.440 --> 31:12.040] This is a nice little family run shop program. [31:12.280 --> 31:15.420] And they're just in here just destroying the heap. [31:17.920 --> 31:20.100] And I think I saw some... [31:20.800 --> 31:23.440] But yeah, I mean, nice shot. [31:23.440 --> 31:26.820] But I think I saw some eggs in there, and I'm just waiting for the shellcode to come out. [31:26.820 --> 31:28.700] Oh, wait, they're adding eggs? [31:29.280 --> 31:32.000] No, one of the items in the shop. [31:32.000 --> 31:33.460] Oh, shell, geez. [31:33.520 --> 31:34.100] Yep, I win. [31:34.100 --> 31:38.340] Yeah, I'm so like trying to figure out, you know, where they are in this. [31:38.340 --> 31:42.880] Because it is part of the solution to put eggs in your cards. [31:43.700 --> 31:46.860] Look, we're simple people here. [31:47.080 --> 31:49.480] We enjoy our dad jokes. [31:50.160 --> 31:52.000] You know, the in jokes in the CTF community. [31:52.000 --> 31:53.920] Oh, I saw somebody looking at the rules page. [31:53.920 --> 31:54.220] Oh, wait. [31:54.220 --> 31:56.800] Oh, they're connecting to a remote instance. [31:57.340 --> 31:59.980] Oh, they got a shell. [32:00.560 --> 32:02.360] Oh, we might be looking at... [32:02.360 --> 32:02.820] At Hypeboy. [32:02.820 --> 32:04.040] Yeah, Hypeboy got a shell. [32:04.040 --> 32:04.880] They submitted. [32:04.960 --> 32:05.980] Hypeboy won. [32:06.820 --> 32:07.500] Oh my goodness. [32:07.500 --> 32:08.320] Hypeboy wins. [32:08.340 --> 32:10.220] And they have a cute cat in their taskbar. [32:10.700 --> 32:11.520] Congratulations, Hypeboy. [32:11.520 --> 32:12.100] Well done. [32:12.200 --> 32:12.880] Well done. [32:12.880 --> 32:13.880] How long was that match? [32:13.880 --> 32:14.080] Did we... [32:14.080 --> 32:17.200] Oh, unknown. [32:17.220 --> 32:17.720] Unknown. [32:17.720 --> 32:18.540] It was a match. [32:18.540 --> 32:20.120] Oh, and they already turned off the stream. [32:20.180 --> 32:20.780] They're done. [32:21.120 --> 32:22.700] So they're over there shaking hands. [32:22.700 --> 32:24.880] Everyone's been fantastic sports. [32:24.880 --> 32:28.720] You know, it's been all smiles. [32:28.720 --> 32:30.680] No one's salty about this. [32:30.680 --> 32:31.920] It's a fun competition. [32:31.920 --> 32:33.400] People respect each other here. [32:33.400 --> 32:35.540] Everyone knows you've earned your place here. [32:35.700 --> 32:39.100] Yeah, I think I've seen disappointment. [32:39.100 --> 32:39.780] Sure. [32:39.880 --> 32:42.720] But I, you know, shaking hands. [32:43.240 --> 32:45.220] I think everybody respects each other. [32:45.220 --> 32:48.580] Everybody knows that if you're here, you have made it. [32:48.580 --> 32:53.820] And these challenges are hard for no other reason than just the environment that it's in. [32:53.820 --> 32:58.380] All of these players have already been playing in, you know, the Olympics of hacking. [32:58.420 --> 33:04.780] So to come and play this sprint on the side of it, in the middle of a marathon, if you will. [33:06.400 --> 33:08.520] Well, that was another match from us. [33:08.520 --> 33:10.100] It was a pleasure casting with you. [33:10.100 --> 33:10.460] Yep. [33:10.460 --> 33:11.420] I'm glad they solved it. [33:11.420 --> 33:12.740] Great working with you, Josh. [33:13.320 --> 33:14.960] And good job on the challenge. [33:14.960 --> 33:18.940] I think that was appropriately difficult. [33:19.100 --> 33:22.520] It was tense there for a bit, but I'm glad that we got to see a solve. [33:22.520 --> 33:25.160] That was my nicest challenge. [33:25.160 --> 33:26.700] The other ones are mean. [33:26.980 --> 33:29.260] So we'll see how those go later. [33:30.460 --> 33:33.060] But it's been fun casting. [33:33.060 --> 33:33.940] It was a good match. [33:33.940 --> 33:35.160] Thank y'all for joining. [33:35.200 --> 33:38.540] And we'll be back with another match shortly. [33:38.540 --> 33:39.180] Yep. [33:39.320 --> 33:39.980] See you soon. [33:39.980 --> 33:40.580] Take care.