I'm unable to understand how arbitrary code execution vulnerabilities are supposed to work.

Wikipedia mentions:


  Arbitrary code execution is commonly achieved through control over the instruction pointer of a running process.


Say, the vulnerability is being triggered by some maliciously crafted file that said process is reading. How could it modify the instruction pointer, or, otherwise, corrupt the internal state of the application so as to cause it to execute the attacker's code?

Also, given that modern OSes implement DEP and ASLR, how is this even feasible? The data loaded from the application would not even be executable, and additionally, it's also difficult to determine the offset of the shellcode/payload.

Brownie points for showing a small snippet of code that would be vulnerable to such an exploit.


Question: How to make animated buttons in a menu with Cocos2d?
Answer: Here is a discussion that may be of some value.


How to flip an image to its back?