WEBVTT

00:03.980 --> 00:07.020
Hello, and welcome back to live CTF.

00:07.640 --> 00:12.260
I'm Josh, aka Nagasora, coming back for another cast back to back.

00:12.260 --> 00:13.800
And I'm joined by...

00:13.800 --> 00:14.480
Gamoza!

00:14.480 --> 00:15.220
Hello!

00:15.220 --> 00:16.100
It's good to be here.

00:16.100 --> 00:18.080
I'm super excited to be doing this live.

00:18.080 --> 00:27.380
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.

00:27.380 --> 00:29.680
Yeah, the late CTF doesn't really have the same rig to do it.

00:29.680 --> 00:31.520
No, no, it definitely doesn't.

00:31.880 --> 00:34.060
So I'm super excited for this.

00:34.060 --> 00:35.480
So who do we got going up here?

00:35.480 --> 00:39.280
We've got Straw Hat versus Orga Kraut?

00:39.800 --> 00:42.640
Organizers and Sour Cloud, maybe?

00:42.640 --> 00:44.060
Okay, all right.

00:44.060 --> 00:45.000
They're a merger team.

00:45.000 --> 00:46.260
Making a big team.

00:46.500 --> 00:50.140
Because they got rid of team size caps or something recently at DEF CON?

00:50.140 --> 00:51.360
Oh, I don't know actually.

00:51.360 --> 00:56.580
Because I remember like everyone started joining and making these like bigger and bigger teams, which is just kind of interesting to see.

00:56.580 --> 00:56.960
Yeah.

00:57.420 --> 01:02.880
Well, Shellfish, I don't know if they've ever had a real cap because Shellfish has had hundreds of people it feels like.

01:02.880 --> 01:04.300
Yeah, exactly.

01:04.300 --> 01:04.420
Yeah.

01:04.840 --> 01:05.780
All right.

01:05.860 --> 01:07.740
Well, I think everyone's ready, right?

01:07.740 --> 01:08.140
Yeah.

01:08.140 --> 01:09.780
You want to go over and give it a countdown?

01:09.780 --> 01:12.360
Ooh, a five or a three?

01:12.400 --> 01:13.740
Let's give it a five.

01:13.740 --> 01:14.600
We'll give it a five?

01:14.600 --> 01:16.280
Yeah, you know, really ramp it up.

01:16.280 --> 01:16.940
All right.

01:17.060 --> 01:23.000
Let's get ready in five, four, three, two, one.

01:23.080 --> 01:23.620
Go.

01:23.620 --> 01:24.580
All right.

01:24.700 --> 01:25.940
Let's see what we got.

01:26.460 --> 01:30.420
First over at Orgacrout, they are downloading the challenge.

01:30.420 --> 01:31.780
Classic first step.

01:31.920 --> 01:32.340
Okay.

01:32.340 --> 01:33.300
Oh, I like this.

01:33.300 --> 01:36.100
We've got the anime background here, which I love to see.

01:36.180 --> 01:37.980
Does anyone know this character?

01:38.240 --> 01:39.560
I guess not character.

01:39.560 --> 01:40.720
This anime.

01:41.080 --> 01:42.500
Ooh, right into AIDA.

01:42.500 --> 01:44.080
No Binary Ninja here.

01:44.080 --> 01:44.660
No Binjo.

01:45.100 --> 01:46.360
We haven't seen Binjo.

01:46.360 --> 01:47.460
We haven't seen Ghidra.

01:47.460 --> 01:47.840
Okay.

01:47.840 --> 01:49.060
Only AIDA so far.

01:49.060 --> 01:51.560
I'm going to pull up a YouTube chat right now.

01:51.560 --> 01:55.840
So that way I can interact with people.

01:55.940 --> 01:57.040
See what they're saying.

01:57.040 --> 02:00.520
Oh, yeah, exactly.

02:00.840 --> 02:02.860
So immediately kind of going into here.

02:03.660 --> 02:06.400
I've got Straw Hat right in front of me here.

02:06.420 --> 02:06.900
Yeah.

02:07.200 --> 02:09.320
Oh, interesting.

02:09.320 --> 02:11.780
It has an Ubuntu VM set up.

02:11.780 --> 02:14.280
It seems like everyone seems to like MacBooks.

02:14.280 --> 02:16.320
Is that like a common thing?

02:16.320 --> 02:17.040
It's pretty common.

02:17.040 --> 02:19.520
I'm one of the holdouts for the Linux laptop.

02:19.540 --> 02:23.400
And honestly, it's saving this broadcast because the info is running on it now.

02:23.400 --> 02:23.900
Yeah.

02:23.900 --> 02:24.360
Yeah.

02:24.360 --> 02:25.580
No, that totally makes sense.

02:25.580 --> 02:26.240
Let me see.

02:26.240 --> 02:28.020
I'm grabbing the YouTube link.

02:28.120 --> 02:28.500
All right.

02:28.500 --> 02:33.920
So they're going into AIDA and they immediately go into Docs.

02:33.940 --> 02:35.740
POSIX OpenPT.

02:36.400 --> 02:37.740
It's interesting.

02:37.880 --> 02:46.020
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.

02:46.020 --> 02:46.960
Absolutely.

02:47.260 --> 02:47.740
But...

02:47.740 --> 02:48.140
I don't know why.

02:48.140 --> 02:50.240
It just feels nicer.

02:50.720 --> 02:51.520
CheckSec.

02:51.520 --> 02:52.640
What is that?

02:52.640 --> 02:53.260
CheckSec.

02:53.260 --> 02:54.760
So it prints common protections.

02:54.760 --> 02:55.020
Okay.

02:55.540 --> 02:57.100
Ah, I see.

02:57.100 --> 02:57.840
I see.

02:57.840 --> 02:58.380
Yep.

02:58.380 --> 02:58.980
All right.

02:58.980 --> 02:59.300
Yeah.

02:59.300 --> 03:00.240
It's pretty nice.

03:00.240 --> 03:04.160
The command line one used to have a really bad bug where it would report incorrect values.

03:04.160 --> 03:04.540
Oh.

03:04.540 --> 03:05.860
So that's very useless.

03:05.860 --> 03:07.220
It was useless.

03:07.220 --> 03:09.460
It was just actually harmful sometimes.

03:09.460 --> 03:14.080
But then I think that's been fixed because it matches up with my VDD output every time.

03:14.080 --> 03:14.760
Yeah.

03:15.120 --> 03:15.560
All right.

03:15.560 --> 03:17.520
I have the chat up now.

03:17.520 --> 03:18.320
Very nice.

03:18.680 --> 03:20.580
Do you want to put it somewhere here in the middle?

03:20.580 --> 03:20.600
Sure .

03:20.600 --> 03:21.220
Put it right in the center.

03:21.220 --> 03:22.060
My eyesight isn't that good.

03:22.060 --> 03:22.480
Yeah.

03:22.480 --> 03:23.900
You know, the glasses are deceiving.

03:24.200 --> 03:25.000
All right.

03:25.020 --> 03:27.960
So ttyioctl.

03:27.960 --> 03:28.500
All right.

03:28.500 --> 03:29.920
I haven't looked much at the challenge.

03:29.920 --> 03:31.480
I was too busy on my phone.

03:31.480 --> 03:31.620
Yeah.

03:31.620 --> 03:35.120
So the name of the challenge is IOCTL or IO Control.

03:35.120 --> 03:36.080
Me maybe.

03:37.180 --> 03:41.060
It is from a series of challenges from Glenn.

03:41.160 --> 03:41.720
Okay .

03:41.780 --> 03:43.900
It's notorious for cursed challenges.

03:44.160 --> 03:44.980
Ah.

03:45.060 --> 03:48.580
In the past, there have been torque engine challenges.

03:48.640 --> 03:49.300
There have been...

03:50.480 --> 03:51.400
What is it?

03:51.400 --> 03:54.500
Rock with weird instructions only.

03:54.500 --> 03:59.620
Oh, knop me maybe was one where it's like you have to jump into the middle of knops.

03:59.680 --> 04:00.040
Yeah.

04:00.040 --> 04:01.260
Let's start checking on Orgacrout.

04:01.260 --> 04:02.320
What are they up to right now?

04:02.320 --> 04:02.740
Yeah.

04:03.040 --> 04:03.840
Orgacrout.

04:04.020 --> 04:08.640
It looks like Stack Overflow, which is never a great sign.

04:08.780 --> 04:09.180
Yeah .

04:09.380 --> 04:10.080
Let's see.

04:10.080 --> 04:14.700
I did see that ChatGPT was open on the Straw Hats side.

04:14.700 --> 04:14.820
Yeah.

04:14.820 --> 04:16.020
It's the very first tab.

04:16.020 --> 04:18.340
So we might see some AI going on.

04:18.340 --> 04:22.820
Honestly, in the hierarchy, I'd put man page, Stack Overflow, ChatGPT.

04:22.820 --> 04:24.800
But obviously, it's upside down.

04:24.800 --> 04:26.340
So ChatGPT is the move.

04:26.500 --> 04:27.060
Now , let's see.

04:27.060 --> 04:29.700
I think we're both on the same website.

04:29.700 --> 04:32.160
We're both looking at man7.org.

04:32.160 --> 04:36.680
So it just seems like this is the way to do man pages on macOS.

04:36.680 --> 04:39.180
I guess, does macOS not have man pages?

04:39.180 --> 04:41.000
Is that not a thing?

04:41.000 --> 04:42.420
No, it has man pages.

04:42.420 --> 04:44.560
But this is a very Linux-specific challenge.

04:44.560 --> 04:44.940
OK.

04:44.940 --> 04:46.160
I don't know if they transfer over.

04:46.160 --> 04:47.520
I don't know if the options are different.

04:47.540 --> 04:49.180
Oh, yeah.

04:49.620 --> 04:52.580
Like, we're going to be learning this challenge with y'all, with them.

04:53.220 --> 04:55.040
We didn't write this.

04:55.040 --> 04:56.120
We haven't looked at it.

04:56.120 --> 04:56.420
No .

04:56.420 --> 04:59.060
No, we're basically solving this at the same time.

05:00.160 --> 05:00.800
Interesting.

05:00.800 --> 05:02.860
Just a lot of Googling right now.

05:02.860 --> 05:03.540
It's only...

05:04.360 --> 05:09.860
I'm curious if the challenge is just a simple, like, IOPTL call and you need to get the ARGs right or something.

05:09.860 --> 05:15.560
We haven't seen anyone really keep a disassembler or decompiler open for more than two seconds.

05:15.560 --> 05:18.040
Straw Hat is typing up Python.

05:18.040 --> 05:19.180
We do have our first...

05:19.180 --> 05:19.740
Straw Hat is typing Python.

05:19.740 --> 05:22.100
We have from PwnImport star.

05:22.100 --> 05:24.700
We're getting ready to just get everything going.

05:24.700 --> 05:25.260
Everything they need.

05:25.260 --> 05:26.520
Yes, yes.

05:26.640 --> 05:27.440
I don't know.

05:27.440 --> 05:29.960
I'm always really afraid to import star.

05:29.960 --> 05:32.020
I'm always afraid that's just going to make a mess of...

05:32.020 --> 05:32.680
It's super...

05:32.680 --> 05:34.800
Do you call it a namespace in Python?

05:34.800 --> 05:35.760
Is that the correct term?

05:35.760 --> 05:36.600
It's a module.

05:36.600 --> 05:37.460
A module?

05:37.460 --> 05:38.280
Okay.

05:38.440 --> 05:39.780
Nothing is namespace Python.

05:39.780 --> 05:41.120
It's only global.

05:41.120 --> 05:42.520
Everything is global.

