-
Book Overview & Buying
-
Table Of Contents
Reverse Engineering Armv8-A Systems
By :
Let’s suppose that a variable in your program suddenly has an unexpected value, even though there is no code that sets it to that value. When this kind of issue happens, it can be difficult to troubleshoot.
If this happens accidentally, it is considered a bug in your program. However, if memory corruption is caused intentionally using malicious techniques, it is referred to as an exploit.
Let’s start analyzing the memory corruption symptom by looking at the following example code:
unsigned int task_state;
void set_task_state(unsigned int new_state) {
task_state = new_state;
}
This code looks simple. The set_task_state function is used to update the task_state global variable. Let’s assume that the set_task_state function is only designed to handle two valid states, defined as follows:
#define TASK_STATE_SLEEP 0
#define TASK_STATE_RUN 1
If you inspect...