5

I understand that referencing a variable out of its lifetime is a dangerous practice, and can enable someone to seriously circumvent the program logic. However the CERT C Programming Language Secure Coding Standard (last edited in 2007) references this as a level 3 vulnerability in terms of severity, which means it can lead to the user running arbitrary code. I would like an illustration of how this could be possible, or a reference to an article explaining it.

7

The issue of using of using memory outside its lifetime is that its content might have changed in an unexpected way.

Consider a dynamically allocated structure with a function pointer as field. If this memory is somehow freed, it is possible that the next memory allocation request points to this memory. An attacker controlling this memory might put data in it which is then interpreted as a function pointer to malicious code. This is an example of arbitrary code execution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.