05:42.520 --> 05:44.040
The locks are global.

05:45.060 --> 05:46.400
Not for long.

05:46.400 --> 05:47.240
There's that...

05:47.240 --> 05:48.460
I saw that.

05:48.460 --> 05:50.600
Almost a PR that removes the GIL.

05:51.300 --> 05:52.760
Is that going to be like when...

05:53.380 --> 05:54.020
What was it?

05:54.200 --> 05:56.420
OpenBSD removed their global lock.

05:56.420 --> 05:58.600
Every time you made a syscall, there'd be a global lock.

05:58.600 --> 06:02.560
And they removed that and immediately erased conditions on every single syscall.

06:02.560 --> 06:03.000
No way.

06:03.000 --> 06:03.320
Yep.

06:03.320 --> 06:05.100
You're telling me that processes are hard?

06:05.380 --> 06:06.700
It's very difficult.

06:06.740 --> 06:10.280
Especially when you have an OS designed for single-threaded stuff.

06:10.280 --> 06:13.180
What do you know about highly parallel processes?

06:14.340 --> 06:15.120
Interesting.

06:15.120 --> 06:16.200
So we're really just deep...

06:16.200 --> 06:20.060
Both are just in the deep man pages.

06:20.060 --> 06:22.540
I think they're on the same page right now.

06:22.820 --> 06:26.400
StrawHat over there reading something very closely.

06:26.460 --> 06:26.760
Yeah!

06:26.760 --> 06:27.940
Actually, OrgeKrout over here...

06:27.940 --> 06:29.480
Okay, well, as I say it...

06:29.480 --> 06:34.220
OrgeKrout creating a C script to try and figure out what IOCTL does.

06:34.480 --> 06:35.180
Oh, yeah.

06:35.180 --> 06:35.900
Okay.

06:36.120 --> 06:38.980
So you got a launch in the process, going interactive.

06:38.980 --> 06:42.000
And I think that's something we see a lot when we're doing CTF stuff.

06:42.000 --> 06:44.820
People love dropping into that interactive prompt.

06:44.820 --> 06:48.700
So they can just start banging out things, trying out stuff.

06:48.800 --> 06:49.620
And let's see.

06:49.620 --> 06:52.300
Do we have the first challenge running here?

06:52.380 --> 06:55.720
That's one of the big differences and approaches we saw last challenge, even.

06:55.720 --> 06:57.680
Was one team went completely static.

06:57.700 --> 07:00.540
And really labeled so many things before even interacting with one.

07:00.540 --> 07:01.300
No way!

07:01.300 --> 07:03.380
The other team was in GDB breaking on every option.

07:03.720 --> 07:04.340
Yep.

07:04.340 --> 07:06.640
And they were really close to one another.

07:06.640 --> 07:09.360
The receive until main is.

07:09.580 --> 07:09.900
Okay .

07:09.900 --> 07:11.660
Not using read until wrapper.

07:11.660 --> 07:12.520
Oh, I see.

07:12.520 --> 07:13.820
Is this an info disclosure?

07:13.820 --> 07:15.680
Just right on the command line?

07:15.680 --> 07:18.580
It just tells you where main is and where RxE is?

07:18.580 --> 07:19.440
Yeah, it is.

07:19.440 --> 07:20.220
That's great.

07:20.220 --> 07:22.300
Why don't my Chrome exploits tell me that?

07:23.300 --> 07:24.800
That would be really convenient.

07:24.800 --> 07:25.800
Because Chrome lost track of it too.

07:25.800 --> 07:27.100
It has so much memory to keep track of.

07:27.100 --> 07:27.840
I guess.

07:27.840 --> 07:28.360
Yeah.

07:28.360 --> 07:29.340
That's true.

07:29.500 --> 07:30.600
What do you want?

07:30.600 --> 07:31.980
Is the question here.

07:32.800 --> 07:34.120
We can maybe read some...

07:34.120 --> 07:34.920
Oh, nope.

07:34.920 --> 07:35.680
Code's gone again.

07:35.680 --> 07:36.780
Code's gone again.

07:37.000 --> 07:37.780
Jeez.

07:37.980 --> 07:38.200
All right.

07:38.200 --> 07:39.040
And then over here...

07:39.680 --> 07:39.700
Oh my god .

07:39.700 --> 07:41.480
Yeah, over here at Orgacrout.

07:41.840 --> 07:42.360
Orgacrout.

07:42.360 --> 07:44.460
They are xattering.

07:44.800 --> 07:46.940
This is a really fancy terminal.

07:46.940 --> 07:47.820
Oh , they're using PwnTemplate.

07:48.240 --> 07:48.740
PwnTemplate?

07:48.740 --> 07:53.680
It kind of creates a little working directory for you with PwnTools and pipenv.

07:53.680 --> 07:56.220
And it makes a PwnTools skeleton and stuff like that.

07:56.220 --> 07:57.780
I personally don't use it.

07:57.780 --> 08:00.040
But the last time I looked at it, it was kind of simple.

08:00.040 --> 08:02.820
Is that an emoji on that terminal there?

08:02.820 --> 08:07.640
Yeah, they have a snake emoji and a little steering wheel for a docker maybe.

08:07.640 --> 08:08.720
Like a ship wheel.

08:08.720 --> 08:09.220
Huh.

08:09.220 --> 08:10.200
All right.

08:10.240 --> 08:11.200
That's pretty fair.

08:11.200 --> 08:17.380
So here we're just basically parsing out all of the printouts that you're getting.

08:17.380 --> 08:21.100
And there hasn't been much reading of code, which is interesting.

08:21.140 --> 08:27.640
That's honestly the approach that I normally go for, is just banging it out immediately going into dynamic stuff.

08:27.640 --> 08:32.000
Yes , but what I saw there for a second, it looks like you're just getting an IOPTL call with args that you specified.

08:32.000 --> 08:34.580
Yeah, which would be pretty slick.

08:34.580 --> 08:38.560
But I don't know what sort of things you can do.

08:38.560 --> 08:40.360
Is it on a TTY?

08:40.360 --> 08:42.240
I didn't actually see what file is being opened.

08:42.240 --> 08:44.440
We're switching between these screens so fast.

08:45.640 --> 08:47.020
Too many arguments.

08:47.560 --> 08:51.580
Oh, so it looks like you get to pick.

08:52.180 --> 09:00.460
I think I saw a zero arg where you have the IOPTL number, and then it looks like two, three, and four.

09:00.460 --> 09:04.100
And it will prompt you, I guess, for the IOPTL code.

09:04.100 --> 09:05.360
So that's interesting.

09:05.360 --> 09:14.280
We're actually writing a function here to properly do these IOPTLs, which is pretty fancy.

09:14.280 --> 09:16.240
Yeah , does it allocate a VTTY or what?

09:16.240 --> 09:18.020
I didn't actually see what it opened.

09:18.020 --> 09:20.420
I've only seen it for like a split second.

09:20.420 --> 09:22.680
Yeah, can I get a nod or a head shake?

09:23.240 --> 09:26.380
A PTY, okay.

09:26.380 --> 09:27.580
Okay, we get a PTY.

09:27.580 --> 09:29.060
Is it dev PTY?

09:29.640 --> 09:30.920
Dev PTY 3.

09:30.920 --> 09:32.480
PTY 3, okay.

09:32.600 --> 09:40.500
Now, my favorite thing is PTMX, which I think is what basically everyone uses when they're doing their basic Linux exploits.

09:40.500 --> 09:45.920
For some reason, I can't remember what it was about the shape of that data structure that it allocates.

09:45.920 --> 09:51.560
It's just very convenient for using in your exploits and overriding the dispatch handles.

09:51.720 --> 09:54.960
Maybe it's just because it's really easy to get access to on Android.

09:54.960 --> 09:57.360
I think it has no permissions required.

09:57.360 --> 09:59.000
I haven't done Android exploits yet.

09:59.000 --> 10:00.900
This is so fancy.

10:01.100 --> 10:02.140
Look at this.

10:02.140 --> 10:02.860
Right?

10:02.860 --> 10:03.760
It's really colorful.

10:03.760 --> 10:04.440
I like it.

10:04.440 --> 10:07.180
I'm really impressed that we're seeing a function.

10:07.180 --> 10:08.000
Oh, here we go.

10:08.140 --> 10:09.860
Orgacrout scrolling through IDA.

10:09.860 --> 10:15.520
We see the project's OPPT 258, unknown what enum value that is.

10:15.520 --> 10:16.320
Huh.

10:16.780 --> 10:17.280
Okay.

10:17.280 --> 10:18.320
Info leak.

10:18.320 --> 10:19.000
And then it just...

10:19.000 --> 10:21.200
Oh , it looks like we're going to get that main page for this.

10:21.420 --> 10:22.300
Compromised password.

10:22.300 --> 10:23.140
That's not a good sign.

10:23.140 --> 10:24.220
They better get that fixed.

10:24.220 --> 10:25.040
Yeah , they have to.

10:25.040 --> 10:25.620
Yeah.

10:25.620 --> 10:27.200
It prints that when you start to challenge it.

10:27.200 --> 10:27.660
All right.

10:27.660 --> 10:30.540
So it looks like you give it...

10:31.080 --> 10:32.140
Oh, some flags.

10:32.140 --> 10:32.480
Okay.

10:32.480 --> 10:33.220
So it's probably...

10:33.220 --> 10:36.060
I'm guessing it's going to be like read-write or something like that.

10:36.060 --> 10:36.380
Yeah .

10:36.460 --> 10:37.000
Pty.

10:37.000 --> 10:41.040
I wonder if you can maybe corrupt a value in that struct.

10:41.260 --> 10:43.680
Yeah, that's kind of interesting.

10:43.680 --> 10:44.800
I'm trying to think if like...

10:45.340 --> 10:47.600
Look at the ads on this page.

10:47.600 --> 10:49.300
Oh, this is great.

10:49.480 --> 10:52.640
We found the CTF player that doesn't run AdBlocker.

10:52.640 --> 10:53.120
Yeah.

10:53.120 --> 10:54.140
Well, how does that work?

10:54.140 --> 10:54.600
It's just...

10:55.580 --> 10:56.640
I don't know.

10:56.640 --> 10:58.640
They just scrolled in really menacingly.

10:58.640 --> 11:01.120
I mean, I guess maybe...

11:02.360 --> 11:02.840
Let's...

11:02.840 --> 11:03.340
Oh, this...

11:04.420 --> 11:05.920
Docstore.mic.ua...

11:05.920 --> 11:06.540
What is this?

11:06.540 --> 11:10.540
Are we just like reading a book on how iOctals work?

11:10.540 --> 11:11.300
I guess so.

11:11.300 --> 11:12.100
That's pretty good.

11:12.100 --> 11:14.480
We're going to walk away from this with so much knowledge.

11:14.480 --> 11:15.240
I like Straw Hat.

11:15.240 --> 11:23.520
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.

11:23.520 --> 11:25.760
And this is literally exactly how I do it.

11:25.760 --> 11:30.300
Anytime I want to figure out what does that code actually turn into is this.

11:30.300 --> 11:35.100
And the reason that's so complex is those I-O codes are all like macro-based.

11:35.100 --> 11:36.760
So I think that's an I-O...

11:36.760 --> 11:38.340
It's an I-O-W.

11:38.340 --> 11:44.100
The fact that it's a right I-Octal, the T is the special code that they're going to use.

11:44.100 --> 11:46.360
Probably stands for TTY in this case.

11:46.500 --> 11:49.040
And then it also has an int, which is the arg.

11:49.060 --> 11:52.020
And in that macro, it's going to use sizeof.

