start	end	text
3980	11320	Hello, and welcome back to live CTF. I'm Josh, aka Nagasora, coming back for another cast
11320	13800	back to back. And I'm joined by...
13800	18580	Gamoza! Hello! It's good to be here. I'm super excited to be doing this live. Last year I
18580	22940	did this, I think, over Discord with like a 60 second delay, and that made it a little
22940	27380	awkward because I was commentating on things that had happened in the past.
27380	29680	Yeah, the late CTF doesn't really have the same rig to do it.
29680	35180	No, no, it definitely doesn't. So I'm super excited for this. So who do we got going up
35180	39280	here? We've got Straw Hat versus Orga Kraut?
39800	42640	Organizers and Sour Cloud, maybe?
42640	44060	Okay, all right.
44060	45000	They're a merger team.
45000	46260	Making a big team.
46500	50140	Because they got rid of team size caps or something recently at DEF CON?
50140	51360	Oh, I don't know actually.
51360	54820	Because I remember like everyone started joining and making these like bigger and bigger teams,
54820	56580	which is just kind of interesting to see.
56580	56960	Yeah.
57420	60900	Well, Shellfish, I don't know if they've ever had a real cap because Shellfish has had
61320	62880	hundreds of people it feels like.
62880	67740	Yeah, exactly. Yeah. All right. Well, I think everyone's ready, right?
67740	69780	Yeah. You want to go over and give it a countdown?
69780	72360	Ooh, a five or a three?
72400	73740	Let's give it a five.
73740	74600	We'll give it a five?
74600	76280	Yeah, you know, really ramp it up.
76280	83000	All right. Let's get ready in five, four, three, two, one.
83080	83620	Go.
83620	85940	All right. Let's see what we got.
86460	90420	First over at Orgacrout, they are downloading the challenge.
90420	91780	Classic first step.
91920	93300	Okay. Oh, I like this.
93300	96100	We've got the anime background here, which I love to see.
96180	97980	Does anyone know this character?
98240	99560	I guess not character.
99560	100720	This anime.
101080	102500	Ooh, right into AIDA.
102500	104080	No Binary Ninja here.
104080	104660	No Binjo.
105100	106360	We haven't seen Binjo.
106360	107460	We haven't seen Ghidra.
107460	107840	Okay.
107840	109060	Only AIDA so far.
109060	111560	I'm going to pull up a YouTube chat right now.
111560	115840	So that way I can interact with people.
115940	117040	See what they're saying.
117040	120520	Oh, yeah, exactly.
120840	122860	So immediately kind of going into here.
123660	126400	I've got Straw Hat right in front of me here.
126420	126900	Yeah.
127200	129320	Oh, interesting.
129320	131780	It has an Ubuntu VM set up.
131780	134280	It seems like everyone seems to like MacBooks.
134280	136320	Is that like a common thing?
136320	137040	It's pretty common.
137040	139520	I'm one of the holdouts for the Linux laptop.
139540	143400	And honestly, it's saving this broadcast because the info is running on it now.
143400	143900	Yeah.
143900	144360	Yeah.
144360	145580	No, that totally makes sense.
145580	146240	Let me see.
146240	148020	I'm grabbing the YouTube link.
148120	148500	All right.
148500	153920	So they're going into AIDA and they immediately go into Docs.
153940	155740	POSIX OpenPT.
156400	157740	It's interesting.
157880	163020	I definitely find myself opening the main pages in a browser way more than I probably should
163020	166020	when I'm on a system that has main pages in the terminal.
166020	166960	Absolutely.
167260	167740	But...
167740	168140	I don't know why.
168140	170240	It just feels nicer.
170720	171520	CheckSec.
171520	172640	What is that?
172640	173260	CheckSec.
173260	174760	So it prints common protections.
174760	175020	Okay.
175540	177100	Ah, I see.
177100	177840	I see.
177840	178380	Yep.
178380	178980	All right.
178980	179300	Yeah.
179300	180240	It's pretty nice.
180240	184160	The command line one used to have a really bad bug where it would report incorrect values.
184160	184540	Oh.
184540	185860	So that's very useless.
185860	187220	It was useless.
187220	189460	It was just actually harmful sometimes.
189460	194080	But then I think that's been fixed because it matches up with my VDD output every time.
194080	194760	Yeah.
195120	195560	All right.
195560	197520	I have the chat up now.
197520	198320	Very nice.
198680	200580	Do you want to put it somewhere here in the middle?
200580	200600	Sure.
200600	201220	Put it right in the center.
201220	202060	My eyesight isn't that good.
202060	202480	Yeah.
202480	203900	You know, the glasses are deceiving.
204200	205000	All right.
205020	207960	So ttyioctl.
207960	208500	All right.
208500	209920	I haven't looked much at the challenge.
209920	211480	I was too busy on my phone.
211480	211620	Yeah.
211620	215120	So the name of the challenge is IOCTL or IO Control.
215120	216080	Me maybe.
217180	221060	It is from a series of challenges from Glenn.
221160	221720	Okay.
221780	223900	It's notorious for cursed challenges.
224160	224980	Ah.
225060	228580	In the past, there have been torque engine challenges.
228640	229300	There have been...
230480	231400	What is it?
231400	234500	Rock with weird instructions only.
234500	239620	Oh, knop me maybe was one where it's like you have to jump into the middle of knops.
239680	240040	Yeah.
240040	241260	Let's start checking on Orgacrout.
241260	242320	What are they up to right now?
242320	242740	Yeah.
243040	243840	Orgacrout.
244020	248640	It looks like Stack Overflow, which is never a great sign.
248780	249180	Yeah.
249380	250080	Let's see.
250080	254700	I did see that ChatGPT was open on the Straw Hats side.
254700	254820	Yeah.
254820	256020	It's the very first tab.
256020	258340	So we might see some AI going on.
258340	262820	Honestly, in the hierarchy, I'd put man page, Stack Overflow, ChatGPT.
262820	264800	But obviously, it's upside down.
264800	266340	So ChatGPT is the move.
266500	267060	Now, let's see.
267060	269700	I think we're both on the same website.
269700	272160	We're both looking at man7.org.
272160	276680	So it just seems like this is the way to do man pages on macOS.
276680	279180	I guess, does macOS not have man pages?
279180	281000	Is that not a thing?
281000	282420	No, it has man pages.
282420	284560	But this is a very Linux-specific challenge.
284560	284940	OK.
284940	286160	I don't know if they transfer over.
286160	287520	I don't know if the options are different.
287540	289180	Oh, yeah.
289620	292580	Like, we're going to be learning this challenge with y'all, with them.
293220	295040	We didn't write this.
295040	296120	We haven't looked at it.
296120	296420	No.
296420	299060	No, we're basically solving this at the same time.
300160	300800	Interesting.
300800	302860	Just a lot of Googling right now.
302860	303540	It's only...
304360	307520	I'm curious if the challenge is just a simple, like,
307520	309860	IOPTL call and you need to get the ARGs right or something.
309860	315560	We haven't seen anyone really keep a disassembler or decompiler open for more than two seconds.
315560	318040	Straw Hat is typing up Python.
318040	319180	We do have our first...
319180	319740	Straw Hat is typing Python.
319740	322100	We have from PwnImport star.
322100	324700	We're getting ready to just get everything going.
324700	325260	Everything they need.
325260	326520	Yes, yes.
326640	327440	I don't know.
327440	329960	I'm always really afraid to import star.
329960	332020	I'm always afraid that's just going to make a mess of...
332020	332680	It's super...
332680	334800	Do you call it a namespace in Python?
334800	335760	Is that the correct term?
335760	336600	It's a module.
336600	337460	A module?
337460	338280	Okay.
338440	339780	Nothing is namespace Python.
339780	341120	It's only global.
341120	342520	Everything is global.
342520	344040	The locks are global.
345060	346400	Not for long.
346400	347240	There's that...
347240	348460	I saw that.
348460	350600	Almost a PR that removes the GIL.
351300	352760	Is that going to be like when...
353380	354020	What was it?
354200	356420	OpenBSD removed their global lock.
356420	358600	Every time you made a syscall, there'd be a global lock.
358600	362560	And they removed that and immediately erased conditions on every single syscall.
362560	363000	No way.
363000	363320	Yep.
363320	365100	You're telling me that processes are hard?
365380	366700	It's very difficult.
366740	370280	Especially when you have an OS designed for single-threaded stuff.
370280	373180	What do you know about highly parallel processes?
374340	375120	Interesting.
375120	376200	So we're really just deep...
376200	380060	Both are just in the deep man pages.
380060	382540	I think they're on the same page right now.
382820	386400	StrawHat over there reading something very closely.
386460	386760	Yeah!
386760	387940	Actually, OrgeKrout over here...
387940	389480	Okay, well, as I say it...
389480	394220	OrgeKrout creating a C script to try and figure out what IOCTL does.
394480	395180	Oh, yeah.
395180	395900	Okay.
396120	398980	So you got a launch in the process, going interactive.
398980	402000	And I think that's something we see a lot when we're doing CTF stuff.
402000	404820	People love dropping into that interactive prompt.
404820	408700	So they can just start banging out things, trying out stuff.
408800	409620	And let's see.
409620	412300	Do we have the first challenge running here?
412380	415720	That's one of the big differences and approaches we saw last challenge, even.
415720	417680	Was one team went completely static.
417700	420540	And really labeled so many things before even interacting with one.
420540	421300	No way!
421300	423380	The other team was in GDB breaking on every option.
423720	424340	Yep.
424340	426640	And they were really close to one another.
426640	429360	The receive until main is.
429580	429900	Okay.
429900	431660	Not using read until wrapper.
431660	432520	Oh, I see.
432520	433820	Is this an info disclosure?
433820	435680	Just right on the command line?
435680	438580	It just tells you where main is and where RxE is?
438580	439440	Yeah, it is.
439440	440220	That's great.
440220	442300	Why don't my Chrome exploits tell me that?
443300	444800	That would be really convenient.
444800	445800	Because Chrome lost track of it too.
445800	447100	It has so much memory to keep track of.
447100	447840	I guess.
447840	448360	Yeah.
448360	449340	That's true.
449500	450600	What do you want?
450600	451980	Is the question here.
452800	454120	We can maybe read some...
454120	454920	Oh, nope.
454920	455680	Code's gone again.
455680	456780	Code's gone again.
457000	457780	Jeez.
457980	458200	All right.
458200	459040	And then over here...
459680	459700	Oh my god.
459700	461480	Yeah, over here at Orgacrout.
461840	462360	Orgacrout.
462360	464460	They are xattering.
464800	466940	This is a really fancy terminal.
466940	467820	Oh, they're using PwnTemplate.
468240	468740	PwnTemplate?
468740	473680	It kind of creates a little working directory for you with PwnTools and pipenv.
473680	476220	And it makes a PwnTools skeleton and stuff like that.
476220	477780	I personally don't use it.
477780	480040	But the last time I looked at it, it was kind of simple.
480040	482820	Is that an emoji on that terminal there?
482820	487640	Yeah, they have a snake emoji and a little steering wheel for a docker maybe.
487640	488720	Like a ship wheel.
488720	489220	Huh.
489220	490200	All right.
490240	491200	That's pretty fair.
491200	497380	So here we're just basically parsing out all of the printouts that you're getting.
497380	501100	And there hasn't been much reading of code, which is interesting.
501140	503760	That's honestly the approach that I normally go for,
503760	507640	is just banging it out immediately going into dynamic stuff.
507640	509000	Yes, but what I saw there for a second,
509000	512000	it looks like you're just getting an IOPTL call with args that you specified.
512000	514580	Yeah, which would be pretty slick.
514580	518560	But I don't know what sort of things you can do.
518560	520360	Is it on a TTY?
520360	522240	I didn't actually see what file is being opened.
522240	524440	We're switching between these screens so fast.
525640	527020	Too many arguments.
527560	531580	Oh, so it looks like you get to pick.
532180	537660	I think I saw a zero arg where you have the IOPTL number,
537660	540460	and then it looks like two, three, and four.
540460	544100	And it will prompt you, I guess, for the IOPTL code.
544100	545360	So that's interesting.
545360	552600	We're actually writing a function here to properly do these IOPTLs,
552600	554280	which is pretty fancy.
554280	556240	Yeah, does it allocate a VTTY or what?
556240	558020	I didn't actually see what it opened.
558020	560420	I've only seen it for like a split second.
560420	562680	Yeah, can I get a nod or a head shake?
563240	566380	A PTY, okay.
566380	567580	Okay, we get a PTY.
567580	569060	Is it dev PTY?
569640	570920	Dev PTY 3.
570920	572480	PTY 3, okay.
572600	575240	Now, my favorite thing is PTMX,
575240	580500	which I think is what basically everyone uses when they're doing their basic Linux exploits.
580500	585920	For some reason, I can't remember what it was about the shape of that data structure that it allocates.
585920	591560	It's just very convenient for using in your exploits and overriding the dispatch handles.
591720	594960	Maybe it's just because it's really easy to get access to on Android.
594960	597360	I think it has no permissions required.
597360	599000	I haven't done Android exploits yet.
599000	600900	This is so fancy.
601100	602140	Look at this.
602140	602860	Right?
602860	603760	It's really colorful.
603760	604440	I like it.
604440	607180	I'm really impressed that we're seeing a function.
607180	608000	Oh, here we go.
608140	609860	Orgacrout scrolling through IDA.
609860	615520	We see the project's OPPT 258, unknown what enum value that is.
615520	616320	Huh.
616780	617280	Okay.
617280	618320	Info leak.
618320	619000	And then it just...
619000	621200	Oh, it looks like we're going to get that main page for this.
621420	622300	Compromised password.
622300	623140	That's not a good sign.
623140	624220	They better get that fixed.
624220	625040	Yeah, they have to.
625040	625620	Yeah.
625620	627200	It prints that when you start to challenge it.
627200	627660	All right.
627660	630540	So it looks like you give it...
631080	632140	Oh, some flags.
632140	632480	Okay.
632480	633220	So it's probably...
633220	636060	I'm guessing it's going to be like read-write or something like that.
636060	636380	Yeah.
636460	637000	Pty.
637000	641040	I wonder if you can maybe corrupt a value in that struct.
641260	643680	Yeah, that's kind of interesting.
643680	644800	I'm trying to think if like...
645340	647600	Look at the ads on this page.
647600	649300	Oh, this is great.
649480	652640	We found the CTF player that doesn't run AdBlocker.
652640	653120	Yeah.
653120	654140	Well, how does that work?
654140	654600	It's just...
655580	656640	I don't know.
656640	658640	They just scrolled in really menacingly.
658640	661120	I mean, I guess maybe...
662360	662840	Let's...
662840	663340	Oh, this...
664420	665920	Docstore.mic.ua...
665920	666540	What is this?
666540	670540	Are we just like reading a book on how iOctals work?
670540	671300	I guess so.
671300	672100	That's pretty good.
672100	674480	We're going to walk away from this with so much knowledge.
674480	675240	I like Straw Hat.
675240	680260	Straw Hat's doing exactly the approach that I would do, which is going into user include,
680260	683520	grepping for the thing, trying to find exactly how these are made.
683520	685760	And this is literally exactly how I do it.
685760	690300	Anytime I want to figure out what does that code actually turn into is this.
690300	695100	And the reason that's so complex is those I-O codes are all like macro-based.
695100	696760	So I think that's an I-O...
696760	698340	It's an I-O-W.
698340	704100	The fact that it's a right I-Octal, the T is the special code that they're going to use.
704100	706360	Probably stands for TTY in this case.
706500	709040	And then it also has an int, which is the arg.
709060	712020	And in that macro, it's going to use sizeof.
712020	717640	And basically, the I-O control code has the T in there, which is like a magic identifier.
717640	720400	Some flags about if it's read, write, or whatever.
720400	722560	And then the size of the args.
722560	724320	And I forget what the 31 hex is.
724320	725660	That's kind of interesting.
726440	731300	Oh, and here we have a standard printout where you just go in for the %x.
731460	733340	I think we're just ignoring that warning now.
733340	736300	He's working in an isolated environment just trying to figure out what it does.
736300	737060	What does it transform?
737060	738040	What can I touch?
738040	741740	You know, he obviously knows all the addresses that were leaked from his own code.
741740	742100	Right.
742100	743580	So it's essentially...
743580	746900	He's rewriting the challenge to try and figure out what it can do.
747120	748580	Context log level debug?
748580	749740	Do you know what that does?
749740	750200	Yeah.
750200	753760	PwnTools, that prints like every transmit, every receive, the sizes of things.
753760	755880	Do you get like a hex printout when they run?
755880	756720	Oh, nice.
757180	762500	Yeah, it looks like we have to find some way to do corruption on our own process
762500	766680	using just these TTY octal codes.
766980	770280	And I think I could be really wrong on this.
770280	776520	I think octals are hierarchical, where you can have some generic TTY ones.
776520	779080	But then beyond that, you can have pseudo TTY ones.
779080	781160	And they kind of build on top of each other.
781160	784240	So I think a pseudo TTY like inherits TTY.
784240	786020	I could be very wrong about that.
786020	786860	I have no idea.
787380	788960	That's more than I know about.
789600	793600	It's been a long time since I've read advanced programming in the Unix environment.
793600	794360	That's for sure.
794360	794940	I think it is.
794940	796060	Yeah, no, I never did.
796060	796460	Yeah.
797020	798440	But this is kind of fun.
798440	800660	I really do like this as a challenge.
800840	802260	Ah, looking for...
802260	803120	Yeah, get it.
803120	806560	There's a getter for the window size, a setter for the window size.
806840	809560	And it looks like, yeah, if you called that getter,
809560	815260	it's going to probably fill out that structure where you get rows, columns, x pixels, and y pixels.
815280	820360	And, you know, it'd be kind of cool if we could see someone go after that,
820360	824560	maybe use some weird x command to, like, force the terminal to some weird size,
824560	827060	and then write some shellcode with the window size.
827060	829800	I'm wondering if TTYs have a maximum size up there that...
829800	830980	I have no idea.
831040	834320	Like, can you just have it go way off the screen or, you know...
834840	835080	Huh.
835080	835940	I assume you can.
835940	840320	I'm sure there's a better way to get, like, arbitrary outputs.
840320	840740	Oh, yeah.
840780	845060	TIO, I don't know if we're limited to the I-O control code that we have.
846100	849240	And let's check in on Orgicrout, let's see what they're doing.
849480	850400	Yeah, okay.
850400	851900	So Orgicrout going through...
851900	852420	They're trying...
852420	854080	They're going to try every IOC.
854100	856080	They're going to run this thing with every IOC.
856080	857560	Now, that's what we call fuzzing here.
857560	861900	That is an advanced security technique, and that's a really good way to find bugs.
861920	865920	So I think this is an interesting approach.
865920	866480	We have...
867100	868520	It looks like no functions here.
868520	869000	We're doing a...
869720	870460	Wow.
870840	875860	So I guess we're just going to blast the apples until we get a result.
875860	876080	Now...
876080	877920	I really hope they don't run out of that piece.
877920	884320	I will say, from Python, it's going to be really hard to enumerate all four billion combinations.
884320	887760	And the I-O control codes are pretty well spaced,
887760	892920	because some of those, like, read-write flags are spaced in just weird ways.
892920	894400	So I've done this before.
894400	896620	I've brute-forced I-O control codes.
896620	900800	But if you really want to do that, the best way to do it is to enumerate,
900800	904440	like, understand, basically, how the control code is packed,
904440	906500	and then, like, do reasonable numbers.
906500	909800	Like, I think the size might be the bottom 16 bits.
909860	914600	And none of these are going to really reasonably take more than, like, a 64-byte structure.
914600	917960	So you could really reduce the state space that you have to search.
918620	920120	That's just going to be a lot of iterations.
920120	922100	I don't know if he has time to write that.
922180	922900	That's true.
922900	923840	That's true.
923840	925280	So you just have that sitting around.
925280	928460	And yeah, we do have control of the I-Optimum number.
928460	930380	I don't think there's any filter.
930380	931320	I think this is purely...
931320	932300	No, there's all of them.
932300	937780	It looks like you just have an ARB number and ARB args on a PTY,
937780	938840	and you just have to...
939360	939940	Yep.
940100	942340	And you just have to find a way to make that work.
942340	945280	And I think that's probably not going to be too bad.
945280	945780	It looks like...
947240	950940	Oh, we're naming stuff over here on Straw Hat.
950940	953540	We're actually doing some AIDA stuff.
954080	956240	Actual reversing, which is kind of interesting.
956400	958860	I mean, honestly, I'd say this is pretty readable.
958860	961980	That shows me basically everything I need to know.
961980	965320	When 70% of your output is strings, I think I know what's going on.
965320	965900	Yeah.
966000	966960	So that's cool.
966960	972860	So it looks like you get the hexadecimal of where main is, where the stack is located.
973060	974380	And now you're just going to...
974380	976560	Is that getWindowSize?
976560	977340	Oh, there we go.
977340	978480	He just ran that.
978480	979100	And I think that's...
979100	980700	Yeah, he just threw his window to the right.
980880	981600	Yeah.
981600	983980	That's why he's running in poor man's demos.
984080	985940	So he can see the window changes.
986040	986240	Yeah.
986240	993680	So he has gotten the Iowa control codes for set and getWindowSize.
993680	996700	And honestly, that makes sense because you could just set the window size first
996700	998460	using that, what was it?
998460	1000980	Four ints or four shorts or something like that.
1001140	1002980	And then just call get.
1002980	1005540	And you'll just get the result at a different address.
1005540	1008260	So I feel like that's a pretty good approach.
1008260	1012960	Now, that does take a pointer to a structure, if I'm not mistaken.
1012960	1015640	I don't think it takes multiple args.
1015640	1022540	So how would you set the pointer to that structure that has the size of that TTY?
1022540	1025320	Well, you have the stack offset, and they allocate it right before.
1025320	1026720	So I'd assume it's on top of the stack.
1026720	1027380	Oh, OK.
1027380	1028740	Yeah, you're right there.
1028960	1032640	Do you have any good place on the stack where you can stash this?
1032640	1034180	They don't have any leak beyond that, though.
1034180	1035760	Right, right.
1035780	1038020	Like, you can't read stack memory.
1038020	1040640	Outside of, obviously, the struct.
1040640	1043320	Because you know where it is, you have things to interact with it.
1043520	1046420	So I'm curious to see where this goes.
1046420	1050400	This is really tough, because you have to kind of make the decision early on.
1050400	1054660	When you're doing these CTFs, it's like, should we commit to this?
1054660	1056400	Like, getting and setting the window size.
1056400	1059840	Obviously, if we can put a pointer to control data,
1059840	1063840	then we can set the window size, put a pointer to other data.
1063840	1067660	And now we have just overwritten something with control data.
1067660	1072940	I'm curious, if input is done on the stack, you can push it down,
1072940	1076320	maybe IOCTL pointer to the stack?
1076320	1077920	Or is the pointer just set in there?
1078020	1079600	Does it operate on top of the stack?
1079600	1082720	I don't actually know what that stack printout is.
1082720	1090380	Yeah, we print out, at the very top, it's argca,
1090380	1093080	which I don't know where that variable is on the stack.
1093080	1096620	If it just takes an FD, can't you FD standard in and make, like,
1096800	1098820	a fake and IOCTL stroke be a standard input?
1098940	1100840	I don't think you have control of the FD.
1102120	1103600	For the IOCTLs?
1103600	1105860	Yeah, doesn't it ask you what FD you want?
1106820	1107500	Hmm.
1108380	1110080	I think it's only the...
1110080	1111860	I'm getting a thumbs up from the author.
1112560	1113800	It asks for the FD?
1113800	1114740	I'm on the right track.
1114740	1115240	All right.
1115240	1116480	Ah, I see.
1116480	1116920	OK.
1117860	1118560	OK.
1118560	1120260	OK, every single parameter is controlled.
1120260	1120660	Nice.
1120660	1122740	OK, so you do get the FD.
1122740	1127720	So, yeah, I mean, Parliament of Ducks just got it.
1127720	1129220	OK, wow.
1129260	1130380	Wow, that was fast.
1130380	1131960	That was quite fast.
1131960	1133400	I'm curious what approach they did.
1133400	1138640	I'm thinking what it is, is you take FD0, you have standard in control,
1138640	1142080	it operates on standard input IOCTL, you send EOF after your fake struct
1142080	1145240	to be a standard input, and maybe there are function pointers in there?
1145240	1146980	I'm not really sure about the next part.
1146980	1147800	Hmm.
1148040	1149860	Do you have only IOCTL?
1150060	1151500	It's one IOCTL call, it looks like.
1151500	1152300	One IOCTL call.
1152300	1155540	OK, let's see.
1155540	1158100	Yeah, let's go back over to Orge Crowd.
1158100	1159560	They've been in IDA, too.
1159560	1163720	OK, and they're using the dark scheme in IDA, which is interesting.
1163720	1164380	Thank you.
1164380	1166980	Every time I use the dark scheme in IDA, I kind of regret it,
1166980	1171020	because some things just don't look right, or the colors are off,
1171020	1172400	or the highlighting is weird.
1172480	1173620	Yeah, I don't know what it is.
1173620	1177060	I don't know if it's gotten better or what.
1177680	1180920	But I remember, like, a couple times, like, you'd pop up a window,
1180920	1185100	like, just some weird, you know, listing of, you know, functions or something like that,
1185100	1187860	and it would just be white, or it would not match the color scheme,
1187860	1190500	and that would always just bleach your eyes.
1190500	1191660	Oh, it's painful.
1191660	1192640	I cannot light theme.
1192640	1194620	We have a couple of people in the office who light them.
1194620	1195000	Yeah.
1195740	1197420	I know it's better to read.
1197420	1200780	I know it's, like, technically supposed to be better for your eyes
1200780	1203440	and, like, your ability to, like, read the text.
1203600	1205360	But I'm not convinced.
1205360	1205820	I'm a dark theme.
1205820	1208840	I'll take the extra second for comfort.
1208840	1209580	Yeah.
1209580	1211000	So, what do we have over here?
1211000	1214440	Is it still... are we still doing the brute force of all the eye octals?
1214500	1216680	It looks like they have that in there, but they're working above it.
1216680	1219320	So, I wonder if they thought of another approach they want to try first.
1219320	1220660	Yeah, yeah.
1221700	1222340	Huh.
1222600	1224680	Oh, they got it for a second.
1225620	1227600	Oh, no, they're just trying to figure out how to run it, it looks like.
1227600	1228140	Okay.
1228620	1230000	Yeah, this is tough.
1230020	1232060	Yeah, okay, you have four different eye octals.
1232060	1236360	So, you can do 0 arg, 1 arg, 2 arg, or 3 arg, I think.
1236420	1237060	Okay.
1237840	1239560	And, yeah, this is really tough.
1239560	1242240	Like, do you want to commit to doing the window size approach?
1242240	1245240	Because, obviously, that's... I'm sure that's Turing complete.
1245240	1248120	You can probably get your arbitrary corruption with that.
1248680	1252680	But, is that the best eye octal?
1252680	1255420	Is that the easiest eye octal, or is there an easier one?
1255480	1257760	All of the eye octals are the best eye octal if they get you there.
1257760	1258820	Right, exactly.
1258820	1262560	Like, this is a solve it and solve it first challenge.
1262560	1263480	Yeah, yeah.
1263480	1266880	You're not trying to get undetected, you're not trying to get minimal size.
1266880	1270780	Over here on Straw Hat, it looks like we're looking at the stack overflow
1270780	1275520	on the responsibilities of each pseudo-terminal PTY component.
1275540	1277940	And look at that, we had a diagram up there?
1278260	1287500	That we are, like, I think we're, like, learning how, like, just PTYs work on Linux.
1287500	1289040	We're learning how to control IO.
1289040	1289460	Yeah.
1291080	1292660	This is interesting.
1292660	1298440	Okay, we're getting more and more different C printouts here of, basically,
1298440	1301960	what these IO control codes are, so we can go test them out, see how they go.
1301960	1304920	I do like that every time we come over here, their window is a little bit larger.
1305000	1306240	Yeah, yeah.
1307700	1312940	Look at this, Oracle Streams Programming Guide.
1314740	1317460	When you end up on an Oracle page, you know you're in.
1317460	1321080	Yeah, like, whenever I end up on Oracle, I'm getting out immediately.
1321080	1321840	Oh, yeah.
1321840	1323220	Oh, look at that, struct.pack.
1323220	1324760	Is this just the exploit right here?
1324760	1326000	No way.
1326000	1328460	Well, it's not, because that needs to be a pointer.
1328500	1330160	That is the right structure.
1330160	1331820	It is four shorts.
1331820	1337400	But you will need to put four shorts somewhere in memory, know the address of it,
1337400	1339580	and then give that address.
1339580	1340900	That's a lot of work, too.
1340900	1341580	Right.
1341580	1346320	And I haven't seen IDA enough to get the stack layout yet.
1346320	1351400	So I, like, don't know, like, because we know the stack address, we know where main is,
1351400	1355480	and it's like, where can we store some things that are controlled over the network or something
1355480	1360460	that we can end up, you know, writing out somewhere in memory,
1360460	1364240	or, I guess, storing in the kernel first, then writing out to memory with a GET request.
1364240	1366560	It looks like you can do multiple app calls.
1366560	1368400	Yeah, yeah, it does look like a loop.
1368400	1372520	Yeah, which I think should make this quite easy.
1372600	1377120	There's, I think, many of these, because a lot of these apps are getters and setters.
1377120	1377640	So you're just...
1377640	1379720	You transform that struct on the stack.
1379720	1380000	Right.
1380000	1381520	Have known data, known address.
1381520	1382660	Right, exactly.
1382820	1383220	Yeah.
1385180	1385980	Interesting.
1386680	1388060	Okay, so they're walking through.
1388060	1389440	They have lots of naked ones.
1390260	1390760	Huh.
1390760	1392700	Looks like they're just making invalid calls right now.
1392700	1393400	Yeah.
1393500	1393920	Yeah.
1393920	1395880	Let's check in on Orgacrout, see what they're doing.
1396160	1396960	Orgacrout?
1397600	1399260	They are making...
1399260	1401480	It looks like an array of interesting IOCTLs.
1401480	1401760	Okay.
1401760	1402360	That they want to...
1402360	1402780	Yep.
1402780	1406380	Oh, it might be that they're making a IOCTL chain.
1406380	1407040	I don't know.
1407040	1407740	Yeah.
1408120	1409160	IOCTL op.
1409740	1410340	Huh.
1412720	1414080	This is going to be very interesting.
1414080	1415520	This is really interesting.
1415520	1416360	Because we don't know where we're at.
1416360	1417700	Have we gotten a crash yet?
1418160	1418900	Oh, no.
1418900	1419620	There's the stack.
1419620	1423360	Okay, FD number, number of args, and then I think four args.
1423360	1425660	I think I got all those.
1425660	1426680	You're fast.
1426900	1427220	Yep.
1427400	1428560	FD number, number of args.
1428560	1428800	Yeah.
1428800	1429220	Yeah.
1429220	1431540	So you should know where those args are.
1431540	1434560	So if you were to just shoot...
1434560	1437960	I don't know if it's okay if you have invalid IOCTL.
1437960	1440580	I imagine it will just silently ignore it and just go through again.
1440580	1441520	We saw that on Straw Hat.
1441520	1442800	They were getting lots of negative one returns.
1442800	1448560	So I think what I would do is I would use like the three or the four arg version,
1448560	1450480	because I think they're 64-bit ints.
1450480	1455660	I don't know what they're doing for A2I or whatever that might limit the space of the ints.
1455720	1459500	But you should be able to do one pass through using the full things.
1459500	1460680	Who cares about the IOCTL?
1460680	1461640	Just let it fail.
1461640	1464480	That will set up the args on the stack.
1464660	1467100	And now you can come through and put a pointer to that.
1467100	1471400	And now you have control data that you can write to some data you point to.
1471400	1473300	Although you do have to dodge.
1473300	1477520	You might have to put them further up the arg stack, because you need the first args.
1477520	1479880	If you use one of these arguments first, then you can go back and just flubber the bottom one.
1479880	1480500	Exactly.
1480500	1481040	Yeah.
1481040	1483660	And that's, I think, the approach that I would take.
1483660	1486980	But once again, I haven't seen much of the IDA here.
1486980	1488600	You have args in known places.
1488600	1489000	Right.
1489000	1489720	Now what?
1489720	1490140	Right.
1490140	1490840	Yeah.
1490920	1492000	So I don't know.
1492000	1495000	I think just a setter, put it in the kernel temporarily,
1495000	1496980	and then get it back out into...
1496980	1499060	I'm sticking true to my standard input.
1499060	1499400	Yeah.
1500200	1501400	Standard input.
1501400	1502000	Yeah.
1502360	1505640	I'm sticking true to FD0, reading from FD0 for the IOctal.
1505640	1507560	But do you have access to a read?
1507560	1510520	Can you do a read through an IOctal?
1511540	1512340	Oh.
1512700	1514320	Oh, no, because it just asks for an FD.
1514320	1515360	It doesn't check if...
1515360	1515940	No?
1515940	1517660	Oh, because the FD's on the PTY.
1517660	1519780	Yeah, but you only have the IOctal sys call.
1519780	1521580	So how would you get that to do a read?
1521580	1526260	Like, is there a way to cause a read from standard in or whatever through an IOctal?
1526260	1527680	Or am I misunderstanding?
1528300	1529980	Well, I wonder if it's...
1529980	1532480	Can you buffer standard input, maybe?
1532480	1534420	Send the IOctal to FD0.
1534420	1537200	It doesn't prompt for input, but it reads the buffer data.
1537200	1539900	Like, you can buffer it in the choice input.
1540020	1540900	Hmm.
1542120	1542800	I'm not sure.
1542800	1543520	I don't know.
1543520	1544000	Okay.
1544000	1544700	Yeah.
1545400	1545720	Yeah.
1545960	1549780	Okay, and it looks like we're adding more libraries here.
1551420	1552860	Oh, you know what?
1552860	1562920	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.
1562920	1566960	Like, assuming we have full control, what kind of FD number are we going to get?
1566960	1573020	Now, that's going to be FD3, of course, because 0, 1, and 2 are allocated to your standard ins and outs.
1573140	1576000	And so he's going to print out a 3.
1576000	1577440	He doesn't have a helper in this terminal.
1577440	1578840	They'll shove his FDs further down.
1578840	1579280	Yeah.
1579280	1579440	Yeah.
1579440	1581780	It automatically allocates more.
1581840	1583960	And then, okay, we're getting these values.
1583960	1585000	Yep, and this makes sense.
1585000	1586220	You're going to get...
1587060	1588720	We're going to pass a ref.
1588720	1591380	So we're going to actually get the window size here.
1592140	1593400	This is really interesting.
1593400	1597480	So it's kind of dangerous, in my opinion, to keep going in and out of Vim.
1597480	1603800	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.
1603800	1604100	Really?
1604700	1606360	Oh, yeah, I forgot.
1606500	1608180	Vim 8 added that or whatever?
1608180	1611140	I think I just disabled that immediately.
1611260	1612280	Oh, that's so nice.
1612400	1615520	But it adds a bunch of temporary files, and I hate that.
1615520	1617920	Put it in your user directory or put it in something you can clean up and do.
1617920	1619180	So much work.
1619180	1619680	Oh, my.
1619680	1620440	So much work.
1620440	1622000	I've seen what you do on screens.
1623220	1625640	I keep my environment pretty default here.
1625640	1626880	Yeah, oh, yeah.
1628960	1631380	Well, it looks like these guys are using what works for them.
1631380	1631680	Yeah.
1631680	1635660	That happens to be four terminals kind of splayed out and man7.com.
1635660	1636260	Yeah.
1636260	1637040	Man7.org.
1637140	1638020	Man7.org.
1638020	1638960	I guess.
1639380	1643080	Which you would think Ubuntu would have the Linux man pages.
1643080	1643640	Oh, it does.
1643640	1644020	Yeah.
1644020	1644920	Oh, it has all of them.
1644920	1646960	Yeah, that's like...
1646960	1648700	Well, all of them for what you have, obviously.
1648840	1651000	So that's kind of interesting.
1651400	1652680	Chad, what do you say?
1652680	1662160	Do you normally use in-terminal man pages or do you end up on like a die.org or I guess man7.org?
1662160	1664200	I guess that's what the cool kids use these days.
1664200	1667380	It's just the first one that comes up because it has man in the domain, I guess.
1667380	1668100	Yeah.
1668840	1669800	SEO.
1670280	1671140	Huh.
1673380	1674800	That's pretty wild.
1674800	1677580	I feel like we're kind of looking at the same thing.
1677580	1681300	We're really, really committing to this getting and setting the window size.
1681300	1682020	Oh, my God.
1682020	1685580	And we're actually far enough in that the first hint has been released.
1685580	1686160	Okay.
1686160	1688620	We haven't seen what that hint is, have we?
1688620	1689040	We have.
1689040	1690720	Has anyone pulled up that hint?
1690720	1693880	They might need to be hinted at that there's a hint.
1694860	1696340	We're 20 minutes in.
1696340	1697100	Okay.
1697700	1698580	Okay.
1698780	1699580	Huh.
1700960	1701780	I don't know.
1701780	1705040	I think these approaches are pretty good.
1706080	1708980	Oh, and now we're doing S traits.
1708980	1710020	So now we're...
1710020	1711300	So Orgo Kraut.
1711420	1717860	Yeah, so Orgo Kraut has Ida open and that was interesting in the non-pseudocode view.
1718420	1721300	But yeah, it's literally just while read int, do another.
1721300	1723460	Yeah, you say zero or one if you want to read another.
1723460	1731500	So you have an arbitrary amount of arbitrary ioctals, arbitrary FD, arbitrary io-control code, arbitrary args.
1731500	1733620	So it is actually ioctal-oriented programming.
1733620	1734540	Yeah, yeah.
1734540	1736140	I think that's a great challenge.
1736140	1737540	I don't think I've seen that before.
1737540	1739300	It's just, it's brilliant.
1739300	1745500	That's Glenn's challenge is he just comes up with weird ideas and makes them, but they end up being really cool.
1745560	1746340	Huh.
1746340	1747240	I like that.
1747240	1753100	The other thing I was thinking about, which would be a fun challenge, is the...
1753100	1758080	What's this syscall that always has bugs and handles the locks and stuff on Linux?
1758080	1760940	The super fast locks.
1761140	1762140	Why am I blanking on it?
1762140	1765820	Was it Geohot's bug way back in the day was on this syscall?
1766160	1767380	Oh, jeez.
1767860	1769540	Oh, I forget what it is.
1769540	1771380	This is outside of my scope of knowledge.
1771380	1772600	I'm not a historian.
1772600	1777620	Oh, it's like the fundamental way that you do fast locks on Linux, where they're like,
1777620	1781200	you give it memory addresses and it will alert you when they've changed
1781200	1784580	so you can come back and try your atomic spin lock.
1784580	1788940	But that whole API is, I think, turn complete in the kernel.
1789080	1789360	Really?
1789360	1793660	You could, I'm pretty sure you could just give it straight up invalid addresses
1793660	1797680	because it won't crash your program because the kernel will fail to access it.
1797680	1801500	So that would allow you to just try random things.
1801500	1805300	Or if you don't know an ASLR location, you probably could just jam things in there.
1805300	1810700	And I think you can tell the kernel to increment or decrement a value at an address, which is fantastic.
1810700	1812780	So you can do address space pre-coursing in the kernel.
1812780	1813720	Yes, yes, yes.
1813720	1815540	So I've wanted to see that.
1815540	1816980	I've wanted to see that in exploits.
1816980	1818700	I've wanted to see it in just so many things.
1818700	1820680	I think it's a really cool way of doing it.
1820680	1822460	Futex, yes, Futex, exactly.
1822540	1823240	Futex.
1823240	1826860	Because Futex has a bunch of different operating modes.
1826860	1828280	Is it really buggy? I didn't know that.
1828880	1830500	Well, that's not even like the bug.
1830500	1832340	It used to be pretty buggy.
1832340	1837900	Like, there was one really big Futex bug, and I think that's what...
1837900	1840720	I think it was like a GeoHotBug way back in the day.
1841060	1843200	But it's just a really complex...
1843200	1847360	you know, immediately there's an enum of a bunch of different modes that you can hit in that.
1847820	1850340	So, and this kind of reminds me of that same thing.
1851520	1854000	In fact, I think that would apply here.
1854000	1860260	If you gave IOCTL an invalid address, the kernel's going to report back, bad adder.
1860260	1861920	It's not going to crash your program.
1861920	1865380	So if you need to make a couple guesses, in this case, I don't know why you would,
1865380	1867580	you have the address that you care about.
1868640	1871500	But, oh, we're in read int.
1871500	1872400	We're seeing what we get.
1872400	1879220	It looks like an LX was the read int command, which means that you will get the full 64 bits.
1879520	1880240	Oh, that's interesting.
1880240	1881600	The return code is 32.
1881880	1884660	On Straw Hat, they're adding hex to everything.
1884660	1886560	I think they weren't using hex.
1886560	1889720	And explicitly, it's pulling it in as hex.
1889840	1892240	And that really hurts.
1892240	1894300	This might be a bit of a breakthrough for them.
1894300	1896620	I think that is a pretty big breakthrough.
1896920	1898140	Oh, no.
1898500	1899320	Yeah.
1900100	1900660	Yeah.
1900660	1902840	Just goes to show, no one knows how this works.
1902840	1903480	Right.
1903480	1905420	Yeah, I mean, that's really tough.
1905420	1907880	That's the sort of thing that you get stuck on for a while.
1907880	1911880	I think that's why he went into GCC to try it out.
1911880	1913300	And then it probably worked in GCC.
1913300	1914300	And he's like, what the hell?
1914300	1917280	You can see, trying to do four ones.
1917280	1920340	He got bad adder from the IOCTL.
1921060	1922600	And that makes sense.
1922600	1924200	That totally makes sense.
1924440	1928000	So it looks like we're probably on a pretty fast path now.
1928000	1931840	I think Straw Hat should have a pretty direct route.
1931840	1933200	You know where your arcs are.
1933200	1934720	You know what you control on the stack.
1934720	1936860	I mean, that IDA output is fantastic.
1936860	1937860	They have that going now.
1937860	1940220	It's going to be smooth for them, whatever they want to do.
1940220	1941180	For sure.
1942440	1944500	What do we got going on, Orger Crout, over here?
1944500	1948280	Orger Crout is looking at PTY docs.
1949600	1951260	OK, you know.
1951260	1955600	I feel like we've almost had time to read through all of these docs by this point.
1955600	1959600	I feel like, if you just take screenshots of every frame,
1959600	1961580	you could see every IOCTL doc.
1961580	1961900	Right.
1961900	1963420	Like, you could have the full thing there.
1963420	1963760	Yeah.
1963940	1964940	Forgetman7.org.
1964940	1966580	Just pull up live CTM.
1966580	1967780	Right, right.
1969020	1969900	This is wild.
1969900	1970900	Oh, I think this is the...
1970900	1972140	TC Send Break?
1973020	1977800	OK, so he's just going through the TC Send Break.
1978660	1979740	Does that get you a write?
1979740	1982200	Because I imagine you're going to need an arbitrary write.
1983440	1986220	And so you're kind of going to need some sort of a getter.
1986220	1989220	I do like the window size, because you have a setter and a getter.
1989220	1990640	You can store stuff off.
1990640	1992680	You can pick it and then write it to another place.
1992680	1995700	I mean, basically, it's memcpy, but through the kernel.
1995700	1997840	Is the argument for that UN16?
1998980	2000260	For the IOCTL?
2001100	2002980	So all the arguments will be long.
2002980	2004500	So it will be 64-bit.
2004500	2010620	And so it'll just be one arg, which is a pointer to a structure.
2010660	2014700	And the structure is just four shorts that are packed in memory.
2015240	2016900	I don't know what the shorts are.
2016900	2022540	I think it's some pixel and column and size of the terminal sort of thing.
2023180	2026580	But it looks like that's what we're committing to on Straw Hat.
2026660	2032020	And Orgatron, I think, is still trying to decide what IOCTL they're on.
2032020	2034840	They were reading the same exact thing, actually.
2035520	2037640	They're thinking about the same approach.
2037640	2040620	Wow, and you get the IOCTL return.
2040620	2045000	So you could potentially use that if you needed to figure out
2045000	2047180	some information from the kernel.
2047180	2049180	I don't think that's necessary here.
2049180	2051900	I think you can do this plainly.
2051900	2053080	I don't think you need anything to fail.
2053080	2055600	I think you can use it to verify that your hard write worked.
2055600	2056600	Which is great.
2056600	2060700	It is great to have an oracle that stuff is going well.
2060700	2062820	It does only return you a 32.
2062940	2063080	Yeah.
2063550	2064800	Or I guess in 32.
2064800	2065600	Right.
2066540	2067540	Huh.
2069440	2071900	Yeah, we'll see what we're going to get here.
2071900	2073720	OK, we're doing some math.
2073780	2080080	So we're subtracting main from the main of the relocated thing.
2080080	2082860	This is going to give us basically the slide.
2082860	2086940	Or whatever this actual ASLR offset.
2088030	2090140	And that's good information to have.
2090140	2093680	I guess you'll need that because...
2093680	2095820	Is there a win function maybe they're calculating?
2095820	2097800	I don't know if there's a win function.
2097800	2101500	I don't know if they're just going to go right to like a system.
2101500	2103280	Oh, they're writing like ESS or something?
2103280	2103860	Yeah.
2103860	2104600	OK.
2104700	2105540	Read eight.
2105540	2106140	OK.
2106140	2108700	Making just a clean function for read eight.
2108700	2109160	OK.
2113100	2113720	IOCTL321523.
2113720	2114940	No hex there.
2115040	2115280	Which is...
2115280	2115980	Wow.
2117560	2118220	Interesting.
2118220	2120840	OK, and then we're passing in those args.
2121300	2123580	And I think now we're going to...
2123580	2127680	OK, now we're going for a straight read and write primitive.
2128140	2131420	I don't know if these values are controlled yet.
2131420	2133960	Yeah, this is just triggering the read to an address.
2134000	2136040	Triggering the write to an address.
2136440	2140040	And yeah, I guess it is an eight byte read and write because it's a four short.
2140040	2142460	So four times two is your eight.
2143260	2143700	So...
2143700	2145860	But that read isn't...
2145860	2146960	Oh no, well, yeah, yeah.
2146960	2148340	It's just the address.
2148340	2149620	Because it'll just return success.
2149620	2150020	That's right.
2150020	2150980	Yep, yep.
2152320	2154840	So it's really going to come down to what?
2154840	2156920	Yes, that is getting the read and write primitives.
2157040	2157460	Yeah.
2157460	2161680	Over on Orgacram, we had some math for a second there.
2161960	2166020	But it looks like they're going for an offset from arg two.
2166260	2167000	OK.
2167000	2167860	Unknown.
2168100	2171380	I think that is kind of similar to what I was thinking.
2171380	2176540	Because I think read int, I think that's getting a 64-bit hexadecimal value.
2176540	2180960	So if you want to go the approach where you are reading and writing
2180960	2185760	in arbitrary eight, I think you have to use the higher args, come back around.
2185760	2190080	You need to use the low arg one so that you have the address.
2190080	2192100	And then you can't clobber the other things.
2192100	2193600	But that should be totally fine.
2193600	2196020	I think that approach would just work.
2196360	2197340	Let's see.
2197360	2198860	AW eight.
2198860	2202140	Oh, wait a minute.
2202340	2202920	Oh.
2202920	2204180	Oh, I saw set seven.
2204180	2205000	I got excited.
2205000	2205600	OK.
2206460	2207280	Set win.
2207280	2209080	Oh, OK, they're throwing some As in there.
2209080	2213100	We're going to try and use address As, get and set window.
2213100	2216200	And so now it looks like we have the same approaches on both.
2216200	2218600	Oh, it's going to be a real close race.
2218600	2219040	Yes.
2220460	2221280	Huh.
2221280	2221980	OK.
2221980	2227300	Now it's starting to get more to like a mechanical thing of like,
2227300	2230700	how fast can you write the code to do the right thing, get that feedback?
2230700	2234240	Because I think both of them are clearly aware of the path
2234240	2236060	that they're going to take.
2236060	2236920	And I agree.
2236920	2238600	It's a winning path here.
2239240	2242900	Oh, it looks like they got a write of four bytes.
2243060	2243100	Yep.
2243100	2243880	There's yep.
2243880	2245460	There's that window size.
2245460	2248400	So that's the actual structure that they're going to be able to control.
2248500	2249080	Nice.
2249300	2254520	And I do think they're going to need to rely on the uninitialized memory.
2254720	2255580	Right. 32.
2255580	2258180	I don't think that's a 32 bit write.
2258180	2258720	He got a 32 bit write.
2258720	2259620	From what?
2259620	2260200	Do you know what?
2260200	2261120	From this?
2261300	2262720	I didn't see exactly what happened.
2262720	2264240	Yeah, I didn't see that either.
2264660	2265780	Okay.
2265880	2266760	I'm not sure.
2266760	2268520	That'll be really interesting to see.
2268520	2269400	It might...
2271860	2277460	Oh, it might be because he's doing offset from argc to arg2.
2280140	2280700	Adder...
2280700	2282440	Set win.
2284220	2285340	Global ioctl.
2285340	2288880	I don't think that's how that ioctl works.
2289540	2290420	Oh!
2291280	2292560	That makes sense.
2292560	2294800	He's doing both in one syscall.
2294800	2295160	Yeah.
2295160	2298960	Because it'll just ignore that second argument.
2298980	2304060	So you can just put your value in there, put the address to that, so you don't have to come back around.
2304060	2305260	That totally makes sense.
2305280	2306620	So that'll just work.
2306960	2310040	Wow. I'm surprised it doesn't fail on invalid argument numbers.
2310040	2310880	I won't care.
2310880	2312000	It won't know.
2312000	2315060	It doesn't know until it gets into the kernel and does the switch statement.
2315060	2316440	I guess it has to be fast.
2316440	2317440	Why does it do argchecker?
2317440	2318540	Well, yeah, why would you do that?
2318540	2320580	That's a perf loss and Linux is fast.
2320580	2325360	So this, I'm pretty sure Orgertrout's on a very, very, very good path here.
2325360	2327020	They're on a laser path.
2327020	2328320	They have...
2328320	2330040	Do they have the address computed?
2330040	2332780	Do they know the offset of arg2?
2332780	2334160	But it's exactly what they have to do.
2334160	2335460	They have the address of arg2.
2335460	2337980	They calculated argc-ox24.
2337980	2341200	Then they're basically, like, right there.
2341200	2341960	Yeah.
2342220	2343320	That's looking pretty good.
2343320	2345380	Let's check in on strawhat and realstrawhat.
2345380	2345860	Okay.
2345860	2349020	They're still doing this, like, invalid ioctl.
2349020	2350020	Oh, you know what?
2350020	2351520	That's what I was talking about.
2351520	2353120	They're doing an invalid ioctl.
2353120	2355780	They're putting a value deeper on the stack.
2355780	2358200	They'll come back around, and then they're going to do their writes.
2358200	2360140	So that's interesting.
2360140	2365300	I like Orgertrout's more, even though strawhat is doing it the way that I initially thought of.
2365300	2367520	I feel like Orgertrout's is a little restrictive.
2368360	2369600	I think it's cleaner.
2369600	2372640	I think it's cleaner because it's guaranteed it's one pass.
2372640	2376060	You don't have to do an invalid ioctl, which is nice.
2376640	2382240	It's just a little quieter for, you know, you don't want the IDS to figure out your exploit here.
2382240	2384140	So you want to keep the errors to a minimum.
2384140	2386480	You want to have a nice, clean environment.
2386480	2387600	Yes, exactly.
2387600	2388500	Exactly.
2388820	2393440	So it looks like we're trying to figure out AW8.
2393460	2394560	Write 8?
2394560	2395160	AW8?
2395160	2396480	Address write 8?
2396780	2398280	Address write 8.
2398640	2399440	Maybe.
2401420	2404700	And they're going to be using org4, which makes sense here,
2404700	2408300	because they're doing the four arg ioctl.
2408600	2411220	And yeah, now we're doing some math in it.
2411220	2412100	Oh, hang on.
2412100	2415380	Over on Orgertrout, we're calculating the base address to...
2415380	2416840	What function was that?
2416840	2420700	Is he trying to pivot to the scanner for like a cleaner arbrite?
2421780	2422640	God, I don't know.
2422640	2424800	I feel like this arbrite's about as clean as you can get.
2424800	2426080	Yeah, it really is.
2426980	2427960	Pass in numbers.
2427960	2428940	It puts numbers.
2428940	2429640	I'm happy with this.
2429640	2431300	Have we seen a crash yet?
2431560	2433240	We've had the debugger open.
2433240	2435740	I think a debugger has only been...
2435740	2437080	It's only been control C.
2437080	2437780	Yeah.
2438280	2440520	So I'm excited to see our first crash.
2440520	2441920	Oh, we have a rock going.
2442520	2443640	We wait.
2443840	2444480	Rock?
2444480	2446260	It looks like he's writing red.
2447120	2449760	It looks like he has arbrite on top of the stack.
2450540	2451180	OK.
2451180	2452100	And he's overwriting the puts.
2452100	2453380	Does it have railroad, though?
2453380	2454860	Is he writing...
2454860	2459540	You will be able to skip over the cookie, which is very nice for this primitive.
2459600	2461360	No, just being able to poke wherever you want immediately.
2461360	2464640	Oh, yeah, it's just the beautiful, beautiful primitive.
2464680	2464960	Yeah.
2464960	2466860	But it looks like...
2466860	2468780	I don't know if this binary has railroad.
2469320	2471420	Because... or full, partial, whatever.
2471420	2471860	Yeah.
2471860	2477300	But he wants to jump to puts unless he's just going to use puts as a lead.
2478520	2479260	Interesting.
2479260	2481540	Because I assume he's going for, like, a got overwrite.
2481580	2483000	Yeah, I guess so.
2484140	2484940	Huh.
2485700	2487380	I'm going to have to close chat.
2487380	2489520	I'm running out of battery right now on my phone.
2490640	2491760	All right.
2491760	2492880	Red adder equals red adder.
2494320	2496140	Oh, I'm making progress here.
2496140	2496820	Yeah.
2496880	2497640	Straw hat.
2497640	2499760	Now it's really a matter of what approach are you
2499760	2503900	going to pick to land, or get your executioner, or leak the flag.
2503900	2507100	I think all of these you're supposed to run a command to win.
2507100	2508620	You run, like, a shell command?
2508620	2513000	You get a shell, you run the submitter, and a little happy message pops up.
2513000	2513500	Interesting.
2513500	2516220	So I don't know what puts is going to be for.
2516220	2517280	What was added here?
2517280	2523300	Like, Orgicrout is about to check if they crash on invalid access to 414141.
2523420	2524320	OK.
2525520	2529580	And it looks like they're just going to send their option.
2531180	2532620	Wait a minute.
2534080	2535940	Are we back to brute forcing?
2535940	2536440	No, no.
2536440	2538180	He wrote our option for this.
2538860	2543500	Well, then why are we working on a brute force loop enumerate all the octal thing?
2543500	2544460	I think he's just...
2544460	2546000	Oh, that's where his code was.
2546000	2546220	Yeah.
2546220	2547180	Yeah, OK.
2547260	2549620	OK, so now he's got to switch back over.
2549740	2550880	I see.
2551120	2552860	Yeah, required argument not an integer.
2553340	2554840	Usually numbers are good.
2558560	2558960	Now...
2559840	2563720	All right, so he's going to be debugging that for, oh, there we go, u64.
2563780	2564780	Hang on.
2565440	2566060	Cool.
2566060	2566800	And what did we get?
2566800	2567640	Where's rip?
2567640	2568700	Are we in puts?
2568760	2569600	We're in puts.
2569600	2570460	We're in puts.
2570460	2571540	We're red on puts.
2571540	2572860	Red is...
2572860	2574280	And we got a success.
2574720	2575520	Wow.
2575620	2576820	So, yeah, it looks like...
2576820	2578440	The stack is A. He's writing the format.
2578440	2580920	Yeah, that's looking pretty good.
2580920	2582320	That's looking really good.
2582320	2583460	It's close.
2583600	2585060	Let's check in on straw hat.
2585060	2586220	Let's see where we're at.
2586620	2587300	I'll keep an eye on him.
2587300	2590740	We should have an arbitrary write here.
2590740	2592980	I think we're going to probably see that crash.
2592980	2597420	I don't know if he's going to try and write maybe over that return address
2597420	2598620	and just see what happens.
2598620	2601820	You also have the arb read, which is quite nice to have.
2601820	2605000	I don't know if you really need to use that.
2605000	2606040	I mean, you have binary base.
2606040	2608660	You can just read a PLT and be like, oh, I'll just appear.
2608700	2609460	Yeah.
2611080	2614560	Yeah, have any of them looked for a win function yet?
2614960	2616700	I don't think there is a win function yet.
2616700	2617940	Okay, no win function?
2617940	2618380	Yeah.
2618380	2621080	I imagine if there was a win function instead of A's, he'd just put that.
2621080	2621660	Yeah.
2621660	2622700	Yeah, exactly.
2622700	2624740	Like, you would just be done at this point.
2625020	2629260	So, I mean, there could be a win function they haven't looked yet,
2629260	2631940	and that would be rough.
2631980	2632680	Oh.
2632680	2633460	You know?
2634380	2634860	So...
2634860	2636620	We've been in this one function, yeah.
2636940	2637760	Huh.
2638240	2639200	Yeah.
2639700	2642480	Okay, so Orgicrout running their script again.
2642480	2642960	Okay.
2642960	2644600	They have print out of...
2644600	2645680	Is that libc?
2646600	2647300	7foe?
2647300	2648920	That doesn't look like stack address.
2653280	2654860	That looks like the libc link.
2654860	2656300	7 hex bytes.
2656680	2657400	Yeah.
2657400	2659340	Either libc or ld, I don't know which.
2661760	2664500	Unmapped address, context failed.
2665320	2669600	So, they're actually hamstrung by their Jeff installation.
2669600	2672140	They just had a Python, like, int access error.
2672140	2673220	Oh, no.
2673780	2674360	Oh, no.
2674360	2676620	So, I really hope it doesn't come down to that.
2676620	2678220	Because they are...
2678220	2679440	They got a libc leak.
2679440	2680520	They have the libc.
2680520	2683740	They can calculate offset to exec be and pass whatever they want.
2683740	2685060	Exactly, yeah.
2685520	2688000	And yet, they're calculating the leak right now.
2688000	2689220	Or unpacking it.
2689220	2689920	Yep.
2692560	2693940	U64, what does that do?
2693940	2695260	Is that just parses it?
2695300	2695500	Unpack 64.
2695500	2695640	Oh.
2695640	2698120	It just bytes and turns them into int versus an int.
2698120	2701020	Oh, so you don't have to do struct.unpack every time.
2701020	2702580	Oh, that's quite nice.
2702580	2703220	Yeah.
2703880	2707200	Hey, we got a SIGSAT, that PC of 414141 on strawhat.
2707200	2708800	Oh, this is really close.
2708800	2710420	So, now we got that going.
2710420	2712200	Strawhat is not 4141.
2712200	2714380	But Orgicrout is calculating offset to exec be.
2714380	2715160	I know.
2715160	2716140	I know.
2716740	2718420	Oh, my goodness.
2719980	2721040	That's tough.
2721040	2726500	It really comes down to how quickly can you go from that.
2726500	2727680	What is this all the gadgets?
2727680	2729440	Strawhat's about to pull up...
2729440	2732000	Oh, I thought they were going to pull up all the gadgets function.
2732000	2733640	I was very curious what that was.
2733640	2734380	Because that...
2734380	2736280	What if that just has...
2736280	2738580	What if that is a win function or something like that?
2738780	2742300	Because that function has not been needed for anything else yet.
2742300	2746640	It's clearly in there, like, intentionally.
2746640	2747560	Oh, yeah.
2747560	2749500	We're looking for the got here.
2749980	2752400	And we've got ioctyl in there.
2752400	2759100	So, we're actually going to try and use the address of the ioctyl entry in the got.
2760320	2762700	Oh, so they don't have to call a different function.
2762700	2764840	They just look back around and it's there for you.
2764840	2765880	Okay, that's kind of nice.
2765880	2766580	So, we'll see.
2766580	2767920	Oh, hang on.
2767940	2768400	Okay.
2768660	2769240	Orgicrout.
2769240	2771840	I see rop.call libc.symbol system.
2772440	2772820	Wow.
2772820	2773620	This is...
2773620	2775540	Is that going to work out of the box?
2775620	2776020	Yeah.
2776020	2778840	I mean, they set the base address of libc.
2778840	2781280	They loaded it as an ELF.
2781540	2782740	No, PwnTools is nice.
2782740	2783340	Yeah.
2783820	2785840	I've just never really used PwnTools.
2785840	2789280	Oh, oh, over here on Straw Hat, we're looking at RopGadgets.
2789440	2791760	Oh, so they're both building chains right now.
2791760	2794520	One of them looking manually and one of them is PwnTools building.
2794840	2799320	Mm, yeah, we got a PopRDI gadget.
2799320	2800940	It looks like a PopRDI ret.
2800940	2804600	So, just straight up prepping for gadgets.
2804600	2810640	This is basically manual versus the machine at this point.
2810860	2815500	Well, Orgicrout now doing system on BSS.
2817440	2818020	Okay.
2818020	2821580	And then time.not.sleep, and then they're sending bin.sh, I guess.
2823160	2825560	Yeah, we'll see if that drops us in.
2825560	2826140	Oh, no, no, no, no, no.
2826140	2828280	They forgot the null byte at the end of bin.sh.
2829060	2831040	Do you need to manually specify that?
2831040	2831800	Yeah.
2832280	2833280	Nuntep has no...
2833280	2834800	Oh, they put it too early.
2834800	2836480	They loaded libc later, I guess.
2836560	2836920	Oh.
2836920	2838280	Or they type out the libc name.
2838280	2838820	Oh.
2838820	2839940	Oh, it's just that libc.
2839940	2840660	Weird line.
2840660	2842780	You just need to help libc, so.
2843160	2844640	Oh, this is tough.
2844640	2847160	See, this is where manual sometimes can get ahead.
2847160	2850400	I think manual should always be slower in this case.
2850580	2855640	But in the off chance that PwnTools doesn't work out of the box or has some error,
2855640	2861420	you might end up fighting PwnTools more than you would have to fight just making the RopGadget.
2863140	2863700	Right.
2864040	2864200	Right.
2864260	2865620	PwnTools, you need to go look up docs.
2865620	2867420	Well, not docs.man7.org, of course.
2867420	2867620	Right.
2867620	2869100	But you need to go look up docs.
2869100	2870060	You need to figure out how it works.
2870060	2871260	You need to debug anything that went wrong.
2871260	2872420	Figure out what the return code is.
2872740	2874920	This, you're just like, oh, you know, my gadget's right here.
2874920	2875400	Yeah.
2876360	2876920	This is...
2877280	2879620	This is going to be pretty tight, I think.
2879780	2880040	Yeah.
2880120	2880960	Let's see.
2880960	2881260	Yeah.
2881260	2884860	Over on OrgaCrow, we just got the error, cannot send a migrated chain,
2884860	2887040	which is one of those usage overhead things.
2887040	2887460	Right.
2887460	2889020	Because I have no idea what that means.
2889020	2890280	Yeah, I don't know what that means either.
2890280	2892860	They slid it around in memory, and now it's bad.
2892860	2894860	Oh, wait a minute.
2894900	2895600	Is that a shell?
2895600	2896800	That might be a shell.
2896800	2898520	He just needs to click left.
2899100	2900600	No, don't control C it.
2903140	2905620	Or is he just going straight live right away?
2906080	2907320	Does he just... no.
2907420	2908440	Is he going live?
2908440	2909740	I think he went live.
2910380	2910940	Live?
2910940	2912540	Cannot append to a migrated chain.
2913840	2915160	Still no idea what that means.
2915160	2915620	Yeah.
2915620	2917820	Why did it work like sometimes, and sometimes it doesn't?
2917820	2918400	I don't know.
2918400	2920780	Oh, he forgot dot strip, I guess.
2922480	2924620	Nope, cannot append to a migrated chain.
2924960	2925800	Huh.
2925800	2927880	Yep, and this is where it's really dangerous.
2927880	2930380	He's scratching his head over on straw hat.
2930380	2931320	Yep, all the gadgets.
2931320	2933780	So all the gadgets is literally everything you want.
2933780	2936840	It is your pop RDR, your pop RSP, your pop RBP.
2936840	2939180	So it is literally all the gadgets.
2939180	2941980	I now see what that function is.
2942100	2945860	So since the ROP chain is going to be so simple here,
2945860	2951420	it might be best to just straight up go for the manual chain.
2951440	2953000	Because this is the risk of PwnTools.
2953000	2954700	This is why I'm always scared of this.
2954700	2960020	When stuff breaks, it's just, you're in a really tough spot.
2960080	2960980	Yeah, really.
2961000	2962980	Yeah, still having that error over there.
2962980	2964160	Still making constant progress.
2964160	2965820	But here we're just making progress.
2965820	2968940	We're making constant progress.
2969200	2973540	And I'm sure PwnTools will just automagically work once it's figured out.
2973540	2976040	Did he just delete all that code?
2976040	2977320	Or just move it around?
2977320	2980600	I think he deleted it.
2980980	2981900	Huh.
2982400	2984160	And then let's see.
2984160	2989580	We got a pop RDI, puts main, quit.
2989580	2990580	Let's see.
2990580	2993740	Is this really going to go down to a ROP race?
2993740	2996540	Yeah, this is definitely a ROP race.
2996540	2998140	Oh, stop using PwnTools ROP.
2999120	3003480	It's fine if you really know how to use it, but it looks like it's a little unfamiliar with it.
3003480	3008240	And left justify, this is some advanced Python right here.
3008240	3011100	Well, he wants to load it, make sure it's 8 bytes exactly.
3011100	3011340	Yeah.
3011340	3014160	So he's just left justify with probably null bytes.
3014160	3015580	Yep, that's exactly what he's doing.
3015760	3017940	U64, you have a clean load into Python.
3017940	3018600	Yeah.
3019680	3022560	And we're doing an NM over here on libc.
3022560	3026840	It looks like we're trying to get some addresses out of libc.
3028720	3029600	OK.
3033150	3036510	And we've been told it's a minute to sudden death.
3036610	3038230	A minute to sudden death.
3038230	3038830	A minute.
3039250	3041690	They better start ROPing like they've never ROPed before.
3041690	3044130	They have to ROP their butts off.
3044270	3045850	That's going to be really tough.
3045850	3051010	I don't think these are 60 seconds away, unless PwnTools automatically starts working.
3051010	3051990	I don't know.
3051990	3053590	If you can append to a migrated chain.
3053590	3056110	Oh, it's really close.
3056110	3057350	Oh, it's so close.
3057350	3058230	I feel so bad.
3058230	3059910	ROPing live is so difficult.
3059910	3060770	You're just like...
3060770	3061630	Oh, gosh.
3061630	3064650	You have to keep all of this stack space in your head.
3064650	3066790	You have to know where you're stashing all your stuff.
3066790	3068850	I can barely pop lock and now they want me to ROP it?
3068850	3069410	Yeah, exactly.
3069410	3070170	How?
3070890	3071630	Nice.
3071630	3072330	Nice.
3072670	3073910	That was pretty good.
3073910	3074830	Thank you.
3075710	3076510	Yeah.
3078050	3078450	Strawhats...
3078450	3081010	Oh, Strawhats kind of paused here.
3081010	3081550	Are they both...
3081550	3082690	They're both...
3082690	3084410	They're both stopped in their tracks.
3084410	3085210	I think...
3085670	3088570	I think Jordan just went and told them that we're going to sudden death.
3088570	3089270	I see.
3089330	3090130	OK.
3091990	3092890	No way.
3093490	3097970	Now, sudden death, as it was last year, and I think as I was told this year,
3097970	3102490	sounds like it's a really, really, really easy challenge.
3103570	3108450	Bare gets, format string bugs, what commands do you want me to run, basically?
3109030	3114010	Now, those are probably one of the hardest for me because I don't think I've ever done, like, easy challenges.
3114010	3114910	So I don't know...
3114910	3117510	Like, I don't think I've ever done a printf bug before.
3117570	3118090	Really?
3118090	3118610	No.
3118630	3119610	I don't think it's ever come up.
3119610	3120890	Straight in the kernel?
3120890	3122990	Yeah, I mean, it's just...
3122990	3125170	I've never seen them in real life.
3129040	3131440	I've just been signaled something in semaphore.
3131440	3134540	Yeah, I don't necessarily know how to read that, but I think...
3134540	3136340	Oh, is there a third hint that got put?
3136340	3136840	No.
3136840	3137400	What?
3137460	3138280	What's going on?
3138280	3139700	All the terminals are closing.
