Return to abort() – Using code introspection to prevent stack-smashing
1–10 of 21 posts
Re: Return to abort() – Using code introspection to prevent stack-smashing
#2Re: Return to abort() – Using code introspection to prevent stack-smashing
#3Why isn't the return address stored in a register instead of on the stack to avoid this in the first place?
Re: Return to abort() – Using code introspection to prevent stack-smashing
#4Re: Return to abort() – Using code introspection to prevent stack-smashing
#5Why isn't the return address stored in a register instead of on the stack to avoid this in the first place?
Re: Return to abort() – Using code introspection to prevent stack-smashing
#6Why isn't the return address stored in a register instead of on the stack to avoid this in the first place?
It has to get put on the stack at some point so you can call more than 1 function deep. So why not always put it on the stack so that you don't waste a valuable register?
Some very early CPU architectures didn't actually support either putting the return address in a register or on the stack. For instance, on the PDP-8 (https://en.wikipedia.org/wiki/PDP-8#Subroutines) the JMS instruction writes the return address to the first word of the subroutine it's about to call (and the actual subroutine entry point is just after that), which meant it didn't conveniently support recursion. It wasn't alone in that either -- I think that it just wasn't quite appreciated how important recursion/reentrancy was back in the early 60s when these ISAs were designed.
Re: Return to abort() – Using code introspection to prevent stack-smashing
#7So this limits the number of gadget options you have for ROP, but doesn't eliminate ROP entirely, right? It maybe increases the difficulty of ROP, if you can't find enough/sufficient gadgets that happen to start after function call sites. Not a silver bullet, anyway.
Re: Return to abort() – Using code introspection to prevent stack-smashing
#8So this limits the number of gadget options you have for ROP, but doesn't eliminate ROP entirely, right? It maybe increases the difficulty of ROP, if you can't find enough/sufficient gadgets that happen to start after function call sites. Not a silver bullet, anyway.
Re: Return to abort() – Using code introspection to prevent stack-smashing
#9So this limits the number of gadget options you have for ROP, but doesn't eliminate ROP entirely, right? It maybe increases the difficulty of ROP, if you can't find enough/sufficient gadgets that happen to start after function call sites. Not a silver bullet, anyway.
Re: Return to abort() – Using code introspection to prevent stack-smashing
#10So this limits the number of gadget options you have for ROP, but doesn't eliminate ROP entirely, right? It maybe increases the difficulty of ROP, if you can't find enough/sufficient gadgets that happen to start after function call sites. Not a silver bullet, anyway.
Well, it means that modulo hash collisions, a function can only return to one of the places which calls that function, so in the really tragic case (for example) that someone called a vulnerable function and then immediately after called system() with a stack variable as the arg, the attacker can just return there and make the arg point to "bash". But in general the whole business of knitting together assembly instru…