11:52.020 --> 11:57.640
And basically, the I-O control code has the T in there, which is like a magic identifier.

11:57.640 --> 12:00.400
Some flags about if it's read, write, or whatever.

12:00.400 --> 12:02.560
And then the size of the args.

12:02.560 --> 12:04.320
And I forget what the 31 hex is.

12:04.320 --> 12:05.660
That's kind of interesting.

12:06.440 --> 12:11.300
Oh, and here we have a standard printout where you just go in for the %x.

12:11.460 --> 12:13.340
I think we're just ignoring that warning now.

12:13.340 --> 12:16.300
He's working in an isolated environment just trying to figure out what it does.

12:16.300 --> 12:17.060
What does it transform?

12:17.060 --> 12:18.040
What can I touch?

12:18.040 --> 12:21.740
You know, he obviously knows all the addresses that were leaked from his own code.

12:21.740 --> 12:22.100
Right.

12:22.100 --> 12:23.580
So it's essentially...

12:23.580 --> 12:26.900
He's rewriting the challenge to try and figure out what it can do.

12:27.120 --> 12:28.580
Context log level debug?

12:28.580 --> 12:29.740
Do you know what that does?

12:29.740 --> 12:30.200
Yeah.

12:30.200 --> 12:33.760
PwnTools, that prints like every transmit, every receive, the sizes of things.

12:33.760 --> 12:35.880
Do you get like a hex printout when they run?

12:35.880 --> 12:36.720
Oh, nice.

12:37.180 --> 12:46.680
Yeah, it looks like we have to find some way to do corruption on our own process using just these TTY octal codes.

12:46.980 --> 12:50.280
And I think I could be really wrong on this.

12:50.280 --> 12:56.520
I think octals are hierarchical, where you can have some generic TTY ones.

12:56.520 --> 12:59.080
But then beyond that, you can have pseudo TTY ones.

12:59.080 --> 13:01.160
And they kind of build on top of each other.

13:01.160 --> 13:04.240
So I think a pseudo TTY like inherits TTY.

13:04.240 --> 13:06.020
I could be very wrong about that.

13:06.020 --> 13:06.860
I have no idea.

13:07.380 --> 13:08.960
That's more than I know about.

13:09.600 --> 13:13.600
It's been a long time since I've read advanced programming in the Unix environment.

13:13.600 --> 13:14.360
That's for sure.

13:14.360 --> 13:14.940
I think it is.

13:14.940 --> 13:16.060
Yeah, no, I never did.

13:16.060 --> 13:16.460
Yeah.

13:17.020 --> 13:18.440
But this is kind of fun.

13:18.440 --> 13:20.660
I really do like this as a challenge.

13:20.840 --> 13:22.260
Ah, looking for...

13:22.260 --> 13:23.120
Yeah, get it.

13:23.120 --> 13:26.560
There's a getter for the window size, a setter for the window size.

13:26.840 --> 13:35.260
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.

13:35.280 --> 13:47.060
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.

13:47.060 --> 13:49.800
I'm wondering if TTYs have a maximum size up there that...

13:49.800 --> 13:50.980
I have no idea.

13:51.040 --> 13:54.320
Like, can you just have it go way off the screen or, you know...

13:54.840 --> 13:55.080
Huh.

13:55.080 --> 13:55.940
I assume you can.

13:55.940 --> 14:00.320
I'm sure there's a better way to get, like, arbitrary outputs.

14:00.320 --> 14:00.740
Oh , yeah.

14:00.780 --> 14:05.060
TIO, I don't know if we're limited to the I-O control code that we have.

14:06.100 --> 14:09.240
And let's check in on Orgicrout, let's see what they're doing.

14:09.480 --> 14:10.400
Yeah, okay.

14:10.400 --> 14:11.900
So Orgicrout going through...

14:11.900 --> 14:12.420
They're trying...

14:12.420 --> 14:14.080
They're going to try every IOC.

14:14.100 --> 14:16.080
They're going to run this thing with every IOC.

14:16.080 --> 14:17.560
Now, that's what we call fuzzing here.

14:17.560 --> 14:21.900
That is an advanced security technique, and that's a really good way to find bugs.

14:21.920 --> 14:25.920
So I think this is an interesting approach.

14:25.920 --> 14:26.480
We have...

14:27.100 --> 14:28.520
It looks like no functions here.

14:28.520 --> 14:29.000
We're doing a...

14:29.720 --> 14:30.460
Wow.

14:30.840 --> 14:35.860
So I guess we're just going to blast the apples until we get a result.

14:35.860 --> 14:36.080
Now...

14:36.080 --> 14:37.920
I really hope they don't run out of that piece.

14:37.920 --> 14:44.320
I will say, from Python, it's going to be really hard to enumerate all four billion combinations.

14:44.320 --> 14:52.920
And the I-O control codes are pretty well spaced, because some of those, like, read-write flags are spaced in just weird ways.

14:52.920 --> 14:54.400
So I've done this before.

14:54.400 --> 14:56.620
I've brute-forced I-O control codes.

14:56.620 --> 15:06.500
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.

15:06.500 --> 15:09.800
Like, I think the size might be the bottom 16 bits.

15:09.860 --> 15:14.600
And none of these are going to really reasonably take more than, like, a 64-byte structure.

15:14.600 --> 15:17.960
So you could really reduce the state space that you have to search.

15:18.620 --> 15:20.120
That's just going to be a lot of iterations.

15:20.120 --> 15:22.100
I don't know if he has time to write that.

15:22.180 --> 15:22.900
That's true.

15:22.900 --> 15:23.840
That's true.

15:23.840 --> 15:25.280
So you just have that sitting around.

15:25.280 --> 15:28.460
And yeah, we do have control of the I-Optimum number.

15:28.460 --> 15:30.380
I don't think there's any filter.

15:30.380 --> 15:31.320
I think this is purely...

15:31.320 --> 15:32.300
No, there's all of them.

15:32.300 --> 15:38.840
It looks like you just have an ARB number and ARB args on a PTY, and you just have to...

15:39.360 --> 15:39.940
Yep.

15:40.100 --> 15:42.340
And you just have to find a way to make that work.

15:42.340 --> 15:45.280
And I think that's probably not going to be too bad.

15:45.280 --> 15:45.780
It looks like...

15:47.240 --> 15:50.940
Oh, we're naming stuff over here on Straw Hat.

15:50.940 --> 15:53.540
We're actually doing some AIDA stuff.

15:54.080 --> 15:56.240
Actual reversing, which is kind of interesting.

15:56.400 --> 15:58.860
I mean, honestly, I'd say this is pretty readable.

15:58.860 --> 16:01.980
That shows me basically everything I need to know.

16:01.980 --> 16:05.320
When 70% of your output is strings, I think I know what's going on.

16:05.320 --> 16:05.900
Yeah.

16:06.000 --> 16:06.960
So that's cool.

16:06.960 --> 16:12.860
So it looks like you get the hexadecimal of where main is, where the stack is located.

16:13.060 --> 16:14.380
And now you're just going to...

16:14.380 --> 16:16.560
Is that getWindowSize?

16:16.560 --> 16:17.340
Oh, there we go.

16:17.340 --> 16:18.480
He just ran that.

16:18.480 --> 16:19.100
And I think that's...

16:19.100 --> 16:20.700
Yeah , he just threw his window to the right.

16:20.880 --> 16:21.600
Yeah.

16:21.600 --> 16:23.980
That's why he's running in poor man's demos.

16:24.080 --> 16:25.940
So he can see the window changes.

16:26.040 --> 16:26.240
Yeah.

16:26.240 --> 16:33.680
So he has gotten the Iowa control codes for set and getWindowSize.

16:33.680 --> 16:38.460
And honestly, that makes sense because you could just set the window size first using that, what was it?

16:38.460 --> 16:40.980
Four ints or four shorts or something like that.

16:41.140 --> 16:42.980
And then just call get.

16:42.980 --> 16:45.540
And you'll just get the result at a different address.

16:45.540 --> 16:48.260
So I feel like that's a pretty good approach.

16:48.260 --> 16:52.960
Now, that does take a pointer to a structure, if I'm not mistaken.

16:52.960 --> 16:55.640
I don't think it takes multiple args.

16:55.640 --> 17:02.540
So how would you set the pointer to that structure that has the size of that TTY?

17:02.540 --> 17:05.320
Well, you have the stack offset, and they allocate it right before.

17:05.320 --> 17:06.720
So I'd assume it's on top of the stack.

17:06.720 --> 17:07.380
Oh, OK.

17:07.380 --> 17:08.740
Yeah, you're right there.

17:08.960 --> 17:12.640
Do you have any good place on the stack where you can stash this?

17:12.640 --> 17:14.180
They don't have any leak beyond that, though.

17:14.180 --> 17:15.760
Right, right.

17:15.780 --> 17:18.020
Like, you can't read stack memory.

17:18.020 --> 17:20.640
Outside of, obviously, the struct.

17:20.640 --> 17:23.320
Because you know where it is, you have things to interact with it.

17:23.520 --> 17:26.420
So I'm curious to see where this goes.

17:26.420 --> 17:30.400
This is really tough, because you have to kind of make the decision early on.

17:30.400 --> 17:34.660
When you're doing these CTFs, it's like, should we commit to this?

17:34.660 --> 17:36.400
Like, getting and setting the window size.

17:36.400 --> 17:43.840
Obviously, if we can put a pointer to control data, then we can set the window size, put a pointer to other data.

17:43.840 --> 17:47.660
And now we have just overwritten something with control data.

17:47.660 --> 17:56.320
I'm curious, if input is done on the stack, you can push it down, maybe IOCTL pointer to the stack?

17:56.320 --> 17:57.920
Or is the pointer just set in there?

17:58.020 --> 17:59.600
Does it operate on top of the stack?

17:59.600 --> 18:02.720
I don't actually know what that stack printout is.

18:02.720 --> 18:13.080
Yeah , we print out, at the very top, it's argca, which I don't know where that variable is on the stack.

18:13.080 --> 18:18.820
If it just takes an FD, can't you FD standard in and make, like, a fake and IOCTL stroke be a standard input?

18:18.940 --> 18:20.840
I don't think you have control of the FD.

18:22.120 --> 18:23.600
For the IOCTLs?

18:23.600 --> 18:25.860
Yeah, doesn't it ask you what FD you want?

18:26.820 --> 18:27.500
Hmm.

18:28.380 --> 18:30.080
I think it's only the...

18:30.080 --> 18:31.860
I'm getting a thumbs up from the author.

18:32.560 --> 18:33.800
It asks for the FD?

18:33.800 --> 18:34.740
I'm on the right track.

18:34.740 --> 18:35.240
All right.

18:35.240 --> 18:36.480
Ah, I see.

18:36.480 --> 18:36.920
OK.

18:37.860 --> 18:38.560
OK.

18:38.560 --> 18:40.260
OK, every single parameter is controlled.

18:40.260 --> 18:40.660
Nice.

18:40.660 --> 18:42.740
OK, so you do get the FD.

18:42.740 --> 18:47.720
So, yeah, I mean, Parliament of Ducks just got it.

18:47.720 --> 18:49.220
OK, wow.

18:49.260 --> 18:50.380
Wow, that was fast.

18:50.380 --> 18:51.960
That was quite fast.

18:51.960 --> 18:53.400
I'm curious what approach they did.

18:53.400 --> 19:05.240
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?

19:05.240 --> 19:06.980
I'm not really sure about the next part.

19:06.980 --> 19:07.800
Hmm.

19:08.040 --> 19:09.860
Do you have only IOCTL?

19:10.060 --> 19:11.500
It's one IOCTL call, it looks like.

