Ok, lets go ahead and wrap this up. Last part is wrapping everything up, and that means we need to actually /call/ execve("/bin/sh"). (icymi, execve = libc func to execute binary in place of current thread). This means we just need to get $eax -> str("/bin/sh") at this point.
-
Show this thread
-
We have 2 options: 1. ROP, which would def work but finding a gadget to get data out of the BSS and into
$eax sounds like a pain. 2. see if we can get the putchar caller to load a full 4 byte word into$eax instead of just 1 byte, like putchar expects. Let's try #21 reply 0 retweets 0 likesShow this thread -
Well, I'm a fool,
$eax isn't even the target. Keep forgetting the x86 calling conventions. Arg 1 of a remote call is passed in the stack, not in$eax. That's actually easier to set up, methinks, but I've been looking in the wrong place. There's probably an easier way to do this..pic.twitter.com/HOB2012itE
1 reply 0 retweets 1 likeShow this thread -
...but I'm kinda tempted to just see if I can also load an arb stack pointer and get rop of some kind. Let's see where this takes us.
2 replies 0 retweets 0 likesShow this thread -
looking at ropgadget --binary bf, (i.e. searching for all rop gadgets in the simple bf interpreter binary) gives a decent selection, but nothing that would give us good stack pointer control, during first look. There are plenty more gadgets in libc, but this is a rookie problem..pic.twitter.com/ZNLEZysrTS
2 replies 0 retweets 1 likeShow this thread -
...which makes me think that there's a good chance that this is definitely not how we're expected to do this. ROP in libc works, sure, but I'd like to figure out what they also expected me to do/find here.
2 replies 0 retweets 2 likesShow this thread -
Replying to @hedgeberg
Sometimes the fun in CTF problems is doing it the way they *didn't* expect you to do it. At last CCC's CTF we solved a challenge1 one way, then challenge2 worked with the exact same code. There was supposed to be an "easier" way for challenge1... but it looked more annoying.
1 reply 0 retweets 3 likes -
Replying to @marcan42
Yeah, I understand, but the thing is that I know the overarching "more challenging" methods for writing exploits. These are meant to teach tricks 1 by 1 and I'd like to figure out what the tricks are here that I'm missing. At least, I think that's reasonable?
1 reply 0 retweets 0 likes -
Replying to @hedgeberg
Sure, if you're trying to learn; I just find that if I already have a valid (if no "the" intended) solution there's a limit to how much time I'm willing to waste trying to find the "right" way. At some point it's more efficient to just look up a write-up for that.
1 reply 0 retweets 1 like -
Replying to @marcan42
Oh yeah absolutely, I just kinda find that I learn these kinds of tricks best when I'm teaching myself in media res. I know it ends up being wasted time, but I think I may genuinely be learning "better" this way... Or it's just placebo :/ Either way I'm having fun!
1 reply 0 retweets 0 likes
In toootally not related news I wrote a CTF level several years ago and everyone should totally try to solve it and tell me how they did it. https://mrcn.st/t/HackTris.zip
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.