Hello, and welcome back to live CTF. I'm Josh, aka Nagasora, coming back for another cast back to back. And I'm joined by... Gamoza! Hello! It's good to be here. I'm super excited to be doing this live. Last year I did this, I think, over Discord with like a 60 second delay, and that made it a little awkward because I was commentating on things that had happened in the past. Yeah, the late CTF doesn't really have the same rig to do it. No, no, it definitely doesn't. So I'm super excited for this. So who do we got going up here? We've got Straw Hat versus Orga Kraut? Organizers and Sour Cloud, maybe? Okay, all right. They're a merger team. Making a big team. Because they got rid of team size caps or something recently at DEF CON? Oh, I don't know actually. Because I remember like everyone started joining and making these like bigger and bigger teams, which is just kind of interesting to see. Yeah. Well, Shellfish, I don't know if they've ever had a real cap because Shellfish has had hundreds of people it feels like. Yeah, exactly. Yeah. All right. Well, I think everyone's ready, right? Yeah. You want to go over and give it a countdown? Ooh, a five or a three? Let's give it a five. We'll give it a five? Yeah, you know, really ramp it up. All right. Let's get ready in five, four, three, two, one. Go. All right. Let's see what we got. First over at Orgacrout, they are downloading the challenge. Classic first step. Okay. Oh, I like this. We've got the anime background here, which I love to see. Does anyone know this character? I guess not character. This anime. Ooh, right into AIDA. No Binary Ninja here. No Binjo. We haven't seen Binjo. We haven't seen Ghidra. Okay. Only AIDA so far. I'm going to pull up a YouTube chat right now. So that way I can interact with people. See what they're saying. Oh, yeah, exactly. So immediately kind of going into here. I've got Straw Hat right in front of me here. Yeah. Oh, interesting. It has an Ubuntu VM set up. It seems like everyone seems to like MacBooks. Is that like a common thing? It's pretty common. I'm one of the holdouts for the Linux laptop. And honestly, it's saving this broadcast because the info is running on it now. Yeah. Yeah. No, that totally makes sense. Let me see. I'm grabbing the YouTube link. All right. So they're going into AIDA and they immediately go into Docs. POSIX OpenPT. It's interesting. I definitely find myself opening the main pages in a browser way more than I probably should when I'm on a system that has main pages in the terminal. Absolutely. But... I don't know why. It just feels nicer. CheckSec. What is that? CheckSec. So it prints common protections. Okay. Ah, I see. I see. Yep. All right. Yeah. It's pretty nice. The command line one used to have a really bad bug where it would report incorrect values. Oh. So that's very useless. It was useless. It was just actually harmful sometimes. But then I think that's been fixed because it matches up with my VDD output every time. Yeah. All right. I have the chat up now. Very nice. Do you want to put it somewhere here in the middle? Sure. Put it right in the center. My eyesight isn't that good. Yeah. You know, the glasses are deceiving. All right. So ttyioctl. All right. I haven't looked much at the challenge. I was too busy on my phone. Yeah. So the name of the challenge is IOCTL or IO Control. Me maybe. It is from a series of challenges from Glenn. Okay. It's notorious for cursed challenges. Ah. In the past, there have been torque engine challenges. There have been... What is it? Rock with weird instructions only. Oh, knop me maybe was one where it's like you have to jump into the middle of knops. Yeah. Let's start checking on Orgacrout. What are they up to right now? Yeah. Orgacrout. It looks like Stack Overflow, which is never a great sign. Yeah. Let's see. I did see that ChatGPT was open on the Straw Hats side. Yeah. It's the very first tab. So we might see some AI going on. Honestly, in the hierarchy, I'd put man page, Stack Overflow, ChatGPT. But obviously, it's upside down. So ChatGPT is the move. Now, let's see. I think we're both on the same website. We're both looking at man7.org. So it just seems like this is the way to do man pages on macOS. I guess, does macOS not have man pages? Is that not a thing? No, it has man pages. But this is a very Linux-specific challenge. OK. I don't know if they transfer over. I don't know if the options are different. Oh, yeah. Like, we're going to be learning this challenge with y'all, with them. We didn't write this. We haven't looked at it. No. No, we're basically solving this at the same time. Interesting. Just a lot of Googling right now. It's only... I'm curious if the challenge is just a simple, like, IOPTL call and you need to get the ARGs right or something. We haven't seen anyone really keep a disassembler or decompiler open for more than two seconds. Straw Hat is typing up Python. We do have our first... Straw Hat is typing Python. We have from PwnImport star. We're getting ready to just get everything going. Everything they need. Yes, yes. I don't know. I'm always really afraid to import star. I'm always afraid that's just going to make a mess of... It's super... Do you call it a namespace in Python? Is that the correct term? It's a module. A module? Okay. Nothing is namespace Python. It's only global. Everything is global. The locks are global. Not for long. There's that... I saw that. Almost a PR that removes the GIL. Is that going to be like when... What was it? OpenBSD removed their global lock. Every time you made a syscall, there'd be a global lock. And they removed that and immediately erased conditions on every single syscall. No way. Yep. You're telling me that processes are hard? It's very difficult. Especially when you have an OS designed for single-threaded stuff. What do you know about highly parallel processes? Interesting. So we're really just deep... Both are just in the deep man pages. I think they're on the same page right now. StrawHat over there reading something very closely. Yeah! Actually, OrgeKrout over here... Okay, well, as I say it... OrgeKrout creating a C script to try and figure out what IOCTL does. Oh, yeah. Okay. So you got a launch in the process, going interactive. And I think that's something we see a lot when we're doing CTF stuff. People love dropping into that interactive prompt. So they can just start banging out things, trying out stuff. And let's see. Do we have the first challenge running here? That's one of the big differences and approaches we saw last challenge, even. Was one team went completely static. And really labeled so many things before even interacting with one. No way! The other team was in GDB breaking on every option. Yep. And they were really close to one another. The receive until main is. Okay. Not using read until wrapper. Oh, I see. Is this an info disclosure? Just right on the command line? It just tells you where main is and where RxE is? Yeah, it is. That's great. Why don't my Chrome exploits tell me that? That would be really convenient. Because Chrome lost track of it too. It has so much memory to keep track of. I guess. Yeah. That's true. What do you want? Is the question here. We can maybe read some... Oh, nope. Code's gone again. Code's gone again. Jeez. All right. And then over here... Oh my god. Yeah, over here at Orgacrout. Orgacrout. They are xattering. This is a really fancy terminal. Oh, they're using PwnTemplate. PwnTemplate? It kind of creates a little working directory for you with PwnTools and pipenv. And it makes a PwnTools skeleton and stuff like that. I personally don't use it. But the last time I looked at it, it was kind of simple. Is that an emoji on that terminal there? Yeah, they have a snake emoji and a little steering wheel for a docker maybe. Like a ship wheel. Huh. All right. That's pretty fair. So here we're just basically parsing out all of the printouts that you're getting. And there hasn't been much reading of code, which is interesting. That's honestly the approach that I normally go for, is just banging it out immediately going into dynamic stuff. Yes, but what I saw there for a second, it looks like you're just getting an IOPTL call with args that you specified. Yeah, which would be pretty slick. But I don't know what sort of things you can do. Is it on a TTY? I didn't actually see what file is being opened. We're switching between these screens so fast. Too many arguments. Oh, so it looks like you get to pick. I think I saw a zero arg where you have the IOPTL number, and then it looks like two, three, and four. And it will prompt you, I guess, for the IOPTL code. So that's interesting. We're actually writing a function here to properly do these IOPTLs, which is pretty fancy. Yeah, does it allocate a VTTY or what? I didn't actually see what it opened. I've only seen it for like a split second. Yeah, can I get a nod or a head shake? A PTY, okay. Okay, we get a PTY. Is it dev PTY? Dev PTY 3. PTY 3, okay. Now, my favorite thing is PTMX, which I think is what basically everyone uses when they're doing their basic Linux exploits. For some reason, I can't remember what it was about the shape of that data structure that it allocates. It's just very convenient for using in your exploits and overriding the dispatch handles. Maybe it's just because it's really easy to get access to on Android. I think it has no permissions required. I haven't done Android exploits yet. This is so fancy. Look at this. Right? It's really colorful. I like it. I'm really impressed that we're seeing a function. Oh, here we go. Orgacrout scrolling through IDA. We see the project's OPPT 258, unknown what enum value that is. Huh. Okay. Info leak. And then it just... Oh, it looks like we're going to get that main page for this. Compromised password. That's not a good sign. They better get that fixed. Yeah, they have to. Yeah. It prints that when you start to challenge it. All right. So it looks like you give it... Oh, some flags. Okay. So it's probably... I'm guessing it's going to be like read-write or something like that. Yeah. Pty. I wonder if you can maybe corrupt a value in that struct. Yeah, that's kind of interesting. I'm trying to think if like... Look at the ads on this page. Oh, this is great. We found the CTF player that doesn't run AdBlocker. Yeah. Well, how does that work? It's just... I don't know. They just scrolled in really menacingly. I mean, I guess maybe... Let's... Oh, this... Docstore.mic.ua... What is this? Are we just like reading a book on how iOctals work? I guess so. That's pretty good. We're going to walk away from this with so much knowledge. I like Straw Hat. Straw Hat's doing exactly the approach that I would do, which is going into user include, grepping for the thing, trying to find exactly how these are made. And this is literally exactly how I do it. Anytime I want to figure out what does that code actually turn into is this. And the reason that's so complex is those I-O codes are all like macro-based. So I think that's an I-O... It's an I-O-W. The fact that it's a right I-Octal, the T is the special code that they're going to use. Probably stands for TTY in this case. And then it also has an int, which is the arg. And in that macro, it's going to use sizeof. And basically, the I-O control code has the T in there, which is like a magic identifier. Some flags about if it's read, write, or whatever. And then the size of the args. And I forget what the 31 hex is. That's kind of interesting. Oh, and here we have a standard printout where you just go in for the %x. I think we're just ignoring that warning now. He's working in an isolated environment just trying to figure out what it does. What does it transform? What can I touch? You know, he obviously knows all the addresses that were leaked from his own code. Right. So it's essentially... He's rewriting the challenge to try and figure out what it can do. Context log level debug? Do you know what that does? Yeah. PwnTools, that prints like every transmit, every receive, the sizes of things. Do you get like a hex printout when they run? Oh, nice. Yeah, it looks like we have to find some way to do corruption on our own process using just these TTY octal codes. And I think I could be really wrong on this. I think octals are hierarchical, where you can have some generic TTY ones. But then beyond that, you can have pseudo TTY ones. And they kind of build on top of each other. So I think a pseudo TTY like inherits TTY. I could be very wrong about that. I have no idea. That's more than I know about. It's been a long time since I've read advanced programming in the Unix environment. That's for sure. I think it is. Yeah, no, I never did. Yeah. But this is kind of fun. I really do like this as a challenge. Ah, looking for... Yeah, get it. There's a getter for the window size, a setter for the window size. And it looks like, yeah, if you called that getter, it's going to probably fill out that structure where you get rows, columns, x pixels, and y pixels. And, you know, it'd be kind of cool if we could see someone go after that, maybe use some weird x command to, like, force the terminal to some weird size, and then write some shellcode with the window size. I'm wondering if TTYs have a maximum size up there that... I have no idea. Like, can you just have it go way off the screen or, you know... Huh. I assume you can. I'm sure there's a better way to get, like, arbitrary outputs. Oh, yeah. TIO, I don't know if we're limited to the I-O control code that we have. And let's check in on Orgicrout, let's see what they're doing. Yeah, okay. So Orgicrout going through... They're trying... They're going to try every IOC. They're going to run this thing with every IOC. Now, that's what we call fuzzing here. That is an advanced security technique, and that's a really good way to find bugs. So I think this is an interesting approach. We have... It looks like no functions here. We're doing a... Wow. So I guess we're just going to blast the apples until we get a result. Now... I really hope they don't run out of that piece. I will say, from Python, it's going to be really hard to enumerate all four billion combinations. And the I-O control codes are pretty well spaced, because some of those, like, read-write flags are spaced in just weird ways. So I've done this before. I've brute-forced I-O control codes. But if you really want to do that, the best way to do it is to enumerate, like, understand, basically, how the control code is packed, and then, like, do reasonable numbers. Like, I think the size might be the bottom 16 bits. And none of these are going to really reasonably take more than, like, a 64-byte structure. So you could really reduce the state space that you have to search. That's just going to be a lot of iterations. I don't know if he has time to write that. That's true. That's true. So you just have that sitting around. And yeah, we do have control of the I-Optimum number. I don't think there's any filter. I think this is purely... No, there's all of them. It looks like you just have an ARB number and ARB args on a PTY, and you just have to... Yep. And you just have to find a way to make that work. And I think that's probably not going to be too bad. It looks like... Oh, we're naming stuff over here on Straw Hat. We're actually doing some AIDA stuff. Actual reversing, which is kind of interesting. I mean, honestly, I'd say this is pretty readable. That shows me basically everything I need to know. When 70% of your output is strings, I think I know what's going on. Yeah. So that's cool. So it looks like you get the hexadecimal of where main is, where the stack is located. And now you're just going to... Is that getWindowSize? Oh, there we go. He just ran that. And I think that's... Yeah, he just threw his window to the right. Yeah. That's why he's running in poor man's demos. So he can see the window changes. Yeah. So he has gotten the Iowa control codes for set and getWindowSize. And honestly, that makes sense because you could just set the window size first using that, what was it? Four ints or four shorts or something like that. And then just call get. And you'll just get the result at a different address. So I feel like that's a pretty good approach. Now, that does take a pointer to a structure, if I'm not mistaken. I don't think it takes multiple args. So how would you set the pointer to that structure that has the size of that TTY? Well, you have the stack offset, and they allocate it right before. So I'd assume it's on top of the stack. Oh, OK. Yeah, you're right there. Do you have any good place on the stack where you can stash this? They don't have any leak beyond that, though. Right, right. Like, you can't read stack memory. Outside of, obviously, the struct. Because you know where it is, you have things to interact with it. So I'm curious to see where this goes. This is really tough, because you have to kind of make the decision early on. When you're doing these CTFs, it's like, should we commit to this? Like, getting and setting the window size. Obviously, if we can put a pointer to control data, then we can set the window size, put a pointer to other data. And now we have just overwritten something with control data. I'm curious, if input is done on the stack, you can push it down, maybe IOCTL pointer to the stack? Or is the pointer just set in there? Does it operate on top of the stack? I don't actually know what that stack printout is. Yeah, we print out, at the very top, it's argca, which I don't know where that variable is on the stack. If it just takes an FD, can't you FD standard in and make, like, a fake and IOCTL stroke be a standard input? I don't think you have control of the FD. For the IOCTLs? Yeah, doesn't it ask you what FD you want? Hmm. I think it's only the... I'm getting a thumbs up from the author. It asks for the FD? I'm on the right track. All right. Ah, I see. OK. OK. OK, every single parameter is controlled. Nice. OK, so you do get the FD. So, yeah, I mean, Parliament of Ducks just got it. OK, wow. Wow, that was fast. That was quite fast. I'm curious what approach they did. I'm thinking what it is, is you take FD0, you have standard in control, it operates on standard input IOCTL, you send EOF after your fake struct to be a standard input, and maybe there are function pointers in there? I'm not really sure about the next part. Hmm. Do you have only IOCTL? It's one IOCTL call, it looks like. One IOCTL call. OK, let's see. Yeah, let's go back over to Orge Crowd. They've been in IDA, too. OK, and they're using the dark scheme in IDA, which is interesting. Thank you. Every time I use the dark scheme in IDA, I kind of regret it, because some things just don't look right, or the colors are off, or the highlighting is weird. Yeah, I don't know what it is. I don't know if it's gotten better or what. But I remember, like, a couple times, like, you'd pop up a window, like, just some weird, you know, listing of, you know, functions or something like that, and it would just be white, or it would not match the color scheme, and that would always just bleach your eyes. Oh, it's painful. I cannot light theme. We have a couple of people in the office who light them. Yeah. I know it's better to read. I know it's, like, technically supposed to be better for your eyes and, like, your ability to, like, read the text. But I'm not convinced. I'm a dark theme. I'll take the extra second for comfort. Yeah. So, what do we have over here? Is it still... are we still doing the brute force of all the eye octals? It looks like they have that in there, but they're working above it. So, I wonder if they thought of another approach they want to try first. Yeah, yeah. Huh. Oh, they got it for a second. Oh, no, they're just trying to figure out how to run it, it looks like. Okay. Yeah, this is tough. Yeah, okay, you have four different eye octals. So, you can do 0 arg, 1 arg, 2 arg, or 3 arg, I think. Okay. And, yeah, this is really tough. Like, do you want to commit to doing the window size approach? Because, obviously, that's... I'm sure that's Turing complete. You can probably get your arbitrary corruption with that. But, is that the best eye octal? Is that the easiest eye octal, or is there an easier one? All of the eye octals are the best eye octal if they get you there. Right, exactly. Like, this is a solve it and solve it first challenge. Yeah, yeah. You're not trying to get undetected, you're not trying to get minimal size. Over here on Straw Hat, it looks like we're looking at the stack overflow on the responsibilities of each pseudo-terminal PTY component. And look at that, we had a diagram up there? That we are, like, I think we're, like, learning how, like, just PTYs work on Linux. We're learning how to control IO. Yeah. This is interesting. Okay, we're getting more and more different C printouts here of, basically, what these IO control codes are, so we can go test them out, see how they go. I do like that every time we come over here, their window is a little bit larger. Yeah, yeah. Look at this, Oracle Streams Programming Guide. When you end up on an Oracle page, you know you're in. Yeah, like, whenever I end up on Oracle, I'm getting out immediately. Oh, yeah. Oh, look at that, struct.pack. Is this just the exploit right here? No way. Well, it's not, because that needs to be a pointer. That is the right structure. It is four shorts. But you will need to put four shorts somewhere in memory, know the address of it, and then give that address. That's a lot of work, too. Right. And I haven't seen IDA enough to get the stack layout yet. So I, like, don't know, like, because we know the stack address, we know where main is, and it's like, where can we store some things that are controlled over the network or something that we can end up, you know, writing out somewhere in memory, or, I guess, storing in the kernel first, then writing out to memory with a GET request. It looks like you can do multiple app calls. Yeah, yeah, it does look like a loop. Yeah, which I think should make this quite easy. There's, I think, many of these, because a lot of these apps are getters and setters. So you're just... You transform that struct on the stack. Right. Have known data, known address. Right, exactly. Yeah. Interesting. Okay, so they're walking through. They have lots of naked ones. Huh. Looks like they're just making invalid calls right now. Yeah. Yeah. Let's check in on Orgacrout, see what they're doing. Orgacrout? They are making... It looks like an array of interesting IOCTLs. Okay. That they want to... Yep. Oh, it might be that they're making a IOCTL chain. I don't know. Yeah. IOCTL op. Huh. This is going to be very interesting. This is really interesting. Because we don't know where we're at. Have we gotten a crash yet? Oh, no. There's the stack. Okay, FD number, number of args, and then I think four args. I think I got all those. You're fast. Yep. FD number, number of args. Yeah. Yeah. So you should know where those args are. So if you were to just shoot... I don't know if it's okay if you have invalid IOCTL. I imagine it will just silently ignore it and just go through again. We saw that on Straw Hat. They were getting lots of negative one returns. So I think what I would do is I would use like the three or the four arg version, because I think they're 64-bit ints. I don't know what they're doing for A2I or whatever that might limit the space of the ints. But you should be able to do one pass through using the full things. Who cares about the IOCTL? Just let it fail. That will set up the args on the stack. And now you can come through and put a pointer to that. And now you have control data that you can write to some data you point to. Although you do have to dodge. You might have to put them further up the arg stack, because you need the first args. If you use one of these arguments first, then you can go back and just flubber the bottom one. Exactly. Yeah. And that's, I think, the approach that I would take. But once again, I haven't seen much of the IDA here. You have args in known places. Right. Now what? Right. Yeah. So I don't know. I think just a setter, put it in the kernel temporarily, and then get it back out into... I'm sticking true to my standard input. Yeah. Standard input. Yeah. I'm sticking true to FD0, reading from FD0 for the IOctal. But do you have access to a read? Can you do a read through an IOctal? Oh. Oh, no, because it just asks for an FD. It doesn't check if... No? Oh, because the FD's on the PTY. Yeah, but you only have the IOctal sys call. So how would you get that to do a read? Like, is there a way to cause a read from standard in or whatever through an IOctal? Or am I misunderstanding? Well, I wonder if it's... Can you buffer standard input, maybe? Send the IOctal to FD0. It doesn't prompt for input, but it reads the buffer data. Like, you can buffer it in the choice input. Hmm. I'm not sure. I don't know. Okay. Yeah. Yeah. Okay, and it looks like we're adding more libraries here. Oh, you know what? We just got a file control, which I think we're going to literally write the example out so we can try out how does this actually work. Like, assuming we have full control, what kind of FD number are we going to get? Now, that's going to be FD3, of course, because 0, 1, and 2 are allocated to your standard ins and outs. And so he's going to print out a 3. He doesn't have a helper in this terminal. They'll shove his FDs further down. Yeah. Yeah. It automatically allocates more. And then, okay, we're getting these values. Yep, and this makes sense. You're going to get... We're going to pass a ref. So we're going to actually get the window size here. This is really interesting. So it's kind of dangerous, in my opinion, to keep going in and out of Vim. Like, I'd probably pull Vim up on another window because you're going to lose your history or your undo buffer here if you end up making a mistake. Really? Oh, yeah, I forgot. Vim 8 added that or whatever? I think I just disabled that immediately. Oh, that's so nice. But it adds a bunch of temporary files, and I hate that. Put it in your user directory or put it in something you can clean up and do. So much work. Oh, my. So much work. I've seen what you do on screens. I keep my environment pretty default here. Yeah, oh, yeah. Well, it looks like these guys are using what works for them. Yeah. That happens to be four terminals kind of splayed out and man7.com. Yeah. Man7.org. Man7.org. I guess. Which you would think Ubuntu would have the Linux man pages. Oh, it does. Yeah. Oh, it has all of them. Yeah, that's like... Well, all of them for what you have, obviously. So that's kind of interesting. Chad, what do you say? Do you normally use in-terminal man pages or do you end up on like a die.org or I guess man7.org? I guess that's what the cool kids use these days. It's just the first one that comes up because it has man in the domain, I guess. Yeah. SEO. Huh. That's pretty wild. I feel like we're kind of looking at the same thing. We're really, really committing to this getting and setting the window size. Oh, my God. And we're actually far enough in that the first hint has been released. Okay. We haven't seen what that hint is, have we? We have. Has anyone pulled up that hint? They might need to be hinted at that there's a hint. We're 20 minutes in. Okay. Okay. Huh. I don't know. I think these approaches are pretty good. Oh, and now we're doing S traits. So now we're... So Orgo Kraut. Yeah, so Orgo Kraut has Ida open and that was interesting in the non-pseudocode view. But yeah, it's literally just while read int, do another. Yeah, you say zero or one if you want to read another. So you have an arbitrary amount of arbitrary ioctals, arbitrary FD, arbitrary io-control code, arbitrary args. So it is actually ioctal-oriented programming. Yeah, yeah. I think that's a great challenge. I don't think I've seen that before. It's just, it's brilliant. That's Glenn's challenge is he just comes up with weird ideas and makes them, but they end up being really cool. Huh. I like that. The other thing I was thinking about, which would be a fun challenge, is the... What's this syscall that always has bugs and handles the locks and stuff on Linux? The super fast locks. Why am I blanking on it? Was it Geohot's bug way back in the day was on this syscall? Oh, jeez. Oh, I forget what it is. This is outside of my scope of knowledge. I'm not a historian. Oh, it's like the fundamental way that you do fast locks on Linux, where they're like, you give it memory addresses and it will alert you when they've changed so you can come back and try your atomic spin lock. But that whole API is, I think, turn complete in the kernel. Really? You could, I'm pretty sure you could just give it straight up invalid addresses because it won't crash your program because the kernel will fail to access it. So that would allow you to just try random things. Or if you don't know an ASLR location, you probably could just jam things in there. And I think you can tell the kernel to increment or decrement a value at an address, which is fantastic. So you can do address space pre-coursing in the kernel. Yes, yes, yes. So I've wanted to see that. I've wanted to see that in exploits. I've wanted to see it in just so many things. I think it's a really cool way of doing it. Futex, yes, Futex, exactly. Futex. Because Futex has a bunch of different operating modes. Is it really buggy? I didn't know that. Well, that's not even like the bug. It used to be pretty buggy. Like, there was one really big Futex bug, and I think that's what... I think it was like a GeoHotBug way back in the day. But it's just a really complex... you know, immediately there's an enum of a bunch of different modes that you can hit in that. So, and this kind of reminds me of that same thing. In fact, I think that would apply here. If you gave IOCTL an invalid address, the kernel's going to report back, bad adder. It's not going to crash your program. So if you need to make a couple guesses, in this case, I don't know why you would, you have the address that you care about. But, oh, we're in read int. We're seeing what we get. It looks like an LX was the read int command, which means that you will get the full 64 bits. Oh, that's interesting. The return code is 32. On Straw Hat, they're adding hex to everything. I think they weren't using hex. And explicitly, it's pulling it in as hex. And that really hurts. This might be a bit of a breakthrough for them. I think that is a pretty big breakthrough. Oh, no. Yeah. Yeah. Just goes to show, no one knows how this works. Right. Yeah, I mean, that's really tough. That's the sort of thing that you get stuck on for a while. I think that's why he went into GCC to try it out. And then it probably worked in GCC. And he's like, what the hell? You can see, trying to do four ones. He got bad adder from the IOCTL. And that makes sense. That totally makes sense. So it looks like we're probably on a pretty fast path now. I think Straw Hat should have a pretty direct route. You know where your arcs are. You know what you control on the stack. I mean, that IDA output is fantastic. They have that going now. It's going to be smooth for them, whatever they want to do. For sure. What do we got going on, Orger Crout, over here? Orger Crout is looking at PTY docs. OK, you know. I feel like we've almost had time to read through all of these docs by this point. I feel like, if you just take screenshots of every frame, you could see every IOCTL doc. Right. Like, you could have the full thing there. Yeah. Forgetman7.org. Just pull up live CTM. Right, right. This is wild. Oh, I think this is the... TC Send Break? OK, so he's just going through the TC Send Break. Does that get you a write? Because I imagine you're going to need an arbitrary write. And so you're kind of going to need some sort of a getter. I do like the window size, because you have a setter and a getter. You can store stuff off. You can pick it and then write it to another place. I mean, basically, it's memcpy, but through the kernel. Is the argument for that UN16? For the IOCTL? So all the arguments will be long. So it will be 64-bit. And so it'll just be one arg, which is a pointer to a structure. And the structure is just four shorts that are packed in memory. I don't know what the shorts are. I think it's some pixel and column and size of the terminal sort of thing. But it looks like that's what we're committing to on Straw Hat. And Orgatron, I think, is still trying to decide what IOCTL they're on. They were reading the same exact thing, actually. They're thinking about the same approach. Wow, and you get the IOCTL return. So you could potentially use that if you needed to figure out some information from the kernel. I don't think that's necessary here. I think you can do this plainly. I don't think you need anything to fail. I think you can use it to verify that your hard write worked. Which is great. It is great to have an oracle that stuff is going well. It does only return you a 32. Yeah. Or I guess in 32. Right. Huh. Yeah, we'll see what we're going to get here. OK, we're doing some math. So we're subtracting main from the main of the relocated thing. This is going to give us basically the slide. Or whatever this actual ASLR offset. And that's good information to have. I guess you'll need that because... Is there a win function maybe they're calculating? I don't know if there's a win function. I don't know if they're just going to go right to like a system. Oh, they're writing like ESS or something? Yeah. OK. Read eight. OK. Making just a clean function for read eight. OK. IOCTL321523. No hex there. Which is... Wow. Interesting. OK, and then we're passing in those args. And I think now we're going to... OK, now we're going for a straight read and write primitive. I don't know if these values are controlled yet. Yeah, this is just triggering the read to an address. Triggering the write to an address. And yeah, I guess it is an eight byte read and write because it's a four short. So four times two is your eight. So... But that read isn't... Oh no, well, yeah, yeah. It's just the address. Because it'll just return success. That's right. Yep, yep. So it's really going to come down to what? Yes, that is getting the read and write primitives. Yeah. Over on Orgacram, we had some math for a second there. But it looks like they're going for an offset from arg two. OK. Unknown. I think that is kind of similar to what I was thinking. Because I think read int, I think that's getting a 64-bit hexadecimal value. So if you want to go the approach where you are reading and writing in arbitrary eight, I think you have to use the higher args, come back around. You need to use the low arg one so that you have the address. And then you can't clobber the other things. But that should be totally fine. I think that approach would just work. Let's see. AW eight. Oh, wait a minute. Oh. Oh, I saw set seven. I got excited. OK. Set win. Oh, OK, they're throwing some As in there. We're going to try and use address As, get and set window. And so now it looks like we have the same approaches on both. Oh, it's going to be a real close race. Yes. Huh. OK. Now it's starting to get more to like a mechanical thing of like, how fast can you write the code to do the right thing, get that feedback? Because I think both of them are clearly aware of the path that they're going to take. And I agree. It's a winning path here. Oh, it looks like they got a write of four bytes. Yep. There's yep. There's that window size. So that's the actual structure that they're going to be able to control. Nice. And I do think they're going to need to rely on the uninitialized memory. Right. 32. I don't think that's a 32 bit write. He got a 32 bit write. From what? Do you know what? From this? I didn't see exactly what happened. Yeah, I didn't see that either. Okay. I'm not sure. That'll be really interesting to see. It might... Oh, it might be because he's doing offset from argc to arg2. Adder... Set win. Global ioctl. I don't think that's how that ioctl works. Oh! That makes sense. He's doing both in one syscall. Yeah. Because it'll just ignore that second argument. So you can just put your value in there, put the address to that, so you don't have to come back around. That totally makes sense. So that'll just work. Wow. I'm surprised it doesn't fail on invalid argument numbers. I won't care. It won't know. It doesn't know until it gets into the kernel and does the switch statement. I guess it has to be fast. Why does it do argchecker? Well, yeah, why would you do that? That's a perf loss and Linux is fast. So this, I'm pretty sure Orgertrout's on a very, very, very good path here. They're on a laser path. They have... Do they have the address computed? Do they know the offset of arg2? But it's exactly what they have to do. They have the address of arg2. They calculated argc-ox24. Then they're basically, like, right there. Yeah. That's looking pretty good. Let's check in on strawhat and realstrawhat. Okay. They're still doing this, like, invalid ioctl. Oh, you know what? That's what I was talking about. They're doing an invalid ioctl. They're putting a value deeper on the stack. They'll come back around, and then they're going to do their writes. So that's interesting. I like Orgertrout's more, even though strawhat is doing it the way that I initially thought of. I feel like Orgertrout's is a little restrictive. I think it's cleaner. I think it's cleaner because it's guaranteed it's one pass. You don't have to do an invalid ioctl, which is nice. It's just a little quieter for, you know, you don't want the IDS to figure out your exploit here. So you want to keep the errors to a minimum. You want to have a nice, clean environment. Yes, exactly. Exactly. So it looks like we're trying to figure out AW8. Write 8? AW8? Address write 8? Address write 8. Maybe. And they're going to be using org4, which makes sense here, because they're doing the four arg ioctl. And yeah, now we're doing some math in it. Oh, hang on. Over on Orgertrout, we're calculating the base address to... What function was that? Is he trying to pivot to the scanner for like a cleaner arbrite? God, I don't know. I feel like this arbrite's about as clean as you can get. Yeah, it really is. Pass in numbers. It puts numbers. I'm happy with this. Have we seen a crash yet? We've had the debugger open. I think a debugger has only been... It's only been control C. Yeah. So I'm excited to see our first crash. Oh, we have a rock going. We wait. Rock? It looks like he's writing red. It looks like he has arbrite on top of the stack. OK. And he's overwriting the puts. Does it have railroad, though? Is he writing... You will be able to skip over the cookie, which is very nice for this primitive. No, just being able to poke wherever you want immediately. Oh, yeah, it's just the beautiful, beautiful primitive. Yeah. But it looks like... I don't know if this binary has railroad. Because... or full, partial, whatever. Yeah. But he wants to jump to puts unless he's just going to use puts as a lead. Interesting. Because I assume he's going for, like, a got overwrite. Yeah, I guess so. Huh. I'm going to have to close chat. I'm running out of battery right now on my phone. All right. Red adder equals red adder. Oh, I'm making progress here. Yeah. Straw hat. Now it's really a matter of what approach are you going to pick to land, or get your executioner, or leak the flag. I think all of these you're supposed to run a command to win. You run, like, a shell command? You get a shell, you run the submitter, and a little happy message pops up. Interesting. So I don't know what puts is going to be for. What was added here? Like, Orgicrout is about to check if they crash on invalid access to 414141. OK. And it looks like they're just going to send their option. Wait a minute. Are we back to brute forcing? No, no. He wrote our option for this. Well, then why are we working on a brute force loop enumerate all the octal thing? I think he's just... Oh, that's where his code was. Yeah. Yeah, OK. OK, so now he's got to switch back over. I see. Yeah, required argument not an integer. Usually numbers are good. Now... All right, so he's going to be debugging that for, oh, there we go, u64. Hang on. Cool. And what did we get? Where's rip? Are we in puts? We're in puts. We're in puts. We're red on puts. Red is... And we got a success. Wow. So, yeah, it looks like... The stack is A. He's writing the format. Yeah, that's looking pretty good. That's looking really good. It's close. Let's check in on straw hat. Let's see where we're at. I'll keep an eye on him. We should have an arbitrary write here. I think we're going to probably see that crash. I don't know if he's going to try and write maybe over that return address and just see what happens. You also have the arb read, which is quite nice to have. I don't know if you really need to use that. I mean, you have binary base. You can just read a PLT and be like, oh, I'll just appear. Yeah. Yeah, have any of them looked for a win function yet? I don't think there is a win function yet. Okay, no win function? Yeah. I imagine if there was a win function instead of A's, he'd just put that. Yeah. Yeah, exactly. Like, you would just be done at this point. So, I mean, there could be a win function they haven't looked yet, and that would be rough. Oh. You know? So... We've been in this one function, yeah. Huh. Yeah. Okay, so Orgicrout running their script again. Okay. They have print out of... Is that libc? 7foe? That doesn't look like stack address. That looks like the libc link. 7 hex bytes. Yeah. Either libc or ld, I don't know which. Unmapped address, context failed. So, they're actually hamstrung by their Jeff installation. They just had a Python, like, int access error. Oh, no. Oh, no. So, I really hope it doesn't come down to that. Because they are... They got a libc leak. They have the libc. They can calculate offset to exec be and pass whatever they want. Exactly, yeah. And yet, they're calculating the leak right now. Or unpacking it. Yep. U64, what does that do? Is that just parses it? Unpack 64. Oh. It just bytes and turns them into int versus an int. Oh, so you don't have to do struct.unpack every time. Oh, that's quite nice. Yeah. Hey, we got a SIGSAT, that PC of 414141 on strawhat. Oh, this is really close. So, now we got that going. Strawhat is not 4141. But Orgicrout is calculating offset to exec be. I know. I know. Oh, my goodness. That's tough. It really comes down to how quickly can you go from that. What is this all the gadgets? Strawhat's about to pull up... Oh, I thought they were going to pull up all the gadgets function. I was very curious what that was. Because that... What if that just has... What if that is a win function or something like that? Because that function has not been needed for anything else yet. It's clearly in there, like, intentionally. Oh, yeah. We're looking for the got here. And we've got ioctyl in there. So, we're actually going to try and use the address of the ioctyl entry in the got. Oh, so they don't have to call a different function. They just look back around and it's there for you. Okay, that's kind of nice. So, we'll see. Oh, hang on. Okay. Orgicrout. I see rop.call libc.symbol system. Wow. This is... Is that going to work out of the box? Yeah. I mean, they set the base address of libc. They loaded it as an ELF. No, PwnTools is nice. Yeah. I've just never really used PwnTools. Oh, oh, over here on Straw Hat, we're looking at RopGadgets. Oh, so they're both building chains right now. One of them looking manually and one of them is PwnTools building. Mm, yeah, we got a PopRDI gadget. It looks like a PopRDI ret. So, just straight up prepping for gadgets. This is basically manual versus the machine at this point. Well, Orgicrout now doing system on BSS. Okay. And then time.not.sleep, and then they're sending bin.sh, I guess. Yeah, we'll see if that drops us in. Oh, no, no, no, no, no. They forgot the null byte at the end of bin.sh. Do you need to manually specify that? Yeah. Nuntep has no... Oh, they put it too early. They loaded libc later, I guess. Oh. Or they type out the libc name. Oh. Oh, it's just that libc. Weird line. You just need to help libc, so. Oh, this is tough. See, this is where manual sometimes can get ahead. I think manual should always be slower in this case. But in the off chance that PwnTools doesn't work out of the box or has some error, you might end up fighting PwnTools more than you would have to fight just making the RopGadget. Right. Right. PwnTools, you need to go look up docs. Well, not docs.man7.org, of course. Right. But you need to go look up docs. You need to figure out how it works. You need to debug anything that went wrong. Figure out what the return code is. This, you're just like, oh, you know, my gadget's right here. Yeah. This is... This is going to be pretty tight, I think. Yeah. Let's see. Yeah. Over on OrgaCrow, we just got the error, cannot send a migrated chain, which is one of those usage overhead things. Right. Because I have no idea what that means. Yeah, I don't know what that means either. They slid it around in memory, and now it's bad. Oh, wait a minute. Is that a shell? That might be a shell. He just needs to click left. No, don't control C it. Or is he just going straight live right away? Does he just... no. Is he going live? I think he went live. Live? Cannot append to a migrated chain. Still no idea what that means. Yeah. Why did it work like sometimes, and sometimes it doesn't? I don't know. Oh, he forgot dot strip, I guess. Nope, cannot append to a migrated chain. Huh. Yep, and this is where it's really dangerous. He's scratching his head over on straw hat. Yep, all the gadgets. So all the gadgets is literally everything you want. It is your pop RDR, your pop RSP, your pop RBP. So it is literally all the gadgets. I now see what that function is. So since the ROP chain is going to be so simple here, it might be best to just straight up go for the manual chain. Because this is the risk of PwnTools. This is why I'm always scared of this. When stuff breaks, it's just, you're in a really tough spot. Yeah, really. Yeah, still having that error over there. Still making constant progress. But here we're just making progress. We're making constant progress. And I'm sure PwnTools will just automagically work once it's figured out. Did he just delete all that code? Or just move it around? I think he deleted it. Huh. And then let's see. We got a pop RDI, puts main, quit. Let's see. Is this really going to go down to a ROP race? Yeah, this is definitely a ROP race. Oh, stop using PwnTools ROP. It's fine if you really know how to use it, but it looks like it's a little unfamiliar with it. And left justify, this is some advanced Python right here. Well, he wants to load it, make sure it's 8 bytes exactly. Yeah. So he's just left justify with probably null bytes. Yep, that's exactly what he's doing. U64, you have a clean load into Python. Yeah. And we're doing an NM over here on libc. It looks like we're trying to get some addresses out of libc. OK. And we've been told it's a minute to sudden death. A minute to sudden death. A minute. They better start ROPing like they've never ROPed before. They have to ROP their butts off. That's going to be really tough. I don't think these are 60 seconds away, unless PwnTools automatically starts working. I don't know. If you can append to a migrated chain. Oh, it's really close. Oh, it's so close. I feel so bad. ROPing live is so difficult. You're just like... Oh, gosh. You have to keep all of this stack space in your head. You have to know where you're stashing all your stuff. I can barely pop lock and now they want me to ROP it? Yeah, exactly. How? Nice. Nice. That was pretty good. Thank you. Yeah. Strawhats... Oh, Strawhats kind of paused here. Are they both... They're both... They're both stopped in their tracks. I think... I think Jordan just went and told them that we're going to sudden death. I see. OK. No way. Now, sudden death, as it was last year, and I think as I was told this year, sounds like it's a really, really, really easy challenge. Bare gets, format string bugs, what commands do you want me to run, basically? Now, those are probably one of the hardest for me because I don't think I've ever done, like, easy challenges. So I don't know... Like, I don't think I've ever done a printf bug before. Really? No. I don't think it's ever come up. Straight in the kernel? Yeah, I mean, it's just... I've never seen them in real life. I've just been signaled something in semaphore. Yeah, I don't necessarily know how to read that, but I think... Oh, is there a third hint that got put? No. What? What's going on? All the terminals are closing.