19:11.500 --> 19:12.300
One IOCTL call.

19:12.300 --> 19:15.540
OK, let's see.

19:15.540 --> 19:18.100
Yeah , let's go back over to Orge Crowd.

19:18.100 --> 19:19.560
They've been in IDA, too.

19:19.560 --> 19:23.720
OK, and they're using the dark scheme in IDA, which is interesting.

19:23.720 --> 19:24.380
Thank you.

19:24.380 --> 19:32.400
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.

19:32.480 --> 19:33.620
Yeah, I don't know what it is.

19:33.620 --> 19:37.060
I don't know if it's gotten better or what.

19:37.680 --> 19:50.500
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.

19:50.500 --> 19:51.660
Oh, it's painful.

19:51.660 --> 19:52.640
I cannot light theme.

19:52.640 --> 19:54.620
We have a couple of people in the office who light them.

19:54.620 --> 19:55.000
Yeah.

19:55.740 --> 19:57.420
I know it's better to read.

19:57.420 --> 20:03.440
I know it's, like, technically supposed to be better for your eyes and, like, your ability to, like, read the text.

20:03.600 --> 20:05.360
But I'm not convinced.

20:05.360 --> 20:05.820
I'm a dark theme.

20:05.820 --> 20:08.840
I'll take the extra second for comfort.

20:08.840 --> 20:09.580
Yeah.

20:09.580 --> 20:11.000
So, what do we have over here?

20:11.000 --> 20:14.440
Is it still... are we still doing the brute force of all the eye octals?

20:14.500 --> 20:16.680
It looks like they have that in there, but they're working above it.

20:16.680 --> 20:19.320
So, I wonder if they thought of another approach they want to try first.

20:19.320 --> 20:20.660
Yeah, yeah.

20:21.700 --> 20:22.340
Huh.

20:22.600 --> 20:24.680
Oh, they got it for a second.

20:25.620 --> 20:27.600
Oh, no, they're just trying to figure out how to run it, it looks like.

20:27.600 --> 20:28.140
Okay.

20:28.620 --> 20:30.000
Yeah, this is tough.

20:30.020 --> 20:32.060
Yeah, okay, you have four different eye octals.

20:32.060 --> 20:36.360
So, you can do 0 arg, 1 arg, 2 arg, or 3 arg, I think.

20:36.420 --> 20:37.060
Okay.

20:37.840 --> 20:39.560
And, yeah, this is really tough.

20:39.560 --> 20:42.240
Like, do you want to commit to doing the window size approach?

20:42.240 --> 20:45.240
Because, obviously, that's... I'm sure that's Turing complete.

20:45.240 --> 20:48.120
You can probably get your arbitrary corruption with that.

20:48.680 --> 20:52.680
But, is that the best eye octal?

20:52.680 --> 20:55.420
Is that the easiest eye octal, or is there an easier one?

20:55.480 --> 20:57.760
All of the eye octals are the best eye octal if they get you there.

20:57.760 --> 20:58.820
Right, exactly.

20:58.820 --> 21:02.560
Like, this is a solve it and solve it first challenge.

21:02.560 --> 21:03.480
Yeah, yeah.

21:03.480 --> 21:06.880
You're not trying to get undetected, you're not trying to get minimal size.

21:06.880 --> 21:15.520
Over here on Straw Hat, it looks like we're looking at the stack overflow on the responsibilities of each pseudo-terminal PTY component.

21:15.540 --> 21:17.940
And look at that, we had a diagram up there?

21:18.260 --> 21:27.500
That we are, like, I think we're, like, learning how, like, just PTYs work on Linux.

21:27.500 --> 21:29.040
We're learning how to control IO.

21:29.040 --> 21:29.460
Yeah.

21:31.080 --> 21:32.660
This is interesting.

21:32.660 --> 21:41.960
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.

21:41.960 --> 21:44.920
I do like that every time we come over here, their window is a little bit larger.

21:45.000 --> 21:46.240
Yeah, yeah.

21:47.700 --> 21:52.940
Look at this, Oracle Streams Programming Guide.

21:54.740 --> 21:57.460
When you end up on an Oracle page, you know you're in.

21:57.460 --> 22:01.080
Yeah, like, whenever I end up on Oracle, I'm getting out immediately.

22:01.080 --> 22:01.840
Oh, yeah.

22:01.840 --> 22:03.220
Oh, look at that, struct.pack.

22:03.220 --> 22:04.760
Is this just the exploit right here?

22:04.760 --> 22:06.000
No way.

22:06.000 --> 22:08.460
Well, it's not, because that needs to be a pointer.

22:08.500 --> 22:10.160
That is the right structure.

22:10.160 --> 22:11.820
It is four shorts.

22:11.820 --> 22:19.580
But you will need to put four shorts somewhere in memory, know the address of it, and then give that address.

22:19.580 --> 22:20.900
That's a lot of work, too.

22:20.900 --> 22:21.580
Right.

22:21.580 --> 22:26.320
And I haven't seen IDA enough to get the stack layout yet.

22:26.320 --> 22:41.060
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,

22:41.060 --> 22:44.240
storing in the kernel first, then writing out to memory with a GET request.

22:44.240 --> 22:46.560
It looks like you can do multiple app calls.

22:46.560 --> 22:48.400
Yeah, yeah, it does look like a loop.

22:48.400 --> 22:52.520
Yeah, which I think should make this quite easy.

22:52.600 --> 22:57.120
There's, I think, many of these, because a lot of these apps are getters and setters.

22:57.120 --> 22:57.640
So you're just...

22:57.640 --> 22:59.720
You transform that struct on the stack.

22:59.720 --> 23:00.000
Right.

23:00.000 --> 23:01.520
Have known data, known address.

23:01.520 --> 23:02.660
Right, exactly.

23:02.820 --> 23:03.220
Yeah .

23:05.180 --> 23:05.980
Interesting.

23:06.680 --> 23:08.060
Okay, so they're walking through.

23:08.060 --> 23:09.440
They have lots of naked ones.

23:10.260 --> 23:10.760
Huh.

23:10.760 --> 23:12.700
Looks like they're just making invalid calls right now.

23:12.700 --> 23:13.400
Yeah.

23:13.500 --> 23:13.920
Yeah.

23:13.920 --> 23:15.880
Let's check in on Orgacrout, see what they're doing.

23:16.160 --> 23:16.960
Orgacrout?

23:17.600 --> 23:19.260
They are making...

23:19.260 --> 23:21.480
It looks like an array of interesting IOCTLs.

23:21.480 --> 23:21.760
Okay.

23:21.760 --> 23:22.360
That they want to...

23:22.360 --> 23:22.780
Yep.

23:22.780 --> 23:26.380
Oh, it might be that they're making a IOCTL chain.

23:26.380 --> 23:27.040
I don't know.

23:27.040 --> 23:27.740
Yeah.

23:28.120 --> 23:29.160
IOCTL op.

23:29.740 --> 23:30.340
Huh.

23:32.720 --> 23:34.080
This is going to be very interesting.

23:34.080 --> 23:35.520
This is really interesting.

23:35.520 --> 23:36.360
Because we don't know where we're at.

23:36.360 --> 23:37.700
Have we gotten a crash yet?

23:38.160 --> 23:38.900
Oh, no.

23:38.900 --> 23:39.620
There's the stack.

23:39.620 --> 23:43.360
Okay, FD number, number of args, and then I think four args.

23:43.360 --> 23:45.660
I think I got all those.

23:45.660 --> 23:46.680
You're fast.

23:46.900 --> 23:47.220
Yep.

23:47.400 --> 23:48.560
FD number, number of args.

23:48.560 --> 23:48.800
Yeah.

23:48.800 --> 23:49.220
Yeah.

23:49.220 --> 23:51.540
So you should know where those args are.

23:51.540 --> 23:54.560
So if you were to just shoot...

23:54.560 --> 23:57.960
I don't know if it's okay if you have invalid IOCTL.

23:57.960 --> 24:00.580
I imagine it will just silently ignore it and just go through again.

24:00.580 --> 24:01.520
We saw that on Straw Hat.

24:01.520 --> 24:02.800
They were getting lots of negative one returns.

24:02.800 --> 24:10.480
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.

24:10.480 --> 24:15.660
I don't know what they're doing for A2I or whatever that might limit the space of the ints.

24:15.720 --> 24:19.500
But you should be able to do one pass through using the full things.

24:19.500 --> 24:20.680
Who cares about the IOCTL?

24:20.680 --> 24:21.640
Just let it fail.

24:21.640 --> 24:24.480
That will set up the args on the stack.

24:24.660 --> 24:27.100
And now you can come through and put a pointer to that.

24:27.100 --> 24:31.400
And now you have control data that you can write to some data you point to.

24:31.400 --> 24:33.300
Although you do have to dodge.

24:33.300 --> 24:37.520
You might have to put them further up the arg stack, because you need the first args.

24:37.520 --> 24:39.880
If you use one of these arguments first, then you can go back and just flubber the bottom one.

24:39.880 --> 24:40.500
Exactly.

24:40.500 --> 24:41.040
Yeah.

24:41.040 --> 24:43.660
And that's, I think, the approach that I would take.

24:43.660 --> 24:46.980
But once again, I haven't seen much of the IDA here.

24:46.980 --> 24:48.600
You have args in known places.

24:48.600 --> 24:49.000
Right.

24:49.000 --> 24:49.720
Now what?

24:49.720 --> 24:50.140
Right.

24:50.140 --> 24:50.840
Yeah.

24:50.920 --> 24:52.000
So I don't know.

24:52.000 --> 24:56.980
I think just a setter, put it in the kernel temporarily, and then get it back out into...

24:56.980 --> 24:59.060
I'm sticking true to my standard input.

24:59.060 --> 24:59.400
Yeah.

25:00.200 --> 25:01.400
Standard input.

25:01.400 --> 25:02.000
Yeah.

25:02.360 --> 25:05.640
I'm sticking true to FD0, reading from FD0 for the IOctal.

25:05.640 --> 25:07.560
But do you have access to a read?

25:07.560 --> 25:10.520
Can you do a read through an IOctal?

25:11.540 --> 25:12.340
Oh.

25:12.700 --> 25:14.320
Oh, no, because it just asks for an FD.

25:14.320 --> 25:15.360
It doesn't check if...

25:15.360 --> 25:15.940
No?

25:15.940 --> 25:17.660
Oh, because the FD's on the PTY.

25:17.660 --> 25:19.780
Yeah, but you only have the IOctal sys call.

25:19.780 --> 25:21.580
So how would you get that to do a read?

25:21.580 --> 25:26.260
Like, is there a way to cause a read from standard in or whatever through an IOctal?

25:26.260 --> 25:27.680
Or am I misunderstanding?

25:28.300 --> 25:29.980
Well, I wonder if it's...

25:29.980 --> 25:32.480
Can you buffer standard input, maybe?

25:32.480 --> 25:34.420
Send the IOctal to FD0.

25:34.420 --> 25:37.200
It doesn't prompt for input, but it reads the buffer data.

25:37.200 --> 25:39.900
Like, you can buffer it in the choice input.

25:40.020 --> 25:40.900
Hmm.

25:42.120 --> 25:42.800
I'm not sure.

25:42.800 --> 25:43.520
I don't know.

25:43.520 --> 25:44.000
Okay.

25:44.000 --> 25:44.700
Yeah.

25:45.400 --> 25:45.720
Yeah.

25:45.960 --> 25:49.780
Okay, and it looks like we're adding more libraries here.

25:51.420 --> 25:52.860
Oh, you know what?

25:52.860 --> 26:02.920
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.

