I’ve read two articles about heap-spraying: Wikiepdia and this blog post.
I understand how the shell code is introduced in to the program’s memory. But how the program is made to jump/call to the address memory located on heap?
What kind of crash makes a call to heap?
Does such attack needs to be conducted with a kind of buffer overflow attack?
Is there any golden rule like the one with buffer overflow ie use the n version of functions (strncpy instead strcpy)?
If I understand correctly,
They’re talking about a situation like this:
And when you read into
bufferthere’s no overflow protection, and you can write directly into the memory location forp. Later on when your code tries to callp, it will jump to where the attacker wants it to jump, presumably where they injected executable code into your app.Simple fix: Don’t use static buffers (prefer the
std::collection classes) and always check for overflows.