Welcome back, CTF fans. I'm Mark and this is Josh. And we're back with the semifinals on the top bracket. Oh my goodness. It's been crazy. Both these teams undefeated so far. Yeah, really impressive given the level of competition that we've seen. We've got Hypeboy versus Straw Hat. I think this is going to be a good one. And you wrote this challenge, right? I wrote this challenge. It's my hardest challenge that I wrote. I'm allowed to say that. I think it's going to be really good though. Both these teams are fantastic. Alright, well I'm excited to see them get at it. So let's count it down. Ready? Let's do the countdown. In 5, 4, 3, 2, 1, go. Let's go. Alright, so we have on your top right, is that Straw Hat? Hypeboy. Did I get backwards? Ah, top right is Hypeboy, top left is Straw Hat. That's right. At this point it looks pretty similar, right? The first step of every challenge, download the challenge. Looks like we're having a little bit of a technical issue here. So we're going to take a look at what's going on with this. Okay, false start. You know, there's a lot of moving parts here and it takes a lot to get this going. It really is impressive to have a show running with everything that's going on here. A lot of moving pieces. I'm glad that we've had a lot of understanding on parts of Confedors. It's a challenge. It is a challenge, or it will be a challenge soon at least. Honestly, I blame the challenge author. You know, I said that going into this and here we are. Look, all my other ones work totally fine. Yeah, you know, but I think that it goes to show that... How many matches have we had so far? Oh my gosh. So we're in Grand Finals. We've had 10. So with that many challenges, you're bound to run into some bumps. And we've had a number of difficulties from infra, hardware, challenges needing to be updated on the fly. And there's so much work that goes on behind the scenes. We test everything as much as we can. We make sure that every challenge is solvable. Can somebody who's on the game network solve it? Is it reachable? Exactly. That's a big one. And there's just a lot of pieces. Yeah, there are a lot of pieces. And I think on this one... The what? Okay, so it sounds like... It's hyphens, not underscores. So I am the only person on the team that names things with underscores. Everyone else uses hyphens. And it looks like that caused the mix-up. So instead of the name of this challenge, we're allowed to say... We'll wait to say. But... Yeah, it's multiple words. I put underscores between them. It should be hyphens. Who's got time for a shift key? Honestly, who has time to not use a shift key? Why even use spaces? Yeah, I don't need numbers. I just need symbols. Why even use spaces? Yeah. Poland can use space. It's a hack-a-sack joke. Oh my gosh. Also another competition going on here. They're great. We have Jordan over there working on that right now. Yeah, it was a fierce rock-paper-scissors to see who was going to be able to commentate the finals. But Jordan, he is actually really good at rock-paper-scissors. Oh my gosh, a professional. I don't understand that. Well, he's doing rocket-paper-scissors right now. Oh my. Ha-ha! Oh, we have time before the challenge? We have time for bad jokes. I'll let you lead. Oh, I got nothing? That was my only one? Oh, okay. I guess now I'm the bad joke. Womp womp. You know, I see a lot of... you can't see this, but when we're looking out, what we're seeing is the DEF CON CTF finals floor. And it is a big dark room with a lot of people. And you know, I'm actually not seeing a lot of dual monitor use. You know there isn't, because a lot of being on the floor at DEF CON is just being able to pick up your laptop, go work wherever. Like, you're done being on the floor. You don't want to sit here anymore. You want to be the Chipotle guy. You want to go up to the suite. You want to, like, do anything else. You're tired of staring at this, like, stupid heap challenge. I, of course, not speaking from experience or anything. Yeah, well, I can relate. I'm very much a one screen guy because I just like to be able to set up wherever I am. Yeah, no, that's totally fair. And your awesome ergonomic setup, which, like, you set it down. You have a stand for your laptop. You have mouse. You have ergonomic keyboard and everything. I'm like, oh my gosh, this guy is a pro. I'm over here with my little laptop and my, like, 90 degree angled posture. It's just years of wrist rot, really. So it comes back to bite you if you don't take care of it up front. See, I don't get that because I don't use home rototype. I have my left hand on WASD and my right is just floating. I learned to type from playing video games. What can I say? Maybe speak and tell me how to type. What to? Old typing program. Oh, God. No, am I showing my age? And I think we're getting close here. We're getting close to ready here. But we're good to go? I think we're just making sure that the connectivity is up. All right. I think we're good to go with not a false start. Okay. So without further ado, for real this time, that was just a practice. In 5, 4, 3, 2, 1. Let's go. Let's go for real, please. Oh. Okay. They download the challenge. I see the happy bouncing box on the Mac. Yeah. They download the challenge file. I see something in IDA. If you just screen dash R or whatever, or I can take care of it. Okay. So... All right. Now we see that beautiful challenge name popping out there. We see the beautiful challenge. Oh, House of Barbie. I'm so proud of this challenge name. This came from another challenge name that Carl came up with originally. I made this as a follow-up joke, and I'm like, damn, I need to write that. So House of Barbie is a custom heap allocator challenge. Everyone's familiar with the, like, House of Spirit, House of Force, and all that. So House of Barbie was the natural follow-up. So this is, you know, in my book, a custom heap allocator. That doesn't sound like an easy challenge to me. It's simple. We don't do TCache. We don't do different bins. We throw everything. We use Sbreak, and we just send it. You know, everything is sequential. If it isn't sequential, oops, memory's bad. Well, you know what? Writing memory allocators is hard. Yeah. Who remembers how to do that? So let's jump in and take a look at our competitors here. So Hypoi launching into it first, going through. It's fairly simple. So what you have is you have a house. This is going to sound so weird. Keep going, Josh. You have a house. There are rooms in the house. There's furniture in the rooms. You make your dream house. I think the description of the challenge was, like, Stidlib Malik wasn't pink enough, so we implemented our own, which also the description. For those that haven't seen the Barbie movie, this is going to be totally over your head. But those that have, I really hope you're laughing. I heard a groan from production. So going through, we have very nice functions here. Print state, it was supposed to be behind debug, but that was actually a little hard, so I just commented out the debug condition. Print state prints each room in the house, each furniture item in the room, and why not? It prints all the heap chunks, too. Heap chunk printed with the address of it, the data address of it, size of it, whether it's free or not, and the next. So the heap here is a singly linked list, which we're going to see so much in CTFs. It's one of the most common data structures you see because that next pointer is just so valuable, especially in heap challenges. You might be able to get an arb right from it if you try hard enough. Yeah, so definitely when I was looking at this challenge, I was thinking, all right, what is the metadata that we're going to see in the chunks? How are these chunks laid out? The print function that you mentioned really does help you understand that, and I'm interested to see when the competitors stumble across that, and we'll be able to tell because there'll be some addresses being printed out. Yeah, no, it looks like Hypoi is doing that. They're not annotating with it quite yet, but Straw Hat is. Straw Hat has already gone through and annotated part of the heap struct, I believe, or maybe they're just in the furniture struct still. Yeah, so that's the globals. There's some global metadata that manages the heap as well as, I believe, the house structure. The house struct is in globals. Yep. So that's easy to keep track of. It's one less layer of indirection, one less allocation you need to keep track of on the heap. And both teams we're going to see going through just doing basic annotation of this. We talked about this earlier, but this is a really good way to just get your bearings in a challenge that has a couple layers to it because you have the house, you have rooms, and you have furniture, and all of those are different structs. Right, and correct me if I'm wrong here, Josh, but I think that the structs themselves, not in the binary, they're going to have to reconstruct that. They've got hints based on strings that are in it and the menu sort of saying add room, add furniture, but they're still going to do a little bit of struct reconstruction. Reconstruction, nice. Got it, got it. Yeah, they are reconstructionists. Yep, yep. And we've talked about this before, but again, common theme, we've got a menu here. We've got one competitor who looks like they're very static focused, so they're looking at each menu item, they're reading the function that gets called. The other competitor looked like they were exploring the menu via just sending stuff to it. Yeah, and it looks like they're just trying to get interaction down, and they're trying to print the state of the heap after each of those interactions. And what's really nice is these structs are, you know, I might have been a little nice here and made them divisible sizes. Always helpful. You might be able to just kind of shove a couple of one in the space of another, and the link list I might have forgotten to free, so you might have a couple free chunks here and there you can control. But really, this challenge was inspired by the name, obviously. And then when I started looking up, I was like, oh, what do people do for custom heap allocators? I looked through a bunch of GitHub repos, and all of them I found bugs. Every single one had a mistake. At least one. As I said, it's hard. Yeah, it is. So I kind of pulled the bug inspired by one of those. Not exactly the same, but kind of the idea of it because I'm like, wow, yeah, people can really make this mistake. This is kind of a real bug. Well, so it's interesting you say that because I think that a surprising number of the challenges that we've seen, both here and in other CTFs, are usually modeled after a real bug that someone else has found. And sometimes it is literally just, here's that software with this bug that I found in it. You find the bug too. Exactly. In some CTFs. Certainly some of the challenges that we've seen in this competition, I know at least one of the ones that I wrote was based on a real-world bug with a weird primitive. And I thought, hey, it would be really cool to see the challengers try their hands at this. Yeah, absolutely. And I remember I was playing in real-world CTF 20... Oh, the first one. Whenever that was. And... they had one challenge that was you know, recreate this ODE in Chrome. Oh, by the way, don't worry, we actually have it. You're not giving us an ODE. We already have it, guys. Trust us. And they had a video of them showing the ODE, which was just them running a script, then Chrome popped up, then Calc popped up, and I'm like, dude, that doesn't prove anything. You could just call Calc. Print random addresses and call Calc. So, there are definitely real-world bugs that try to be put in CTF. Sometimes, it's a little shadier than others. We decided to not do that challenge because we're like, we don't know how we feel about this. Right. Yeah, I mean, they're in good company in terms of the number of proof videos out there that just popped up. Where it's just, you know, a script that's called, like, exploit.py, and inside of it, all of us is like, subprocess.calc.exe. Great exploit. One of my favorites. So, if we switch over here to Hypeboi, we can see that they're printing out the this is the list of the chunks, and these are the different... Yeah, these are all the field values. The fields in the chunks. So, it looks like three... oh, gosh. So, they're going to be creating a room. Yeah, creating a room and adding items to it. I have to say, I really especially for a challenge like this, I think it's great to have stuff like that because for me, having heap structure stuff in my head, even with nice printouts like that, it's hard. It is hard, definitely. And unless you're really familiar with the structures, like, you can hold tcache info in your head. With a custom heap allocator, like, you need to change your understanding and you're going to be making mistakes because fields are at different places. Fields don't exist. They're different sizes, different everything. So, having that printout is really, really beneficial to just being able to do this challenge, period, let alone in the time they're given. Yeah, and I think that one of the things that is tricky with a new heap allocator is, as you were talking about, it's nice that they're at good widths because with heap stuff, typically what you're looking to do is you have these boxes, right, and you're trying to get maybe one overlaid over the other or a little bit further into them, but you have to know exactly what that structure is to know what's being overwritten or what's being placed on top of a value that used to be there. Yeah, absolutely. Like, if you have two structs of the same size, one with a function pointer at the offset of the size field of the other one, you know, that's really nice. You get arb call on size field, but if you have mismatched sizes, you know, you get, uh-oh, that function pointer is now like next pointer in the heap metadata, and it's just so like it's probably still possible, but you have to do so much heap manipulation to get there that it's just not feasible within an hour. I'm sure everybody at home has exactly the picture in their head of what Josh was just talking about. I know it's very easy. This is child's play, surely. Okay. Let's take a look here and see what Straw Hat has going on. So Straw Hat... So right now they're breaking down. So this is the free function. So the allocator, it's essentially only three functions, right? Yeah. It's, uh, what is it? Free, malloc, and realloc. Yep. And I think looking at this, you just skipped over the malloc function because you're just like, oh, it's just malloc. And you were looking for straight, like, stdlib heap bugs. Yeah. Because... Yeah, I'm like, uh, double click on malloc, and you're like, you bastard. Yeah. If you look on the left-hand side there, you can very clearly see that the malloc, free, and realloc functions don't have that pink background on them. So they're not imports. Um, so I missed that because I, you know, little detail like that, and I was looking for the bug and didn't see it. It's a really common oversight. Honestly, a big part of this is, you know, going through with a fine-tooth comb and understanding every step of the process because if you make assumptions like that, you're going to be skipping over potentially major parts of program logic and potentially where the bug is. Right. Who knows? Right. And so I'm glad to see that our competitors did not fall for that like I did. Oh, my god. I was honestly worried and I was debating renaming them, and then I'm just like, nah, I like using these names. Uh, yep. And we can see that both competitors looking at these heap implementations. Yeah. Hypeboi also looking at realloc and free. Yeah. Hypeboi probably knows that realloc is usually pretty buggy because you need to split chunks, you need to be able to shift them, join them, etc. You know, that's all this does but other heap allocators, absolutely. Um, but you might notice that splitting the chunk isn't the job of realloc. Splitting the chunk happens in malloc. Yeah, I was going to say that depending on how you want to write your heap allocator, you could end up with some of these being pretty simple. So, realloc really could just be a thin wrapper around malloc and free if you wanted to, like if you wanted to be lazy. It was originally. Um, and free. I think that if you wanted to be lazy about it, you could do basically all the work in free and have it do the consolidation of chunks and malloc just be real lazy and just, do I have a big enough free slot? If so, yep, just take it. Okay, well, look. Sorry. Shade being thrown this way because that's kind of what it does. I mean, but despite that, look. Yeah. What are we looking at? We're looking at Hypeboy here. Um, yeah. Looks like they're cross-referencing those heap functions. See those calls to free there. Trying to figure out what goes inside of them. Exactly. I think once you understand that, okay, there might be a bug in one of the three allocator functions, the next step is probably, okay, where do each of these functions get used? Yeah. As far as I'm aware, the only bug in this program is in the heap allocator. It's very possible that there's another bug somewhere, like, I'm not a perfect programmer. And I would be delighted to see it because I've been saying this whole tournament that I want to see a challenger come up with an unintended solution because I know it's a possibility. We've had a little off from intended solution but we haven't had, you know, fully just wrong place, not where we expected at all. We thought this was sound. Like, I want to see someone just tear apart my code. Yeah, and especially for this one, which I think the intended solution in this one is, it's not simple, right? This is a tough challenge. Yeah. This is, I want to say, the hardest challenge I wrote for this. Both very good teams. We were saving it for later because we were worried that when players were just getting used to this, when players were still very nervous about competing, that they wouldn't solve it in time. But we're pretty confident that this won't go into sudden death, obviously, otherwise we wouldn't have fielded it. Yeah, a lot of quality control on our side is really focused on, is this hard but solvable? Yes, absolutely. So we've got a couple of levers that we can pull in this regard. We've got hints, we can add symbols or have explanatory stuff sort of sprinkled in. Oh yeah, and we've nerfed challenges, we've added win functions, we added unoptimized gadgets in there. And I'll also say that the sudden death challenges that we've seen so far weren't necessarily the ones that we thought were going to be the ones that would go the distance. Absolutely. I honestly chalk that up to nerves. Yes, this is truly a difficult situation to try to succeed in. Yeah, it's a different situation than these teams have been in before because they've competed in countless CTFs. They got here, they're used to being here, you know, you work in your team, every team has a little, almost enclave where they work with their teammates. And then you get over here, you're alone, you're against another team that you don't know the person potentially. You're on unfamiliar challenge. You have to use tools that you might have installed, you might need to download them. We saw with the LEB128 package that you needed to download the tool because no one had that obviously. I think MMM didn't end up using it, right? Oh, you're right. No, they didn't end up using it at all. But it just goes to show, like, it's a very different situation and the amount that plays into it just can't be overstated. Yeah, it's a different game and I have been in the CTF scene for a long time and one of the things that I picked up on after the first few years of playing is that it's really a big morale game. It's a psychological game. Do you feel like you have momentum? Do you feel like you're making progress? And this is a different situation. You're just behind this wall and it's just them back there. They don't have their teammates to bounce ideas off of and all they have is another fierce competitor sitting across from them and they don't know how far that person's made it yet. A big, big part of CTF is social and interaction and, you know, rubber ducking, bouncing ideas, working together on an exploit. Because we're, as commentators, we've really found out how easy it is to see bugs in someone else's code. And we know this, obviously, from, like, work, too. It's so much easier to see bugs in someone else's code when they're just sitting there writing it and, like, they're saying their logic out loud and then they write something totally different and you're like, that's not what that does. They're like, oh, damn, you're right. Yeah, it is always easier when you're, you know, one step removed. Yeah, even a, was it, even a 10x programmer, 10x hacker needs someone to work with sometimes. Oh, I totally agree. And I think that when with this tournament in particular, we've seen a little bit of teammate rotation. Yes. But a lot of these challenges have been Pwn challenges and a lot of them have been the same competitors for... Absolutely. most of the challenges. Yeah. Or we've had people switch off because they're just like, you know, I, this isn't really my forte. I'm not doing well solo. I don't really want to be under that pressure. Or they're like, you'd be better at this. Like, go for it. These teammates all have major confidence and trust in each other because you're working on these challenges. You're spending, you know, 16 hours looking at one challenge and then you have to be able to comfortably hand off your script to someone else so you can sleep. Yeah. And trust them to not like burn it all down or ruin it or like waste those precious hours in the competition. Exactly. And we've seen that really... I think the best example was the Python challenge yesterday. We saw some fresh faces and one of the competitors was not the person who had played previously for their team but then they executed an extremely fast solve. So clearly they had a specialist on that team. They knew, hey, this is going to be your challenge and it worked out for them. Absolutely. And I think really working with these people for so long and working in these high-stress, you know, fast-paced environments, really you build knowledge of who can do what the fastest and who can do what the most consistently. Those aren't always the same person. Exactly. Yeah. And I've heard this from a number of my friends in the community and talking to them about what makes their team good. And I think a big part of it is really understanding your teammates' strengths and knowing, I'm really struggling with this. I'm going to turn it over to this person or go to this person because I know that they're good at this sort of thing or maybe they just look at it differently. We're both good but we look at it differently. Looking at it differently is major also because it's so easy to get rabbit hole and just like... Oh yeah. Oh yeah. And that's key when you've got a teammate to say like, I don't think that this is the way to go. Yeah, this is nit guys. This is memcopy. And it is fun to see the different approaches that people have and I mean different in every sense of it. I know one good friend of mine, he is a very fast hacker but he has another teammate who is also very fast and I said, so which one of you is faster? And they looked at each other and they said, well, he types faster but I have to delete my stuff less and go back and fix less. So we're probably about a head and a head. I worked with two really good friends all throughout college and RPI sec on like crypto challenges and some reversing some web and we all have different strengths and I remember specifically when Defcon qualls, we split off from the rest of our team, went into a different room and just like closed door, like locked. We just had a big whiteboard and we're like, okay. And we all took a different part of this crypto problem and at the end just like put them all together and we got this all. Wow. It was we all know our own specific domain and work together to make one beautiful solution script. Yeah, that's great. I mean in the divide and conquer approach really works, especially when you've got some of these finals problems are massive, right? Or they'll be, you know, a common sort of thread, but okay so here's the same mini problem but solve it a thousand times, right? Could be one problem. And finals, attack, defend, you need to submit patches for it too that don't break SLA. Like you need to be able to keep the service up but fix. And one of the challenges, Torque also written by Glenn because it's cursed but is Torque and it's it's Torque. You can pop a shell in 2,000 different ways but one of those ways is you know it's how the game runs. So you can't really disable it. You need to make mitigation somewhere else. So just knowing specific domains and knowing how to work together is crazy. Here alone it looks like Hypeboy has been making good progress. They've been writing interaction wrappers. They're checking the offset from heap base. If I want to be really nice I could have had fixed base but I'm not that nice. Well they do, they can print out the addresses whenever they want, right? Yeah but then you need to write a parser and it's like who wants to parse? It's not like I give them really nice output that helped me a lot in solving this. Yep, those info leaks they come in handy especially when you're in a speed challenge like this. Oh yeah. And what I haven't noticed yet is anyone highlighting the real bug here? What function are we in? We're in malloc here? Oh! Wait, hang on. He's reading the line. Line 52 where the bug is. He's walking through it. If he does size minus delta he's just checking size. So I did this exact same thing. I looked at that exact thing and I was like, huh, I wonder why he did that. And then I forgot to comment it and it just went out of my head. I really want to see the comment, this is the bug. You're like, he's thinking about it. Oh. So the bug here being that you're checking the wrong size field is bigger than twice the size, or sorry the size of the free chunk is bigger than twice the size of the size field. But the size field being checked is the requested size. I love that comment. Is the requested size. Not the allocated size. So you get a chunk that has the size of the heap metadata overwrite into the next chunks info. Which, you know, it's the entire thing. So you have arbitrary you can allocate basically a fake chunk. And then you get arbrite. Using the next pointer? Yeah, using next pointer. And it's what's going to be really important is the second part of this challenge which is finding an offset that they write to that doesn't cause a next pointer to be an invalid deref in crash. Ah, right. Yeah. So that's the second part of this challenge. There's a couple of pieces here. There are a couple of pieces, but Straw Hat finding the line with the bug is big. And they did go right into writing their script which, that's a good sign. Now, over on Hypoi, it looks like they're walking through the removal code. I really hope they've looked at malloc and everything. I think they have. We did see them exploring looking at the implementation. I don't think we saw them. So they know it's not standard. Right. And the category of this challenge we gave them was custom heap allocator. They came in knowing. They really should know. We made sure that they weren't going to just scan over it. But I really want to see. I think right now they're looking for double freeze. But they're noticing... No, they're not looking for double freeze because they're in add room remove room. So I think what they're trying to do is make room size mismatch. Which is close. Well, I'll say that if the category is custom heap allocator, that's still, you know, a number of bugs could be under that category, right? Yeah. When I was developing this, I was debating, like, oh, do we forget to set free in, like, a chunk split? Or do we forget to, like, update the data point or the next pointer and it points into your data? And it could be so many different things. But I think... Yeah, Hypo is going to be going through and trying to figure out, you know, a standard heap bug. Is it UAF? Is it a known house of besides House of Barbie? Yep. I mean, my immediate thought looking at this was, okay, are we looking at double free? Is this heap buffer overflow and some friendly metadata that can be smashed? Yeah. Is it some UAF? Exactly. You know, can I... There was a challenge I always wanted to write that I'm going to leak now. But is it, like, a heap meets stack kind of thing where you get... The classic love story. Yeah. Very boy meets world. The stack Topanga and the heap Cory Matthews. Oh my gosh. I remember those names. That's crazy. How could you forget a name like Topanga? Match made in heaven. But we saw Straw Hat just then revisiting the line, trying to figure out... It looks like trying to figure out what they can do with it, trying to figure out the right structs to use. If memory serves, which sometimes it doesn't, but in this challenge it does, you can grow the list of furniture in the room to be, you know, 32 bytes. And then the size of the furniture struct itself, 16 bytes. So, you get... What is it? The size of the header is 24 bytes plus 16 bytes. You get 16 byte overwrite into the next chunk. Okay, so we see that the first hint has dropped. Oh, the first hint dropped. Do all chunks have the correct size? Which is definitely going to be a helpful hint because at least the size field was called out in the printing, the debug printing function. So that's helpful. Absolutely. And I think that it will be most helpful for Hypeboy because Straw Hat, we think we've seen... They probably know that. They probably know. So this is going to push Hypeboy to catch up. Yep. So now they're looking in Realloc. They're walking through. One step off here. A minus 24. So the size of the chunk metadata is 24. They're going to be walking through and checking. Now, Realloc doesn't do the actual allocation itself. It calls out to malloc. So that should say to them, oh, the only place where the size is properly set is malloc. So I need to check the branches there. So they're going to be going through, stepping through, making sure that everything is the correct size. I'm a little bit worried that because they haven't gone too in-depth in the heap implementation, that they're going to be thinking that I'm, like, under-allocating for a struct, just automatically, which I'm not that nice. Well, I mean, especially when you're reversing, the size of the struct that's being allocated is usually a very strong hint because, you know, who's going to mess that up? But with the CTF challenge, you never know. True. But they should also be able to see. They have all the info printed out to them. They should do struct recovery, know the size of it, and just be able to immediately knock out, oh, this is 16, this is 32, this is also 16, and just say, oh, these are all correct. Mark them as correct and move on. Yeah. I know on one side I saw the player annotating structs, making sure that they had that in their decompilation. Yeah. I don't know if I saw that on the Hypebites side, but I might have just missed it. Not 100%. It looks like they're calculating offsets correctly. So, one other big hint here is if you get data minus address not equal to size, you know that chunk is wrong. That chunk has the wrong size. Right. Because the data of a chunk is just immediately after metadata. And they should see that. Well, so that's a little bit of a second order analysis here, which may not be immediately apparent. I mean, if you break in a debugger, if you change, the first step of this challenge is setting the name for the house. Or you can set the name for the house and get a simple allocation. If you set a debug breakpoint, print the address of the name of the house, and then print the address of the chunk, you should see oh, this is just immediately after. You know, it's a little thing that's taken for granted in standard lib heap. But you really need to get a good sense of what this does. Yeah, well, this is... I'm trying to think of the number of custom heap allocator challenges I've seen. I mean, this may be just kind of a weird thing to think about. And it's not necessarily easy. True. There have been... I was talking with Lightning and she did like a protected malloc, which was a custom heap allocator. It was almost a complete rewrite. But it was rewritten to use MD5 verification of chunk metadata. So definitely optimized for performance. Oh, yeah, totally. MD5 is the fastest. Oh, my gosh. Yeah, so I'm hoping the teams... Obviously, I'm hoping the teams solve this. It looks like over on Straw Hat, they're making consistent progress. They're trying to figure out can I overallocate? I'm making the size of the room. They're making the size of the room large enough here. It's important that each room has a size. Each furniture item has a size. And you can't put, you know, obviously too large furniture in a room. That doesn't make it a dream house. That makes it a nightmare house to get through the door. So, you know, let's just make them good sizes. It might also be, you know, a very convenient feel to have an arbitrary unsigned 64-bit integer in there. You know, that would be nice. Right, right. Yeah, I was thinking that one of the things that I'm thinking about looking at a heap challenge is what are the resizable things that I control? Or what arbitrary data can I stuff into it? So with, say, the names, for example, okay, so now I've got potentially a resizable amount of memory depending on how name allocation is handled. But as you said, if it can take an arbitrary unsigned integer as the size, well, now I'm thinking how is that going to be used for exploitation? Yeah, like, oh, I can write a pointer here. Where do I want to write it? And it's walking through that. So it looks like Straw Hat is writing just kind of a simple interaction wrapper. They only have add room and rename right now. Yeah, so they're working back from the bug, right? They're only writing the menu interaction that they think that they need not trying to have a wrapper function for everything in the menu. Yeah, and it might be possible to solve this with only rooms. My solution used rooms and furniture, but you could do it with only rooms, I'm sure. I mean, I think the structs are the same size. Well, the way you talk about dream houses, Josh, doesn't surprise me. How could you have a dream house with no furniture? It's so true. Well, I feel like it just makes the feng shui easier. You know, the flow of energy isn't interrupted by anything or redirected. Josh, that's the best heap feng shui joke I've heard all day. Thank you so much. Wait, all day? That was the first one. All right. So it looks like over on a high point, they're... Oh, so they have a room. They're adding furniture to a room. They're allocating it. You can over-allocate this. That's fine. Adding 50. And... Looks like they have an item with no name. That's because you used up the horse. I saw a hex stump coming out. Oh, there's a hex stump. There's a seg fault. Okay, that's a good sign. That's a great sign. So they just sped ahead here. And it looks like that their reallocation... They're going to find out very soon that reallocation is very busted. If they don't find out very soon, hint two will let them know because I think it's exactly that. Or no, I made it very clear that it's not in reallocation. It's in splitting. Yes, an earlier iteration of the hints led me astray. It was... Yeah, no, I can't defend it. It was. Some other sort of excitement going on in the room right now. It's hard to tell how much is making it through the microphones, but there is a lot of action in this big room. Yeah, there is a lot. Sounds like another competition just ended, had the countdown. I'm not sure which it was. I think it was Hackasad, actually, so we might be getting our Jordan back soon. Excellent. Well, the Hackasad, very cool competition for all of our viewers. If you haven't heard of it, very cool stuff. And, you know, they've got Jordan, so obviously they've got a pretty good commentator. Their production values through the roof. Oh, yeah. Really cool stuff. So it looks like over on Hypeboy, they're getting invalid furniture items. They're getting reallocation bugs because you're going back, your furniture list is increasing, increasing, increasing. Oh, and now they're fine tuning their offsets to get that. Nice. It's increasing so much, they have a leak in the size field now, and they see it here. So they know that the size field overlaps. The size field overlaps the next heap metadata size field, or next heap metadata next pointer. That's what I meant to say. It's so clear. And knowing that, creating new furniture, they know that they're going to be able to write to that next pointer. And if you write to a next pointer, point that up, writeable memory, and then allocate something else, you can get potentially an ARB write. Yeah, I think they're making great progress. Oh, yeah. I was trying to look and see in their chunk list there, in the debug prints, if we saw any pointers, it started to look like they had control. The problem is, they are over-allocating right now. So the debug print is going to print so many chunks that it's going to be hard to scroll through and find them. So I think you only need to add something like five, six furniture items max. And that's going to be a much more manageable like 20 chunks. I saw them printing out like 54. I think that this is the kind of problem. I'm a very visual guy, and for me, seeing a long list of tabular data, it's hard to visualize. And when I'm working on a challenge like this, I'm making a picture in my head. And if I can't make that picture, just due to the raw size of the data or the complexity of what I'm dealing with, it's hard. Yeah, absolutely. Honestly, it would have been really cute to write a visualization like... A Barbie house visualization? Yeah, where you can see, or like for the heap chunks just overlaps and stuff. What a missed opportunity. That code would have had so many bugs in it. Like, that sounds hard. Okay, and if we switch over to the raw hat side, we can see that they are examining their chunk list. They've got some large allocations going on. So that chunk size 2f is going to come up in the future. Yeah. That's actually pretty important. So what's... I don't want to give the solution away here. We'll see. How far are we to hint2, production? We're checking in now. Hint2 just came up. And hint2 just dropped. So the competitors, they have a timer that they can revisit. They may not be looking at... I'm guessing they're not looking at the clock. No, I don't think so. We will probably see one of them flip over and check to see if the hint has dropped here. But they're both kind of on a roll too, just judging by how quickly they're typing. It's definitely something that's not on the top of your mind. Hey, what's the next hint? Unless you're stuck. Yeah, I kind of want to have production go tell them hint2 dropped. But at the same time, I don't want to ruin their train of thought. I think we don't interrupt them. We told them when the hint was going to be at the beginning. No, and I think that that's... that's the way we've been running this competition. And as you said, both of these competitors seem to be on a roll, typing really fast. It's not like they just have a cursor hanging over idly, hovering things in IDA. They are moving towards the solution. Oh, got EOF. So it looks like they have next. So let's flip over to HypeBoy and take a look. Oh, thank you. Sorry. Next is null. Sending 50. Yeah, so it looks like they're getting... Oh, you just need to print the state of the crash here. You're so close. So once they get control on this, they overwrite a pointer. What's the next step? So you overwrite the next pointer. Where are you going to point it to? Right before the got is pretty nice. Because, you know, I think this is no rel row. You can push that right before the got. Right before the got, you know, if they look around there, you might notice, oh, there's a very convenient field of zeros with, you know, some other bytes in there. So you could point it right before. Let's see. Right before the got is going to be... Oh, I forget where it is in no rel row. It's been a minute. So what's the characteristics that we're looking at here? It's readable and writable? You're looking for something that'll have a big enough size, a size that you can put, you know, ideally the house name into. Because that's the easiest thing to control. You're looking for something that has a size field that matches that. You're looking for something that has free set. That's the most important thing, is you need to have the free field set in order for that chunk to be used by any new allocation. And then you want the next pointer to be either valid or not. And so in this case, what you're doing is you're setting up a portion of memory to look like a chunk so that you can use it. You're making a fake heap chunk in, like, program memory, in the BSS. Exactly. So fake heap chunk. And then from there, we're... I see some very active mouse work over here. I want to jump over to HypeBoy and see what they're looking at. There we go. Doing the math in their head, you could see it work out. Okay, so I see Straw Hat has picked up hint two. I didn't know hitting enter after an examine command would just, like, step forward. That's pretty nice. I didn't know that. I just always change the offset. Yeah, well, I mean, that's one of the things. I think if you are a competitor at this level, if you're not taking a look at some of the tricks that your competitors are doing, because this is all live, right? Everybody's aware that what they're going to do is going to be public, at least in that the stream is visible. So there's a lot of interesting techniques to be cleaned. Absolutely. And over on Straw Hat, we see them looking in the buggy check. Were they just looking at Malik? Or they're looking at where Malik is used. Weren't they? Oh, no, they weren't at furniture. I'm sorry. It just looked very similar. There was a size check greater than, but it said V2. And so we don't think that we've seen them have control yet. I don't believe they've gotten a crash yet. I'm not 100% on that, but I don't know. We'll keep an eye on them for sure. It looks like over on Hype Boy, they're going into remove furniture and figuring out what it does. It actually well, you know, we'll see here. It frees the name, it frees the struct, and it decreases the size of the furniture item linked list size count field, whatever that is. It's not really important. It's just like a linked list implementation. Yeah, so part of this is really just understanding exactly what you're supposed to do with the bug. Which as we've said a couple times now, a lot of different ways to go with heap. I think that they're packing a pointer, so they're just understanding. So if I'm mistaken, have they annotated that struct, or are they just looking at offsets? No, I was just thinking that. I would really annotate that struct. That would make stuff stand out a lot clearer. Well, with more than one struct, it's definitely something, like if it was only one struct, sure, maybe you can just think about the offsets, but with more than one in play, definitely that would help. Unless do they... are they going to return to it properly? Oh, come on, you need to print out the state, looking at debugger. Oh, there we go, up there. On the straw hat side, I just saw them double-clicking. They're looking at the debug heap prints, and I saw them double-clicking on the size2f. I think that they're... Okay, now that might be just standing out because that's like slash. And it might just be... Well, let's see here. Yeah, I'm curious if they're still sort of feeling around. Maybe they know something is wrong, but they can't quite isolate it. I'm not sure. Not 100%, they have more of a wrapper now. Yeah, they're getting their interaction sorted out here. And over on Hypo, we saw them double-clicking some addresses too. Figuring out what the offset is. Oh, they have... Yeah, they have a wrong size field. Size is 0x980. That's super wrong. So I think they have a write into the size field. They need to shift it one... Or I guess eight bytes forward to get an overwrite into the next field. They are eight A's in their payload away from getting next overwrite. And if they had the stroke, they'd know. How long? Eight minutes to sudden death. Wow, yep. We knew this was going to be a hard one. It is going to come down to the wire here. Wow, it really is. And if we have to go into sudden death, that's what we'll do. We're already running a little bit behind due to some technical difficulties. We are, yeah. We're cutting into our lunch break here, that's for sure. We do that for you. For the love of the game. Isn't that some slogan? Sounds familiar. It does, yeah. Oh, oh, oh. Item 0x7f something. We're seeing some corruption go down in that debug print. Oh, yeah. Okay, and they're going to leak that out. Print out their leak and figure out what that's... It looks like they have meted out a misalignment, maybe? I'm not 100%. Well, so if you can adjust the size on this... Well, you can get a size overwrite, but just as easily you can get an X overwrite if you shift your data forward 8. 8 more bytes. Right, but if they're trying to leverage that the size is incorrect here. Is there any way you see the exploitation from there? Yeah, totally. I mean, because it is a sequential heap allocator, it's a little bit weird because you're going to try to write past the end of program memory. I think what you might get is an allocation after then corruption of size of the chunk before, and then you get full overwrite of the chunk after. But the important part is you get an allocation after you get the... Sorry, you get an allocation after it before you get the size overwrite. So you're actually able to use that size. Right. You know, that's an option. As you can tell by me kind of stumbling through it, it's harder. It's not just, you know, you have control of the next pointer and link list. It is a way to get next pointer control. So they might take that path to it. Once again, because we saw them not annotating structs, they might have a good mental layout of what's going on here. They might be comfortable with that. That might be completely within the realm of possibility for them. I see I'm putting out some function pointers there. I think they have an idea of where they're trying to go. On the lower right hand side of the screen, you can see I'm printing out some pointers. Oh, yeah. Alright. Let's take a look at straw hat real fast. Straw hat was just highlighting the buggy line. Yeah, I saw them returning to their comment there with the triple question mark. It feels like they're still trying to work out what can I really do with this. They know something is wrong there. They've highlighted the bug. They've got the comment that nails the bug. They need to figure out how to hit it. And if they do C times 0x20... Yeah, 0x22. Sorry, just 0x22. Man, at this point, I am just rooting for these competitors. I really want to see a solve on this. They see a chunk with 0 size. So that's good. Which seems suspicious. That is very suspicious. And... I don't know. I don't know how this is going to go honestly. So doing C times... Oh, it needs to be C times 0x20. No, you forgot the 0x. That doesn't look like 32 Cs. This is the drama of CTF. Oh, man. They're so close, but that's such a simple mistake to make. Such an easy mistake to make, rather. Yeah, and you just... If you've played, you can appreciate the heartbreak. To know that you were so close, or that there's one little mistake that got you tripped up, you didn't know that you made it, and then you spent like an hour or so going down the wrong path, or thinking that what you were looking at wasn't viable when it was, in fact, the bug. Yeah. I mean, they annotated that line early, early, and then they just moved on to other things. So, I don't know if they were trying to figure out how to hit it. It's fairly straightforward to hit it. It's from every mallet call it can be hit. Well, on the Hypeboy side, I've seen in their debugger, which they just had up, looks like they're making progress. I think that they're close. Let's see, what are they doing here? They're stepping through. They have invalid items in rooms, which is right. That's great. They're going through... Oh, man. It looks like they have a consistent leak. They're just trying to figure out what to do with it. And they're checking where their allocation goes. I think they're looking for allocation into program memory, or like, you know, BSS global memory, which is the right approach. That's correct. And so, the path exploitation that it looks like they're going down is that they're looking to stage a chunk, a fake chunk, and then use that to overwrite a function pointer? Yeah, that's correct. And you can overwrite function... You can overwrite function pointer. You can... I think I just put an admin terminal in here. Did I? No, I put a win function in here. So, it's overwrite function pointer to win function. Which I didn't necessarily see either of our competitors playing with that win function, though certainly they may have just looked at it and said, yep, this is where I'm trying to get to go. Oh, they know there are two minutes left. Oh, man. It's possible, but it's going to be really close. Yeah, the time pressure is real. Capitalizing data isn't really a sign of forward progress. I'm worried here. 93 seconds. We just saw over on the Straw Hat side checking the timer. I wish we had a giant digital clock counting down over there, but really that's what they've got to gauge. How much time they have left. They feel the pressure. This is going to be tense. And it looks like both teams just kind of sitting there. Just looking, trying to figure it out. Yep, this is that part of the competition that everybody's familiar with when you're just feeling like, ah, I know there's something here, but maybe the next step isn't clear. They're writing a chunk of 24 which is right. That gives them 16 byte overwrite. So on the Hype Boy side, I think that they're on the right path. The question is just, are they going to finish before the timer runs out? Really, yeah. And they have item size being the leak. I mean, really impressive that they've gotten this far. I like the LS. They type 50, enter, enter, LS. It's just like, sorry, not that lucky. And I think we're starting to see the desperation as the speed of their of their pointers and their typing increases. Yeah. I want to say we could poll them and see if they want to go Sudden Death or continue it, but knowing CTF players, they'd continue this until retirement. Yeah. I think that we're going to go into Sudden Death. I think so. Oh, and it looks like yeah, over on the Hype Boy side, they have controlled right into Heap. Oh, 7a. But that being said, there is still another stage to this. So I guess they just didn't hack hard enough. Well, ultimately, that is really the only thing in CTF is that you either figured it out or you didn't. I mean, the challenge could be broken, but barring that, I validate it. Barring that, we knew that this was going to be a tough challenge from the get-go and confirmed, right? Yeah. Two teams, top of their game. And so now we're going to set them up against a challenge where we're pretty sure that they're going to get this quite quickly. Yes. Just a question of who's first. House of Barbie was, I want to say, the hardest Pwn Challenge we have. Yeah. For reasons, it wasn't saved until Grand Finals, which we'll find out later. But now we're going into Sudden Death. We see one of the team members, I assume, Slack messaging their team saying, yeah, Sudden Death guy, sorry. Um... Yeah, I mean, it's important to remember that this is within the larger finals ecosystem here. Like, the Nautilus game is going on. We can see their scoreboards. It is, yeah. If they're not blanking now, probably soon. No, they're not blanking. They're not blanking today. I talked to Brumley yesterday and he was so happy about it. He's like, I always hated how you blank it at the end of the day and we're the only ones that know. Or rather, he's always with PPP. So it's like, y'all are the only ones that know. Brumley being fantastic also, supporting us behind the scenes. Supporting the entire CTF team here. Yeah, really great. And definitely appreciate that. Yeah, fantastic. So, with the larger DefCon CTF finals, the winner here is going to get points for their team and... I think the winner here gets 1337 points. Fitting. Which is insane. Because, let's see, last place right now, Mhacaroni with just under 3000. To first place, MMM with... Is that 7000? So it's significant. This is not jump change points. This could really alter the rankings. Oh, yeah. And in the middle, you know, there's from 4th to... What is that? From 4th to 10th? There's a 600 point difference. So you can jump up like 6 places by winning live CTF. It's the longest running challenge. And we just got the thumbs up that we're good to go. Alright, so... Let's get ready to count it down. It hurt they didn't solve it, but let's do sudden death here. Alright. 5, 4, 3, 2, 1. Let's go. Alright. Have you tried reversing it this sudden death? Oh, man. This is an old joke from a long time ago. When we put on hack the vote at RPISec, we had an intro submission is working challenge. It was category reversing. And we just print the flag reverse and you need to flop it. So this is also because our poners hated reversing. Well, our poners hated reversing. Our reversers hated poning. Sorry, hard to reverse that. And it was kind of a joke, like, they'd always walk over to the poners and be like, oh, have you tried reversing it? So this challenge is made by Glenn. Did I see a decomp failure on Ida? Was there a decomp failure? I think that that's what's happening. Positive SP value? Something like that? So, you know, this is the risk. Everybody's using Ida, except for I believe one competitor was using Ghidra. Yeah, there was... Yeah, I think just one using Ghidra. You're right. And this is a risk. Now, I believe that any competitor at this level is going to be able to read this disassembly and figure out what's going on pretty quickly. We see Hydeboy scrolling through the disassembly right now. I've got to say, as one of the few non-Vector35 members here, that if you think that LiveCTF is testing their challenges in Binja, that's probably a pretty good bet. No, we test our challenges in everything, honestly. Really? Yeah, we really, really try to not... like, we do not write challenges to make Binja look good. There are some challenges where it looks worse. There are some challenges where Ida looks worse. We didn't test Ghidra. Oh, that's a big diagonal arrow in the Ida graph view. I actually haven't seen that before. I don't think I've ever seen that. Okay, here we go. So now we've got... looks like there's a fix up there that resulted in the decouplation on one side here. And then straw hat. They should be able to tell that this is a string. So, yeah, looking at those numbers, I'm guessing that's ASCII. That is, in fact, ASCII. Thank you for ASCII-ing. Sorry, I should save it for the full screen us cap. No, get your dad jokes out now, Josh. I feel like we're going to be done here soon. I have terrible news. I'm never going to run out. I'm so sorry. If that impacts your choice to continue doing this with us, you know, I understand. I'm going to need a minute to chew on that. Let's flip over to Hype Boy. So, Hype Boy. Oh, they pulled the string out, so reversing it. Yes, I have tried. Except... you know... Oh, I see anger coming out on straw hat. Anger is incredibly overkill for this. But does it work? This is a string compare to running your shell game. Oh, we're seeing anger on both sides. Are you... We're seeing anger on both sides. They're installing anger. That is not a fast installation last I checked. That might cost them some time. The very, very lucky thing is, they're on our organizer internet up to the internet, so they have really fast download. Wow. On game net, that would have been slow. Wow. Oh my goodness. Okay, so we see anger installed as root. Did we see a pseudo pip install? We saw a pseudo pip install. All the rules are being thrown out the window here. Maybe they're running in a docker container. It looks like they are. Oh, okay. Well, that works. Oh my god. Anger coming out on both sides. This is an unexpected turn of events. We are watching an anger race. It is a stir cup. With the decouplation that we're seeing on the straw hat side, you know, this... I'm guessing that the number of equations or equality checks there, that may have been what has driven them to check anger. But you see it's all ASCII. Indeed. And I believe that you can look at each one of those indices, it's decreasing, and it's character by character, but they're under so much pressure that they might be jumping. They might have figured it out. Yeah. Okay, they're just going to write a Python script to pull out what it is. Okay. I was really worried there for a second. Oh, wait a minute. But over on Hypeway, we see Linux x86 shellcode. That's a good sign. Yeah, they're pulling it up. Not using shell plus null by... Ah, that's not going to work. You need your payload first. Yes, I've tried reversing it. They put it... No, put it first! Put it first! But they're on the right track here. They are on the right track here. That might work. I might not remember the Python 3 challenge. Oh, yeah, they're under pressure. Seems like maybe you should. If they swap the order of those two, their shellcode... Do you mean if they reverse the order? Oh, my God. It's meta. If they reverse the order here, they get a shell. On the Straw Hat side... No, don't put it at the end. Oh, wait. Oh, my God. They just totally rewrote their shell. Okay. They threw out the other thing, and they just have another. On the Straw Hat side, we see them continuing... to look at this Oh, my goodness. It looks like Hypo is going to run away with it here. Straw Hat, real fast, still running their parser. Hypo over here. Should run it from remote. What? It said... Didn't they get a shell? Oh, now go get a shell. So they got the, yes, I've tried reversing it right. But... Oh, that's... And Straw Hat is still continuing to fix their script and isolate just the pieces of the equality checks. I think that they're still going down the road. Yep. We can see them printing out what the response is going to be checked against. I'm going to keep an eye over on Hypo because if they just swap, if they just put, yes, I've tried reversing it in the beginning, they win. At this point, it's really a pressure cooker. They're already exhausted from the challenge that they just went the distance on. Over on Hypo, they think it's their shell code that's wrong. Oh. They are so close. But really all you need to do is just put the string before because it's comparing from zero index. Over on Straw Hat... Oh. They're going all in on this string manipulation with Python which under this kind of time pressure... Yeah. You see that the indices are reversing. You can honestly just reverse those lines and pull out the ASCII character. Yeah. Gosh, this is tough. Yeah. So it looks like they're trying to extract out the numbers and the indices and then remap everything into a string but might be a little bit of overkill for this situation. Yeah. Hypo going through in the debugger. Looks like they see that... Is that their shell code that's executing there? Yeah, that looks like it. But then they have an IML. So something went wrong with their shell code there. Oh, it looks like maybe they're... Oh, no, they're in ops. Or maybe that was just a non-destructive operation. Because they have 0x90 in ops, right? Oh, and then they have nulls. Looks like it.