26:02.920 --> 26:06.960
Like, assuming we have full control, what kind of FD number are we going to get?

26:06.960 --> 26:13.020
Now, that's going to be FD3, of course, because 0, 1, and 2 are allocated to your standard ins and outs.

26:13.140 --> 26:16.000
And so he's going to print out a 3.

26:16.000 --> 26:17.440
He doesn't have a helper in this terminal.

26:17.440 --> 26:18.840
They'll shove his FDs further down.

26:18.840 --> 26:19.280
Yeah.

26:19.280 --> 26:19.440
Yeah.

26:19.440 --> 26:21.780
It automatically allocates more.

26:21.840 --> 26:23.960
And then, okay, we're getting these values.

26:23.960 --> 26:25.000
Yep, and this makes sense.

26:25.000 --> 26:26.220
You're going to get...

26:27.060 --> 26:28.720
We're going to pass a ref.

26:28.720 --> 26:31.380
So we're going to actually get the window size here.

26:32.140 --> 26:33.400
This is really interesting.

26:33.400 --> 26:37.480
So it's kind of dangerous, in my opinion, to keep going in and out of Vim.

26:37.480 --> 26:43.800
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.

26:43.800 --> 26:44.100
Really?

26:44.700 --> 26:46.360
Oh, yeah, I forgot.

26:46.500 --> 26:48.180
Vim 8 added that or whatever?

26:48.180 --> 26:51.140
I think I just disabled that immediately.

26:51.260 --> 26:52.280
Oh , that's so nice.

26:52.400 --> 26:55.520
But it adds a bunch of temporary files, and I hate that.

26:55.520 --> 26:57.920
Put it in your user directory or put it in something you can clean up and do.

26:57.920 --> 26:59.180
So much work.

26:59.180 --> 26:59.680
Oh , my.

26:59.680 --> 27:00.440
So much work.

27:00.440 --> 27:02.000
I've seen what you do on screens.

27:03.220 --> 27:05.640
I keep my environment pretty default here.

27:05.640 --> 27:06.880
Yeah, oh, yeah.

27:08.960 --> 27:11.380
Well, it looks like these guys are using what works for them.

27:11.380 --> 27:11.680
Yeah.

27:11.680 --> 27:15.660
That happens to be four terminals kind of splayed out and man7.com.

27:15.660 --> 27:16.260
Yeah.

27:16.260 --> 27:17.040
Man7.org.

27:17.140 --> 27:18.020
Man7.org.

27:18.020 --> 27:18.960
I guess.

27:19.380 --> 27:23.080
Which you would think Ubuntu would have the Linux man pages.

27:23.080 --> 27:23.640
Oh, it does.

27:23.640 --> 27:24.020
Yeah.

27:24.020 --> 27:24.920
Oh, it has all of them.

27:24.920 --> 27:26.960
Yeah, that's like...

27:26.960 --> 27:28.700
Well, all of them for what you have, obviously.

27:28.840 --> 27:31.000
So that's kind of interesting.

27:31.400 --> 27:32.680
Chad, what do you say?

27:32.680 --> 27:42.160
Do you normally use in-terminal man pages or do you end up on like a die.org or I guess man7.org?

27:42.160 --> 27:44.200
I guess that's what the cool kids use these days.

27:44.200 --> 27:47.380
It's just the first one that comes up because it has man in the domain, I guess.

27:47.380 --> 27:48.100
Yeah.

27:48.840 --> 27:49.800
SEO.

27:50.280 --> 27:51.140
Huh.

27:53.380 --> 27:54.800
That's pretty wild.

27:54.800 --> 27:57.580
I feel like we're kind of looking at the same thing.

27:57.580 --> 28:01.300
We're really, really committing to this getting and setting the window size.

28:01.300 --> 28:02.020
Oh , my God.

28:02.020 --> 28:05.580
And we're actually far enough in that the first hint has been released.

28:05.580 --> 28:06.160
Okay.

28:06.160 --> 28:08.620
We haven't seen what that hint is, have we?

28:08.620 --> 28:09.040
We have.

28:09.040 --> 28:10.720
Has anyone pulled up that hint?

28:10.720 --> 28:13.880
They might need to be hinted at that there's a hint.

28:14.860 --> 28:16.340
We're 20 minutes in.

28:16.340 --> 28:17.100
Okay.

28:17.700 --> 28:18.580
Okay.

28:18.780 --> 28:19.580
Huh.

28:20.960 --> 28:21.780
I don't know.

28:21.780 --> 28:25.040
I think these approaches are pretty good.

28:26.080 --> 28:28.980
Oh, and now we're doing S traits.

28:28.980 --> 28:30.020
So now we're...

28:30.020 --> 28:31.300
So Orgo Kraut.

28:31.420 --> 28:37.860
Yeah, so Orgo Kraut has Ida open and that was interesting in the non-pseudocode view.

28:38.420 --> 28:41.300
But yeah, it's literally just while read int, do another.

28:41.300 --> 28:43.460
Yeah, you say zero or one if you want to read another.

28:43.460 --> 28:51.500
So you have an arbitrary amount of arbitrary ioctals, arbitrary FD, arbitrary io-control code, arbitrary args.

28:51.500 --> 28:53.620
So it is actually ioctal-oriented programming.

28:53.620 --> 28:54.540
Yeah, yeah.

28:54.540 --> 28:56.140
I think that's a great challenge.

28:56.140 --> 28:57.540
I don't think I've seen that before.

28:57.540 --> 28:59.300
It's just, it's brilliant.

28:59.300 --> 29:05.500
That's Glenn's challenge is he just comes up with weird ideas and makes them, but they end up being really cool.

29:05.560 --> 29:06.340
Huh.

29:06.340 --> 29:07.240
I like that.

29:07.240 --> 29:13.100
The other thing I was thinking about, which would be a fun challenge, is the...

29:13.100 --> 29:18.080
What's this syscall that always has bugs and handles the locks and stuff on Linux?

29:18.080 --> 29:20.940
The super fast locks.

29:21.140 --> 29:22.140
Why am I blanking on it?

29:22.140 --> 29:25.820
Was it Geohot's bug way back in the day was on this syscall?

29:26.160 --> 29:27.380
Oh, jeez.

29:27.860 --> 29:29.540
Oh, I forget what it is.

29:29.540 --> 29:31.380
This is outside of my scope of knowledge.

29:31.380 --> 29:32.600
I'm not a historian.

29:32.600 --> 29:44.580
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.

29:44.580 --> 29:48.940
But that whole API is, I think, turn complete in the kernel.

29:49.080 --> 29:49.360
Really ?

29:49.360 --> 29:57.680
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.

29:57.680 --> 30:01.500
So that would allow you to just try random things.

30:01.500 --> 30:05.300
Or if you don't know an ASLR location, you probably could just jam things in there.

30:05.300 --> 30:10.700
And I think you can tell the kernel to increment or decrement a value at an address, which is fantastic.

30:10.700 --> 30:12.780
So you can do address space pre-coursing in the kernel.

30:12.780 --> 30:13.720
Yes , yes, yes.

30:13.720 --> 30:15.540
So I've wanted to see that.

30:15.540 --> 30:16.980
I've wanted to see that in exploits.

30:16.980 --> 30:18.700
I've wanted to see it in just so many things.

30:18.700 --> 30:20.680
I think it's a really cool way of doing it.

30:20.680 --> 30:22.460
Futex, yes, Futex, exactly.

30:22.540 --> 30:23.240
Futex.

30:23.240 --> 30:26.860
Because Futex has a bunch of different operating modes.

30:26.860 --> 30:27.300
Is it really buggy?

30:27.300 --> 30:28.280
I didn't know that.

30:28.880 --> 30:30.500
Well, that's not even like the bug.

30:30.500 --> 30:32.340
It used to be pretty buggy.

30:32.340 --> 30:37.900
Like, there was one really big Futex bug, and I think that's what...

30:37.900 --> 30:40.720
I think it was like a GeoHotBug way back in the day.

30:41.060 --> 30:43.200
But it's just a really complex...

30:43.200 --> 30:47.360
you know, immediately there's an enum of a bunch of different modes that you can hit in that.

30:47.820 --> 30:50.340
So , and this kind of reminds me of that same thing.

30:51.520 --> 30:54.000
In fact, I think that would apply here.

30:54.000 --> 31:00.260
If you gave IOCTL an invalid address, the kernel's going to report back, bad adder.

31:00.260 --> 31:01.920
It's not going to crash your program.

31:01.920 --> 31:07.580
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.

31:08.640 --> 31:11.500
But , oh, we're in read int.

31:11.500 --> 31:12.400
We're seeing what we get.

31:12.400 --> 31:19.220
It looks like an LX was the read int command, which means that you will get the full 64 bits.

31:19.520 --> 31:20.240
Oh , that's interesting.

31:20.240 --> 31:21.600
The return code is 32.

31:21.880 --> 31:24.660
On Straw Hat, they're adding hex to everything.

31:24.660 --> 31:26.560
I think they weren't using hex.

31:26.560 --> 31:29.720
And explicitly, it's pulling it in as hex.

31:29.840 --> 31:32.240
And that really hurts.

31:32.240 --> 31:34.300
This might be a bit of a breakthrough for them.

31:34.300 --> 31:36.620
I think that is a pretty big breakthrough.

31:36.920 --> 31:38.140
Oh, no.

31:38.500 --> 31:39.320
Yeah.

31:40.100 --> 31:40.660
Yeah.

31:40.660 --> 31:42.840
Just goes to show, no one knows how this works.

31:42.840 --> 31:43.480
Right.

31:43.480 --> 31:45.420
Yeah, I mean, that's really tough.

31:45.420 --> 31:47.880
That's the sort of thing that you get stuck on for a while.

31:47.880 --> 31:51.880
I think that's why he went into GCC to try it out.

31:51.880 --> 31:53.300
And then it probably worked in GCC.

31:53.300 --> 31:54.300
And he's like, what the hell?

31:54.300 --> 31:57.280
You can see, trying to do four ones.

31:57.280 --> 32:00.340
He got bad adder from the IOCTL.

32:01.060 --> 32:02.600
And that makes sense.

32:02.600 --> 32:04.200
That totally makes sense.

32:04.440 --> 32:08.000
So it looks like we're probably on a pretty fast path now.

32:08.000 --> 32:11.840
I think Straw Hat should have a pretty direct route.

32:11.840 --> 32:13.200
You know where your arcs are.

32:13.200 --> 32:14.720
You know what you control on the stack.

32:14.720 --> 32:16.860
I mean, that IDA output is fantastic.

32:16.860 --> 32:17.860
They have that going now.

32:17.860 --> 32:20.220
It's going to be smooth for them, whatever they want to do.

32:20.220 --> 32:21.180
For sure.

32:22.440 --> 32:24.500
What do we got going on, Orger Crout, over here?

32:24.500 --> 32:28.280
Orger Crout is looking at PTY docs.

32:29.600 --> 32:31.260
OK, you know.

32:31.260 --> 32:35.600
I feel like we've almost had time to read through all of these docs by this point.

32:35.600 --> 32:41.580
I feel like, if you just take screenshots of every frame, you could see every IOCTL doc.

32:41.580 --> 32:41.900
Right.

32:41.900 --> 32:43.420
Like, you could have the full thing there.

32:43.420 --> 32:43.760
Yeah.

32:43.940 --> 32:44.940
Forgetman7.org.

32:44.940 --> 32:46.580
Just pull up live CTM.

32:46.580 --> 32:47.780
Right, right.

32:49.020 --> 32:49.900
This is wild.

32:49.900 --> 32:50.900
Oh, I think this is the...

32:50.900 --> 32:52.140
TC Send Break?

32:53.020 --> 32:57.800
OK, so he's just going through the TC Send Break.

32:58.660 --> 32:59.740
Does that get you a write?

32:59.740 --> 33:02.200
Because I imagine you're going to need an arbitrary write.

33:03.440 --> 33:06.220
And so you're kind of going to need some sort of a getter.

33:06.220 --> 33:09.220
I do like the window size, because you have a setter and a getter.

33:09.220 --> 33:10.640
You can store stuff off.

33:10.640 --> 33:12.680
You can pick it and then write it to another place.

33:12.680 --> 33:15.700
I mean, basically, it's memcpy, but through the kernel.

33:15.700 --> 33:17.840
Is the argument for that UN16?

33:18.980 --> 33:20.260
For the IOCTL?

33:21.100 --> 33:22.980
So all the arguments will be long.

33:22.980 --> 33:24.500
So it will be 64-bit.

33:24.500 --> 33:30.620
And so it'll just be one arg, which is a pointer to a structure.

33:30.660 --> 33:34.700
And the structure is just four shorts that are packed in memory.

33:35.240 --> 33:36.900
I don't know what the shorts are.

33:36.900 --> 33:42.540
I think it's some pixel and column and size of the terminal sort of thing.

33:43.180 --> 33:46.580
But it looks like that's what we're committing to on Straw Hat.

33:46.660 --> 33:52.020
And Orgatron, I think, is still trying to decide what IOCTL they're on.

33:52.020 --> 33:54.840
They were reading the same exact thing, actually.

33:55.520 --> 33:57.640
They're thinking about the same approach.

33:57.640 --> 34:00.620
Wow, and you get the IOCTL return.

34:00.620 --> 34:07.180
So you could potentially use that if you needed to figure out some information from the kernel.

34:07.180 --> 34:09.180
I don't think that's necessary here.

34:09.180 --> 34:11.900
I think you can do this plainly.

34:11.900 --> 34:13.080
I don't think you need anything to fail.

34:13.080 --> 34:15.600
I think you can use it to verify that your hard write worked.

34:15.600 --> 34:16.600
Which is great.

34:16.600 --> 34:20.700
It is great to have an oracle that stuff is going well.

34:20.700 --> 34:22.820
It does only return you a 32.

34:22.940 --> 34:23.080
Yeah .

34:23.550 --> 34:24.800
Or I guess in 32.

34:24.800 --> 34:25.600
Right.

34:26.540 --> 34:27.540
Huh.

34:29.440 --> 34:31.900
Yeah, we'll see what we're going to get here.

34:31.900 --> 34:33.720
OK, we're doing some math.

34:33.780 --> 34:40.080
So we're subtracting main from the main of the relocated thing.

34:40.080 --> 34:42.860
This is going to give us basically the slide.

34:42.860 --> 34:46.940
Or whatever this actual ASLR offset.

34:48.030 --> 34:50.140
And that's good information to have.

34:50.140 --> 34:53.680
I guess you'll need that because...

34:53.680 --> 34:55.820
Is there a win function maybe they're calculating?

34:55.820 --> 34:57.800
I don't know if there's a win function.

34:57.800 --> 35:01.500
I don't know if they're just going to go right to like a system.

35:01.500 --> 35:03.280
Oh, they're writing like ESS or something?

35:03.280 --> 35:03.860
Yeah.

35:03.860 --> 35:04.600
OK.

35:04.700 --> 35:05.540
Read eight.

35:05.540 --> 35:06.140
OK.

35:06.140 --> 35:08.700
Making just a clean function for read eight.

35:08.700 --> 35:09.160
OK .

35:13.100 --> 35:13.720
IOCTL321523.

35:13.720 --> 35:14.940
No hex there.

35:15.040 --> 35:15.280
Which is...

35:15.280 --> 35:15.980
Wow.

35:17.560 --> 35:18.220
Interesting.

35:18.220 --> 35:20.840
OK, and then we're passing in those args.

35:21.300 --> 35:23.580
And I think now we're going to...

35:23.580 --> 35:27.680
OK, now we're going for a straight read and write primitive.

35:28.140 --> 35:31.420
I don't know if these values are controlled yet.

35:31.420 --> 35:33.960
Yeah, this is just triggering the read to an address.

35:34.000 --> 35:36.040
Triggering the write to an address.

35:36.440 --> 35:40.040
And yeah, I guess it is an eight byte read and write because it's a four short.

35:40.040 --> 35:42.460
So four times two is your eight.

35:43.260 --> 35:43.700
So...

35:43.700 --> 35:45.860
But that read isn't...

35:45.860 --> 35:46.960
Oh no, well, yeah, yeah.

35:46.960 --> 35:48.340
It's just the address.

35:48.340 --> 35:49.620
Because it'll just return success.

35:49.620 --> 35:50.020
That's right.

35:50.020 --> 35:50.980
Yep, yep.

35:52.320 --> 35:54.840
So it's really going to come down to what?

35:54.840 --> 35:56.920
Yes , that is getting the read and write primitives.

35:57.040 --> 35:57.460
Yeah.

35:57.460 --> 36:01.680
Over on Orgacram, we had some math for a second there.

36:01.960 --> 36:06.020
But it looks like they're going for an offset from arg two.

36:06.260 --> 36:07.000
OK.

36:07.000 --> 36:07.860
Unknown.

36:08.100 --> 36:11.380
I think that is kind of similar to what I was thinking.

36:11.380 --> 36:16.540
Because I think read int, I think that's getting a 64-bit hexadecimal value.

36:16.540 --> 36:25.760
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.

36:25.760 --> 36:30.080
You need to use the low arg one so that you have the address.

36:30.080 --> 36:32.100
And then you can't clobber the other things.

36:32.100 --> 36:33.600
But that should be totally fine.

36:33.600 --> 36:36.020
I think that approach would just work.

36:36.360 --> 36:37.340
Let's see.

36:37.360 --> 36:38.860
AW eight.

36:38.860 --> 36:42.140
Oh, wait a minute.

36:42.340 --> 36:42.920
Oh.

36:42.920 --> 36:44.180
Oh, I saw set seven.

36:44.180 --> 36:45.000
I got excited.

36:45.000 --> 36:45.600
OK.

36:46.460 --> 36:47.280
Set win.

36:47.280 --> 36:49.080
Oh, OK, they're throwing some As in there.

36:49.080 --> 36:53.100
We're going to try and use address As, get and set window.

36:53.100 --> 36:56.200
And so now it looks like we have the same approaches on both.

36:56.200 --> 36:58.600
Oh, it's going to be a real close race.

36:58.600 --> 36:59.040
Yes .

37:00.460 --> 37:01.280
Huh.

37:01.280 --> 37:01.980
OK.

37:01.980 --> 37:10.700
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?

37:10.700 --> 37:16.060
Because I think both of them are clearly aware of the path that they're going to take.

37:16.060 --> 37:16.920
And I agree.

37:16.920 --> 37:18.600
It's a winning path here.

37:19.240 --> 37:22.900
Oh, it looks like they got a write of four bytes.

37:23.060 --> 37:23.100
Yep .

37:23.100 --> 37:23.880
There's yep.

37:23.880 --> 37:25.460
There's that window size.

37:25.460 --> 37:28.400
So that's the actual structure that they're going to be able to control.

37:28.500 --> 37:29.080
Nice.

37:29.300 --> 37:34.520
And I do think they're going to need to rely on the uninitialized memory.

37:34.720 --> 37:35.080
Right.

37:35.080 --> 37:35.580
32.

37:35.580 --> 37:38.180
I don't think that's a 32 bit write.

37:38.180 --> 37:38.720
He got a 32 bit write.

37:38.720 --> 37:39.620
From what?

37:39.620 --> 37:40.200
Do you know what?

37:40.200 --> 37:41.120
From this?

37:41.300 --> 37:42.720
I didn't see exactly what happened.

37:42.720 --> 37:44.240
Yeah, I didn't see that either.

37:44.660 --> 37:45.780
Okay.

37:45.880 --> 37:46.760
I'm not sure.

37:46.760 --> 37:48.520
That'll be really interesting to see.

37:48.520 --> 37:49.400
It might...

37:51.860 --> 37:57.460
Oh, it might be because he's doing offset from argc to arg2.

38:00.140 --> 38:00.700
Adder...

38:00.700 --> 38:02.440
Set win.

38:04.220 --> 38:05.340
Global ioctl.

38:05.340 --> 38:08.880
I don't think that's how that ioctl works.

38:09.540 --> 38:10.420
Oh!

38:11.280 --> 38:12.560
That makes sense.

38:12.560 --> 38:14.800
He's doing both in one syscall.

38:14.800 --> 38:15.160
Yeah .

38:15.160 --> 38:18.960
Because it'll just ignore that second argument.

38:18.980 --> 38:24.060
So you can just put your value in there, put the address to that, so you don't have to come back around.

38:24.060 --> 38:25.260
That totally makes sense.

38:25.280 --> 38:26.620
So that'll just work.

38:26.960 --> 38:27.280
Wow.

38:27.280 --> 38:30.040
I'm surprised it doesn't fail on invalid argument numbers.

38:30.040 --> 38:30.880
I won't care.

38:30.880 --> 38:32.000
It won't know.

38:32.000 --> 38:35.060
It doesn't know until it gets into the kernel and does the switch statement.

38:35.060 --> 38:36.440
I guess it has to be fast.

38:36.440 --> 38:37.440
Why does it do argchecker?

38:37.440 --> 38:38.540
Well, yeah, why would you do that?

38:38.540 --> 38:40.580
That's a perf loss and Linux is fast.

38:40.580 --> 38:45.360
So this, I'm pretty sure Orgertrout's on a very, very, very good path here.

38:45.360 --> 38:47.020
They're on a laser path.

38:47.020 --> 38:48.320
They have...

38:48.320 --> 38:50.040
Do they have the address computed?

38:50.040 --> 38:52.780
Do they know the offset of arg2?

38:52.780 --> 38:54.160
But it's exactly what they have to do.

38:54.160 --> 38:55.460
They have the address of arg2.

38:55.460 --> 38:57.980
They calculated argc-ox24.

38:57.980 --> 39:01.200
Then they're basically, like, right there.

39:01.200 --> 39:01.960
Yeah.

39:02.220 --> 39:03.320
That's looking pretty good.

39:03.320 --> 39:05.380
Let's check in on strawhat and realstrawhat.

39:05.380 --> 39:05.860
Okay.

39:05.860 --> 39:09.020
They're still doing this, like, invalid ioctl.

39:09.020 --> 39:10.020
Oh, you know what?

39:10.020 --> 39:11.520
That's what I was talking about.

39:11.520 --> 39:13.120
They're doing an invalid ioctl.

39:13.120 --> 39:15.780
They're putting a value deeper on the stack.

39:15.780 --> 39:18.200
They'll come back around, and then they're going to do their writes.

39:18.200 --> 39:20.140
So that's interesting.

39:20.140 --> 39:25.300
I like Orgertrout's more, even though strawhat is doing it the way that I initially thought of.

39:25.300 --> 39:27.520
I feel like Orgertrout's is a little restrictive.

39:28.360 --> 39:29.600
I think it's cleaner.

39:29.600 --> 39:32.640
I think it's cleaner because it's guaranteed it's one pass.

39:32.640 --> 39:36.060
You don't have to do an invalid ioctl, which is nice.

39:36.640 --> 39:42.240
It's just a little quieter for, you know, you don't want the IDS to figure out your exploit here.

39:42.240 --> 39:44.140
So you want to keep the errors to a minimum.

39:44.140 --> 39:46.480
You want to have a nice, clean environment.

39:46.480 --> 39:47.600
Yes, exactly.

39:47.600 --> 39:48.500
Exactly.

39:48.820 --> 39:53.440
So it looks like we're trying to figure out AW8.

39:53.460 --> 39:54.560
Write 8?

39:54.560 --> 39:55.160
AW8?

39:55.160 --> 39:56.480
Address write 8?

39:56.780 --> 39:58.280
Address write 8.

39:58.640 --> 39:59.440
Maybe.

40:01.420 --> 40:08.300
And they're going to be using org4, which makes sense here, because they're doing the four arg ioctl.

40:08.600 --> 40:11.220
And yeah, now we're doing some math in it.

40:11.220 --> 40:12.100
Oh, hang on.

40:12.100 --> 40:15.380
Over on Orgertrout, we're calculating the base address to...

40:15.380 --> 40:16.840
What function was that?

40:16.840 --> 40:20.700
Is he trying to pivot to the scanner for like a cleaner arbrite?

40:21.780 --> 40:22.640
God, I don't know.

40:22.640 --> 40:24.800
I feel like this arbrite's about as clean as you can get.

40:24.800 --> 40:26.080
Yeah, it really is.

40:26.980 --> 40:27.960
Pass in numbers.

40:27.960 --> 40:28.940
It puts numbers.

40:28.940 --> 40:29.640
I'm happy with this.

40:29.640 --> 40:31.300
Have we seen a crash yet?

40:31.560 --> 40:33.240
We've had the debugger open.

40:33.240 --> 40:35.740
I think a debugger has only been...

40:35.740 --> 40:37.080
It's only been control C.

40:37.080 --> 40:37.780
Yeah.

40:38.280 --> 40:40.520
So I'm excited to see our first crash.

40:40.520 --> 40:41.920
Oh, we have a rock going.

40:42.520 --> 40:43.640
We wait.

40:43.840 --> 40:44.480
Rock?

40:44.480 --> 40:46.260
It looks like he's writing red.

40:47.120 --> 40:49.760
It looks like he has arbrite on top of the stack.

40:50.540 --> 40:51.180
OK.

40:51.180 --> 40:52.100
And he's overwriting the puts.

40:52.100 --> 40:53.380
Does it have railroad, though?

40:53.380 --> 40:54.860
Is he writing...

40:54.860 --> 40:59.540
You will be able to skip over the cookie, which is very nice for this primitive.

40:59.600 --> 41:01.360
No, just being able to poke wherever you want immediately.

41:01.360 --> 41:04.640
Oh, yeah, it's just the beautiful, beautiful primitive.

41:04.680 --> 41:04.960
Yeah .

41:04.960 --> 41:06.860
But it looks like...

41:06.860 --> 41:08.780
I don't know if this binary has railroad.

41:09.320 --> 41:11.420
Because... or full, partial, whatever.

41:11.420 --> 41:11.860
Yeah.

41:11.860 --> 41:17.300
But he wants to jump to puts unless he's just going to use puts as a lead.

41:18.520 --> 41:19.260
Interesting.

41:19.260 --> 41:21.540
Because I assume he's going for, like, a got overwrite.

41:21.580 --> 41:23.000
Yeah, I guess so.

41:24.140 --> 41:24.940
Huh.

41:25.700 --> 41:27.380
I'm going to have to close chat.

41:27.380 --> 41:29.520
I'm running out of battery right now on my phone.

41:30.640 --> 41:31.760
All right.

41:31.760 --> 41:32.880
Red adder equals red adder.

41:34.320 --> 41:36.140
Oh, I'm making progress here.

41:36.140 --> 41:36.820
Yeah.

41:36.880 --> 41:37.640
Straw hat.

41:37.640 --> 41:43.900
Now it's really a matter of what approach are you going to pick to land, or get your executioner, or leak the flag.

41:43.900 --> 41:47.100
I think all of these you're supposed to run a command to win.

41:47.100 --> 41:48.620
You run, like, a shell command?

41:48.620 --> 41:53.000
You get a shell, you run the submitter, and a little happy message pops up.

41:53.000 --> 41:53.500
Interesting.

41:53.500 --> 41:56.220
So I don't know what puts is going to be for.

41:56.220 --> 41:57.280
What was added here?

41:57.280 --> 42:03.300
Like, Orgicrout is about to check if they crash on invalid access to 414141.

42:03.420 --> 42:04.320
OK.

42:05.520 --> 42:09.580
And it looks like they're just going to send their option.

42:11.180 --> 42:12.620
Wait a minute.

42:14.080 --> 42:15.940
Are we back to brute forcing?

42:15.940 --> 42:16.440
No, no.

42:16.440 --> 42:18.180
He wrote our option for this.

42:18.860 --> 42:23.500
Well, then why are we working on a brute force loop enumerate all the octal thing?

42:23.500 --> 42:24.460
I think he's just...

42:24.460 --> 42:26.000
Oh, that's where his code was.

42:26.000 --> 42:26.220
Yeah.

42:26.220 --> 42:27.180
Yeah, OK.

42:27.260 --> 42:29.620
OK, so now he's got to switch back over.

42:29.740 --> 42:30.880
I see.

42:31.120 --> 42:32.860
Yeah , required argument not an integer.

42:33.340 --> 42:34.840
Usually numbers are good.

42:38.560 --> 42:38.960
Now...

42:39.840 --> 42:43.720
All right, so he's going to be debugging that for, oh, there we go, u64.

42:43.780 --> 42:44.780
Hang on.

42:45.440 --> 42:46.060
Cool.

42:46.060 --> 42:46.800
And what did we get?

42:46.800 --> 42:47.640
Where's rip?

42:47.640 --> 42:48.700
Are we in puts?

42:48.760 --> 42:49.600
We're in puts.

42:49.600 --> 42:50.460
We're in puts.

42:50.460 --> 42:51.540
We're red on puts.

42:51.540 --> 42:52.860
Red is...

42:52.860 --> 42:54.280
And we got a success.

42:54.720 --> 42:55.520
Wow.

42:55.620 --> 42:56.820
So, yeah, it looks like...

42:56.820 --> 42:57.420
The stack is A.

42:57.420 --> 42:58.440
He's writing the format.

42:58.440 --> 43:00.920
Yeah, that's looking pretty good.

43:00.920 --> 43:02.320
That's looking really good.

43:02.320 --> 43:03.460
It's close.

43:03.600 --> 43:05.060
Let's check in on straw hat.

43:05.060 --> 43:06.220
Let's see where we're at.

43:06.620 --> 43:07.300
I'll keep an eye on him.

43:07.300 --> 43:10.740
We should have an arbitrary write here.

43:10.740 --> 43:12.980
I think we're going to probably see that crash.

43:12.980 --> 43:18.620
I don't know if he's going to try and write maybe over that return address and just see what happens.

43:18.620 --> 43:21.820
You also have the arb read, which is quite nice to have.

43:21.820 --> 43:25.000
I don't know if you really need to use that.

43:25.000 --> 43:26.040
I mean, you have binary base.

43:26.040 --> 43:28.660
You can just read a PLT and be like, oh, I'll just appear.

43:28.700 --> 43:29.460
Yeah.

43:31.080 --> 43:34.560
Yeah, have any of them looked for a win function yet?

43:34.960 --> 43:36.700
I don't think there is a win function yet.

43:36.700 --> 43:37.940
Okay, no win function?

43:37.940 --> 43:38.380
Yeah.

43:38.380 --> 43:41.080
I imagine if there was a win function instead of A's, he'd just put that.

43:41.080 --> 43:41.660
Yeah.

43:41.660 --> 43:42.700
Yeah, exactly.

43:42.700 --> 43:44.740
Like, you would just be done at this point.

43:45.020 --> 43:51.940
So, I mean, there could be a win function they haven't looked yet, and that would be rough.

43:51.980 --> 43:52.680
Oh.

43:52.680 --> 43:53.460
You know?

43:54.380 --> 43:54.860
So...

43:54.860 --> 43:56.620
We've been in this one function, yeah.

43:56.940 --> 43:57.760
Huh.

43:58.240 --> 43:59.200
Yeah.

43:59.700 --> 44:02.480
Okay, so Orgicrout running their script again.

44:02.480 --> 44:02.960
Okay.

44:02.960 --> 44:04.600
They have print out of...

44:04.600 --> 44:05.680
Is that libc?

44:06.600 --> 44:07.300
7foe?

44:07.300 --> 44:08.920
That doesn't look like stack address.

44:13.280 --> 44:14.860
That looks like the libc link.

44:14.860 --> 44:16.300
7 hex bytes.

44:16.680 --> 44:17.400
Yeah.

44:17.400 --> 44:19.340
Either libc or ld, I don't know which.

44:21.760 --> 44:24.500
Unmapped address, context failed.

44:25.320 --> 44:29.600
So, they're actually hamstrung by their Jeff installation.

44:29.600 --> 44:32.140
They just had a Python, like, int access error.

44:32.140 --> 44:33.220
Oh, no.

44:33.780 --> 44:34.360
Oh, no.

44:34.360 --> 44:36.620
So , I really hope it doesn't come down to that.

44:36.620 --> 44:38.220
Because they are...

44:38.220 --> 44:39.440
They got a libc leak.

44:39.440 --> 44:40.520
They have the libc.

44:40.520 --> 44:43.740
They can calculate offset to exec be and pass whatever they want.

44:43.740 --> 44:45.060
Exactly, yeah.

44:45.520 --> 44:48.000
And yet, they're calculating the leak right now.

44:48.000 --> 44:49.220
Or unpacking it.

44:49.220 --> 44:49.920
Yep.

44:52.560 --> 44:53.940
U64, what does that do?

44:53.940 --> 44:55.260
Is that just parses it?

44:55.300 --> 44:55.500
Unpack 64 .

44:55.500 --> 44:55.640
Oh.

44:55.640 --> 44:58.120
It just bytes and turns them into int versus an int.

44:58.120 --> 45:01.020
Oh, so you don't have to do struct.unpack every time.

45:01.020 --> 45:02.580
Oh, that's quite nice.

45:02.580 --> 45:03.220
Yeah.

45:03.880 --> 45:07.200
Hey, we got a SIGSAT, that PC of 414141 on strawhat.

45:07.200 --> 45:08.800
Oh, this is really close.

45:08.800 --> 45:10.420
So, now we got that going.

45:10.420 --> 45:12.200
Strawhat is not 4141.

45:12.200 --> 45:14.380
But Orgicrout is calculating offset to exec be.

45:14.380 --> 45:15.160
I know.

45:15.160 --> 45:16.140
I know.

45:16.740 --> 45:18.420
Oh, my goodness.

45:19.980 --> 45:21.040
That's tough.

45:21.040 --> 45:26.500
It really comes down to how quickly can you go from that.

45:26.500 --> 45:27.680
What is this all the gadgets?

45:27.680 --> 45:29.440
Strawhat's about to pull up...

45:29.440 --> 45:32.000
Oh, I thought they were going to pull up all the gadgets function.

45:32.000 --> 45:33.640
I was very curious what that was.

45:33.640 --> 45:34.380
Because that...

45:34.380 --> 45:36.280
What if that just has...

45:36.280 --> 45:38.580
What if that is a win function or something like that?

45:38.780 --> 45:42.300
Because that function has not been needed for anything else yet.

45:42.300 --> 45:46.640
It's clearly in there, like, intentionally.

45:46.640 --> 45:47.560
Oh, yeah.

45:47.560 --> 45:49.500
We're looking for the got here.

45:49.980 --> 45:52.400
And we've got ioctyl in there.

45:52.400 --> 45:59.100
So, we're actually going to try and use the address of the ioctyl entry in the got.

46:00.320 --> 46:02.700
Oh, so they don't have to call a different function.

46:02.700 --> 46:04.840
They just look back around and it's there for you.

46:04.840 --> 46:05.880
Okay, that's kind of nice.

46:05.880 --> 46:06.580
So, we'll see.

46:06.580 --> 46:07.920
Oh, hang on.

46:07.940 --> 46:08.400
Okay.

46:08.660 --> 46:09.240
Orgicrout.

46:09.240 --> 46:11.840
I see rop.call libc.symbol system.

46:12.440 --> 46:12.820
Wow.

46:12.820 --> 46:13.620
This is...

46:13.620 --> 46:15.540
Is that going to work out of the box?

46:15.620 --> 46:16.020
Yeah.

46:16.020 --> 46:18.840
I mean, they set the base address of libc.

46:18.840 --> 46:21.280
They loaded it as an ELF.

46:21.540 --> 46:22.740
No, PwnTools is nice.

46:22.740 --> 46:23.340
Yeah.

46:23.820 --> 46:25.840
I've just never really used PwnTools.

46:25.840 --> 46:29.280
Oh, oh, over here on Straw Hat, we're looking at RopGadgets.

46:29.440 --> 46:31.760
Oh, so they're both building chains right now.

46:31.760 --> 46:34.520
One of them looking manually and one of them is PwnTools building.

46:34.840 --> 46:39.320
Mm, yeah, we got a PopRDI gadget.

46:39.320 --> 46:40.940
It looks like a PopRDI ret.

46:40.940 --> 46:44.600
So, just straight up prepping for gadgets.

46:44.600 --> 46:50.640
This is basically manual versus the machine at this point.

46:50.860 --> 46:55.500
Well, Orgicrout now doing system on BSS.

46:57.440 --> 46:58.020
Okay.

46:58.020 --> 47:01.580
And then time.not.sleep, and then they're sending bin.sh, I guess.

47:03.160 --> 47:05.560
Yeah, we'll see if that drops us in.

47:05.560 --> 47:06.140
Oh , no , no, no, no, no.

47:06.140 --> 47:08.280
They forgot the null byte at the end of bin.sh.

47:09.060 --> 47:11.040
Do you need to manually specify that?

47:11.040 --> 47:11.800
Yeah.

47:12.280 --> 47:13.280
Nuntep has no...

47:13.280 --> 47:14.800
Oh, they put it too early.

47:14.800 --> 47:16.480
They loaded libc later, I guess.

47:16.560 --> 47:16.920
Oh.

47:16.920 --> 47:18.280
Or they type out the libc name.

47:18.280 --> 47:18.820
Oh.

47:18.820 --> 47:19.940
Oh, it's just that libc.

47:19.940 --> 47:20.660
Weird line.

47:20.660 --> 47:22.780
You just need to help libc, so.

47:23.160 --> 47:24.640
Oh, this is tough.

47:24.640 --> 47:27.160
See, this is where manual sometimes can get ahead.

47:27.160 --> 47:30.400
I think manual should always be slower in this case.

47:30.580 --> 47:41.420
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.

47:43.140 --> 47:43.700
Right.

47:44.040 --> 47:44.200
Right.

47:44.260 --> 47:45.620
PwnTools, you need to go look up docs.

47:45.620 --> 47:47.420
Well, not docs.man7.org, of course.

47:47.420 --> 47:47.620
Right.

47:47.620 --> 47:49.100
But you need to go look up docs.

47:49.100 --> 47:50.060
You need to figure out how it works.

47:50.060 --> 47:51.260
You need to debug anything that went wrong.

47:51.260 --> 47:52.420
Figure out what the return code is.

47:52.740 --> 47:54.920
This, you're just like, oh, you know, my gadget's right here.

47:54.920 --> 47:55.400
Yeah.

47:56.360 --> 47:56.920
This is...

47:57.280 --> 47:59.620
This is going to be pretty tight, I think.

47:59.780 --> 48:00.040
Yeah.

48:00.120 --> 48:00.960
Let's see.

48:00.960 --> 48:01.260
Yeah.

48:01.260 --> 48:07.040
Over on OrgaCrow, we just got the error, cannot send a migrated chain, which is one of those usage overhead things.

48:07.040 --> 48:07.460
Right.

48:07.460 --> 48:09.020
Because I have no idea what that means.

48:09.020 --> 48:10.280
Yeah, I don't know what that means either.

48:10.280 --> 48:12.860
They slid it around in memory, and now it's bad.

48:12.860 --> 48:14.860
Oh, wait a minute.

48:14.900 --> 48:15.600
Is that a shell?

48:15.600 --> 48:16.800
That might be a shell.

48:16.800 --> 48:18.520
He just needs to click left.

48:19.100 --> 48:20.600
No, don't control C it.

48:23.140 --> 48:25.620
Or is he just going straight live right away?

48:26.080 --> 48:27.320
Does he just... no.

48:27.420 --> 48:28.440
Is he going live?

48:28.440 --> 48:29.740
I think he went live.

48:30.380 --> 48:30.940
Live?

48:30.940 --> 48:32.540
Cannot append to a migrated chain.

48:33.840 --> 48:35.160
Still no idea what that means.

48:35.160 --> 48:35.620
Yeah.

48:35.620 --> 48:37.820
Why did it work like sometimes, and sometimes it doesn't?

48:37.820 --> 48:38.400
I don't know.

48:38.400 --> 48:40.780
Oh, he forgot dot strip, I guess.

48:42.480 --> 48:44.620
Nope, cannot append to a migrated chain.

48:44.960 --> 48:45.800
Huh.

48:45.800 --> 48:47.880
Yep, and this is where it's really dangerous.

48:47.880 --> 48:50.380
He's scratching his head over on straw hat.

48:50.380 --> 48:51.320
Yep, all the gadgets.

48:51.320 --> 48:53.780
So all the gadgets is literally everything you want.

48:53.780 --> 48:56.840
It is your pop RDR, your pop RSP, your pop RBP.

48:56.840 --> 48:59.180
So it is literally all the gadgets.

48:59.180 --> 49:01.980
I now see what that function is.

49:02.100 --> 49:11.420
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.

49:11.440 --> 49:13.000
Because this is the risk of PwnTools.

49:13.000 --> 49:14.700
This is why I'm always scared of this.

49:14.700 --> 49:20.020
When stuff breaks, it's just, you're in a really tough spot.

49:20.080 --> 49:20.980
Yeah , really.

49:21.000 --> 49:22.980
Yeah, still having that error over there.

49:22.980 --> 49:24.160
Still making constant progress.

49:24.160 --> 49:25.820
But here we're just making progress.

49:25.820 --> 49:28.940
We're making constant progress.

49:29.200 --> 49:33.540
And I'm sure PwnTools will just automagically work once it's figured out.

49:33.540 --> 49:36.040
Did he just delete all that code?

49:36.040 --> 49:37.320
Or just move it around?

49:37.320 --> 49:40.600
I think he deleted it.

49:40.980 --> 49:41.900
Huh.

49:42.400 --> 49:44.160
And then let's see.

49:44.160 --> 49:49.580
We got a pop RDI, puts main, quit.

49:49.580 --> 49:50.580
Let's see.

49:50.580 --> 49:53.740
Is this really going to go down to a ROP race?

49:53.740 --> 49:56.540
Yeah, this is definitely a ROP race.

49:56.540 --> 49:58.140
Oh , stop using PwnTools ROP.

49:59.120 --> 50:03.480
It's fine if you really know how to use it, but it looks like it's a little unfamiliar with it.

50:03.480 --> 50:08.240
And left justify, this is some advanced Python right here.

50:08.240 --> 50:11.100
Well, he wants to load it, make sure it's 8 bytes exactly.

50:11.100 --> 50:11.340
Yeah.

50:11.340 --> 50:14.160
So he's just left justify with probably null bytes.

50:14.160 --> 50:15.580
Yep, that's exactly what he's doing.

50:15.760 --> 50:17.940
U64, you have a clean load into Python.

50:17.940 --> 50:18.600
Yeah.

50:19.680 --> 50:22.560
And we're doing an NM over here on libc.

50:22.560 --> 50:26.840
It looks like we're trying to get some addresses out of libc.

50:28.720 --> 50:29.600
OK.

50:33.150 --> 50:36.510
And we've been told it's a minute to sudden death.

50:36.610 --> 50:38.230
A minute to sudden death.

50:38.230 --> 50:38.830
A minute.

50:39.250 --> 50:41.690
They better start ROPing like they've never ROPed before.

50:41.690 --> 50:44.130
They have to ROP their butts off.

50:44.270 --> 50:45.850
That's going to be really tough.

50:45.850 --> 50:51.010
I don't think these are 60 seconds away, unless PwnTools automatically starts working.

50:51.010 --> 50:51.990
I don't know.

50:51.990 --> 50:53.590
If you can append to a migrated chain.

50:53.590 --> 50:56.110
Oh , it's really close.

50:56.110 --> 50:57.350
Oh, it's so close.

50:57.350 --> 50:58.230
I feel so bad.

50:58.230 --> 50:59.910
ROPing live is so difficult.

50:59.910 --> 51:00.770
You're just like...

51:00.770 --> 51:01.630
Oh, gosh.

51:01.630 --> 51:04.650
You have to keep all of this stack space in your head.

51:04.650 --> 51:06.790
You have to know where you're stashing all your stuff.

51:06.790 --> 51:08.850
I can barely pop lock and now they want me to ROP it?

51:08.850 --> 51:09.410
Yeah, exactly.

51:09.410 --> 51:10.170
How?

51:10.890 --> 51:11.630
Nice.

51:11.630 --> 51:12.330
Nice.

51:12.670 --> 51:13.910
That was pretty good.

51:13.910 --> 51:14.830
Thank you.

51:15.710 --> 51:16.510
Yeah.

51:18.050 --> 51:18.450
Strawhats...

51:18.450 --> 51:21.010
Oh, Strawhats kind of paused here.

51:21.010 --> 51:21.550
Are they both...

51:21.550 --> 51:22.690
They're both...

51:22.690 --> 51:24.410
They're both stopped in their tracks.

51:24.410 --> 51:25.210
I think...

51:25.670 --> 51:28.570
I think Jordan just went and told them that we're going to sudden death.

51:28.570 --> 51:29.270
I see.

51:29.330 --> 51:30.130
OK.

51:31.990 --> 51:32.890
No way.

51:33.490 --> 51:42.490
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.

51:43.570 --> 51:48.450
Bare gets, format string bugs, what commands do you want me to run, basically?

51:49.030 --> 51:54.010
Now, those are probably one of the hardest for me because I don't think I've ever done, like, easy challenges.

51:54.010 --> 51:54.910
So I don't know...

51:54.910 --> 51:57.510
Like, I don't think I've ever done a printf bug before.

51:57.570 --> 51:58.090
Really?

51:58.090 --> 51:58.610
No.

51:58.630 --> 51:59.610
I don't think it's ever come up.

51:59.610 --> 52:00.890
Straight in the kernel?

52:00.890 --> 52:02.990
Yeah, I mean, it's just...

52:02.990 --> 52:05.170
I've never seen them in real life.

52:09.040 --> 52:11.440
I've just been signaled something in semaphore.

52:11.440 --> 52:14.540
Yeah, I don't necessarily know how to read that, but I think...

52:14.540 --> 52:16.340
Oh, is there a third hint that got put?

52:16.340 --> 52:16.840
No.

52:16.840 --> 52:17.400
What?

52:17.460 --> 52:18.280
What's going on?

52:18.280 --> 52:19.700
All the terminals are closing.

